|
|
@ -1,7 +1,14 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="[...InspectionQ3Main.allSchemas.searchSchema,...InspectionQ3Detail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="[ |
|
|
|
...InspectionQ3Main.allSchemas.searchSchema, |
|
|
|
...InspectionQ3Detail.allSchemas.searchSchema |
|
|
|
]" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
@ -17,7 +24,8 @@ |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
|
<Table v-clientTable |
|
|
|
<Table |
|
|
|
v-clientTable |
|
|
|
:columns="tableColumns" |
|
|
|
:data="tableObject.tableList" |
|
|
|
:loading="tableObject.loading" |
|
|
@ -34,7 +42,10 @@ |
|
|
|
</el-button> |
|
|
|
</template> |
|
|
|
<template #action="{ row, $index }"> |
|
|
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<ButtonBase |
|
|
|
:Butttondata="butttondata(row, $index)" |
|
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
@ -59,13 +70,15 @@ |
|
|
|
@tableSelectionDelete="tableSelectionDelete" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
@submitForm="submitForm" |
|
|
|
@onChange="onChange" |
|
|
|
@inputNumberChange="inputNumberChange" |
|
|
|
@clearSearchInput="onChange" |
|
|
|
:sumFormDataByTableCustom ="(formRef,formModel,tableData)=>{ |
|
|
|
tableData.forEach(item=>{ |
|
|
|
:sumFormDataByTableCustom=" |
|
|
|
(formRef, formModel, tableData) => { |
|
|
|
tableData.forEach((item) => { |
|
|
|
item.qty = item.countQty * item.packQty |
|
|
|
}) |
|
|
|
}" |
|
|
|
} |
|
|
|
" |
|
|
|
> |
|
|
|
<!-- <template #default="{row}"> |
|
|
|
<el-input-number disabled v-model="row.qty"></el-input-number> |
|
|
@ -86,19 +99,26 @@ |
|
|
|
@searchTableSuccessDetail="searchTableSuccessDetail" |
|
|
|
:detailValidate="detailValidate" |
|
|
|
/> |
|
|
|
|
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|
|
|
import { InspectionQ3Main,InspectionQ3MainRules,InspectionQ3Detail,InspectionQ3DetailRules } from './inspectionQ3.data' |
|
|
|
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 ProductionlineitemApi from '@/api/wms/productionlineitem' |
|
|
|
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' |
|
|
|
const userStore = useUserStore() |
|
|
|
|
|
|
|
// 发料申请 |
|
|
|
defineOptions({ name: 'InspectionQ3Main' }) |
|
|
@ -109,7 +129,10 @@ const { t } = useI18n() // 国际化 |
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref([...InspectionQ3Main.allSchemas.tableColumns,...InspectionQ3Detail.allSchemas.tableMainColumns]) |
|
|
|
const tableColumns = ref([ |
|
|
|
...InspectionQ3Main.allSchemas.tableColumns, |
|
|
|
...InspectionQ3Detail.allSchemas.tableMainColumns |
|
|
|
]) |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
@ -124,17 +147,11 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
|
if (formField == 'itemCode') { |
|
|
|
val.forEach(item=>{ |
|
|
|
let tableForm = JSON.parse(JSON.stringify(tableFormKeys)) |
|
|
|
if(tableData.value.find(item1=>item1['itemCode'] == item['itemCode'])) return |
|
|
|
const newRow = JSON.parse(JSON.stringify({...tableForm,...item})) |
|
|
|
newRow['itemCode'] = item['code'] |
|
|
|
newRow['uom'] = item['uom'] |
|
|
|
tableData.value.push(newRow) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
// val.forEach(item=>{ |
|
|
|
|
|
|
|
// }) |
|
|
|
const index1 = 0 |
|
|
|
setTableFormsValues(val, index1) |
|
|
|
|
|
|
|
// row['uom'] = val[0]['uom'] |
|
|
|
// console.log(formRef.formModel.qty) |
|
|
@ -188,10 +205,52 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const onChange =(field,e)=>{ |
|
|
|
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 = { |
|
|
|
by: 'ASC', |
|
|
|
filters: [{ column: 'itemCode', action: '==', value: val[index1].itemCode }], |
|
|
|
pageNo: 1, |
|
|
|
pageSize: 500, |
|
|
|
sort: '' |
|
|
|
} |
|
|
|
params.isSearch = true |
|
|
|
await StdcostpriceApi.getStdcostpricePage(params).then((res) => { |
|
|
|
if (res.list?.length > 0) { |
|
|
|
priceObj.value = res.list[0] |
|
|
|
newRow['price'] = parseFloat(priceObj.value.price) |
|
|
|
newRow['amount']=(parseFloat(newRow['qty']) * parseFloat(priceObj.value.price)).toFixed(6) |
|
|
|
} |
|
|
|
}) |
|
|
|
tableData.value.push(newRow) |
|
|
|
index1++ |
|
|
|
setTableFormsValues(val, index1) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const inputNumberChange = (field, index, row, val) => { |
|
|
|
if (field == 'qty') { |
|
|
|
formRef.value.formRef.formModel.amount = (parseFloat( formRef.value.formRef.formModel.qty) * parseFloat( priceObj.value.price)).toFixed(6) |
|
|
|
row.amount = (parseFloat(row['qty']) * parseFloat(row.price)).toFixed(6) |
|
|
|
} |
|
|
|
formRef.value.formRef.formModel.summaryAmount =0 |
|
|
|
tableData.value.forEach(item=>{ |
|
|
|
formRef.value.formRef.formModel.summaryAmount += parseFloat(item.amount) |
|
|
|
}) |
|
|
|
} |
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
@ -220,19 +279,24 @@ const HeadButttondata = [ |
|
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'qms:inspection-Q3-main:export' }), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
|
] |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
if (val == 'add') { |
|
|
|
// 新增 |
|
|
|
openForm('create') |
|
|
|
} 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) |
|
|
|
} |
|
|
|
} |
|
|
@ -248,7 +312,9 @@ const isShowMainButton = (row, val) => { |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = (row, $index) => { |
|
|
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
|
|
|
const findIndex = row['masterId'] |
|
|
|
? tableObject.tableList.findIndex((item) => item['masterId'] == row['masterId']) |
|
|
|
: -1 |
|
|
|
if (findIndex > -1 && findIndex < $index) { |
|
|
|
return [] |
|
|
|
} |
|
|
@ -268,8 +334,6 @@ const butttondata = (row,$index) => { |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { |
|
|
@ -295,12 +359,12 @@ const handleFinish = async (id: number) => { |
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const formRef = ref() |
|
|
|
const openForm =async (type: string, row?: number) => { |
|
|
|
const openForm = async (type: string, row?: any) => { |
|
|
|
tableData.value = [] // 重置明细数据 |
|
|
|
// 编辑时 车间代码不可修改 |
|
|
|
if (type == 'update') { |
|
|
|
// 修改 tableform 属性 |
|
|
|
InspectionQ3Main.allSchemas.formSchema.map(itemColumns => { |
|
|
|
InspectionQ3Main.allSchemas.formSchema.map((itemColumns) => { |
|
|
|
if (itemColumns.field == 'workshopCode') { |
|
|
|
itemColumns.componentProps.isSearchList = false |
|
|
|
itemColumns.componentProps.disabled = true |
|
|
@ -308,7 +372,7 @@ const openForm =async (type: string, row?: number) => { |
|
|
|
}) |
|
|
|
} else { |
|
|
|
// 修改 tableform 属性 |
|
|
|
InspectionQ3Main.allSchemas.formSchema.map(itemColumns => { |
|
|
|
InspectionQ3Main.allSchemas.formSchema.map((itemColumns) => { |
|
|
|
if (itemColumns.field == 'workshopCode') { |
|
|
|
itemColumns.componentProps.isSearchList = true |
|
|
|
itemColumns.componentProps.disabled = false |
|
|
@ -323,9 +387,11 @@ const { wsCache } = useCache() |
|
|
|
/** 详情操作 */ |
|
|
|
const detailRef = ref() |
|
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
|
const departmentCode = wsCache.get(CACHE_KEY.DEPT).find((account) => account.id == row.departmentCode)?.name |
|
|
|
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,"requestIssueMain") |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'requestIssueMain') |
|
|
|
} |
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
@ -363,7 +429,7 @@ const handleExport = async () => { |
|
|
|
* tableForm方法 |
|
|
|
*/ |
|
|
|
const tableFormKeys = {} |
|
|
|
InspectionQ3Detail.allSchemas.tableFormColumns.forEach(item => { |
|
|
|
InspectionQ3Detail.allSchemas.tableFormColumns.forEach((item) => { |
|
|
|
tableFormKeys[item.field] = item.default ? item.default : '' |
|
|
|
}) |
|
|
|
const tableData = ref([]) |
|
|
@ -386,7 +452,7 @@ const handleDeleteTable = (item, index) => { |
|
|
|
} |
|
|
|
} |
|
|
|
const tableSelectionDelete = (selection) => { |
|
|
|
tableData.value = tableData.value.filter(item => !selection.includes(item)) |
|
|
|
tableData.value = tableData.value.filter((item) => !selection.includes(item)) |
|
|
|
} |
|
|
|
// 主子数据 提交 |
|
|
|
const submitForm = async (formType, submitData) => { |
|
|
@ -394,8 +460,9 @@ const submitForm = async (formType, submitData) => { |
|
|
|
if (data.masterId) { |
|
|
|
data.id = data.masterId |
|
|
|
} |
|
|
|
data.responUser = userStore.getUser.nickname |
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
if(tableData.value.find(item => (item.qty <= 0))) { |
|
|
|
if (tableData.value.find((item) => item.qty <= 0)) { |
|
|
|
message.warning('数量必须大于0') |
|
|
|
formRef.value.formLoading = false |
|
|
|
return |
|
|
|