|
|
@ -1,18 +1,22 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="Q2.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="Q2.allSchemas.searchSchema" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="Q2.allSchemas" |
|
|
|
/> |
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="Q2.allSchemas" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
@ -27,13 +31,16 @@ |
|
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
> |
|
|
|
<template #number="{row}"> |
|
|
|
<template #number="{ row }"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
|
|
|
<span>{{ row.number }}</span> |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #action="{ row }"> |
|
|
|
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<ButtonBase |
|
|
|
:Butttondata="butttondata(row)" |
|
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
@ -54,12 +61,17 @@ |
|
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Q2.allSchemas" /> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/basic/Q2/import" :importTemplateData="importTemplateData" @success="importSuccess" /> |
|
|
|
<ImportForm |
|
|
|
ref="importFormRef" |
|
|
|
url="/basic/Q2/import" |
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { Q2,Q2Rules } from './inspectionQ2.data' |
|
|
|
import { Q2, Q2Rules } from './inspectionQ2.data' |
|
|
|
import * as Q2Api from '@/api/qms/inspectionQ2' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
@ -81,34 +93,34 @@ const tableColumns = ref(Q2.allSchemas.tableColumns) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
if(formField == 'supplierCode'){ |
|
|
|
setV['itemCode'] = ''; |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
if (formField == 'supplierCode') { |
|
|
|
setV['itemCode'] = '' |
|
|
|
} |
|
|
|
if(formField == 'itemCode'){ |
|
|
|
if (formField == 'itemCode') { |
|
|
|
setV['uom'] = val[0]['supplierUom'] |
|
|
|
} |
|
|
|
// if (formField == 'q1Number') { |
|
|
|
// console.log(123) |
|
|
|
// setV['q1Number'] = val[0]['number'] |
|
|
|
// } |
|
|
|
if (formField == 'purchaseReceiptNumber') { |
|
|
|
} |
|
|
|
// if (formField == 'q1Number') { |
|
|
|
// console.log(123) |
|
|
|
// setV['q1Number'] = val[0]['number'] |
|
|
|
// } |
|
|
|
if (formField == 'purchaseReceiptNumber') { |
|
|
|
setV['wmsQty'] = val[0]['qty'] |
|
|
|
} |
|
|
|
if(formField == 'q1Number'){ |
|
|
|
} |
|
|
|
if (formField == 'q1Number') { |
|
|
|
//Q1通知单号 |
|
|
|
let list = [] |
|
|
|
val.forEach(item=>{ |
|
|
|
val.forEach((item) => { |
|
|
|
list.push(item[searchField]) |
|
|
|
}) |
|
|
|
setV[formField] = list.join(',') |
|
|
|
formRef.setValues(setV) |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
formRef.setValues(setV) |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
@ -125,12 +137,12 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'qms:Q2:create'}), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({hasPermi:'qms:Q2:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'qms:Q2:export'}), // 导出 |
|
|
|
defaultButtons.defaultAddBtn({ hasPermi: 'qms:Q2:create' }), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({ hasPermi: 'qms:Q2:import' }), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'qms:Q2:export' }), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
|
// { |
|
|
|
// label: '自定义扩展按钮', |
|
|
|
// name: 'zdy', |
|
|
@ -143,21 +155,27 @@ const HeadButttondata = [ |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
if (val == 'add') { |
|
|
|
// 新增 |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'import') { // 导入 |
|
|
|
} else if (val == 'import') { |
|
|
|
// 导入 |
|
|
|
handleImport() |
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
} else if (val == 'export') { |
|
|
|
// 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
getList() |
|
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
|
} else { // 其他按钮 |
|
|
|
} else if (val == 'filtrate') { |
|
|
|
// 筛选 |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const isShowMainButton = (row,val) => { |
|
|
|
const isShowMainButton = (row, val) => { |
|
|
|
if (val.indexOf(row.status) > -1) { |
|
|
|
return false |
|
|
|
} else { |
|
|
@ -168,19 +186,31 @@ const isShowMainButton = (row,val) => { |
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = (row) => { |
|
|
|
return [ |
|
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['0']),hasPermi:'qms:Q2:update'}), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn({hide:isShowMainButton(row,['0']),hasPermi:'qms:Q2:delete'}), // 删除 |
|
|
|
defaultButtons.mainListFinishBtn({hide:isShowMainButton(row,['0']),hasPermi:'qms:Q2:finish'}), // 完成 |
|
|
|
defaultButtons.mainListEditBtn({ |
|
|
|
hide: isShowMainButton(row, ['0']), |
|
|
|
hasPermi: 'qms:Q2:update' |
|
|
|
}), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn({ |
|
|
|
hide: isShowMainButton(row, ['0']), |
|
|
|
hasPermi: 'qms:Q2:delete' |
|
|
|
}), // 删除 |
|
|
|
defaultButtons.mainListFinishBtn({ |
|
|
|
hide: isShowMainButton(row, ['0']), |
|
|
|
hasPermi: 'qms:Q2:finish' |
|
|
|
}) // 完成 |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
} else if (val == 'delete') { |
|
|
|
// 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
}else if (val == 'finish') { // 删除 |
|
|
|
} else if (val == 'finish') { |
|
|
|
// 删除 |
|
|
|
handleFinish(row.id) |
|
|
|
} |
|
|
|
} |
|
|
@ -198,52 +228,59 @@ const handleFinish = async (id: number) => { |
|
|
|
const basicFormRef = ref() |
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
if (type=='create') { |
|
|
|
nextTick(() => { |
|
|
|
basicFormRef.value.formRef.setValues({ |
|
|
|
handleTime: new Date().getTime(), |
|
|
|
claimTime: new Date().getTime(), |
|
|
|
priority: '3', |
|
|
|
}) |
|
|
|
}) |
|
|
|
if (type == 'create') { |
|
|
|
nextTick(() => { |
|
|
|
basicFormRef.value.formRef.setValues({ |
|
|
|
handleTime: new Date().getTime(), |
|
|
|
claimTime: new Date().getTime(), |
|
|
|
priority: '3' |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType, data) => { |
|
|
|
data.responUser = userStore.getUser.id |
|
|
|
var isHave =Q2.allSchemas.formSchema.some(function (item) { |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
}); |
|
|
|
if(isHave){ |
|
|
|
if(data.activeTime && data.expireTime && data.activeTime >=data.expireTime){ |
|
|
|
var isHave = Q2.allSchemas.formSchema.some(function (item) { |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime' |
|
|
|
}) |
|
|
|
if (isHave) { |
|
|
|
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) { |
|
|
|
message.error('失效时间要大于生效时间') |
|
|
|
return; |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if (data.qty>data.wmsQty) { |
|
|
|
message.error('数量不能大于记录中的收货数量') |
|
|
|
return; |
|
|
|
if (data.qty > data.wmsQty) { |
|
|
|
message.error('数量不能大于记录中的收货数量') |
|
|
|
return |
|
|
|
} |
|
|
|
if (data.qty==0) { |
|
|
|
message.error('数量不能为0') |
|
|
|
return; |
|
|
|
if (data.qty == 0) { |
|
|
|
message.error('数量不能为0') |
|
|
|
return |
|
|
|
} |
|
|
|
if (data.claimAmount==0) { |
|
|
|
message.error('索赔金额不能为0') |
|
|
|
return; |
|
|
|
if (data.claimAmount == 0) { |
|
|
|
message.error('索赔金额不能为0') |
|
|
|
return |
|
|
|
} |
|
|
|
if(data.activeTime==0)data.activeTime = null; |
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
|
if (formType === 'create') { |
|
|
|
await Q2Api.createQ2(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await Q2Api.updateQ2(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
if (data.activeTime == 0) data.activeTime = null |
|
|
|
if (data.expireTime == 0) data.expireTime = null |
|
|
|
|
|
|
|
try { |
|
|
|
basicFormRef.value.formLoading = true |
|
|
|
if (formType === 'create') { |
|
|
|
await Q2Api.createQ2(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await Q2Api.updateQ2(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
basicFormRef.value.formLoading = false |
|
|
|
getList() |
|
|
|
} finally { |
|
|
|
basicFormRef.value.formLoading = false |
|
|
|
} |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
@ -310,5 +347,4 @@ onMounted(async () => { |
|
|
|
getList() |
|
|
|
importTemplateData.templateUrl = await Q2Api.importTemplate() |
|
|
|
}) |
|
|
|
|
|
|
|
</script> |
|
|
|