瀏覽代碼

选址因子树结构数据与接口,因子表格展示,与新增接口修改

lkk 11 月之前
父節點
當前提交
1349d791c6
共有 2 個文件被更改,包括 55 次插入72 次删除
  1. 1 4
      src/views/siteselection/components/fzxz.vue
  2. 54 68
      src/views/siteselection/components/yxyzPop.vue

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

@@ -105,7 +105,7 @@
           </template>
         </el-table-column>
 
-        <el-table-column prop="defaultValue" label="值" show-overflow-tooltip>
+        <el-table-column prop="defaultValue" label="约束(m/°)" show-overflow-tooltip>
         </el-table-column>
       </el-table>
     </div>
@@ -245,9 +245,6 @@ export default {
           };
           // console.log(obj, "objobj");
           AddFzxz(obj).then((res) => {
-            // console.log(res, "哈哈哈哈哈");
-            // if (res.success) {
-            // this.bus.$emit("recordBsm", res.data.rwbsm);
             const loading = this.$loading({
               lock: true,
               text: "分析中",

+ 54 - 68
src/views/siteselection/components/yxyzPop.vue

@@ -17,7 +17,7 @@
               :props="defaultProps"
               highlight-current
               show-checkbox
-              node-key="bsm"
+              node-key="id"
               ref="tree"
             ></el-tree>
           </el-scrollbar>
@@ -46,52 +46,34 @@
           >
             <el-table-column type="selection" width="55" align="center">
             </el-table-column>
-            <el-table-column prop="yxyzmc" label="因子名称"> </el-table-column>
+            <el-table-column prop="name" label="因子名称"> </el-table-column>
             <el-table-column prop="spatial_type" label="条件" width="150">
               <template slot-scope="scope">
                 <el-select
-                  v-model="scope.row.spatial_type"
+                  v-model="scope.row.default"
                   placeholder="请选择"
                   class="input-style"
-                  v-if="
-                    scope.row.spatial_type == 'identity' ||
-                    scope.row.spatial_type == 'n_identity'
-                  "
                 >
                   <el-option
-                    v-for="item in conditionList1"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
-                  >
-                  </el-option>
-                </el-select>
-                <el-select
-                  v-model="scope.row.spatial_type"
-                  placeholder="请选择"
-                  class="input-style"
-                  v-if="
-                    scope.row.spatial_type == 'contain' ||
-                    scope.row.spatial_type == 'n_contain'
-                  "
-                >
-                  <el-option
-                    v-for="item in conditionList2"
-                    :key="item.value"
-                    :label="item.label"
-                    :value="item.value"
+                    v-for="item in scope.row.spatial_types"
+                    :key="item.key"
+                    :label="item.name"
+                    :value="item.key"
                   >
                   </el-option>
                 </el-select>
               </template>
             </el-table-column>
-            <el-table-column prop="yxz" label="约束值(m)" width="120">
+            <el-table-column prop="defaultValue" label="约束值(m/°)" width="120">
               <template slot-scope="scope">
                 <el-input
                   Onkeyup="this.value=this.value.replace(/[^\d^\.]+/g,'').replace(/^0+(\d)/,'$1').replace(/^\./,'0.').match(/\d+.?\d{0,2}/);this.dispatchEvent(new Event('input'))"
-                  v-model="scope.row.yxz"
+                  v-model.number="scope.row.defaultValue"
                   placeholder="距离"
                   class="input-style font-14"
+                  :disabled="scope.row.hasValue"
+                  type="number"
+                  @input="testInput(scope.row.hasValue)"
                 ></el-input>
                 <!-- :disabled="scope.row.condition == 'F'" -->
               </template>
@@ -109,7 +91,7 @@
 </template>
 
 <script>
-import { GetFxyzList } from "../../../api/ghss/ghxz.js";
+import { GetFactorList } from "../../../api/ghss/ghxz.js";
 export default {
   components: {},
   props: {
@@ -122,7 +104,7 @@ export default {
     return {
       defaultProps: {
         children: "children",
-        label: "yxyzmc",
+        label: "name",
       },
       dialogVisible: false,
       options: [],
@@ -131,34 +113,21 @@ export default {
       optionsTemp: [],
       selectdialogData: [],
       dialogData: [],
-      conditionList1: [
-        { label: "范围内", value: "identity" },
-        { label: "范围外", value: "n_identity" },
-      ],
-      conditionList2: [
-        { label: "距离包含", value: "contain" },
-        { label: "距离不包含", value: "n_contain" },
-      ],
     };
   },
-  computed: {
-    conditionList(val) {
-      if (val == "identity") {
-        return this.conditionList1;
-      } else {
-        return this.conditionList2;
-      }
-    },
-  },
+  computed: {},
   mounted() {
-    this.GetFxyzList();
+    this.GetFactorList();
   },
   methods: {
+    testInput(val){
+val = Number(val)
+    },
     close() {
       this.dialogVisible = false;
     },
-    GetFxyzList() {
-      GetFxyzList().then((res) => {
+    GetFactorList() {
+      GetFactorList().then((res) => {
         this.kxyzList = res.data;
         this.tempList = JSON.parse(JSON.stringify(res.data));
         this.getTreeList();
@@ -170,14 +139,14 @@ export default {
         const map = {};
         const tree = [];
         for (const node of nodes) {
-          map[node.bsm] = { ...node, children: [] };
+          map[node.id] = { ...node, children: [] };
         }
         for (const node of Object.values(map)) {
-          if (node.parent_bsm === null) {
+          if (node.parent_id == "") {
             tree.push(node);
           } else {
-            map[node.parent_bsm].children.push(node);
-            map[node.parent_bsm].parentNode = true;
+            map[node.parent_id].children.push(node);
+            map[node.parent_id].parentNode = true;
           }
         }
         return tree;
@@ -208,17 +177,22 @@ export default {
     setTable(selectdata) {
       let tableList = [];
       selectdata.forEach((item) => {
+        let JSONItem = JSON.parse(item.conditionInfo);
         tableList.push({
-          id: item.bsm,
+          id: item.id,
           // name: item.yxyzmc,
           // condition: item.spatial_type,
           // value: "",
           // sjy: item.has_yxz,
           // sjlx: item.spatial_type,
-          yzbsm: item.bsm,
-          yxyzmc: item.yxyzmc,
-          spatial_type: item.spatial_type,
-          yxz: "",
+          // yzbsm: item.bsm,
+          name: item.name,
+          bsm:item.bsm,
+          spatial_types:JSONItem.items,
+          spatial_type:JSONItem.spatial_type,
+          hasValue: JSONItem.hasValue, //是否可以填写约束值
+          defaultValue: Number(JSONItem.defaultValue), //约束值默认值
+          default: JSONItem.default, //默认选中条件
         });
       });
       tableList.forEach((item) => {
@@ -229,7 +203,7 @@ export default {
     },
     resetTree(data, item1) {
       data.forEach((item, index) => {
-        if (item.bsm == item1.id) {
+        if (item.id == item1.id) {
           data.splice(index, 1);
         }
         if (item.children != undefined && item.children.length != 0) {
@@ -291,8 +265,6 @@ export default {
         item.type && item.value == "" && (sign = false);
       });
       if (sign) {
-        // parent.emit("update:tableData", this.dialogData);
-        // parent.emit("update:dialogVisible", false);
         this.$parent.tableData = this.dialogData;
         this.dialogVisible = false;
       } else {
@@ -306,12 +278,10 @@ export default {
     },
     clearitem(item) {
       this.options[0].children = this.options[0].children.filter((item1) => {
-        // return item.id != item1.value;
-        return item.id != item1.yxz;
+        return item.id != '';
       });
       this.options[1].children = this.options[1].children.filter((item1) => {
-        // return item.id != item1.value;
-        return item.id != item1.yxz;
+        return item.id != '';//item1.defaultValue
       });
       this.options[0].children.length == 0
         ? (this.options[0].disabled = true)
@@ -399,4 +369,20 @@ export default {
 /deep/.el-dialog__body {
   color: #fff !important;
 }
+/* 去除Element UI中el-input数字类型的样式 */
+/deep/ .el-input__inner[type="number"] {
+  -webkit-appearance: none; /* 移除系统默认的外观样式 */
+}
+ 
+/* 去除增加/减少数字按钮的样式 */
+/deep/ .el-input__inner[type="number"]::-webkit-inner-spin-button,
+.el-input__inner[type="number"]::-webkit-outer-spin-button {
+  -webkit-appearance: none; /* 移除输入框两侧的上下箭头 */
+  margin: 0; /* 移除上下箭头与文本之间的间隔 */
+}
+ 
+/* 去除Firefox浏览器中的一些特定样式 */
+/deep/ .el-input__inner[type="number"]::-moz-inner-spin-button {
+  -moz-appearance: none; /* 移除Firefox中的上下箭头 */
+}
 </style>