query.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749
  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. :typeData="reportTypeData"
  191. type="wbs"
  192. isDatas
  193. title="批量上报审批"
  194. url="informationWriteQuery/batchTask"
  195. @finish="showReportFinish"
  196. @hide="showReportModal = false"
  197. @tagClose="reportTaskTagClose"
  198. />
  199. </div>
  200. </template>
  201. <script setup>
  202. import {ref, watch, onMounted} from "vue";
  203. import {useAppStore} from "~src/store";
  204. import WbsTree from "./components/WbsTree.vue"
  205. import HcTreeData from "./components/HcTreeData.vue"
  206. import {getStoreValue, setStoreValue} from '~src/utils/storage'
  207. import {downloadBlob, isString, getObjValue, getArrValue} from "js-fast-way"
  208. import queryApi from '~api/data-fill/query';
  209. import {eVisaTaskCheckApi} from "~api/other"
  210. //变量
  211. const useAppState = useAppStore()
  212. const projectId = ref(useAppState.getProjectId);
  213. const contractId = ref(useAppState.getContractId);
  214. const projectInfo = ref(useAppState.getProjectInfo);
  215. const contractInfo = ref(useAppState.getContractInfo);
  216. const isCollapse = ref(useAppState.getCollapse)
  217. //变量
  218. const wbstree = ref(null)
  219. const wbstreeKey = ref(Math.random())
  220. //树搜索
  221. const isSearchTree = ref(false)
  222. //监听
  223. watch(() => [
  224. useAppState.getCollapse,
  225. ], ([Collapse]) => {
  226. isCollapse.value = Collapse
  227. })
  228. //自动展开缓存
  229. const treeAutoExpandKeys = ref(getStoreValue('wbsTreeExpandKeys') || [])
  230. //渲染完成
  231. onMounted(() => {
  232. getFileUser()
  233. getReportNumber()
  234. getFirstTaskStatus()
  235. getDictBizClassify()
  236. if (contractTypeTabKey.value == 2 || contractInfo.value?.contractType == 3) {
  237. getSearchTreeDataJl()
  238. } else {
  239. getSearchTreeData()
  240. }
  241. })
  242. const searchTreeVal = ref('')
  243. const searchTreeData = ref([])
  244. //回车
  245. const treeLoading = ref(false)
  246. const getSearchTreeData = async () => {
  247. // treeLoading.value = true
  248. searchElTreeLoadNode.value = true
  249. const {error, code, data} = await queryApi.getTreeall({
  250. contractId: contractId.value,
  251. projectId: projectId.value,
  252. wbsId: projectInfo?.value.referenceWbsTemplateId,
  253. type: 1
  254. })
  255. //判断状态
  256. if (!error && code === 200) {
  257. searchTreeData.value = getArrValue(data)
  258. searchElTreeLoadNode.value = false
  259. treeLoading.value = false
  260. } else {
  261. searchElTreeLoadNode.value = false
  262. treeLoading.value = false
  263. searchTreeData.value = []
  264. }
  265. }
  266. const searchElTreeLoadNode = ref(true)
  267. const getSearchTreeDataJl = async () => {
  268. // treeLoading.value = true
  269. searchElTreeLoadNode.value = true
  270. const {error, code, data} = await queryApi.getTreeallJl({
  271. contractId: contractId.value,
  272. type: 1
  273. })
  274. //判断状态
  275. if (!error && code === 200) {
  276. searchElTreeLoadNode.value = false
  277. let searchobj = getObjValue(data)
  278. let searcharr = []
  279. for (let key in searchobj) {
  280. searcharr.push(searchobj[key][0])
  281. }
  282. searchTreeData.value = searcharr
  283. treeLoading.value = false
  284. } else {
  285. treeLoading.value = false
  286. searchElTreeLoadNode.value = false
  287. searchTreeData.value = []
  288. }
  289. }
  290. const searchTreeKeyUp = (e) => {
  291. if (e.key === "Enter") {
  292. searchTreeClick()
  293. }
  294. }
  295. const searchTreeClick = async () => {
  296. treeLoading.value = true
  297. if (searchElTreeLoadNode.value === true) {
  298. treeLoading.value = true
  299. window?.$message?.warning('请加载完再次点击搜索')
  300. } else {
  301. isSearchTree.value = true
  302. treeLoading.value = false
  303. }
  304. }
  305. //树相关的变量
  306. const primaryKeyId = ref('')
  307. const nodeItemInfo = ref({})
  308. const nodeDataInfo = ref({})
  309. const changeisSearch = () => {
  310. isSearchTree.value = false
  311. }
  312. const changetreelaod = (val) => {
  313. treeLoading.value = val
  314. }
  315. //树被点击
  316. const wbsElTreeClick = ({node, data, keys}) => {
  317. nodeItemInfo.value = node
  318. nodeDataInfo.value = data
  319. primaryKeyId.value = data['primaryKeyId'] || ''
  320. //缓存自动展开
  321. treeAutoExpandKeys.value = keys
  322. setStoreValue('wbsTreeExpandKeys', keys)
  323. //改变搜索表单数据
  324. searchForm.value.wbsId = data['primaryKeyId']
  325. searchForm.value.contractIdRelation = data['contractIdRelation']
  326. searchForm.value.current = 1;
  327. getTableData()
  328. }
  329. //搜索条件
  330. const processStatusData = ref([]) //流程状态
  331. const reportingPersonData = ref([]) //填报人
  332. const fileTypeData = ref([]) //文件类型
  333. const reportBatchData = ref([]) //上报批次
  334. //获取所有填报人
  335. const getFileUser = async () => {
  336. const {error, code, data} = await queryApi.getFileUser({
  337. contractId: contractId.value
  338. })
  339. //判断状态
  340. if (!error && code === 200) {
  341. let res = getArrValue(data), userArr = [];
  342. res.forEach(item => {
  343. userArr.push({label: item['userName'], value: `${item['userId']}-${item['userName']}`})
  344. })
  345. reportingPersonData.value = userArr
  346. } else {
  347. reportingPersonData.value = []
  348. }
  349. }
  350. //获取上报批次
  351. const getReportNumber = async () => {
  352. const {error, code, data} = await queryApi.getReportNumber({
  353. contractId: contractId.value,
  354. projectId: projectId.value
  355. })
  356. //判断状态
  357. if (!error && code === 200) {
  358. reportBatchData.value = getArrValue(data)
  359. } else {
  360. reportBatchData.value = []
  361. }
  362. }
  363. //获取流程状态
  364. const getFirstTaskStatus = async () => {
  365. const {error, code, data} = await queryApi.getFirstTaskStatus()
  366. //判断状态
  367. if (!error && code === 200) {
  368. processStatusData.value = getArrValue(data)
  369. } else {
  370. processStatusData.value = []
  371. }
  372. }
  373. //获取流程状态分类和文件类型分类
  374. const getDictBizClassify = async () => {
  375. const {error, code, data} = await queryApi.getDictBizClassify({
  376. contractId: contractId.value,
  377. code: 'fileType'
  378. })
  379. //判断状态
  380. if (!error && code === 200) {
  381. fileTypeData.value = getArrValue(data)
  382. } else {
  383. fileTypeData.value = []
  384. }
  385. }
  386. //搜索表单
  387. const searchForm = ref({
  388. taskStatus: null, fileUserIdAndName: null, sourceType: null, reportNumber: null, betweenTime: null,
  389. queryValue: null, contractIdRelation: null, wbsId: null, current: 1, size: 20, total: 0
  390. })
  391. //结构类型tab数据和相关处理
  392. // const contractTypeTabKey = ref('1')
  393. const {contractType} = contractInfo.value;
  394. const contractTypeTabKey = ref(contractType === 2 ? '2' : '1')
  395. const contractTypeTab = ref([
  396. {key: '1', name: '施工数据'},
  397. {key: '2', name: '监理数据'}
  398. ]);
  399. const contractTypeTabChange = (item) => {
  400. contractTypeTabKey.value = item?.key;
  401. // window?.location?.reload() //刷新页面
  402. searchClick()
  403. }
  404. //获取合同段类型
  405. // const getContractTypeKey = () => {
  406. // const { contractType } = contractInfo.value;
  407. // if (contractType === 2 || contractType === 3) {
  408. // return contractTypeTabKey.value ?? '1'
  409. // } else {
  410. // return null
  411. // }
  412. // }
  413. //日期时间被选择
  414. const betweenTime = ref(null)
  415. const betweenTimeUpdate = ({arr, query}) => {
  416. betweenTime.value = arr
  417. searchForm.value.betweenTime = query
  418. }
  419. //回车搜索
  420. const keyUpEvent = (e) => {
  421. if (e.key === "Enter") {
  422. searchForm.value.current = 1;
  423. getTableData()
  424. }
  425. }
  426. //搜索
  427. const searchClick = () => {
  428. searchForm.value.current = 1;
  429. wbstreeKey.value = Math.random()
  430. getTableData()
  431. // wbstree.value.resetNode().then((red)=>{
  432. // if(red){
  433. // getTableData()
  434. // }
  435. // })
  436. }
  437. //分页被点击
  438. const pageChange = ({current, size}) => {
  439. searchForm.value.current = current
  440. searchForm.value.size = size
  441. getTableData()
  442. }
  443. //获取数据
  444. const tableListRef = ref(null)
  445. const tableLoading = ref(false)
  446. const tableListColumn = ref([
  447. {key: 'name', name: '文件名称'},
  448. {key: 'startTime', name: '开始时间'},
  449. {key: 'taskStatusStr', name: '流程状态'},
  450. {key: 'reportNumber', name: '上报批次'},
  451. {key: 'fileUserIdAndName', name: '填报人'},
  452. {key: 'waitingUserList', name: '任务人'}
  453. ])
  454. const tableListData = ref([])
  455. const getTableData = async () => {
  456. if (!!searchForm.value.wbsId) {
  457. tableListRef.value?.clearSelection()
  458. tableCheckedKeys.value = []
  459. tableLoading.value = true
  460. // const classifyType = getContractTypeKey();
  461. const {error, code, data} = await queryApi.getPageData({
  462. projectId: projectId.value,
  463. contractId: contractId.value,
  464. ...searchForm.value,
  465. classifyType: contractTypeTabKey.value
  466. })
  467. //处理数据
  468. tableLoading.value = false
  469. if (!error && code === 200) {
  470. tableListData.value = getArrValue(data['records'])
  471. searchForm.value.total = data.total || 0
  472. } else {
  473. tableListData.value = []
  474. searchForm.value.total = 0
  475. }
  476. } else {
  477. window?.$message?.warning('请先选择一个树节点')
  478. }
  479. }
  480. //多选
  481. const tableCheckedKeys = ref([]);
  482. const tableSelectionChange = (rows) => {
  483. tableCheckedKeys.value = rows.filter((item) => {
  484. return (item ?? '') !== '';
  485. })
  486. }
  487. //名称被点击
  488. const tableRowName = (row) => {
  489. //如果 evisaPdfUrl 不为空,使用evisaPdfUrl,反之使用pdfUrl
  490. if (row['evisaPdfUrl']) {
  491. window.open(row['evisaPdfUrl'], '_blank')
  492. } else if (row['pdfUrl']) {
  493. window.open(row['pdfUrl'], '_blank')
  494. } else {
  495. window.$message?.warning('文件不存在')
  496. }
  497. }
  498. //上报
  499. const reportIds = ref('')
  500. const reportTaskName = ref('')
  501. const reportDatas = ref([])
  502. const reportTypeData = ref([])
  503. const showReportModal = ref(false)
  504. const reportLoading = ref(false)
  505. const reportModalClick = async () => {
  506. const rows = tableCheckedKeys.value;
  507. //判断是否满足条件
  508. const result = rows.every(({status}) => {
  509. return status === 0 || status === 3
  510. })
  511. //处理数据
  512. let newArr = [];
  513. for (let i = 0; i < rows.length; i++) {
  514. newArr.push(rows[i]['wbsId'])
  515. }
  516. reportTypeData.value = newArr
  517. //判断状态
  518. if (result) {
  519. reportLoading.value = true
  520. const taskCheck = await eVisaTaskCheckApi({
  521. projectId: projectId.value,
  522. contractId: contractId.value
  523. })
  524. if (taskCheck) {
  525. //初始ID
  526. const row = getObjValue(rows[0])
  527. reportIds.value = rowsToId(rows)
  528. //设置任务数据
  529. let reportDataArr = []
  530. rows.forEach(item => {
  531. reportDataArr.push({
  532. id: item?.id,
  533. name: item?.name
  534. })
  535. })
  536. reportDatas.value = reportDataArr
  537. //设置任务名称
  538. reportTaskName.value = rows.length > 1 ? `${row.name}等${rows.length}个文件` : row.name
  539. reportLoading.value = false
  540. showReportModal.value = true
  541. } else {
  542. reportLoading.value = false
  543. }
  544. } else {
  545. window.$message?.warning('已上报的文件不能进行再次上报,若要重新上报,要先撤回之前的上报,再重新上报')
  546. }
  547. }
  548. //上报的审批内容移除
  549. const reportTaskTagClose = (index) => {
  550. const row = tableCheckedKeys.value[index];
  551. tableListRef.value?.toggleRowSelection(row, false)
  552. }
  553. //上报完成
  554. const showReportFinish = () => {
  555. showReportModal.value = false
  556. getTableData()
  557. }
  558. //下载
  559. const downloadLoading = ref(false)
  560. const batchDownload = async () => {
  561. const rows = tableCheckedKeys.value;
  562. const ids = rowsToId(rows)
  563. //批量下载
  564. downloadLoading.value = true
  565. const {error, disposition, res} = await queryApi.batchDownloadFileToZip({ids: ids})
  566. //处理数据
  567. downloadLoading.value = false
  568. if (!error) {
  569. if (disposition) {
  570. downloadBlob(res, disposition)
  571. } else {
  572. window.$message?.error('数据异常')
  573. }
  574. }
  575. }
  576. //打印
  577. const printLoading = ref(false)
  578. const batchPrint = async () => {
  579. const rows = tableCheckedKeys.value;
  580. const ids = rowsToId(rows)
  581. //批量下载
  582. printLoading.value = true
  583. const {error, code, data} = await queryApi.batchPrint({ids: ids})
  584. //处理数据
  585. printLoading.value = false
  586. const res = isString(data) ? data ?? '' : ''
  587. if (!error && code === 200 && res) {
  588. window.open(res, '_blank')
  589. }
  590. }
  591. //废除
  592. const batchAbolishClick = () => {
  593. const rows = tableCheckedKeys.value;
  594. //判断是否满足条件
  595. const result = rows.every(({status}) => {
  596. return status !== 0 && status !== 3
  597. })
  598. //判断状态
  599. if (result) {
  600. //拼接ID
  601. const ids = rowsToId(rows)
  602. window?.$messageBox?.alert('是否废除勾选的已上报文件?', '废除文件', {
  603. showCancelButton: true,
  604. confirmButtonText: '确定废除',
  605. cancelButtonText: '取消',
  606. callback: (action) => {
  607. if (action === 'confirm') {
  608. batchAbolishSave(ids)
  609. }
  610. }
  611. })
  612. } else {
  613. window.$message?.warning('未上报的文件不能废除')
  614. }
  615. }
  616. //废除勾选的已上报文件
  617. const batchAbolishSave = async (ids) => {
  618. const {error, code} = await queryApi.batchAbolish({ids: ids})
  619. //处理数据
  620. if (!error && code === 200) {
  621. window.$message?.success('批量废除成功')
  622. tableCheckedKeys.value = []
  623. getTableData()
  624. }
  625. }
  626. //本地验签
  627. const localLoading = ref(false)
  628. const batchLocal = async () => {
  629. const rows = tableCheckedKeys.value;
  630. //判断是否满足条件
  631. const result = rows.every(({status}) => {
  632. return status === 2
  633. })
  634. //判断状态
  635. if (result) {
  636. const ids = rowsToId(rows)
  637. //请求数据
  638. localLoading.value = true
  639. const {error, code, data} = await queryApi.localVerify({
  640. ids: ids
  641. })
  642. //处理数据
  643. localLoading.value = false
  644. if (!error && code === 200) {
  645. console.log(data)
  646. }
  647. } else {
  648. window.$message?.warning('存在未审批或未上报数据')
  649. }
  650. }
  651. //在线验签
  652. const onlineLoading = ref(false)
  653. const batchOnline = async () => {
  654. const rows = tableCheckedKeys.value;
  655. if (rows.length > 1) {
  656. window.$message?.warning('在线验签只能勾选一条数据进行验签')
  657. return;
  658. }
  659. if (rows[0].status !== 2) {
  660. window.$message?.warning('存在未审批或未上报数据')
  661. return;
  662. }
  663. //发起
  664. onlineLoading.value = true
  665. const {error, code, data} = await queryApi.onlineVerify({
  666. ids: rows[0]['id']
  667. })
  668. //处理数据
  669. localLoading.value = false
  670. if (!error && code === 200) {
  671. console.log(data)
  672. }
  673. }
  674. //拼接ID
  675. const rowsToId = (rows) => {
  676. return rows.map((obj) => {
  677. return obj.id;
  678. }).join(",")
  679. }
  680. //左右拖动,改变树形结构宽度
  681. const leftWidth = ref(505);
  682. const onmousedown = () => {
  683. const leftNum = isCollapse.value ? 142 : 272
  684. document.onmousemove = (ve) => {
  685. let diffVal = ve.clientX - leftNum;
  686. if (diffVal >= 310 && diffVal <= 900) {
  687. leftWidth.value = diffVal;
  688. }
  689. }
  690. document.onmouseup = () => {
  691. document.onmousemove = null;
  692. document.onmouseup = null;
  693. }
  694. }
  695. </script>
  696. <style lang="scss" scoped>
  697. @import "../../styles/data-fill/query.scss";
  698. .iscusor {
  699. cursor: pointer;
  700. }
  701. </style>