query.vue 26 KB

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