query.vue 26 KB

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