小小儁爺
2024-08-08 d20654ba067e5c0621d4d7d95915cbe47a10fe87
src/views/basicSettings/organizationList.vue
@@ -168,7 +168,7 @@
                  />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row.id)" />
                  <i :style="{color:$store.state.settings.theme}" class="el-icon-delete" @click="del(row)" />
                </el-tooltip>
                <!--                <el-button type="primary" size="mini" />-->
                <!--                <el-button type="danger" size="mini">删除</el-button>-->
@@ -184,7 +184,7 @@
        :page.sync="form.page"
        :limit.sync="form.rows"
        align="right"
        layout="total ,prev, pager, next,sizes"
        layout="total ,prev, pager, next, sizes,jumper "
        popper-class="select_bottom"
        @pagination="getOrganizationSearch"
      />
@@ -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"
@@ -221,7 +220,7 @@
        <el-form-item label="组织名称" prop="OrgName">
          <el-input v-model="dialogForm.OrgName" style="width: 200px" />
        </el-form-item>
        <el-form-item v-if="dialogForm.OrgType!=='部门'" prop="SupUnit" label="上级单位">
        <el-form-item v-if="dialogForm.OrgType!=='部门'&&$store.state.settings.orgType===''" prop="SupUnit" label="上级单位">
          <el-select
            v-model="dialogForm.SupUnit"
            style="width: 200px"
@@ -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>
@@ -266,7 +265,7 @@
// const SER_HZ = /^[\u4e00-\u9fa5]+$/
// const SER_HZ = /^[a-zA-Z0-9_;,.<>() ]{0,}$/
export default {
  name: 'ZZJG',
  name: 'OrganizationList',
  components: {
    Pagination, TableColumnSettings
  },
@@ -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,16 @@
      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('当前用户无新增权限!')
      }
      await this.getPrentOrganization()
      this.operation = operation
      this.dialogVisible = true
@@ -519,7 +533,11 @@
      // this.numvalue = res.numvalue
    },
    // 修改按钮
    edit(operation, row) {
    async  edit(operation, row) {
      if (this.$store.state.settings.orgType === 'W') {
        return this.$message.info('当前用户无修改权限!')
      }
      await this.getPrentOrganization()
      this.operation = operation
      this.dialogVisible = true
      // if (row.description === 'F') {
@@ -536,20 +554,23 @@
      //   this.dialogForm.OrgType = '生产线'
      // }
      this.$nextTick(() => {
        this.changeRadio(this.dialogForm.OrgType)
        this.dialogForm.OrgCode = row.org_code
        this.dialogForm.OrgName = row.org_name
        this.dialogForm.SupUnit = row.parent_id
      })
    },
    // 删除按钮
    async del(id) {
    async del(row) {
      if (this.$store.state.settings.orgType === 'W') {
        return this.$message.info('当前用户无删除权限!')
      }
      this.$confirm('是否确认删除?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeleteOrganization({ orgid: id }).then(res => {
        DeleteOrganization({ orgid: row.id, orgcode: row.org_code }).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            if (this.form.page > 1 && this.tableData.length === 1) {
@@ -580,14 +601,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')
          }