loulijun2021
2023-06-13 3784cc5b9f62d0397c3036126c014fe4070e8a7d
src/views/basicSettings/organizationList.vue
@@ -201,11 +201,10 @@
      @close="handleClose"
    >
      <el-form ref="dialogForm" :rules="dialogFormRules" :model="dialogForm" label-width="80px">
        <el-form-item label="组织类型" prop="OrgType">
        <el-form-item v-if="$store.state.settings.orgType===''" label="组织类型" prop="OrgType">
          <el-radio-group
            v-model="dialogForm.OrgType"
            :disabled="operation==='edit'"
            @change="changeRadio"
          >
            <el-radio
              v-for="item in OrgTypeArr"
@@ -232,7 +231,7 @@
            <el-option
              v-for="item in SupUnitArr"
              :key="item.id"
              :label="item.org_name"
              :label="item.org_name+' / '+item.org_code"
              :value="item.id"
            />
          </el-select>
@@ -442,7 +441,7 @@
  //   }
  // },
  created() {
    this.getOrganizationSearch()
    this.handleRequest()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
@@ -472,10 +471,24 @@
      this.tableTimeStampKey = new Date().getTime()
      this.$refs.tableDataRef.doLayout()
    },
    handleRequest() {
      this.getOrganizationSearch().then(res => {
        if (res.code === '200') {
          this.getPrentOrganization()
        }
      })
    },
    async getOrganizationSearch() {
      const res = await OrganizationSearch(this.form)
      this.tableData = res.data
      this.total = res.count
      return { code: res.code }
    },
    async getPrentOrganization() {
      const { data: res } = await PrentOrganization({ orgcode: 'W' })
      this.SupUnitArr = res
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
@@ -502,15 +515,14 @@
      this.form.UserName = ''
      this.getOrganizationSearch()
    },
    // 单选框改变时
    async changeRadio(val) {
      if (this.dialogForm.OrgType !== '部门') {
        const { data: res } = await PrentOrganization({ orgcode: this.OrgTypeArr.find(item => item.label === this.dialogForm.OrgType).value })
        this.SupUnitArr = res
      }
    },
    // 新增按钮
    async add(operation) {
      console.log(this.$store.state.settings.orgType, 987)
      if (this.$store.state.settings.orgType === 'W') {
        return this.$message.info('当前用户无新增权限!')
      }
      this.operation = operation
      this.dialogVisible = true
@@ -520,6 +532,10 @@
    },
    // 修改按钮
    edit(operation, row) {
      if (this.$store.state.settings.orgType === 'W') {
        return this.$message.info('当前用户无修改权限!')
      }
      this.operation = operation
      this.dialogVisible = true
      // if (row.description === 'F') {
@@ -544,6 +560,10 @@
    },
    // 删除按钮
    async del(id) {
      if (this.$store.state.settings.orgType === 'W') {
        return this.$message.info('当前用户无删除权限!')
      }
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
@@ -580,14 +600,14 @@
        if (valid) {
          this.$store.state.app.buttonIsDisabled = true
          const data = {
            OrganType: this.dialogForm.OrgType === '部门' ? 'D' : 'W',
            OrganType: this.$store.state.settings.orgType !== '' ? 'W' : (this.dialogForm.OrgType === '部门' ? 'D' : 'W'),
            OrganCode: this.dialogForm.OrgCode,
            OrganName: this.dialogForm.OrgName,
            RightCode: '',
            numvalue: '',
            // RightCode: this.operation === 'add' ? getCookie('ruleCode') : '',
            // numvalue: this.operation === 'add' ? this.numvalue : '',
            SupUnit: this.dialogForm.OrgType === '部门' ? '0' : this.dialogForm.SupUnit,
            SupUnit: this.$store.state.settings.orgType !== '' ? this.SupUnitArr.find(i => i.org_code === getCookie('stu_torgcode')).id : (this.dialogForm.OrgType === '部门' ? '0' : this.dialogForm.SupUnit),
            OperType: this.operation === 'add' ? 'Add' : 'Update',
            Operator: getCookie('admin')
          }