churf
2023-08-09 b94044936656e73438ccc689c970c9e80518c175
eladmin-web-master/src/views/task/taskUser/index.vue
@@ -27,7 +27,7 @@
            <div class="infinite-list" style="overflow:auto;height:500px">
              <el-card v-for="task in taskDatas" :key="task.id" class="box-card" style="margin-bottom: 10px;" shadow="hover">
                <div @click="handleNodeClick(task)">
                  {{task.name}}
                  {{ task.name }}
                </div>
              </el-card>
            </div>
@@ -76,7 +76,7 @@
            </el-select>
            <rrOperation :crud="crud" />
          </div>
          <crudOperation :permission="permission">
          <crudOperation v-if="flag" :permission="permission">
            <el-button
              slot="right"
              v-permission="permission.generate"
@@ -90,7 +90,7 @@
          </crudOperation>
          <div>
            <span> 当前任务:<i> {{ selectedTaskName }} </i>
              <span v-if="taskTotal.performanceType" style="magin: right 10px;"><i> (绩效类型: {{ taskTotal.performanceType === '1' ? '绩效' : '非绩效'}})</i></span>
              <span v-if="taskTotal.performanceType" style="magin: right 10px;"><i> (绩效类型: {{ taskTotal.performanceType === '1' ? '绩效' : '非绩效' }})</i></span>
            </span>
            <el-divider>
              <span v-for="item in taskTotal.details" :key="item._id">
@@ -114,8 +114,8 @@
        <el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
          <el-form ref="form" :model="form" :rules="rules" size="small" label-width="110px">
            <el-form-item label="所属" prop="taskId">
              <el-input v-show="false" v-model="form.task.id" style="width: 340px;"></el-input>
              <el-input v-model="form.task.name" :disabled="true" style="width: 340px;"></el-input>
              <el-input v-show="false" v-model="form.task.id" style="width: 340px;" />
              <el-input v-model="form.task.name" :disabled="true" style="width: 340px;" />
            </el-form-item>
            <el-form-item label="任务名称">
              <el-input v-model="form.name" style="width: 340px;" />
@@ -184,30 +184,31 @@
              <el-tag>{{ dict.label[taskStatus][scope.row.taskStatus] }}</el-tag>
            </template>
          </el-table-column>
          <el-table-column v-if="checkPer(['admin','taskUser:edit','taskUser:del'])" label="操作" width="180" align="center" fixed="right">
          <el-table-column v-if="checkPer(['admin','taskUser:edit','taskUser:del'])" label="操作" width="200" align="center" fixed="right">
            <template slot-scope="scope">
              <udOperation
                v-if="flag"
                :data="scope.row"
                :permission="permission"
              >
                <el-button
                  slot="left"
                  v-if="scope.row.userNickName"
                  slot="left"
                  v-permission="permission.list"
                  size="mini"
                  type="primary"
                  icon="el-icon-check"
                  style="display:none"
                  @click="toPick(scope.row)"
                />
                <el-button
                  slot="left"
                  v-else
                  slot="left"
                  v-permission="permission.list"
                  size="mini"
                  type="primary"
                  icon="el-icon-share"
                  @click="unPick(scope.row)"
                />
                >获取</el-button>
              </udOperation>
            </template>
          </el-table-column>
@@ -249,6 +250,7 @@
const defaultForm = { id: null, userId: null, projectId: null, task: { id: null }, taskStartDate: null, taskEndDate: null, taskHours: null, taskStatus: null, remarks: null, divideUserIds: [] }
export default {
  name: 'TaskUser',
  // eslint-disable-next-line vue/no-unused-components
  components: { Treeselect, crudOperation, rrOperation, udOperation, pagination, DateRangePicker, UploadExcelComponent },
  cruds() {
    return CRUD({ title: '任务分配', url: 'api/taskUser', crudMethod: { ...crudTaskUser }})
@@ -258,6 +260,7 @@
  dicts: [constant.TASK_STATUS, constant.TAST_CLASSIFICATION, constant.STANDARD_WORKLOAD_UNIT, constant.PERFORMANCE_TYPE],
  data() {
    // 时长(万内)验证
    // eslint-disable-next-line no-unused-vars
    var durationValidate = (rule, value, callback) => {
      const reg = /^([0-9]|[1-9]\d{1,3})(\.\d{1,2})?$/
      if (value != null && value !== '' && !reg.test(value)) {
@@ -324,6 +327,7 @@
      // 生成表单加载
      generateLoading: false,
      uploading: true,
      flag: false
    }
  },
  computed: {
@@ -334,7 +338,6 @@
  mounted() {
    this.getAllProjectDatas()
    this.getTaskDatas()
    this.getUser()
  },
  methods: {
    // 钩子:在获取表格数据之前执行,false 则代表不获取数据
@@ -360,12 +363,12 @@
      return true
    },
    disabledDate(time) {
      return time.getTime() < new Date(this.planStartTime) -8.64e7 || time.getTime() > new Date(this.planEndTime).getTime()
      return time.getTime() < new Date(this.planStartTime) - 8.64e7 || time.getTime() > new Date(this.planEndTime).getTime()
    },
    // 获取用户
    getUser() {
    getUser(taskId) {
      // 获取用户
      crudUser.getAll().then(res => {
      crudUser.getProjectUser(taskId).then(res => {
        // 用户列表
        this.users = res
      })
@@ -394,7 +397,7 @@
      }
      this.taskLoading = true
      setTimeout(() => {
        crudTask.getChildren(params).then(res => {
        crudTask.ChildrenTaskAnyParent(params).then(res => {
          if (resolve) {
            resolve(res)
          } else {
@@ -417,6 +420,7 @@
        this.query.taskId = data.id
        this.query.taskStatus = ['task_status_not_started', 'task_status_in_hand', 'task_status_test', 'task_status_stop']
        this.selectedTaskName = data.name
        this.flag = data.flag
        console.log('data : ', data)
        this.planStartTime = data.planStartTime
        this.planEndTime = data.planEndTime
@@ -425,6 +429,7 @@
        })
      }
      this.crud.toQuery()
      this.getUser(this.query.taskId)
    },
    beforeUpload(file) {
      const isLt1M = file.size / 1024 / 1024 < 1
@@ -478,6 +483,25 @@
      //     // 生成表单加载
      //     this.generateLoading = false
      // })
    },
    unPick(e) {
      crudTaskUser.addTaskUser({ 'TaskId': e.id }).then(res => {
        if (res === 1) {
          this.$notify({
            title: '获取成功',
            type: 'success',
            duration: 2500
          })
          window.location.reload()
        } else {
          this.$notify({
            title: '获取失败',
            type: 'error',
            duration: 2500
          })
        }
      })
    }
  }
}