sign-admin.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <template>
  2. <div class="hc-layout-box">
  3. <HcCard :scrollbar="false" action-size="lg">
  4. <template #header>
  5. <div class="w-64">
  6. <el-input
  7. v-model="searchForm.evisaUserName" block clearable placeholder="请输入用户名称检索"
  8. size="large" @keyup="keyUpEvent"
  9. />
  10. </div>
  11. <div class="w-32 ml-3">
  12. <el-select
  13. v-model="searchForm.contractId" block clearable placeholder="合同段" size="large"
  14. @change="ContractIdChange"
  15. >
  16. <el-option v-for="item in contractList" :key="item.id" :label="item.name" :value="item.id" />
  17. </el-select>
  18. </div>
  19. <div class="w-64 ml-3">
  20. <HcDatePicker :dates="betweenTime" clearable size="large" @change="betweenTimeUpdate" />
  21. </div>
  22. <div class="w-56 ml-3">
  23. <el-input
  24. v-model="searchForm.queryValue" block clearable placeholder="请输入名称关键词检索"
  25. size="large" @keyup="keyUpEvent"
  26. />
  27. </div>
  28. <div class="ml-2">
  29. <el-button size="large" type="primary" @click="searchClick">
  30. <HcIcon name="search-2" />
  31. <span>搜索</span>
  32. </el-button>
  33. </div>
  34. </template>
  35. <template #extra>
  36. <HcTooltip keys="tasks_sign_key_renewal">
  37. <el-button hc-btn type="primary" :loading="resignLoading" :disabled="tableCheckedKeys.length == 0" @click="resignClick">
  38. <HcIcon name="restart" />
  39. <span>一键重签</span>
  40. </el-button>
  41. </HcTooltip>
  42. </template>
  43. <HcTable
  44. ref="tableListRef" :column="tableListColumn" :datas="tableData" :loading="tableLoading" is-check
  45. @selection-change="tableSelectionChange"
  46. >
  47. <template #taskStatusName="{ row }">
  48. <el-tag
  49. v-if="row?.taskStatusName"
  50. :type="`${row.taskStatusName === '已审批' ? 'success' : row.taskStatusName === '已废除' ? 'warning' : 'info'}`" class="mx-1" effect="dark"
  51. >
  52. {{ row.taskStatusName }}
  53. </el-tag>
  54. </template>
  55. <template #taskApproveUserNamesList="{ row }">
  56. <template v-for="item in row.taskApproveUserNamesList">
  57. <el-tag
  58. v-if="item.taskUserName"
  59. :type="`${item.evisaStatus === 2 ? 'success' : item.evisaStatus === 3 ? 'warning' : item.evisaStatus === 999 ? 'danger' : 'info'}`" class="mx-1" effect="dark"
  60. >
  61. {{ item.taskUserName }}
  62. </el-tag>
  63. </template>
  64. </template>
  65. </HcTable>
  66. <template #action>
  67. <HcPages :pages="searchForm" @change="pageChange" />
  68. </template>
  69. </HcCard>
  70. </div>
  71. </template>
  72. <script setup>
  73. import { onMounted, ref } from 'vue'
  74. import { useAppStore } from '~src/store'
  75. import { arrToId, getArrValue, getObjValue } from 'js-fast-way'
  76. import signApi from '~api/tasks/sign'
  77. //变量
  78. const useAppState = useAppStore()
  79. const projectId = ref(useAppState.getProjectId)
  80. const contractId = ref(useAppState.getContractId)
  81. const projectInfo = ref(useAppState.getProjectInfo)
  82. //渲染完成
  83. onMounted(() => {
  84. const project = getObjValue(projectInfo.value)
  85. contractList.value = getArrValue(project['contractInfoList'])
  86. if (contractList.value.length > 0) {
  87. searchForm.value.contractId = contractList.value[0].id
  88. }
  89. getTableData()
  90. })
  91. const tasksData = ref([])
  92. const statusData = ref([])
  93. //合同段
  94. const contractList = ref([])
  95. const ContractIdChange = () => {
  96. getTableData()
  97. }
  98. //日期时间被选择
  99. const betweenTime = ref(null)
  100. const betweenTimeUpdate = ({ val, arr }) => {
  101. betweenTime.value = arr
  102. searchForm.value.startTimeValue = val['start']
  103. searchForm.value.endTimeValue = val['end']
  104. }
  105. //搜索表单
  106. const searchForm = ref({
  107. queryValue: null, evisaUserName: null, contractId: null, startTimeValue: null, endTimeValue: null,
  108. current: 1, size: 20, total: 0,
  109. })
  110. //回车搜索
  111. const keyUpEvent = (e) => {
  112. if (e.key === 'Enter') {
  113. searchForm.value.current = 1
  114. getTableData()
  115. }
  116. }
  117. //重新搜索数据
  118. const searchClick = () => {
  119. searchForm.value.current = 1
  120. getTableData()
  121. }
  122. //分页被点击
  123. const pageChange = ({ current, size }) => {
  124. searchForm.value.current = current
  125. searchForm.value.size = size
  126. getTableData()
  127. }
  128. //获取数据
  129. const tableLoading = ref(false)
  130. const tableData = ref([])
  131. const getTableData = async () => {
  132. tableLoading.value = true
  133. const { error, code, data } = await signApi.eVisaFailedPage({
  134. ...searchForm.value,
  135. })
  136. //判断状态
  137. tableLoading.value = false
  138. if (!error && code === 200) {
  139. tableData.value = getArrValue(data['records'])
  140. searchForm.value.total = data['total'] || 0
  141. } else {
  142. tableData.value = []
  143. searchForm.value.total = 0
  144. }
  145. }
  146. //多选
  147. const tableListRef = ref(null)
  148. const tableCheckedKeys = ref([])
  149. const tableSelectionChange = (rows) => {
  150. tableCheckedKeys.value = rows.filter((item) => {
  151. return (item ?? '') !== ''
  152. })
  153. }
  154. const tableListColumn = ref([
  155. { key: 'taskName', name: '流程名称' },
  156. { key: 'taskStatusName', name: '任务状态' },
  157. { key: 'evisaStatusName', name: '电签状态' },
  158. { key: 'evisaUpdateDate', name: '审批时间' },
  159. { key: 'evisaFailedInfo', name: '电签失败原因' },
  160. { key: 'taskReportUserName', name: '上报人' },
  161. { key: 'taskApproveUserNamesList', name: '电签任务人' },
  162. ])
  163. //一键重签
  164. const resignLoading = ref(false)
  165. const resignClick = async ()=>{
  166. const taskIds = arrToId(tableCheckedKeys.value)
  167. resignLoading.value = true
  168. const { error, code, msg } = await signApi.reSigningEVisa({
  169. contractId:searchForm.value.contractId,
  170. projectId:projectId.value,
  171. taskIds:taskIds,
  172. })
  173. //判断状态
  174. resignLoading.value = false
  175. if (!error && code === 200) {
  176. window.$message.success(msg)
  177. getTableData()
  178. }
  179. }
  180. </script>
  181. <style lang="scss" scoped>
  182. .hc-layout-box {
  183. position: relative;
  184. height: 100%;
  185. }
  186. </style>