diff --git a/src/views/quality/base/qualityInspectionDet/index.vue b/src/views/quality/base/qualityInspectionDet/index.vue index d6aa3a15..6ec4534b 100644 --- a/src/views/quality/base/qualityInspectionDet/index.vue +++ b/src/views/quality/base/qualityInspectionDet/index.vue @@ -1,109 +1,26 @@ @@ -158,6 +71,82 @@ export default { components: {}, data() { return { + searchBarFormConfig: [ + { + type: 'input', + label: '检测内容', + placeholder: '请输入检测内容', + param: 'content', + }, + { + type: 'datePicker', + label: '创建时间', + dateType: 'daterange', // datetimerange + format: 'yyyy-MM-dd HH:mm:ss', + valueFormat: 'yyyy-MM-ddTHH:mm:ss', + rangeSeparator: '-', + startPlaceholder: '开始日期', + endPlaceholder: '结束日期', + defaultTime: ['00:00:00', '23:59:59'], + param: 'createTime', + width: 350, + }, + { + type: 'button', + btnName: '查询', + name: 'search', + color: 'primary', + }, + // { + // type: 'button', + // btnName: '重置', + // name: 'reset', + // }, + { + type: 'separate', + }, + { + type: this.$auth.hasPermi('base:quality-inspection-det:create') + ? 'button' + : '', + btnName: '新增', + name: 'add', + plain: true, + color: 'success', + }, + // { + // type: this.$auth.hasPermi('base:quality-inspection-type:export') + // ? 'button' + // : '', + // btnName: '导出', + // name: 'export', + // color: 'warning', + // }, + ], + 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), + tableData: [], + tableProps: [ + { + prop: 'createTime', + label: '添加时间', + fixed: true, + width: 180, + filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'), + }, + { prop: 'typeId', label: '检测类型ID', align: 'center' }, + { prop: 'content', label: '检测类型内容', align: 'center' }, + { prop: 'code', label: '检测编码', align: 'center' }, + { prop: 'remark', label: '备注', align: 'center' }, + ], // 遮罩层 loading: true, // 导出遮罩层 @@ -196,6 +185,47 @@ export default { this.getList(); }, methods: { + /** base table related */ + handleTableBtnClick({ data, type }) { + switch (type) { + case 'edit': + this.handleUpdate(data); + break; + case 'delete': + this.handleDelete(data); + break; + } + }, + /** search bar related */ + 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() { this.loading = true; diff --git a/src/views/quality/base/qualityInspectionType/index.vue b/src/views/quality/base/qualityInspectionType/index.vue index 164a9c72..18eefe7d 100644 --- a/src/views/quality/base/qualityInspectionType/index.vue +++ b/src/views/quality/base/qualityInspectionType/index.vue @@ -69,15 +69,15 @@ export default { data() { return { tableBtn: [ - { + this.$auth.hasPermi('base:quality-inspection-type:update') ? { type: 'edit', btnName: '修改', - }, - { + } : undefined, + this.$auth.hasPermi('base:quality-inspection-type:delete') ? { type: 'delete', btnName: '删除', - }, - ], + } : undefined, + ].filter(v=>v), tableData: [], tableProps: [ {