huang_an 2 лет назад
Родитель
Сommit
379d409994

+ 3 - 1
src/components/selectTree/index.vue

@@ -19,7 +19,7 @@
           :data="options"
           :props="props"
           :node-key="props.value"
-          :default-expand-all="true"
+          :default-expand-all="isAll"
           :default-expanded-keys="defaultExpandedKey"
           @node-click="handleNodeClick"
         >
@@ -43,6 +43,8 @@
           };
         }
       },
+      // 展开可不展开
+      isAll: { type: Boolean, default: true },
       // 选项列表数据(树形结构的对象数组)
       options: { type: Array, default: () => [] },
       // 初始值

+ 4 - 1
src/views/warehouseManagement/components/WareHouseDailog.vue

@@ -339,7 +339,10 @@
       },
       async _getWarehouseChildren() {
         const res = await warehouseDefinition.list({});
-        this.warehouseList = res;
+        console.log(res);
+        this.warehouseList = res.map((item) => {
+          return { ...item, name: item.factoryName + '-' + item.name };
+        });
 
         // const res = await getWarehouseChildren();
         // if (res?.success) {

+ 29 - 5
src/views/warehouseManagement/outgoingManagement/add.vue

@@ -23,7 +23,7 @@
                 v-model="formData.extInfo.assetType"
                 @itemChange="handleChange"
               /> -->
-              <el-select
+              <!-- <el-select
                 :disabled="
                   !!(warehousingMaterialList && warehousingMaterialList.length)
                 "
@@ -37,7 +37,25 @@
                   :label="item.dictValue"
                   :value="item.dictCode"
                 ></el-option>
-              </el-select>
+              </el-select> -->
+              <selectTree
+                ref="tree"
+                class="form-ipt"
+                :isBindPlan="
+                  !!(warehousingMaterialList && warehousingMaterialList.length)
+                "
+                size="medium"
+                style="width: 100%"
+                clearable
+                :options="codeList"
+                :props="{
+                  value: 'id',
+                  label: 'name',
+                  children: 'children'
+                }"
+                @getValue="codeListValue"
+                :isAll="false"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="8">
@@ -872,11 +890,17 @@
         });
         console.log('sasasasa===>>>', this.warehousingMaterialList);
       },
+      codeListValue(val) {
+        console.log(val);
+        this.formData.extInfo.assetType = val.id;
+        this.$forceUpdate();
+        this.title = val?.name;
+        this.selectEquiType = val?.id;
+        console.log(this.title);
+      },
       async initData() {
         const { data } = await getTreeByPid(0);
-        this.codeList = data.map((item) => {
-          return { dictCode: item.id, dictValue: item.name };
-        });
+        this.codeList = data;
         const res = await warehouseDefinition.tree();
         this.treeList = this.$util.toTreeData({
           data: res,

+ 30 - 5
src/views/warehouseManagement/stockManagement/add.vue

@@ -44,7 +44,7 @@
                 v-model="formData.extInfo.assetType"
                 @itemChange="handleChange"
               /> -->
-              <el-select
+              <!-- <el-select
                 :disabled="
                   !!(warehousingMaterialList && warehousingMaterialList.length)
                 "
@@ -58,7 +58,23 @@
                   :label="item.dictValue"
                   :value="item.dictCode"
                 ></el-option>
-              </el-select>
+              </el-select> -->
+
+              <selectTree
+                ref="tree"
+                class="form-ipt"
+                size="medium"
+                style="width: 100%"
+                clearable
+                :options="codeList"
+                :props="{
+                  value: 'id',
+                  label: 'name',
+                  children: 'children'
+                }"
+                @getValue="codeListValue"
+                :isAll="false"
+              />
             </el-form-item>
           </el-col>
           <el-col :span="8">
@@ -865,6 +881,14 @@
       this.initData();
     },
     methods: {
+      codeListValue(val) {
+        console.log(val);
+        this.formData.extInfo.assetType = val.id;
+        this.$forceUpdate();
+        this.title = val?.name;
+        this.selectEquiType = val?.id;
+        console.log(this.title);
+      },
       //计算生产设备重量
       deviceWeight(row, num) {
         if (row) {
@@ -1402,9 +1426,10 @@
       },
       async initData() {
         const { data } = await getTreeByPid(0);
-        this.codeList = data.map((item) => {
-          return { dictCode: item.id, dictValue: item.name };
-        });
+        this.codeList = data;
+        // .map((item) => {
+        //   return { dictCode: item.id, dictValue: item.name };
+        // });
         const res = await warehouseDefinition.tree();
         this.treeList = this.$util.toTreeData({
           data: res,