|
|
@ -27,43 +27,47 @@ |
|
|
|
v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort" |
|
|
|
> |
|
|
|
<template #code="{row}"> |
|
|
|
<el-button type="primary" link @click="openDetail(row, '代码', row.code)"> |
|
|
|
<span>{{ row.code }}</span> |
|
|
|
<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" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
<ButtonBase :Butttondata="butttondata(row)" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
@success="formsSuccess" |
|
|
|
ref="formRef" |
|
|
|
@success="getList" |
|
|
|
:rules="StockupMainRecordRules" |
|
|
|
:formAllSchemas="StockupMainRecord.allSchemas" |
|
|
|
:apiUpdate="StockupMainRecordApi.updateStockupMainRecord" |
|
|
|
:apiCreate="StockupMainRecordApi.createStockupMainRecord" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
:isBusiness="false" |
|
|
|
:tableAllSchemas="StockupDetailRecord.allSchemas" |
|
|
|
:tableFormRules="StockupDetailRecordRules" |
|
|
|
:isBusiness="true" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="StockupMainRecord.allSchemas" /> |
|
|
|
|
|
|
|
|
|
|
|
<Detail |
|
|
|
ref="detailRef" |
|
|
|
:isBasic="false" |
|
|
|
:allSchemas="StockupMainRecord.allSchemas" |
|
|
|
:detailAllSchemas="StockupDetailRecord.allSchemas" |
|
|
|
:detailAllSchemasRules="StockupDetailRecordRules" |
|
|
|
:apiPage="StockupDetailRecordApi.getStockupDetailRecordPage" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
|
import download from '@/utils/download' |
|
|
|
import { StockupMainRecord,StockupMainRecordRules } from './stockupMainRecord.data' |
|
|
|
import { StockupMainRecord,StockupMainRecordRules,StockupDetailRecord,StockupDetailRecordRules } from './stockupMainRecord.data' |
|
|
|
import * as StockupMainRecordApi from '@/api/wms/stockupMainRecord' |
|
|
|
import * as StockupDetailRecordApi from '@/api/wms/stockupDetailRecord' |
|
|
|
import * as defaultButtons from '@/utils/disposition/defaultButtons' |
|
|
|
import TableHead from '@/components/TableHead/src/TableHead.vue' |
|
|
|
import Detail from '@/components/Detail/src/Detail.vue' |
|
|
|
|
|
|
|
// 备货记录主 |
|
|
|
defineOptions({ name: 'StockupMainRecord' }) |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
@ -74,15 +78,6 @@ const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(StockupMainRecord.allSchemas.tableColumns) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
@ -97,8 +92,7 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'wms:stockupMainRecord:create'}), // 新增 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:stockupMainRecord:export'}), // 导出 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:deliver-record-main:export'}), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
@ -114,12 +108,16 @@ const HeadButttondata = [ |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
if (val == 'export') { // 导出 |
|
|
|
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 { // 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
@ -127,67 +125,18 @@ const buttonBaseClick = (val, item) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn({hasPermi:'wms:stockupMainRecord:update'}), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:stockupMainRecord:delete'}), // 删除 |
|
|
|
] |
|
|
|
const butttondata = (row) => { |
|
|
|
return [] |
|
|
|
} |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** 添加/修改操作 */ |
|
|
|
const basicFormRef = ref() |
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
} |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
var isHave =StockupMainRecord.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.activeTime==0)data.activeTime = null; |
|
|
|
if(data.expireTime==0)data.expireTime = null; |
|
|
|
if (formType === 'create') { |
|
|
|
await StockupMainRecordApi.createStockupMainRecord(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await StockupMainRecordApi.updateStockupMainRecord(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
|
const detailRef = ref() |
|
|
|
const openDetail = (row: any, titleName: any, titleValue: any) => { |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue, 'basicStockupMainRecord') |
|
|
|
} |
|
|
|
|
|
|
|
/** 删除按钮操作 */ |
|
|
|
const handleDelete = async (id: number) => { |
|
|
|
try { |
|
|
|
// 删除的二次确认 |
|
|
|
await message.delConfirm() |
|
|
|
// 发起删除 |
|
|
|
await StockupMainRecordApi.deleteStockupMainRecord(id) |
|
|
|
message.success(t('common.delSuccess')) |
|
|
|
// 刷新列表 |
|
|
|
await getList() |
|
|
|
} catch {} |
|
|
|
detailRef.value.openDetail(row, titleName, titleValue,'recordDeliverMain') |
|
|
|
} |
|
|
|
|
|
|
|
/** 导出按钮操作 */ |
|
|
@ -206,7 +155,6 @@ const handleExport = async () => { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// 筛选提交 |
|
|
|
const searchFormClick = (searchData) => { |
|
|
|
tableObject.params = { |
|
|
@ -220,5 +168,4 @@ const searchFormClick = (searchData) => { |
|
|
|
onMounted(async () => { |
|
|
|
getList() |
|
|
|
}) |
|
|
|
|
|
|
|
</script> |
|
|
|