| | |
| | | method: 'get', |
| | | params, |
| | | }) |
| | | } |
| | | // 图斑类型分页 |
| | | export const listOfSpotTypesApi = params => { |
| | | return request({ |
| | | url: `/drone-device-core/lotType/page`, |
| | | method: 'get', |
| | | params, |
| | | }) |
| | | } |
| | | // 图斑类型创建 |
| | | export const spotTypesCreateApi = (data) => { |
| | | return request({ |
| | | url: `/drone-device-core/lotType/create`, |
| | | method: 'post', |
| | | data |
| | | }) |
| | | } |
| | | // 图斑类型编辑 |
| | | export const editSpotTypeApi = (data) => { |
| | | return request({ |
| | | url: `/drone-device-core/lotType/updateType`, |
| | | method: 'put', |
| | | data |
| | | }) |
| | | } |
| | | // 图斑类型删除 |
| | | export const deleteSpotTypeApi = (data) => { |
| | | return request({ |
| | | url: `/drone-device-core/lotType/batch`, |
| | | method:'delete', |
| | | data |
| | | }) |
| | | } |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | |
| | | import {listOfSpotTypesApi,spotTypesCreateApi,editSpotTypeApi,deleteSpotTypeApi} from '@/api/patchManagement/index' |
| | | import { ref, computed, watch } from 'vue' |
| | | import { getListPage, getDetail, add, update, remove, enable, disable } from '@/api/resource/oss' |
| | | import { getListPage, getDetail, add, remove, enable, disable } from '@/api/resource/oss' |
| | | import { useStore } from 'vuex' |
| | | import func from '@/utils/func' |
| | | import { useRouter } from 'vue-router' |
| | | |
| | | import { ElMessage, ElMessageBox, ElLoading } from 'element-plus'; |
| | | const store = useStore() |
| | | const router = useRouter() |
| | | |
| | |
| | | const box = ref(false) |
| | | |
| | | const page = ref({ |
| | | pageSize: 10, |
| | | pageSize: 20, |
| | | currentPage: 1, |
| | | total: 0, |
| | | }) |
| | | |
| | | const selectionList = ref([]) |
| | | |
| | | const option = ref({ |
| | | addBtn: true, |
| | | addBtnText: '新增类型', |
| | |
| | | column: [ |
| | | { |
| | | label: '类型名称', |
| | | prop: 'name', |
| | | prop: 'lot_value', |
| | | search: true, |
| | | searchSpan: 4, |
| | | rules: [ |
| | |
| | | }, |
| | | { |
| | | label: '创建时间', |
| | | prop: 'ossCode', |
| | | prop: 'create_time', |
| | | rules: [ |
| | | { required: true, message: '请输入创建时间', trigger: 'blur' }, |
| | | ], |
| | | }, |
| | | { |
| | | label: '创建人', |
| | | prop: 'ossCode', |
| | | prop: 'user_name', |
| | | search: true, |
| | | searchSpan: 4, |
| | | rules: [ |
| | |
| | | |
| | | // ---------------- methods ---------------- |
| | | const rowSave = (row, done, loadingFn) => { |
| | | add(row).then( |
| | | () => { |
| | | onLoad(page.value) |
| | | ElMessage.success('操作成功!') |
| | | done() |
| | | }, |
| | | error => { |
| | | console.log(error) |
| | | loadingFn() |
| | | } |
| | | ) |
| | | console.log('row',row); |
| | | |
| | | // spotTypesCreateApi(row).then( |
| | | // () => { |
| | | // onLoad(page.value) |
| | | // ElMessage.success('操作成功!') |
| | | // done() |
| | | // }, |
| | | // error => { |
| | | // console.log(error) |
| | | // loadingFn() |
| | | // } |
| | | // ) |
| | | } |
| | | |
| | | const rowUpdate = (row, index, done, loadingFn) => { |
| | | update(row).then( |
| | | () => { |
| | | console.log('row',row); |
| | | |
| | | editSpotTypeApi(row).then( |
| | | (res) => { |
| | | console.log('res',res); |
| | | |
| | | onLoad(page.value) |
| | | ElMessage.success('操作成功!') |
| | | done() |
| | |
| | | cancelButtonText: '取消', |
| | | type: 'warning', |
| | | }) |
| | | .then(() => remove(row.id)) |
| | | .then(() => deleteSpotTypeApi([row.id])) |
| | | .then(() => { |
| | | onLoad(page.value) |
| | | ElMessage.success('操作成功!') |
| | |
| | | } |
| | | |
| | | const searchChange = (params, done) => { |
| | | console.log('list'); |
| | | console.log('list',params); |
| | | query.value = params |
| | | page.value.currentPage = 1 |
| | | onLoad(page.value, params) |
| | |
| | | } |
| | | |
| | | const beforeOpen = (done, type) => { |
| | | if (['edit', 'view'].includes(type)) { |
| | | getDetail(form.value.id).then(res => { |
| | | form.value = res.data.data |
| | | }) |
| | | } |
| | | // if (['edit', 'view'].includes(type)) { |
| | | // // getDetail(form.value.id).then(res => { |
| | | // // form.value = res.data.data |
| | | // // }) |
| | | // } |
| | | done() |
| | | } |
| | | |
| | |
| | | const sizeChange = pageSize => { |
| | | page.value.pageSize = pageSize |
| | | } |
| | | |
| | | const refreshChange = () => { |
| | | onLoad(page.value, query.value) |
| | | } |
| | | |
| | | const onLoad = (pageParam, params = {}) => { |
| | | const searchparams ={ |
| | | current:pageParam.currentPage, |
| | | size:pageParam.pageSize |
| | | } |
| | | loading.value = true |
| | | getListPage(pageParam.currentPage, pageParam.pageSize, Object.assign(params, query.value)).then(res => { |
| | | listOfSpotTypesApi(searchparams).then(res => { |
| | | const resData = res.data.data |
| | | console.log('列表',resData.records); |
| | | |
| | | page.value.total = resData.total |
| | | data.value = resData.records |
| | | loading.value = false |