sign-admin.vue 7.6 KB

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