diff --git a/src/main.js b/src/main.js index 3a5bb299..6f99ce9b 100644 --- a/src/main.js +++ b/src/main.js @@ -82,7 +82,7 @@ import Tinymce from '@/components/tinymce/index.vue'; Vue.component('tinymce', Tinymce); import '@/assets/icons'; import request from '@/utils/request'; // 实现 form generator 使用自己定义的 axios request 对象 -console.log(request); +// console.log(request); Vue.prototype.$axios = request; import '@/styles/index.scss'; diff --git a/src/views/quality/base/qualityInspectionBoxBtn/index.vue b/src/views/quality/base/qualityInspectionBoxBtn/index.vue index 741ec1c2..8c777b7c 100644 --- a/src/views/quality/base/qualityInspectionBoxBtn/index.vue +++ b/src/views/quality/base/qualityInspectionBoxBtn/index.vue @@ -1,227 +1,343 @@ diff --git a/src/views/quality/base/qualityInspectionDet/index.vue b/src/views/quality/base/qualityInspectionDet/index.vue index b1fec0ea..939568c5 100644 --- a/src/views/quality/base/qualityInspectionDet/index.vue +++ b/src/views/quality/base/qualityInspectionDet/index.vue @@ -17,6 +17,7 @@ v-if="tableBtn.length" slot="handleBtn" label="操作" + fixed="right" :method-list="tableBtn" @clickBtn="handleTableBtnClick" /> @@ -49,9 +50,9 @@ prop: 'typeId', url: '/base/quality-inspection-type/listAll', rules: [{ required: true, message: '不能为空', trigger: 'blur' }], - // bind: { - // disabled: true, // some condition, like detail mode... - // } + bind: { + filterable: true, + }, }, ], [ @@ -62,36 +63,17 @@ rules: [{ required: true, message: '不能为空', trigger: 'blur' }], }, ], - [{ input: true, label: '检测编码', prop: 'code' }], + [ + { + input: true, + label: '内容编码', + prop: 'code', + url: '/base/quality-inspection-det/getCode', + }, + ], [{ input: true, label: '备注', prop: 'remark' }], ]" /> - @@ -106,11 +88,12 @@ import { } from '@/api/base/qualityInspectionDet'; import moment from 'moment'; -import DialogForm from '../../components/dialogForm.vue'; + +import basicPageMixin from '../../mixin/basicPageMixin'; export default { name: 'QualityInspectionDet', - components: { DialogForm }, + mixins: [basicPageMixin], data() { return { typeList: [], // 检测类型列表 @@ -121,20 +104,20 @@ export default { placeholder: '请输入检测内容', param: 'content', }, - { - type: 'datePicker', - label: '创建时间', - dateType: 'daterange', // datetimerange - // format: 'yyyy-MM-dd HH:mm:ss', - format: 'yyyy-MM-dd', - valueFormat: 'yyyy-MM-dd HH:mm:ss', - rangeSeparator: '-', - startPlaceholder: '开始日期', - endPlaceholder: '结束日期', - defaultTime: ['00:00:00', '23:59:59'], - param: 'createTime', - width: 350, - }, + // { + // type: 'datePicker', + // label: '创建时间', + // dateType: 'daterange', // datetimerange + // // format: 'yyyy-MM-dd HH:mm:ss', + // format: 'yyyy-MM-dd', + // valueFormat: 'yyyy-MM-dd HH:mm:ss', + // rangeSeparator: '-', + // startPlaceholder: '开始日期', + // endPlaceholder: '结束日期', + // defaultTime: ['00:00:00', '23:59:59'], + // param: 'createTime', + // width: 350, + // }, { type: 'button', btnName: '查询', @@ -181,7 +164,6 @@ export default { } : undefined, ].filter((v) => v), - tableData: [], tableProps: [ { prop: 'createTime', @@ -190,25 +172,11 @@ export default { 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: 'typeName', label: '类型名称', align: 'center' }, + { prop: 'content', label: '检测内容', align: 'center' }, { prop: 'code', label: '检测编码', align: 'center' }, { prop: 'remark', label: '备注', align: 'center' }, ], - // 遮罩层 - loading: true, - // 导出遮罩层 - exportLoading: false, - // 显示搜索条件 - showSearch: true, - // 总条数 - total: 0, - // 质量检测信息基础列表 - list: [], - // 弹出层标题 - title: '', - // 是否显示弹出层 - open: false, // 查询参数 queryParams: { pageNo: 1, @@ -216,16 +184,14 @@ export default { content: null, createTime: [], }, - // 表单参数 - form: {}, - // 表单校验 - rules: { - typeId: [ - { required: true, message: '检测类型id不能为空', trigger: 'change' }, - ], - content: [ - { required: true, message: '检测内容不能为空', trigger: 'blur' }, - ], + // 搜索框需要的 keys, 与上面 queryParams 的除 pageNo, pageSize 之外的 key 一一对应 + searchBarKeys: ['content', 'createTime'], + form: { + id: undefined, + typeId: undefined, + content: undefined, + code: undefined, + remark: undefined, }, }; }, @@ -234,49 +200,6 @@ export default { this.getTypeList(); }, 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 = ['content', '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; - } - console.log('key', key, btn[key]) - this.queryParams[key] = btn[key] || null; - }); - console.log('queryParams', this.queryParams) - 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); - }, /** 获取检测类型id */ getTypeList() { this.$axios('/base/quality-inspection-type/listAll').then((response) => { @@ -298,11 +221,6 @@ export default { this.loading = false; }); }, - /** 取消按钮 */ - cancel() { - this.open = false; - this.reset(); - }, /** 表单重置 */ reset() { this.form = { @@ -314,16 +232,6 @@ export default { }; this.resetForm('form'); }, - /** 搜索按钮操作 */ - handleQuery() { - this.queryParams.pageNo = 1; - this.getList(); - }, - /** 重置按钮操作 */ - resetQuery() { - this.resetForm('queryForm'); - this.handleQuery(); - }, /** 新增按钮操作 */ handleAdd() { this.reset(); diff --git a/src/views/quality/base/qualityInspectionType/index.vue b/src/views/quality/base/qualityInspectionType/index.vue index ce6f2c23..9bafb076 100644 --- a/src/views/quality/base/qualityInspectionType/index.vue +++ b/src/views/quality/base/qualityInspectionType/index.vue @@ -52,7 +52,14 @@ // } }, ], - [{ input: true, label: '检测类型编码', prop: 'code' }], + [ + { + input: true, + label: '检测类型编码', + prop: 'code', + url: '/base/quality-inspection-type/getCode', + }, + ], [{ input: true, label: '备注', prop: 'remark' }], ]" /> @@ -61,7 +68,6 @@ - + diff --git a/src/views/quality/mixin/basicPageMixin.js b/src/views/quality/mixin/basicPageMixin.js index b4005a91..c65eab32 100644 --- a/src/views/quality/mixin/basicPageMixin.js +++ b/src/views/quality/mixin/basicPageMixin.js @@ -1,4 +1,7 @@ +import DialogForm from '../components/dialogForm.vue'; + export default { + components: { DialogForm }, data() { return { // 遮罩层 @@ -15,32 +18,24 @@ export default { title: '', // 是否显示弹出层 open: false, - // 查询参数 - queryParams: { - pageNo: 1, - pageSize: 10, - }, - // 列表数据 tableData: [], - tableProps: [], // 占位 - tableBtn: [], // 占位 - searchBarFormConfig: [], // 占位 - // 弹窗表单配置 - dialogFormConfig: [], // 占位 + // 弹窗的表单 + // form: {}, // 占位 + // 搜索框需要的 keys + // searchBarKeys: [], // 占位 + // tableProps: [], // 占位 + // tableBtn: [], // 占位 + // searchBarFormConfig: [], // 占位 + // // 弹窗表单配置 + // dialogFormConfig: [], // 占位 }; }, - mounted() { - if (this.prepareSelectOptions) { - // 准备列表的options - // TODO: 也许需要挪到 dialogForm.vue 里 - this.prepareSelectOptions(); - } - }, + mounted() {}, methods: { // 处理搜索条件 handleSearchBarBtnClick() {}, - // 处理表格按钮 + // 处理表格按钮 handleTableBtnClick({ data, type }) { switch (type) { case 'edit': @@ -53,10 +48,10 @@ export default { }, // 处理搜索栏按钮 handleSearchBarBtnClick(btn) { - const keys = ['name', 'createTime']; // timeVal + // const keys = ['name', 'createTime']; // timeVal // 已被 searchBarKeys 替代 switch (btn.btnName) { case 'search': - keys.forEach((key) => { + this.searchBarKeys.forEach((key) => { if (key == 'timeVal') { this.queryParams['startTime'] = btn.timeVal[0]; this.queryParams['endTime'] = btn.timeVal[1]; @@ -83,5 +78,20 @@ export default { }, // 获取列表数据 getList() {}, + /** 搜索按钮操作 */ + handleQuery() { + this.queryParams.pageNo = 1; + this.getList(); + }, + /** 重置按钮操作 */ + resetQuery() { + this.resetForm('queryForm'); + this.handleQuery(); + }, + /** 取消按钮 */ + cancel() { + this.open = false; + this.reset(); + }, }, };