Prechádzať zdrojové kódy

管理后台-系统设置加锁

panyong 3 rokov pred
rodič
commit
d28f3a1f28

+ 5 - 2
htmldev/manage/src/views/department/details.vue

@@ -18,7 +18,7 @@
       </el-form>
       <div slot="footer" class="dialog-footer text-center">
         <el-button @click="dialog = false">取 消</el-button>
-        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+        <el-button type="danger" :disabled="booLock" @click="handleSubmit">确 定</el-button>
       </div>
     </el-dialog>
   </div>
@@ -52,13 +52,16 @@ export default {
         department_project_id: undefined,
         department_name: '',
         department_desc: ''
-      }
+      },
+      booLock: false
     }
   },
   methods: {
     async handleSubmit () {
       let url = this.exData.id ? '/department/edit' : '/department/add'
+      this.booLock = true
       const data = await this.$fetch('/api/auth' + url, { ...this.form })
+      this.booLock = false
       if (data.code === 200) {
         this.$message.success('提交成功')
         this.$emit('success')

+ 5 - 2
htmldev/manage/src/views/project/details.vue

@@ -18,7 +18,7 @@
       </el-form>
       <div slot="footer" class="dialog-footer text-center">
         <el-button @click="dialog = false">取 消</el-button>
-        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+        <el-button type="danger" @click="handleSubmit" :disabled="booLock">确 定</el-button>
       </div>
     </el-dialog>
   </div>
@@ -51,13 +51,16 @@ export default {
         project_logo: '',
         project_desc: '',
         project_host: '',
-      }
+      },
+      booLock: false
     }
   },
   methods: {
     async handleSubmit () {
       let url = this.exData.id ? '/project/edit' : '/project/add'
+      this.booLock = true
       const data = await this.$fetch('/api/auth' + url, { ...this.form })
+      this.booLock = false
       if (data.code === 200) {
         this.$message.success('提交成功')
         this.$emit('success')

+ 5 - 2
htmldev/manage/src/views/project/ruleDialog.vue

@@ -25,7 +25,7 @@
       </el-form>
       <div slot="footer" class="dialog-footer text-center">
         <el-button @click="dialog = false">取 消</el-button>
-        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+        <el-button type="danger" :disabled="booLock" @click="handleSubmit">确 定</el-button>
       </div>
     </el-dialog>
   </div>
@@ -59,7 +59,8 @@ export default {
         rule_title: '',
         rule_url: '#',
         rule_pid: 0
-      }
+      },
+      booLock: false
     }
   },
   methods: {
@@ -67,7 +68,9 @@ export default {
       this.$refs.form.validate(async valid => {
         if (valid) {
           let url = this.exData.id ? '/rule/edit' : '/rule/add'
+          this.booLock = true
           const data = await this.$fetch('/api/auth' + url, { ...this.form })
+          this.booLock = false
           if (data.code === 200) {
             this.$message.success('提交成功')
             this.$emit('success')

+ 5 - 2
htmldev/manage/src/views/roles/details.vue

@@ -24,7 +24,7 @@
       </el-form>
       <div slot="footer" class="dialog-footer text-center">
         <el-button @click="dialog = false">取 消</el-button>
-        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+        <el-button type="danger" :disabled="booLock" @click="handleSubmit">确 定</el-button>
       </div>
     </el-dialog>
   </div>
@@ -60,13 +60,16 @@ export default {
         role_department_id: undefined,
         role_name: '',
         role_desc: ''
-      }
+      },
+      booLock: false
     }
   },
   methods: {
     async handleSubmit () {
       let url = this.exData.id ? '/role/set_role_info' : '/role/add'
+      this.booLock = true
       const data = await this.$fetch('/api/auth' + url, { ...this.form })
+      this.booLock = false
       if (data.code === 200) {
         this.$message.success('提交成功')
         this.$emit('success')

+ 4 - 5
htmldev/manage/src/views/roles/permissions.vue

@@ -34,15 +34,13 @@
       </el-tree>
       <div slot="footer" class="dialog-footer text-center">
         <el-button @click="dialog = false">取 消</el-button>
-        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+        <el-button type="danger" :disabled="booLock" @click="handleSubmit">确 定</el-button>
       </div>
     </el-dialog>
   </div>
 </template>
 
 <script>
-import { mapGetters } from 'vuex'
-
 export default {
   props: {
     value: {
@@ -67,7 +65,7 @@ export default {
       treeData: [],
       defaultChecked: [],
       dialog: !!this.value,
-
+      booLock: false
     }
   },
   methods: {
@@ -79,7 +77,6 @@ export default {
       keys = [...selectedKeys, ...keys]
       // 去重
       // keys = [...new Set(keys)]
-      console.log({ keys })
       this.$refs.tree.setCheckedKeys(keys)
     },
     clear (node, data) {
@@ -104,7 +101,9 @@ export default {
     },
     async handleSubmit () {
       let rule_id = this.$refs.tree.getCheckedKeys()
+      this.booLock = true
       const data = await this.$fetch('/api/auth/role/set_role_rule', { id: this.exData.id, rule_id })
+      this.booLock = false
       if (data.code == 200) {
         this.$message.success('修改成功')
         this.$emit('success')

+ 4 - 1
htmldev/manage/src/views/user/details.vue

@@ -45,7 +45,7 @@
       </el-form>
       <div slot="footer" class="dialog-footer text-center">
         <el-button @click="dialog = false">取 消</el-button>
-        <el-button type="danger" @click="handleSubmit">确 定</el-button>
+        <el-button type="danger" :disabled="booLock" @click="handleSubmit">确 定</el-button>
       </div>
     </el-dialog>
   </div>
@@ -88,13 +88,16 @@ export default {
       },
       departmentArr: [],
       roleArr: [],
+      booLock: false
     }
   },
   methods: {
     async handleSubmit () {
       let url = this.exData.id ? '/user/edit' : '/user/add'
       this.form.user_phone = this.form.user_phone.replace(/ /g, '')
+      this.booLock = true
       const data = await this.$fetch('/api/auth' + url, { ...this.form })
+      this.booLock = false
       if (data.code === 200) {
         this.$message.success('提交成功')
         this.$emit('success')

+ 1 - 1
htmldev/manage/src/views/user/index.vue

@@ -95,7 +95,7 @@ export default {
         confirmButtonText: '确定',
         cancelButtonText: '取消',
         inputValidator: (value) => {
-          if (value.replace(/ /g, '').length < 6) {
+          if (!value || value.replace(/ /g, '').length < 6) {
             return false
           } else {
             return true