loulijun2021
2022-07-19 d71436544198b7b051115662fc9cf4b12ce0cda3
src/views/jcsz/zzjg.vue
@@ -144,6 +144,7 @@
        <el-form-item label="组织类型" prop="OrgType">
          <el-radio-group
            v-model="dialogForm.OrgType"
            :disabled="operation==='edit'"
            @change="changeRadio"
          >
            <el-radio
@@ -160,8 +161,7 @@
        <el-form-item label="组织名称" prop="OrgName">
          <el-input v-model="dialogForm.OrgName" style="width: 200px" />
        </el-form-item>
        <!--        <el-form-item v-if="dialogFormOrgTypeSelected!=='F'" prop="SupUnit" label="上级单位">-->
        <el-form-item v-if="dialogFormOrgTypeSelected!=='D'" prop="SupUnit" label="上级单位">
        <el-form-item v-if="dialogForm.OrgType!=='部门'" prop="SupUnit" label="上级单位">
          <el-select
            v-model="dialogForm.SupUnit"
            style="width: 200px"
@@ -247,13 +247,12 @@
      tableData: [],
      dialogVisible: false,
      dialogForm: {
        OrgType: '',
        OrgType: '部门',
        OrgCode: '',
        OrgName: '',
        SupUnit: ''// 上级单位
      },
      SupUnitArr: [],
      dialogFormOrgTypeSelected: '',
      operation: '',
      dialogFormRules: {
        OrgType: [
@@ -338,19 +337,8 @@
    },
    // 单选框改变时
    async changeRadio(val) {
      if (val.length > 1) {
        this.OrgTypeArr.forEach(item => {
          if (item.label === val) {
            this.dialogFormOrgTypeSelected = item.value
          }
        })
        this.dialogForm.SupUnit = ''
      } else {
        this.dialogFormOrgTypeSelected = val
      }
      // if (this.dialogFormOrgTypeSelected !== 'F') {
      if (this.dialogFormOrgTypeSelected !== 'D') {
        const { data: res } = await PrentOrganization({ orgcode: this.dialogFormOrgTypeSelected })
      if (this.dialogForm.OrgType !== '部门') {
        const { data: res } = await PrentOrganization({ orgcode: this.OrgTypeArr.find(item => item.label === this.dialogForm.OrgType).value })
        this.SupUnitArr = res
      }
    },
@@ -407,7 +395,7 @@
    },
    // 对话框关闭事件
    handleClose() {
      this.dialogForm.OrgType = ''
      this.dialogForm.OrgType = '部门'
      this.dialogForm.OrgCode = ''
      this.dialogForm.OrgName = ''
      this.dialogForm.SupUnit = ''
@@ -422,18 +410,18 @@
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          const data = {
            OrganType: this.dialogFormOrgTypeSelected,
            OrganType: 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.dialogFormOrgTypeSelected === 'F' ? '0' : this.dialogForm.SupUnit,
            SupUnit: this.dialogFormOrgTypeSelected === 'D' ? '0' : this.dialogForm.SupUnit,
            SupUnit: this.dialogForm.OrgType === '部门' ? '0' : this.dialogForm.SupUnit,
            OperType: this.operation === 'add' ? 'Add' : 'Update',
            Operator: getCookie('admin')
          }
          AddUpdateOrganization(data).then(res => {
            if (res.code === '200') {
              this.$message.success(this.operation === 'add' ? '添加成功!' : '修改成功!')