tangning 3 rokov pred
rodič
commit
50ad0bc2cd

+ 18 - 2
src/components/role-select/index.vue

@@ -7,12 +7,12 @@
 
 <script>
 import selectComponentJs from '../select'
-import { getRoleList } from '@/request/config'
+import { getRoleList,getListByDeptId } from '@/request/config'
 import axios from 'axios'
 
 const extObj = selectComponentJs()
 
-extObj.props = [...extObj.props, 'maxLeave', 'disabled']
+extObj.props = [...extObj.props, 'maxLeave', 'disabled','deptId']
 
 extObj.computed = {
   ...extObj.computed,
@@ -25,6 +25,15 @@ extObj.computed = {
   }
 }
 
+extObj.watch = {
+  ...extObj.watch,
+    deptId() {
+      console.log('setup',this.deptId);
+    this.value = ''
+    this.getOptions()
+  }
+}
+
 export default {
   ...extObj,
 
@@ -32,6 +41,13 @@ export default {
     let res = await axios.post(getRoleList, {})
     this.options = res.data.map(item => ({...item, id: item.id.toString()}))
     extObj.mounted.call(this)
+  },
+  methods:{
+   ...extObj.methods,
+  async getOptions(){
+    let res = await axios.get(getListByDeptId, {params:{deptId:this.deptId}})
+    this.options = res.data.map(item => ({...item, id: item.id.toString()}))
+  }
   }
 }
 </script>

+ 2 - 1
src/request/config.js

@@ -1,5 +1,6 @@
 /**  ----------------角色接口----------------   */
 export const getRoleList = '/web/role/getAllRoleList'
+export const getListByDeptId = '/web/role/getListByDeptId'
 
 /** ------------------------------------------ */
 
@@ -222,7 +223,7 @@ export const fromUrls = [auditHouse, dismissHouse]
 // 带文件的请求
 export const fileUrls = [uploadHouseLogo, uploadAttachFile, uploadAttachImage]
 // 需要限定卫GET请求方式的url
-export const GetUrls = [getRoleList, getCompanyList]
+export const GetUrls = [getRoleList, getCompanyList,getListByDeptId]
 // 需要限定请求方式的url
 export const PostUrls = [getFireList, getMessageList ]
 // 恒大接口

+ 10 - 6
src/view/camera/index.vue

@@ -1,13 +1,16 @@
 <template>
   <com-head :options="headList" >
-    <el-form label-width="84px" inline="true">
+    <el-form label-width="97px" inline="true">
+      <el-form-item label="所属架构:">
+        <com-select v-model="search.state.deptId" />
+      </el-form-item>
       <el-form-item label="S/N码:">
         <el-input v-model="search.state.snCode" placeholder="请输入"></el-input>
       </el-form-item>
-      <el-form-item label="所属架构:">
-        <com-select v-model="search.state.deptId" />
+      <el-form-item label="绑定管理员:">
+        <el-input v-model="search.state.searchKey" placeholder="请输入"></el-input>
       </el-form-item>
-      <el-form-item class="searh-btns" style="grid-area: 1 / 3 / 2 / 4;">
+      <el-form-item class="searh-btns" style="grid-area: 1 / 4 / 2 / 4;">
         <el-button type="primary" @click="search.submit">查询</el-button>
         <el-button type="primary" plain @click="search.reset">重置</el-button>
       </el-form-item>
@@ -44,6 +47,7 @@
         {{row.usedSpaceStr}} 
         <!-- / {{row.totalSpaceStr}} -->
       </el-table-column>
+      <el-table-column label="绑定管理员" prop="nickName"></el-table-column>
       <el-table-column label="操作" v-slot:default="{ row }" v-if="auth.unbind || auth.update">
         <!-- <span class="oper-span" @click="oper.readyUpdate(row)" v-if="auth.update">编辑</span> -->
         <span class="oper-span" @click="unbindCamrea(row)" v-power="'unbind'" style="color: var(--primaryColor)">
@@ -113,8 +117,8 @@ export default {
       updateUrl: updateCamera,
       getUrl: getCameraList,
       delUrl: deleteCamera,
-      searchAttr: { deptId: '', snCode: '',type:'2' },
-      operAttr: { snCode: '', cameraSn: '',userId:'' },
+      searchAttr: { deptId: '', snCode: '',type:'2',searchKey:'' },
+      operAttr: { snCode: '', cameraSn: '',userId:'',searchKey:'' },
       delMsg: '解绑相机,该相机拍摄的场景也将一并解绑(场景在云端存储,不会删除)确定要解绑吗?'
     });
     const headList = ref([{ name: "相机管理", value: 2 }]);

+ 2 - 2
src/view/dispatch/index.vue

@@ -527,8 +527,8 @@ export default {
       
     },
     takeLook(row) {
-        console.log('带看',row);
-        this.$router.push({name: 'sceneInitiator', query: {sceneNum:row.sceneNum,id: row.id}})
+        let routeData = this.$router.push({name: 'sceneInitiator', query: {sceneNum:row.sceneNum,id: row.id}})
+        window.open(routeData.href, '_blank');
     },
     editInfo(row) {
       this.searchScene('')

+ 4 - 0
src/view/role/index.vue

@@ -61,6 +61,7 @@
               class="oper-span"
               style="color: var(--primaryColor)"
               @click="delInfo(row)"
+              :class="{disable:row.type == 0}"
               v-power="'del'"
               >删除</span
             >
@@ -204,6 +205,9 @@ export default {
     });
     const operRoleId = ref("");
     const delInfo = async (row) => {
+      if(row.type == 0){
+        return  getApp().$message({ message: "预设角色不能删除", type: "warning" });
+      }
       let isOk = await getApp().$confirm(
         "删除角色后,相关用户需重新配置角色,确认要删除组织吗?",
         "删除"

+ 66 - 17
src/view/user/index.vue

@@ -101,11 +101,23 @@
       <el-form ref="form" :model="form" label-width="90px" class="user-from">
         <el-form-item label="用户姓名" class="mandatory" >
           <el-input
-            v-model.trim="editName"
+            v-model.trim="editData.editName"
             placeholder="请输入"
             maxlength="30"
           ></el-input>
         </el-form-item>
+        <el-form-item label="所属架构:" class="mandatory" v-if="user.roleKey !== 'admin-ordinary'">
+          <el-cascader
+            style="width: 100%"
+            v-model="editData.deptIdList"
+            @change="editChange"
+            :options="treedata"
+            :props="{ checkStrictly: true, label: 'name', value: 'id' }"
+          ></el-cascader>
+        </el-form-item>
+        <el-form-item label="用户角色" class="roleName mandatory">
+         <com-role :deptId="relationDeptId" v-model="editData.roleId" style="width: 100%" allText="请选择" hideAll :notDefault="true" />
+        </el-form-item>
       </el-form>
     </com-dialog>
 
@@ -124,17 +136,17 @@
             placeholder="请输入"
           ></el-input>
         </el-form-item>
-        <el-form-item label="所属架构:"  v-if="user.roleKey !== 'admin-ordinary'">
+        <el-form-item label="所属架构:" class="mandatory" v-if="user.roleKey !== 'admin-ordinary'">
           <el-cascader
             style="width: 100%"
-            v-model="deptIdList"
-            @change="changeDeptId"
+            v-model="newData.deptIdList"
+            @change="editChange"
             :options="treedata"
             :props="{ checkStrictly: true, label: 'name', value: 'id' }"
           ></el-cascader>
         </el-form-item>
         <el-form-item label="用户角色" class="roleName mandatory">
-         <com-role v-model="newData.roleId" style="width: 100%" allText="请选择" hideAll :notDefault="true" />
+         <com-role :deptId="relationDeptId" v-model="newData.roleId" style="width: 100%" allText="请选择" hideAll :notDefault="true" />
         </el-form-item>
         <el-form-item label="用户账号" class="mandatory">
           <el-input
@@ -204,7 +216,12 @@ export default {
       if (!row.status) {
         return getApp().$message.error("请先启用用户", "提示");
       }
-      data.editName = row.nickName
+      console.log('updateInfo',row)
+      data.editData = {
+        editName:row.nickName,
+        roleId:row.roleId,
+        deptIdList:row.deptIdList.split(','),
+      }
       operRoleId.value = row.roleId;
       state.oper.value.readyUpdate(row);
     };
@@ -226,8 +243,13 @@ export default {
       data.newShow = true
     }
     const data = reactive({
+      relationDeptId:'',
       newShow: false,
-      editName:'',//修改编辑用户名称
+      editData:{
+        editName:'',
+        roleId:'',
+        deptIdList:'',
+      },//修改编辑用户名称
       deptIdList:[],
       treedata:[],
       newData:{
@@ -235,6 +257,7 @@ export default {
         userId: "",
         password: "",
         userRole: "",
+        deptIdList:null
       }
     });
     onMounted(async () => {
@@ -257,14 +280,16 @@ export default {
     };
   },
   methods: {
-    changeDeptId(val){
-      this.newData.deptId = val && val[val.length - 1];
-    },
     async newSubmit(){
       console.log('newSubmit',this.user,this.newData);
+      let deptIdList = this.newData.deptIdList
+      let deptId = deptIdList&& deptIdList[deptIdList.length - 1];
       if (!this.newData.nickName) {
         return this.$message.error("请输入用户姓名", "提示");
       }
+      if(!deptId){
+        return this.$message.error("请选择用户所属架构", "提示");
+      }
       if (!this.newData.roleId) {
         return this.$message.error("请选择用户角色", "提示");
       }
@@ -284,28 +309,48 @@ export default {
         password:this.newData.psw,
         userName:this.newData.userName,
         roleId:this.newData.roleId,
-        deptId:this.newData.deptId
-            // ...this.newData
+        deptId:deptId,
+        deptIdList:deptIdList.toString()
       });
       this.$message({message: apiinfo.msg || '成功', type: 'success'});
       // await this.$confirm('每个组织只能创建一个总管理员~', '新增用户')
-      this.newData = {}
-      this.deptIdList = []
+      this.newData = {
+        userName: "",
+        userId: "",
+        password: "",
+        userRole: "",
+        deptIdList:null
+      }
       this.newShow = false
       this.dataList.refer();
     },
     async operItem() {
-      if (!this.editName) {
+      console.log('state.oper',this.editData);
+      if (!this.editData.editName) {
         return this.$message.error("请输入用户名称", "提示");
       }
+      if (!this.editData.deptIdList) {
+        return this.$message.error("请选择用户所属架构", "提示");
+      }
+      if (!this.editData.roleId) {
+        return this.$message.error("请选择用户角色", "提示");
+      }
       console.log('state.oper',this.oper);
+      let deptId = this.editData.deptIdList[this.editData.deptIdList.length - 1];
       await axios.post(userEdit, {
           id:this.oper.state.id,
-          nickName:this.editName,
+          nickName:this.editData.editName,
+          roleId:this.editData.roleId,
+          deptId:deptId,
+          deptIdList:this.editData.deptIdList.toString()
       });
       this.$message({message: '编辑成功', type: 'success'});
       this.oper.reset();
-      this.editName = ''
+      this.editData = {
+        editName:'',
+        roleId:'',
+        deptIdList:'',
+      }
       this.dataList.refer();
     },
     async changeUserStatus(row, d) {
@@ -325,6 +370,10 @@ export default {
         return false;
       }
     },
+    editChange(val){
+      console.log('relationDeptId',val);
+      this.relationDeptId = val&&val[val.length - 1] || '';
+    }
   },
   components: {
     "com-dialog": comDialog,

+ 2 - 2
vue.config.js

@@ -19,8 +19,8 @@ module.exports = {
     // 设置代理proxy
     proxy: {
       '/__api': {
-        // target: 'http://192.168.0.135:8585/',
-        target: 'https://testxfhd.4dkankan.com',
+        target: 'http://192.168.0.135:8585/',
+        // target: 'https://testxfhd.4dkankan.com',
         // target: 'https://testhuodiao.4dkankan.com/',
         changeOrigin: true,  
         pathRewrite: {