-
组件id:{{ $route.query.id }}
import localStore from 'storejs';
import iscsCanvas from './iscsCanvas';
-import BuilderFactory from '@/iscs_new/core/form/builderFactory';
+import formBuilder from '@/iscs_new/core/form/formBuilder';
import DataForm from '../components/dataForm';
import TableForm from '../components/tableForm';
import orders from '@/iscs_new/utils/orders';
import * as utils from '@/iscs_new/utils/utils';
-import idb from '../utils/indexedDb.js';
+import Idb from '../utils/indexedDb.js';
import shapeType from '@/iscs_new/constant/shapeType.js';
export default {
@@ -111,9 +110,9 @@ export default {
(temp, el) => el && temp ? temp.union(el.getBoundingRect().clone()) : el.getBoundingRect(), null);
const position = rect ? [(rect.x + rect.width) / 2, (rect.y + rect.height) / 2] : [0, 0];
const model = { id, name, type, shapeList, position };
- idb.delete('composeList', model.id);
- idb.write('composeList', model);
- idb.list('composeList').then(list => {
+ Idb.delete('composeList', model.id);
+ Idb.write('composeList', model);
+ Idb.list('composeList').then(list => {
console.log(list);
});
}
@@ -141,12 +140,12 @@ export default {
this.$refs['dataform' + this.enabledTab][0].$refs['form'].validate((valid) => {
if (valid) {
const formModel = this.$refs['dataform' + this.enabledTab][0].formModel;
- const newModel = JSON.parse(JSON.stringify(formModel));
+ const newModel = utils.deepClone(formModel);
newModel.code = utils.getUID(this.enabledTab);
newModel.type = this.enabledTab;
- // newModel.name = '<名称>';
+ newModel.name = '<名称>';
newModel.stateList = [];
- this.$refs.iscsCanvas.doAction([{model: newModel, action: {shapeType: shapeType.Element, order: orders.ADD}}]);
+ this.$refs.iscsCanvas.doAction([{model: newModel, action: {shapeType: shapeType.Element, order: orders.Add}}]);
this.clear(this.enabledTab);
this.getComposeElemList();
}
@@ -155,11 +154,11 @@ export default {
onModify() {
this.$refs['dataform' + this.enabledTab][0].$refs['form'].validate((valid) => {
if (valid) {
- const model = this.$refs['dataform' + this.enabledTab][0].formModel;
+ const model = utils.deepClone(this.$refs['dataform' + this.enabledTab][0].formModel);
model.code = this.selected.code;
model.type = this.selected.type;
model.name = this.selected.name;
- this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.UPDATE}}]);
+ this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.Update}}]);
this.clear(this.enabledTab);
}
});
@@ -167,11 +166,11 @@ export default {
onDelete() {
this.$refs['dataform' + this.enabledTab][0].$refs['form'].validate((valid) => {
if (valid) {
- const model = this.$refs['dataform' + this.enabledTab][0].formModel;
+ const model = utils.deepClone(this.$refs['dataform' + this.enabledTab][0].formModel);
model.code = this.selected.code;
model.type = this.selected.type;
model.name = this.selected.name;
- this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.DELETE}}]);
+ this.$refs.iscsCanvas.doAction([{model, action: {shapeType: shapeType.Element, order: orders.Delete}}]);
this.clear(this.enabledTab);
this.getComposeElemList();
}
diff --git a/src/views/iscs_new/iscsDraw/iscsCanvas.vue b/src/views/iscs_new/iscsDraw/iscsCanvas.vue
index c93860ef4..5ee9582aa 100644
--- a/src/views/iscs_new/iscsDraw/iscsCanvas.vue
+++ b/src/views/iscs_new/iscsDraw/iscsCanvas.vue
@@ -7,7 +7,10 @@