zhongxiaoyu 3 роки тому
батько
коміт
d5740e837a

+ 5 - 3
src/components/organization/index.vue

@@ -153,9 +153,11 @@ export default {
           this.checkedKeys.forEach(key => {
             if (key !== -1) {
               const org = this.orgList.find(item => item.OrganId == key)
-              const OrganUpid = org.OrganUpid
-              if (!this.defaultExpandedKeys.includes(OrganUpid)) {
-                this.defaultExpandedKeys.push(OrganUpid)
+              if (org) {
+                const OrganUpid = org.OrganUpid
+                if (!this.defaultExpandedKeys.includes(OrganUpid)) {
+                  this.defaultExpandedKeys.push(OrganUpid)
+                }
               }
             }
           })

+ 29 - 9
src/components/rulesofcompetency/index.vue

@@ -5,42 +5,42 @@
       <div class="paren_header">
         <p>{{ title }}</p>
         <div class="header_right">
-          <el-radio v-model="form.radio" :label="item.id" v-for="(item, index) in option" :key="index">{{ item.label }}</el-radio>
+          <el-radio v-model="form.radio" :label="item.id" v-for="(item, index) in option" :key="index" :disabled="disabled">{{ item.label }}</el-radio>
         </div>
       </div>
       <div class="juris_list" :style="{ marginBottom: marginB }">
         <p>时效范围起</p>
-        <el-date-picker @change="setTime" v-model="form.firstWeeks" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择时间" size="mini" :picker-options="pickerOptionsStart">
+        <el-date-picker @change="setTime" v-model="form.firstWeeks" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" placeholder="选择时间" size="mini" :picker-options="pickerOptionsStart" :disabled="disabled">
         </el-date-picker>
       </div>
       <div class="juris_list" :style="{ marginBottom: marginB }">
         <p>至</p>
-        <el-date-picker @change="setTime" v-model="form.endWeeks" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择时间" size="mini" :picker-options="pickerOptionsEnd">
+        <el-date-picker @change="setTime" v-model="form.endWeeks" value-format="yyyy-MM-dd HH:mm:ss" type="datetime" placeholder="选择时间" size="mini" :picker-options="pickerOptionsEnd" :disabled="disabled">
         </el-date-picker>
       </div>
       <div class="juris_list" :style="{ marginBottom: marginB }">
         <p>许可查询行</p>
-        <el-input v-model.trim="form.input1" placeholder="请输入内容" size="mini"></el-input>
+        <el-input v-model.trim="form.input1" placeholder="请输入内容" size="mini" :disabled="disabled"></el-input>
       </div>
       <div class="juris_list" :style="{ marginBottom: marginB }">
         <p>许可查询列</p>
-        <el-input v-model.trim="form.input2" placeholder="请输入内容" size="mini"></el-input>
+        <el-input v-model.trim="form.input2" placeholder="请输入内容" size="mini" :disabled="disabled"></el-input>
       </div>
       <div class="juris_list" :style="{ marginBottom: marginB }">
         <p>许可删除行</p>
-        <el-input v-model.trim="form.input3" placeholder="请输入内容" size="mini"></el-input>
+        <el-input v-model.trim="form.input3" placeholder="请输入内容" size="mini" :disabled="disabled"></el-input>
       </div>
       <div class="juris_list" :style="{ marginBottom: marginB }">
         <p>许可新增列</p>
-        <el-input v-model.trim="form.input4" placeholder="请输入内容" size="mini"></el-input>
+        <el-input v-model.trim="form.input4" placeholder="请输入内容" size="mini" :disabled="disabled"></el-input>
       </div>
       <div class="juris_list" :style="{ marginBottom: marginB }">
         <p>许可编辑行</p>
-        <el-input v-model.trim="form.input5" placeholder="请输入内容" size="mini"></el-input>
+        <el-input v-model.trim="form.input5" placeholder="请输入内容" size="mini" :disabled="disabled"></el-input>
       </div>
       <div class="juris_list" :style="{ marginBottom: marginB }">
         <p>许可编辑列</p>
-        <el-input v-model.trim="form.input6" placeholder="请输入内容" size="mini"></el-input>
+        <el-input v-model.trim="form.input6" placeholder="请输入内容" size="mini" :disabled="disabled"></el-input>
       </div>
     </div>
   </el-form>
@@ -63,6 +63,10 @@ export default {
     authList: {
       type: Array,
       default: () => []
+    },
+    disabled: {
+      type: Boolean,
+      default: false
     }
   },
   data () {
@@ -143,6 +147,22 @@ export default {
       },
       deep: true
     },
+    disabled: {
+      handler(val) {
+        if (val) {
+          this.form.radio = 1
+          this.form.firstWeeks =
+            this.form.endWeeks =
+            this.form.input1 =
+            this.form.input2 =
+            this.form.input3 =
+            this.form.input4 =
+            this.form.input5 =
+            this.form.input6 =
+              ''
+        }
+      }
+    }
   },
   methods: {
     setTime () {

+ 2 - 1
src/utils/validate.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-12-13 09:43:22
- * @LastEditTime: 2022-03-16 10:57:25
+ * @LastEditTime: 2022-03-16 16:51:25
  * @LastEditors: your name
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: \Foshan4A2.0\src\utils\validate.js
@@ -291,6 +291,7 @@ function getRealLength(string) {
 }
 
 export function lengthValidator(rule, value, callback) {
+  value = value ?? ''
   const realLength = getRealLength(value)
   if (realLength === 0) {
     callback()

+ 4 - 4
src/views/accountManagement/components/accountEdit.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: Badguy
  * @Date: 2022-02-15 11:37:42
- * @LastEditTime: 2022-03-16 15:24:22
+ * @LastEditTime: 2022-03-16 16:36:49
  * @LastEditors: your name
  * @Description: 编辑账号
  * have a nice day!
@@ -211,9 +211,9 @@ export default {
         desc: [{ validator: lengthValidator, max: 128, message: '长度在 1 到 128 个字符', trigger: ['change', 'blur'] }]
       },
       accountForm: {
-        name: null,
-        pwd: null,
-        desc: null,
+        name: '',
+        pwd: '',
+        desc: '',
         status: 0
       },
       accountGroupTreeProps: {

+ 15 - 9
src/views/authorityManagement/components/authorityPowerAdd.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 11:26:07
- * @LastEditTime: 2022-03-16 15:12:13
+ * @LastEditTime: 2022-03-16 17:08:03
  * @LastEditors: your name
  * @Description:权限项
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\authorityPower.vue
@@ -45,7 +45,7 @@
       <!--有角色-->
       <template v-if="openRole">
         <div class="r24 flex1 part">
-          <Rulesofcompetency @getData="getData" :authTo="authTo" title="权限规则" />
+          <Rulesofcompetency :disabled="disabled" @getData="getData" :authTo="authTo" title="权限规则" />
         </div>
         <div v-is="['authtree_role_card']" class="flex1 part">
           <Rolelist @checkChange="checkChange" :roleType="roleType" needType="1" :checkBoxList="checkBoxList" :number="8" title="角色" />
@@ -54,7 +54,7 @@
       <!--有岗位-->
       <template v-else-if="OpenGroup">
         <div class="r24 flex1 part">
-          <Rulesofcompetency @getData="getData" :authTo="authTo" title="权限规则" />
+          <Rulesofcompetency :disabled="disabled" @getData="getData" :authTo="authTo" title="权限规则" />
         </div>
         <div v-is="['authtree_role_card']" class="flex1 part">
           <Rolelist @checkChange="checkChange" :roleType="roleType" :checkBoxList="checkBoxList" :number="8" title="账号授权" />
@@ -123,7 +123,8 @@ export default {
       msgDatas: [],
       roleType: '',
       orgType: '',
-      checkedKeys: []
+      checkedKeys: [],
+      disabled: true
     };
   },
   computed: {
@@ -290,6 +291,11 @@ export default {
     //角色选取
     checkChange (arr) {
       this.msgDatas = arr;
+      if (arr.length) {
+        this.disabled = false
+      } else {
+        this.disabled = true
+      }
     },
     //权限新增保存
     async editAuth () {
@@ -300,11 +306,11 @@ export default {
             item.IsSelected = 1;
           });
         }
-        const rulesKeys = Object.keys(this.rulesObj);
-        if (rulesKeys.length && !datas.length) {
-          this.$message.error('请选中数据后再提交当前规则');
-          return;
-        }
+        // const rulesKeys = Object.keys(this.rulesObj);
+        // if (rulesKeys.length && !datas.length) {
+        //   this.$message.error('请选中数据后再提交当前规则');
+        //   return;
+        // }
         const res = await SaveAuth({
           AuthName: this.form.name,
           AuthIdent: this.form.id,

+ 15 - 9
src/views/authorityManagement/components/authorityPowerEdit.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2021-11-29 11:26:07
- * @LastEditTime: 2022-03-16 15:15:12
+ * @LastEditTime: 2022-03-16 17:08:05
  * @LastEditors: your name
  * @Description:权限项
  * @FilePath: \Foshan4A2.0\src\views\authorityManagement\components\authorityPower.vue
@@ -45,7 +45,7 @@
       <!--有角色-->
       <template v-if="openRole">
         <div class="r24 flex1 part">
-          <Rulesofcompetency @getData="getData" :authTo="authTo" title="权限规则" />
+          <Rulesofcompetency :disabled="disabled" @getData="getData" :authTo="authTo" title="权限规则" />
         </div>
         <div v-is="['appupdate_edit_card']" class="flex1 part">
           <Rolelist @checkChange="checkChange" :roleType="roleType" needType="1" :checkBoxList="checkBoxList" :number="8" title="角色" />
@@ -54,7 +54,7 @@
       <!--有岗位-->
       <template v-else-if="OpenGroup">
         <div class="r24 flex1 part">
-          <Rulesofcompetency @getData="getData" :authTo="authTo" title="权限规则" />
+          <Rulesofcompetency :disabled="disabled" @getData="getData" :authTo="authTo" title="权限规则" />
         </div>
         <div v-is="['appupdate_edit_card']" class="flex1 part">
           <Rolelist @checkChange="checkChange" :roleType="roleType" :checkBoxList="checkBoxList" :number="8" title="账号授权" />
@@ -123,7 +123,8 @@ export default {
       msgDatas: [],
       roleType: '',
       orgType: '',
-      checkedKeys: []
+      checkedKeys: [],
+      disabled: true
     };
   },
   computed: {
@@ -291,6 +292,11 @@ export default {
     //角色选取
     checkChange (arr) {
       this.msgDatas = arr;
+      if (arr.length) {
+        this.disabled = false
+      } else {
+        this.disabled = true
+      }
     },
     //权限新增保存
     async editAuth () {
@@ -301,11 +307,11 @@ export default {
             item.IsSelected = 1;
           });
         }
-        const rulesKeys = Object.keys(this.rulesObj);
-        if (rulesKeys.length && !datas.length) {
-          this.$message.error('请选中数据后再提交当前规则');
-          return;
-        }
+        // const rulesKeys = Object.keys(this.rulesObj);
+        // if (rulesKeys.length && !datas.length) {
+        //   this.$message.error('请选中数据后再提交当前规则');
+        //   return;
+        // }
         const res = await EditAuth({
           AuthName: this.form.name,
           AuthIdent: this.form.id,

+ 8 - 8
src/views/organizationManagement/components/organizationEdit.vue

@@ -265,14 +265,14 @@ export default {
             L4,
             L5
           } = res.returnData;
-          this.form.name = OrganName || '';
-          this.form.id = OrganType || '';
-          this.form.desc = OrganDesc || '';
-          this.form.oneCode = L1 || '';
-          this.form.twoCode = L2 || '';
-          this.form.threeCode = L3 || '';
-          this.form.fourCode = L4 || '';
-          this.form.fiveCode = L5 || '';
+          this.form.name = OrganName;
+          this.form.id = OrganType;
+          this.form.desc = OrganDesc;
+          this.form.oneCode = L1;
+          this.form.twoCode = L2;
+          this.form.threeCode = L3;
+          this.form.fourCode = L4;
+          this.form.fiveCode = L5;
           this.Status = Status;
           if (AuthList && AuthList.length) {
             AuthList.forEach((item) => {