query.vue 28 KB

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