From 1a63d909f7a976156c70186f913385798d652713 Mon Sep 17 00:00:00 2001
From: liupengpeng <276665548@qq.com>
Date: 星期二, 07 二月 2023 18:51:37 +0800
Subject: [PATCH] 用户管理、数据管理

---
 src/views/datamanage/styleManage.vue |  103 +++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 82 insertions(+), 21 deletions(-)

diff --git a/src/views/datamanage/styleManage.vue b/src/views/datamanage/styleManage.vue
index 28e13ae..740f178 100644
--- a/src/views/datamanage/styleManage.vue
+++ b/src/views/datamanage/styleManage.vue
@@ -274,7 +274,7 @@
           <el-input
             v-model="upform.name"
             autocomplete="off"
-            style="width:75%"
+            style="width:85%"
           ></el-input>
         </el-form-item>
         <el-form-item
@@ -284,7 +284,7 @@
           <el-input
             v-model="upform.type"
             autocomplete="off"
-            style="width:75%"
+            style="width:85%"
           ></el-input>
         </el-form-item>
         <el-form-item
@@ -294,13 +294,15 @@
         <el-select
           v-model="upform.dirid"
           placeholder="璇烽�夋嫨"
-          style="width:75%"
+          style="width:85%"
+          @focus="setOptionWidth"
         >
-          <el-option :value="upform.dirid" :label="upform.dirName" style="height: auto">
+          <el-option :value="upform.dirid" :label="upform.dirName" 
+          :style="{ width: selectOptionWidth, height: selectheight }">
             <el-tree
               ref="tree"
               :data="editcatalogOption"
-              default-expand-all
+              :default-expand-all="defaultexpand"
               node-key="id"
               :props="defaultProps"
               @node-click="handleNodeClickto"
@@ -333,13 +335,15 @@
         <el-select
           v-model="upform.depid"
           placeholder="璇烽�夋嫨"
-          style="width:75%"
+          style="width:85%"
+          @focus="setOptionWidth"
         >
-          <el-option :value="upform.depid" :label="upform.depName" style="height: auto">
+          <el-option :value="upform.depid" :label="upform.depName" 
+          :style="{ width: selectOptionWidth, height: selectheight }">
             <el-tree
               ref="tree"
               :data="editCompanyOption"
-              default-expand-all
+              :default-expand-all="defaultexpand"
               node-key="id"
               :props="defaultProps"
               @node-click="handleNodeClick"
@@ -373,7 +377,7 @@
           <el-input
             v-model="upform.ver"
             autocomplete="off"
-            style="width:75%"
+            style="width:85%"
           ></el-input>
         </el-form-item>
         <el-form-item
@@ -382,7 +386,7 @@
         >
           <el-select
             v-model="upform.status"
-            style="width:75%"
+            style="width:85%"
             :placeholder="$t('common.choose')"
           >
             <el-option
@@ -402,7 +406,7 @@
           <el-input
             v-model="upform.precision"
             autocomplete="off"
-            style="width:75%"
+            style="width:85%"
           ></el-input>
         </el-form-item>
         <el-form-item
@@ -412,7 +416,7 @@
           <el-input
             v-model="upform.descr"
             autocomplete="off"
-            style="width:75%"
+            style="width:85%"
           ></el-input>
         </el-form-item>
         <el-form-item
@@ -423,7 +427,7 @@
             v-model="upform.fileGuid"
             disabled
             autocomplete="off"
-            style="width:62%"
+            style="width:70%"
           ></el-input>
           <input
             name="file1"
@@ -434,7 +438,7 @@
             @change="editFile(0)"
           />
           <el-button
-          style="margin-left: 8px;"
+          style="margin-left: 6px;"
           type="primary"
           size="small"
           :underline="false"
@@ -467,7 +471,7 @@
             v-model="upform.viewGuid"
             disabled
             autocomplete="off"
-            style="width:62%"
+            style="width:70%"
           ></el-input>
           <input
             name="file1"
@@ -479,7 +483,6 @@
             @change="editFile(1)"
           />
           <el-button
-          style="margin-left: 8px;"
           type="primary"
           size="small"
           :underline="false"
@@ -510,7 +513,7 @@
           <el-input
             v-model="upform.bak"
             autocomplete="off"
-            style="width:75%"
+            style="width:85%"
           ></el-input>
         </el-form-item>
       </el-form>
@@ -560,13 +563,31 @@
           :label="$t('dataManage.styleObj.dirid')"
           :label-width="formLabelWidth"
         >
-          <el-cascader
+        <el-select
+          v-model="insertform.dirid"
+          placeholder="璇烽�夋嫨"
+          style="width:85%"
+          @focus="setOptionWidth"
+        >
+          <el-option :value="insertform.dirid" :label="insertform.dirName" 
+          :style="{ width: selectOptionWidth, height: selectheight }">
+            <el-tree
+              ref="tree"
+              :data="catalogOption"
+              :default-expand-all="defaultexpand"
+              node-key="id"
+              :props="defaultProps"
+              @node-click="handcatalogChange"
+            />
+          </el-option>
+        </el-select>
+          <!-- <el-cascader
             v-model="insertform.dirid"
             :options="catalogOption"
             @change="catalogChange"
             :props="cascader"
             style="width:730px"
-          ></el-cascader>
+          ></el-cascader> -->
           <!-- <el-input
             v-model="insertform.dirValue"
             disabled
@@ -583,13 +604,31 @@
           :label="$t('dataManage.styleObj.depid')"
           :label-width="formLabelWidth"
         >
-          <el-cascader
+        <el-select
+          v-model="insertform.depid"
+          placeholder="璇烽�夋嫨"
+          style="width:85%"
+          @focus="setOptionWidth"
+        >
+          <el-option :value="insertform.depid" :label="insertform.depName"
+          :style="{ width: selectOptionWidth, height: selectheight }">
+            <el-tree
+              ref="tree"
+              :data="companyOption"
+              :default-expand-all="defaultexpand"
+              node-key="id"
+              :props="cascader"
+              @node-click="handcompanyChange"
+            />
+          </el-option>
+        </el-select>
+          <!-- <el-cascader
             v-model="insertform.depid"
             :options="companyOption"
             @change="companyChange"
             :props="cascader"
             style="width:730px"
-          ></el-cascader>
+          ></el-cascader> -->
           <!-- <el-input
             v-model="insertform.depValue"
             disabled
@@ -861,6 +900,9 @@
         children: "children",
         label: "name",
       },
+      selectOptionWidth: '',
+      selectheight: 'auto',
+      defaultexpand: false
     };
   },
   created() {
@@ -1388,6 +1430,12 @@
       this.upform.dirid = res;
 
     },
+    handcatalogChange(data, node, nodeData) {
+      this.$set(this.insertform, 'dirid', data.id)
+      this.$set(this.insertform, 'dirName', data.name)
+      // this.insertform.dirid = data.id;
+      // this.insertform.dirName = data.name
+    },
     handleNodeClickto(data, node, nodeData) {
       this.insertform.depid = data.id
       this.upform.dirid = data.id;
@@ -1401,9 +1449,16 @@
       this.insertform.depid = res;
 
     },
+    handcompanyChange(data, node, nodeData) {
+      this.$set(this.insertform, 'depid', data.id)
+      // this.insertform.depid = data.id;
+      this.$set(this.insertform, 'depName', data.name)
+      // this.insertform.depName = data.name;
+    },
     //鏂板鏁版嵁
     setInsertShow() {
       this.InsertFormdialog = true;
+      this.$set(this, 'insertform', {})
     },
     //鐩綍鍒楄〃鑾峰彇
     async getSelectdirTab() {
@@ -1443,6 +1498,12 @@
         return father.pid == 0; // 杩斿洖涓�绾ц彍鍗�
       });
     },
+    setOptionWidth(event) {
+      // 涓嬫媺妗嗚仛鐒︼紝璁剧疆寮规鐨勫搴�
+      this.$nextTick(() => {
+        this.selectOptionWidth = event.srcElement.offsetWidth + 'px';
+      });
+    }
   },
 };
 </script>

--
Gitblit v1.9.3