createTask.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <!-- 创建挖掘任务弹窗 -->
  3. <div class="createTask">
  4. <el-dialog :title="title" :visible.sync="dialogVisible" width="500px" :before-close="handleClose"
  5. :append-to-body="true" :close-on-click-modal="false">
  6. <el-form :model="form" status-icon :rules="rules" ref="form" label-width="120px" class="demo-ruleForm">
  7. <el-form-item label="任务名称:" prop="name">
  8. <el-input v-model="form.name" placeholder="请输入任务名称" :disabled="form.id ? true : false"></el-input>
  9. </el-form-item>
  10. <el-form-item v-if="form.type != 1" label="任务流程:" prop="processId">
  11. <el-select v-model="form.processId" placeholder="请选择流程" style="width: 100%;" :disabled="form.id ? true : false">
  12. <el-option v-for="item in pathOptions" :key="item.value" :label="item.label" :value="item.value">
  13. </el-option>
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item label="处理人:" prop="handler">
  17. <el-select v-model="form.handler" placeholder="请选择处理人" style="width: 100%;" filterable remote
  18. :remote-method="remoteMethodPerson" v-SelectLazyLoading="lazyLoadingPerson" :loading="personnelList.loading">
  19. <el-option v-for="item in personnelList.data" :key="item.id" :label="item.name" :value="item.id">
  20. </el-option>
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="截止时间:" prop="deadLineTime">
  24. <el-date-picker style="width: 100%" v-model="form.deadLineTime" type="datetime"
  25. value-format="yyyy-MM-dd HH:mm:ss" placeholder="请选择截止日期时间">
  26. </el-date-picker>
  27. </el-form-item>
  28. <el-form-item label="备注:">
  29. <el-input type="textarea" :rows="3" placeholder="请输入内容" v-model="form.description"></el-input>
  30. </el-form-item>
  31. </el-form>
  32. <span slot="footer" class="dialog-footer">
  33. <el-button @click="handleClose">取 消</el-button>
  34. <el-button type="primary" @click="submit">确 定</el-button>
  35. </span>
  36. </el-dialog>
  37. </div>
  38. </template>
  39. <script>
  40. import { personnelLoading, optionsData } from '../mixins/index2'
  41. export default {
  42. mixins: [personnelLoading, optionsData],
  43. components: {},
  44. props: ['projectId', 'processId'],
  45. data() {
  46. return {
  47. dialogVisible: false,
  48. title: '',
  49. form: {},
  50. rules: {},
  51. personOptions: [],//处理人
  52. rules: {
  53. name: [{ required: true, message: '请输入任务名称', trigger: 'blur' },],
  54. processId: [{ required: true, message: '请选择流程', trigger: 'change' },],
  55. handler: [{ required: true, message: '请选择处理人', trigger: 'change' },],
  56. deadLineTime: [{ required: true, message: '请选择截止时间', trigger: 'change' },],
  57. }
  58. };
  59. },
  60. watch: {},
  61. computed: {},
  62. created() { },
  63. mounted() { },
  64. methods: {
  65. //打开弹窗
  66. async open(data) {
  67. if (data.type == 6 || data.type == 5 || data.type == 1 || data.type == 7) {
  68. if (data.type == 6) {
  69. this.title = '编辑文件分配任务'
  70. } else if (data.type == 5) {
  71. this.title = '编辑任务审核任务'
  72. } else if (data.type == 7) {
  73. this.title = '编辑文件审核任务'
  74. } else {
  75. this.title = '编辑项目开卷审核任务'
  76. }
  77. this.form = JSON.parse(JSON.stringify(data))
  78. // 负责人
  79. if (this.form.handler) {
  80. this.personnelList.queryParams.id = this.form.handler
  81. await this.getPermissionPersonnel(1)
  82. this.personnelList.queryParams.id = null
  83. }
  84. } else {//创建分配任务
  85. this.title = '创建文件分配任务'
  86. this.form.projectId = this.projectId//项目id
  87. this.form.processId = this.processId
  88. this.form.type = 6//分配任务
  89. this.form.handlerType = 0//0内部人员1外部人员
  90. }
  91. this.getPermissionPersonnel()
  92. this.dialogVisible = true
  93. },
  94. //关闭弹窗
  95. handleClose() {
  96. this.$refs.form.resetFields()
  97. this.form = {}
  98. this.clear()
  99. this.dialogVisible = false
  100. },
  101. clear() {
  102. this.personnelList.data = []
  103. this.personnelList.queryParams.current = 1
  104. this.personnelList.queryParams.total = 0
  105. this.personnelList.queryParams.name = null
  106. },
  107. //提交数据
  108. submit() {
  109. this.$refs.form.validate((valid) => {
  110. if (valid) {
  111. if (!this.form.id) {//新增分配任务
  112. this.$api.addTask(this.form).then(res => {
  113. if (res.code == 200) {
  114. this.$message.success('创建文件分配任务成功')
  115. this.$emit('isCreate', '新增成功')
  116. this.handleClose()
  117. }
  118. })
  119. } else {
  120. this.$api.updateTask(this.form).then(res => {
  121. if (res.code == 200) {
  122. this.$message.success('编辑任务成功')
  123. this.$emit('isCreate', '编辑成功')
  124. this.handleClose()
  125. }
  126. })
  127. }
  128. } else {
  129. this.$message.error('信息未输入完整')
  130. }
  131. });
  132. }
  133. },
  134. };
  135. </script>
  136. <style lang="scss" scoped></style>