test-form.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736
  1. <template>
  2. <div class="hc-page-box">
  3. <HcCard actionUi="text-center">
  4. <template #header>
  5. <el-button :type="authBtnTabKey === '1'?'primary':''" hc-btn @click="authBtnTabClick('1')">
  6. <HcIcon name="folder-user"/>
  7. <span>施工质检</span>
  8. </el-button>
  9. <el-button :type="authBtnTabKey === '2'?'primary':''" hc-btn @click="authBtnTabClick('2')">
  10. <HcIcon name="folder-shield"/>
  11. <span>监理质检</span>
  12. </el-button>
  13. </template>
  14. <template #extra>
  15. <el-button type="primary" hc-btn @click="linksRelateModalClick" :disabled="listItemData.length <= 0">关联工程用途及部位</el-button>
  16. <el-button :type="isMixRatioTestIds ? 'primary' : ''" hc-btn :disabled="!isMixRatioTestIds" @click="linksRawModalClick">关联原材检测报告</el-button>
  17. <el-button type="primary" hc-btn @click="linksSampleModalClick">关联取样</el-button>
  18. </template>
  19. <template #search>
  20. <div class="flex-1">
  21. <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" @change="tabTypeChange" size="default" :round="false"/>
  22. </div>
  23. <div class="hc-search-top-form">
  24. <div class="w-40">
  25. <el-input v-model="listItemBaseData.trialUserName" placeholder="请输入试验人员" clearable/>
  26. </div>
  27. <div class="w-36 ml-2" v-if="tabTypeKey === '2'">
  28. <el-date-picker type="date" v-model="listItemBaseData.reportDate" class="block" value-format="YYYY-MM-DD" :clearable="false" placeholder="请选择报告日期"/>
  29. </div>
  30. <div class="w-28 ml-2" v-if="tabTypeKey === '2'">
  31. <el-select v-model="listItemBaseData.detectionResult" placeholder="是否合格" block>
  32. <el-option label="合格" value="1" />
  33. <el-option label="不合格" value="0" />
  34. </el-select>
  35. </div>
  36. <div class="w-36 ml-2">
  37. <el-select v-model="listItemBaseData.detectionCategory" placeholder="选择检测类型" block>
  38. <el-option v-for="item in categoryData" :label="item['dictValue']" :value="item['dictKey']"/>
  39. </el-select>
  40. </div>
  41. </div>
  42. </template>
  43. <!--清表列表-->
  44. <el-scrollbar ref="ListItemScrollRef" v-loading="isLoading" v-if="listItemData.length > 0">
  45. <ListItem ref="ListItemRef" :datas="listItemData" :status="1" :baseData="listItemBaseData" @offsetTop="ListItemOffsetTop" @renew="getTableDataAll"
  46. :deviceUseIds="listDeviceUseIds"
  47. :authBtnTabKey="authBtnTabKey"
  48. @updeviceUseIds="updeviceUseIds"
  49. @upcheckTableId="upcheckTableId"
  50. />
  51. </el-scrollbar>
  52. <template #action>
  53. <el-button type="primary" hc-btn :disabled="NodeStatus === '3' || listItemData.length <= 0" :loading="tableFormSaveLoading" @click="tableFormSaveClick">
  54. <HcIcon name="save"/>
  55. <span>保存</span>
  56. </el-button>
  57. <!-- <el-button hc-btn :loading="reportLoading" @click="reportModalClick" :disabled="NodeStatus === '3' || NodeStatus === '1'" >
  58. <HcIcon name="send-plane-2"/>
  59. <span>上报</span>
  60. </el-button> -->
  61. <el-button hc-btn :loading="reportLoading" @click="reportModalClick" >
  62. <HcIcon name="send-plane-2"/>
  63. <span>上报</span>
  64. </el-button>
  65. <el-button hc-btn :disabled="NodeStatus === '1'" :loading="bussPdfsLoading" @click="bussPdfsClick">
  66. <HcIcon name="eye"/>
  67. <span>预览</span>
  68. </el-button>
  69. <el-button hc-btn @click="abolishOneClick" v-if="NodeStatus === '3'">
  70. <HcIcon name="arrow-go-back"/>
  71. <span>撤回上报流程</span>
  72. </el-button>
  73. <el-button hc-btn @click="toBackClick">
  74. <HcIcon name="delete-back"/>
  75. <span>返回</span>
  76. </el-button>
  77. </template>
  78. </HcCard>
  79. <!--关联工程用途及部位-->
  80. <HcDialog :show="linksRelateModal" title="关联工程用途及部位" widths="50rem" isTable saveText="确认关联" @close="linksRelateModalClose" @save="linksRelateModalSave">
  81. <div class="hc-links-relate-tree-box">
  82. <div class="hc-search-tree-val">
  83. <el-input v-model="linksRelateSearchTreeVal" block size="large" placeholder="请输入名称关键词检索" clearable @keyup="searchTreeKeyUp">
  84. <template #suffix>
  85. <HcIcon name="search-2" ui="text-xl"/>
  86. </template>
  87. </el-input>
  88. </div>
  89. <div class="hc-tree-scrollbar" v-loading="linksRelateTreeLoading" element-loading-text="获取数据中...">
  90. <el-scrollbar>
  91. <!-- <DivisionTree :datas="unmatchedTreeData" @nodeTap="divisionTreeClick" @nodeCheck="divisionTreeCheck" :defaultCheckarr="defaultCheckarrIds"/> -->
  92. <KeepAlive>
  93. <template v-if="isSearchTree">
  94. <DivisionTree :datas="searchTreeData" @nodeTap="divisionTreeClick" @nodeCheck="divisionTreeCheck" :defaultCheckarr="defaultCheckarrIds" :ElTreeProps="seaElTreeProps" :defaultExpandAll="true" :check-strictly="true"/>
  95. </template>
  96. <template v-else>
  97. <DivisionTree :datas="unmatchedTreeData" @nodeTap="divisionTreeClick" @nodeCheck="divisionTreeCheck" :defaultCheckarr="defaultCheckarrIds" :check-strictly="true"/>
  98. </template>
  99. </KeepAlive>
  100. </el-scrollbar>
  101. </div>
  102. </div>
  103. </HcDialog>
  104. <!--关联原材检测报告-->
  105. <HcDialog :show="linksRawModal" title="关联原材检测报告" widths="75rem" isTable saveText="确认关联" @close="linksRawModalClose" @save="linksRawModalSave">
  106. <div class="hc-links-sample-modal-box">
  107. <div class="hc-links-sample-tree-box">
  108. <el-scrollbar>
  109. <TestTree :projectId="projectId" :wbsTempId="projectInfo?.referenceWbsTemplateIdTrial" :wbsType="2" :tenantId="userInfo?.tenant_id" @nodeTap="linksRawTreeClick"/>
  110. </el-scrollbar>
  111. </div>
  112. <div class="hc-links-sample-table-box">
  113. <HcTable ref="tableRawRef" :column="linksRawTableColumn" :datas="linksRawTableData" :loading="linksRawTableLoading" :isIndex="false" isCheck @selection-change="linksRawTableSelection"/>
  114. </div>
  115. </div>
  116. </HcDialog>
  117. <!--关联取样-->
  118. <HcDialog :show="linksSampleModal" title="关联取样信息" widths="75rem" isTable saveText="确认" @close="linksSampleModalClose" @save="linksSampleModalSave">
  119. <div class="hc-links-sample-modal-box">
  120. <div class="hc-links-sample-tree-box">
  121. <el-scrollbar>
  122. <TestTree :projectId="projectId" :wbsTempId="projectInfo?.referenceWbsTemplateIdTrial" :wbsType="2" :tenantId="userInfo?.tenant_id" @nodeTap="linksSampleTreeClick"/>
  123. </el-scrollbar>
  124. </div>
  125. <div class="hc-links-sample-table-box">
  126. <HcTable ref="tableSampleRef" :column="linksSampleTableColumn" :datas="linksSampleTableData" :loading="linksSampleTableLoading" :isIndex="false" isCheck @selection-change="linksSampleTableSelection"/>
  127. </div>
  128. </div>
  129. </HcDialog>
  130. <!--批量上报审批-->
  131. <HcReportModal title="批量上报审批" url="informationWriteQuery/taskOne" :show="showReportModal" :projectId="projectId" :contractId="contractId" type="wbs" :typeData="reportTypeData"
  132. :taskName="reportTaskName" :ids="reportIds" :addition="reportAddition" @hide="showReportModal = false" @finish="showReportFinish"/>
  133. </div>
  134. </template>
  135. <script setup>
  136. import {ref, watch, onMounted} from "vue";
  137. import {useAppStore} from "~src/store";
  138. import {useRouter, useRoute} from 'vue-router'
  139. import ListItem from "./components/ListItem.vue"
  140. import DivisionTree from "./components/DivisionTree.vue"
  141. import dataApi from "~api/tentative/detect/test";
  142. import divisionApi from "~api/data-fill/division";
  143. import queryApi from '~api/data-fill/query';
  144. import {getStoreData} from '~src/utils/storage'
  145. import TestTree from "../material/components/TestTree.vue"
  146. import {getArrValue, getObjValue, getObjNullValue,isString} from "vue-utils-plus";
  147. import {getDictionary} from "~api/other";
  148. import {rowsToId} from "~uti/tools";
  149. import dayjs from "dayjs"
  150. import { Loading } from "element-plus/es/components/loading/src/service";
  151. import { eVisaTaskCheckApi} from "~api/other"
  152. import wbsApi from "~api/data-fill/wbs"
  153. //变量
  154. const router = useRouter()
  155. const useRoutes = useRoute()
  156. const useAppState = useAppStore()
  157. const userInfo = ref(useAppState.getUserInfo);
  158. const projectId = ref(useAppState.getProjectId);
  159. const contractId = ref(useAppState.getContractId);
  160. const projectInfo = ref(useAppState.getProjectInfo);
  161. const contractInfo = ref(useAppState.getContractInfo);
  162. //获取模板标签数据
  163. const isTableForm = ref(false)
  164. //路由参数
  165. const routerQuery = useRoutes?.query;
  166. //存储目录格式 1按部位存储,2按日期存储
  167. const dataId = routerQuery?.id || '';
  168. const nodeId = routerQuery?.nodeId || '';
  169. const dataType = routerQuery?.dataType || '1';
  170. const isaddType = routerQuery?.isaddType || false;
  171. const dayDate = dayjs().format('YYYY-MM-DD')
  172. const testTreeItem = ref(getStoreData('testTreeItem'));
  173. const isMixRatioTestIds = ref(false);
  174. //渲染完成
  175. onMounted(() => {
  176. const { title, mixRatioTestIds} = getObjValue(testTreeItem.value);
  177. const info = getStoreData('test-form') || {}
  178. isMixRatioTestIds.value = !(!mixRatioTestIds || mixRatioTestIds <= 0);
  179. listItemBaseData.value.contractId = contractId.value
  180. listItemBaseData.value.trialProjectName = title
  181. listItemBaseData.value.reportDate = dayDate
  182. listItemBaseData.value.detectionCategory = Number(dataType)
  183. listItemBaseData.value.trialUserName =info.trialUserName||''
  184. if(info&&info.detectionResult){
  185. listItemBaseData.value.detectionResult=info.detectionResult.toString()
  186. }
  187. getSearchNodeTables()
  188. getCategoryData()
  189. })
  190. //身份按钮切换数据
  191. const authBtnTabKey = ref(dataType)
  192. const authBtnTabClick = (val) => {
  193. if (val !== authBtnTabKey.value) {
  194. authBtnTabKey.value = val
  195. listItemBaseData.value.type = val
  196. listItemBaseData.value.detectionCategory = Number(val)
  197. getSearchNodeTables()
  198. }
  199. }
  200. //类型tab数据和相关处理
  201. const tabTypeKey = ref('1')
  202. const tabTypeTab = ref([
  203. {key:'1', name: '记录表'},
  204. {key:'2', name: '报告单'},
  205. ]);
  206. const tabTypeChange = ({key}) => {
  207. tabTypeKey.value = key
  208. listItemBaseData.value.tableType = key
  209. getSearchNodeTables()
  210. }
  211. //获取检测类别类型
  212. const categoryData = ref([])
  213. const getCategoryData = async () => {
  214. const { data } = await getDictionary({
  215. code: 'trial_detection_category'
  216. })
  217. const arrData = getArrValue(data)
  218. arrData.forEach(item => {
  219. item.dictKey = Number(item.dictKey)
  220. })
  221. categoryData.value = arrData
  222. }
  223. //顶部表单
  224. const ListItemRef = ref(null);
  225. const listItemBaseData = ref({
  226. sampleIds: '', contractId: null, nodeId: nodeId, trialProjectName: null, type: dataType, tableType: '1',
  227. detectionCategory: '', detectionResult: '', reportDate: '', trialUserName: '', id: dataId,
  228. })
  229. //获取数据
  230. const isLoading = ref(false)
  231. const listItemData = ref([])
  232. const listDeviceUseIds=ref('')
  233. const getSearchNodeTables = async () => {
  234. isLoading.value = true
  235. if(isaddType){
  236. const { error, code, data } = await dataApi.searchNodeTables({
  237. id: dataId,
  238. projectId: projectId.value,
  239. contractId: contractId.value,
  240. primaryKeyId: nodeId,
  241. type: authBtnTabKey.value,
  242. tableType: tabTypeKey.value,
  243. isAdd: 1
  244. })
  245. //处理数据
  246. isLoading.value = false
  247. if (!error && code === 200) {
  248. listItemData.value = getArrValue(data)
  249. } else {
  250. listItemData.value = []
  251. }
  252. }else{
  253. const { error, code, data } = await dataApi.searchNodeTables({
  254. id: dataId,
  255. projectId: projectId.value,
  256. contractId: contractId.value,
  257. primaryKeyId: nodeId,
  258. type: authBtnTabKey.value,
  259. tableType: tabTypeKey.value,
  260. })
  261. //处理数据
  262. isLoading.value = false
  263. if (!error && code === 200) {
  264. listItemData.value = getArrValue(data)
  265. } else {
  266. listItemData.value = []
  267. }
  268. }
  269. }
  270. //获取数据
  271. const getTableDataAll = () => {
  272. getSearchNodeTables()
  273. queryNodeStatus()
  274. }
  275. //设置滚动条位置
  276. const ListItemScrollRef = ref(null)
  277. const ListItemOffsetTop = (offsetTop) => {
  278. if (offsetTop > 0) {
  279. setTimeout(() => {
  280. ListItemScrollRef.value?.setScrollTop(offsetTop)
  281. }, 350)
  282. } else {
  283. ListItemScrollRef.value?.setScrollTop(offsetTop)
  284. }
  285. }
  286. const checkTabId=ref('')
  287. const upcheckTableId = (val) => {
  288. checkTabId.value=val
  289. }
  290. //关联工程用途及部位 树
  291. const linksRelateModal = ref(false)
  292. const linksRelateModalClick = () => {
  293. linksRelateModal.value = true
  294. linksRelateSearchTreeVal.value=''
  295. getContractInfoTreeApi()
  296. }
  297. //获取导入树
  298. const unmatchedTreeData = ref([])
  299. const defaultCheckarrIds=ref([])
  300. const getContractInfoTreeApi = async () => {
  301. const {error, code, data} = await divisionApi.getengineerInfoTree1({
  302. projectId: projectId.value,
  303. contractId: contractId.value,
  304. wbsId: projectInfo?.value.referenceWbsTemplateId,
  305. selfId:dataId
  306. })
  307. //判断状态
  308. if (!error && code === 200) {
  309. unmatchedTreeData.value = getArrValue(data['treeContractAll'])
  310. defaultCheckarrIds.value=getArrValue(data['isSelectedStatus'])
  311. } else {
  312. unmatchedTreeData.value = []
  313. }
  314. }
  315. //关联树
  316. const divisionTreeItemInfo = ref({})
  317. const divisionTreeClick = ({data}) => {
  318. divisionTreeItemInfo.value = data
  319. }
  320. const checkrelationId=ref([])
  321. const checkrelationString=ref([])
  322. const divisionTreeCheck = (data) => {
  323. checkrelationId.value=data
  324. }
  325. const seaElTreeProps = ref({
  326. label: 'title',
  327. children: 'children'
  328. })
  329. const linksRelateSearchTreeVal = ref('')
  330. const linksRelateTreeLoading = ref(false)
  331. const searchTreeData = ref([])
  332. const searchlinksRelateTreeLoading = ref(false)
  333. const searchTreeKeyUp = (e) => {
  334. if (e.key === "Enter") {
  335. searchTreeClick()
  336. }
  337. }
  338. //树搜索
  339. const isSearchTree = ref(false)
  340. const searchTreeClick = async () => {
  341. if (linksRelateSearchTreeVal.value) {
  342. isSearchTree.value = true
  343. searchlinksRelateTreeLoading.value = false
  344. const {error, code, data} = await queryApi.searchContractTree({
  345. contractId: contractId.value,
  346. queryValue: linksRelateSearchTreeVal.value
  347. })
  348. //判断状态
  349. if (!error && code === 200) {
  350. searchTreeData.value = getArrValue(data)
  351. searchlinksRelateTreeLoading.value = false
  352. } else {
  353. searchlinksRelateTreeLoading.value = true
  354. searchTreeData.value = []
  355. }
  356. } else {
  357. searchlinksRelateTreeLoading.value = true
  358. isSearchTree.value = false
  359. }
  360. }
  361. //确认关联
  362. const linksRelateModalSave = () => {
  363. if(checkrelationId.value.length>0){
  364. let idarr=[]
  365. checkrelationId.value.forEach((item)=>{
  366. idarr.push(item.primaryKeyId)
  367. })
  368. checkrelationString.value=idarr.toString()
  369. linksRelateModal.value = false
  370. }else{
  371. window.$message?.warning('请选择你要关联的数据')
  372. }
  373. }
  374. const linksRelateModalClose = () => {
  375. linksRelateModal.value = false
  376. }
  377. //关联原材检测报告
  378. const linksRawModal = ref(false)
  379. const linksRawModalClick = () => {
  380. linksRawModal.value = true
  381. }
  382. //树被点击
  383. const linksRawTreeClick = ({data}) => {
  384. }
  385. //原材检测报告数据
  386. const tableRawRef = ref(null)
  387. const linksRawTableColumn = ref([
  388. {key:'key1', name: '报告编号'},
  389. {key:'key2', name: '试验项目名称'},
  390. {key:'key3', name: '工程部位及用途'},
  391. {key:'key4', name: '报告日期'}
  392. ])
  393. const linksRawTableData = ref([])
  394. const linksRawTableLoading = ref(false)
  395. //多选
  396. const tableRawCheckedKeys = ref([]);
  397. const linksRawTableSelection = (rows) => {
  398. tableRawCheckedKeys.value = rows
  399. }
  400. const linksRawModalSave = () => {
  401. }
  402. //关闭原材检测报告
  403. const linksRawModalClose = () => {
  404. linksRawModal.value = false
  405. }
  406. //关联取样
  407. const linksSampleModal = ref(false)
  408. const linksSampleModalClick = () => {
  409. linksSampleTableData.value = [];
  410. linksSampleModal.value = true
  411. }
  412. //搜索表单
  413. const linksSampleSearchForm = ref({
  414. nodeId: null, current: 1, size: 20, total: 0
  415. })
  416. //树被点击
  417. const linksSampleTreeClick = ({data}) => {
  418. linksSampleSearchForm.value.nodeId = data.primaryKeyId;
  419. linksSampleSearchForm.value.current = 1;
  420. getLinksSampleData()
  421. }
  422. //关联取样数据
  423. const tableSampleRef = ref(null)
  424. const linksSampleTableColumn = ref([
  425. {key:'materialName', name: '样品名称'},
  426. {key:'samplingDate', name: '取样日期'},
  427. {key:'specificationModel', name: '规格型号'},
  428. {key:'proposedPosition', name: '拟用部位'},
  429. {key:'userName', name: '取样人'},
  430. ])
  431. const linksSampleTableData = ref([])
  432. //获取关联数据
  433. const linksSampleTableLoading = ref(false)
  434. const getLinksSampleData = async () => {
  435. linksSampleTableLoading.value = true
  436. const { error, code, data } = await dataApi.sampleListInfo({
  437. ...linksSampleSearchForm.value,
  438. projectId: projectId.value,
  439. contractId: contractId.value
  440. })
  441. //处理数据
  442. linksSampleTableLoading.value = false
  443. if (!error && code === 200) {
  444. linksSampleTableData.value = getArrValue(data)
  445. //searchForm.value.total = data.total || 0
  446. } else {
  447. linksSampleTableData.value = []
  448. //searchForm.value.total = 0
  449. }
  450. }
  451. //多选
  452. const tableSampleCheckedKeys = ref([]);
  453. const linksSampleTableSelection = (rows) => {
  454. tableSampleCheckedKeys.value = rows
  455. }
  456. //保存关联
  457. const linksSampleModalSave = () => {
  458. const rows = tableSampleCheckedKeys.value
  459. if (rows.length > 0) {
  460. listItemBaseData.value.sampleIds = rowsToId(rows) || '';
  461. tableSampleRef.value?.clearSelection();
  462. tableSampleCheckedKeys.value = [];
  463. linksSampleModal.value = false
  464. } else {
  465. window.$message?.warning('请先勾选需要关联的记录')
  466. }
  467. }
  468. //关闭关联取样
  469. const linksSampleModalClose = () => {
  470. linksSampleModal.value = false
  471. }
  472. //保存
  473. const tableFormSaveLoading = ref(false)
  474. const tableFormSaveClick = async () => {
  475. if(checkrelationString.value.length>0){
  476. listItemBaseData.value.projectPosition=checkrelationString.value
  477. }
  478. let FormData = ListItemRef.value?.getFormData()
  479. let FormRegExpJson = ListItemRef.value?.getFormRegExpJson()
  480. //效验数据
  481. if (getObjNullValue(FormRegExpJson)) {
  482. setFormRegExpJson(FormRegExpJson)
  483. } else if (FormData.length > 0) {
  484. tableFormSaveLoading.value = true
  485. const {error, code} = await dataApi.saveExcelBussData({
  486. ...listItemBaseData.value,
  487. isBatchSave:1,
  488. dataInfo: {orderList: FormData},
  489. // deviceUseIds:listDeviceUseIds.value
  490. })
  491. tableFormSaveLoading.value = false
  492. if (!error && code === 200) {
  493. window?.$message?.success('保存成功')
  494. listItemBaseData.value.deviceUseIds=''
  495. checkTabId.value=''
  496. if(!isaddType){
  497. // bussPdfsClick()
  498. }else{
  499. toBackClick()
  500. }
  501. getTableDataAll()
  502. }
  503. } else {
  504. if(!isaddType){
  505. window.$message?.warning('请先选择你需要编辑的表格')
  506. // bussPdfsClick()
  507. }else{
  508. window.$message?.warning('请先选择你需要新增的表格')
  509. }
  510. }
  511. }
  512. //效验数据
  513. const setFormRegExpJson = (FormRegExpJson) => {
  514. let nodeName = '', itemId = '';
  515. Object.keys(FormRegExpJson).forEach(key => {
  516. const name = FormRegExpJson[key]?.nodeName ?? ''
  517. if (name) {
  518. if (nodeName) {
  519. nodeName += ',' + name
  520. } else {
  521. nodeName = name
  522. itemId = FormRegExpJson[key]?.itemId
  523. }
  524. }
  525. })
  526. //const activeKey = ListItemRef.value?.getActiveKey()
  527. //弹出提示
  528. const val = '<div style="font-size: 16px;">请先完善 <span style="color:#1ECC95;">' + nodeName + '</span> 的数据内容</div>'
  529. window?.$messageBox?.alert(val, '表单完善提醒', {
  530. confirmButtonText: '确定',
  531. dangerouslyUseHTMLString: true,
  532. callback: (action) => {
  533. if (action === 'confirm') {
  534. ListItemRef.value?.setActiveKey(itemId)
  535. ListItemOffsetTop(0)
  536. setTimeout(() => {
  537. const offsetTop = document.getElementById(itemId)?.offsetTop
  538. ListItemOffsetTop(offsetTop)
  539. }, 350)
  540. }
  541. }
  542. })
  543. }
  544. //获取数据列表
  545. const nodeItemInfo = ref({})
  546. const nodeDataInfo = ref({})
  547. //查询状态
  548. const NodeStatus = ref('1')
  549. const queryNodeStatus = async () => {
  550. const info = getStoreData('prenodeDataInfo') || {}
  551. const {error, code, data} = await wbsApi.queryNodeStatus({
  552. primaryKeyId: info['contractIdRelation'] ? info['id'] : info['primaryKeyId'],
  553. classify: authBtnTabKey.value
  554. })
  555. //1 未填报,2待上报,3已上报
  556. if (!error && code === 200) {
  557. NodeStatus.value = data ?? '1'
  558. } else {
  559. NodeStatus.value = '1'
  560. }
  561. }
  562. //批量上报
  563. const reportIds = ref('')
  564. const reportTaskName = ref('')
  565. const reportAddition = ref({})
  566. const showReportModal = ref(false)
  567. const reportLoading = ref(false)
  568. const reportTypeData = ref([])
  569. // const reportModalClick = async () => {
  570. // showReportModal.value = true
  571. // }
  572. //上报完成
  573. const showReportFinish = () => {
  574. showReportModal.value = false
  575. getTableDataAll()
  576. }
  577. const reportModalClick = async () => {
  578. const info = getStoreData('prenodeDataInfo') || {}
  579. console.log(info,'info');
  580. const rows = listItemData.value;
  581. if (rows.length > 0) {
  582. reportLoading.value = true
  583. const taskCheck = await eVisaTaskCheckApi({
  584. projectId: projectId.value,
  585. contractId: contractId.value
  586. })
  587. //处理数据
  588. let newArr = [];
  589. // console.log(rows,'rows');
  590. for (let i = 0; i < rows.length; i++) {
  591. newArr.push(rows[i]['pKeyId'])
  592. }
  593. reportTypeData.value = newArr
  594. reportLoading.value = false
  595. if (taskCheck) {
  596. //初始弹出弹窗,防呆
  597. reportIds.value = info['primaryKeyId']
  598. reportAddition.value = {
  599. classify: authBtnTabKey.value,
  600. contractIdRelation: info['contractIdRelation'],
  601. }
  602. showReportModal.value = true
  603. //请求文件题名
  604. const {data} = await wbsApi.queryDocumentTitle({
  605. // primaryKeyId: info['primaryKeyId'],
  606. primaryKeyId:dataId,
  607. classify: authBtnTabKey.value
  608. })
  609. reportTaskName.value = isString(data)? data : ''
  610. }
  611. } else {
  612. window.$message?.warning('暂无相关数据')
  613. }
  614. }
  615. //多表预览
  616. const bussPdfsLoading = ref(false)
  617. const bussPdfsClick = async () => {
  618. bussPdfsLoading.value = true
  619. const {error, code, data} = await dataApi.getBussPdfs({
  620. projectId: projectId.value,
  621. contractId: contractId.value,
  622. classify: authBtnTabKey.value,
  623. tableType: tabTypeKey.value,
  624. nodeId: router.currentRoute.value.query.id,
  625. })
  626. bussPdfsLoading.value = false
  627. if (!error && code === 200) {
  628. window.open(data,'_blank')
  629. } else {
  630. window.$message?.warning('获取PDF失败')
  631. }
  632. }
  633. //撤回上报流程
  634. // const abolishOneClick = () => {
  635. // window.$message?.warning('暂无接口')
  636. // }
  637. //撤回上报流程
  638. const abolishOneClick = () => {
  639. window?.$messageBox?.alert('请谨慎考虑后,是否确定撤回?', '撤回上报', {
  640. showCancelButton: true,
  641. confirmButtonText: '确定撤回',
  642. cancelButtonText: '取消',
  643. callback: (action) => {
  644. if (action === 'confirm') {
  645. abolishOneSave()
  646. }
  647. }
  648. })
  649. }
  650. //撤回请求
  651. const abolishOneSave = async () => {
  652. const info = getStoreData('prenodeDataInfo') || {}
  653. const {error, code} = await wbsApi.abolishOne({
  654. primaryKeyId: info?.primaryKeyId || '',
  655. classify: authBtnTabKey.value
  656. })
  657. if (!error && code === 200) {
  658. window.$message?.success('撤回成功')
  659. getTableDataAll()
  660. }
  661. }
  662. //返回
  663. const toBackClick = () => {
  664. router.push({
  665. path: '/tentative/detect/test',
  666. query: {}
  667. })
  668. }
  669. const updeviceUseIds = (val) => {
  670. listItemBaseData.value.deviceUseIds=val
  671. }
  672. </script>
  673. <style lang="scss" scoped>
  674. @import "../../../styles/tentative/detect/test-form.scss";
  675. </style>