Selaa lähdekoodia

Merge branch 'bug5459'

Karsa 3 kuukautta sitten
vanhempi
commit
7283e2d692

+ 0 - 212
src/views/system_manage/components/authSetDialog.vue

@@ -1,212 +0,0 @@
-<template>
-  <el-dialog
-		:visible.sync="isShow"
-		:close-on-click-modal="false"
-		:modal-append-to-body="false"
-		@close="cancelHandle"
-		custom-class="auth-set-dialog"
-		center
-		width="850px"
-		top="5vh"
-		v-dialogDrag
-    :title="edbForm.title"
-	>
-    <div class="cont">
-      <div class="header">
-        <span>{{$t('SystemManage.OperateAuth.invisible_users')}}</span>
-        <el-cascader
-          v-model="filterUsers"
-          :options="userList"
-          :props="{
-            value: 'AdminId',
-            label: 'RealName',
-            children: 'ChildrenList',
-            emitPath: false,
-            multiple: true,
-            disabled: 'Creater'
-          }"
-          collapse-tags
-          :show-all-levels="false"
-          clearable
-          filterable
-          :placeholder="$t('SystemManage.OperateAuth.placeholder04')" 
-          style="margin: 0 20px"
-        />
-        <el-button type="primary" @click="setAuthHandle">{{$t('Dialog.set_btn')}}</el-button>
-      </div>
-      <template v-if="edbForm.title===$t('SystemManage.OperateAuth.permission_title01')">
-        <el-table
-          :data="filterTable"
-          border
-          style="margin: 20px 0"
-        >
-          <el-table-column v-for="item in tableColums" :key="item.key" align="center" :label="item.label">
-            <template slot-scope="{row}">
-              <span>{{ row[item.key] }}</span>
-            </template>
-          </el-table-column>
-          <el-table-column align="center" :label="$t('Table.column_operations')">
-            <template slot-scope="{row}" >
-              <el-popconfirm
-                :title="$t('SystemManage.OperateAuth.permission_confirm_msg')"
-                @onConfirm="removeUser(row)"
-              >
-                <span slot="reference" class="deletesty">{{$t('Table.delete_btn')}}</span>
-              </el-popconfirm>
-            </template>
-          </el-table-column>
-        </el-table>
-        <el-col :span="24" style="height:100px">
-          <m-page
-            :page_no="pageNo"
-            :pageSize="pageSize"
-            :total="total"
-            @handleCurrentChange="pageChange"
-          />
-        </el-col>
-      </template>
-    </div>
-  </el-dialog>
-</template>
-
-<script>
-import { operateAuthInterface } from '@/api/modules/setApi';
-import mPage from '@/components/mPage';
-export default {
-  props: {
-    isShow: {
-      type: Boolean
-    },
-    users: {
-      type: Array
-    },
-    edbForm: {
-      type: Object
-    }
-  },
-  components: { mPage },
-  watch: {
-    isShow(nval) {
-      if(!nval) return
-      
-      let uers_arr = _.cloneDeep(this.users);
-      this.disableCreaterHandle(uers_arr);
-      this.userList = uers_arr;
-      this.edbForm.title===this.$t('SystemManage.OperateAuth.permission_title01') && this.getTableList()
-    }
-  },
-  computed:{
-    tableColums(){
-      return [
-        { label:this.$t('SystemManage.DepartManage.user_table_name'),key: 'RealName' },
-        { label:this.$t('SystemManage.DepartManage.user_table_role'),key: 'RoleName' },
-        { label:this.$t('SystemManage.DepartManage.user_table_depart'),key: 'DepartmentGroup' },
-      ]
-    }
-  },
-  data() {
-    return {
-      userList: [],
-      filterUsers: [],
-
-      tableData: [],
-      filterTable: [],
-      // tableColums:[
-      //   { label:'姓名',key: 'RealName' },
-      //   { label:'角色',key: 'RoleName' },
-      //   { label:'部门/分组',key: 'DepartmentGroup' },
-      // ],
-      pageNo:1,
-      pageSize: 10,
-      total: 0,
-    }
-  },
-  methods: {
-
-    /* 数据列表 */
-    getTableList() {
-      operateAuthInterface.getEdbNoAuthList({
-        EdbInfoId: this.edbForm.ids[0]
-      }).then(res => {
-        if(res.Ret !== 200) return
-        this.tableData = res.Data.List || [];
-        this.total = this.tableData.length;
-        this.filterTable = this.tableData.slice(0,this.pageSize*this.pageNo);
-        // this.filterUsers = this.tableData.length ? this.tableData.map(_ => _.AdminId) : [];
-
-      })
-    },
-
-    disableCreaterHandle(arr) {
-      // let filter_arr = arr.form
-      arr.forEach(item => {
-        item.ChildrenList && item.ChildrenList.length && this.disableCreaterHandle(item.ChildrenList);
-        if( Number(item.AdminId) === this.edbForm.createId) {
-          item.Creater = true;
-        }
-      })
-    },
-
-    pageChange(page) {
-      this.pageNo = page;
-      this.filterTable = this.tableData.slice(this.pageSize*(this.pageNo-1),this.pageSize*this.pageNo);
-    },
-
-
-    cancelHandle() {
-      this.pageNo = 1;
-      this.filterUsers = [];
-      this.filterTable = [];
-      this.$emit('update:isShow',false)
-    },
-
-    /* 删除 */
-    removeUser({AdminId}) {
-          operateAuthInterface.edbNoAuthDel({
-            EdbInfoId: Number(this.edbForm.ids[0]),
-            AdminId
-          }).then(res => {
-            if(res.Ret !== 200) return 
-            this.$message.success(this.$t('MsgPrompt.delete_msg'));
-            this.getTableList();
-          })
-    },
-
-    /* 设置权限 */
-    async setAuthHandle() {
-      if(!this.filterUsers.length) return this.$message.warning(this.$t('SystemManage.OperateAuth.placeholder04'))
-      // let res = this.edbForm.title === '权限设置' 
-      //   ? await operateAuthInterface.edbNoAuthSet({
-      //       EdbInfoId: Number(this.edbForm.ids[0]),
-      //       AdminIdList: this.filterUsers.map(_ => Number(_))
-      //   })
-      //   : 
-      let res = await operateAuthInterface.edbNoAuthBatchSet({
-          EdbInfoIdList: this.edbForm.ids.map(_ => Number(_)),
-          AdminIdList: this.filterUsers.map(_ => Number(_))
-        })
-
-      if(res.Ret !== 200) return 
-      this.$message.success(this.$t('SystemManage.OperateAuth.set_success'))
-      if(this.edbForm.title === this.$t('SystemManage.OperateAuth.permission_title01')) {
-        this.filterUsers=[]
-        this.getTableList()
-      }else {
-        this.$emit('setSuccess');
-        this.cancelHandle()
-      }
-    }
-  }
-}
-</script>
-
-<style lang="scss" soped>
-.cont {
-  min-height: 250px;
-}
-</style>
-<style lang='scss'>
-.auth-set-dialog {
-  .el-cascader .el-input {width: 100%;}
-}
-</style>

+ 14 - 7
src/views/system_manage/dataOperaAuth.vue

@@ -470,17 +470,24 @@ export default {
       if (res.Ret !== 200) return
     
       this.userList = res.Data || []
-      this.filterTreeEmpty(this.userList)
+      this.filterTreeEmpty({Children:this.userList})
     },
 
     // 递归处理数组
     filterTreeEmpty(arr) {
-      arr.length && arr.forEach(item => {
-        item.Children && item.Children.length && this.filterTreeEmpty(item.Children)
-        if (!item.Children || !item.Children.length) {
-          delete item.Children
-        }
-      })
+      function dfs(node) {
+          if (Array.isArray(node.Children)) {
+              for (let child of node.Children) {
+                  dfs(child);
+              }
+              if(node.Children.length===0) delete node.Children
+          }
+          //若为叶子节点,且不为用户,禁止选中
+          if(!node.Children||!Array.isArray(node.Children)){
+              if(node.NodeType!==3) node.disabled = true
+          }
+      }
+      dfs(arr); 
     },
 
     /* 获取用户的资产数量 */

+ 0 - 481
src/views/system_manage/operateAuthManage.vue

@@ -1,481 +0,0 @@
-<template>
-  <div class="container">
-    <div class="top">
-      <ul class="tab-ul">
-        <li :class="['tab-li',{act: default_tab===item.key}]" v-for="item in authTabs" :key="item.key" @click="changeTab(item)">{{item.label}}</li>
-      </ul>
-    </div>
-
-    <div class="top">
-        <div v-if="authTabs.length">
-            <el-input 
-            v-model="searchForm.key_word" 
-            :placeholder="default_tab === 5 ? this.$t('SystemManage.OperateAuth.placeholder01') : this.$t('SystemManage.OperateAuth.placeholder02')" 
-            style="width: 300px;margin-right:20px;"
-            @change="changeUser"
-            clearable
-            >
-            <i slot="prefix" class="el-input__icon el-icon-search"/>
-            </el-input>
-        </div>
-        <div v-if="authTabs.length" style="margin-right:auto;">
-          <el-cascader
-            v-model="searchForm.classification"
-            :options="classificationList"
-            :props="{
-              value: 'ClassifyId',
-              label: 'ClassifyName',
-              children: 'Child',
-              emitPath: false,
-              multiple:true
-            }"
-            collapse-tags
-            :show-all-levels="false"
-            :key="default_tab"
-            clearable
-            filterable
-            @change="changeUser"
-            :placeholder="this.$t('SystemManage.OperateAuth.placeholder03')" 
-            style="width: 250px;"
-          />
-          <el-cascader
-            v-model="searchForm.user"
-            :options="userList"
-            :props="{
-              value: 'AdminId',
-              label: 'RealName',
-              children: 'ChildrenList',
-              emitPath: false
-            }"
-            collapse-tags
-            :show-all-levels="false"
-            clearable
-            @change="changeUser"
-            filterable
-            :placeholder="this.$t('SystemManage.OperateAuth.placeholder04')" 
-            style="margin: 0 20px"
-          />
-        </div>
-        <div>
-          <el-button type="primary" @click="editAuthHandle({},'multiple')" 
-          v-if="[3,4].includes(default_tab)?authBtn('edit'):authTabs.length">{{$t('SystemManage.OperateAuth.btn_text01')}}</el-button>
-          <el-button type="primary" @click="edbAuthSetHandle({},'multiple')" v-if="[3,4].includes(default_tab
-        )&&authBtn('auth')">{{$t('SystemManage.OperateAuth.btn_text02')}}</el-button>
-        </div>
-    </div>
-     <el-table
-        :data="tableData"
-        ref="table"
-        element-loading-text="加载中..."
-        v-loading="tableLoading"
-        border
-        style="margin:30px 0"
-        @selection-change="selectionChange"
-      >
-        <el-table-column
-          type="selection"
-          width="55"
-        />
-        <el-table-column
-          v-for="item in tableColums"
-          :key="item.label"
-          :label="item.label"
-          :prop="item.key"
-          :width="item.widthsty"
-          :min-width="item.minwidthsty"
-          align="center"
-        >
-          <template slot-scope="{row}">
-            <template v-if="item.key==='handle'">
-              <span class="editsty" @click="edbAuthSetHandle(row)" v-if="[3,4].includes(default_tab
-        )&&authBtn('auth')">{{$t('SystemManage.OperateAuth.btn_text02')}}</span>
-              <span class="editsty" @click="editAuthHandle(row)" v-if="[3,4].includes(default_tab)?authBtn('edit'):authTabs.length">{{$t('Dialog.title_prefix_edit')}}</span>
-            </template>
-
-            <span v-else>{{ row[item.key] }}</span>
-          </template>
-        </el-table-column>
-        
-        <div slot="empty" style="padding: 100px 0">
-          <tableNoData :text="$t('Table.prompt_slogan')" size="mini"/>
-				</div>
-    </el-table>
-    <el-col :span="24" style="height:35px;text-align: right;float: none;">
-      <m-page
-        :page_no="page_no"
-        :pageSize="pageSize"
-        :total="total"
-        @handleCurrentChange="pageChange"
-      />
-    </el-col>
-
-     <!-- 编辑弹窗 -->
-    <m-dialog
-      :show.sync="isOpenDialog"
-      width="650px"
-      :title="dialogForm.title"
-      @close="isOpenDialog = false"
-    >
-      <div class="dialog-cont operateauth-dialog-cont">
-        <el-form
-          ref="formRef"
-          label-position="left"
-          hide-required-asterisk
-          label-width="80px"
-          :model="dialogForm"
-          :rules="dialogFormRules"
-          @close="cancelDialogHandle"
-        >
-          <el-form-item :label="$t('SystemManage.OperateAuth.original_creator')">
-            <span>{{ dialogForm.old_user_name }}</span>
-          </el-form-item>
-          <el-form-item :label="$t('SystemManage.OperateAuth.new_creator')" prop="new_user">
-            <el-cascader
-              v-model="dialogForm.new_user"
-              :options="userList"
-              :props="{
-                value: 'AdminId',
-                label: 'RealName',
-                children: 'ChildrenList',
-                emitPath: false
-              }"
-              collapse-tags
-              :show-all-levels="false"
-              clearable
-              filterable
-              :placeholder="$t('SystemManage.OperateAuth.placeholder04')" 
-              style="width: 250px"
-            />
-          </el-form-item>
-        </el-form>
-      </div>
-      <div class="dia-bot">
-        <el-button
-          type="primary"
-          style="margin-right: 60px"
-          @click="saveHandle"
-          >{{$t('Dialog.confirm_save_btn')}}</el-button
-        >
-        <el-button type="primary" plain @click="cancelDialogHandle"
-          >{{$t('Dialog.cancel_btn')}}</el-button
-        >
-      </div>
-    </m-dialog>
-
-    <!-- 指标权限弹窗 -->
-    <edbSetDialog
-      :isShow.sync="isEdbSetDialog"
-      :edbForm="edbForm"
-      :users="userList"
-      @setSuccess="()=>{$refs.table.clearSelection();selectedArr=[]}"
-    />
-  </div>
-</template>
-
-<script>
-import { operateAuthInterface } from '@/api/modules/setApi';
-// import { customInterence } from '@/api/modules/crmApi';
-import {dataBaseInterface} from '@/api/modules/chartApi'
-import mPage from '@/components/mPage';
-import mDialog from '@/components/mDialog';
-import edbSetDialog from './components/authSetDialog.vue';
-export default {
-  components: { mPage,mDialog,edbSetDialog },
-  computed: {
-    tableColums() {
-      return this.default_tab === 5 ? [
-        { label: this.$t('SystemManage.OperateAuth.table_col_name01'),key: 'Name' },
-        { label: this.$t('SystemManage.OperateAuth.table_col_name02'),key: 'ClassifyName' },
-        { label: this.$t('SystemManage.OperateAuth.table_col_name03'),key: 'CreateUserName' },
-        { label: this.$t('Table.column_operations'),key: 'handle' },
-      ] : [
-        { label: this.$t('SystemManage.OperateAuth.table_col_name04'),key: 'Code' },
-        { label: this.$t('SystemManage.OperateAuth.table_col_name05'),key: 'Name' },
-        { label: this.$t('SystemManage.OperateAuth.table_col_name03'),key: 'CreateUserName' },
-        { label: this.$t('Table.column_operations'),key: 'handle' },
-      ]
-    },
-    //权限配置化后的tabs
-    authTabs(){
-        const {operateAuthPermission,checkPermissionBtn} = this.permissionBtn
-        const operaMap = {
-            1:checkPermissionBtn(operateAuthPermission.operateAuth_manual),
-            2:checkPermissionBtn(operateAuthPermission.operateAuth_mysteel),
-            3:checkPermissionBtn(operateAuthPermission.operateAuth_etaLib),
-            4:checkPermissionBtn(operateAuthPermission.operateAuth_etaPredictLib),
-            5:checkPermissionBtn(operateAuthPermission.operateAuth_chartLib),
-        }
-        let temp = []
-        for(const k in operaMap){
-            console.log('k',k,operaMap[k])
-            if(operaMap[k]){
-                temp.push(this.tabs[k-1])
-            }
-        }
-        return temp
-    },
-    tabs(){
-      return [
-        { label: this.$t('SystemManage.OperateAuth.tab01'), key: 1 },
-        { label: this.$t('SystemManage.OperateAuth.tab02'), key: 2 },
-        { label: this.$t('SystemManage.OperateAuth.tab03'), key: 3 },
-        { label: this.$t('SystemManage.OperateAuth.tab04'), key: 4 },
-        { label: this.$t('SystemManage.OperateAuth.tab05'), key: 5 }
-      ]
-    }
-  },
-  data() {
-    return {
-      default_tab: 1,
-      // tabs:[
-      //   { label: '手工数据指标', key: 1 },
-      //   { label: '钢联化工数据库', key: 2 },
-      //   { label: 'ETA指标库', key: 3 },
-      //   { label: 'ETA预测指标', key: 4 },
-      //   { label: '图库', key: 5 }
-      // ],
-      selectedArr: [],//多选数组
-      tableLoading: false,
-      tableData:[],
-      page_no: 1,
-      total: 0,
-      pageSize: 10,
-
-      userList: [],
-      classificationList:[],
-      searchForm: {
-        classification:[],
-        user: '',
-        key_word: ''
-      },
-
-      isOpenDialog: false,
-      dialogForm: {
-        title: '',
-        old_user_name: '',
-        ids:'',
-        new_user: '',
-      },
-      dialogFormRules: {
-        new_user: [
-          { required: true, message: this.$t('SystemManage.OperateAuth.placeholder05'), trigger: 'change' }
-        ]
-      },
-
-      /* 指标权限设置 */
-      isEdbSetDialog: false,
-      edbForm: {}
-    }
-  },
-  methods: {
-
-    getTableData() {
-      this.tableLoading = true;
-      let params = {
-        Source: this.default_tab,
-        UserId: this.searchForm.user || '',
-        CurrentIndex: this.page_no,
-        PageSize: this.pageSize,
-        Keyword: this.searchForm.key_word,
-        Classify:this.searchForm.classification.join(',')
-      }
-			operateAuthInterface.list(params).then(res => {
-        this.tableLoading = false;
-        if( res.Ret!==200 )return
-
-        const { Data } = res;
-        Data.List && Data.List.forEach(_ => {
-          _.ModifyTime = _.ModifyTime ? this.$moment(_.ModifyTime).format('YYYY-MM-DD HH:mm:ss') : ''
-          _.PublishTime = _.PublishTime ? this.$moment(_.PublishTime).format('YYYY-MM-DD HH:mm:ss') : ''
-        })
-        this.tableData = Data.List || [];
-        this.total=parseInt(Data.Paging.Totals);
-			});
-    },
-    /* 获取用户列表 */
-    getUserList() {
-      // customInterence.getSale({Status: 0,AllEnabled: true}).then(res => {
-      dataBaseInterface.getEdbChartAdminList({Source: this.default_tab}).then(res=>{
-        if(res.Ret !== 200) return
-
-        this.userList = res.Data || [];
-      })
-    },
-    /* 获取分类列表 */
-    getClassificationList() {
-      operateAuthInterface.getClassificationBySource({Source: this.default_tab}).then(res => {
-        if(res.Ret == 200){
-          this.classificationList = res.Data.List || []
-          //如果是三级分类,去掉最后一级分类的child
-          if([3,4,5].includes(this.default_tab)){
-            this.filterNodes(this.classificationList)
-          }
-        }
-      })
-    },
-    filterNodes(arr) {
-        arr.length && arr.forEach(item => {
-            item.Child && item.Child.length && this.filterNodes(item.Child)
-            if(item.Child && !item.Child.length) {
-                delete item.Child
-            }
-        })
-    },
-    
-    changeTab({key}) {
-      this.default_tab = key;
-      this.searchForm.classification=[]
-      this.searchForm.user=''
-      this.page_no = 1;
-      this.getClassificationList()
-      this.getUserList()
-      this.getTableData();
-    },
-
-    pageChange(page) {
-      this.page_no = page;
-      this.getTableData()
-    },
-
-    changeUser() {
-      this.page_no = 1;
-      this.getTableData();
-    },
-
-    /* 复选框选择 */
-    selectionChange(val) {
-      console.log(val)
-      this.selectedArr = val || [];
-    },
-
-    /* 编辑 */
-    editAuthHandle({DataId,CreateUserName,},type='single') {
-      if(type === 'multiple' && !this.selectedArr.length) return this.$message.warning(this.$t('SystemManage.OperateAuth.msg01'))
-
-      this.dialogForm = {
-        title: type === 'multiple' ? this.$t('SystemManage.OperateAuth.edit_title02') : this.$t('SystemManage.OperateAuth.edit_title01'),
-        old_user_name: type === 'multiple' ? this.selectedArr[0].CreateUserName : CreateUserName,
-        ids: type === 'multiple' ? this.selectedArr.map(_ => _.DataId) : [DataId],
-        new_user: ''
-      }
-      this.isOpenDialog = true;
-    },
-
-    async saveHandle() {
-      await this.$refs.formRef.validate()
-
-      const res = await operateAuthInterface.authEdit({
-        Source: this.default_tab,
-        DataIdList: this.dialogForm.ids,
-        NewUserId: Number(this.dialogForm.new_user)
-      })
-
-      if(res.Ret !== 200) return
-      this.$message.success(res.Msg);
-      this.cancelDialogHandle();
-      this.getTableData();
-    },
-
-    /* 指标权限配置 */
-    edbAuthSetHandle({DataId,CreateUserId},type='') {
-      if(type === 'multiple' && !this.selectedArr.length) return this.$message.warning(this.$t('SystemManage.OperateAuth.msg01'))
-      if(type === 'multiple' && this.selectedArr.some(_ => this.selectedArr[0].CreateUserId!==_.CreateUserId)) return this.$message.warning('所选指标创建人不是同一用户,请重新选择!')
-
-      this.edbForm = {
-        title: type === 'multiple' ? this.$t('SystemManage.OperateAuth.permission_title02') : this.$t('SystemManage.OperateAuth.permission_title01'),
-        createId: type === 'multiple' ? this.selectedArr[0].CreateUserId : CreateUserId,
-        ids: type === 'multiple' ? this.selectedArr.map(_ => _.DataId) : [DataId],
-      }
-      this.isEdbSetDialog = true;
-      
-    },
-
-    cancelDialogHandle() {
-      this.$refs.formRef.resetFields();
-      this.isOpenDialog = false
-    },
-    authBtn(type){
-        const {operateAuthPermission,checkPermissionBtn} = this.permissionBtn
-        const authMap = {
-            3:operateAuthPermission.operateAuth_etaLib_authSetting,
-            4:operateAuthPermission.operateAuth_etaPredictLib_authSetting,
-        }
-        const editMap = {
-            3:operateAuthPermission.operateAuth_etaLib_edit,
-            4:operateAuthPermission.operateAuth_etaPredictLib_edit,
-        }
-        if(type==='auth'){
-            return checkPermissionBtn(authMap[this.default_tab])
-        }else{
-            return checkPermissionBtn(editMap[this.default_tab])
-        }
-    }
-  },
-  mounted() {
-    if(this.authTabs.length){
-        this.getUserList();
-    }
-  },
-  created(){
-    if(this.authTabs.length){
-        this.default_tab = this.authTabs[0].key
-        this.getClassificationList()
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-@import "~@/styles/theme-vars.scss";
-.container {
-  box-sizing: border-box;
-  min-height: calc(100vh - 120px);
-  padding: 20px 30px;
-  background: #fff;
-  position: relative;
-  border: 1px solid #ECECEC;
-  border-radius: 4px;
-  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
-  .top {
-    display: flex;
-    align-items: center;
-    justify-content: space-between;
-    flex-wrap: wrap;
-    margin-top: 15px;
-    .tab-ul,.right-side {
-      display: flex;
-      margin: 5px 0;
-      .tab-li {
-        margin-right: 20px;
-        min-width: 120px;
-        padding: 12px 0;
-        text-align: center;
-        color: $theme-color;
-        border: 1px solid $theme-color;
-        background: #e6eefb;
-        border-radius: 4px;
-        cursor: pointer;
-        &.act {
-          color: #fff;
-          border: 1px solid $theme-color;
-          background: $theme-color;
-        }
-      }
-    }
-  }
-
-}
-.dialog-cont {
-  padding-left: 110px;
-}
-.dia-bot {
-  display: flex;
-  justify-content: center;
-  margin-top: 50px;
-}
-</style>
-<style lang="scss">
-.operateauth-dialog-cont .el-input {
-  width: 100%;
-}
-</style>