|
|
@ -41,10 +41,9 @@ |
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
@success="getList" |
|
|
|
@success="formsSuccess" |
|
|
|
:rules="FactoryAreaRules" |
|
|
|
:formAllSchemas="FactoryArea.allSchemas" |
|
|
|
:searchTableParams="searchTableParams" |
|
|
|
:apiUpdate="FactoryAreaApi.updateFactoryArea" |
|
|
|
:apiCreate="FactoryAreaApi.createFactoryArea" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
@ -77,21 +76,20 @@ const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(FactoryArea.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 |
|
|
|
} |
|
|
|
|
|
|
|
// 查询列表页面参数设置 |
|
|
|
const searchTableParams = ref([ |
|
|
|
//{ |
|
|
|
// formField: 'productItemCode', |
|
|
|
// searchTableTitle: '物料信息', |
|
|
|
// searchTableAllSchemas: Itembasic.allSchemas, |
|
|
|
// searchTablePage: ItembasicApi.getItembasicPage |
|
|
|
//} |
|
|
|
]) |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
getListApi: FactoryAreaApi.getFactoryAreaPage // 分页接口 |
|
|
|
}) |
|
|
@ -101,9 +99,9 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn({hasPermi:'wms:factoryArea:create'}), // 新增 |
|
|
|
defaultButtons.defaultImportBtn({hasPermi:'wms:factoryArea:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'wms:factoryArea:export'}), // 导出 |
|
|
|
defaultButtons.defaultAddBtn(null), // 新增 |
|
|
|
defaultButtons.defaultImportBtn(null), // 导入 |
|
|
|
defaultButtons.defaultExportBtn(null), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
@ -135,8 +133,8 @@ const buttonBaseClick = (val, item) => { |
|
|
|
|
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn({hasPermi:'wms:factoryArea:update'}), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn({hasPermi:'wms:factoryArea:delete'}), // 删除 |
|
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn(null), // 删除 |
|
|
|
] |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
@ -154,13 +152,28 @@ const openForm = (type: string, row?: any) => { |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
} |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
|
formRef.setValues(setV) |
|
|
|
}) |
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
var isHave =FactoryArea.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 FactoryAreaApi.createFactoryArea(data) |
|
|
|
message.success(t('common.createSuccess')) |
|
|
|
} else { |
|
|
|
await FactoryAreaApi.updateFactoryArea(data) |
|
|
|
message.success(t('common.updateSuccess')) |
|
|
|
} |
|
|
|
basicFormRef.value.dialogVisible = false |
|
|
|
getList() |
|
|
|
} |
|
|
|
|
|
|
|
/** 详情操作 */ |
|
|
@ -190,8 +203,8 @@ const handleExport = async () => { |
|
|
|
await message.exportConfirm() |
|
|
|
// 发起导出 |
|
|
|
exportLoading.value = true |
|
|
|
const data = await FactoryAreaApi.exportFactoryArea(setSearchParams) |
|
|
|
download.excel(data, '厂区.xls') |
|
|
|
const data = await FactoryAreaApi.exportFactoryArea(tableObject.params) |
|
|
|
download.excel(data, '厂区.xlsx') |
|
|
|
} catch { |
|
|
|
} finally { |
|
|
|
exportLoading.value = false |
|
|
@ -206,7 +219,7 @@ const handleImport = () => { |
|
|
|
// 导入附件弹窗所需的参数 |
|
|
|
const importTemplateData = reactive({ |
|
|
|
templateUrl: '', |
|
|
|
templateTitle: '厂区导入模版.xls' |
|
|
|
templateTitle: '厂区导入模版.xlsx' |
|
|
|
}) |
|
|
|
// 导入成功之后 |
|
|
|
const importSuccess = () => { |
|
|
|