certificate.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  1. <template>
  2. <basic-container class="certificate-monitor-container">
  3. <div class="title-box">
  4. <div
  5. v-if="status != null"
  6. class="tag"
  7. :style="{ background: status ? '#67C23B' : '#949494' }"
  8. >
  9. {{ status ? "正在运行" : "已停止" }}
  10. </div>
  11. <div class="box-title">电签队列详情</div>
  12. </div>
  13. <div class="table-box">
  14. <div class="search-box">
  15. <el-select
  16. size="small"
  17. v-model="query.type"
  18. filterable
  19. style="width: 150px"
  20. placeholder="所属系统"
  21. clearable
  22. >
  23. <el-option label="质检" :value="1"> </el-option>
  24. <el-option label="试验" :value="2"> </el-option>
  25. </el-select>
  26. <el-select
  27. size="small"
  28. v-model="query.projectId"
  29. filterable
  30. style="width: 200px"
  31. placeholder="项目名称"
  32. clearable
  33. @change="(id) => queryContractList(id)"
  34. >
  35. <el-option
  36. v-for="item in projectOptions"
  37. :key="item.id"
  38. :label="item.projectName"
  39. :value="item.id"
  40. >
  41. </el-option>
  42. </el-select>
  43. <el-select
  44. size="small"
  45. v-model="query.contractId"
  46. filterable
  47. style="width: 200px"
  48. placeholder="合同段"
  49. clearable
  50. >
  51. <el-option
  52. v-for="item in contractOptions"
  53. :key="item.id"
  54. :label="item.contractName"
  55. :value="item.id"
  56. >
  57. </el-option>
  58. </el-select>
  59. <div>
  60. <el-input
  61. size="small"
  62. v-model="query.taskName"
  63. style="width: 240px; margin-right: 10px"
  64. placeholder="搜索任务名称/ID"
  65. clearable
  66. />
  67. <el-button type="primary" size="small" @click="listPage">
  68. 搜索
  69. </el-button>
  70. <el-button
  71. type="primary"
  72. size="small"
  73. @click="initSearch"
  74. icon="el-icon-refresh"
  75. >
  76. 数据刷新
  77. </el-button>
  78. </div>
  79. </div>
  80. <el-tabs v-model="query.taskType" @tab-click="listPage">
  81. <el-tab-pane :label="`正在处理(${runTotal})`" :name="1"></el-tab-pane>
  82. <el-tab-pane :label="`排队中(${orderTotal})`" :name="2"></el-tab-pane>
  83. </el-tabs>
  84. </div>
  85. <el-table
  86. class="martop20 tableList"
  87. :data="tableData"
  88. style="width: 100%"
  89. max-height="calc(100vh - 350px)"
  90. >
  91. <el-table-column type="index" label="序号" width="80"> </el-table-column>
  92. <el-table-column prop="type" label="所属系统" width="100">
  93. <template slot-scope="{ row }">
  94. <span v-if="row.type == 1">质检</span>
  95. <span v-else>试验</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column prop="projectName" label="项目名称" width="280">
  99. <template slot-scope="{ row }">
  100. <span style="color: #979797">{{ row.projectName }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column prop="contractName" label="合同段" width="150">
  104. <template slot-scope="{ row }">
  105. <span style="color: #979797">{{ row.contractName }}</span>
  106. </template>
  107. </el-table-column>
  108. <el-table-column prop="taskName" label="任务名称">
  109. <template slot-scope="{ row }">
  110. <span style="font-weight: bolder; color: #000">
  111. {{ row.taskName }}
  112. </span>
  113. </template>
  114. </el-table-column>
  115. <el-table-column prop="userName" label="任务人" width="120">
  116. <template slot-scope="{ row }">
  117. <span style="font-weight: bolder; color: #000">
  118. {{ row.userName }}
  119. </span>
  120. </template>
  121. </el-table-column>
  122. <el-table-column prop="signType" label="任务类型" width="120">
  123. <template slot-scope="{ row }">
  124. <div
  125. class="task-tag"
  126. :style="{ background: row.type == 1 ? '#DCEAFE' : '#DCFCE7',color: row.type == 1 ? '#3973ED' : '#16A34A' }"
  127. >
  128. {{ row.type == 1 ? "个人证书" : "企业证书" }}
  129. </div>
  130. </template>
  131. </el-table-column>
  132. <el-table-column prop="createTime" label="任务开始时间" width="120">
  133. </el-table-column>
  134. <el-table-column
  135. v-if="query.taskType == 1"
  136. prop="startTime"
  137. label="电签开始时间"
  138. width="120"
  139. >
  140. </el-table-column>
  141. <el-table-column prop="finishTime" label="预计完成时间" width="120">
  142. </el-table-column>
  143. </el-table>
  144. <el-pagination
  145. v-if="query.taskType == 2"
  146. hide-on-single-page
  147. style="float: right"
  148. background
  149. class="martop20 marbottom20"
  150. layout="total, prev, pager, next, jumper, sizes"
  151. :total="orderTotal"
  152. @size-change="handleSizeChange"
  153. @current-change="handleCurrentChange"
  154. :current-page="query.pageIndex"
  155. :page-size="query.pageSize"
  156. >
  157. </el-pagination>
  158. </basic-container>
  159. </template>
  160. <script>
  161. import {
  162. getTaskBatchCount,
  163. getTaskBatchPage,
  164. getTaskBatchPageOrder,
  165. queryProjectList,
  166. } from "@/api/certificate/list";
  167. import { findContractByProjectId } from "@/api/manager/contractinfo";
  168. export default {
  169. data() {
  170. return {
  171. query: {
  172. pageIndex: 1,
  173. pageSize: 20,
  174. contractId: null,
  175. projectId: null,
  176. taskName: "",
  177. taskType: 1,
  178. type: null,
  179. },
  180. projectOptions: [],
  181. contractOptions: [],
  182. tableData: [],
  183. orderTotal: 0,
  184. runTotal: 0,
  185. status: null,
  186. };
  187. },
  188. created() {
  189. this.init();
  190. },
  191. methods: {
  192. init() {
  193. this.queryProjectList();
  194. this.getCount();
  195. this.listPage();
  196. },
  197. async getCount() {
  198. const { data: res } = await getTaskBatchCount({
  199. projectId: this.query.projectId,
  200. contractId: this.query.contractId,
  201. type: this.query.type,
  202. taskName: this.query.taskName,
  203. });
  204. this.orderTotal = res.data.orderTotal;
  205. this.runTotal = res.data.runTotal;
  206. this.status = res.data.status;
  207. },
  208. async queryProjectList() {
  209. const { data: res } = await queryProjectList();
  210. if (res.code == 200) {
  211. this.projectOptions = res.data;
  212. }
  213. },
  214. // 根据项目ID获取合同段选项
  215. async queryContractList(pId) {
  216. const { data: res } = await findContractByProjectId(pId);
  217. if (res.code === 200) {
  218. this.contractOptions = res.data;
  219. }
  220. },
  221. handleSizeChange(val) {
  222. this.query.pageSize = val;
  223. this.listPage();
  224. },
  225. handleCurrentChange(val) {
  226. this.query.pageIndex = val;
  227. this.listPage();
  228. },
  229. taskTypeChange(el) {
  230. this.query.taskType = el.name;
  231. this.listPage();
  232. },
  233. initSearch() {
  234. this.query = {
  235. ...this.query,
  236. pageIndex: 1,
  237. pageSize: 20,
  238. contractId: null,
  239. projectId: null,
  240. taskName: "",
  241. type: null,
  242. };
  243. this.listPage();
  244. this.getCount();
  245. },
  246. async listPage() {
  247. if (this.query.taskType == 1) {
  248. this.listPageRun();
  249. } else {
  250. this.listPageOrder();
  251. }
  252. },
  253. async listPageRun() {
  254. const { data: res } = await getTaskBatchPage({
  255. projectId: this.query.projectId,
  256. contractId: this.query.contractId,
  257. type: this.query.type,
  258. taskType: this.query.taskType,
  259. taskName: this.query.taskName,
  260. });
  261. if (res.code === 200) {
  262. this.tableData = res.data;
  263. this.runTotal = res.data.length;
  264. }
  265. },
  266. async listPageOrder() {
  267. //分页获取证书列表数据
  268. const { data: res } = await getTaskBatchPageOrder({
  269. current: this.query.pageIndex,
  270. size: this.query.pageSize,
  271. projectId: this.query.projectId,
  272. contractId: this.query.contractId,
  273. type: this.query.type,
  274. taskType: this.query.taskType,
  275. taskName: this.query.taskName,
  276. });
  277. if (res.code === 200) {
  278. this.tableData = res.data.records;
  279. this.orderTotal = res.data.total;
  280. }
  281. },
  282. },
  283. };
  284. </script>
  285. <style lang="scss" scoped>
  286. .certificate-monitor-container {
  287. .title-box {
  288. display: flex;
  289. align-items: center;
  290. margin-bottom: 12px;
  291. .tag {
  292. padding: 6px 12px;
  293. font-size: 12px;
  294. color: #fff;
  295. border-radius: 20px;
  296. line-height: 1;
  297. }
  298. .box-title {
  299. font-size: 20px;
  300. font-weight: 700;
  301. margin-left: 10px;
  302. }
  303. }
  304. .table-box {
  305. position: relative;
  306. .search-box {
  307. position: absolute;
  308. z-index: 1;
  309. right: 0;
  310. display: flex;
  311. align-items: center;
  312. gap: 10px;
  313. }
  314. }
  315. }
  316. .task-tag {
  317. width: 80px;
  318. padding: 4px 4px;
  319. border-radius: 30px;
  320. color: #fff;
  321. text-align: center;
  322. font-size: 14px;
  323. }
  324. // .tableList {
  325. // ::v-deep th.el-table__cell {
  326. // font-size: 16px !important;
  327. // }
  328. // }
  329. </style>