diff --git a/src/application/mk/components/editors/MkFormDataSelector.vue b/src/application/mk/components/editors/MkFormDataSelector.vue index 86acbb3..7805247 100644 --- a/src/application/mk/components/editors/MkFormDataSelector.vue +++ b/src/application/mk/components/editors/MkFormDataSelector.vue @@ -4,7 +4,7 @@ @@ -51,14 +49,14 @@ export default { props: { // 组件属性 readonly: Boolean, params: Object, - value: [Array, String,Object] + value: [Array, String, Object] }, data() { return { actions: { // api地址 getList: `${BASE_URL}/api/web/listdata` // 获取列表数据 }, - actionParams:null, + actionParams: null, buttons: [], modalVisible: false, // 弹出框显示 lastKey: '', // 上次输入的值 @@ -79,7 +77,7 @@ export default { { field: 'name', title: '名称' }, // 字段名称,字段标题 { field: 'code', title: '编码' } // 字段名称,字段标题 ], - treeConfig:null, + treeConfig: null, modalWidth: 800, // 弹出框宽度 modalHeight: 600, // 弹出框高度 searchFieldNames: ['name'], // 搜索字段 @@ -98,9 +96,9 @@ export default { if (params.autoFocus) { this.$nextTick(() => { - setTimeout(()=>{ - this.$refs.inputx.focus(); - },100) + setTimeout(() => { + this.$refs.inputx.focus(); + }, 100) }); } @@ -160,10 +158,10 @@ export default { if (params.columns) { // 如果列存在 this.tableColumn = params.columns; // 表格列 } - if(params.treeConfig){ + if (params.treeConfig) { this.treeConfig = params.treeConfig; } - + if (params.popup) { // 如果弹出框存在 this.enalbedPopup = true; // 是否启用弹出框 this.popupPage = params.popup.page; // 弹出框页面 @@ -172,7 +170,7 @@ export default { if (params.dataUrl) { this.actions.getList = params.dataUrl; } - if(params.actionParams){ + if (params.actionParams) { this.actionParams = params.actionParams; } } @@ -193,31 +191,30 @@ export default { } else { this.textboxValue = ""; } - + let f = params.listdataFieldName || "Records"; this.getData().then(data => { - if('Total' in data){ - this.tablePage.total = data.Total ; - }else{ - this.tablePage.total = data.total ; + if ('Total' in data) { + this.tablePage.total = data.Total; + } else { + this.tablePage.total = data.total; } - + this.tableData = data[f]; }); }, - getData(key) { // 获取数据 + getData(key) { // 获取数据 + var params = Object.assign({}, this.params.actionParams || {}) // 定义请求参数 - var params = Object.assign({},this.actionParams ||{}) // 定义请求参数 - params.page = this.tablePage.currentPage; // 当前页码 params.limit = this.tablePage.pageSize; // 每页条数 - params.order_bys = []; // 排序信息 - params.search_rules = []; // 搜索信息 - if(key){ + params.order_bys = params.order_bys || []; // 排序信息 + params.search_rules = params.search_rules || []; // 搜索信息 + if (key) { key = this.$mk.trim(key); } if (key) { @@ -230,10 +227,10 @@ export default { }); } } - + return this.$mk.getPagedData({ url: this.actions.getList, - useBigInt:true, + useBigInt: true, data: params }); }, @@ -246,9 +243,9 @@ export default { handleScanInput(event) { const { params } = this - const input = event.target; - const inputValue = input.value; - this.scanEntry = input.value; + const input = event.target; + const inputValue = input.value; + this.scanEntry = input.value; if (event.key === 'Enter') { @@ -259,19 +256,19 @@ export default { this.scanEntry = ''; }, 10); - if(params.scan){ + if (params.scan) { console.log(inputValue) - params.scan({value:inputValue,input:input}) + params.scan({ value: inputValue, input: input }) } - + } }, keydownEvent(e) { - + const { params } = this - if(params.scan){ + if (params.scan) { this.handleScanInput(e.$event); } }, @@ -334,19 +331,41 @@ export default { } this.loading = true // 加载 let f = params.listdataFieldName || "Records"; - this.getData(cellValue).then(data => { + this.getData(cellValue).then(data => { this.loading = false - if('Total' in data){ - this.tablePage.total = data.Total ; - }else{ - this.tablePage.total = data.total ; + if ('Total' in data) { + this.tablePage.total = data.Total; + } else { + this.tablePage.total = data.total; } this.tableData = data[f]; }) }, + onFocus(){ + const { params } = this + console.log(params) + if (params.focusToLoad) { + const cellValue = this.textboxValue; + let f = params.listdataFieldName || "Records"; + this.loading = true + this.getData(cellValue).then(data => { + + this.loading = false + if ('Total' in data) { + this.tablePage.total = data.Total; + } else { + this.tablePage.total = data.total; + } + this.tableData = data[f]; + }) + } + + }, suffixClick() { // 后缀点击事件 - this.$refs.xDown.togglePanel() + this.$refs.xDown.togglePanel(); + + }, pageChangeEvent({ currentPage, pageSize }) { // 分页改变事件 this.tablePage.currentPage = currentPage @@ -355,12 +374,12 @@ export default { const { params } = this let f = params.listdataFieldName || "Records"; this.getData(this.lastKey).then(data => { - + this.loading = false - if('Total' in data){ - this.tablePage.total = data.Total ; - }else{ - this.tablePage.total = data.total ; + if ('Total' in data) { + this.tablePage.total = data.Total; + } else { + this.tablePage.total = data.total; } this.tableData = data[f]; }) @@ -375,16 +394,16 @@ export default { else if (params.dataType == "object") { this.$emit('input', e.row); } - + else if (params.dataType == 'mapper') { - if(params.showField){ + if (params.showField) { this.$emit('input', e.row[params.showField]); } } else { this.$emit('input', [e.row.ID, e.row[textField]]); } - + if (params.onDataChanged) { params.onDataChanged({ value: [e.row.ID, e.row[textField]], data: e.row }) @@ -409,7 +428,7 @@ export default { this.$emit('input', selectedRow); } else if (params.dataType == 'mapper') { - if(params.showField){ + if (params.showField) { this.$emit('input', selectedRow[params.showField]); } } diff --git a/src/application/mk/index.js b/src/application/mk/index.js index a896ce0..39c0a15 100644 --- a/src/application/mk/index.js +++ b/src/application/mk/index.js @@ -104,8 +104,8 @@ VXETable.formats.mixin({ return '未审'; }, formatDateTime({ cellValue }) { // 日期时间格式化 - - if(!cellValue){ + + if (!cellValue) { return ''; } if (typeof (cellValue) == "number") { @@ -114,7 +114,7 @@ VXETable.formats.mixin({ return XEUtils.toDateString(cellValue, 'yyyy-MM-dd HH:mm:ss') }, formatDate({ cellValue }) { // 日期格式化 - if(!cellValue){ + if (!cellValue) { return ''; } if (typeof (cellValue) == "number") { @@ -133,10 +133,14 @@ VXETable.formats.mixin({ }, formatEnum({ cellValue, column }) { // 格式化状态 if (cellValue == null) return ''; - if (!column.params) return ''; - for (let i = 0; i < column.params.length; i++) { - if (column.params[i].value == cellValue) { - return '' + column.params[i].label + ''; + let params = column.params; + if (params && params.data) { + params = params.data; + } + if (!params) return ''; + for (let i = 0; i < params.length; i++) { + if (params[i].value == cellValue) { + return '' + params[i].label + ''; } } return ''; @@ -154,8 +158,8 @@ VXETable.renderer.add('enum', { let cellValue = row[column.field]; for (let i = 0; column.params && i < column.params.data.length; i++) { if (column.params.data[i].value == cellValue) { - let cls = column.params.cls + ' ' + column.params.cls +'_'+column.params.data[i].value; - return {column.params.data[i].label}; + let cls = column.params.cls + ' ' + column.params.cls + '_' + column.params.data[i].value; + return {column.params.data[i].label}; } } return ; diff --git a/src/pages/Middle/Mold/MoldOrder/selector.vue b/src/pages/Middle/Mold/MoldOrder/selector.vue new file mode 100644 index 0000000..5aa523f --- /dev/null +++ b/src/pages/Middle/Mold/MoldOrder/selector.vue @@ -0,0 +1,316 @@ + + + + \ No newline at end of file diff --git a/src/pages/Middle/Mold/MoldProductionOrder/Edit.vue b/src/pages/Middle/Mold/MoldProductionOrder/Edit.vue index 180efe2..22f5270 100644 --- a/src/pages/Middle/Mold/MoldProductionOrder/Edit.vue +++ b/src/pages/Middle/Mold/MoldProductionOrder/Edit.vue @@ -1,6 +1,28 @@ -