| | |
| | | }, |
| | | wrkSts: { |
| | | label: '工作状态', |
| | | kind: 'foreign', |
| | | kind: 'enum', |
| | | tableProp: 'wrkSts$', |
| | | exportField: 'wrkSts$', |
| | | foreignQuery: 'basWrkStatus', |
| | | enumOptions: [], |
| | | searchable: true, |
| | | quickSearch: true, |
| | | minWidth: 160 |
| | | }, |
| | | ioType: { |
| | | label: '入出库类型', |
| | | kind: 'foreign', |
| | | kind: 'enum', |
| | | tableProp: 'ioType$', |
| | | exportField: 'ioType$', |
| | | foreignQuery: 'basWrkIotype', |
| | | enumOptions: [], |
| | | searchable: true, |
| | | quickSearch: true, |
| | | minWidth: 160 |
| | |
| | | minWidth: 90 |
| | | }, |
| | | sourceStaNo: { |
| | | label: '源站' |
| | | label: '源站', |
| | | kind: 'enum', |
| | | enumOptions: [], |
| | | searchable: true, |
| | | minWidth: 120 |
| | | }, |
| | | staNo: { |
| | | label: '目标站' |
| | | label: '目标站', |
| | | kind: 'enum', |
| | | enumOptions: [], |
| | | searchable: true, |
| | | minWidth: 120 |
| | | }, |
| | | sourceLocNo: { |
| | | label: '源库位', |
| | |
| | | }, |
| | | barcode: { |
| | | label: '条码', |
| | | searchable: true, |
| | | minWidth: 140 |
| | | }, |
| | | modiUser: { |
| | |
| | | }; |
| | | } |
| | | |
| | | function getFieldByName(fieldName) { |
| | | for (var i = 0; i < fieldMeta.length; i += 1) { |
| | | if (fieldMeta[i] && fieldMeta[i].field === fieldName) { |
| | | return fieldMeta[i]; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | function buildEnumOptions(records, valueField, labelField) { |
| | | var options = []; |
| | | var seen = {}; |
| | | (records || []).forEach(function (item) { |
| | | if (!item) { |
| | | return; |
| | | } |
| | | var rawValue = item[valueField]; |
| | | if (isEmptyValue(rawValue)) { |
| | | return; |
| | | } |
| | | var key = String(rawValue); |
| | | if (seen[key]) { |
| | | return; |
| | | } |
| | | seen[key] = true; |
| | | options.push({ |
| | | rawValue: key, |
| | | label: isEmptyValue(item[labelField]) ? key : String(item[labelField]) |
| | | }); |
| | | }); |
| | | return options; |
| | | } |
| | | |
| | | function handleForbidden(res) { |
| | | if (res && res.code === 403) { |
| | | top.location.href = baseUrl + '/'; |
| | |
| | | } |
| | | }, |
| | | created: function () { |
| | | this.loadSearchEnumOptions(); |
| | | this.loadTable(); |
| | | }, |
| | | mounted: function () { |
| | |
| | | } |
| | | this.$set(this.searchForm, field.field, ''); |
| | | }, |
| | | loadSearchEnumOptions: function () { |
| | | var self = this; |
| | | [ |
| | | { |
| | | field: 'wrkSts', |
| | | url: baseUrl + '/basWrkStatus/list/auth', |
| | | valueField: 'wrkSts', |
| | | labelField: 'wrkDesc', |
| | | limit: 200 |
| | | }, |
| | | { |
| | | field: 'ioType', |
| | | url: baseUrl + '/basWrkIotype/list/auth', |
| | | valueField: 'ioType', |
| | | labelField: 'ioDesc', |
| | | limit: 200 |
| | | }, |
| | | { |
| | | field: 'staNo', |
| | | url: baseUrl + '/basStation/list/auth', |
| | | valueField: 'stationId', |
| | | labelField: 'stationId', |
| | | limit: 500 |
| | | }, |
| | | { |
| | | field: 'sourceStaNo', |
| | | url: baseUrl + '/basStation/list/auth', |
| | | valueField: 'stationId', |
| | | labelField: 'stationId', |
| | | limit: 500 |
| | | } |
| | | ].forEach(function (config) { |
| | | $.ajax({ |
| | | url: config.url, |
| | | method: 'GET', |
| | | headers: self.authHeaders(), |
| | | data: { |
| | | curr: 1, |
| | | limit: config.limit |
| | | }, |
| | | success: function (res) { |
| | | if (self.handleForbidden(res)) { |
| | | return; |
| | | } |
| | | if (!res || res.code !== 200) { |
| | | return; |
| | | } |
| | | var payload = res.data || {}; |
| | | var field = getFieldByName(config.field); |
| | | if (!field) { |
| | | return; |
| | | } |
| | | self.$set(field, 'enumOptions', buildEnumOptions(payload.records, config.valueField, config.labelField)); |
| | | } |
| | | }); |
| | | }); |
| | | }, |
| | | buildQueryParams: function () { |
| | | var self = this; |
| | | var params = { |