|
@@ -352,25 +352,19 @@ export default {
|
|
return {
|
|
return {
|
|
ruleForm: {
|
|
ruleForm: {
|
|
//基本信息表单
|
|
//基本信息表单
|
|
- tdataName: "",
|
|
|
|
- eventID: "",
|
|
|
|
- datatype: "",
|
|
|
|
|
|
+ dataName: "",
|
|
|
|
+ dataType: "",
|
|
dataDescribe: "",
|
|
dataDescribe: "",
|
|
|
|
+ computingMethod:"",
|
|
|
|
+ validationExpression:""
|
|
},
|
|
},
|
|
rules: {
|
|
rules: {
|
|
//基本信息验证
|
|
//基本信息验证
|
|
- tdataName: [
|
|
|
|
|
|
+ dataName: [
|
|
{ required: true, message: "请输入目标数据名", trigger: "blur" },
|
|
{ required: true, message: "请输入目标数据名", trigger: "blur" },
|
|
],
|
|
],
|
|
- eventID: [
|
|
|
|
- {
|
|
|
|
- required: true,
|
|
|
|
- message: "请输入目标数据事件标识",
|
|
|
|
- trigger: "blur",
|
|
|
|
- },
|
|
|
|
- ],
|
|
|
|
- datatype: [
|
|
|
|
- { required: true, message: "请选择数据类型", trigger: "change" },
|
|
|
|
|
|
+ dataType: [
|
|
|
|
+ { required: true, message: "请选择数据格式", trigger: "change" },
|
|
],
|
|
],
|
|
},
|
|
},
|
|
posArr: [], //存储数据项数据
|
|
posArr: [], //存储数据项数据
|
|
@@ -463,7 +457,7 @@ export default {
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
|
|
- //保存
|
|
|
|
|
|
+ //保存主数据
|
|
async storagemod() {
|
|
async storagemod() {
|
|
this.ruleForm["operate"] = "2";
|
|
this.ruleForm["operate"] = "2";
|
|
try {
|
|
try {
|
|
@@ -480,6 +474,7 @@ export default {
|
|
console.log("错误", error);
|
|
console.log("错误", error);
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ //获取数据项列表
|
|
async getDataList() {
|
|
async getDataList() {
|
|
let params = {
|
|
let params = {
|
|
id: 16,
|
|
id: 16,
|
|
@@ -534,6 +529,7 @@ export default {
|
|
delete res.children
|
|
delete res.children
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
+ this.posArrCopy = JSON.parse(JSON.stringify(this.posArr));
|
|
} else {
|
|
} else {
|
|
this.$message.error(res.message ?? "失败");
|
|
this.$message.error(res.message ?? "失败");
|
|
}
|
|
}
|
|
@@ -543,12 +539,44 @@ export default {
|
|
let that = this;
|
|
let that = this;
|
|
that.storagedetails().then(function (data) {
|
|
that.storagedetails().then(function (data) {
|
|
if (val) {
|
|
if (val) {
|
|
- that.posArr = findarrays(that.posArr, "itemName", val);
|
|
|
|
|
|
+ that.posArr = rebuildData(val,that.posArr);
|
|
} else {
|
|
} else {
|
|
that.storagedetails();
|
|
that.storagedetails();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ //根据name字段模糊匹配树状结构数据,最后将处理好的数据返回出来
|
|
|
|
+ rebuildData (value, arr){
|
|
|
|
+ if (!arr) {
|
|
|
|
+ return []
|
|
|
|
+ }
|
|
|
|
+ const newarr = [];
|
|
|
|
+ arr.forEach(element => {
|
|
|
|
+ // indexOf用来判读当前节点name字段是否包含所搜索的字符串value
|
|
|
|
+ // 返回值:包含则返回索引值,反之返回-1
|
|
|
|
+ if (element.ItemName.indexOf(value) > -1) {
|
|
|
|
+ const ab = this.rebuildData(value, element.children);
|
|
|
|
+ const obj = {
|
|
|
|
+ ...element,
|
|
|
|
+ children: ab
|
|
|
|
+ }
|
|
|
|
+ newarr.push(obj);
|
|
|
|
+ } else {
|
|
|
|
+ // 判断当前节点知否有子节点,并且子节点中有数据,有数据继续递归查找
|
|
|
|
+ if (element.children && element.children.length > 0) {
|
|
|
|
+ const ab = this.rebuildData(value, element.children);
|
|
|
|
+ const obj = {
|
|
|
|
+ ...element,
|
|
|
|
+ children: ab
|
|
|
|
+ };
|
|
|
|
+ if (ab && ab.length > 0) {
|
|
|
|
+ newarr.push(obj);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ return newarr
|
|
|
|
+ },
|
|
//清空搜索
|
|
//清空搜索
|
|
clearSearchData() {
|
|
clearSearchData() {
|
|
this.posArr = this.posArrCopy;
|
|
this.posArr = this.posArrCopy;
|
|
@@ -585,12 +613,14 @@ export default {
|
|
this.msgType = 1;
|
|
this.msgType = 1;
|
|
this.addFlag = true;
|
|
this.addFlag = true;
|
|
},
|
|
},
|
|
|
|
+ //点击列表新增按钮
|
|
handleAdd(index,row){
|
|
handleAdd(index,row){
|
|
this.msgType = 1;
|
|
this.msgType = 1;
|
|
this.addFlag = true;
|
|
this.addFlag = true;
|
|
this.dataForm.parentID = row.ItemID;
|
|
this.dataForm.parentID = row.ItemID;
|
|
this.dataForm.parentIDs = [row.ItemID];
|
|
this.dataForm.parentIDs = [row.ItemID];
|
|
},
|
|
},
|
|
|
|
+ //点击列表编辑按钮
|
|
handleEdit(index,row){
|
|
handleEdit(index,row){
|
|
this.msgType = 2;
|
|
this.msgType = 2;
|
|
this.addFlag = true;
|
|
this.addFlag = true;
|
|
@@ -621,6 +651,7 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ //数据项保存
|
|
async saveData(){
|
|
async saveData(){
|
|
try {
|
|
try {
|
|
const res = await GeneralDataReception({
|
|
const res = await GeneralDataReception({
|
|
@@ -639,7 +670,7 @@ export default {
|
|
}
|
|
}
|
|
|
|
|
|
},
|
|
},
|
|
- //存储数据项-取消
|
|
|
|
|
|
+ //数据项-取消
|
|
resetForm(formName) {
|
|
resetForm(formName) {
|
|
this.addFlag = false;
|
|
this.addFlag = false;
|
|
this.dataForm = {};
|
|
this.dataForm = {};
|