|
@ -2,7 +2,10 @@ |
|
|
<ContentWrap> |
|
|
<ContentWrap> |
|
|
<!-- 搜索工作栏 --> |
|
|
<!-- 搜索工作栏 --> |
|
|
<Search |
|
|
<Search |
|
|
:schema="Q3.allSchemas.searchSchema" |
|
|
:schema="[ |
|
|
|
|
|
...InspectionQ3Main.allSchemas.searchSchema, |
|
|
|
|
|
...InspectionQ3Detail.allSchemas.searchSchema |
|
|
|
|
|
]" |
|
|
@search="setSearchParams" |
|
|
@search="setSearchParams" |
|
|
@reset="setSearchParams" |
|
|
@reset="setSearchParams" |
|
|
/> |
|
|
/> |
|
@ -15,12 +18,14 @@ |
|
|
:routeName="routeName" |
|
|
:routeName="routeName" |
|
|
@updataTableColumns="updataTableColumns" |
|
|
@updataTableColumns="updataTableColumns" |
|
|
@searchFormClick="searchFormClick" |
|
|
@searchFormClick="searchFormClick" |
|
|
:allSchemas="Q3.allSchemas" |
|
|
:allSchemas="InspectionQ3Main.allSchemas" |
|
|
|
|
|
:detailAllSchemas="InspectionQ3Detail.allSchemas" |
|
|
/> |
|
|
/> |
|
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
<!-- 列表 --> |
|
|
<ContentWrap> |
|
|
<ContentWrap> |
|
|
<Table |
|
|
<Table |
|
|
|
|
|
v-clientTable |
|
|
:columns="tableColumns" |
|
|
:columns="tableColumns" |
|
|
:data="tableObject.tableList" |
|
|
:data="tableObject.tableList" |
|
|
:loading="tableObject.loading" |
|
|
:loading="tableObject.loading" |
|
@ -32,13 +37,13 @@ |
|
|
v-model:sort="tableObject.sort" |
|
|
v-model:sort="tableObject.sort" |
|
|
> |
|
|
> |
|
|
<template #number="{ row }"> |
|
|
<template #number="{ row }"> |
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.number)"> |
|
|
<el-button type="primary" link @click="openDetail(row, '单据号', row.number)"> |
|
|
<span>{{ row.number }}</span> |
|
|
<span>{{ row.number }}</span> |
|
|
</el-button> |
|
|
</el-button> |
|
|
</template> |
|
|
</template> |
|
|
<template #action="{ row }"> |
|
|
<template #action="{ row, $index }"> |
|
|
<ButtonBase |
|
|
<ButtonBase |
|
|
:Butttondata="butttondata(row)" |
|
|
:Butttondata="butttondata(row, $index)" |
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
/> |
|
|
/> |
|
|
</template> |
|
|
</template> |
|
@ -47,44 +52,68 @@ |
|
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
<BasicForm |
|
|
<BasicForm |
|
|
ref="basicFormRef" |
|
|
ref="formRef" |
|
|
@success="formsSuccess" |
|
|
:isOpenSearchTable="true" |
|
|
:rules="Q3Rules" |
|
|
fieldTableColumn="itemCode" |
|
|
:formAllSchemas="Q3.allSchemas" |
|
|
@success="getList" |
|
|
:apiUpdate="Q3Api.updateQ3" |
|
|
:rules="InspectionQ3MainRules" |
|
|
:apiCreate="Q3Api.createQ3" |
|
|
:formAllSchemas="InspectionQ3Main.allSchemas" |
|
|
|
|
|
:tableAllSchemas="InspectionQ3Detail.allSchemas" |
|
|
|
|
|
:tableFormRules="InspectionQ3DetailRules" |
|
|
|
|
|
:tableData="tableData" |
|
|
|
|
|
:apiUpdate="InspectionQ3MainApi.updateInspectionQ3Main" |
|
|
|
|
|
:apiCreate="InspectionQ3MainApi.createInspectionQ3Main" |
|
|
|
|
|
:isBusiness="true" |
|
|
|
|
|
@handleAddTable="handleAddTable" |
|
|
|
|
|
@handleDeleteTable="handleDeleteTable" |
|
|
|
|
|
:isShowReduceButtonSelection="true" |
|
|
|
|
|
@tableSelectionDelete="tableSelectionDelete" |
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
:isBusiness="false" |
|
|
@submitForm="submitForm" |
|
|
@onChange="onChange" |
|
|
@inputNumberChange="inputNumberChange" |
|
|
/> |
|
|
> |
|
|
|
|
|
<!-- <template #default="{row}"> |
|
|
|
|
|
<el-input-number disabled v-model="row.qty"></el-input-number> |
|
|
|
|
|
</template> --> |
|
|
|
|
|
</BasicForm> |
|
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
<!-- 详情 --> |
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="Q3.allSchemas" /> |
|
|
<Detail |
|
|
|
|
|
ref="detailRef" |
|
|
<!-- 导入 --> |
|
|
:isBasic="false" |
|
|
<ImportForm |
|
|
:allSchemas="InspectionQ3Main.allSchemas" |
|
|
ref="importFormRef" |
|
|
:detailAllSchemas="InspectionQ3Detail.allSchemas" |
|
|
url="/basic/Q3/import" |
|
|
:detailAllSchemasRules="InspectionQ3DetailRules" |
|
|
:importTemplateData="importTemplateData" |
|
|
:apiCreate="InspectionQ3DetailApi.createInspectionQ3Detail" |
|
|
@success="importSuccess" |
|
|
:apiUpdate="InspectionQ3DetailApi.updateInspectionQ3Detail" |
|
|
|
|
|
:apiPage="InspectionQ3DetailApi.getInspectionQ3DetailPage" |
|
|
|
|
|
:apiDelete="InspectionQ3DetailApi.deleteInspectionQ3Detail" |
|
|
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
|
|
:detailValidate="detailValidate" |
|
|
/> |
|
|
/> |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
<script setup lang="ts"> |
|
|
import download from '@/utils/download' |
|
|
import download from '@/utils/download' |
|
|
import { Q3, Q3Rules } from './inspectionQ3.data' |
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|
|
import * as Q3Api from '@/api/qms/inspectionQ3' |
|
|
import { |
|
|
|
|
|
InspectionQ3Main, |
|
|
|
|
|
InspectionQ3MainRules, |
|
|
|
|
|
InspectionQ3Detail, |
|
|
|
|
|
InspectionQ3DetailRules |
|
|
|
|
|
} from './inspectionQ3.data' |
|
|
|
|
|
import * as InspectionQ3MainApi from '@/api/qms/inspectionQ3/inspectionQ3Main' |
|
|
|
|
|
import * as InspectionQ3DetailApi from '@/api/qms/inspectionQ3/inspectionQ3Detail' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
|
|
import ImportForm from '@/components/ImportForm/src/ImportForm.vue' |
|
|
|
|
|
import Detail from '@/components/Detail/src/Detail.vue' |
|
|
|
|
|
import * as ProductionlineitemApi from '@/api/wms/productionlineitem' |
|
|
import * as ProductionlineitemApi from '@/api/wms/productionlineitem' |
|
|
import * as StdcostpriceApi from '@/api/wms/stdcostprice' |
|
|
import * as StdcostpriceApi from '@/api/wms/stdcostprice' |
|
|
|
|
|
import { formatDate } from '@/utils/formatTime' |
|
|
|
|
|
import { async } from '@antv/x6/lib/registry/marker/async' |
|
|
import { useUserStore } from '@/store/modules/user' |
|
|
import { useUserStore } from '@/store/modules/user' |
|
|
const userStore = useUserStore() |
|
|
const userStore = useUserStore() |
|
|
|
|
|
|
|
|
defineOptions({ name: 'InspectionQ3' }) |
|
|
// 发料申请 |
|
|
|
|
|
defineOptions({ name: 'InspectionQ3Main' }) |
|
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
const message = useMessage() // 消息弹窗 |
|
|
const { t } = useI18n() // 国际化 |
|
|
const { t } = useI18n() // 国际化 |
|
@ -92,74 +121,111 @@ const { t } = useI18n() // 国际化 |
|
|
const route = useRoute() // 路由信息 |
|
|
const route = useRoute() // 路由信息 |
|
|
const routeName = ref() |
|
|
const routeName = ref() |
|
|
routeName.value = route.name |
|
|
routeName.value = route.name |
|
|
const tableColumns = ref(Q3.allSchemas.tableColumns) |
|
|
const tableColumns = ref([ |
|
|
|
|
|
...InspectionQ3Main.allSchemas.tableColumns, |
|
|
|
|
|
...InspectionQ3Detail.allSchemas.tableMainColumns |
|
|
|
|
|
]) |
|
|
|
|
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
|
|
const updataTableColumns = (val) => { |
|
|
|
|
|
tableColumns.value = val |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
// 查询页面返回 |
|
|
const priceObj = ref() |
|
|
const priceObj = ref() |
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
nextTick(async () => { |
|
|
nextTick(async () => { |
|
|
const setV = {} |
|
|
const setV = {} |
|
|
|
|
|
if (type == 'tableForm') { |
|
|
|
|
|
// 明细查询页赋值 |
|
|
if (formField == 'itemCode') { |
|
|
if (formField == 'itemCode') { |
|
|
console.log(val) |
|
|
const index1 = 0 |
|
|
setV['uom'] = val[0]['uom'] |
|
|
setTableFormsValues(val, index1) |
|
|
console.log(formRef.formModel.qty) |
|
|
} |
|
|
// let res = await ProductionlineitemApi.selectItemCodeToProductionLineCode(val[0].code) |
|
|
if (formField == 'costCode') { |
|
|
ProductionlineitemApi.selectItemCodeToProductionLineCode(val[0].code).then((res) => { |
|
|
console.log(11111) |
|
|
console.log(res) |
|
|
row['costCode'] = val[0]['costcentreCode'] |
|
|
if (res?.length > 0) { |
|
|
|
|
|
formRef.formModel.defectLocation = res[0].productionLineCode |
|
|
|
|
|
Q3.allSchemas.formSchema.forEach(item=>{ |
|
|
|
|
|
if (item.field == 'defectLocation') { |
|
|
|
|
|
item.componentProps.options = res |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
if (formField == 'q1Number') { |
|
|
|
|
|
//Q1通知单号 |
|
|
|
|
|
let list = [] |
|
|
|
|
|
val.forEach((item) => { |
|
|
|
|
|
list.push(item[searchField]) |
|
|
}) |
|
|
}) |
|
|
|
|
|
setV[formField] = list.join(',') |
|
|
|
|
|
formRef.setValues(setV) |
|
|
|
|
|
} |
|
|
|
|
|
} else { |
|
|
|
|
|
const setV = {} |
|
|
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
|
|
formRef.setValues(setV) |
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
const setTableFormsValues = async (val, index1) => { |
|
|
|
|
|
if (index1 <= val.length - 1) { |
|
|
|
|
|
let tableForm = JSON.parse(JSON.stringify(tableFormKeys)) |
|
|
|
|
|
if (tableData.value.find((item1) => item1['itemCode'] == val[index1]['itemCode'])) return |
|
|
|
|
|
const newRow = JSON.parse(JSON.stringify({ ...tableForm, ...val[index1] })) |
|
|
|
|
|
newRow['itemCode'] = val[index1]['itemCode'] |
|
|
|
|
|
newRow['uom'] = val[index1]['uom'] |
|
|
|
|
|
newRow['qty'] = 0 |
|
|
|
|
|
newRow.defectLocation = val[index1]['productionLineCode'] |
|
|
|
|
|
await ProductionlineitemApi.selectItemCodeToProductionLineCode(val[index1].itemCode).then( |
|
|
|
|
|
(res) => { |
|
|
|
|
|
console.log(res) |
|
|
|
|
|
if (res?.length > 0) { |
|
|
|
|
|
newRow.defectLocationInitOptions = res |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
) |
|
|
const params = { |
|
|
const params = { |
|
|
by: "ASC", |
|
|
by: 'ASC', |
|
|
filters: [{column: "itemCode", action: "==", value: val[0].code}], |
|
|
filters: [{ column: 'itemCode', action: '==', value: val[index1].itemCode }], |
|
|
pageNo: 1, |
|
|
pageNo: 1, |
|
|
pageSize: 500, |
|
|
pageSize: 500, |
|
|
sort: "" |
|
|
sort: '' |
|
|
} |
|
|
} |
|
|
params.isSearch = true |
|
|
params.isSearch = true |
|
|
StdcostpriceApi.getStdcostpricePage(params).then((res) => { |
|
|
await StdcostpriceApi.getStdcostpricePage(params).then((res) => { |
|
|
if (res.list?.length > 0) { |
|
|
if (res.list?.length > 0) { |
|
|
priceObj.value = res.list[0] |
|
|
priceObj.value = res.list[0] |
|
|
formRef.setValues({ |
|
|
newRow['price'] = parseFloat(priceObj.value.price) |
|
|
amount: (parseFloat(formRef.formModel.qty) * parseFloat(priceObj.value.price)).toFixed(6) |
|
|
newRow['amount']=(parseFloat(newRow['qty']) * parseFloat(priceObj.value.price)).toFixed(6) |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
|
|
|
tableData.value.push(newRow) |
|
|
|
|
|
console.log( tableData.value) |
|
|
|
|
|
index1++ |
|
|
|
|
|
setTableFormsValues(val, index1) |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
const inputNumberChange = (field, index, row, val) => { |
|
|
|
|
|
if (field == 'qty') { |
|
|
|
|
|
row.amount = (parseFloat(row['qty']) * parseFloat(row.price)).toFixed(6) |
|
|
} |
|
|
} |
|
|
if (formField == 'q1Number') { |
|
|
formRef.value.formRef.formModel.summaryAmount =0 |
|
|
//Q1通知单号 |
|
|
tableData.value.forEach(item=>{ |
|
|
let list = [] |
|
|
formRef.value.formRef.formModel.summaryAmount += parseFloat(item.amount) |
|
|
val.forEach((item) => { |
|
|
|
|
|
list.push(item[searchField]) |
|
|
|
|
|
}) |
|
|
}) |
|
|
setV[formField] = list.join(',') |
|
|
} |
|
|
formRef.setValues(setV) |
|
|
// 查询页面返回——详情 |
|
|
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
|
|
nextTick(() => { |
|
|
|
|
|
const setV = {} |
|
|
|
|
|
if (formField == 'itemCode') { |
|
|
|
|
|
setV['itemCode'] = val[0]['code'] |
|
|
|
|
|
setV['uom'] = val[0]['uom'] |
|
|
} else { |
|
|
} else { |
|
|
setV[formField] = val[0][searchField] |
|
|
setV[formField] = val[0][searchField] |
|
|
formRef.setValues(setV) |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
formRef.setValues(setV) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
const onChange =(field,e)=>{ |
|
|
|
|
|
if (field == 'qty') { |
|
|
|
|
|
basicFormRef.value.formRef.formModel.amount = (parseFloat( basicFormRef.value.formRef.formModel.qty) * parseFloat( priceObj.value.price)).toFixed(6) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
|
|
const updataTableColumns = (val) => { |
|
|
|
|
|
tableColumns.value = val |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
getListApi: Q3Api.getQ3Page // 分页接口 |
|
|
getListApi: InspectionQ3DetailApi.getInspectionQ3DetailPage // 分页接口 |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
// 获得表格的各种操作 |
|
@ -167,20 +233,11 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
// 列表头部按钮 |
|
|
const HeadButttondata = [ |
|
|
const HeadButttondata = [ |
|
|
defaultButtons.defaultAddBtn({ hasPermi: 'qms:Q3:create' }), // 新增 |
|
|
defaultButtons.defaultAddBtn({ hasPermi: 'qms:inspection-Q3-main:create' }), // 新增 |
|
|
defaultButtons.defaultImportBtn({ hasPermi: 'qms:Q3:import' }), // 导入 |
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'qms:inspection-Q3-main:export' }), // 导出 |
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'qms:Q3:export' }), // 导出 |
|
|
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
// { |
|
|
|
|
|
// label: '自定义扩展按钮', |
|
|
|
|
|
// name: 'zdy', |
|
|
|
|
|
// hide: false, |
|
|
|
|
|
// type: 'primary', |
|
|
|
|
|
// icon: 'Select', |
|
|
|
|
|
// color: '' |
|
|
|
|
|
// }, |
|
|
|
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
// 头部按钮事件 |
|
@ -188,9 +245,6 @@ const buttonBaseClick = (val, item) => { |
|
|
if (val == 'add') { |
|
|
if (val == 'add') { |
|
|
// 新增 |
|
|
// 新增 |
|
|
openForm('create') |
|
|
openForm('create') |
|
|
} else if (val == 'import') { |
|
|
|
|
|
// 导入 |
|
|
|
|
|
handleImport() |
|
|
|
|
|
} else if (val == 'export') { |
|
|
} else if (val == 'export') { |
|
|
// 导出 |
|
|
// 导出 |
|
|
handleExport() |
|
|
handleExport() |
|
@ -205,6 +259,7 @@ const buttonBaseClick = (val, item) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 根据状态返回该按钮是否显示 |
|
|
const isShowMainButton = (row, val) => { |
|
|
const isShowMainButton = (row, val) => { |
|
|
if (val.indexOf(row.status) > -1) { |
|
|
if (val.indexOf(row.status) > -1) { |
|
|
return false |
|
|
return false |
|
@ -214,19 +269,25 @@ const isShowMainButton = (row, val) => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
// 列表-操作按钮 |
|
|
const butttondata = (row) => { |
|
|
const butttondata = (row, $index) => { |
|
|
|
|
|
const findIndex = row['masterId'] |
|
|
|
|
|
? tableObject.tableList.findIndex((item) => item['masterId'] == row['masterId']) |
|
|
|
|
|
: -1 |
|
|
|
|
|
if (findIndex > -1 && findIndex < $index) { |
|
|
|
|
|
return [] |
|
|
|
|
|
} |
|
|
return [ |
|
|
return [ |
|
|
defaultButtons.mainListEditBtn({ |
|
|
defaultButtons.mainListEditBtn({ |
|
|
hide: isShowMainButton(row, ['0']), |
|
|
hide: isShowMainButton(row, ['0']), |
|
|
hasPermi: 'qms:Q3:update' |
|
|
hasPermi: 'qms:inspection-Q3-main:update' |
|
|
}), // 编辑 |
|
|
}), // 编辑 |
|
|
defaultButtons.mainListDeleteBtn({ |
|
|
defaultButtons.mainListDeleteBtn({ |
|
|
hide: isShowMainButton(row, ['0']), |
|
|
hide: isShowMainButton(row, ['0']), |
|
|
hasPermi: 'qms:Q3:delete' |
|
|
hasPermi: 'qms:inspection-Q3-main:delete' |
|
|
}), // 删除 |
|
|
}), // 删除 |
|
|
defaultButtons.mainListFinishBtn({ |
|
|
defaultButtons.mainListFinishBtn({ |
|
|
hide: isShowMainButton(row, ['0']), |
|
|
hide: isShowMainButton(row, ['0']), |
|
|
hasPermi: 'qms:Q3:finish' |
|
|
hasPermi: 'qms:inspection-Q3-main:finish' |
|
|
}) // 完成 |
|
|
}) // 完成 |
|
|
] |
|
|
] |
|
|
} |
|
|
} |
|
@ -238,16 +299,16 @@ const buttonTableClick = async (val, row) => { |
|
|
openForm('update', row) |
|
|
openForm('update', row) |
|
|
} else if (val == 'delete') { |
|
|
} else if (val == 'delete') { |
|
|
// 删除 |
|
|
// 删除 |
|
|
handleDelete(row.id) |
|
|
handleDelete(row.masterId) |
|
|
} else if (val == 'finish') { |
|
|
} else if (val == 'finish') { |
|
|
// 删除 |
|
|
// 完成 |
|
|
handleFinish(row.id) |
|
|
handleFinish(row.masterId) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const handleFinish = async (id: number) => { |
|
|
const handleFinish = async (id: number) => { |
|
|
try { |
|
|
try { |
|
|
await Q3Api.finishQ3(id) |
|
|
await InspectionQ3MainApi.finishInspectionQ3Main(id) |
|
|
message.success(t('common.updateSuccess')) |
|
|
message.success(t('common.updateSuccess')) |
|
|
// 刷新列表 |
|
|
// 刷新列表 |
|
|
await getList() |
|
|
await getList() |
|
@ -255,12 +316,13 @@ const handleFinish = async (id: number) => { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
/** 添加/修改操作 */ |
|
|
const basicFormRef = ref() |
|
|
const formRef = ref() |
|
|
const openForm = (type: string, row?: any) => { |
|
|
const openForm = async (type: string, row?: any) => { |
|
|
basicFormRef.value.open(type, row) |
|
|
tableData.value = [] |
|
|
|
|
|
formRef.value.open(type, row) |
|
|
if (type == 'create') { |
|
|
if (type == 'create') { |
|
|
nextTick(() => { |
|
|
nextTick(() => { |
|
|
basicFormRef.value.formRef.setValues({ |
|
|
formRef.value.formRef.setValues({ |
|
|
handleTime: new Date().getTime(), |
|
|
handleTime: new Date().getTime(), |
|
|
priority: '3' |
|
|
priority: '3' |
|
|
}) |
|
|
}) |
|
@ -268,50 +330,16 @@ const openForm = (type: string, row?: any) => { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// form表单提交 |
|
|
// 获取部门 用于详情 部门回显 |
|
|
const formsSuccess = async (formType, data) => { |
|
|
const { wsCache } = useCache() |
|
|
data.responUser = userStore.getUser.id |
|
|
|
|
|
var isHave = Q3.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 |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (data.qty == 0) { |
|
|
|
|
|
message.error('数量不能为0') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (data.amount == 0) { |
|
|
|
|
|
message.error('金额不能为0') |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (data.activeTime == 0) data.activeTime = null |
|
|
|
|
|
if (data.expireTime == 0) data.expireTime = null |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
basicFormRef.value.formLoading = true |
|
|
|
|
|
if (formType === 'create') { |
|
|
|
|
|
await Q3Api.createQ3(data) |
|
|
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
|
|
} else { |
|
|
|
|
|
await Q3Api.updateQ3(data) |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
} |
|
|
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
|
|
basicFormRef.value.formLoading = false |
|
|
|
|
|
getList() |
|
|
|
|
|
} finally { |
|
|
|
|
|
basicFormRef.value.formLoading = false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
/** 详情操作 */ |
|
|
const detailRef = ref() |
|
|
const detailRef = ref() |
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicQ3') |
|
|
const departmentCode = wsCache |
|
|
|
|
|
.get(CACHE_KEY.DEPT) |
|
|
|
|
|
.find((account) => account.id == row.departmentCode)?.name |
|
|
|
|
|
if (departmentCode) row.departmentCode = JSON.parse(JSON.stringify(departmentCode)) |
|
|
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'inspectionQ3Main') |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
/** 删除按钮操作 */ |
|
@ -319,11 +347,13 @@ const handleDelete = async (id: number) => { |
|
|
try { |
|
|
try { |
|
|
// 删除的二次确认 |
|
|
// 删除的二次确认 |
|
|
await message.delConfirm() |
|
|
await message.delConfirm() |
|
|
|
|
|
tableObject.loading = true |
|
|
// 发起删除 |
|
|
// 发起删除 |
|
|
await Q3Api.deleteQ3(id) |
|
|
await InspectionQ3MainApi.deleteInspectionQ3Main(id) |
|
|
|
|
|
tableObject.loading = false |
|
|
message.success(t('common.delSuccess')) |
|
|
message.success(t('common.delSuccess')) |
|
|
// 刷新列表 |
|
|
// 刷新列表 |
|
|
await getList() |
|
|
buttonBaseClick('refresh', null) |
|
|
} catch {} |
|
|
} catch {} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -335,24 +365,108 @@ const handleExport = async () => { |
|
|
await message.exportConfirm() |
|
|
await message.exportConfirm() |
|
|
// 发起导出 |
|
|
// 发起导出 |
|
|
exportLoading.value = true |
|
|
exportLoading.value = true |
|
|
const data = await Q3Api.exportQ3(tableObject.params) |
|
|
const excelTitle = ref(route.meta.title) |
|
|
download.excel(data, 'Q3通知单.xlsx') |
|
|
const data = await InspectionQ3MainApi.exportInspectionQ3Main(tableObject.params) |
|
|
|
|
|
download.excel(data, `【${excelTitle.value}】【${formatDate(new Date())}】.xlsx`) |
|
|
} catch { |
|
|
} catch { |
|
|
} finally { |
|
|
} finally { |
|
|
exportLoading.value = false |
|
|
exportLoading.value = false |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* tableForm方法 |
|
|
|
|
|
*/ |
|
|
|
|
|
const tableFormKeys = {} |
|
|
|
|
|
InspectionQ3Detail.allSchemas.tableFormColumns.forEach((item) => { |
|
|
|
|
|
tableFormKeys[item.field] = item.default ? item.default : '' |
|
|
|
|
|
}) |
|
|
|
|
|
const tableData = ref([]) |
|
|
|
|
|
|
|
|
|
|
|
// 添加明细 |
|
|
|
|
|
const handleAddTable = () => { |
|
|
|
|
|
// 添加明细 已有数据 添加的明细 生产线 工位按照之前数据进行添加 |
|
|
|
|
|
let tableForm = JSON.parse(JSON.stringify(tableFormKeys)) |
|
|
|
|
|
if (tableData.value.length > 0) { |
|
|
|
|
|
// tableForm.productionLineCode = tableData.value[0].productionLineCode |
|
|
|
|
|
// tableForm.workStationCode = tableData.value[0].workStationCode |
|
|
|
|
|
} |
|
|
|
|
|
tableData.value.push(tableForm) |
|
|
|
|
|
} |
|
|
|
|
|
// 删除明细 |
|
|
|
|
|
const handleDeleteTable = (item, index) => { |
|
|
|
|
|
let itemIndex = tableData.value.indexOf(item) |
|
|
|
|
|
if (itemIndex > -1) { |
|
|
|
|
|
tableData.value.splice(itemIndex, 1) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
const tableSelectionDelete = (selection) => { |
|
|
|
|
|
tableData.value = tableData.value.filter((item) => !selection.includes(item)) |
|
|
|
|
|
} |
|
|
|
|
|
// 主子数据 提交 |
|
|
|
|
|
const submitForm = async (formType, submitData) => { |
|
|
|
|
|
let data = { ...submitData } |
|
|
|
|
|
if (data.masterId) { |
|
|
|
|
|
data.id = data.masterId |
|
|
|
|
|
} |
|
|
|
|
|
data.responUser = userStore.getUser.nickname |
|
|
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
|
|
try { |
|
|
|
|
|
if (formType === 'create') { |
|
|
|
|
|
if(data.subList.length == 0){ |
|
|
|
|
|
message.warning("请添加子列表数据") |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
let flag = false; |
|
|
|
|
|
console.log(1111) |
|
|
|
|
|
data.subList.forEach((item) => { |
|
|
|
|
|
if(item.qty == 0){ |
|
|
|
|
|
message.warning("数量不能为0") |
|
|
|
|
|
flag = true; |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
if(flag){ |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
formRef.value.formLoading = true |
|
|
|
|
|
await InspectionQ3MainApi.createInspectionQ3Main(data) |
|
|
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
|
|
} else { |
|
|
|
|
|
await InspectionQ3MainApi.updateInspectionQ3Main(data) |
|
|
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
|
|
} |
|
|
|
|
|
formRef.value.dialogVisible = false |
|
|
|
|
|
// 刷新当前列表 |
|
|
|
|
|
if (formType === 'create') { |
|
|
|
|
|
getList() |
|
|
|
|
|
} else { |
|
|
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
|
|
} |
|
|
|
|
|
} finally { |
|
|
|
|
|
formRef.value.formLoading = false |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 子表新增/编辑校验 |
|
|
|
|
|
const detailValidate = async (data) => { |
|
|
|
|
|
// let rs = false |
|
|
|
|
|
// TODO: 单一新编/编辑,校验是否与其他子数据存在生产线工位有不同数据情况 |
|
|
|
|
|
return true |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** 导入 */ |
|
|
/** 导入 */ |
|
|
const importFormRef = ref() |
|
|
const importFormRef = ref() |
|
|
const handleImport = () => { |
|
|
const handleImport = () => { |
|
|
importFormRef.value.open() |
|
|
importFormRef.value.open() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 导入附件弹窗所需的参数 |
|
|
// 导入附件弹窗所需的参数 |
|
|
const importTemplateData = reactive({ |
|
|
const importTemplateData = reactive({ |
|
|
templateUrl: '', |
|
|
templateUrl: '', |
|
|
templateTitle: 'Q3通知单导入模版.xlsx' |
|
|
templateTitle: `【${route.meta.title}】导入模版.xlsx` |
|
|
}) |
|
|
}) |
|
|
|
|
|
|
|
|
// 导入成功之后 |
|
|
// 导入成功之后 |
|
|
const importSuccess = () => { |
|
|
const importSuccess = () => { |
|
|
getList() |
|
|
getList() |
|
@ -370,6 +484,5 @@ const searchFormClick = (searchData) => { |
|
|
/** 初始化 **/ |
|
|
/** 初始化 **/ |
|
|
onMounted(async () => { |
|
|
onMounted(async () => { |
|
|
getList() |
|
|
getList() |
|
|
importTemplateData.templateUrl = await Q3Api.importTemplate() |
|
|
|
|
|
}) |
|
|
}) |
|
|
</script> |
|
|
</script> |
|
|