|
@@ -51,7 +51,7 @@
|
|
|
:data="treedata"
|
|
|
ref="tree"
|
|
|
show-checkbox
|
|
|
- node-key="id"
|
|
|
+ node-key="bsm"
|
|
|
:props="defaultProps"
|
|
|
:default-expanded-keys="xz"
|
|
|
>
|
|
@@ -92,7 +92,7 @@ export default {
|
|
|
],
|
|
|
defaultProps: {
|
|
|
children: "children",
|
|
|
- label: "label",
|
|
|
+ label: "ysmc",
|
|
|
},
|
|
|
ruleForm: {
|
|
|
xmmc: "",
|
|
@@ -110,7 +110,12 @@ export default {
|
|
|
xzmj: [{ required: true, message: "请填写范围的数据" }],
|
|
|
xmmc: [
|
|
|
{ required: true, message: "请输入项目名称", trigger: "blur" },
|
|
|
- { min: 3, max: 50, message: "长度在 3 到 50 个字符", trigger: "blur" },
|
|
|
+ {
|
|
|
+ min: 3,
|
|
|
+ max: 50,
|
|
|
+ message: "长度在 3 到 50 个字符",
|
|
|
+ trigger: "blur",
|
|
|
+ },
|
|
|
],
|
|
|
jsdw: [{ required: true, message: "请输入建设单位", trigger: "blur" }],
|
|
|
xmlx: [{ required: true, message: "请输入项目类型", trigger: "blur" }],
|
|
@@ -120,63 +125,36 @@ export default {
|
|
|
};
|
|
|
},
|
|
|
mounted() {
|
|
|
- this.getTreeData(); //getKzx();
|
|
|
+ this.getKzx();
|
|
|
},
|
|
|
methods: {
|
|
|
//获取检查要素
|
|
|
getKzx() {
|
|
|
GetScx().then((res) => {
|
|
|
if (res) {
|
|
|
- let GetAll = res.data;
|
|
|
- for (var t in GetAll) {
|
|
|
- const getall = GetAll[t];
|
|
|
- if (getall.kzxjb == 1) {
|
|
|
- this.treedata[0].children.push({
|
|
|
- id: getall.bsm,
|
|
|
- label: getall.ysmc,
|
|
|
- });
|
|
|
- this.xz.push(getall.bsm);
|
|
|
- } else if (getall.kzxjb == 2) {
|
|
|
- this.treedata[1].children.push({
|
|
|
- id: getall.bsm,
|
|
|
- label: getall.ysmc,
|
|
|
- });
|
|
|
- this.xz.push(getall.bsm);
|
|
|
- } else {
|
|
|
- let bool = false;
|
|
|
- for (let i = 0; i < this.treedata.length; i++) {
|
|
|
- if (this.treedata[i].id == getall.kzxjb) {
|
|
|
- bool = true;
|
|
|
- this.treedata[i].children.push({
|
|
|
- id: getall.bsm,
|
|
|
- label: getall.ysmc,
|
|
|
- });
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!bool) {
|
|
|
- this.treedata.push({
|
|
|
- id: getall.kzxjb,
|
|
|
- label: getall.tjzd,
|
|
|
- children: [
|
|
|
- {
|
|
|
- id: getall.bsm,
|
|
|
- label: getall.ysmc,
|
|
|
- },
|
|
|
- ],
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ this.treedata = this.tranListToTreeData(res.data, "0");
|
|
|
+ res.data.forEach((item) => {
|
|
|
+ if (item.kzxjb == 1) this.xz.push(item.bsm);
|
|
|
+ });
|
|
|
setTimeout(() => {
|
|
|
this.$refs.tree.setCheckedKeys(this.xz);
|
|
|
}, 1);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- //获取检查要素
|
|
|
- getTreeData() {
|
|
|
- this.treedata = hgxfx.treeData;
|
|
|
+ tranListToTreeData(list, pbsm) {
|
|
|
+ var map = {};
|
|
|
+ list.forEach((item) => {
|
|
|
+ if (map[item.pbsm]) map[item.pbsm].push(item);
|
|
|
+ else map[item.pbsm] = [item];
|
|
|
+ });
|
|
|
+ list.forEach((item) => {
|
|
|
+ if (map[item.pbsm]) item.children = map[item.bsm];
|
|
|
+ });
|
|
|
+ map = list.filter((item) => {
|
|
|
+ return item.pbsm == pbsm;
|
|
|
+ });
|
|
|
+ return map;
|
|
|
},
|
|
|
updateScx() {
|
|
|
UpdateScx().then((res) => {
|
|
@@ -201,7 +179,7 @@ export default {
|
|
|
xzdw: "",
|
|
|
ydxz_bsm: "",
|
|
|
yjydlx: "",
|
|
|
- scxs: [],
|
|
|
+ scxList: [],
|
|
|
|
|
|
fwlx: 1,
|
|
|
xzfw: "",
|
|
@@ -217,7 +195,7 @@ export default {
|
|
|
this.$refs.ruleForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
this.getCheckedNodes();
|
|
|
- if (this.ruleForm.scxs.length == 0) {
|
|
|
+ if (this.ruleForm.scxList.length == 0) {
|
|
|
Message.warning("至少选择一个项目信息");
|
|
|
}
|
|
|
MessageBox.confirm("是否开始进行合规性检查?", "合规性检查", {
|
|
@@ -226,32 +204,26 @@ export default {
|
|
|
type: "warning",
|
|
|
}).then(() => {
|
|
|
this.$emit("updateParent", "loading", true);
|
|
|
- setTimeout(() => {
|
|
|
- let bsm = "767d0754a41f43fb86982678134ff768";
|
|
|
- hgxfx.addList({ ...this.ruleForm, bsm });
|
|
|
- this.$emit("updateParent", "nowObj", this.ruleForm);
|
|
|
- this.$emit("updateParent", "rzBsm", bsm);
|
|
|
+ Add({ ...this.ruleForm }).then((res) => {
|
|
|
+ if (res.success) {
|
|
|
+ this.$emit("updateParent", "nowObj", this.ruleForm);
|
|
|
+ this.$emit("updateParent", "rzBsm", res.data);
|
|
|
+ this.reset();
|
|
|
+ } else {
|
|
|
+ Message.warning(res.message);
|
|
|
+ }
|
|
|
this.$emit("updateParent", "loading", false);
|
|
|
- this.reset();
|
|
|
- }, 500);
|
|
|
- // Add({ ...this.ruleForm }).then((res) => {
|
|
|
- // if (res.success) {
|
|
|
- // this.$emit("updateParent", "rzMc", this.ruleForm.xmmc);
|
|
|
- // this.$emit("updateParent", "rzBsm", res.data);
|
|
|
- // // this.$emit("updateParent", "rwBsm", res.data);
|
|
|
- // }
|
|
|
- // this.$emit("updateParent", "loading", false);
|
|
|
- // });
|
|
|
+ });
|
|
|
});
|
|
|
- } else {
|
|
|
- Message.warning(res);
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
getCheckedNodes() {
|
|
|
- this.ruleForm.scxs = this.$refs.tree.getCheckedNodes(true).map((item) => {
|
|
|
- return item.id;
|
|
|
- });
|
|
|
+ this.ruleForm.scxList = this.$refs.tree
|
|
|
+ .getCheckedNodes(true)
|
|
|
+ .map((item) => {
|
|
|
+ return { scxbsm: item.bsm };
|
|
|
+ });
|
|
|
},
|
|
|
},
|
|
|
watch: {},
|