hc-data.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. <template>
  2. <hc-tab-card :tabs="tabsData" :tab-key="tabsKey" @change="tabsClick">
  3. <!-- template v-if="tabsKey === '1'" #extra>
  4. <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn type="primary" @click="batchApprovalTaskClick">批量审批</el-button>
  5. </template -->
  6. <template #search>
  7. <div class="w-32">
  8. <el-select v-model="searchForm.typeValue" clearable block placeholder="任务类型">
  9. <el-option v-for="item in tasksType" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  10. </el-select>
  11. </div>
  12. <div class="ml-2 w-32">
  13. <el-select v-model="searchForm.statusValue" clearable block placeholder="任务状态">
  14. <el-option v-for="item in tasksStatus" :key="item.dictKey" :label="item.dictValue" :value="item.dictKey" />
  15. </el-select>
  16. </div>
  17. <div class="ml-2 w-32">
  18. <el-select v-model="searchForm.batchValue" clearable block placeholder="上报批次">
  19. <!-- el-option v-for="item in reportBatch" :label="item.batch" :value="item.batch" / -->
  20. </el-select>
  21. </div>
  22. <div class="ml-2 w-64">
  23. <hc-date-picker :dates="betweenTime" clearable @change="betweenTimeUpdate" />
  24. </div>
  25. <hc-search-input v-model="searchForm.queryValue" class="ml-2" placeholder="请输入名称关键词检索" @search="searchClick" />
  26. </template>
  27. <hc-table
  28. ref="tableListRef" :column="tableListColumn" :datas="tableListData" :loading="tableLoading"
  29. is-new is-check :check-style="{ width: 29 }" :index-style="{ width: 60 }"
  30. @selection-change="tableSelectionChange"
  31. >
  32. <template #taskName="{ row }">
  33. <span class="text-link" @click="rowTaskName(row)">{{ row?.taskName }}</span>
  34. </template>
  35. <template #taskStatusName="{ row }">
  36. <HcTaskTag :name="row.taskStatusName" :type="`${row.taskStatusName === '已审批' ? 'success' : row.taskStatusName === '已废除' ? 'warning' : 'info'}`" />
  37. </template>
  38. <template #taskApproveUserNamesList="{ row }">
  39. <template v-for="(item, index) in row.taskApproveUserNamesList" :key="index">
  40. <HcTaskTag :name="row.taskUserName" :type="`${item.evisaStatus === 2 ? 'success' : item.evisaStatus === 3 ? 'warning' : item.evisaStatus === 999 ? 'danger' : 'info'}`" />
  41. </template>
  42. </template>
  43. </hc-table>
  44. <template #action>
  45. <div class="lr-dialog-footer">
  46. <div class="left">
  47. <span class="text-success">审批人员中:</span>
  48. <el-tag class="mx-1" effect="dark" type="info">未签字</el-tag>
  49. <el-tag class="mx-1" effect="dark" type="success">已签字</el-tag>
  50. <el-tag class="mx-1" effect="dark" type="warning">已废除</el-tag>
  51. <el-tag class="mx-1" effect="dark" type="danger">签字异常</el-tag>
  52. </div>
  53. <div class="right">
  54. <hc-pages :pages="searchForm" :sizes="[50, 100, 150, 200, 300]" @change="pageChange" />
  55. </div>
  56. </div>
  57. </template>
  58. <!-- 任务审核 -->
  59. <taskReview v-model="isTaskReviewModalshow" :tabs="tabsKey" :row="taskReviewRow" />
  60. </hc-tab-card>
  61. </template>
  62. <script setup>
  63. import { nextTick, onMounted, ref } from 'vue'
  64. import { getArrValue } from 'js-fast-way'
  65. import mainApi from '~api/tasks/hc-data'
  66. import { useAppStore } from '~src/store'
  67. import taskReview from './components/hc-data/task-review.vue'
  68. import HcTaskTag from './components/hc-data/task-tag.vue'
  69. const useAppState = useAppStore()
  70. const projectId = ref(useAppState.getProjectId || '')
  71. const contractId = ref(useAppState.getContractId || '')
  72. //渲染完成
  73. onMounted(() => {
  74. queryTaskType()
  75. queryTaskStatus()
  76. getTableData()
  77. })
  78. //类型处理
  79. const tabsKey = ref('1')
  80. const tabsData = [
  81. { key: '1', name: '待办任务' },
  82. { key: '2', name: '已办任务' },
  83. { key: '3', name: '我发起的' },
  84. ]
  85. const tabsClick = ({ key }) => {
  86. tabsKey.value = key
  87. searchForm.value.selectedType = key
  88. searchForm.value.current = 1
  89. getTableData()
  90. }
  91. //搜索条件
  92. const searchForm = ref({
  93. selectedType: 1, typeValue: '', statusValue: '', batchValue: '', queryValue: '', startTimeValue: '', endTimeValue: '',
  94. current: 1, size: 100, total: 0,
  95. })
  96. //获取任务类型
  97. const tasksType = ref([])
  98. const queryTaskType = async () => {
  99. const { data } = await mainApi.queryTaskTypeStatus({ typeOrStatus: 'task_type' })
  100. tasksType.value = getArrValue(data)
  101. }
  102. //获取任务状态
  103. const tasksStatus = ref([])
  104. const queryTaskStatus = async () => {
  105. const { data } = await mainApi.queryTaskTypeStatus({ typeOrStatus: 'task_status' })
  106. tasksStatus.value = getArrValue(data)
  107. }
  108. //日期范围选择
  109. const betweenTime = ref(null)
  110. const betweenTimeUpdate = ({ val, arr }) => {
  111. betweenTime.value = arr
  112. searchForm.value.startTimeValue = val['start']
  113. searchForm.value.endTimeValue = val['end']
  114. }
  115. //搜索
  116. const searchClick = () => {
  117. searchForm.value.current = 1
  118. getTableData()
  119. }
  120. //分页被点击
  121. const pageChange = ({ current, size }) => {
  122. searchForm.value.current = current
  123. searchForm.value.size = size
  124. getTableData()
  125. }
  126. //获取数据
  127. const tableListRef = ref(null)
  128. const tableListColumn = ref([
  129. { key: 'taskName', name: '任务名称' },
  130. { key: 'taskTypeName', name: '任务类型', width: '120' },
  131. { key: 'taskStatusName', name: '任务状态', width: '120' },
  132. { key: 'startTime', name: '开始时间', width: '160' },
  133. { key: 'endTime', name: '限定时间', width: '160' },
  134. { key: 'taskDesc', name: '任务描述' },
  135. { key: 'taskReportUserName', name: '上报人', width: '120' },
  136. { key: 'taskApproveUserNames', name: '签字人员' },
  137. { key: 'evisaStatus', name: '电签状态', width: '120' },
  138. ])
  139. const tableListData = ref([])
  140. //获取表格数据
  141. const tableLoading = ref(false)
  142. const getTableData = async () => {
  143. tableLoading.value = true
  144. //清空数据
  145. tableListData.value = []
  146. tableListRef.value?.clearSelection()
  147. tableCheckedKeys.value = []
  148. //发起请求
  149. const { error, code, data } = await mainApi.getPage({
  150. ...searchForm.value,
  151. projectId: projectId.value,
  152. contractId: contractId.value,
  153. })
  154. //处理数据
  155. tableLoading.value = false
  156. if (!error && code === 200) {
  157. tableListData.value = getArrValue(data['records'])
  158. searchForm.value.total = data.total || 0
  159. } else {
  160. tableListData.value = []
  161. searchForm.value.total = 0
  162. }
  163. }
  164. //多选
  165. const tableCheckedKeys = ref([])
  166. const tableSelectionChange = (rows) => {
  167. tableCheckedKeys.value = rows
  168. }
  169. //任务名称被点击
  170. const taskReviewRow = ref({})
  171. const isTaskReviewModalshow = ref(false)
  172. const rowTaskName = (row) => {
  173. taskReviewRow.value = row
  174. nextTick(() => {
  175. isTaskReviewModalshow.value = true
  176. })
  177. }
  178. //批量审批
  179. const batchApprovalTaskClick = () => {
  180. }
  181. </script>