From b6e47673460528a10647f939704f2764f7ae4733 Mon Sep 17 00:00:00 2001 From: lb Date: Wed, 2 Aug 2023 11:27:33 +0800 Subject: [PATCH] add mixin & dialog --- src/views/quality/base/mixin.js | 5 - .../base/qualityInspectionDet/index.vue | 58 ++++++-- src/views/quality/components/dialogForm.vue | 137 ++++++++++++++++++ src/views/quality/mixin/basicPageMixin.js | 87 +++++++++++ 4 files changed, 268 insertions(+), 19 deletions(-) delete mode 100644 src/views/quality/base/mixin.js create mode 100644 src/views/quality/components/dialogForm.vue create mode 100644 src/views/quality/mixin/basicPageMixin.js diff --git a/src/views/quality/base/mixin.js b/src/views/quality/base/mixin.js deleted file mode 100644 index 91b329b7..00000000 --- a/src/views/quality/base/mixin.js +++ /dev/null @@ -1,5 +0,0 @@ -export default { - data() { - - } -} \ No newline at end of file diff --git a/src/views/quality/base/qualityInspectionDet/index.vue b/src/views/quality/base/qualityInspectionDet/index.vue index 6ec4534b..9bca5dc5 100644 --- a/src/views/quality/base/qualityInspectionDet/index.vue +++ b/src/views/quality/base/qualityInspectionDet/index.vue @@ -37,8 +37,12 @@ @confirm="submitForm"> - - + + @@ -52,7 +56,6 @@ - @@ -66,11 +69,14 @@ import { exportQualityInspectionDetExcel, } from '@/api/base/qualityInspectionDet'; +import moment from 'moment'; + export default { name: 'QualityInspectionDet', components: {}, data() { return { + typeList: [], // 检测类型列表 searchBarFormConfig: [ { type: 'input', @@ -124,15 +130,19 @@ export default { // }, ], tableBtn: [ - this.$auth.hasPermi('base:quality-inspection-det:update') ? { - type: 'edit', - btnName: '修改', - } : undefined, - this.$auth.hasPermi('base:quality-inspection-det:delete') ? { - type: 'delete', - btnName: '删除', - } : undefined, - ].filter(v=>v), + this.$auth.hasPermi('base:quality-inspection-det:update') + ? { + type: 'edit', + btnName: '修改', + } + : undefined, + this.$auth.hasPermi('base:quality-inspection-det:delete') + ? { + type: 'delete', + btnName: '删除', + } + : undefined, + ].filter((v) => v), tableData: [], tableProps: [ { @@ -183,6 +193,7 @@ export default { }, created() { this.getList(); + this.getTypeList(); }, methods: { /** base table related */ @@ -226,6 +237,19 @@ export default { handleEmitFun(val) { console.log('emit unf', val); }, + /** 获取检测类型id */ + getTypeList() { + this.$axios('/base/quality-inspection-type/listAll').then( + (response) => { + this.typeList = response.data.map((item) => { + return { + label: item.name, + value: item.id, + }; + }); + } + ); + }, /** 查询列表 */ getList() { this.loading = true; @@ -266,7 +290,7 @@ export default { handleAdd() { this.reset(); this.open = true; - this.title = '添加质量检测信息基础'; + this.title = '添加质量检测信息'; }, /** 修改按钮操作 */ handleUpdate(row) { @@ -275,7 +299,7 @@ export default { getQualityInspectionDet(id).then((response) => { this.form = response.data; this.open = true; - this.title = '修改质量检测信息基础'; + this.title = '修改质量检测信息'; }); }, /** 提交按钮 */ @@ -336,3 +360,9 @@ export default { }, }; + + diff --git a/src/views/quality/components/dialogForm.vue b/src/views/quality/components/dialogForm.vue new file mode 100644 index 00000000..aac1d33d --- /dev/null +++ b/src/views/quality/components/dialogForm.vue @@ -0,0 +1,137 @@ + + + + + + + diff --git a/src/views/quality/mixin/basicPageMixin.js b/src/views/quality/mixin/basicPageMixin.js new file mode 100644 index 00000000..b4005a91 --- /dev/null +++ b/src/views/quality/mixin/basicPageMixin.js @@ -0,0 +1,87 @@ +export default { + data() { + return { + // 遮罩层 + loading: true, + // 导出遮罩层 + exportLoading: false, + // 显示搜索条件 + showSearch: true, + // 总条数 + total: 0, + // 质量检测信息基础列表 + list: [], + // 弹出层标题 + title: '', + // 是否显示弹出层 + open: false, + // 查询参数 + queryParams: { + pageNo: 1, + pageSize: 10, + }, + + // 列表数据 + tableData: [], + tableProps: [], // 占位 + tableBtn: [], // 占位 + searchBarFormConfig: [], // 占位 + // 弹窗表单配置 + dialogFormConfig: [], // 占位 + }; + }, + mounted() { + if (this.prepareSelectOptions) { + // 准备列表的options + // TODO: 也许需要挪到 dialogForm.vue 里 + this.prepareSelectOptions(); + } + }, + methods: { + // 处理搜索条件 + 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 + switch (btn.btnName) { + case 'search': + keys.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() {}, + }, +};