query.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. <template>
  2. <div class="hc-layout-box">
  3. <div id="wbs-left-tree" :style="`width:${leftWidth}px;`" class="hc-layout-left-box">
  4. <div class="hc-project-box">
  5. <div class="hc-project-icon-box">
  6. <HcIcon name="stack" />
  7. </div>
  8. <div class="ml-2 project-name-box">
  9. <span class="text-xl text-cut project-alias">{{ projectInfo.projectAlias }}</span>
  10. <div class="text-xs text-cut project-name">
  11. {{ projectInfo.name }}
  12. </div>
  13. </div>
  14. </div>
  15. <div class="hc-tree-box">
  16. <div class="hc-search-tree-val">
  17. <el-input
  18. v-model="searchTreeVal" block clearable placeholder="请输入名称关键词检索" size="large"
  19. @keyup="searchTreeKeyUp"
  20. >
  21. <template #suffix>
  22. <HcIcon name="search-2" ui="text-xl iscusor" @click="searchTreeClick" />
  23. </template>
  24. </el-input>
  25. </div>
  26. <div
  27. id="hc-tree-scrollbar" v-loading="treeLoading" class="hc-tree-scrollbar"
  28. element-loading-text="获取数据中..."
  29. >
  30. <!-- <HcTreeV2
  31. :isShow="isSearchTree"
  32. :datas="searchTreeData"
  33. :height="searchTreeHeight"
  34. :searchVal="searchTreeVal"
  35. isCounts
  36. isType
  37. @nodeTap="wbsElTreeClick"
  38. /> -->
  39. <el-scrollbar v-show="isSearchTree" class="scroll-bar-right-16">
  40. <HcDataTree
  41. :datas="searchTreeData"
  42. is-counts
  43. is-type
  44. :auto-expand-keys="treeAutoExpandKeys"
  45. default-expand-all
  46. @nodeTap="wbsElTreeClick"
  47. />
  48. </el-scrollbar>
  49. <el-scrollbar v-show="!isSearchTree" class="scroll-bar-right-16">
  50. <HcLazyTree
  51. ref="wbstree"
  52. :auto-expand-keys="treeAutoExpandKeys"
  53. is-counts
  54. is-type
  55. @load="treeLoadNode"
  56. @nodeTap="wbsElTreeClick"
  57. />
  58. </el-scrollbar>
  59. </div>
  60. </div>
  61. <div class="hc-tree-foot-tip-box">
  62. <div class="dot-view green">
  63. 已审批
  64. </div>
  65. <div class="dot-view black">
  66. 未填报
  67. </div>
  68. <div class="dot-view orange">
  69. 已填报-待审批
  70. </div>
  71. <div class="dot-view blue">
  72. 已填报-未上报
  73. </div>
  74. </div>
  75. <!-- 左右拖动 -->
  76. <div class="horizontal-drag-line" @mousedown="onmousedown" />
  77. </div>
  78. <div class="hc-layout-content-box">
  79. <HcCard :scrollbar="false" action-size="lg">
  80. <template #header>
  81. <HcTooltip keys="query_report">
  82. <el-button
  83. :disabled="tableCheckedKeys.length <= 0" :loading="reportLoading" hc-btn
  84. type="primary" @click="reportModalClick"
  85. >
  86. <HcIcon name="send-plane-2" />
  87. <span>上报</span>
  88. </el-button>
  89. </HcTooltip>
  90. <HcTooltip keys="query_download">
  91. <el-button
  92. :disabled="tableCheckedKeys.length <= 0" :loading="downloadLoading" hc-btn
  93. @click="batchDownload"
  94. >
  95. <HcIcon name="download" />
  96. <span>下载</span>
  97. </el-button>
  98. </HcTooltip>
  99. <HcTooltip keys="query_print">
  100. <el-button
  101. :disabled="tableCheckedKeys.length <= 0" :loading="printLoading" hc-btn
  102. @click="batchPrint"
  103. >
  104. <HcIcon name="printer" />
  105. <span>打印</span>
  106. </el-button>
  107. </HcTooltip>
  108. <HcTooltip keys="query_abolish">
  109. <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn @click="batchAbolishClick">
  110. <HcIcon name="delete-bin-3" />
  111. <span>废除</span>
  112. </el-button>
  113. </HcTooltip>
  114. <HcTooltip keys="query_local_attestation">
  115. <el-button
  116. :disabled="tableCheckedKeys.length <= 0" :loading="localLoading" hc-btn
  117. @click="batchLocal"
  118. >
  119. <HcIcon name="folder-download" />
  120. <span>本地验签</span>
  121. </el-button>
  122. </HcTooltip>
  123. <HcTooltip keys="query_online_attestation">
  124. <el-button
  125. :disabled="tableCheckedKeys.length <= 0" :loading="onlineLoading" hc-btn
  126. @click="batchOnline"
  127. >
  128. <HcIcon name="cloud" />
  129. <span>在线验签</span>
  130. </el-button>
  131. </HcTooltip>
  132. </template>
  133. <template #search>
  134. <div class="flex items-center">
  135. <div class="w-40">
  136. <el-select v-model="searchForm.taskStatus" clearable placeholder="流程状态">
  137. <el-option
  138. v-for="item in processStatusData" :key="item.value"
  139. :label="item.dictValue" :value="item.dictKey"
  140. />
  141. </el-select>
  142. </div>
  143. <div class="w-40 ml-2">
  144. <el-select v-model="searchForm.fileUserIdAndName" clearable placeholder="填报人">
  145. <el-option
  146. v-for="item in reportingPersonData" :key="item.value" :label="item.label"
  147. :value="item.value"
  148. />
  149. </el-select>
  150. </div>
  151. <div class="w-40 ml-2">
  152. <el-select v-model="searchForm.sourceType" clearable placeholder="文件类型">
  153. <el-option
  154. v-for="item in fileTypeData" :key="item.value" :label="item.dictValue"
  155. :value="item.dictKey"
  156. />
  157. </el-select>
  158. </div>
  159. <div class="w-32 ml-2">
  160. <el-select v-model="searchForm.reportNumber" clearable placeholder="上报批次">
  161. <el-option v-for="item in reportBatchData" :key="item" :label="item" :value="item" />
  162. </el-select>
  163. </div>
  164. <div class="w-64 ml-2">
  165. <HcDatePicker :dates="betweenTime" clearable @change="betweenTimeUpdate" />
  166. </div>
  167. <div class="w-60 ml-2">
  168. <el-input
  169. v-model="searchForm.queryValue" clearable placeholder="请输入名称关键词检索"
  170. @keyup="keyUpEvent"
  171. />
  172. </div>
  173. <div class="ml-2">
  174. <el-button type="primary" @click="searchClick">
  175. <HcIcon name="search-2" />
  176. <span>搜索</span>
  177. </el-button>
  178. </div>
  179. </div>
  180. </template>
  181. <template #extra>
  182. <template v-if="contractInfo?.contractType === 2 || contractInfo?.contractType === 3">
  183. <HcNewSwitch
  184. :datas="contractTypeTab" :keys="contractTypeTabKey"
  185. @change="contractTypeTabChange"
  186. />
  187. </template>
  188. </template>
  189. <HcTable
  190. ref="tableListRef" :column="tableListColumn" :datas="tableListData" :loading="tableLoading"
  191. is-check @selection-change="tableSelectionChange"
  192. >
  193. <template #name="{ row }">
  194. <span class="text-link" @click="tableRowName(row)">{{ row?.name }}</span>
  195. </template>
  196. <template #waitingUserList="{ row }">
  197. <template v-for="item in row.waitingUserList">
  198. <el-tag
  199. v-if="item.waitingUserName"
  200. :type="`${item.status === 2 ? 'success' : item.status === 3 ? 'warning' : item.status === 999 ? 'danger' : 'info'}`"
  201. class="mx-1" effect="dark"
  202. >
  203. {{ item.waitingUserName }}
  204. </el-tag>
  205. </template>
  206. </template>
  207. </HcTable>
  208. <template #action>
  209. <div class="lr-dialog-footer">
  210. <div class="left">
  211. <span class="text-success">任务人员中:</span>
  212. <el-tag class="mx-1" effect="dark" type="info">
  213. 未签字
  214. </el-tag>
  215. <el-tag class="mx-1" effect="dark" type="success">
  216. 已签字
  217. </el-tag>
  218. <el-tag class="mx-1" effect="dark" type="warning">
  219. 已废除
  220. </el-tag>
  221. <el-tag class="mx-1" effect="dark" type="danger">
  222. 签字异常
  223. </el-tag>
  224. </div>
  225. <div class="right">
  226. <HcPages :pages="searchForm" @change="pageChange" />
  227. </div>
  228. </div>
  229. </template>
  230. </HcCard>
  231. </div>
  232. <!-- 批量上报审批 -->
  233. <HcReportModal
  234. :contract-id="contractId"
  235. :datas="reportDatas"
  236. :ids="reportIds"
  237. :project-id="projectId"
  238. :show="showReportModal"
  239. :task-name="reportTaskName"
  240. :type-data="reportTypeData"
  241. type="query"
  242. is-datas
  243. title="批量上报审批"
  244. url="informationWriteQuery/batchTask"
  245. @finish="showReportFinish"
  246. @hide="showReportModal = false"
  247. @tagClose="reportTaskTagClose"
  248. />
  249. </div>
  250. </template>
  251. <script setup>
  252. import { onMounted, ref, watch } from 'vue'
  253. import { useAppStore } from '~src/store'
  254. import { getStoreValue, setStoreValue } from '~src/utils/storage'
  255. import { arrToId, downloadBlob, getArrValue, getObjValue, isString } from 'js-fast-way'
  256. import queryApi from '~api/data-fill/query'
  257. import { eVisaTaskCheckApi } from '~api/other'
  258. //变量
  259. const useAppState = useAppStore()
  260. const projectId = ref(useAppState.getProjectId)
  261. const contractId = ref(useAppState.getContractId)
  262. const projectInfo = ref(useAppState.getProjectInfo)
  263. const contractInfo = ref(useAppState.getContractInfo)
  264. const isCollapse = ref(useAppState.getCollapse)
  265. //变量
  266. const wbstree = ref(null)
  267. const wbstreeKey = ref(Math.random())
  268. //树搜索
  269. const isSearchTree = ref(false)
  270. const searchTreeHeight = ref()
  271. const searchTreeVal = ref('')
  272. //监听
  273. watch(() => [
  274. useAppState.getCollapse, searchTreeVal.value,
  275. ], ([Collapse, search]) => {
  276. isCollapse.value = Collapse
  277. if (search.length == 0) {
  278. isSearchTree.value = false
  279. }
  280. })
  281. //自动展开缓存
  282. const treeAutoExpandKeys = ref(getStoreValue('wbsTreeExpandKeys') || [])
  283. //渲染完成
  284. onMounted(() => {
  285. getFileUser()
  286. getReportNumber()
  287. getFirstTaskStatus()
  288. getDictBizClassify()
  289. })
  290. const searchTreeData = ref([])
  291. //回车
  292. const treeLoading = ref(false)
  293. const getSearchTreeData = async () => {
  294. treeLoading.value = true
  295. const { error, code, data } = await queryApi.getTreeNodeByQueryValueAndContractId({
  296. contractId: contractId.value,
  297. queryValue: searchTreeVal.value,
  298. })
  299. //判断状态
  300. if (!error && code === 200) {
  301. let treedata = getArrValue(data)
  302. searchTreeData.value = treedata
  303. treeLoading.value = false
  304. } else {
  305. treeLoading.value = false
  306. searchTreeData.value = []
  307. }
  308. }
  309. //回车
  310. const searchTreeKeyUp = (e) => {
  311. if (e.key === 'Enter') {
  312. searchTreeClick()
  313. }
  314. }
  315. const searchTreeClick = async () => {
  316. if (searchTreeVal.value) {
  317. searchTreeHeight.value = document.getElementById('hc-tree-scrollbar').offsetHeight
  318. isSearchTree.value = true
  319. //treeLoading.value = true
  320. getSearchTreeData().then()
  321. } else {
  322. isSearchTree.value = false
  323. }
  324. }
  325. //树相关的变量
  326. const primaryKeyId = ref('')
  327. const nodeItemInfo = ref({})
  328. const nodeDataInfo = ref({})
  329. //懒加载的数据
  330. const treeLoadNode = async ({ node, item, level }, resolve) => {
  331. let contractIdRelation = '', parentId = '', primaryKeyId = ''
  332. if (level !== 0) {
  333. const nodeData = getObjValue(item)
  334. contractIdRelation = nodeData?.contractIdRelation || ''
  335. parentId = contractIdRelation ? nodeData?.primaryKeyId : nodeData?.id
  336. primaryKeyId = nodeData?.id || ''
  337. }
  338. //获取数据
  339. const { data } = await queryApi.queryWbsTreeData({
  340. contractId: contractId.value || '',
  341. contractIdRelation,
  342. primaryKeyId,
  343. parentId,
  344. classifyType: contractTypeTabKey.value,
  345. })
  346. resolve(getArrValue(data))
  347. }
  348. //树被点击
  349. const wbsElTreeClick = ({ node, data, keys }) => {
  350. nodeItemInfo.value = node
  351. nodeDataInfo.value = data
  352. primaryKeyId.value = data['primaryKeyId'] || ''
  353. //缓存自动展开
  354. treeAutoExpandKeys.value = keys
  355. setStoreValue('wbsTreeExpandKeys', keys)
  356. //改变搜索表单数据
  357. searchForm.value.wbsId = data['primaryKeyId']
  358. //只有监理、指挥合同段才传contractIdRelation
  359. if (contractInfo.value?.contractType == 2 || contractInfo.value?.contractType == 3) {
  360. searchForm.value.contractIdRelation = data['contractIdRelation']
  361. } else {
  362. searchForm.value.contractIdRelation = ''
  363. }
  364. searchForm.value.current = 1
  365. getTableData()
  366. }
  367. //搜索条件
  368. const processStatusData = ref([]) //流程状态
  369. const reportingPersonData = ref([]) //填报人
  370. const fileTypeData = ref([]) //文件类型
  371. const reportBatchData = ref([]) //上报批次
  372. //获取所有填报人
  373. const getFileUser = async () => {
  374. const { error, code, data } = await queryApi.getFileUser({
  375. contractId: contractId.value,
  376. })
  377. //判断状态
  378. if (!error && code === 200) {
  379. let res = getArrValue(data), userArr = []
  380. res.forEach(item => {
  381. userArr.push({ label: item['userName'], value: `${item['userId']}-${item['userName']}` })
  382. })
  383. reportingPersonData.value = userArr
  384. } else {
  385. reportingPersonData.value = []
  386. }
  387. }
  388. //获取上报批次
  389. const getReportNumber = async () => {
  390. const { error, code, data } = await queryApi.getReportNumber({
  391. contractId: contractId.value,
  392. projectId: projectId.value,
  393. })
  394. //判断状态
  395. if (!error && code === 200) {
  396. reportBatchData.value = getArrValue(data)
  397. } else {
  398. reportBatchData.value = []
  399. }
  400. }
  401. //获取流程状态
  402. const getFirstTaskStatus = async () => {
  403. const { error, code, data } = await queryApi.getFirstTaskStatus()
  404. //判断状态
  405. if (!error && code === 200) {
  406. processStatusData.value = getArrValue(data)
  407. } else {
  408. processStatusData.value = []
  409. }
  410. }
  411. //获取流程状态分类和文件类型分类
  412. const getDictBizClassify = async () => {
  413. const { error, code, data } = await queryApi.getDictBizClassify({
  414. contractId: contractId.value,
  415. code: 'fileType',
  416. })
  417. //判断状态
  418. if (!error && code === 200) {
  419. fileTypeData.value = getArrValue(data)
  420. } else {
  421. fileTypeData.value = []
  422. }
  423. }
  424. //搜索表单
  425. const searchForm = ref({
  426. taskStatus: null, fileUserIdAndName: null, sourceType: null, reportNumber: null, betweenTime: null,
  427. queryValue: null, contractIdRelation: null, wbsId: null, current: 1, size: 20, total: 0,
  428. })
  429. //结构类型tab数据和相关处理
  430. // const contractTypeTabKey = ref('1')
  431. const { contractType } = contractInfo.value
  432. const contractTypeTabKey = ref(contractType === 2 ? '2' : '1')
  433. const contractTypeTab = ref([
  434. { key: '1', name: '施工数据' },
  435. { key: '2', name: '监理数据' },
  436. ])
  437. const contractTypeTabChange = (item) => {
  438. contractTypeTabKey.value = item?.key
  439. // window?.location?.reload() //刷新页面
  440. searchClick()
  441. }
  442. //获取合同段类型
  443. // const getContractTypeKey = () => {
  444. // const { contractType } = contractInfo.value;
  445. // if (contractType === 2 || contractType === 3) {
  446. // return contractTypeTabKey.value ?? '1'
  447. // } else {
  448. // return null
  449. // }
  450. // }
  451. //日期时间被选择
  452. const betweenTime = ref(null)
  453. const betweenTimeUpdate = ({ arr, query }) => {
  454. betweenTime.value = arr
  455. searchForm.value.betweenTime = query
  456. }
  457. //回车搜索
  458. const keyUpEvent = (e) => {
  459. if (e.key === 'Enter') {
  460. searchForm.value.current = 1
  461. if (searchForm.value?.queryValue) {
  462. searchForm.value.queryValue = searchForm.value.queryValue.trim()
  463. }
  464. getTableData()
  465. }
  466. }
  467. //搜索
  468. const searchClick = () => {
  469. searchForm.value.current = 1
  470. if (searchForm.value?.queryValue) {
  471. searchForm.value.queryValue = searchForm.value.queryValue.trim()
  472. }
  473. wbstreeKey.value = Math.random()
  474. getTableData()
  475. // wbstree.value.resetNode().then((red)=>{
  476. // if(red){
  477. // getTableData()
  478. // }
  479. // })
  480. }
  481. //分页被点击
  482. const pageChange = ({ current, size }) => {
  483. searchForm.value.current = current
  484. searchForm.value.size = size
  485. getTableData()
  486. }
  487. //获取数据
  488. const tableListRef = ref(null)
  489. const tableLoading = ref(false)
  490. const tableListColumn = ref([
  491. { key: 'name', name: '文件名称' },
  492. { key: 'startTime', name: '开始时间' },
  493. { key: 'taskStatusStr', name: '流程状态' },
  494. { key: 'reportNumber', name: '上报批次' },
  495. { key: 'fileUserIdAndName', name: '填报人' },
  496. { key: 'waitingUserList', name: '任务人' },
  497. ])
  498. const tableListData = ref([])
  499. const getTableData = async () => {
  500. if (searchForm.value.wbsId) {
  501. tableListRef.value?.clearSelection()
  502. tableCheckedKeys.value = []
  503. tableLoading.value = true
  504. // const classifyType = getContractTypeKey();
  505. const { error, code, data } = await queryApi.getPageData({
  506. projectId: projectId.value,
  507. contractId: contractId.value,
  508. ...searchForm.value,
  509. classifyType: contractTypeTabKey.value,
  510. })
  511. //处理数据
  512. tableLoading.value = false
  513. if (!error && code === 200) {
  514. tableListData.value = getArrValue(data['records'])
  515. searchForm.value.total = data.total || 0
  516. } else {
  517. tableListData.value = []
  518. searchForm.value.total = 0
  519. }
  520. } else {
  521. window?.$message?.warning('请先选择一个树节点')
  522. }
  523. }
  524. //多选
  525. const tableCheckedKeys = ref([])
  526. const tableSelectionChange = (rows) => {
  527. tableCheckedKeys.value = rows.filter((item) => {
  528. return (item ?? '') !== ''
  529. })
  530. }
  531. //名称被点击
  532. const tableRowName = (row) => {
  533. //如果 evisaPdfUrl 不为空,使用evisaPdfUrl,反之使用pdfUrl
  534. if (row['evisaPdfUrl']) {
  535. window.open(row['evisaPdfUrl'], '_blank')
  536. } else if (row['pdfUrl']) {
  537. window.open(row['pdfUrl'], '_blank')
  538. } else {
  539. window.$message?.warning('文件不存在')
  540. }
  541. }
  542. //上报
  543. const reportIds = ref('')
  544. const reportTaskName = ref('')
  545. const reportDatas = ref([])
  546. const reportTypeData = ref([])
  547. const showReportModal = ref(false)
  548. const reportLoading = ref(false)
  549. const reportModalClick = async () => {
  550. const rows = tableCheckedKeys.value
  551. //判断是否满足条件
  552. const result = rows.every(({ status }) => {
  553. return status === 0 || status === 3
  554. })
  555. //处理数据
  556. let newArr = []
  557. for (let i = 0; i < rows.length; i++) {
  558. newArr.push(rows[i]['wbsId'])
  559. }
  560. reportTypeData.value = newArr
  561. //判断状态
  562. if (result) {
  563. reportLoading.value = true
  564. const taskCheck = await eVisaTaskCheckApi({
  565. projectId: projectId.value,
  566. contractId: contractId.value,
  567. })
  568. if (taskCheck) {
  569. //初始ID
  570. const row = getObjValue(rows[0])
  571. reportIds.value = arrToId(rows)
  572. //设置任务数据
  573. let reportDataArr = []
  574. rows.forEach(item => {
  575. reportDataArr.push({
  576. id: item?.id,
  577. name: item?.name,
  578. })
  579. })
  580. reportDatas.value = reportDataArr
  581. //设置任务名称
  582. reportTaskName.value = rows.length > 1 ? `${row.name}等${rows.length}个文件` : row.name
  583. reportLoading.value = false
  584. showReportModal.value = true
  585. } else {
  586. reportLoading.value = false
  587. }
  588. } else {
  589. window.$message?.warning('已上报的文件不能进行再次上报,若要重新上报,要先撤回之前的上报,再重新上报')
  590. }
  591. }
  592. //上报的审批内容移除
  593. const reportTaskTagClose = (index) => {
  594. const row = tableCheckedKeys.value[index]
  595. tableListRef.value?.toggleRowSelection(row, false)
  596. }
  597. //上报完成
  598. const showReportFinish = () => {
  599. showReportModal.value = false
  600. getTableData()
  601. }
  602. //下载
  603. const downloadLoading = ref(false)
  604. const batchDownload = async () => {
  605. const rows = tableCheckedKeys.value
  606. const ids = arrToId(rows)
  607. //批量下载
  608. downloadLoading.value = true
  609. const { error, disposition, res } = await queryApi.batchDownloadFileToZip({ ids: ids })
  610. //处理数据
  611. downloadLoading.value = false
  612. if (!error) {
  613. if (disposition) {
  614. downloadBlob(res, disposition)
  615. } else {
  616. window.$message?.error('数据异常')
  617. }
  618. }
  619. }
  620. //打印
  621. const printLoading = ref(false)
  622. const batchPrint = async () => {
  623. const rows = tableCheckedKeys.value
  624. const ids = arrToId(rows)
  625. //批量下载
  626. printLoading.value = true
  627. const { error, code, data } = await queryApi.batchPrint({ ids: ids })
  628. //处理数据
  629. printLoading.value = false
  630. const res = isString(data) ? data ?? '' : ''
  631. if (!error && code === 200 && res) {
  632. window.open(res, '_blank')
  633. }
  634. }
  635. //废除
  636. const batchAbolishClick = () => {
  637. const rows = tableCheckedKeys.value
  638. //判断是否满足条件
  639. const result = rows.every(({ status }) => {
  640. return status !== 0 && status !== 3
  641. })
  642. //判断状态
  643. if (result) {
  644. //拼接ID
  645. const ids = arrToId(rows)
  646. window?.$messageBox?.alert('是否废除勾选的已上报文件?', '废除文件', {
  647. showCancelButton: true,
  648. confirmButtonText: '确定废除',
  649. cancelButtonText: '取消',
  650. callback: (action) => {
  651. if (action === 'confirm') {
  652. batchAbolishSave(ids)
  653. }
  654. },
  655. })
  656. } else {
  657. window.$message?.warning('未上报的文件不能废除')
  658. }
  659. }
  660. //废除勾选的已上报文件
  661. const batchAbolishSave = async (ids) => {
  662. const { error, code } = await queryApi.batchAbolish({ ids: ids })
  663. //处理数据
  664. if (!error && code === 200) {
  665. window.$message?.success('批量废除成功')
  666. tableCheckedKeys.value = []
  667. getTableData()
  668. }
  669. }
  670. //本地验签
  671. const localLoading = ref(false)
  672. const batchLocal = async () => {
  673. const rows = tableCheckedKeys.value
  674. //判断是否满足条件
  675. const result = rows.every(({ status }) => {
  676. return status === 2
  677. })
  678. //判断状态
  679. if (result) {
  680. const ids = arrToId(rows)
  681. //请求数据
  682. localLoading.value = true
  683. const { error, code, data } = await queryApi.localVerify({
  684. ids: ids,
  685. })
  686. //处理数据
  687. localLoading.value = false
  688. if (!error && code === 200) {
  689. console.log(data)
  690. }
  691. } else {
  692. window.$message?.warning('存在未审批或未上报数据')
  693. }
  694. }
  695. //在线验签
  696. const onlineLoading = ref(false)
  697. const batchOnline = async () => {
  698. const rows = tableCheckedKeys.value
  699. if (rows.length > 1) {
  700. window.$message?.warning('在线验签只能勾选一条数据进行验签')
  701. return
  702. }
  703. if (rows[0].status !== 2) {
  704. window.$message?.warning('存在未审批或未上报数据')
  705. return
  706. }
  707. //发起
  708. onlineLoading.value = true
  709. const { error, code, data } = await queryApi.onlineVerify({
  710. ids: rows[0]['id'],
  711. })
  712. //处理数据
  713. localLoading.value = false
  714. if (!error && code === 200) {
  715. console.log(data)
  716. }
  717. }
  718. //左右拖动,改变树形结构宽度
  719. const leftWidth = ref(505)
  720. const onmousedown = () => {
  721. const leftNum = isCollapse.value ? 142 : 272
  722. document.onmousemove = (ve) => {
  723. let diffVal = ve.clientX - leftNum
  724. if (diffVal >= 310 && diffVal <= 900) {
  725. leftWidth.value = diffVal
  726. }
  727. }
  728. document.onmouseup = () => {
  729. document.onmousemove = null
  730. document.onmouseup = null
  731. }
  732. }
  733. </script>
  734. <style lang="scss" scoped>
  735. @import "../../styles/data-fill/query.scss";
  736. .iscusor {
  737. cursor: pointer;
  738. }
  739. </style>