|
|
@ -1,7 +1,14 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="[...ScrapRequestMain.allSchemas.searchSchema,...ScrapRequestDetail.allSchemas.searchSchema]" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="[ |
|
|
|
...ScrapRequestMain.allSchemas.searchSchema, |
|
|
|
...ScrapRequestDetail.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" |
|
|
@ -28,13 +36,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,$index }"> |
|
|
|
<ButtonBase :Butttondata="butttondata(row,$index)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<template #action="{ row, $index }"> |
|
|
|
<ButtonBase |
|
|
|
:Butttondata="butttondata(row, $index)" |
|
|
|
@button-base-click="buttonTableClick($event, row)" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
@ -61,6 +72,7 @@ |
|
|
|
@inputNumberChange="inputNumberChange" |
|
|
|
@submitForm="submitForm" |
|
|
|
@tableFormSelectOnBlur="tableFormSelectOnBlur" |
|
|
|
@clearSearchInput="clearSearchInput" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
@ -82,14 +94,26 @@ |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/wms/scrap-request-main/import" :importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" :updateIsDisable="true" :coverIsDisable="true" :mode="2" /> |
|
|
|
<ImportForm |
|
|
|
ref="importFormRef" |
|
|
|
url="/wms/scrap-request-main/import" |
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" |
|
|
|
:updateIsDisable="true" |
|
|
|
:coverIsDisable="true" |
|
|
|
:mode="2" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { CACHE_KEY, useCache } from '@/hooks/web/useCache' |
|
|
|
import { ScrapRequestMain,ScrapRequestMainRules,ScrapRequestDetail,ScrapRequestDetailRules } from './scrapRequestMain.data' |
|
|
|
import { |
|
|
|
ScrapRequestMain, |
|
|
|
ScrapRequestMainRules, |
|
|
|
ScrapRequestDetail, |
|
|
|
ScrapRequestDetailRules |
|
|
|
} from './scrapRequestMain.data' |
|
|
|
import * as ScrapRequestMainApi from '@/api/wms/scrapRequestMain' |
|
|
|
import * as ScrapRequestDetailApi from '@/api/wms/scrapRequestDetail' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
@ -105,8 +129,10 @@ const { t } = useI18n() // 国际化 |
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref([...ScrapRequestMain.allSchemas.tableColumns,...ScrapRequestDetail.allSchemas.tableMainColumns]) |
|
|
|
|
|
|
|
const tableColumns = ref([ |
|
|
|
...ScrapRequestMain.allSchemas.tableColumns, |
|
|
|
...ScrapRequestDetail.allSchemas.tableMainColumns |
|
|
|
]) |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
@ -114,7 +140,7 @@ const updataTableColumns = (val) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => { |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef, type, row) => { |
|
|
|
nextTick(() => { |
|
|
|
if (type == 'tableForm') { |
|
|
|
// 明细查询页赋值 |
|
|
@ -129,21 +155,28 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
// tableData.value.push(newRow) |
|
|
|
// }) |
|
|
|
// 查询标准价格 |
|
|
|
if(formField == 'packingNumber'){ |
|
|
|
val = val.filter(item=>!tableData.value.find(item1=>item1['itemCode']==item['itemCode']&&item1['packingNumber']==item['packingNumber'])) |
|
|
|
if(val.length==0) return |
|
|
|
let param = {'itemCodes':val.map(item=>item.itemCode).join(',') as string} |
|
|
|
StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => { |
|
|
|
val.forEach(item=>{ |
|
|
|
const itemCode = res.find(item1=>item1['itemCode']==item['itemCode']) |
|
|
|
const newRow = JSON.parse(JSON.stringify({...tableFormKeys,...item})) |
|
|
|
if (formField == 'packingNumber') { |
|
|
|
val = val.filter( |
|
|
|
(item) => |
|
|
|
!tableData.value.find( |
|
|
|
(item1) => |
|
|
|
item1['itemCode'] == item['itemCode'] && |
|
|
|
item1['packingNumber'] == item['packingNumber'] |
|
|
|
) |
|
|
|
) |
|
|
|
if (val.length == 0) return |
|
|
|
let param = { itemCodes: val.map((item) => item.itemCode).join(',') as string } |
|
|
|
StdcostpriceApi.queryStdcostpriceByItemCode(param).then((res) => { |
|
|
|
val.forEach((item) => { |
|
|
|
const itemCode = res.find((item1) => item1['itemCode'] == item['itemCode']) |
|
|
|
const newRow = JSON.parse(JSON.stringify({ ...tableFormKeys, ...item })) |
|
|
|
newRow[formField] = item[searchField] |
|
|
|
newRow['packingNumber'] = item['packingNumber'] |
|
|
|
newRow['batch'] = item['batch'] |
|
|
|
newRow['fromLocationCode'] = item['locationCode'] |
|
|
|
newRow['itemCode'] = item['itemCode'] |
|
|
|
newRow['uom'] = item['uom'] |
|
|
|
newRow['singlePrice'] = itemCode?itemCode['price']:'' |
|
|
|
newRow['singlePrice'] = itemCode ? itemCode['price'] : '' |
|
|
|
tableData.value.push(newRow) |
|
|
|
}) |
|
|
|
// row['singlePrice'] = res.price |
|
|
@ -151,16 +184,71 @@ const searchTableSuccess = (formField, searchField, val, formRef, type, row ) => |
|
|
|
} else { |
|
|
|
row[formField] = val[0][searchField] |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
formRef.setValues(setV) |
|
|
|
if (formField == 'q1Number') { |
|
|
|
ScrapRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'q2Number' || item.field == 'q3Number') { |
|
|
|
item.componentProps.enterSearch = false |
|
|
|
item.componentProps.isSearchList = false |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if (formField == 'q2Number') { |
|
|
|
ScrapRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'q1Number' || item.field == 'q3Number') { |
|
|
|
item.componentProps.enterSearch = false |
|
|
|
item.componentProps.isSearchList = false |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if (formField == 'q3Number') { |
|
|
|
ScrapRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'q1Number' || item.field == 'q2Number') { |
|
|
|
item.componentProps.enterSearch = false |
|
|
|
item.componentProps.isSearchList = false |
|
|
|
item.componentProps.disabled = true |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
const clearSearchInput = (field) => { |
|
|
|
if (field == 'q1Number') { |
|
|
|
ScrapRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'q2Number' || item.field == 'q3Number') { |
|
|
|
item.componentProps.enterSearch = true |
|
|
|
item.componentProps.isSearchList = true |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if (field == 'q2Number') { |
|
|
|
ScrapRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'q1Number' || item.field == 'q3Number') { |
|
|
|
item.componentProps.enterSearch = true |
|
|
|
item.componentProps.isSearchList = true |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
if (field == 'q3Number') { |
|
|
|
ScrapRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'q1Number' || item.field == 'q1Number') { |
|
|
|
item.componentProps.enterSearch = true |
|
|
|
item.componentProps.isSearchList = true |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
// 查询页面返回——详情 |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
const searchTableSuccessDetail = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
@ -170,9 +258,9 @@ const searchTableSuccessDetail = (formField, searchField, val, formRef ) => { |
|
|
|
setV['itemCode'] = val[0]['itemCode'] |
|
|
|
setV['uom'] = val[0]['uom'] |
|
|
|
// 查询标准价格 |
|
|
|
let param = {'itemCodes':val[0]['itemCode'] as string} |
|
|
|
StdcostpriceApi.queryStdcostpriceByItemCode(param).then(res => { |
|
|
|
if(res&&res.length>0){ |
|
|
|
let param = { itemCodes: val[0]['itemCode'] as string } |
|
|
|
StdcostpriceApi.queryStdcostpriceByItemCode(param).then((res) => { |
|
|
|
if (res && res.length > 0) { |
|
|
|
setV['singlePrice'] = res[0].price |
|
|
|
} |
|
|
|
}) |
|
|
@ -193,12 +281,12 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'wms:scrap-request-main:create'}), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({hasPermi:'wms:scrap-request-main:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:scrap-request-main:export'}), // 导出 |
|
|
|
defaultButtons.defaultAddBtn({ hasPermi: 'wms:scrap-request-main:create' }), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({ hasPermi: 'wms:scrap-request-main:import' }), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({ hasPermi: 'wms:scrap-request-main:export' }), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
|
defaultButtons.defaultSetBtn(null) // 设置 |
|
|
|
// { |
|
|
|
// label: '自定义扩展按钮', |
|
|
|
// name: 'zdy', |
|
|
@ -211,28 +299,34 @@ 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') { // 刷新 |
|
|
|
if (tableObject.params.filters && tableObject.params.filters.length > 0 ) { |
|
|
|
} 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 { // 其他按钮 |
|
|
|
} 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 { |
|
|
@ -241,45 +335,76 @@ const isShowMainButton = (row,val) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = (row,$index) => { |
|
|
|
const findIndex = row['masterId']?tableObject.tableList.findIndex(item=>item['masterId'] == row['masterId']):-1 |
|
|
|
if(findIndex>-1&&findIndex<$index){ |
|
|
|
const butttondata = (row, $index) => { |
|
|
|
const findIndex = row['masterId'] |
|
|
|
? tableObject.tableList.findIndex((item) => item['masterId'] == row['masterId']) |
|
|
|
: -1 |
|
|
|
if (findIndex > -1 && findIndex < $index) { |
|
|
|
return [] |
|
|
|
} |
|
|
|
return [ |
|
|
|
defaultButtons.mainListCloseBtn({hide:isShowMainButton(row,['1','2','3','4','6']),hasPermi:'wms:scrap-request-main:close'}), // 关闭 |
|
|
|
defaultButtons.mainListReAddBtn({hide:isShowMainButton(row,['5']),hasPermi:'wms:scrap-request-main:reAdd'}), // 重新添加 |
|
|
|
defaultButtons.mainListSubmitBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:scrap-request-main:submit'}), // 提交审批 |
|
|
|
defaultButtons.mainListTurnDownBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:scrap-request-main:refused'}), // 驳回 |
|
|
|
defaultButtons.mainListApproveBtn({hide:isShowMainButton(row,['2']),hasPermi:'wms:scrap-request-main:agree'}), // 审批通过 |
|
|
|
defaultButtons.mainListHandleBtn({hide:isShowMainButton(row,['3']),hasPermi:'wms:scrap-request-main:handle'}), // 处理 |
|
|
|
defaultButtons.mainListEditBtn({hide:isShowMainButton(row,['1']),hasPermi:'wms:scrap-request-main:update'}), // 编辑 |
|
|
|
defaultButtons.mainListCloseBtn({ |
|
|
|
hide: isShowMainButton(row, ['1', '2', '3', '4', '6']), |
|
|
|
hasPermi: 'wms:scrap-request-main:close' |
|
|
|
}), // 关闭 |
|
|
|
defaultButtons.mainListReAddBtn({ |
|
|
|
hide: isShowMainButton(row, ['5']), |
|
|
|
hasPermi: 'wms:scrap-request-main:reAdd' |
|
|
|
}), // 重新添加 |
|
|
|
defaultButtons.mainListSubmitBtn({ |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'wms:scrap-request-main:submit' |
|
|
|
}), // 提交审批 |
|
|
|
defaultButtons.mainListTurnDownBtn({ |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
hasPermi: 'wms:scrap-request-main:refused' |
|
|
|
}), // 驳回 |
|
|
|
defaultButtons.mainListApproveBtn({ |
|
|
|
hide: isShowMainButton(row, ['2']), |
|
|
|
hasPermi: 'wms:scrap-request-main:agree' |
|
|
|
}), // 审批通过 |
|
|
|
defaultButtons.mainListHandleBtn({ |
|
|
|
hide: isShowMainButton(row, ['3']), |
|
|
|
hasPermi: 'wms:scrap-request-main:handle' |
|
|
|
}), // 处理 |
|
|
|
defaultButtons.mainListEditBtn({ |
|
|
|
hide: isShowMainButton(row, ['1']), |
|
|
|
hasPermi: 'wms:scrap-request-main:update' |
|
|
|
}) // 编辑 |
|
|
|
// defaultButtons.mainListDeleteBtn({hasPermi:'wms:scrap-request-main:delete'}), // 删除 |
|
|
|
] |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'mainClose') { // 关闭 |
|
|
|
if (val == 'mainClose') { |
|
|
|
// 关闭 |
|
|
|
console.log('列表-操作按钮事件-关闭') |
|
|
|
handleClose(row.masterId) |
|
|
|
} else if (val == 'mainReAdd') { // 重新添加 |
|
|
|
} else if (val == 'mainReAdd') { |
|
|
|
// 重新添加 |
|
|
|
console.log('列表-操作按钮事件-重新添加') |
|
|
|
handleReAdd(row.masterId) |
|
|
|
} else if (val == 'mainSubmit') { // 提交审批 |
|
|
|
} else if (val == 'mainSubmit') { |
|
|
|
// 提交审批 |
|
|
|
console.log('列表-操作按钮事件-提交审批') |
|
|
|
handleSubmit(row.masterId) |
|
|
|
} else if (val == 'mainTurnDown') { // 驳回 |
|
|
|
} else if (val == 'mainTurnDown') { |
|
|
|
// 驳回 |
|
|
|
console.log('列表-操作按钮事件-驳回') |
|
|
|
handleRefused(row.masterId) |
|
|
|
} else if (val == 'mainApprove') { // 审批通过 |
|
|
|
} else if (val == 'mainApprove') { |
|
|
|
// 审批通过 |
|
|
|
console.log('列表-操作按钮事件-审批通过') |
|
|
|
handleAgree(row.masterId) |
|
|
|
} else if (val == 'mainHandle') { // 处理 |
|
|
|
} else if (val == 'mainHandle') { |
|
|
|
// 处理 |
|
|
|
handleHandle(row.masterId) |
|
|
|
} else if (val == 'edit') { // 编辑 |
|
|
|
} else if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
} else if (val == 'delete') { |
|
|
|
// 删除 |
|
|
|
handleDelete(row.masterId) |
|
|
|
} |
|
|
|
} |
|
|
@ -292,7 +417,7 @@ const handleClose = async (id: number) => { |
|
|
|
await ScrapRequestMainApi.closeScrapRequestMain(id) |
|
|
|
message.success(t('common.closeSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
|
|
|
@ -304,7 +429,7 @@ const handleReAdd = async (id: number) => { |
|
|
|
await ScrapRequestMainApi.reAddScrapRequestMain(id) |
|
|
|
message.success(t('common.reAddSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
|
|
|
@ -316,7 +441,7 @@ const handleSubmit = async (id: number) => { |
|
|
|
await ScrapRequestMainApi.submitScrapRequestMain(id) |
|
|
|
message.success(t('common.submitSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
|
|
|
@ -328,7 +453,7 @@ const handleRefused = async (id: number) => { |
|
|
|
await ScrapRequestMainApi.refusedScrapRequestMain(id) |
|
|
|
message.success(t('common.refusedSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
|
|
|
@ -340,7 +465,7 @@ const handleAgree = async (id: number) => { |
|
|
|
await ScrapRequestMainApi.agreeScrapRequestMain(id) |
|
|
|
message.success(t('common.agreeSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
|
|
|
@ -352,13 +477,20 @@ const handleHandle = async (id: number) => { |
|
|
|
await ScrapRequestMainApi.handleScrapRequestMain(id) |
|
|
|
message.success(t('common.handleSuccess')) |
|
|
|
tableObject.loading = false |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const formRef = ref() |
|
|
|
const openForm =async (type: string, row?: number) => { |
|
|
|
const openForm = async (type: string, row?: number) => { |
|
|
|
ScrapRequestMain.allSchemas.formSchema.forEach((item) => { |
|
|
|
if (item.field == 'q1Number' || item.field == 'q2Number' || item.field == 'q3Number') { |
|
|
|
item.componentProps.enterSearch = true |
|
|
|
item.componentProps.isSearchList = true |
|
|
|
item.componentProps.disabled = false |
|
|
|
} |
|
|
|
}) |
|
|
|
tableData.value = [] // 重置明细数据 |
|
|
|
formRef.value.open(type, row) |
|
|
|
} |
|
|
@ -368,9 +500,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,'requestScrapMain') |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'requestScrapMain') |
|
|
|
} |
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
@ -384,7 +518,7 @@ const handleDelete = async (id: number) => { |
|
|
|
tableObject.loading = false |
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
// 刷新列表 |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} catch {} |
|
|
|
} |
|
|
|
|
|
|
@ -407,9 +541,9 @@ const handleExport = async () => { |
|
|
|
|
|
|
|
/** |
|
|
|
* tableForm方法 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
const tableFormKeys = {} |
|
|
|
ScrapRequestDetail.allSchemas.tableFormColumns.forEach(item => { |
|
|
|
ScrapRequestDetail.allSchemas.tableFormColumns.forEach((item) => { |
|
|
|
tableFormKeys[item.field] = item.default ? item.default : '' |
|
|
|
}) |
|
|
|
const tableData = ref([]) |
|
|
@ -421,36 +555,36 @@ const handleAddTable = () => { |
|
|
|
// 删除明细 |
|
|
|
const handleDeleteTable = (item, index) => { |
|
|
|
let itemIndex = tableData.value.indexOf(item) |
|
|
|
if(itemIndex>-1){ |
|
|
|
if (itemIndex > -1) { |
|
|
|
tableData.value.splice(itemIndex, 1) |
|
|
|
} |
|
|
|
} |
|
|
|
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) => { |
|
|
|
let data = {...submitData} |
|
|
|
if(data.masterId){ |
|
|
|
let data = { ...submitData } |
|
|
|
if (data.masterId) { |
|
|
|
data.id = data.masterId |
|
|
|
} |
|
|
|
data.subList = tableData.value // 拼接子表数据参数 |
|
|
|
try { |
|
|
|
if (formType === 'create') { |
|
|
|
console.log("【报废出库子列表】",data.subList) |
|
|
|
if(data.subList.length == 0){ |
|
|
|
message.warning("请添加子列表数据") |
|
|
|
return; |
|
|
|
console.log('【报废出库子列表】', data.subList) |
|
|
|
if (data.subList.length == 0) { |
|
|
|
message.warning('请添加子列表数据') |
|
|
|
return |
|
|
|
} |
|
|
|
let flag = false; |
|
|
|
let flag = false |
|
|
|
data.subList.forEach((item) => { |
|
|
|
if(item.qty == 0){ |
|
|
|
message.warning("数量不能为0") |
|
|
|
flag = true; |
|
|
|
return; |
|
|
|
if (item.qty == 0) { |
|
|
|
message.warning('数量不能为0') |
|
|
|
flag = true |
|
|
|
return |
|
|
|
} |
|
|
|
}) |
|
|
|
if(flag){ |
|
|
|
if (flag) { |
|
|
|
return |
|
|
|
} |
|
|
|
formRef.value.formLoading = true |
|
|
@ -465,8 +599,8 @@ const submitForm = async (formType, submitData) => { |
|
|
|
// 刷新当前列表 |
|
|
|
if (formType === 'create') { |
|
|
|
getList() |
|
|
|
}else{ |
|
|
|
buttonBaseClick('refresh',null) |
|
|
|
} else { |
|
|
|
buttonBaseClick('refresh', null) |
|
|
|
} |
|
|
|
} finally { |
|
|
|
formRef.value.formLoading = false |
|
|
@ -475,14 +609,14 @@ const submitForm = async (formType, submitData) => { |
|
|
|
|
|
|
|
// 子表新增/编辑校验 |
|
|
|
const detailValidate = (data) => { |
|
|
|
let tag = false; |
|
|
|
if(data.qty <= 0){ |
|
|
|
let tag = false |
|
|
|
if (data.qty <= 0) { |
|
|
|
message.warning('数量必须大于0') |
|
|
|
tag = false; |
|
|
|
return tag; |
|
|
|
}else { |
|
|
|
tag = true; |
|
|
|
return tag; |
|
|
|
tag = false |
|
|
|
return tag |
|
|
|
} else { |
|
|
|
tag = true |
|
|
|
return tag |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -525,14 +659,16 @@ const tableFormSelectOnBlur = (field, val, row, index) => { |
|
|
|
} |
|
|
|
|
|
|
|
const inputNumberChange = (field, index, row, val) => { |
|
|
|
if(field == 'qty' || field == 'singlePrice'){ |
|
|
|
if (field == 'qty' || field == 'singlePrice') { |
|
|
|
row.amount = row.qty * row.singlePrice |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
const qtyOnChange = (field,val) =>{ |
|
|
|
if(field == 'qty' || field == 'singlePrice'){ |
|
|
|
detailRef.value.formRef.formRef.formModel.amount = detailRef.value.formRef.formRef.formModel.qty * detailRef.value.formRef.formRef.formModel.singlePrice |
|
|
|
const qtyOnChange = (field, val) => { |
|
|
|
if (field == 'qty' || field == 'singlePrice') { |
|
|
|
detailRef.value.formRef.formRef.formModel.amount = |
|
|
|
detailRef.value.formRef.formRef.formModel.qty * |
|
|
|
detailRef.value.formRef.formRef.formModel.singlePrice |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|