maxiaoxiao 11 mesiacov pred
rodič
commit
1ea8de6203

+ 16 - 2
src/api/ghss/ghxz.js

@@ -36,7 +36,7 @@ export function AddFzxz(data) {
     return request({
         url: '/analyse/fzss/AddFzxz',
         method: 'post',
-        data:data
+        data: data
     })
 }
 
@@ -63,7 +63,21 @@ export function DelXzRes(params) {
         params
     })
 }
-
+// 保存模版因子
+export function AddTemplate(data) {
+    return request({
+        url: '/apply/fzxz/AddTemplate',
+        method: 'post',
+        data
+    })
+}
+export function DelTemplate(params) {
+    return request({
+        url: '/apply/fzxz/DelTemplate',
+        method: 'delete',
+        params
+    })
+}
 
 // 获取模版因子列表
 export function GetTemplateFactorList(params) {

+ 0 - 1
src/views/siteselection/components/fzxz.vue

@@ -143,7 +143,6 @@ import {
   AddFzxz,
   GetTemplateFactorList,
 } from "../../../api/ghss/ghxz.js";
-import hgxfx from "../../../../static/data/ghss/data.js";
 import moment from "moment";
 export default {
   components: {

+ 61 - 11
src/views/siteselection/components/yxyzPop.vue

@@ -88,7 +88,8 @@
       </el-row>
 
       <span slot="footer" class="dialog-footer">
-        <el-button @click="close">取 消</el-button>
+        <span class="clearBtn" @click="submit(true)">保存至模板</span>
+        <el-button @click="reset">重置</el-button>
         <el-button type="primary" @click="submit">确 定</el-button>
       </span>
     </el-dialog>
@@ -96,7 +97,11 @@
 </template>
 
 <script>
-import { GetFactorList } from "../../../api/ghss/ghxz.js";
+import {
+  GetFactorList,
+  AddTemplate,
+  DelTemplate,
+} from "../../../api/ghss/ghxz.js";
 export default {
   components: {},
   props: {
@@ -127,6 +132,23 @@ export default {
     this.GetFactorList();
   },
   methods: {
+    save(factors) {
+      AddTemplate({ landTypeCode: this.$parent.ydlxBSM, factors }).then(
+        (res) => {
+          if (res.success) {
+            this.$message.success(res.message);
+            this.$parent.GetTemplateFactorList(this.$parent.ydlxBSM);
+          }
+        }
+      );
+    },
+    reset() {
+      DelTemplate({ landTypeCode: this.$parent.ydlxBSM }).then((res) => {
+        if (res.success) {
+          this.$parent.GetTemplateFactorList(this.$parent.ydlxBSM);
+        }
+      });
+    },
     testInput(val) {
       val = Number(val);
     },
@@ -189,7 +211,7 @@ export default {
           id: item.id,
           name: item.name,
           bsm: item.bsm,
-          conditionInfo:JSONItem,
+          conditionInfo: JSONItem,
         });
       });
       tableList.forEach((item) => {
@@ -214,7 +236,8 @@ export default {
         if (item.children != undefined && item.children.length == 0) {
           if (item.parentNode) {
             item.disabled = true;
-            if (this.$refs.tree) {//用地类型绑定后易出现找不到tree的情况
+            if (this.$refs.tree) {
+              //用地类型绑定后易出现找不到tree的情况
               this.$refs.tree.setCheckedKeys([]);
             }
           }
@@ -257,16 +280,26 @@ export default {
     },
     handleSelectionChange(val) {
       this.selectdialogData = val;
-      console.log(val,"这是什么");
+      console.log(val, "这是什么");
     },
-    submit() {
+    submit(issave) {
       var sign = true;
+      let saveData = [];
       this.dialogData.forEach((item) => {
         item.type && item.value == "" && (sign = false);
+        issave &&
+          saveData.push({
+            ...item,
+            conditionInfo: JSON.stringify(item.conditionInfo),
+          });
       });
       if (sign) {
-        this.$parent.tableData = this.dialogData;
-        this.dialogVisible = false;
+        if (issave) {
+          this.save(saveData);
+        } else {
+          this.$parent.tableData = this.dialogData;
+          this.dialogVisible = false;
+        }
       } else {
         this.$message.warning("请将信息补充完整!");
       }
@@ -290,9 +323,7 @@ export default {
         ? (this.options[1].disabled = true)
         : (this.options[1].disabled = false);
     },
-  },
-  watch: {
-    dialogVisible(oldVal, newVal) {
+    resetDialogData() {
       if (this.tableData.length == []) {
         // 重置时,树的数据恢复
         this.dialogData = [];
@@ -311,12 +342,18 @@ export default {
         return this.dialogData;
       }
     },
+  },
+  watch: {
+    dialogVisible(oldVal, newVal) {
+      // this.resetDialogData();
+    },
     yzTableData(oldVal, newVal) {
       let idArr = [];
       this.yzTableData.forEach((item) => {
         idArr.push(item.id);
       });
       this.defaultArr = idArr;
+      this.resetDialogData();
     },
   },
 };
@@ -399,4 +436,17 @@ export default {
 /deep/ .el-input__inner[type="number"]::-moz-inner-spin-button {
   -moz-appearance: none; /* 移除Firefox中的上下箭头 */
 }
+.clearBtn {
+  padding: 12px 20px;
+  border-radius: 4px;
+  cursor: pointer;
+  width: 30%;
+  background-color: #3f94f53f;
+  border: 1px solid #3f93f5;
+  color: #b6e0ff;
+
+  &:hover {
+    font-weight: bold;
+  }
+}
 </style>