|
|
@ -20,7 +20,8 @@ |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
|
<Table v-clientTable |
|
|
|
<Table |
|
|
|
v-clientTable |
|
|
|
:columns="tableColumns" |
|
|
|
:data="tableObject.tableList" |
|
|
|
:loading="tableObject.loading" |
|
|
@ -57,6 +58,7 @@ |
|
|
|
:rules="InspectionJobMainRules" |
|
|
|
:formAllSchemas="InspectionJobMain.allSchemas" |
|
|
|
@submitForm="submitForm" |
|
|
|
@close="getList" |
|
|
|
/> |
|
|
|
<!-- 详情 --> |
|
|
|
<Detail |
|
|
@ -119,6 +121,7 @@ import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
import AddForm from './addForm.vue' |
|
|
|
import Detail from './detail.vue' |
|
|
|
import { getReportUrl } from '@/utils/systemParam' |
|
|
|
import { useUserStore } from '@/store/modules/user' |
|
|
|
|
|
|
|
// 采购订单 |
|
|
|
defineOptions({ name: 'inspectionJobMain' }) |
|
|
@ -129,7 +132,7 @@ const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(InspectionJobMain.allSchemas.tableColumns) |
|
|
|
|
|
|
|
const userStore = useUserStore() |
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
@ -180,7 +183,7 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultExportBtn(null), |
|
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'qms:inspection-job-main:export' }), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
@ -199,7 +202,13 @@ const buttonBaseClick = (val, item) => { |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
if (tableObject.params.filters && tableObject.params.filters.length > 0) { |
|
|
|
searchFormClick({ |
|
|
|
filters: tableObject.params.filters |
|
|
|
}) |
|
|
|
} else { |
|
|
|
getList() |
|
|
|
} |
|
|
|
} else if (val == 'filtrate') { |
|
|
|
// 筛选 |
|
|
|
} else { |
|
|
@ -226,23 +235,35 @@ const isShowMainButton2 = (row, val) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 根据状态返回该按钮是否显示 |
|
|
|
const isShowMainButton1 = (row, val) => { |
|
|
|
if (val.indexOf(row.status) > -1) { |
|
|
|
if (userStore.getUser.id == row.acceptUserId) { |
|
|
|
return false |
|
|
|
} else { |
|
|
|
return true |
|
|
|
} |
|
|
|
} else { |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = (row) => { |
|
|
|
return [ |
|
|
|
defaultButtons.mainListJobAccBtn({ |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'qms:inspection-job-main:accept' |
|
|
|
}), // 承接 |
|
|
|
// defaultButtons.mainListJobAccBtn({ |
|
|
|
// hide: isShowMainButton(row, ['1']), |
|
|
|
// hasPermi: 'qms:inspection-job-main:accept' |
|
|
|
// }), // 承接 |
|
|
|
defaultButtons.mainListJobCloBtn({ |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'qms:inspection-job-main:close' |
|
|
|
}), // 关闭 |
|
|
|
defaultButtons.mainListJobAbaBtn({ |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
hide: isShowMainButton1(row, ['2']), |
|
|
|
hasPermi: 'qms:inspection-job-main:abandon' |
|
|
|
}), // 放弃 |
|
|
|
defaultButtons.mainListJobExeBtn({ |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
hide: isShowMainButton(row, ['1', '2']), |
|
|
|
hasPermi: 'qms:inspection-job-main:execute' |
|
|
|
}), // 执行 |
|
|
|
defaultButtons.mainListOrderPubBtn({ |
|
|
@ -284,14 +305,13 @@ const buttonTableClick = async (val, row) => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 查看质检报告 |
|
|
|
// 查看质检报告 |
|
|
|
const reportHeight = ref(window.innerHeight - 120) |
|
|
|
const showQualityReport = ref(false) |
|
|
|
const qualityReport = ref('') |
|
|
|
const checkQualityReport = async (row) => { |
|
|
|
showQualityReport.value = true |
|
|
|
qualityReport.value = `${getReportUrl()}/purchasereceiptReport?asnNumber=${row.asnNumber}` |
|
|
|
qualityReport.value = getReportUrl() + '/purchasereceiptReport?asnNumber=' + row.asnNumber |
|
|
|
} |
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
@ -309,8 +329,18 @@ const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
|
//执行 |
|
|
|
|
|
|
|
const formRef = ref() |
|
|
|
const execute = async (type: string, row?: number) => { |
|
|
|
const execute = async (type: string, row?: any) => { |
|
|
|
if (row.status == '2') { |
|
|
|
if (userStore.getUser.id == row.acceptUserId) { |
|
|
|
formRef.value.open(type, row) |
|
|
|
} else { |
|
|
|
message.error('承接人与当前登录人不一致') |
|
|
|
} |
|
|
|
} else if (row.status == '1') { |
|
|
|
await handleAccept(row.id) |
|
|
|
formRef.value.open(type, row) |
|
|
|
await getList() |
|
|
|
} |
|
|
|
} |
|
|
|
/** 关闭按钮操作 */ |
|
|
|
const handleClose = async (id: number) => { |
|
|
@ -321,7 +351,7 @@ const handleClose = async (id: number) => { |
|
|
|
await InspectionJobMainApi.closeInspectionJobMain(id) |
|
|
|
message.success(t('common.closeSuccess')) |
|
|
|
// 刷新列表 |
|
|
|
await getList() |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
/** 发布按钮操作 */ |
|
|
@ -333,19 +363,19 @@ const handleRelease = async (id: number) => { |
|
|
|
await InspectionJobMainApi.releaseInspectionJobMain(id) |
|
|
|
message.success('发布成功!') |
|
|
|
// 刷新列表 |
|
|
|
await getList() |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
// 承接 |
|
|
|
const handleAccept = async (id: number) => { |
|
|
|
try { |
|
|
|
// 承接的二次确认 |
|
|
|
await message.confirm(t('common.confirmAccept')) |
|
|
|
// await message.confirm(t('common.confirmAccept')) |
|
|
|
// 发起承接 |
|
|
|
await InspectionJobMainApi.acceptInspectionJobMain(id) |
|
|
|
message.success(t('common.acceptSuccess')) |
|
|
|
// 刷新列表 |
|
|
|
await getList() |
|
|
|
// message.success(t('common.acceptSuccess')) |
|
|
|
// 刷新列表(TB反馈,取消承接后刷新页面) |
|
|
|
// buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
// 放弃任务 |
|
|
@ -357,7 +387,7 @@ const handleAbandon = async (id: number) => { |
|
|
|
await InspectionJobMainApi.abandonInspectionJobMain(id) |
|
|
|
message.success(t('common.giveupSuccess')) |
|
|
|
// 刷新列表 |
|
|
|
await getList() |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
|
|
|
@ -401,7 +431,11 @@ const submitForm = async (formType, data) => { |
|
|
|
formRef.value.dialogVisible = false |
|
|
|
formRef.value.formLoading = false |
|
|
|
// 刷新当前列表 |
|
|
|
if (formType === 'create') { |
|
|
|
getList() |
|
|
|
} else { |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} |
|
|
|
} finally { |
|
|
|
formRef.value.formLoading = false |
|
|
|
} |
|
|
@ -415,19 +449,75 @@ const handleImport = () => { |
|
|
|
|
|
|
|
// 筛选提交 |
|
|
|
const searchFormClick = (searchData) => { |
|
|
|
let isHave = searchData?.filters?.some((item) => item.column == 'inspectionType') |
|
|
|
if (!isHave) { |
|
|
|
if (route.name == 'inspectionJobProductionMain') { |
|
|
|
searchData.filters.push({ |
|
|
|
action: '==', |
|
|
|
column: 'inspectionType', |
|
|
|
value: '4' |
|
|
|
}) |
|
|
|
} else if (route.name == 'inspectionJobPurchaseMain') { |
|
|
|
searchData.filters.push({ |
|
|
|
action: '==', |
|
|
|
column: 'inspectionType', |
|
|
|
value: '1' |
|
|
|
}) |
|
|
|
} else { |
|
|
|
searchData.filters.push({ |
|
|
|
action: 'notIn', |
|
|
|
column: 'excludeInspectionType', |
|
|
|
value: '1,4' |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
tableObject.params = { |
|
|
|
isSearch: true, |
|
|
|
filters: searchData.filters |
|
|
|
} |
|
|
|
getList() // 刷新当前列表 |
|
|
|
} |
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
tableObject.params = { |
|
|
|
available: true |
|
|
|
} |
|
|
|
console.log(11,route.name) |
|
|
|
if (route.name == 'inspectionJobProductionMain') { |
|
|
|
tableObject.params = { |
|
|
|
available: true, |
|
|
|
inspectionType: '4' |
|
|
|
} |
|
|
|
} else if (route.name == 'inspectionJobPurchaseMain') { |
|
|
|
tableObject.params = { |
|
|
|
available: true, |
|
|
|
inspectionType: '1' |
|
|
|
} |
|
|
|
} else { |
|
|
|
tableObject.params = { |
|
|
|
available: true, |
|
|
|
excludeInspectionType: '1,4' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
getList() |
|
|
|
// importTemplateData.templateUrl = await InspectionJobMainApi.importTemplate() |
|
|
|
}) |
|
|
|
onActivated(() => { |
|
|
|
if (route.name == 'inspectionJobProductionMain') { |
|
|
|
tableObject.params = { |
|
|
|
available: true, |
|
|
|
inspectionType: '4' |
|
|
|
} |
|
|
|
} else if (route.name == 'inspectionJobPurchaseMain') { |
|
|
|
tableObject.params = { |
|
|
|
available: true, |
|
|
|
inspectionType: '1' |
|
|
|
} |
|
|
|
} else { |
|
|
|
tableObject.params = { |
|
|
|
available: true, |
|
|
|
excludeInspectionType: '1,4' |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
getList() |
|
|
|
}) |
|
|
|
</script> |
|
|
|