|
|
@ -35,10 +35,6 @@ |
|
|
|
<template #action="{ row }"> |
|
|
|
<ButtonBase :Butttondata="butttondata" @button-base-click="buttonTableClick($event,row)" /> |
|
|
|
</template> |
|
|
|
|
|
|
|
<template v-for="name in array" :key="name.field" #[name.field]="{row}"> |
|
|
|
<span>44</span> |
|
|
|
</template> |
|
|
|
</Table> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
@ -72,16 +68,70 @@ import Detail from '@/components/Detail/src/Detail.vue' |
|
|
|
|
|
|
|
defineOptions({ name: 'SupplierDeliMain' }) |
|
|
|
|
|
|
|
// const array = [{ |
|
|
|
// field: "code1", |
|
|
|
// isForm: false, |
|
|
|
// isTable: true, |
|
|
|
// isSearch: true, |
|
|
|
// label: "编码1", |
|
|
|
// sort: "custom", |
|
|
|
// sortTableDefault: 999, |
|
|
|
// width: 150, |
|
|
|
// table:{ |
|
|
|
// width: 150, |
|
|
|
// } |
|
|
|
// }] |
|
|
|
|
|
|
|
const orginTableColumns = ref(SupplierDeliMain.allSchemas.tableColumns) |
|
|
|
const tableColumns = ref(SupplierDeliMain.allSchemas.tableColumns) |
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val: { [x: string]: any; field: string; label?: string | undefined; width?: string | number | undefined; fixed?: "left" | "right" | undefined; children?: any[] | undefined }[]) => { |
|
|
|
orginTableColumns.value = val |
|
|
|
} |
|
|
|
|
|
|
|
const { tableObject:tableObjectHead, tableMethods:tableMethodsHead } = useTable({ |
|
|
|
getListApi: SupplierDeliMainApi.getPageTableHead // 分页接口 |
|
|
|
}) |
|
|
|
|
|
|
|
// 获得表格的各种操作 |
|
|
|
const { getList:getListHead, setSearchParams:setSearchParamsHead } = tableMethodsHead |
|
|
|
|
|
|
|
watch(()=>tableObjectHead.tableList,()=>{ |
|
|
|
updateDateTableColumns() |
|
|
|
},{deep:true}) |
|
|
|
const updateDateTableColumns = ()=>{ |
|
|
|
console.log('tableObjectHead',tableObjectHead) |
|
|
|
let dateColumns = [] |
|
|
|
if(tableObjectHead.tableList.length>10){ |
|
|
|
tableObjectHead.tableList.forEach(item=>{ |
|
|
|
dateColumns.push({ |
|
|
|
width:120, |
|
|
|
field: item, |
|
|
|
label: item |
|
|
|
}) |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
tableObjectHead.tableList.forEach(item=>{ |
|
|
|
dateColumns.push({ |
|
|
|
field: item, |
|
|
|
label: item |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
tableColumns.value = [...orginTableColumns.value,...dateColumns] |
|
|
|
console.log('tableColumns',tableColumns.value) |
|
|
|
} |
|
|
|
|
|
|
|
const message = useMessage() // 消息弹窗 |
|
|
|
const { t } = useI18n() // 国际化 |
|
|
|
|
|
|
|
const route = useRoute() // 路由信息 |
|
|
|
const routeName = ref() |
|
|
|
routeName.value = route.name |
|
|
|
const tableColumns = ref(SupplierDeliMain.allSchemas.tableColumns) |
|
|
|
// const tableColumns = ref(SupplierDeliMain.allSchemas.tableColumns) |
|
|
|
|
|
|
|
// 查询页面返回 |
|
|
|
const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
const searchTableSuccess = (formField: string | number, searchField: string | number, val: { [x: string]: any }[], formRef: { setValues: (arg0: {}) => void }) => { |
|
|
|
nextTick(() => { |
|
|
|
const setV = {} |
|
|
|
setV[formField] = val[0][searchField] |
|
|
@ -90,9 +140,9 @@ const searchTableSuccess = (formField, searchField, val, formRef) => { |
|
|
|
} |
|
|
|
|
|
|
|
// 字段设置 更新主列表字段 |
|
|
|
const updataTableColumns = (val) => { |
|
|
|
tableColumns.value = val |
|
|
|
} |
|
|
|
// const updataTableColumns = (val) => { |
|
|
|
// tableColumns.value = val |
|
|
|
// } |
|
|
|
|
|
|
|
const { tableObject, tableMethods } = useTable({ |
|
|
|
getListApi: SupplierDeliMainApi.getSupplierDeliMainPage // 分页接口 |
|
|
@ -105,7 +155,7 @@ const { getList, setSearchParams } = tableMethods |
|
|
|
const HeadButttondata = [ |
|
|
|
// defaultButtons.defaultAddBtn({hasPermi:'wms:supplierDeliMain:create'}), // 新增 |
|
|
|
// defaultButtons.defaultImportBtn({hasPermi:'wms:supplierDeliMain:import'}), // 导入 |
|
|
|
defaultButtons.defaultExportBtn({hasPermi:'basic:supplier-deli-main:export'}), // 导出 |
|
|
|
defaultButtons.defaultExportBtn(null), // 导出 |
|
|
|
defaultButtons.defaultFreshBtn(null), // 刷新 |
|
|
|
// defaultButtons.defaultFilterBtn(null), // 筛选 |
|
|
|
defaultButtons.defaultSetBtn(null), // 设置 |
|
|
@ -120,7 +170,7 @@ const HeadButttondata = [ |
|
|
|
] |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
const buttonBaseClick = (val, item) => { |
|
|
|
const buttonBaseClick = (val: string, item: any) => { |
|
|
|
if (val == 'add') { // 新增 |
|
|
|
openForm('create') |
|
|
|
} else if (val == 'import') { // 导入 |
|
|
@ -128,6 +178,7 @@ const buttonBaseClick = (val, item) => { |
|
|
|
} else if (val == 'export') { // 导出 |
|
|
|
handleExport() |
|
|
|
} else if (val == 'refresh') { // 刷新 |
|
|
|
getListHead() |
|
|
|
getList() |
|
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
|
} else { // 其他按钮 |
|
|
@ -142,7 +193,7 @@ const butttondata = [ |
|
|
|
] |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
const buttonTableClick = async (val: string, row: { id: number }) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
@ -157,7 +208,7 @@ const openForm = (type: string, row?: any) => { |
|
|
|
} |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType,data) => { |
|
|
|
const formsSuccess = async (formType: string,data: SupplierDeliMainApi.SupplierDeliMainVO) => { |
|
|
|
var isHave =SupplierDeliMain.allSchemas.formSchema.some(function (item) { |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
}); |
|
|
@ -231,7 +282,7 @@ const importSuccess = () => { |
|
|
|
} |
|
|
|
|
|
|
|
// 筛选提交 |
|
|
|
const searchFormClick = (searchData) => { |
|
|
|
const searchFormClick = (searchData: { filters: any }) => { |
|
|
|
tableObject.params = { |
|
|
|
isSearch: true, |
|
|
|
filters: searchData.filters |
|
|
@ -241,9 +292,8 @@ const searchFormClick = (searchData) => { |
|
|
|
|
|
|
|
/** 初始化 **/ |
|
|
|
onMounted(async () => { |
|
|
|
tableObject.params = { |
|
|
|
isSearch: true |
|
|
|
} |
|
|
|
getListHead() |
|
|
|
getList() |
|
|
|
importTemplateData.templateUrl = await SupplierDeliMainApi.importTemplate() |
|
|
|
}) |
|
|
|
|
|
|
|