yao-zengchun
2025-05-30 9ef4318fc20a9f1f8d22bb21eba6815d173fbde0
eladmin-web-master/src/views/task/taskUser/index.vue
@@ -317,9 +317,19 @@
              size="mini"
              type="primary"
              icon="el-icon-tickets"
              style="margin-right: 60px;"
              style="margin-right: 6px;"
              @click="adventTesk()"
            >临期任务</el-button>
            <el-button
              slot="right"
              class="filter-item"
              size="mini"
              type="primary"
              icon="el-icon-plus"
              :disabled="crud.selections.length !== 1"
              style="margin-right: 6px;"
              @click="toReviewTask()"
            >新建复核</el-button>
          </crudOperation>
          <div>
            <span>
@@ -389,6 +399,9 @@
                :disabled="true"
                style="width: 340px;"
              />
            </el-form-item>
            <el-form-item v-show="form.rid !== null" label="复核对象" prop="rname">
              <el-input v-model="form.rname" disabled style="width: 340px;" />
            </el-form-item>
            <el-form-item label="任务名称">
              <el-input v-model="form.name" style="width: 340px;" />
@@ -645,7 +658,7 @@
            <el-button type="primary" @click="doTaskCompleted">确 定</el-button>
          </span>
        </el-dialog>
        <!--表单组件-->
        <!--导入任务分配信息-->
        <el-dialog
          :close-on-click-modal="false"
          :before-close="closeGenerate"
@@ -690,20 +703,16 @@
import crudTaskUser from '@/api/task/taskUser'
import crudTask from '@/api/task/task'
import crudUser from '@/api/system/user'
import crudUserInsurance from '@/api/treatment/userInsurance'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker'
import Treeselect from '@riophae/vue-treeselect'
import { mapGetters } from 'vuex'
import constant from '@/utils/constant'
import UploadExcelComponent from '@/components/UploadExcel/index.vue'
import UploadExcelComponentTwo from '@/components/UploadExcel/excelIndex.vue'
import { transformData, formatExcelDate } from '@/utils/trans'
import { parseTime, downloadFile } from '@/utils/index'
import { downloadFile } from '@/utils/index'
const defaultForm = {
  id: null,
  name: null,
@@ -719,19 +728,17 @@
  remarks: null,
  divideUserIds: [],
  is_ok: null,
  uid: null
  uid: null,
  rid: null,
  rname: null
}
export default {
  name: 'TaskUser',
  // eslint-disable-next-line vue/no-unused-components
  components: {
    Treeselect,
    crudOperation,
    rrOperation,
    udOperation,
    pagination,
    DateRangePicker,
    UploadExcelComponent,
    UploadExcelComponentTwo
  },
  cruds() {
@@ -852,7 +859,12 @@
      slong: false,
      taskSo: constant.TASK_STATUS_UNRECOGNIZED,
      taskSt: constant.TASK_STATUS_COMPLETED,
      taskStatusOne: ''
      taskStatusOne: '',
      // 复核任务参数
      reviewTaskParams: {
        rid: null,
        rname: null
      }
    }
  },
  computed: {
@@ -880,13 +892,23 @@
      this.form.performanceHours = null
      this.form.start = false
    },
    // 新建之前
    [CRUD.HOOK.beforeToAdd]() {
      const that = this
      if (that.reviewTaskParams.rid !== null) {
        that.$set(that.form, 'rid', that.reviewTaskParams.rid)
        that.$set(that.form, 'rname', that.reviewTaskParams.rname)
        that.$set(that.form, 'name', that.reviewTaskParams.rname + '(复核)')
      }
      return true
    },
    // 编辑之前
    [CRUD.HOOK.beforeToEdit]() {
      if (this.form.taskStatus == this.taskSo) {
      if (this.form.taskStatus === this.taskSo) {
        this.form.is_ok = false
        this.taskStatusOne = '未承认'
      }
      if (this.form.taskStatus == this.taskSt) {
      if (this.form.taskStatus === this.taskSt) {
        this.form.is_ok = true
        this.taskStatusOne = '已完成'
      }
@@ -903,11 +925,25 @@
      this.form.performanceHours = null
      this.form.start = false
    },
    // 取消新建之前
    [CRUD.HOOK.beforeAddCancel]() {
      const that = this
      that.$set(that.reviewTaskParams, 'rid', null)
      that.$set(that.reviewTaskParams, 'rname', null)
      return true
    },
    [CRUD.HOOK.afterAddCancel]() {
      this.formTasks = []
      this.form.name = null
      this.form.performanceHours = null
      this.form.start = false
    },
    // 提交之后
    [CRUD.HOOK.afterSubmit]() {
      const that = this
      that.$set(that.reviewTaskParams, 'rid', null)
      that.$set(that.reviewTaskParams, 'rname', null)
      return true
    },
    [CRUD.HOOK.afterAddError]() {
      this.formTasks = []
@@ -949,10 +985,10 @@
    handleChange(value) {
      if (value) {
        this.taskStatusOne = '已完成'
        this.form.taskStatus == this.taskSt
        this.form.taskStatus === this.taskSt
      } else {
        this.taskStatusOne = '未承认'
        this.form.taskStatus == this.taskSo
        this.form.taskStatus === this.taskSo
      }
    },
    checkStartTime(time) {
@@ -1052,7 +1088,7 @@
          this.slong = false
          this.crud.notify('生成成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
        })
        .catch(error => {
        .catch(() => {
          this.slong = false
          this.crud.notify('生成失败', CRUD.NOTIFICATION_TYPE.ERROR)
        })
@@ -1118,17 +1154,28 @@
      this.generateForm = results
      this.generateForm = results.map(item => {
        const {
          所属员工ID: _,
          任务状态ID: ___,
          优先度ID: __,
          隔绝列1: ____,
          隔绝列2: _____,
          隔绝列3: ______,
          隔绝列4: _______,
          隔绝列5: ________,
          隔绝列6: _________,
          隔绝列7: __________,
          隔绝列8: ____________,
          // eslint-disable-next-line no-unused-vars
          所属员工ID,
          // eslint-disable-next-line no-unused-vars
          任务状态ID,
          // eslint-disable-next-line no-unused-vars
          优先度ID,
          // eslint-disable-next-line no-unused-vars
          隔绝列1,
          // eslint-disable-next-line no-unused-vars
          隔绝列2,
          // eslint-disable-next-line no-unused-vars
          隔绝列3,
          // eslint-disable-next-line no-unused-vars
          隔绝列4,
          // eslint-disable-next-line no-unused-vars
          隔绝列5,
          // eslint-disable-next-line no-unused-vars
          隔绝列6,
          // eslint-disable-next-line no-unused-vars
          隔绝列7,
          // eslint-disable-next-line no-unused-vars
          隔绝列8,
          ...newItem
        } = item
        if ('任务开始时间' in newItem) {
@@ -1231,7 +1278,7 @@
          this.crud.toQuery()
          this.crud.notify('导入成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
        })
        .catch(err => {
        .catch(() => {
          this.uploading = false
          // 生成表单加载
          this.generateLoading = false
@@ -1360,6 +1407,17 @@
    },
    formatTaskProgress(percentage) {
      return percentage === 100 ? '实际消耗已超出计划时长' : `${percentage}%`
    },
    // 开启新建复核
    toReviewTask() {
      const that = this
      if (that.crud.selections[0].rid === undefined || that.crud.selections[0].rid === null) {
        that.$set(that.reviewTaskParams, 'rid', that.crud.selections[0].id)
        that.$set(that.reviewTaskParams, 'rname', that.crud.selections[0].name)
        that.crud.toAdd()
      } else {
        that.$message.warning('复核任务下不可创建复核任务')
      }
    }
  }
}