diff --git a/src/api/device/borrow.ts b/src/api/device/borrow.ts index c5e1f79..7fd5f9c 100644 --- a/src/api/device/borrow.ts +++ b/src/api/device/borrow.ts @@ -54,13 +54,23 @@ }) } // 设备借用申请提交 +// export function submitApply(data: object) { +// return request({ +// url: '/equipmentApply/borrowEquipmentApply', +// method: 'post', +// data, +// }) +// } + +// 状态管理提交 export function submitApply(data: object) { return request({ - url: '/equipmentApply/borrowEquipmentApply', + url: '/meter/stateManage/submitStandardEquipmentApply', method: 'post', data, }) } + // 设备借用归还提交 export function returnApply(data: object) { return request({ diff --git a/src/api/device/borrow.ts b/src/api/device/borrow.ts index c5e1f79..7fd5f9c 100644 --- a/src/api/device/borrow.ts +++ b/src/api/device/borrow.ts @@ -54,13 +54,23 @@ }) } // 设备借用申请提交 +// export function submitApply(data: object) { +// return request({ +// url: '/equipmentApply/borrowEquipmentApply', +// method: 'post', +// data, +// }) +// } + +// 状态管理提交 export function submitApply(data: object) { return request({ - url: '/equipmentApply/borrowEquipmentApply', + url: '/meter/stateManage/submitStandardEquipmentApply', method: 'post', data, }) } + // 设备借用归还提交 export function returnApply(data: object) { return request({ diff --git a/src/components/NormalTable/table_interface.ts b/src/components/NormalTable/table_interface.ts index e080e57..d1f5b24 100644 --- a/src/components/NormalTable/table_interface.ts +++ b/src/components/NormalTable/table_interface.ts @@ -9,3 +9,4 @@ styleFilter?: Function // 文字过滤器 fixed?: boolean // 固定列 } + diff --git a/src/api/device/borrow.ts b/src/api/device/borrow.ts index c5e1f79..7fd5f9c 100644 --- a/src/api/device/borrow.ts +++ b/src/api/device/borrow.ts @@ -54,13 +54,23 @@ }) } // 设备借用申请提交 +// export function submitApply(data: object) { +// return request({ +// url: '/equipmentApply/borrowEquipmentApply', +// method: 'post', +// data, +// }) +// } + +// 状态管理提交 export function submitApply(data: object) { return request({ - url: '/equipmentApply/borrowEquipmentApply', + url: '/meter/stateManage/submitStandardEquipmentApply', method: 'post', data, }) } + // 设备借用归还提交 export function returnApply(data: object) { return request({ diff --git a/src/components/NormalTable/table_interface.ts b/src/components/NormalTable/table_interface.ts index e080e57..d1f5b24 100644 --- a/src/components/NormalTable/table_interface.ts +++ b/src/components/NormalTable/table_interface.ts @@ -9,3 +9,4 @@ styleFilter?: Function // 文字过滤器 fixed?: boolean // 固定列 } + diff --git a/src/views/device/borrow/borrowHandle.vue b/src/views/device/borrow/borrowHandle.vue index c0c2553..81c6b47 100644 --- a/src/views/device/borrow/borrowHandle.vue +++ b/src/views/device/borrow/borrowHandle.vue @@ -7,12 +7,8 @@ import { useRouter } from 'vue-router' import { SCHEDULE } from '@/utils/scheduleDict' import ButtonBox from '@/components/buttonBox/buttonBox.vue' -import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import type { IMenu } from '@/components/buttonBox/buttonBox' import type { IlistQuery, IlistType, dictType } from '@/views/device/receive/receive' -import { - submitReceiveApplyList, -} from '@/api/device/receive' import { deleteApply, exportApply, getApplyList, returnApply, submitApply } from '@/api/device/borrow' import { getDictByCode } from '@/api/system/dict' @@ -23,11 +19,11 @@ import { getDeptTreeList } from '@/api/system/dept' import { exportFile } from '@/utils/exportUtils' import { printJSON } from '@/utils/printUtils' +import type { TableColumn } from '@/components/NormalTable/table_interface' const { proxy } = getCurrentInstance() as any const active = ref('') // 选中的按钮 const activeTitle = ref('') // active对应的审批状态名字 -const approvalDialog = ref() // 审批对话框显隐 const menu = ref([]) // 审批状态按钮组合 // 筛选时间段数据 const timeRange = ref<[DateModelType, DateModelType]>(['', '']) @@ -62,7 +58,7 @@ // 选中的内容 const checkoutList = ref([]) -const columns = ref([ +const columns = ref([ { text: '申请编号', value: 'applyNo', @@ -151,9 +147,20 @@ fetchData(true) } -// 审批结束回调 -const approvalSuccess = () => { - fetchData(true) +// 选择器模糊查询 +const remoteMethod = (query: string) => { + if (query) { + applyPersonLoading.value = true + setTimeout(() => { + applyPersonLoading.value = false + usePersonOptions.value = usePersonList.value.filter((item) => { + return item.name.toLowerCase().includes(query.toLowerCase()) + }) + }, 200) + } + else { + usePersonOptions.value = usePersonList.value + } } // 获取用户列表(增加模糊查询) @@ -257,11 +264,14 @@ // 模板下载 const templateDownload = () => { - } // 标签识别 const identify = () => { +} +// 多选发生改变时 +const handleSelectionChange = (e: any) => { + checkoutList.value = e.map((item: { id: string }) => item.id) } // 借用 @@ -274,7 +284,7 @@ cancelButtonText: '取消', type: 'warning', }, - ).then((res) => { + ).then(() => { submitApply({ id: row.id as string }).then((res) => { if (res.code === 200) { ElMessage({ @@ -311,18 +321,15 @@ const $router = useRouter() -// 新增 -const addBtn = () => { - $router.push({ - name: 'stateManageDetail', - params: { - type: 'add', - }, - query: { - title: '新建', - name: '设备借用处理', - }, - }) +// 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 +const changePage = (val: { size?: number; page?: number }) => { + if (val && val.size) { + listQuery.value.limit = val.size + } + if (val && val.page) { + listQuery.value.offset = val.page + } + fetchData(true) } // 详情 @@ -428,9 +435,9 @@ 查看 - + 借用 - + 归还 - + 删除 diff --git a/src/api/device/borrow.ts b/src/api/device/borrow.ts index c5e1f79..7fd5f9c 100644 --- a/src/api/device/borrow.ts +++ b/src/api/device/borrow.ts @@ -54,13 +54,23 @@ }) } // 设备借用申请提交 +// export function submitApply(data: object) { +// return request({ +// url: '/equipmentApply/borrowEquipmentApply', +// method: 'post', +// data, +// }) +// } + +// 状态管理提交 export function submitApply(data: object) { return request({ - url: '/equipmentApply/borrowEquipmentApply', + url: '/meter/stateManage/submitStandardEquipmentApply', method: 'post', data, }) } + // 设备借用归还提交 export function returnApply(data: object) { return request({ diff --git a/src/components/NormalTable/table_interface.ts b/src/components/NormalTable/table_interface.ts index e080e57..d1f5b24 100644 --- a/src/components/NormalTable/table_interface.ts +++ b/src/components/NormalTable/table_interface.ts @@ -9,3 +9,4 @@ styleFilter?: Function // 文字过滤器 fixed?: boolean // 固定列 } + diff --git a/src/views/device/borrow/borrowHandle.vue b/src/views/device/borrow/borrowHandle.vue index c0c2553..81c6b47 100644 --- a/src/views/device/borrow/borrowHandle.vue +++ b/src/views/device/borrow/borrowHandle.vue @@ -7,12 +7,8 @@ import { useRouter } from 'vue-router' import { SCHEDULE } from '@/utils/scheduleDict' import ButtonBox from '@/components/buttonBox/buttonBox.vue' -import ApprovalDialog from '@/components/Approval/ApprovalDialog.vue' import type { IMenu } from '@/components/buttonBox/buttonBox' import type { IlistQuery, IlistType, dictType } from '@/views/device/receive/receive' -import { - submitReceiveApplyList, -} from '@/api/device/receive' import { deleteApply, exportApply, getApplyList, returnApply, submitApply } from '@/api/device/borrow' import { getDictByCode } from '@/api/system/dict' @@ -23,11 +19,11 @@ import { getDeptTreeList } from '@/api/system/dept' import { exportFile } from '@/utils/exportUtils' import { printJSON } from '@/utils/printUtils' +import type { TableColumn } from '@/components/NormalTable/table_interface' const { proxy } = getCurrentInstance() as any const active = ref('') // 选中的按钮 const activeTitle = ref('') // active对应的审批状态名字 -const approvalDialog = ref() // 审批对话框显隐 const menu = ref([]) // 审批状态按钮组合 // 筛选时间段数据 const timeRange = ref<[DateModelType, DateModelType]>(['', '']) @@ -62,7 +58,7 @@ // 选中的内容 const checkoutList = ref([]) -const columns = ref([ +const columns = ref([ { text: '申请编号', value: 'applyNo', @@ -151,9 +147,20 @@ fetchData(true) } -// 审批结束回调 -const approvalSuccess = () => { - fetchData(true) +// 选择器模糊查询 +const remoteMethod = (query: string) => { + if (query) { + applyPersonLoading.value = true + setTimeout(() => { + applyPersonLoading.value = false + usePersonOptions.value = usePersonList.value.filter((item) => { + return item.name.toLowerCase().includes(query.toLowerCase()) + }) + }, 200) + } + else { + usePersonOptions.value = usePersonList.value + } } // 获取用户列表(增加模糊查询) @@ -257,11 +264,14 @@ // 模板下载 const templateDownload = () => { - } // 标签识别 const identify = () => { +} +// 多选发生改变时 +const handleSelectionChange = (e: any) => { + checkoutList.value = e.map((item: { id: string }) => item.id) } // 借用 @@ -274,7 +284,7 @@ cancelButtonText: '取消', type: 'warning', }, - ).then((res) => { + ).then(() => { submitApply({ id: row.id as string }).then((res) => { if (res.code === 200) { ElMessage({ @@ -311,18 +321,15 @@ const $router = useRouter() -// 新增 -const addBtn = () => { - $router.push({ - name: 'stateManageDetail', - params: { - type: 'add', - }, - query: { - title: '新建', - name: '设备借用处理', - }, - }) +// 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 +const changePage = (val: { size?: number; page?: number }) => { + if (val && val.size) { + listQuery.value.limit = val.size + } + if (val && val.page) { + listQuery.value.offset = val.page + } + fetchData(true) } // 详情 @@ -428,9 +435,9 @@ 查看 - + 借用 - + 归还 - + 删除 diff --git a/src/views/device/borrow/borrwoApply.vue b/src/views/device/borrow/borrwoApply.vue index 89e09ef..aae69c7 100644 --- a/src/views/device/borrow/borrwoApply.vue +++ b/src/views/device/borrow/borrwoApply.vue @@ -23,6 +23,7 @@ import { getDeptTreeList } from '@/api/system/dept' import { exportFile } from '@/utils/exportUtils' import { printJSON } from '@/utils/printUtils' +import type { TableColumn } from '@/components/NormalTable/table_interface' const { proxy } = getCurrentInstance() as any const active = ref('') // 选中的按钮 const activeTitle = ref('') // active对应的审批状态名字 @@ -63,7 +64,7 @@ // 选中的内容 const checkoutList = ref([]) // 表格数据 -const columns = ref([ +const columns = ref([ { text: '申请编号', value: 'applyNo', @@ -431,16 +432,6 @@ }, }) } - // $router.push({ - // path: `/receive/${title}`, - // query: { - // typeValue: title, - // approvalStatus: approvalStatusReserveMap[row.approvalStatus], - // id: row.id, - // taskId: row.taskId, - // processId: row.processId, - // }, - // }) } } @@ -496,9 +487,9 @@ ([]) // 审批状态按钮组合 // 筛选时间段数据 const timeRange = ref<[DateModelType, DateModelType]>(['', '']) @@ -62,7 +58,7 @@ // 选中的内容 const checkoutList = ref([]) -const columns = ref([ +const columns = ref([ { text: '申请编号', value: 'applyNo', @@ -151,9 +147,20 @@ fetchData(true) } -// 审批结束回调 -const approvalSuccess = () => { - fetchData(true) +// 选择器模糊查询 +const remoteMethod = (query: string) => { + if (query) { + applyPersonLoading.value = true + setTimeout(() => { + applyPersonLoading.value = false + usePersonOptions.value = usePersonList.value.filter((item) => { + return item.name.toLowerCase().includes(query.toLowerCase()) + }) + }, 200) + } + else { + usePersonOptions.value = usePersonList.value + } } // 获取用户列表(增加模糊查询) @@ -257,11 +264,14 @@ // 模板下载 const templateDownload = () => { - } // 标签识别 const identify = () => { +} +// 多选发生改变时 +const handleSelectionChange = (e: any) => { + checkoutList.value = e.map((item: { id: string }) => item.id) } // 借用 @@ -274,7 +284,7 @@ cancelButtonText: '取消', type: 'warning', }, - ).then((res) => { + ).then(() => { submitApply({ id: row.id as string }).then((res) => { if (res.code === 200) { ElMessage({ @@ -311,18 +321,15 @@ const $router = useRouter() -// 新增 -const addBtn = () => { - $router.push({ - name: 'stateManageDetail', - params: { - type: 'add', - }, - query: { - title: '新建', - name: '设备借用处理', - }, - }) +// 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 +const changePage = (val: { size?: number; page?: number }) => { + if (val && val.size) { + listQuery.value.limit = val.size + } + if (val && val.page) { + listQuery.value.offset = val.page + } + fetchData(true) } // 详情 @@ -428,9 +435,9 @@ 查看 - + 借用 - + 归还 - + 删除 diff --git a/src/views/device/borrow/borrwoApply.vue b/src/views/device/borrow/borrwoApply.vue index 89e09ef..aae69c7 100644 --- a/src/views/device/borrow/borrwoApply.vue +++ b/src/views/device/borrow/borrwoApply.vue @@ -23,6 +23,7 @@ import { getDeptTreeList } from '@/api/system/dept' import { exportFile } from '@/utils/exportUtils' import { printJSON } from '@/utils/printUtils' +import type { TableColumn } from '@/components/NormalTable/table_interface' const { proxy } = getCurrentInstance() as any const active = ref('') // 选中的按钮 const activeTitle = ref('') // active对应的审批状态名字 @@ -63,7 +64,7 @@ // 选中的内容 const checkoutList = ref([]) // 表格数据 -const columns = ref([ +const columns = ref([ { text: '申请编号', value: 'applyNo', @@ -431,16 +432,6 @@ }, }) } - // $router.push({ - // path: `/receive/${title}`, - // query: { - // typeValue: title, - // approvalStatus: approvalStatusReserveMap[row.approvalStatus], - // id: row.id, - // taskId: row.taskId, - // processId: row.processId, - // }, - // }) } } @@ -496,9 +487,9 @@ ([]) // 审批状态按钮组合 // 筛选时间段数据 const timeRange = ref<[DateModelType, DateModelType]>(['', '']) @@ -62,7 +58,7 @@ // 选中的内容 const checkoutList = ref([]) -const columns = ref([ +const columns = ref([ { text: '申请编号', value: 'applyNo', @@ -151,9 +147,20 @@ fetchData(true) } -// 审批结束回调 -const approvalSuccess = () => { - fetchData(true) +// 选择器模糊查询 +const remoteMethod = (query: string) => { + if (query) { + applyPersonLoading.value = true + setTimeout(() => { + applyPersonLoading.value = false + usePersonOptions.value = usePersonList.value.filter((item) => { + return item.name.toLowerCase().includes(query.toLowerCase()) + }) + }, 200) + } + else { + usePersonOptions.value = usePersonList.value + } } // 获取用户列表(增加模糊查询) @@ -257,11 +264,14 @@ // 模板下载 const templateDownload = () => { - } // 标签识别 const identify = () => { +} +// 多选发生改变时 +const handleSelectionChange = (e: any) => { + checkoutList.value = e.map((item: { id: string }) => item.id) } // 借用 @@ -274,7 +284,7 @@ cancelButtonText: '取消', type: 'warning', }, - ).then((res) => { + ).then(() => { submitApply({ id: row.id as string }).then((res) => { if (res.code === 200) { ElMessage({ @@ -311,18 +321,15 @@ const $router = useRouter() -// 新增 -const addBtn = () => { - $router.push({ - name: 'stateManageDetail', - params: { - type: 'add', - }, - query: { - title: '新建', - name: '设备借用处理', - }, - }) +// 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写 +const changePage = (val: { size?: number; page?: number }) => { + if (val && val.size) { + listQuery.value.limit = val.size + } + if (val && val.page) { + listQuery.value.offset = val.page + } + fetchData(true) } // 详情 @@ -428,9 +435,9 @@ 查看 - + 借用 - + 归还 - + 删除 diff --git a/src/views/device/borrow/borrwoApply.vue b/src/views/device/borrow/borrwoApply.vue index 89e09ef..aae69c7 100644 --- a/src/views/device/borrow/borrwoApply.vue +++ b/src/views/device/borrow/borrwoApply.vue @@ -23,6 +23,7 @@ import { getDeptTreeList } from '@/api/system/dept' import { exportFile } from '@/utils/exportUtils' import { printJSON } from '@/utils/printUtils' +import type { TableColumn } from '@/components/NormalTable/table_interface' const { proxy } = getCurrentInstance() as any const active = ref('') // 选中的按钮 const activeTitle = ref('') // active对应的审批状态名字 @@ -63,7 +64,7 @@ // 选中的内容 const checkoutList = ref([]) // 表格数据 -const columns = ref([ +const columns = ref([ { text: '申请编号', value: 'applyNo', @@ -431,16 +432,6 @@ }, }) } - // $router.push({ - // path: `/receive/${title}`, - // query: { - // typeValue: title, - // approvalStatus: approvalStatusReserveMap[row.approvalStatus], - // id: row.id, - // taskId: row.taskId, - // processId: row.processId, - // }, - // }) } } @@ -496,9 +487,9 @@ import { ElMessage, ElMessageBox, dayjs } from 'element-plus' import type { FormInstance, FormRules } from 'element-plus' -import type { IdeviceList, IdeviceListQuery } from '../status-interface' +import type { EquipmentListRow, IdeviceList, IdeviceListQuery } from './status-interface' import addRow from './addRow.vue' import SelectDeviceDialog from './selectDeviceDialog.vue' import approveAction from './approvalActionDialog.vue' @@ -19,6 +19,7 @@ import type { borrowDeviceType } from '@/views/device/borrow/borrow' import useUserStore from '@/store/modules/user' import { SCHEDULE } from '@/utils/scheduleDict' +import type { TableColumn } from '@/components/NormalTable/table_interface' const userInfo = useUserStore() const $router = useRouter() @@ -31,9 +32,7 @@ const dialogSelectDiviceVisible = ref(false) // 控制选择设备对话框显隐 const selectIndex = ref() // 点击选择的index--点击第几行 const borrowList = ref([]) -interface EquipmentListRow { - equipmentId: string -} + const ruleForm1 = ref({ applyType: $route.query.applyType, // 申请类型 remark: '', // 申请说明 @@ -286,7 +285,7 @@ await formEl2.validate((valid, fields) => { if (valid) { ElMessageBox.confirm( - '确认提交吗?', + '确认提交吗?', '提示', { confirmButtonText: '确认', @@ -315,6 +314,7 @@ if (!formEl1) { return } await formEl1.validate((valid, fields) => { if (valid) { + console.log(ruleForm1.value.equipmentList) ElMessageBox.confirm( '确认提交吗?', '提示', @@ -329,7 +329,7 @@ ruleForm1.value.applyUnit = ruleForm1.value.id if (ruleForm1.value.equipmentList && ruleForm1.value.equipmentList[0]) { ruleForm1.value.equipmentId = ruleForm1.value.equipmentList[0].equipmentId - delete ruleForm1.value.equipmentList + // delete ruleForm1.value.equipmentList } updateStatus(ruleForm1.value).then((res) => { if (res.code === 200) { @@ -439,7 +439,7 @@ const upload = () => { fileRef.value.click() } -const columns = ref([ +const columns = ref([ { text: '设备名称', value: 'equipmentName', @@ -493,7 +493,6 @@ align: 'center', }, ]) -const addRowRef = ref() const SelectionList = ref() // 表格选中 const handleSelectionChange = (e: any) => { @@ -544,48 +543,7 @@ return !SelectionList.value.includes(item) }) } -// 借用设备列表添加 -const addRowMethods = (row: IdeviceListQuery) => { - if (isDevice.value) { - // 设备借用 - borrowList.value = [...borrowList.value, ...row] - } - else { - // 设备状态 - if (row.length > 1) { - ElMessage.warning('只能选择一个设备') - } - else { - console.log(row[0], '选中的设备') - const device = row[0] - ruleForm1.value.equipmentNo = device.equipmentNo - ruleForm1.value.equipmentName = device.equipmentName - ruleForm1.value.modelNo = device.modelNo - ruleForm1.value.equipmentSpecifications = device.equipmentSpecifications - ruleForm1.value.manufacturingNo = device.manufacturingNo - ruleForm1.value.manufacturer = device.manufacturer - ruleFormRef1.value.clearValidate('equipmentNo') - // 赋值 - ruleForm1.value.equipmentList = [{ - equipmentId: row[0].id, - }] - } - } - // row.forEach((element) => { - // borrowList.value.push({ - // equipmentName: element.equipmentName, // 设备名称 - // createUser: '', // 当前用户id 1 - // equipmentId: element.id, // 设备id 1 - // equipmentNo: element.equipmentNo, // 设备编号 - // modelNo: element.modelNo, // 型号 - // measureRange: '', // 测量范围 1 - // useDept: '', // 使用部门 1 - // usePerson: '', // 使用人 1 - // validDate: element.validDate, // 有效日期 - // edit: true, - // }) - // }) -} + // 详情页面中是否可审批 const isApproval = computed(() => { // 根据状态判断 @@ -612,6 +570,12 @@ } }) +// 设备状态管理 +const addRowBtn = () => { + dialogSelectDiviceVisible.value = true // 选择设备对话框显隐 + isMulti.value = false // 是否单选, false单选、true表格多选 +} + // 点击选择 const handleSelect = (index: number, row: borrowDeviceType) => { dialogSelectDiviceVisible.value = true // 选择设备对话框显隐 @@ -632,6 +596,23 @@ // 选择好设备了, 添加选好的设备到表格中 const updateDeviceConfirm = (val: Array) => { + console.log(isDevice.value) + // // 如果是状态管理 + if (isDevice.value === false) { + const device = val[0] + ruleForm1.value.equipmentNo = device.equipmentNo + ruleForm1.value.equipmentName = device.equipmentName + ruleForm1.value.modelNo = device.modelNo + ruleForm1.value.equipmentSpecifications = device.equipmentSpecifications as string + ruleForm1.value.manufacturingNo = device.manufacturingNo as string + ruleForm1.value.manufacturer = device.manufacturer as string + ruleFormRef1.value.clearValidate('equipmentNo') + // 赋值 + ruleForm1.value.equipmentList = [{ + equipmentId: device.id as string, + }] + return false + } if (isMulti.value) { // 批量增加时push val.forEach((item: IdeviceList) => { // 只添加列表里不存在的 @@ -647,6 +628,7 @@ ElMessage.warning('此设备已添加过') return } + borrowList.value.splice(selectIndex.value, 1, val[0]) } } @@ -654,13 +636,11 @@