diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/system/source.ts b/src/api/system/source.ts index 65c14fe..93f5f12 100644 --- a/src/api/system/source.ts +++ b/src/api/system/source.ts @@ -55,6 +55,7 @@ data, }) } + // 导出详情 export function getSoucreLisListExport(data: object) { return request({ @@ -64,3 +65,12 @@ data, }) } + +// 溯源供方审批接口 +export function getapprovalListPage(data: object) { + return request({ + url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/system/source.ts b/src/api/system/source.ts index 65c14fe..93f5f12 100644 --- a/src/api/system/source.ts +++ b/src/api/system/source.ts @@ -55,6 +55,7 @@ data, }) } + // 导出详情 export function getSoucreLisListExport(data: object) { return request({ @@ -64,3 +65,12 @@ data, }) } + +// 溯源供方审批接口 +export function getapprovalListPage(data: object) { + return request({ + url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} diff --git a/src/router/modules/device.ts b/src/router/modules/device.ts index d67dab6..d464b09 100644 --- a/src/router/modules/device.ts +++ b/src/router/modules/device.ts @@ -437,6 +437,37 @@ auth: '/device/manage/checkList', }, }, + { + path: ':type/:id?', + name: 'maintenanceAdd', + component: () => import('@/views/device/deviceMaintenance/components/listApply/listPageAdd.vue'), + meta: { + title: '设备维护列表', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/maintenance/maintenanceList', + }, + beforeEnter: (to, from, next) => { + const type = from.path.split('/')[from.path.split('/').length - 1] + console.log(type) + switch (type) { + case 'maintenanceList': + to.meta.activeMenu = '/maintenance/maintenanceList' + to.meta.title = '设备维护列表' + break + case 'maintenanceCheckList': + to.meta.activeMenu = '/maintenance/maintenanceCheckList' + to.meta.title = '设备检修保养验收单' + break + case 'manageCheckList': + to.meta.activeMenu = '/maintenance/manageCheckList' + to.meta.title = '设备管理点检查表' + break + } + next() + }, + }, ], }, { diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/system/source.ts b/src/api/system/source.ts index 65c14fe..93f5f12 100644 --- a/src/api/system/source.ts +++ b/src/api/system/source.ts @@ -55,6 +55,7 @@ data, }) } + // 导出详情 export function getSoucreLisListExport(data: object) { return request({ @@ -64,3 +65,12 @@ data, }) } + +// 溯源供方审批接口 +export function getapprovalListPage(data: object) { + return request({ + url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} diff --git a/src/router/modules/device.ts b/src/router/modules/device.ts index d67dab6..d464b09 100644 --- a/src/router/modules/device.ts +++ b/src/router/modules/device.ts @@ -437,6 +437,37 @@ auth: '/device/manage/checkList', }, }, + { + path: ':type/:id?', + name: 'maintenanceAdd', + component: () => import('@/views/device/deviceMaintenance/components/listApply/listPageAdd.vue'), + meta: { + title: '设备维护列表', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/maintenance/maintenanceList', + }, + beforeEnter: (to, from, next) => { + const type = from.path.split('/')[from.path.split('/').length - 1] + console.log(type) + switch (type) { + case 'maintenanceList': + to.meta.activeMenu = '/maintenance/maintenanceList' + to.meta.title = '设备维护列表' + break + case 'maintenanceCheckList': + to.meta.activeMenu = '/maintenance/maintenanceCheckList' + to.meta.title = '设备检修保养验收单' + break + case 'manageCheckList': + to.meta.activeMenu = '/maintenance/manageCheckList' + to.meta.title = '设备管理点检查表' + break + } + next() + }, + }, ], }, { diff --git a/src/router/modules/measure.ts b/src/router/modules/measure.ts index 710bdc2..f114ca2 100644 --- a/src/router/modules/measure.ts +++ b/src/router/modules/measure.ts @@ -278,7 +278,7 @@ icon: 'ep:key', sidebar: false, breadcrumb: true, - auth: '/train/trainPlanApprove', + activeMenu: '/train/trainPlanApprove', }, }, { diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/system/source.ts b/src/api/system/source.ts index 65c14fe..93f5f12 100644 --- a/src/api/system/source.ts +++ b/src/api/system/source.ts @@ -55,6 +55,7 @@ data, }) } + // 导出详情 export function getSoucreLisListExport(data: object) { return request({ @@ -64,3 +65,12 @@ data, }) } + +// 溯源供方审批接口 +export function getapprovalListPage(data: object) { + return request({ + url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} diff --git a/src/router/modules/device.ts b/src/router/modules/device.ts index d67dab6..d464b09 100644 --- a/src/router/modules/device.ts +++ b/src/router/modules/device.ts @@ -437,6 +437,37 @@ auth: '/device/manage/checkList', }, }, + { + path: ':type/:id?', + name: 'maintenanceAdd', + component: () => import('@/views/device/deviceMaintenance/components/listApply/listPageAdd.vue'), + meta: { + title: '设备维护列表', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/maintenance/maintenanceList', + }, + beforeEnter: (to, from, next) => { + const type = from.path.split('/')[from.path.split('/').length - 1] + console.log(type) + switch (type) { + case 'maintenanceList': + to.meta.activeMenu = '/maintenance/maintenanceList' + to.meta.title = '设备维护列表' + break + case 'maintenanceCheckList': + to.meta.activeMenu = '/maintenance/maintenanceCheckList' + to.meta.title = '设备检修保养验收单' + break + case 'manageCheckList': + to.meta.activeMenu = '/maintenance/manageCheckList' + to.meta.title = '设备管理点检查表' + break + } + next() + }, + }, ], }, { diff --git a/src/router/modules/measure.ts b/src/router/modules/measure.ts index 710bdc2..f114ca2 100644 --- a/src/router/modules/measure.ts +++ b/src/router/modules/measure.ts @@ -278,7 +278,7 @@ icon: 'ep:key', sidebar: false, breadcrumb: true, - auth: '/train/trainPlanApprove', + activeMenu: '/train/trainPlanApprove', }, }, { diff --git a/src/views/device/deviceMaintenance/components/listApply/listPage.vue b/src/views/device/deviceMaintenance/components/listApply/listPage.vue index df90882..478f4fb 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPage.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPage.vue @@ -3,7 +3,6 @@ import type { Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { IlistQuery, IlistType } from '../list_interface' -import ListSourceAdd from './listPageAdd.vue' import { getSoucreList, getSoucreListDelete } from '@/api/system/source' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' @@ -26,6 +25,8 @@ offset: 1, limit: 10, }) +// 初始化路由 +const $router = useRouter() // 控制是否显示新增页面 const show = ref(true) // 表格数据 @@ -167,22 +168,44 @@ // }) }) } -// 点击编辑/详情 -const handleEdit = (index: string, row: rowReturn, value: string) => { - if (value === '查看' || value === '编辑') { - buttonArray.value = ['同意', '驳回', '拒绝'] - buttonType.value = value - infoId.value = row.id - show.value = false +// // 点击编辑/详情 +// const handleEdit = (index: string, row: rowReturn, value: string) => { +// if (value === '查看' || value === '编辑') { +// buttonArray.value = ['同意', '驳回', '拒绝'] +// buttonType.value = value +// infoId.value = row.id +// show.value = false +// } +// else if (value === '删除' || value === '取消' || value === '提交') { +// handleDelete(row, value) +// } +// else { +// if (value === '同意') { +// applyList.value.select = '1' +// } +// else if (value === '驳回') { +// applyList.value.select = '2' +// } +// else { +// applyList.value.select = '3' +// } +// applyList.value.approval = row.name +// applyList.value.approvalTime = row.name +// applyShow.value = true +// } +// } +const pageTypeMap = ref('') +// 点击每条数据操作 +const handleEdit = (row: rowReturn, pageType: string) => { + if (pageType === '编辑' || pageType === '查看') { + pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' + $router.push(`/maintenance/${pageTypeMap.value}/${row.id}`) } - else if (value === '删除' || value === '取消' || value === '提交') { - handleDelete(row, value) - } - else { - if (value === '同意') { + else if (pageType === '同意' || pageType === '驳回' || pageType === '拒绝') { + if (pageType === '同意') { applyList.value.select = '1' } - else if (value === '驳回') { + else if (pageType === '驳回') { applyList.value.select = '2' } else { @@ -192,6 +215,9 @@ applyList.value.approvalTime = row.name applyShow.value = true } + else { + handleDelete(row, pageType) + } } // 审批弹窗关闭 const handleClose = () => { @@ -280,9 +306,7 @@ upload() } const add = () => { - buttonArray.value = ['提交', '保存'] - buttonType.value = '' - show.value = false + $router.push('/maintenance/add') } const exportAll = () => { exportExcelBtn() @@ -396,7 +420,7 @@ :key="index" size="small" :type="item.type" link - @click="handleEdit(row.$index, row, item.name)" + @click="handleEdit(row, item.name)" > {{ item.name }} @@ -407,71 +431,68 @@ - - - - - - 同意 - - - 驳回 - - - 拒绝 - - - - - - - - - - - - + + + + + + 同意 + + + 驳回 + + + 拒绝 + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/system/source.ts b/src/api/system/source.ts index 65c14fe..93f5f12 100644 --- a/src/api/system/source.ts +++ b/src/api/system/source.ts @@ -55,6 +55,7 @@ data, }) } + // 导出详情 export function getSoucreLisListExport(data: object) { return request({ @@ -64,3 +65,12 @@ data, }) } + +// 溯源供方审批接口 +export function getapprovalListPage(data: object) { + return request({ + url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} diff --git a/src/router/modules/device.ts b/src/router/modules/device.ts index d67dab6..d464b09 100644 --- a/src/router/modules/device.ts +++ b/src/router/modules/device.ts @@ -437,6 +437,37 @@ auth: '/device/manage/checkList', }, }, + { + path: ':type/:id?', + name: 'maintenanceAdd', + component: () => import('@/views/device/deviceMaintenance/components/listApply/listPageAdd.vue'), + meta: { + title: '设备维护列表', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/maintenance/maintenanceList', + }, + beforeEnter: (to, from, next) => { + const type = from.path.split('/')[from.path.split('/').length - 1] + console.log(type) + switch (type) { + case 'maintenanceList': + to.meta.activeMenu = '/maintenance/maintenanceList' + to.meta.title = '设备维护列表' + break + case 'maintenanceCheckList': + to.meta.activeMenu = '/maintenance/maintenanceCheckList' + to.meta.title = '设备检修保养验收单' + break + case 'manageCheckList': + to.meta.activeMenu = '/maintenance/manageCheckList' + to.meta.title = '设备管理点检查表' + break + } + next() + }, + }, ], }, { diff --git a/src/router/modules/measure.ts b/src/router/modules/measure.ts index 710bdc2..f114ca2 100644 --- a/src/router/modules/measure.ts +++ b/src/router/modules/measure.ts @@ -278,7 +278,7 @@ icon: 'ep:key', sidebar: false, breadcrumb: true, - auth: '/train/trainPlanApprove', + activeMenu: '/train/trainPlanApprove', }, }, { diff --git a/src/views/device/deviceMaintenance/components/listApply/listPage.vue b/src/views/device/deviceMaintenance/components/listApply/listPage.vue index df90882..478f4fb 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPage.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPage.vue @@ -3,7 +3,6 @@ import type { Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { IlistQuery, IlistType } from '../list_interface' -import ListSourceAdd from './listPageAdd.vue' import { getSoucreList, getSoucreListDelete } from '@/api/system/source' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' @@ -26,6 +25,8 @@ offset: 1, limit: 10, }) +// 初始化路由 +const $router = useRouter() // 控制是否显示新增页面 const show = ref(true) // 表格数据 @@ -167,22 +168,44 @@ // }) }) } -// 点击编辑/详情 -const handleEdit = (index: string, row: rowReturn, value: string) => { - if (value === '查看' || value === '编辑') { - buttonArray.value = ['同意', '驳回', '拒绝'] - buttonType.value = value - infoId.value = row.id - show.value = false +// // 点击编辑/详情 +// const handleEdit = (index: string, row: rowReturn, value: string) => { +// if (value === '查看' || value === '编辑') { +// buttonArray.value = ['同意', '驳回', '拒绝'] +// buttonType.value = value +// infoId.value = row.id +// show.value = false +// } +// else if (value === '删除' || value === '取消' || value === '提交') { +// handleDelete(row, value) +// } +// else { +// if (value === '同意') { +// applyList.value.select = '1' +// } +// else if (value === '驳回') { +// applyList.value.select = '2' +// } +// else { +// applyList.value.select = '3' +// } +// applyList.value.approval = row.name +// applyList.value.approvalTime = row.name +// applyShow.value = true +// } +// } +const pageTypeMap = ref('') +// 点击每条数据操作 +const handleEdit = (row: rowReturn, pageType: string) => { + if (pageType === '编辑' || pageType === '查看') { + pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' + $router.push(`/maintenance/${pageTypeMap.value}/${row.id}`) } - else if (value === '删除' || value === '取消' || value === '提交') { - handleDelete(row, value) - } - else { - if (value === '同意') { + else if (pageType === '同意' || pageType === '驳回' || pageType === '拒绝') { + if (pageType === '同意') { applyList.value.select = '1' } - else if (value === '驳回') { + else if (pageType === '驳回') { applyList.value.select = '2' } else { @@ -192,6 +215,9 @@ applyList.value.approvalTime = row.name applyShow.value = true } + else { + handleDelete(row, pageType) + } } // 审批弹窗关闭 const handleClose = () => { @@ -280,9 +306,7 @@ upload() } const add = () => { - buttonArray.value = ['提交', '保存'] - buttonType.value = '' - show.value = false + $router.push('/maintenance/add') } const exportAll = () => { exportExcelBtn() @@ -396,7 +420,7 @@ :key="index" size="small" :type="item.type" link - @click="handleEdit(row.$index, row, item.name)" + @click="handleEdit(row, item.name)" > {{ item.name }} @@ -407,71 +431,68 @@ - - - - - - 同意 - - - 驳回 - - - 拒绝 - - - - - - - - - - - - + + + + + + 同意 + + + 驳回 + + + 拒绝 + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue index eb506ec..6527f2e 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue @@ -1,4 +1,4 @@ - diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/system/source.ts b/src/api/system/source.ts index 65c14fe..93f5f12 100644 --- a/src/api/system/source.ts +++ b/src/api/system/source.ts @@ -55,6 +55,7 @@ data, }) } + // 导出详情 export function getSoucreLisListExport(data: object) { return request({ @@ -64,3 +65,12 @@ data, }) } + +// 溯源供方审批接口 +export function getapprovalListPage(data: object) { + return request({ + url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} diff --git a/src/router/modules/device.ts b/src/router/modules/device.ts index d67dab6..d464b09 100644 --- a/src/router/modules/device.ts +++ b/src/router/modules/device.ts @@ -437,6 +437,37 @@ auth: '/device/manage/checkList', }, }, + { + path: ':type/:id?', + name: 'maintenanceAdd', + component: () => import('@/views/device/deviceMaintenance/components/listApply/listPageAdd.vue'), + meta: { + title: '设备维护列表', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/maintenance/maintenanceList', + }, + beforeEnter: (to, from, next) => { + const type = from.path.split('/')[from.path.split('/').length - 1] + console.log(type) + switch (type) { + case 'maintenanceList': + to.meta.activeMenu = '/maintenance/maintenanceList' + to.meta.title = '设备维护列表' + break + case 'maintenanceCheckList': + to.meta.activeMenu = '/maintenance/maintenanceCheckList' + to.meta.title = '设备检修保养验收单' + break + case 'manageCheckList': + to.meta.activeMenu = '/maintenance/manageCheckList' + to.meta.title = '设备管理点检查表' + break + } + next() + }, + }, ], }, { diff --git a/src/router/modules/measure.ts b/src/router/modules/measure.ts index 710bdc2..f114ca2 100644 --- a/src/router/modules/measure.ts +++ b/src/router/modules/measure.ts @@ -278,7 +278,7 @@ icon: 'ep:key', sidebar: false, breadcrumb: true, - auth: '/train/trainPlanApprove', + activeMenu: '/train/trainPlanApprove', }, }, { diff --git a/src/views/device/deviceMaintenance/components/listApply/listPage.vue b/src/views/device/deviceMaintenance/components/listApply/listPage.vue index df90882..478f4fb 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPage.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPage.vue @@ -3,7 +3,6 @@ import type { Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { IlistQuery, IlistType } from '../list_interface' -import ListSourceAdd from './listPageAdd.vue' import { getSoucreList, getSoucreListDelete } from '@/api/system/source' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' @@ -26,6 +25,8 @@ offset: 1, limit: 10, }) +// 初始化路由 +const $router = useRouter() // 控制是否显示新增页面 const show = ref(true) // 表格数据 @@ -167,22 +168,44 @@ // }) }) } -// 点击编辑/详情 -const handleEdit = (index: string, row: rowReturn, value: string) => { - if (value === '查看' || value === '编辑') { - buttonArray.value = ['同意', '驳回', '拒绝'] - buttonType.value = value - infoId.value = row.id - show.value = false +// // 点击编辑/详情 +// const handleEdit = (index: string, row: rowReturn, value: string) => { +// if (value === '查看' || value === '编辑') { +// buttonArray.value = ['同意', '驳回', '拒绝'] +// buttonType.value = value +// infoId.value = row.id +// show.value = false +// } +// else if (value === '删除' || value === '取消' || value === '提交') { +// handleDelete(row, value) +// } +// else { +// if (value === '同意') { +// applyList.value.select = '1' +// } +// else if (value === '驳回') { +// applyList.value.select = '2' +// } +// else { +// applyList.value.select = '3' +// } +// applyList.value.approval = row.name +// applyList.value.approvalTime = row.name +// applyShow.value = true +// } +// } +const pageTypeMap = ref('') +// 点击每条数据操作 +const handleEdit = (row: rowReturn, pageType: string) => { + if (pageType === '编辑' || pageType === '查看') { + pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' + $router.push(`/maintenance/${pageTypeMap.value}/${row.id}`) } - else if (value === '删除' || value === '取消' || value === '提交') { - handleDelete(row, value) - } - else { - if (value === '同意') { + else if (pageType === '同意' || pageType === '驳回' || pageType === '拒绝') { + if (pageType === '同意') { applyList.value.select = '1' } - else if (value === '驳回') { + else if (pageType === '驳回') { applyList.value.select = '2' } else { @@ -192,6 +215,9 @@ applyList.value.approvalTime = row.name applyShow.value = true } + else { + handleDelete(row, pageType) + } } // 审批弹窗关闭 const handleClose = () => { @@ -280,9 +306,7 @@ upload() } const add = () => { - buttonArray.value = ['提交', '保存'] - buttonType.value = '' - show.value = false + $router.push('/maintenance/add') } const exportAll = () => { exportExcelBtn() @@ -396,7 +420,7 @@ :key="index" size="small" :type="item.type" link - @click="handleEdit(row.$index, row, item.name)" + @click="handleEdit(row, item.name)" > {{ item.name }} @@ -407,71 +431,68 @@ - - - - - - 同意 - - - 驳回 - - - 拒绝 - - - - - - - - - - - - + + + + + + 同意 + + + 驳回 + + + 拒绝 + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue index eb506ec..6527f2e 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue @@ -1,4 +1,4 @@ - diff --git a/src/views/device/standardEquipment/components/listApply/listPageAdd.vue b/src/views/device/standardEquipment/components/listApply/listPageAdd.vue index 2b8bef4..96aabeb 100644 --- a/src/views/device/standardEquipment/components/listApply/listPageAdd.vue +++ b/src/views/device/standardEquipment/components/listApply/listPageAdd.vue @@ -7,7 +7,7 @@ import UserListDialog from './userListDialog.vue' import { getStaffList } from '@/api/measure/person' import { getTypeSelect } from '@/api/system/price' -import { getStandardLisAdd, getStandardList, getStandardListDetail, getUsersDept } from '@/api/device/standard' +import { getStandardLisAdd, getStandardLisdetali, getStandardList, getStandardListDetail, getUsersDept } from '@/api/device/standard' import { UploadFile } from '@/api/measure/file' const loading = ref(false) // 表单加载状态 const infoId = ref('') // id diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/system/source.ts b/src/api/system/source.ts index 65c14fe..93f5f12 100644 --- a/src/api/system/source.ts +++ b/src/api/system/source.ts @@ -55,6 +55,7 @@ data, }) } + // 导出详情 export function getSoucreLisListExport(data: object) { return request({ @@ -64,3 +65,12 @@ data, }) } + +// 溯源供方审批接口 +export function getapprovalListPage(data: object) { + return request({ + url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} diff --git a/src/router/modules/device.ts b/src/router/modules/device.ts index d67dab6..d464b09 100644 --- a/src/router/modules/device.ts +++ b/src/router/modules/device.ts @@ -437,6 +437,37 @@ auth: '/device/manage/checkList', }, }, + { + path: ':type/:id?', + name: 'maintenanceAdd', + component: () => import('@/views/device/deviceMaintenance/components/listApply/listPageAdd.vue'), + meta: { + title: '设备维护列表', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/maintenance/maintenanceList', + }, + beforeEnter: (to, from, next) => { + const type = from.path.split('/')[from.path.split('/').length - 1] + console.log(type) + switch (type) { + case 'maintenanceList': + to.meta.activeMenu = '/maintenance/maintenanceList' + to.meta.title = '设备维护列表' + break + case 'maintenanceCheckList': + to.meta.activeMenu = '/maintenance/maintenanceCheckList' + to.meta.title = '设备检修保养验收单' + break + case 'manageCheckList': + to.meta.activeMenu = '/maintenance/manageCheckList' + to.meta.title = '设备管理点检查表' + break + } + next() + }, + }, ], }, { diff --git a/src/router/modules/measure.ts b/src/router/modules/measure.ts index 710bdc2..f114ca2 100644 --- a/src/router/modules/measure.ts +++ b/src/router/modules/measure.ts @@ -278,7 +278,7 @@ icon: 'ep:key', sidebar: false, breadcrumb: true, - auth: '/train/trainPlanApprove', + activeMenu: '/train/trainPlanApprove', }, }, { diff --git a/src/views/device/deviceMaintenance/components/listApply/listPage.vue b/src/views/device/deviceMaintenance/components/listApply/listPage.vue index df90882..478f4fb 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPage.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPage.vue @@ -3,7 +3,6 @@ import type { Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { IlistQuery, IlistType } from '../list_interface' -import ListSourceAdd from './listPageAdd.vue' import { getSoucreList, getSoucreListDelete } from '@/api/system/source' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' @@ -26,6 +25,8 @@ offset: 1, limit: 10, }) +// 初始化路由 +const $router = useRouter() // 控制是否显示新增页面 const show = ref(true) // 表格数据 @@ -167,22 +168,44 @@ // }) }) } -// 点击编辑/详情 -const handleEdit = (index: string, row: rowReturn, value: string) => { - if (value === '查看' || value === '编辑') { - buttonArray.value = ['同意', '驳回', '拒绝'] - buttonType.value = value - infoId.value = row.id - show.value = false +// // 点击编辑/详情 +// const handleEdit = (index: string, row: rowReturn, value: string) => { +// if (value === '查看' || value === '编辑') { +// buttonArray.value = ['同意', '驳回', '拒绝'] +// buttonType.value = value +// infoId.value = row.id +// show.value = false +// } +// else if (value === '删除' || value === '取消' || value === '提交') { +// handleDelete(row, value) +// } +// else { +// if (value === '同意') { +// applyList.value.select = '1' +// } +// else if (value === '驳回') { +// applyList.value.select = '2' +// } +// else { +// applyList.value.select = '3' +// } +// applyList.value.approval = row.name +// applyList.value.approvalTime = row.name +// applyShow.value = true +// } +// } +const pageTypeMap = ref('') +// 点击每条数据操作 +const handleEdit = (row: rowReturn, pageType: string) => { + if (pageType === '编辑' || pageType === '查看') { + pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' + $router.push(`/maintenance/${pageTypeMap.value}/${row.id}`) } - else if (value === '删除' || value === '取消' || value === '提交') { - handleDelete(row, value) - } - else { - if (value === '同意') { + else if (pageType === '同意' || pageType === '驳回' || pageType === '拒绝') { + if (pageType === '同意') { applyList.value.select = '1' } - else if (value === '驳回') { + else if (pageType === '驳回') { applyList.value.select = '2' } else { @@ -192,6 +215,9 @@ applyList.value.approvalTime = row.name applyShow.value = true } + else { + handleDelete(row, pageType) + } } // 审批弹窗关闭 const handleClose = () => { @@ -280,9 +306,7 @@ upload() } const add = () => { - buttonArray.value = ['提交', '保存'] - buttonType.value = '' - show.value = false + $router.push('/maintenance/add') } const exportAll = () => { exportExcelBtn() @@ -396,7 +420,7 @@ :key="index" size="small" :type="item.type" link - @click="handleEdit(row.$index, row, item.name)" + @click="handleEdit(row, item.name)" > {{ item.name }} @@ -407,71 +431,68 @@ - - - - - - 同意 - - - 驳回 - - - 拒绝 - - - - - - - - - - - - + + + + + + 同意 + + + 驳回 + + + 拒绝 + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue index eb506ec..6527f2e 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue @@ -1,4 +1,4 @@ - diff --git a/src/views/device/standardEquipment/components/listApply/listPageAdd.vue b/src/views/device/standardEquipment/components/listApply/listPageAdd.vue index 2b8bef4..96aabeb 100644 --- a/src/views/device/standardEquipment/components/listApply/listPageAdd.vue +++ b/src/views/device/standardEquipment/components/listApply/listPageAdd.vue @@ -7,7 +7,7 @@ import UserListDialog from './userListDialog.vue' import { getStaffList } from '@/api/measure/person' import { getTypeSelect } from '@/api/system/price' -import { getStandardLisAdd, getStandardList, getStandardListDetail, getUsersDept } from '@/api/device/standard' +import { getStandardLisAdd, getStandardLisdetali, getStandardList, getStandardListDetail, getUsersDept } from '@/api/device/standard' import { UploadFile } from '@/api/measure/file' const loading = ref(false) // 表单加载状态 const infoId = ref('') // id diff --git a/src/views/device/standardEquipment/components/listApply/userListDialog.vue b/src/views/device/standardEquipment/components/listApply/userListDialog.vue index bbaaa1f..2792a21 100644 --- a/src/views/device/standardEquipment/components/listApply/userListDialog.vue +++ b/src/views/device/standardEquipment/components/listApply/userListDialog.vue @@ -115,7 +115,7 @@ - + diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/system/source.ts b/src/api/system/source.ts index 65c14fe..93f5f12 100644 --- a/src/api/system/source.ts +++ b/src/api/system/source.ts @@ -55,6 +55,7 @@ data, }) } + // 导出详情 export function getSoucreLisListExport(data: object) { return request({ @@ -64,3 +65,12 @@ data, }) } + +// 溯源供方审批接口 +export function getapprovalListPage(data: object) { + return request({ + url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} diff --git a/src/router/modules/device.ts b/src/router/modules/device.ts index d67dab6..d464b09 100644 --- a/src/router/modules/device.ts +++ b/src/router/modules/device.ts @@ -437,6 +437,37 @@ auth: '/device/manage/checkList', }, }, + { + path: ':type/:id?', + name: 'maintenanceAdd', + component: () => import('@/views/device/deviceMaintenance/components/listApply/listPageAdd.vue'), + meta: { + title: '设备维护列表', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/maintenance/maintenanceList', + }, + beforeEnter: (to, from, next) => { + const type = from.path.split('/')[from.path.split('/').length - 1] + console.log(type) + switch (type) { + case 'maintenanceList': + to.meta.activeMenu = '/maintenance/maintenanceList' + to.meta.title = '设备维护列表' + break + case 'maintenanceCheckList': + to.meta.activeMenu = '/maintenance/maintenanceCheckList' + to.meta.title = '设备检修保养验收单' + break + case 'manageCheckList': + to.meta.activeMenu = '/maintenance/manageCheckList' + to.meta.title = '设备管理点检查表' + break + } + next() + }, + }, ], }, { diff --git a/src/router/modules/measure.ts b/src/router/modules/measure.ts index 710bdc2..f114ca2 100644 --- a/src/router/modules/measure.ts +++ b/src/router/modules/measure.ts @@ -278,7 +278,7 @@ icon: 'ep:key', sidebar: false, breadcrumb: true, - auth: '/train/trainPlanApprove', + activeMenu: '/train/trainPlanApprove', }, }, { diff --git a/src/views/device/deviceMaintenance/components/listApply/listPage.vue b/src/views/device/deviceMaintenance/components/listApply/listPage.vue index df90882..478f4fb 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPage.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPage.vue @@ -3,7 +3,6 @@ import type { Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { IlistQuery, IlistType } from '../list_interface' -import ListSourceAdd from './listPageAdd.vue' import { getSoucreList, getSoucreListDelete } from '@/api/system/source' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' @@ -26,6 +25,8 @@ offset: 1, limit: 10, }) +// 初始化路由 +const $router = useRouter() // 控制是否显示新增页面 const show = ref(true) // 表格数据 @@ -167,22 +168,44 @@ // }) }) } -// 点击编辑/详情 -const handleEdit = (index: string, row: rowReturn, value: string) => { - if (value === '查看' || value === '编辑') { - buttonArray.value = ['同意', '驳回', '拒绝'] - buttonType.value = value - infoId.value = row.id - show.value = false +// // 点击编辑/详情 +// const handleEdit = (index: string, row: rowReturn, value: string) => { +// if (value === '查看' || value === '编辑') { +// buttonArray.value = ['同意', '驳回', '拒绝'] +// buttonType.value = value +// infoId.value = row.id +// show.value = false +// } +// else if (value === '删除' || value === '取消' || value === '提交') { +// handleDelete(row, value) +// } +// else { +// if (value === '同意') { +// applyList.value.select = '1' +// } +// else if (value === '驳回') { +// applyList.value.select = '2' +// } +// else { +// applyList.value.select = '3' +// } +// applyList.value.approval = row.name +// applyList.value.approvalTime = row.name +// applyShow.value = true +// } +// } +const pageTypeMap = ref('') +// 点击每条数据操作 +const handleEdit = (row: rowReturn, pageType: string) => { + if (pageType === '编辑' || pageType === '查看') { + pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' + $router.push(`/maintenance/${pageTypeMap.value}/${row.id}`) } - else if (value === '删除' || value === '取消' || value === '提交') { - handleDelete(row, value) - } - else { - if (value === '同意') { + else if (pageType === '同意' || pageType === '驳回' || pageType === '拒绝') { + if (pageType === '同意') { applyList.value.select = '1' } - else if (value === '驳回') { + else if (pageType === '驳回') { applyList.value.select = '2' } else { @@ -192,6 +215,9 @@ applyList.value.approvalTime = row.name applyShow.value = true } + else { + handleDelete(row, pageType) + } } // 审批弹窗关闭 const handleClose = () => { @@ -280,9 +306,7 @@ upload() } const add = () => { - buttonArray.value = ['提交', '保存'] - buttonType.value = '' - show.value = false + $router.push('/maintenance/add') } const exportAll = () => { exportExcelBtn() @@ -396,7 +420,7 @@ :key="index" size="small" :type="item.type" link - @click="handleEdit(row.$index, row, item.name)" + @click="handleEdit(row, item.name)" > {{ item.name }} @@ -407,71 +431,68 @@ - - - - - - 同意 - - - 驳回 - - - 拒绝 - - - - - - - - - - - - + + + + + + 同意 + + + 驳回 + + + 拒绝 + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue index eb506ec..6527f2e 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue @@ -1,4 +1,4 @@ - diff --git a/src/views/device/standardEquipment/components/listApply/listPageAdd.vue b/src/views/device/standardEquipment/components/listApply/listPageAdd.vue index 2b8bef4..96aabeb 100644 --- a/src/views/device/standardEquipment/components/listApply/listPageAdd.vue +++ b/src/views/device/standardEquipment/components/listApply/listPageAdd.vue @@ -7,7 +7,7 @@ import UserListDialog from './userListDialog.vue' import { getStaffList } from '@/api/measure/person' import { getTypeSelect } from '@/api/system/price' -import { getStandardLisAdd, getStandardList, getStandardListDetail, getUsersDept } from '@/api/device/standard' +import { getStandardLisAdd, getStandardLisdetali, getStandardList, getStandardListDetail, getUsersDept } from '@/api/device/standard' import { UploadFile } from '@/api/measure/file' const loading = ref(false) // 表单加载状态 const infoId = ref('') // id diff --git a/src/views/device/standardEquipment/components/listApply/userListDialog.vue b/src/views/device/standardEquipment/components/listApply/userListDialog.vue index bbaaa1f..2792a21 100644 --- a/src/views/device/standardEquipment/components/listApply/userListDialog.vue +++ b/src/views/device/standardEquipment/components/listApply/userListDialog.vue @@ -115,7 +115,7 @@ - + diff --git a/src/views/device/standardEquipment/standardList.vue b/src/views/device/standardEquipment/standardList.vue index e9ff0ce..e858700 100644 --- a/src/views/device/standardEquipment/standardList.vue +++ b/src/views/device/standardEquipment/standardList.vue @@ -58,6 +58,7 @@ text: '标准所在部门', value: 'standardLaboratoryName', align: 'center', + width: '180', }, { text: '负责人', diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/system/source.ts b/src/api/system/source.ts index 65c14fe..93f5f12 100644 --- a/src/api/system/source.ts +++ b/src/api/system/source.ts @@ -55,6 +55,7 @@ data, }) } + // 导出详情 export function getSoucreLisListExport(data: object) { return request({ @@ -64,3 +65,12 @@ data, }) } + +// 溯源供方审批接口 +export function getapprovalListPage(data: object) { + return request({ + url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} diff --git a/src/router/modules/device.ts b/src/router/modules/device.ts index d67dab6..d464b09 100644 --- a/src/router/modules/device.ts +++ b/src/router/modules/device.ts @@ -437,6 +437,37 @@ auth: '/device/manage/checkList', }, }, + { + path: ':type/:id?', + name: 'maintenanceAdd', + component: () => import('@/views/device/deviceMaintenance/components/listApply/listPageAdd.vue'), + meta: { + title: '设备维护列表', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/maintenance/maintenanceList', + }, + beforeEnter: (to, from, next) => { + const type = from.path.split('/')[from.path.split('/').length - 1] + console.log(type) + switch (type) { + case 'maintenanceList': + to.meta.activeMenu = '/maintenance/maintenanceList' + to.meta.title = '设备维护列表' + break + case 'maintenanceCheckList': + to.meta.activeMenu = '/maintenance/maintenanceCheckList' + to.meta.title = '设备检修保养验收单' + break + case 'manageCheckList': + to.meta.activeMenu = '/maintenance/manageCheckList' + to.meta.title = '设备管理点检查表' + break + } + next() + }, + }, ], }, { diff --git a/src/router/modules/measure.ts b/src/router/modules/measure.ts index 710bdc2..f114ca2 100644 --- a/src/router/modules/measure.ts +++ b/src/router/modules/measure.ts @@ -278,7 +278,7 @@ icon: 'ep:key', sidebar: false, breadcrumb: true, - auth: '/train/trainPlanApprove', + activeMenu: '/train/trainPlanApprove', }, }, { diff --git a/src/views/device/deviceMaintenance/components/listApply/listPage.vue b/src/views/device/deviceMaintenance/components/listApply/listPage.vue index df90882..478f4fb 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPage.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPage.vue @@ -3,7 +3,6 @@ import type { Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { IlistQuery, IlistType } from '../list_interface' -import ListSourceAdd from './listPageAdd.vue' import { getSoucreList, getSoucreListDelete } from '@/api/system/source' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' @@ -26,6 +25,8 @@ offset: 1, limit: 10, }) +// 初始化路由 +const $router = useRouter() // 控制是否显示新增页面 const show = ref(true) // 表格数据 @@ -167,22 +168,44 @@ // }) }) } -// 点击编辑/详情 -const handleEdit = (index: string, row: rowReturn, value: string) => { - if (value === '查看' || value === '编辑') { - buttonArray.value = ['同意', '驳回', '拒绝'] - buttonType.value = value - infoId.value = row.id - show.value = false +// // 点击编辑/详情 +// const handleEdit = (index: string, row: rowReturn, value: string) => { +// if (value === '查看' || value === '编辑') { +// buttonArray.value = ['同意', '驳回', '拒绝'] +// buttonType.value = value +// infoId.value = row.id +// show.value = false +// } +// else if (value === '删除' || value === '取消' || value === '提交') { +// handleDelete(row, value) +// } +// else { +// if (value === '同意') { +// applyList.value.select = '1' +// } +// else if (value === '驳回') { +// applyList.value.select = '2' +// } +// else { +// applyList.value.select = '3' +// } +// applyList.value.approval = row.name +// applyList.value.approvalTime = row.name +// applyShow.value = true +// } +// } +const pageTypeMap = ref('') +// 点击每条数据操作 +const handleEdit = (row: rowReturn, pageType: string) => { + if (pageType === '编辑' || pageType === '查看') { + pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' + $router.push(`/maintenance/${pageTypeMap.value}/${row.id}`) } - else if (value === '删除' || value === '取消' || value === '提交') { - handleDelete(row, value) - } - else { - if (value === '同意') { + else if (pageType === '同意' || pageType === '驳回' || pageType === '拒绝') { + if (pageType === '同意') { applyList.value.select = '1' } - else if (value === '驳回') { + else if (pageType === '驳回') { applyList.value.select = '2' } else { @@ -192,6 +215,9 @@ applyList.value.approvalTime = row.name applyShow.value = true } + else { + handleDelete(row, pageType) + } } // 审批弹窗关闭 const handleClose = () => { @@ -280,9 +306,7 @@ upload() } const add = () => { - buttonArray.value = ['提交', '保存'] - buttonType.value = '' - show.value = false + $router.push('/maintenance/add') } const exportAll = () => { exportExcelBtn() @@ -396,7 +420,7 @@ :key="index" size="small" :type="item.type" link - @click="handleEdit(row.$index, row, item.name)" + @click="handleEdit(row, item.name)" > {{ item.name }} @@ -407,71 +431,68 @@ - - - - - - 同意 - - - 驳回 - - - 拒绝 - - - - - - - - - - - - + + + + + + 同意 + + + 驳回 + + + 拒绝 + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue index eb506ec..6527f2e 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue @@ -1,4 +1,4 @@ - diff --git a/src/views/device/standardEquipment/components/listApply/listPageAdd.vue b/src/views/device/standardEquipment/components/listApply/listPageAdd.vue index 2b8bef4..96aabeb 100644 --- a/src/views/device/standardEquipment/components/listApply/listPageAdd.vue +++ b/src/views/device/standardEquipment/components/listApply/listPageAdd.vue @@ -7,7 +7,7 @@ import UserListDialog from './userListDialog.vue' import { getStaffList } from '@/api/measure/person' import { getTypeSelect } from '@/api/system/price' -import { getStandardLisAdd, getStandardList, getStandardListDetail, getUsersDept } from '@/api/device/standard' +import { getStandardLisAdd, getStandardLisdetali, getStandardList, getStandardListDetail, getUsersDept } from '@/api/device/standard' import { UploadFile } from '@/api/measure/file' const loading = ref(false) // 表单加载状态 const infoId = ref('') // id diff --git a/src/views/device/standardEquipment/components/listApply/userListDialog.vue b/src/views/device/standardEquipment/components/listApply/userListDialog.vue index bbaaa1f..2792a21 100644 --- a/src/views/device/standardEquipment/components/listApply/userListDialog.vue +++ b/src/views/device/standardEquipment/components/listApply/userListDialog.vue @@ -115,7 +115,7 @@ - + diff --git a/src/views/device/standardEquipment/standardList.vue b/src/views/device/standardEquipment/standardList.vue index e9ff0ce..e858700 100644 --- a/src/views/device/standardEquipment/standardList.vue +++ b/src/views/device/standardEquipment/standardList.vue @@ -58,6 +58,7 @@ text: '标准所在部门', value: 'standardLaboratoryName', align: 'center', + width: '180', }, { text: '负责人', diff --git a/src/views/measure/source/components/listPage.vue b/src/views/measure/source/components/listPage.vue index 24f12ed..207c39f 100644 --- a/src/views/measure/source/components/listPage.vue +++ b/src/views/measure/source/components/listPage.vue @@ -2,9 +2,9 @@ import { reactive, ref } from 'vue' import type { Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' -import type { IlistQuery, IlistType } from '../list_interface' -import ListSourceAdd from './listPageAdd.vue' -import { getSoucreList, getSoucreListDelete } from '@/api/system/source' +import type { IlistType, IlistTypes } from '../list_interface' +import ManageBox from './manageBox.vue' +import { getSoucreListDelete, getapprovalListPage } from '@/api/system/source' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' const props = defineProps({ @@ -19,21 +19,28 @@ }) const emit = defineEmits(['setData']) // 关闭 // 查询条件 -const listQuery: Ref = ref({ - supplierNo: '', // 业务内容 - supplierName: '', // 溯源供方名称 - businessContent: '', // 溯源供方编号 +const listQuery: Ref = ref({ + approvalStatus: '0', + businessContent: '', + companyArea: '', + companyCity: '', + companyProvince: '', + formId: '1', + supplierName: '', + supplierNo: '', offset: 1, - limit: 10, + limit: 20, }) // 控制是否显示新增页面 const show = ref(true) // 表格数据 const list = ref([ - { name: '张三' }, + { name: '张三', id: '12' }, ]) // 总数 const total = ref(0) +// 控制审批操作弹窗的开关 +const applyShow = ref(false) // 表头 const columns = ref([ { @@ -104,12 +111,13 @@ // 是否显示当前页,否则跳转第一页 listQuery.value.offset = 1 } - getSoucreList(listQuery.value).then((response) => { + getapprovalListPage(listQuery.value).then((response) => { list.value = response.data.rows total.value = parseInt(response.data.total) loadingTable.value = false }) } +// fetchData(true) // 多选发生改变时 const handleSelectionChange = (e: any) => { checkoutList.value = e @@ -119,25 +127,11 @@ id: string supplierName: string } -// // 点击编辑/详情 -// const handleEdit = (index: string, row: rowReturn, value: string) => { -// buttonArray.value = value === '编辑' ? ['提交'] : ['同意', '驳回', '拒绝'] -// buttonType.value = value -// infoId.value = row.id -// show.value = false -// } const pageTypeMap = ref('') -// 点击编辑/详情 -const handleEdit = (row: rowReturn, pageType: string) => { - if (pageType === '编辑' || pageType === '查看') { - pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' - $router.push(`/train/trainPlanApprove/${pageTypeMap.value}/${row.id}`) - } -} -// 点击删除 -const handleDelete = (index: string, row: rowReturn) => { +// 点击删除或者取消 +const handleDelete = (row: rowReturn, pageType: string) => { ElMessageBox.confirm( - `确认删除${row.supplierName}吗?`, + `确认${pageType}${row.supplierName}吗?`, '提示', { confirmButtonText: '确认', @@ -146,17 +140,43 @@ }, ) .then(() => { - getSoucreListDelete({ id: row.id as string }).then((res) => { - if (res.code === 200) { - ElMessage({ - type: 'success', - message: '删除成功', - }) - fetchData(true) - } - }) + if (pageType === '删除') { + getSoucreListDelete({ id: row.id as string }).then((res) => { + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '删除成功', + }) + fetchData(true) + } + }) + } + else { + getSoucreListDelete({ id: row.id as string }).then((res) => { + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '取消成功', + }) + fetchData(true) + } + }) + } }) } +// 点击每条数据操作 +const handleEdit = (row: rowReturn, pageType: string) => { + if (pageType === '编辑' || pageType === '查看') { + pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' + $router.push(`/source/approve/${pageTypeMap.value}/${row.id}`) + } + else if (pageType === '同意' || pageType === '驳回' || pageType === '拒绝') { + applyShow.value = true + } + else { + handleDelete(row, pageType) + } +} // 点击搜索 const searchList = () => { fetchData(true) @@ -167,9 +187,14 @@ // 点击重置 const clearList = () => { listQuery.value = { - supplierNo: '', // 业务内容 - supplierName: '', // 溯源供方名称 - businessContent: '', // 溯源供方编号 + approvalStatus: '', + businessContent: '', + companyArea: '', + companyCity: '', + companyProvince: '', + formId: '1', + supplierName: '', + supplierNo: '', offset: 1, limit: 20, } @@ -243,6 +268,16 @@ const exportAll = () => { exportExcelBtn() } + +// 审批弹窗关闭 +const handleClose = () => { + applyShow.value = false +} +// 点击审批的提交 +const applyListSubmit = (row: any) => { + console.log(row) + handleClose() +} watch(() => show.value, (newVal) => { // 变化后存储 emit('setData', newVal) @@ -325,19 +360,6 @@ - - + - diff --git a/src/api/device/standard.ts b/src/api/device/standard.ts index ffd9e95..5ae03f9 100644 --- a/src/api/device/standard.ts +++ b/src/api/device/standard.ts @@ -67,7 +67,7 @@ // 删除申请列表信息 export function getStandardLisdelete(data: object) { return request({ - url: `${prefix}/standard/deleteStandardEquipmentApply`, + url: '/standard/deleteStandardEquipmentApply', method: 'post', data, }) @@ -76,7 +76,16 @@ // 新建申请列表信息 export function getStandardLisAdd(data: object) { return request({ - url: `${prefix}/standard/addStandardEquipmentApply`, + url: '/standard/addStandardEquipmentApply', + method: 'post', + data, + }) +} + +// 获取到申请列表信息 +export function getStandardLisdetali(data: object) { + return request({ + url: '/standard/standardEquipmentApplyInfo', method: 'post', data, }) diff --git a/src/api/system/source.ts b/src/api/system/source.ts index 65c14fe..93f5f12 100644 --- a/src/api/system/source.ts +++ b/src/api/system/source.ts @@ -55,6 +55,7 @@ data, }) } + // 导出详情 export function getSoucreLisListExport(data: object) { return request({ @@ -64,3 +65,12 @@ data, }) } + +// 溯源供方审批接口 +export function getapprovalListPage(data: object) { + return request({ + url: `${prefix}/supplier/approval/listPage?offset=${data.offset}&limit=${data.limit}`, + method: 'post', + data, + }) +} diff --git a/src/router/modules/device.ts b/src/router/modules/device.ts index d67dab6..d464b09 100644 --- a/src/router/modules/device.ts +++ b/src/router/modules/device.ts @@ -437,6 +437,37 @@ auth: '/device/manage/checkList', }, }, + { + path: ':type/:id?', + name: 'maintenanceAdd', + component: () => import('@/views/device/deviceMaintenance/components/listApply/listPageAdd.vue'), + meta: { + title: '设备维护列表', + icon: 'ep:key', + sidebar: false, + breadcrumb: true, + activeMenu: '/maintenance/maintenanceList', + }, + beforeEnter: (to, from, next) => { + const type = from.path.split('/')[from.path.split('/').length - 1] + console.log(type) + switch (type) { + case 'maintenanceList': + to.meta.activeMenu = '/maintenance/maintenanceList' + to.meta.title = '设备维护列表' + break + case 'maintenanceCheckList': + to.meta.activeMenu = '/maintenance/maintenanceCheckList' + to.meta.title = '设备检修保养验收单' + break + case 'manageCheckList': + to.meta.activeMenu = '/maintenance/manageCheckList' + to.meta.title = '设备管理点检查表' + break + } + next() + }, + }, ], }, { diff --git a/src/router/modules/measure.ts b/src/router/modules/measure.ts index 710bdc2..f114ca2 100644 --- a/src/router/modules/measure.ts +++ b/src/router/modules/measure.ts @@ -278,7 +278,7 @@ icon: 'ep:key', sidebar: false, breadcrumb: true, - auth: '/train/trainPlanApprove', + activeMenu: '/train/trainPlanApprove', }, }, { diff --git a/src/views/device/deviceMaintenance/components/listApply/listPage.vue b/src/views/device/deviceMaintenance/components/listApply/listPage.vue index df90882..478f4fb 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPage.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPage.vue @@ -3,7 +3,6 @@ import type { Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' import type { IlistQuery, IlistType } from '../list_interface' -import ListSourceAdd from './listPageAdd.vue' import { getSoucreList, getSoucreListDelete } from '@/api/system/source' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' @@ -26,6 +25,8 @@ offset: 1, limit: 10, }) +// 初始化路由 +const $router = useRouter() // 控制是否显示新增页面 const show = ref(true) // 表格数据 @@ -167,22 +168,44 @@ // }) }) } -// 点击编辑/详情 -const handleEdit = (index: string, row: rowReturn, value: string) => { - if (value === '查看' || value === '编辑') { - buttonArray.value = ['同意', '驳回', '拒绝'] - buttonType.value = value - infoId.value = row.id - show.value = false +// // 点击编辑/详情 +// const handleEdit = (index: string, row: rowReturn, value: string) => { +// if (value === '查看' || value === '编辑') { +// buttonArray.value = ['同意', '驳回', '拒绝'] +// buttonType.value = value +// infoId.value = row.id +// show.value = false +// } +// else if (value === '删除' || value === '取消' || value === '提交') { +// handleDelete(row, value) +// } +// else { +// if (value === '同意') { +// applyList.value.select = '1' +// } +// else if (value === '驳回') { +// applyList.value.select = '2' +// } +// else { +// applyList.value.select = '3' +// } +// applyList.value.approval = row.name +// applyList.value.approvalTime = row.name +// applyShow.value = true +// } +// } +const pageTypeMap = ref('') +// 点击每条数据操作 +const handleEdit = (row: rowReturn, pageType: string) => { + if (pageType === '编辑' || pageType === '查看') { + pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' + $router.push(`/maintenance/${pageTypeMap.value}/${row.id}`) } - else if (value === '删除' || value === '取消' || value === '提交') { - handleDelete(row, value) - } - else { - if (value === '同意') { + else if (pageType === '同意' || pageType === '驳回' || pageType === '拒绝') { + if (pageType === '同意') { applyList.value.select = '1' } - else if (value === '驳回') { + else if (pageType === '驳回') { applyList.value.select = '2' } else { @@ -192,6 +215,9 @@ applyList.value.approvalTime = row.name applyShow.value = true } + else { + handleDelete(row, pageType) + } } // 审批弹窗关闭 const handleClose = () => { @@ -280,9 +306,7 @@ upload() } const add = () => { - buttonArray.value = ['提交', '保存'] - buttonType.value = '' - show.value = false + $router.push('/maintenance/add') } const exportAll = () => { exportExcelBtn() @@ -396,7 +420,7 @@ :key="index" size="small" :type="item.type" link - @click="handleEdit(row.$index, row, item.name)" + @click="handleEdit(row, item.name)" > {{ item.name }} @@ -407,71 +431,68 @@ - - - - - - 同意 - - - 驳回 - - - 拒绝 - - - - - - - - - - - - + + + + + + 同意 + + + 驳回 + + + 拒绝 + + + + + + + + + + + + + + + + + + + + + + + + - - diff --git a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue index eb506ec..6527f2e 100644 --- a/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue +++ b/src/views/device/deviceMaintenance/components/listApply/listPageAdd.vue @@ -1,4 +1,4 @@ - diff --git a/src/views/device/standardEquipment/components/listApply/listPageAdd.vue b/src/views/device/standardEquipment/components/listApply/listPageAdd.vue index 2b8bef4..96aabeb 100644 --- a/src/views/device/standardEquipment/components/listApply/listPageAdd.vue +++ b/src/views/device/standardEquipment/components/listApply/listPageAdd.vue @@ -7,7 +7,7 @@ import UserListDialog from './userListDialog.vue' import { getStaffList } from '@/api/measure/person' import { getTypeSelect } from '@/api/system/price' -import { getStandardLisAdd, getStandardList, getStandardListDetail, getUsersDept } from '@/api/device/standard' +import { getStandardLisAdd, getStandardLisdetali, getStandardList, getStandardListDetail, getUsersDept } from '@/api/device/standard' import { UploadFile } from '@/api/measure/file' const loading = ref(false) // 表单加载状态 const infoId = ref('') // id diff --git a/src/views/device/standardEquipment/components/listApply/userListDialog.vue b/src/views/device/standardEquipment/components/listApply/userListDialog.vue index bbaaa1f..2792a21 100644 --- a/src/views/device/standardEquipment/components/listApply/userListDialog.vue +++ b/src/views/device/standardEquipment/components/listApply/userListDialog.vue @@ -115,7 +115,7 @@ - + diff --git a/src/views/device/standardEquipment/standardList.vue b/src/views/device/standardEquipment/standardList.vue index e9ff0ce..e858700 100644 --- a/src/views/device/standardEquipment/standardList.vue +++ b/src/views/device/standardEquipment/standardList.vue @@ -58,6 +58,7 @@ text: '标准所在部门', value: 'standardLaboratoryName', align: 'center', + width: '180', }, { text: '负责人', diff --git a/src/views/measure/source/components/listPage.vue b/src/views/measure/source/components/listPage.vue index 24f12ed..207c39f 100644 --- a/src/views/measure/source/components/listPage.vue +++ b/src/views/measure/source/components/listPage.vue @@ -2,9 +2,9 @@ import { reactive, ref } from 'vue' import type { Ref } from 'vue' import { ElLoading, ElMessage, ElMessageBox } from 'element-plus' -import type { IlistQuery, IlistType } from '../list_interface' -import ListSourceAdd from './listPageAdd.vue' -import { getSoucreList, getSoucreListDelete } from '@/api/system/source' +import type { IlistType, IlistTypes } from '../list_interface' +import ManageBox from './manageBox.vue' +import { getSoucreListDelete, getapprovalListPage } from '@/api/system/source' import { uploadApi } from '@/api/system/notice' import { exportExcel } from '@/utils/exportXlsx' const props = defineProps({ @@ -19,21 +19,28 @@ }) const emit = defineEmits(['setData']) // 关闭 // 查询条件 -const listQuery: Ref = ref({ - supplierNo: '', // 业务内容 - supplierName: '', // 溯源供方名称 - businessContent: '', // 溯源供方编号 +const listQuery: Ref = ref({ + approvalStatus: '0', + businessContent: '', + companyArea: '', + companyCity: '', + companyProvince: '', + formId: '1', + supplierName: '', + supplierNo: '', offset: 1, - limit: 10, + limit: 20, }) // 控制是否显示新增页面 const show = ref(true) // 表格数据 const list = ref([ - { name: '张三' }, + { name: '张三', id: '12' }, ]) // 总数 const total = ref(0) +// 控制审批操作弹窗的开关 +const applyShow = ref(false) // 表头 const columns = ref([ { @@ -104,12 +111,13 @@ // 是否显示当前页,否则跳转第一页 listQuery.value.offset = 1 } - getSoucreList(listQuery.value).then((response) => { + getapprovalListPage(listQuery.value).then((response) => { list.value = response.data.rows total.value = parseInt(response.data.total) loadingTable.value = false }) } +// fetchData(true) // 多选发生改变时 const handleSelectionChange = (e: any) => { checkoutList.value = e @@ -119,25 +127,11 @@ id: string supplierName: string } -// // 点击编辑/详情 -// const handleEdit = (index: string, row: rowReturn, value: string) => { -// buttonArray.value = value === '编辑' ? ['提交'] : ['同意', '驳回', '拒绝'] -// buttonType.value = value -// infoId.value = row.id -// show.value = false -// } const pageTypeMap = ref('') -// 点击编辑/详情 -const handleEdit = (row: rowReturn, pageType: string) => { - if (pageType === '编辑' || pageType === '查看') { - pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' - $router.push(`/train/trainPlanApprove/${pageTypeMap.value}/${row.id}`) - } -} -// 点击删除 -const handleDelete = (index: string, row: rowReturn) => { +// 点击删除或者取消 +const handleDelete = (row: rowReturn, pageType: string) => { ElMessageBox.confirm( - `确认删除${row.supplierName}吗?`, + `确认${pageType}${row.supplierName}吗?`, '提示', { confirmButtonText: '确认', @@ -146,17 +140,43 @@ }, ) .then(() => { - getSoucreListDelete({ id: row.id as string }).then((res) => { - if (res.code === 200) { - ElMessage({ - type: 'success', - message: '删除成功', - }) - fetchData(true) - } - }) + if (pageType === '删除') { + getSoucreListDelete({ id: row.id as string }).then((res) => { + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '删除成功', + }) + fetchData(true) + } + }) + } + else { + getSoucreListDelete({ id: row.id as string }).then((res) => { + if (res.code === 200) { + ElMessage({ + type: 'success', + message: '取消成功', + }) + fetchData(true) + } + }) + } }) } +// 点击每条数据操作 +const handleEdit = (row: rowReturn, pageType: string) => { + if (pageType === '编辑' || pageType === '查看') { + pageTypeMap.value = pageType === '编辑' ? 'edit' : 'detail' + $router.push(`/source/approve/${pageTypeMap.value}/${row.id}`) + } + else if (pageType === '同意' || pageType === '驳回' || pageType === '拒绝') { + applyShow.value = true + } + else { + handleDelete(row, pageType) + } +} // 点击搜索 const searchList = () => { fetchData(true) @@ -167,9 +187,14 @@ // 点击重置 const clearList = () => { listQuery.value = { - supplierNo: '', // 业务内容 - supplierName: '', // 溯源供方名称 - businessContent: '', // 溯源供方编号 + approvalStatus: '', + businessContent: '', + companyArea: '', + companyCity: '', + companyProvince: '', + formId: '1', + supplierName: '', + supplierNo: '', offset: 1, limit: 20, } @@ -243,6 +268,16 @@ const exportAll = () => { exportExcelBtn() } + +// 审批弹窗关闭 +const handleClose = () => { + applyShow.value = false +} +// 点击审批的提交 +const applyListSubmit = (row: any) => { + console.log(row) + handleClose() +} watch(() => show.value, (newVal) => { // 变化后存储 emit('setData', newVal) @@ -325,19 +360,6 @@ - - + - diff --git a/src/views/measure/source/components/listPageAdd.vue b/src/views/measure/source/components/listPageAdd.vue index f3eae25..289b3e4 100644 --- a/src/views/measure/source/components/listPageAdd.vue +++ b/src/views/measure/source/components/listPageAdd.vue @@ -3,7 +3,9 @@ import type { Ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadInstance, UploadProps, UploadUserFile } from 'element-plus' -import type { IformInline } from './list_interface' +import type { IformInline, traceSupplierPerson } from '../list_interface' +import ManageBox from './manageBox.vue' +import showPhoto from '@/views/system/tool/showPhoto.vue' import { exportFile } from '@/utils/exportUtils' import { UploadFile } from '@/api/measure/file' import { getSoucreLisListExport, getSoucreLisUpdate, getSoucreListAdd, getSoucreListDetail, getSoucreListlevelType } from '@/api/system/source' @@ -67,6 +69,7 @@ traceSupplierPersonList: [], }) const ruleFormRef = ref() +const traceSupplierPersonList: Ref = ref([]) const columns = [ { text: '人员编号', value: 'personNo' }, { text: '姓名', value: 'name' }, @@ -74,6 +77,8 @@ { text: '职务', value: 'job' }, { text: '联系方式', value: 'phone' }, ] +// 控制审批弹窗开关 +const applyShow = ref(false) const rules = ref({ supplierNo: [{ required: true, message: '溯源供方编号不能为空', trigger: 'blur' }], supplierName: [{ required: true, message: '公司名称不能为空', trigger: 'blur' }], @@ -96,7 +101,6 @@ phone: '', }) const SelectionList = ref([]) -const upload = ref() // 初始化router const $router = useRouter() // 关闭新增页面的回调 @@ -159,18 +163,38 @@ }) } // 点击增加行 -const addRoow = () => { - Object.keys(addPersonList.value).forEach(key => (addPersonList.value[key] = '')) - dialogVisible.value = true +const addRow = () => { + // 检查上一行必填项 + if (checkPersonList()) { + setAllRowReadable() + traceSupplierPersonList.value.push({ ...addPersonObj }) + } } -// 点击关闭 -const handleClose = () => { - dialogVisible.value = false +// 检查人员列表 +function checkPersonList() { + for (let index = 0; index < traceSupplierPersonList.value.length; index++) { + const item = traceSupplierPersonList.value[index] + for (const prop of columns.value) { + // 检查必填 + if (prop.required && !item[prop.value]) { + ElMessage.warning(`请先完善第${index + 1}行中${prop.text}`) + return false + } + // 验证正则 + if (prop.reg && typeof prop.reg === 'function') { + if (!prop.reg(item[prop.value])) { + ElMessage.warning(`第${index + 1}行中${prop.text}输入不合法`) + return false + } + } + } + } + return true } // 点击弹窗的完成追加到表格数组中 const addPushList = () => { formInline.value.traceSupplierPersonList.push(JSON.parse(JSON.stringify(addPersonList.value))) - handleClose() + handleVisibleClose() } // 删除行 const deleteList = () => { @@ -180,6 +204,7 @@ } // 点击提交/导出按钮 const getAddList = async (formEl: FormInstance | undefined, type: string) => { + console.log('6666') if (type === '提交' && pageType.value === 'edit') { if (!formEl) { return } await formEl.validate((valid, fields) => { @@ -211,65 +236,52 @@ }) } else { - const params = { - businessContent: formInline.value.businessContent, - supplierName: formInline.value.supplierName, - supplierNo: formInline.value.supplierNo, - } - getSoucreLisListExport(params).then((res) => { - exportFile(res.data, '溯源供方详情') + applyShow.value = true + } +} +// 审批弹窗关闭 +const handleClose = () => { + applyShow.value = false +} +// 点击审批的提交 +const applyListSubmit = (row: any) => { + console.log(row) + handleClose() +} +const fileRef = ref() // 文件上传input +const onFileChange = (event: any) => { + // 原生上传 + console.log(event.target.files) + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('multipartFile', event.target.files[0]) + UploadFile(fd).then((res) => { + if (res.code === 200) { + formInline.value.minioFileName = res.data[0] + // 重置当前验证 + ElMessage.success('文件上传成功') + } + else { + ElMessage.error(res.message) + } }) } } -const handleExceed: UploadProps['onExceed'] = (files, uploadFiles) => { - ElMessage.warning('只能上传一个文件') +const upload = () => { + fileRef.value.click() } -// 移除时触发 -const beforeRemove: UploadProps['beforeRemove'] = (uploadFile, uploadFiles) => { - return ElMessageBox.confirm( - `确认移除${uploadFile.name}文件吗 ?`, - ).then( - () => true, - () => false, - - ) +// 双击行显示输入框 +const dblclickRow = (row: traceSupplierPerson) => { + setAllRowReadable() + row.editable = true } -const isShow = ref(false) -const testForm = ref({ - fileList: [], - fileContent: '', -}) -const handleFileChange = (files: any, fileList: any) => { - testForm.value.fileList = fileList - const reader = new FileReader() - reader.readAsText(files.raw) - reader.onload = (e) => { - testForm.value.fileContent = e.target!.result?.replace( - /\n|\r\n/g, - '
', - ) +// 将所有人员信息列表置为不可编辑状态 +function setAllRowReadable() { + for (const item of traceSupplierPersonList.value) { + item.editable = false } } -// 点击文件预览 -const uploadShow = (e: any) => { - const URL = window.URL || window.webkitURL - window.open(URL.createObjectURL(e.raw)) -} -// 上传请求 -const uploadQuarterlyEvaluateFile = (file: File) => { - UploadFile(file).then((res) => { - if (res.code === 200) { - formInline.value.minioFileName = res.data.fileName - // fileList.value.push({ - // name: res.data.fileName, - // url: res.data.fileId, - // // type: file.file.type, - // }) - // 重置当前验证 - ElMessage.success('文件上传成功') - } - }) -} if (pageType.value !== 'add') { getInfo() } @@ -279,7 +291,7 @@ - diff --git a/src/views/measure/source/components/listPageAdd.vue b/src/views/measure/source/components/listPageAdd.vue index f3eae25..289b3e4 100644 --- a/src/views/measure/source/components/listPageAdd.vue +++ b/src/views/measure/source/components/listPageAdd.vue @@ -3,7 +3,9 @@ import type { Ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadInstance, UploadProps, UploadUserFile } from 'element-plus' -import type { IformInline } from './list_interface' +import type { IformInline, traceSupplierPerson } from '../list_interface' +import ManageBox from './manageBox.vue' +import showPhoto from '@/views/system/tool/showPhoto.vue' import { exportFile } from '@/utils/exportUtils' import { UploadFile } from '@/api/measure/file' import { getSoucreLisListExport, getSoucreLisUpdate, getSoucreListAdd, getSoucreListDetail, getSoucreListlevelType } from '@/api/system/source' @@ -67,6 +69,7 @@ traceSupplierPersonList: [], }) const ruleFormRef = ref() +const traceSupplierPersonList: Ref = ref([]) const columns = [ { text: '人员编号', value: 'personNo' }, { text: '姓名', value: 'name' }, @@ -74,6 +77,8 @@ { text: '职务', value: 'job' }, { text: '联系方式', value: 'phone' }, ] +// 控制审批弹窗开关 +const applyShow = ref(false) const rules = ref({ supplierNo: [{ required: true, message: '溯源供方编号不能为空', trigger: 'blur' }], supplierName: [{ required: true, message: '公司名称不能为空', trigger: 'blur' }], @@ -96,7 +101,6 @@ phone: '', }) const SelectionList = ref([]) -const upload = ref() // 初始化router const $router = useRouter() // 关闭新增页面的回调 @@ -159,18 +163,38 @@ }) } // 点击增加行 -const addRoow = () => { - Object.keys(addPersonList.value).forEach(key => (addPersonList.value[key] = '')) - dialogVisible.value = true +const addRow = () => { + // 检查上一行必填项 + if (checkPersonList()) { + setAllRowReadable() + traceSupplierPersonList.value.push({ ...addPersonObj }) + } } -// 点击关闭 -const handleClose = () => { - dialogVisible.value = false +// 检查人员列表 +function checkPersonList() { + for (let index = 0; index < traceSupplierPersonList.value.length; index++) { + const item = traceSupplierPersonList.value[index] + for (const prop of columns.value) { + // 检查必填 + if (prop.required && !item[prop.value]) { + ElMessage.warning(`请先完善第${index + 1}行中${prop.text}`) + return false + } + // 验证正则 + if (prop.reg && typeof prop.reg === 'function') { + if (!prop.reg(item[prop.value])) { + ElMessage.warning(`第${index + 1}行中${prop.text}输入不合法`) + return false + } + } + } + } + return true } // 点击弹窗的完成追加到表格数组中 const addPushList = () => { formInline.value.traceSupplierPersonList.push(JSON.parse(JSON.stringify(addPersonList.value))) - handleClose() + handleVisibleClose() } // 删除行 const deleteList = () => { @@ -180,6 +204,7 @@ } // 点击提交/导出按钮 const getAddList = async (formEl: FormInstance | undefined, type: string) => { + console.log('6666') if (type === '提交' && pageType.value === 'edit') { if (!formEl) { return } await formEl.validate((valid, fields) => { @@ -211,65 +236,52 @@ }) } else { - const params = { - businessContent: formInline.value.businessContent, - supplierName: formInline.value.supplierName, - supplierNo: formInline.value.supplierNo, - } - getSoucreLisListExport(params).then((res) => { - exportFile(res.data, '溯源供方详情') + applyShow.value = true + } +} +// 审批弹窗关闭 +const handleClose = () => { + applyShow.value = false +} +// 点击审批的提交 +const applyListSubmit = (row: any) => { + console.log(row) + handleClose() +} +const fileRef = ref() // 文件上传input +const onFileChange = (event: any) => { + // 原生上传 + console.log(event.target.files) + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('multipartFile', event.target.files[0]) + UploadFile(fd).then((res) => { + if (res.code === 200) { + formInline.value.minioFileName = res.data[0] + // 重置当前验证 + ElMessage.success('文件上传成功') + } + else { + ElMessage.error(res.message) + } }) } } -const handleExceed: UploadProps['onExceed'] = (files, uploadFiles) => { - ElMessage.warning('只能上传一个文件') +const upload = () => { + fileRef.value.click() } -// 移除时触发 -const beforeRemove: UploadProps['beforeRemove'] = (uploadFile, uploadFiles) => { - return ElMessageBox.confirm( - `确认移除${uploadFile.name}文件吗 ?`, - ).then( - () => true, - () => false, - - ) +// 双击行显示输入框 +const dblclickRow = (row: traceSupplierPerson) => { + setAllRowReadable() + row.editable = true } -const isShow = ref(false) -const testForm = ref({ - fileList: [], - fileContent: '', -}) -const handleFileChange = (files: any, fileList: any) => { - testForm.value.fileList = fileList - const reader = new FileReader() - reader.readAsText(files.raw) - reader.onload = (e) => { - testForm.value.fileContent = e.target!.result?.replace( - /\n|\r\n/g, - '
', - ) +// 将所有人员信息列表置为不可编辑状态 +function setAllRowReadable() { + for (const item of traceSupplierPersonList.value) { + item.editable = false } } -// 点击文件预览 -const uploadShow = (e: any) => { - const URL = window.URL || window.webkitURL - window.open(URL.createObjectURL(e.raw)) -} -// 上传请求 -const uploadQuarterlyEvaluateFile = (file: File) => { - UploadFile(file).then((res) => { - if (res.code === 200) { - formInline.value.minioFileName = res.data.fileName - // fileList.value.push({ - // name: res.data.fileName, - // url: res.data.fileId, - // // type: file.file.type, - // }) - // 重置当前验证 - ElMessage.success('文件上传成功') - } - }) -} if (pageType.value !== 'add') { getInfo() } @@ -279,7 +291,7 @@ - diff --git a/src/views/measure/source/components/listPageAdd.vue b/src/views/measure/source/components/listPageAdd.vue index f3eae25..289b3e4 100644 --- a/src/views/measure/source/components/listPageAdd.vue +++ b/src/views/measure/source/components/listPageAdd.vue @@ -3,7 +3,9 @@ import type { Ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadInstance, UploadProps, UploadUserFile } from 'element-plus' -import type { IformInline } from './list_interface' +import type { IformInline, traceSupplierPerson } from '../list_interface' +import ManageBox from './manageBox.vue' +import showPhoto from '@/views/system/tool/showPhoto.vue' import { exportFile } from '@/utils/exportUtils' import { UploadFile } from '@/api/measure/file' import { getSoucreLisListExport, getSoucreLisUpdate, getSoucreListAdd, getSoucreListDetail, getSoucreListlevelType } from '@/api/system/source' @@ -67,6 +69,7 @@ traceSupplierPersonList: [], }) const ruleFormRef = ref() +const traceSupplierPersonList: Ref = ref([]) const columns = [ { text: '人员编号', value: 'personNo' }, { text: '姓名', value: 'name' }, @@ -74,6 +77,8 @@ { text: '职务', value: 'job' }, { text: '联系方式', value: 'phone' }, ] +// 控制审批弹窗开关 +const applyShow = ref(false) const rules = ref({ supplierNo: [{ required: true, message: '溯源供方编号不能为空', trigger: 'blur' }], supplierName: [{ required: true, message: '公司名称不能为空', trigger: 'blur' }], @@ -96,7 +101,6 @@ phone: '', }) const SelectionList = ref([]) -const upload = ref() // 初始化router const $router = useRouter() // 关闭新增页面的回调 @@ -159,18 +163,38 @@ }) } // 点击增加行 -const addRoow = () => { - Object.keys(addPersonList.value).forEach(key => (addPersonList.value[key] = '')) - dialogVisible.value = true +const addRow = () => { + // 检查上一行必填项 + if (checkPersonList()) { + setAllRowReadable() + traceSupplierPersonList.value.push({ ...addPersonObj }) + } } -// 点击关闭 -const handleClose = () => { - dialogVisible.value = false +// 检查人员列表 +function checkPersonList() { + for (let index = 0; index < traceSupplierPersonList.value.length; index++) { + const item = traceSupplierPersonList.value[index] + for (const prop of columns.value) { + // 检查必填 + if (prop.required && !item[prop.value]) { + ElMessage.warning(`请先完善第${index + 1}行中${prop.text}`) + return false + } + // 验证正则 + if (prop.reg && typeof prop.reg === 'function') { + if (!prop.reg(item[prop.value])) { + ElMessage.warning(`第${index + 1}行中${prop.text}输入不合法`) + return false + } + } + } + } + return true } // 点击弹窗的完成追加到表格数组中 const addPushList = () => { formInline.value.traceSupplierPersonList.push(JSON.parse(JSON.stringify(addPersonList.value))) - handleClose() + handleVisibleClose() } // 删除行 const deleteList = () => { @@ -180,6 +204,7 @@ } // 点击提交/导出按钮 const getAddList = async (formEl: FormInstance | undefined, type: string) => { + console.log('6666') if (type === '提交' && pageType.value === 'edit') { if (!formEl) { return } await formEl.validate((valid, fields) => { @@ -211,65 +236,52 @@ }) } else { - const params = { - businessContent: formInline.value.businessContent, - supplierName: formInline.value.supplierName, - supplierNo: formInline.value.supplierNo, - } - getSoucreLisListExport(params).then((res) => { - exportFile(res.data, '溯源供方详情') + applyShow.value = true + } +} +// 审批弹窗关闭 +const handleClose = () => { + applyShow.value = false +} +// 点击审批的提交 +const applyListSubmit = (row: any) => { + console.log(row) + handleClose() +} +const fileRef = ref() // 文件上传input +const onFileChange = (event: any) => { + // 原生上传 + console.log(event.target.files) + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('multipartFile', event.target.files[0]) + UploadFile(fd).then((res) => { + if (res.code === 200) { + formInline.value.minioFileName = res.data[0] + // 重置当前验证 + ElMessage.success('文件上传成功') + } + else { + ElMessage.error(res.message) + } }) } } -const handleExceed: UploadProps['onExceed'] = (files, uploadFiles) => { - ElMessage.warning('只能上传一个文件') +const upload = () => { + fileRef.value.click() } -// 移除时触发 -const beforeRemove: UploadProps['beforeRemove'] = (uploadFile, uploadFiles) => { - return ElMessageBox.confirm( - `确认移除${uploadFile.name}文件吗 ?`, - ).then( - () => true, - () => false, - - ) +// 双击行显示输入框 +const dblclickRow = (row: traceSupplierPerson) => { + setAllRowReadable() + row.editable = true } -const isShow = ref(false) -const testForm = ref({ - fileList: [], - fileContent: '', -}) -const handleFileChange = (files: any, fileList: any) => { - testForm.value.fileList = fileList - const reader = new FileReader() - reader.readAsText(files.raw) - reader.onload = (e) => { - testForm.value.fileContent = e.target!.result?.replace( - /\n|\r\n/g, - '
', - ) +// 将所有人员信息列表置为不可编辑状态 +function setAllRowReadable() { + for (const item of traceSupplierPersonList.value) { + item.editable = false } } -// 点击文件预览 -const uploadShow = (e: any) => { - const URL = window.URL || window.webkitURL - window.open(URL.createObjectURL(e.raw)) -} -// 上传请求 -const uploadQuarterlyEvaluateFile = (file: File) => { - UploadFile(file).then((res) => { - if (res.code === 200) { - formInline.value.minioFileName = res.data.fileName - // fileList.value.push({ - // name: res.data.fileName, - // url: res.data.fileId, - // // type: file.file.type, - // }) - // 重置当前验证 - ElMessage.success('文件上传成功') - } - }) -} if (pageType.value !== 'add') { getInfo() } @@ -279,7 +291,7 @@ - diff --git a/src/views/measure/source/components/listPageAdd.vue b/src/views/measure/source/components/listPageAdd.vue index f3eae25..289b3e4 100644 --- a/src/views/measure/source/components/listPageAdd.vue +++ b/src/views/measure/source/components/listPageAdd.vue @@ -3,7 +3,9 @@ import type { Ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadInstance, UploadProps, UploadUserFile } from 'element-plus' -import type { IformInline } from './list_interface' +import type { IformInline, traceSupplierPerson } from '../list_interface' +import ManageBox from './manageBox.vue' +import showPhoto from '@/views/system/tool/showPhoto.vue' import { exportFile } from '@/utils/exportUtils' import { UploadFile } from '@/api/measure/file' import { getSoucreLisListExport, getSoucreLisUpdate, getSoucreListAdd, getSoucreListDetail, getSoucreListlevelType } from '@/api/system/source' @@ -67,6 +69,7 @@ traceSupplierPersonList: [], }) const ruleFormRef = ref() +const traceSupplierPersonList: Ref = ref([]) const columns = [ { text: '人员编号', value: 'personNo' }, { text: '姓名', value: 'name' }, @@ -74,6 +77,8 @@ { text: '职务', value: 'job' }, { text: '联系方式', value: 'phone' }, ] +// 控制审批弹窗开关 +const applyShow = ref(false) const rules = ref({ supplierNo: [{ required: true, message: '溯源供方编号不能为空', trigger: 'blur' }], supplierName: [{ required: true, message: '公司名称不能为空', trigger: 'blur' }], @@ -96,7 +101,6 @@ phone: '', }) const SelectionList = ref([]) -const upload = ref() // 初始化router const $router = useRouter() // 关闭新增页面的回调 @@ -159,18 +163,38 @@ }) } // 点击增加行 -const addRoow = () => { - Object.keys(addPersonList.value).forEach(key => (addPersonList.value[key] = '')) - dialogVisible.value = true +const addRow = () => { + // 检查上一行必填项 + if (checkPersonList()) { + setAllRowReadable() + traceSupplierPersonList.value.push({ ...addPersonObj }) + } } -// 点击关闭 -const handleClose = () => { - dialogVisible.value = false +// 检查人员列表 +function checkPersonList() { + for (let index = 0; index < traceSupplierPersonList.value.length; index++) { + const item = traceSupplierPersonList.value[index] + for (const prop of columns.value) { + // 检查必填 + if (prop.required && !item[prop.value]) { + ElMessage.warning(`请先完善第${index + 1}行中${prop.text}`) + return false + } + // 验证正则 + if (prop.reg && typeof prop.reg === 'function') { + if (!prop.reg(item[prop.value])) { + ElMessage.warning(`第${index + 1}行中${prop.text}输入不合法`) + return false + } + } + } + } + return true } // 点击弹窗的完成追加到表格数组中 const addPushList = () => { formInline.value.traceSupplierPersonList.push(JSON.parse(JSON.stringify(addPersonList.value))) - handleClose() + handleVisibleClose() } // 删除行 const deleteList = () => { @@ -180,6 +204,7 @@ } // 点击提交/导出按钮 const getAddList = async (formEl: FormInstance | undefined, type: string) => { + console.log('6666') if (type === '提交' && pageType.value === 'edit') { if (!formEl) { return } await formEl.validate((valid, fields) => { @@ -211,65 +236,52 @@ }) } else { - const params = { - businessContent: formInline.value.businessContent, - supplierName: formInline.value.supplierName, - supplierNo: formInline.value.supplierNo, - } - getSoucreLisListExport(params).then((res) => { - exportFile(res.data, '溯源供方详情') + applyShow.value = true + } +} +// 审批弹窗关闭 +const handleClose = () => { + applyShow.value = false +} +// 点击审批的提交 +const applyListSubmit = (row: any) => { + console.log(row) + handleClose() +} +const fileRef = ref() // 文件上传input +const onFileChange = (event: any) => { + // 原生上传 + console.log(event.target.files) + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('multipartFile', event.target.files[0]) + UploadFile(fd).then((res) => { + if (res.code === 200) { + formInline.value.minioFileName = res.data[0] + // 重置当前验证 + ElMessage.success('文件上传成功') + } + else { + ElMessage.error(res.message) + } }) } } -const handleExceed: UploadProps['onExceed'] = (files, uploadFiles) => { - ElMessage.warning('只能上传一个文件') +const upload = () => { + fileRef.value.click() } -// 移除时触发 -const beforeRemove: UploadProps['beforeRemove'] = (uploadFile, uploadFiles) => { - return ElMessageBox.confirm( - `确认移除${uploadFile.name}文件吗 ?`, - ).then( - () => true, - () => false, - - ) +// 双击行显示输入框 +const dblclickRow = (row: traceSupplierPerson) => { + setAllRowReadable() + row.editable = true } -const isShow = ref(false) -const testForm = ref({ - fileList: [], - fileContent: '', -}) -const handleFileChange = (files: any, fileList: any) => { - testForm.value.fileList = fileList - const reader = new FileReader() - reader.readAsText(files.raw) - reader.onload = (e) => { - testForm.value.fileContent = e.target!.result?.replace( - /\n|\r\n/g, - '
', - ) +// 将所有人员信息列表置为不可编辑状态 +function setAllRowReadable() { + for (const item of traceSupplierPersonList.value) { + item.editable = false } } -// 点击文件预览 -const uploadShow = (e: any) => { - const URL = window.URL || window.webkitURL - window.open(URL.createObjectURL(e.raw)) -} -// 上传请求 -const uploadQuarterlyEvaluateFile = (file: File) => { - UploadFile(file).then((res) => { - if (res.code === 200) { - formInline.value.minioFileName = res.data.fileName - // fileList.value.push({ - // name: res.data.fileName, - // url: res.data.fileId, - // // type: file.file.type, - // }) - // 重置当前验证 - ElMessage.success('文件上传成功') - } - }) -} if (pageType.value !== 'add') { getInfo() } @@ -279,7 +291,7 @@ - diff --git a/src/views/measure/source/components/listPageAdd.vue b/src/views/measure/source/components/listPageAdd.vue index f3eae25..289b3e4 100644 --- a/src/views/measure/source/components/listPageAdd.vue +++ b/src/views/measure/source/components/listPageAdd.vue @@ -3,7 +3,9 @@ import type { Ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadInstance, UploadProps, UploadUserFile } from 'element-plus' -import type { IformInline } from './list_interface' +import type { IformInline, traceSupplierPerson } from '../list_interface' +import ManageBox from './manageBox.vue' +import showPhoto from '@/views/system/tool/showPhoto.vue' import { exportFile } from '@/utils/exportUtils' import { UploadFile } from '@/api/measure/file' import { getSoucreLisListExport, getSoucreLisUpdate, getSoucreListAdd, getSoucreListDetail, getSoucreListlevelType } from '@/api/system/source' @@ -67,6 +69,7 @@ traceSupplierPersonList: [], }) const ruleFormRef = ref() +const traceSupplierPersonList: Ref = ref([]) const columns = [ { text: '人员编号', value: 'personNo' }, { text: '姓名', value: 'name' }, @@ -74,6 +77,8 @@ { text: '职务', value: 'job' }, { text: '联系方式', value: 'phone' }, ] +// 控制审批弹窗开关 +const applyShow = ref(false) const rules = ref({ supplierNo: [{ required: true, message: '溯源供方编号不能为空', trigger: 'blur' }], supplierName: [{ required: true, message: '公司名称不能为空', trigger: 'blur' }], @@ -96,7 +101,6 @@ phone: '', }) const SelectionList = ref([]) -const upload = ref() // 初始化router const $router = useRouter() // 关闭新增页面的回调 @@ -159,18 +163,38 @@ }) } // 点击增加行 -const addRoow = () => { - Object.keys(addPersonList.value).forEach(key => (addPersonList.value[key] = '')) - dialogVisible.value = true +const addRow = () => { + // 检查上一行必填项 + if (checkPersonList()) { + setAllRowReadable() + traceSupplierPersonList.value.push({ ...addPersonObj }) + } } -// 点击关闭 -const handleClose = () => { - dialogVisible.value = false +// 检查人员列表 +function checkPersonList() { + for (let index = 0; index < traceSupplierPersonList.value.length; index++) { + const item = traceSupplierPersonList.value[index] + for (const prop of columns.value) { + // 检查必填 + if (prop.required && !item[prop.value]) { + ElMessage.warning(`请先完善第${index + 1}行中${prop.text}`) + return false + } + // 验证正则 + if (prop.reg && typeof prop.reg === 'function') { + if (!prop.reg(item[prop.value])) { + ElMessage.warning(`第${index + 1}行中${prop.text}输入不合法`) + return false + } + } + } + } + return true } // 点击弹窗的完成追加到表格数组中 const addPushList = () => { formInline.value.traceSupplierPersonList.push(JSON.parse(JSON.stringify(addPersonList.value))) - handleClose() + handleVisibleClose() } // 删除行 const deleteList = () => { @@ -180,6 +204,7 @@ } // 点击提交/导出按钮 const getAddList = async (formEl: FormInstance | undefined, type: string) => { + console.log('6666') if (type === '提交' && pageType.value === 'edit') { if (!formEl) { return } await formEl.validate((valid, fields) => { @@ -211,65 +236,52 @@ }) } else { - const params = { - businessContent: formInline.value.businessContent, - supplierName: formInline.value.supplierName, - supplierNo: formInline.value.supplierNo, - } - getSoucreLisListExport(params).then((res) => { - exportFile(res.data, '溯源供方详情') + applyShow.value = true + } +} +// 审批弹窗关闭 +const handleClose = () => { + applyShow.value = false +} +// 点击审批的提交 +const applyListSubmit = (row: any) => { + console.log(row) + handleClose() +} +const fileRef = ref() // 文件上传input +const onFileChange = (event: any) => { + // 原生上传 + console.log(event.target.files) + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('multipartFile', event.target.files[0]) + UploadFile(fd).then((res) => { + if (res.code === 200) { + formInline.value.minioFileName = res.data[0] + // 重置当前验证 + ElMessage.success('文件上传成功') + } + else { + ElMessage.error(res.message) + } }) } } -const handleExceed: UploadProps['onExceed'] = (files, uploadFiles) => { - ElMessage.warning('只能上传一个文件') +const upload = () => { + fileRef.value.click() } -// 移除时触发 -const beforeRemove: UploadProps['beforeRemove'] = (uploadFile, uploadFiles) => { - return ElMessageBox.confirm( - `确认移除${uploadFile.name}文件吗 ?`, - ).then( - () => true, - () => false, - - ) +// 双击行显示输入框 +const dblclickRow = (row: traceSupplierPerson) => { + setAllRowReadable() + row.editable = true } -const isShow = ref(false) -const testForm = ref({ - fileList: [], - fileContent: '', -}) -const handleFileChange = (files: any, fileList: any) => { - testForm.value.fileList = fileList - const reader = new FileReader() - reader.readAsText(files.raw) - reader.onload = (e) => { - testForm.value.fileContent = e.target!.result?.replace( - /\n|\r\n/g, - '
', - ) +// 将所有人员信息列表置为不可编辑状态 +function setAllRowReadable() { + for (const item of traceSupplierPersonList.value) { + item.editable = false } } -// 点击文件预览 -const uploadShow = (e: any) => { - const URL = window.URL || window.webkitURL - window.open(URL.createObjectURL(e.raw)) -} -// 上传请求 -const uploadQuarterlyEvaluateFile = (file: File) => { - UploadFile(file).then((res) => { - if (res.code === 200) { - formInline.value.minioFileName = res.data.fileName - // fileList.value.push({ - // name: res.data.fileName, - // url: res.data.fileId, - // // type: file.file.type, - // }) - // 重置当前验证 - ElMessage.success('文件上传成功') - } - }) -} if (pageType.value !== 'add') { getInfo() } @@ -279,7 +291,7 @@ - diff --git a/src/views/measure/source/components/listPageAdd.vue b/src/views/measure/source/components/listPageAdd.vue index f3eae25..289b3e4 100644 --- a/src/views/measure/source/components/listPageAdd.vue +++ b/src/views/measure/source/components/listPageAdd.vue @@ -3,7 +3,9 @@ import type { Ref } from 'vue' import { ElMessage, ElMessageBox } from 'element-plus' import type { FormInstance, UploadInstance, UploadProps, UploadUserFile } from 'element-plus' -import type { IformInline } from './list_interface' +import type { IformInline, traceSupplierPerson } from '../list_interface' +import ManageBox from './manageBox.vue' +import showPhoto from '@/views/system/tool/showPhoto.vue' import { exportFile } from '@/utils/exportUtils' import { UploadFile } from '@/api/measure/file' import { getSoucreLisListExport, getSoucreLisUpdate, getSoucreListAdd, getSoucreListDetail, getSoucreListlevelType } from '@/api/system/source' @@ -67,6 +69,7 @@ traceSupplierPersonList: [], }) const ruleFormRef = ref() +const traceSupplierPersonList: Ref = ref([]) const columns = [ { text: '人员编号', value: 'personNo' }, { text: '姓名', value: 'name' }, @@ -74,6 +77,8 @@ { text: '职务', value: 'job' }, { text: '联系方式', value: 'phone' }, ] +// 控制审批弹窗开关 +const applyShow = ref(false) const rules = ref({ supplierNo: [{ required: true, message: '溯源供方编号不能为空', trigger: 'blur' }], supplierName: [{ required: true, message: '公司名称不能为空', trigger: 'blur' }], @@ -96,7 +101,6 @@ phone: '', }) const SelectionList = ref([]) -const upload = ref() // 初始化router const $router = useRouter() // 关闭新增页面的回调 @@ -159,18 +163,38 @@ }) } // 点击增加行 -const addRoow = () => { - Object.keys(addPersonList.value).forEach(key => (addPersonList.value[key] = '')) - dialogVisible.value = true +const addRow = () => { + // 检查上一行必填项 + if (checkPersonList()) { + setAllRowReadable() + traceSupplierPersonList.value.push({ ...addPersonObj }) + } } -// 点击关闭 -const handleClose = () => { - dialogVisible.value = false +// 检查人员列表 +function checkPersonList() { + for (let index = 0; index < traceSupplierPersonList.value.length; index++) { + const item = traceSupplierPersonList.value[index] + for (const prop of columns.value) { + // 检查必填 + if (prop.required && !item[prop.value]) { + ElMessage.warning(`请先完善第${index + 1}行中${prop.text}`) + return false + } + // 验证正则 + if (prop.reg && typeof prop.reg === 'function') { + if (!prop.reg(item[prop.value])) { + ElMessage.warning(`第${index + 1}行中${prop.text}输入不合法`) + return false + } + } + } + } + return true } // 点击弹窗的完成追加到表格数组中 const addPushList = () => { formInline.value.traceSupplierPersonList.push(JSON.parse(JSON.stringify(addPersonList.value))) - handleClose() + handleVisibleClose() } // 删除行 const deleteList = () => { @@ -180,6 +204,7 @@ } // 点击提交/导出按钮 const getAddList = async (formEl: FormInstance | undefined, type: string) => { + console.log('6666') if (type === '提交' && pageType.value === 'edit') { if (!formEl) { return } await formEl.validate((valid, fields) => { @@ -211,65 +236,52 @@ }) } else { - const params = { - businessContent: formInline.value.businessContent, - supplierName: formInline.value.supplierName, - supplierNo: formInline.value.supplierNo, - } - getSoucreLisListExport(params).then((res) => { - exportFile(res.data, '溯源供方详情') + applyShow.value = true + } +} +// 审批弹窗关闭 +const handleClose = () => { + applyShow.value = false +} +// 点击审批的提交 +const applyListSubmit = (row: any) => { + console.log(row) + handleClose() +} +const fileRef = ref() // 文件上传input +const onFileChange = (event: any) => { + // 原生上传 + console.log(event.target.files) + if (event.target.files?.length !== 0) { + // 创建formdata对象 + const fd = new FormData() + fd.append('multipartFile', event.target.files[0]) + UploadFile(fd).then((res) => { + if (res.code === 200) { + formInline.value.minioFileName = res.data[0] + // 重置当前验证 + ElMessage.success('文件上传成功') + } + else { + ElMessage.error(res.message) + } }) } } -const handleExceed: UploadProps['onExceed'] = (files, uploadFiles) => { - ElMessage.warning('只能上传一个文件') +const upload = () => { + fileRef.value.click() } -// 移除时触发 -const beforeRemove: UploadProps['beforeRemove'] = (uploadFile, uploadFiles) => { - return ElMessageBox.confirm( - `确认移除${uploadFile.name}文件吗 ?`, - ).then( - () => true, - () => false, - - ) +// 双击行显示输入框 +const dblclickRow = (row: traceSupplierPerson) => { + setAllRowReadable() + row.editable = true } -const isShow = ref(false) -const testForm = ref({ - fileList: [], - fileContent: '', -}) -const handleFileChange = (files: any, fileList: any) => { - testForm.value.fileList = fileList - const reader = new FileReader() - reader.readAsText(files.raw) - reader.onload = (e) => { - testForm.value.fileContent = e.target!.result?.replace( - /\n|\r\n/g, - '
', - ) +// 将所有人员信息列表置为不可编辑状态 +function setAllRowReadable() { + for (const item of traceSupplierPersonList.value) { + item.editable = false } } -// 点击文件预览 -const uploadShow = (e: any) => { - const URL = window.URL || window.webkitURL - window.open(URL.createObjectURL(e.raw)) -} -// 上传请求 -const uploadQuarterlyEvaluateFile = (file: File) => { - UploadFile(file).then((res) => { - if (res.code === 200) { - formInline.value.minioFileName = res.data.fileName - // fileList.value.push({ - // name: res.data.fileName, - // url: res.data.fileId, - // // type: file.file.type, - // }) - // 重置当前验证 - ElMessage.success('文件上传成功') - } - }) -} if (pageType.value !== 'add') { getInfo() } @@ -279,7 +291,7 @@