Junjie
3 天以前 ce958810cabd72b5ee6bc4b9433633b0230bcfdd
src/main/webapp/static/js/basDevp/basDevp.js
@@ -2268,6 +2268,8 @@
                    tableResizeHandler: null,
                    dialogForm: createFormDefaults(),
                    dialogDisplay: createDisplayDefaults(),
                    stationEditorFields: ['stationList', 'barcodeStationList', 'inStationList', 'outStationList', 'runBlockReassignLocStationList', 'isOutOrderList', 'isLiftTransferList'],
                    jsonEditorRows: {},
                    dialogRules: createFormRules()
                };
            },
@@ -2501,6 +2503,7 @@
                resetDialogState: function () {
                    this.dialogForm = createFormDefaults();
                    this.dialogDisplay = createDisplayDefaults();
                    this.jsonEditorRows = {};
                    if (this.$refs.dialogForm) {
                        this.$refs.dialogForm.clearValidate();
                    }
@@ -2517,6 +2520,7 @@
                    self.$nextTick(function () {
                        self.resetDialogState();
                        fillFormFromRow(row, self.dialogForm, self.dialogDisplay);
                        self.initJsonEditorRows();
                        if (self.$refs.dialogForm) {
                            self.$refs.dialogForm.clearValidate();
                        }
@@ -2525,6 +2529,12 @@
                submitDialog: function () {
                    var self = this;
                    if (!self.$refs.dialogForm) {
                        return;
                    }
                    self.syncAllJsonEditors();
                    var jsonError = self.validateAllJsonEditors();
                    if (jsonError) {
                        self.$message.warning(jsonError);
                        return;
                    }
                    self.$refs.dialogForm.validate(function (valid) {
@@ -2558,6 +2568,62 @@
                        return true;
                    });
                },
                initJsonEditorRows: function () {
                    var self = this;
                    var editors = window.WcsJsonEditors;
                    self.stationEditorFields.forEach(function (field) {
                        self.$set(self.jsonEditorRows, field, editors.parseStationList(self.dialogForm[field]));
                    });
                },
                syncAllJsonEditors: function () {
                    var self = this;
                    var editors = window.WcsJsonEditors;
                    self.stationEditorFields.forEach(function (field) {
                        self.$set(self.dialogForm, field, editors.buildStationListJson(self.jsonEditorRows[field]));
                    });
                },
                validateAllJsonEditors: function () {
                    var self = this;
                    var editors = window.WcsJsonEditors;
                    var error = '';
                    self.stationEditorFields.forEach(function (field) {
                        if (error) return;
                        error = editors.validateStationList(self.jsonEditorRows[field]);
                    });
                    return error;
                },
                addStationRow: function (field) {
                    if (!this.jsonEditorRows[field]) {
                        this.$set(this.jsonEditorRows, field, []);
                    }
                    this.jsonEditorRows[field].push(window.WcsJsonEditors.createEmptyStation());
                    this.syncAllJsonEditors();
                },
                removeStationRow: function (field, index) {
                    this.jsonEditorRows[field].splice(index, 1);
                    this.syncAllJsonEditors();
                },
                toggleNested: function (field, rowIndex, nestedKey) {
                    var row = this.jsonEditorRows[field][rowIndex];
                    var showKey = '_show' + nestedKey.charAt(0).toUpperCase() + nestedKey.slice(1);
                    this.$set(row, showKey, !row[showKey]);
                },
                addNestedStation: function (field, rowIndex, nestedKey) {
                    var row = this.jsonEditorRows[field][rowIndex];
                    var nested = {};
                    window.WcsJsonEditors.STATION_OBJ_FIELDS.forEach(function (k) { nested[k] = ''; });
                    this.$set(row, nestedKey, nested);
                    var showKey = '_show' + nestedKey.charAt(0).toUpperCase() + nestedKey.slice(1);
                    this.$set(row, showKey, true);
                    this.syncAllJsonEditors();
                },
                removeNestedStation: function (field, rowIndex, nestedKey) {
                    this.$set(this.jsonEditorRows[field][rowIndex], nestedKey, null);
                    this.syncAllJsonEditors();
                },
                syncStationField: function (field) {
                    this.$set(this.dialogForm, field, window.WcsJsonEditors.buildStationListJson(this.jsonEditorRows[field]));
                },
                removeSelection: function () {
                    var self = this;
                    var ids = self.selection.map(function (row) {