From c11c32d7ee970999d755f9a94a772d370806ad14 Mon Sep 17 00:00:00 2001 From: lb Date: Fri, 11 Aug 2023 16:49:28 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=AE=BE=E5=A4=87=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/base/components/dialogForm.vue | 208 +++++++++ src/views/base/equipmentType/index.vue | 534 ++++++++++++++--------- src/views/base/mixin/basicPageMixin.js | 109 +++++ 3 files changed, 643 insertions(+), 208 deletions(-) create mode 100644 src/views/base/components/dialogForm.vue create mode 100644 src/views/base/mixin/basicPageMixin.js diff --git a/src/views/base/components/dialogForm.vue b/src/views/base/components/dialogForm.vue new file mode 100644 index 00000000..2db7ffd9 --- /dev/null +++ b/src/views/base/components/dialogForm.vue @@ -0,0 +1,208 @@ + + + + + + + diff --git a/src/views/base/equipmentType/index.vue b/src/views/base/equipmentType/index.vue index f95a15ba..2228fb42 100644 --- a/src/views/base/equipmentType/index.vue +++ b/src/views/base/equipmentType/index.vue @@ -1,219 +1,337 @@ diff --git a/src/views/base/mixin/basicPageMixin.js b/src/views/base/mixin/basicPageMixin.js new file mode 100644 index 00000000..670b909a --- /dev/null +++ b/src/views/base/mixin/basicPageMixin.js @@ -0,0 +1,109 @@ +import DialogForm from '../components/dialogForm.vue'; + +export default { + components: { DialogForm }, + data() { + return { + // 遮罩层 + loading: true, + // 导出遮罩层 + exportLoading: false, + // 显示搜索条件 + showSearch: true, + // 总条数 + total: 0, + // 质量检测信息基础列表 + list: [], + // 弹出层标题 + title: '', + // 是否显示弹出层 + open: false, + // 列表数据 + tableData: [], + // 弹窗的表单 + // form: {}, // 占位 + // 搜索框需要的 keys + // searchBarKeys: [], // 占位 + // tableProps: [], // 占位 + // tableBtn: [], // 占位 + // searchBarFormConfig: [], // 占位 + // // 弹窗表单配置 + // dialogFormConfig: [], // 占位 + }; + }, + mounted() {}, + methods: { + // 过滤后端传回的详情数据 + filterData(data, keys) { + const obj = {}; + keys.forEach((key) => { + if (/time/i.test(key)) { + obj[key] = new Date(data[key]); + } else { + obj[key] = data[key]; + } + }); + return obj; + }, + // 处理搜索条件 + handleSearchBarBtnClick() {}, + // 处理表格按钮 + handleTableBtnClick({ data, type }) { + switch (type) { + case 'edit': + this.handleUpdate(data); + break; + case 'delete': + this.handleDelete(data); + break; + } + }, + // 处理搜索栏按钮 + handleSearchBarBtnClick(btn) { + // const keys = ['name', 'createTime']; // timeVal // 已被 searchBarKeys 替代 + switch (btn.btnName) { + case 'search': + this.searchBarKeys.forEach((key) => { + if (key == 'timeVal') { + this.queryParams['startTime'] = btn.timeVal[0]; + this.queryParams['endTime'] = btn.timeVal[1]; + return; + } + this.queryParams[key] = btn[key] || null; + }); + this.handleQuery(); + break; + case 'add': + this.handleAdd(); + break; + case 'export': + this.handleExport(); + break; + case 'reset': + this.$refs['search-bar'].resetForm(); + this.resetQuery(); + break; + } + }, + handleEmitFun(val) { + console.log('emit unf', val); + }, + // 获取列表数据 + getList() {}, + /** 搜索按钮操作 */ + handleQuery() { + this.queryParams.pageNo = 1; + this.getList(); + }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm('queryForm'); + this.handleQuery(); + }, + /** 取消按钮 */ + cancel() { + this.open = false; + this.reset(); + }, + }, +};