赵士淞
2023-04-28 5a31047fa94abde105ee964a70891dd975403f89
eladmin-web-master/src/views/task/taskUser/index.vue
@@ -96,9 +96,9 @@
          <el-form-item label="任务工作量单位" prop="taskWorkloadUnit">
            {{ dict.label[standardWorkloadUnit][form.taskWorkloadUnit] }}
          </el-form-item>
          <el-form-item label="强制更新" tool-tip prop="enable">
          <el-form-item label="强制更新" tool-tip prop="enable1">
            <el-tooltip content="不增减工作量的场合调整工时的话,需要选择此项。(有疑问请联系管理员,不要随便选。。。)" effect="dark" placement="bottom">
              <el-switch v-model="form.enable" />
              <el-switch v-model="form.enable1" />
            </el-tooltip>
          </el-form-item>
          <el-form-item label="任务状态" prop="taskStatus">
@@ -179,6 +179,7 @@
        <el-table-column v-if="checkPer(['admin','taskUser:edit','taskUser:del'])" label="操作" width="150px" align="center" fixed="right">
          <template slot-scope="scope">
            <udOperation
              v-if="userRolesLevelMin == roleLevelSuper || userRolesLevelMin == roleLevelGeneral || scope.row.projectLiableUserIdList.indexOf($store.state.user.user.id) != -1 || scope.row.userId == $store.state.user.user.id"
              :data="scope.row"
              :permission="permission"
            />
@@ -205,7 +206,7 @@
import crudUser from '@/api/system/user'
import DateRangePicker from '@/components/DateRangePicker'
const defaultForm = { id: null, userId: null, projectId: null, taskId: null, taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null, enable: false, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, divideUserIds: [] }
const defaultForm = { id: null, userId: null, projectId: null, taskId: null, taskStartDate: null, taskEndDate: null, taskHours: null, taskWorkload: null, taskStatus: null, enable1: false, remarks: null, createBy: null, createTime: null, updateBy: null, updateTime: null, divideUserIds: [] }
export default {
  name: 'TaskUser',
  components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker },
@@ -287,6 +288,10 @@
      standardWorkloadUnit: constant.STANDARD_WORKLOAD_UNIT,
      // 字典:批准状态-未承认
      approveStatusUnrecognized: constant.APPROVE_STATUS_UNRECOGNIZED,
      // 角色级别:超级管理员
      roleLevelSuper: constant.ROLE_LEVEL_SUPER,
      // 角色级别:总经理
      roleLevelGeneral: constant.ROLE_LEVEL_GENERAL,
      // 角色级别:普通用户
      roleLevelOrdinary: constant.ROLE_LEVEL_ORDINARY,
      // CRUD状态
@@ -507,6 +512,27 @@
        // 表单赋值
        this.form.divideUserIds = res
      })
    },
    // 钩子:提交 - 之前
    [CRUD.HOOK.beforeSubmit]() {
      this.form.enable = this.form.enable1
      // 判断用户角色
      if (this.userRolesLevelMin === this.roleLevelSuper || this.userRolesLevelMin === this.roleLevelGeneral) {
        return true
      } else {
        // 检索选中项目信息
        const chooseProject = this.projects.filter((item) => {
          return item.id === this.form.projectId
        })
        // 判断是否是项目责任人
        if ((chooseProject.length === 1 && chooseProject[0].liableUserIdList.indexOf(this.$store.state.user.user.id) !== -1) || this.form.userId === this.$store.state.user.user.id) {
          return true
        } else {
          // 消息提示
          this.crud.notify('您不是当前项目责任人,无法添加/修改任务分配', CRUD.NOTIFICATION_TYPE.WARNING)
          return false
        }
      }
    }
  }
}