|
|
@ -1,20 +1,36 @@ |
|
|
|
<template> |
|
|
|
<ContentWrap> |
|
|
|
<!-- 搜索工作栏 --> |
|
|
|
<Search :schema="ProblemSolving.allSchemas.searchSchema" @search="setSearchParams" @reset="setSearchParams" /> |
|
|
|
<Search |
|
|
|
:schema="ProblemSolving.allSchemas.searchSchema" |
|
|
|
@search="setSearchParams" |
|
|
|
@reset="setSearchParams" |
|
|
|
/> |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 列表头部 --> |
|
|
|
<TableHead :HeadButttondata="HeadButttondata" @button-base-click="buttonBaseClick" :routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" @searchFormClick="searchFormClick" |
|
|
|
:allSchemas="ProblemSolving.allSchemas" /> |
|
|
|
<TableHead |
|
|
|
:HeadButttondata="HeadButttondata" |
|
|
|
@button-base-click="buttonBaseClick" |
|
|
|
:routeName="routeName" |
|
|
|
@updataTableColumns="updataTableColumns" |
|
|
|
@searchFormClick="searchFormClick" |
|
|
|
:allSchemas="ProblemSolving.allSchemas" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 列表 --> |
|
|
|
<ContentWrap> |
|
|
|
<Table :columns="tableColumns" :data="tableObject.tableList" :loading="tableObject.loading" :pagination="{ |
|
|
|
<Table |
|
|
|
:columns="tableColumns" |
|
|
|
:data="tableObject.tableList" |
|
|
|
:loading="tableObject.loading" |
|
|
|
:pagination="{ |
|
|
|
total: tableObject.total |
|
|
|
}" v-model:pageSize="tableObject.pageSize" v-model:currentPage="tableObject.currentPage" |
|
|
|
v-model:sort="tableObject.sort"> |
|
|
|
}" |
|
|
|
v-model:pageSize="tableObject.pageSize" |
|
|
|
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> |
|
|
@ -27,16 +43,27 @@ |
|
|
|
</ContentWrap> |
|
|
|
|
|
|
|
<!-- 表单弹窗:添加/修改 --> |
|
|
|
<BasicForm ref="basicFormRef" @success="formsSuccess" :rules="ProblemSolvingRules" |
|
|
|
:formAllSchemas="ProblemSolving.allSchemas" :apiUpdate="ProblemSolvingApi.updateProblemSolving" |
|
|
|
:apiCreate="ProblemSolvingApi.createProblemSolving" @searchTableSuccess="searchTableSuccess" :isBusiness="false" /> |
|
|
|
<BasicForm |
|
|
|
ref="basicFormRef" |
|
|
|
@success="formsSuccess" |
|
|
|
:rules="ProblemSolvingRules" |
|
|
|
:formAllSchemas="ProblemSolving.allSchemas" |
|
|
|
:apiUpdate="ProblemSolvingApi.updateProblemSolving" |
|
|
|
:apiCreate="ProblemSolvingApi.createProblemSolving" |
|
|
|
@searchTableSuccess="searchTableSuccess" |
|
|
|
:isBusiness="false" |
|
|
|
/> |
|
|
|
|
|
|
|
<!-- 详情 --> |
|
|
|
<Detail ref="detailRef" :isBasic="true" :allSchemas="ProblemSolving.allSchemas" /> |
|
|
|
|
|
|
|
<!-- 导入 --> |
|
|
|
<ImportForm ref="importFormRef" url="/eam/item-accounts/import" :importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" /> |
|
|
|
<ImportForm |
|
|
|
ref="importFormRef" |
|
|
|
url="/eam/item-accounts/import" |
|
|
|
:importTemplateData="importTemplateData" |
|
|
|
@success="importSuccess" |
|
|
|
/> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script setup lang="ts"> |
|
|
@ -81,7 +108,7 @@ |
|
|
|
|
|
|
|
// 列表头部按钮 |
|
|
|
const HeadButttondata = [ |
|
|
|
defaultButtons.defaultAddBtn(null), // 新增 |
|
|
|
defaultButtons.defaultAddBtn(null) // 新增 |
|
|
|
// { |
|
|
|
// label: '自定义扩展按钮', |
|
|
|
// name: 'zdy', |
|
|
@ -94,16 +121,22 @@ |
|
|
|
|
|
|
|
// 头部按钮事件 |
|
|
|
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') { // 刷新 |
|
|
|
} else if (val == 'refresh') { |
|
|
|
// 刷新 |
|
|
|
getList() |
|
|
|
} else if (val == 'filtrate') { // 筛选 |
|
|
|
} else { // 其他按钮 |
|
|
|
} else if (val == 'filtrate') { |
|
|
|
// 筛选 |
|
|
|
} else { |
|
|
|
// 其他按钮 |
|
|
|
console.log('其他按钮', item) |
|
|
|
} |
|
|
|
} |
|
|
@ -111,14 +144,16 @@ |
|
|
|
// 列表-操作按钮 |
|
|
|
const butttondata = [ |
|
|
|
defaultButtons.mainListEditBtn(null), // 编辑 |
|
|
|
defaultButtons.mainListDeleteBtn(null), // 删除 |
|
|
|
defaultButtons.mainListDeleteBtn(null) // 删除 |
|
|
|
] |
|
|
|
|
|
|
|
// 列表-操作按钮事件 |
|
|
|
const buttonTableClick = async (val, row) => { |
|
|
|
if (val == 'edit') { // 编辑 |
|
|
|
if (val == 'edit') { |
|
|
|
// 编辑 |
|
|
|
openForm('update', row) |
|
|
|
} else if (val == 'delete') { // 删除 |
|
|
|
} else if (val == 'delete') { |
|
|
|
// 删除 |
|
|
|
handleDelete(row.id) |
|
|
|
} |
|
|
|
} |
|
|
@ -127,31 +162,34 @@ |
|
|
|
const basicFormRef = ref() |
|
|
|
const openForm = (type: string, row?: any) => { |
|
|
|
// console.log(99,row) |
|
|
|
row.filePathListView = row.filePathList.map(item=>{ |
|
|
|
console.log(row) |
|
|
|
if (row&&row.filePathList && row.filePathList.length > 0) { |
|
|
|
row.filePathListView = row.filePathList.map((item) => { |
|
|
|
return { |
|
|
|
name: item, |
|
|
|
url: item |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
basicFormRef.value.open(type, row) |
|
|
|
} |
|
|
|
|
|
|
|
// form表单提交 |
|
|
|
const formsSuccess = async (formType, data) => { |
|
|
|
var isHave = ProblemSolving.allSchemas.formSchema.some(function (item) { |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime'; |
|
|
|
}); |
|
|
|
return item.field === 'activeTime' || item.field === 'expireTime' |
|
|
|
}) |
|
|
|
if (isHave) { |
|
|
|
if (data.activeTime && data.expireTime && data.activeTime >= data.expireTime) { |
|
|
|
message.error('失效时间要大于生效时间') |
|
|
|
return; |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
if (data.activeTime == 0) data.activeTime = null; |
|
|
|
if (data.expireTime == 0) data.expireTime = null; |
|
|
|
data.filePathList=[]; |
|
|
|
if (data.activeTime == 0) data.activeTime = null |
|
|
|
if (data.expireTime == 0) data.expireTime = null |
|
|
|
data.filePathList = [] |
|
|
|
for (let i = 0; i < data.filePathListView.length; i++) { |
|
|
|
data.filePathList.push(data.filePathListView[i].url); |
|
|
|
data.filePathList.push(data.filePathListView[i].url) |
|
|
|
} |
|
|
|
if (formType === 'create') { |
|
|
|
await ProblemSolvingApi.createProblemSolving(data) |
|
|
|