test.vue 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. <template>
  2. <div class="hc-page-layout-box">
  3. <div class="hc-layout-left-box" :style="'width:' + leftWidth + 'px;'">
  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. <el-scrollbar>
  15. <TestTree
  16. :autoExpandKeys="treeAutoExpandKeys"
  17. :projectId="projectId"
  18. :wbsTempId="projectInfo?.referenceWbsTemplateIdTrial"
  19. :wbsType="2"
  20. :tenantId="userInfo?.tenant_id"
  21. @nodeTap="wbsElTreeClick"/>
  22. </el-scrollbar>
  23. </div>
  24. <!--左右拖动-->
  25. <div class="horizontal-drag-line" @mousedown="onmousedown"/>
  26. </div>
  27. <div class="hc-page-content-box">
  28. <HcCard :scrollbar="false" actionSize="lg">
  29. <template #header>
  30. <HcTooltip keys="tentative_detect_test_add">
  31. <el-button type="primary" hc-btn :disabled="!primaryKeyId" @click="addFormModalClick">
  32. <HcIcon name="add-circle"/>
  33. <span>新增</span>
  34. </el-button>
  35. </HcTooltip>
  36. <HcTooltip keys="tentative_detect_test_copy">
  37. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="copyLoading" @click="copyDataClick">
  38. <HcIcon name="file-copy-2"/>
  39. <span>复制</span>
  40. </el-button>
  41. </HcTooltip>
  42. <HcTooltip keys="tentative_detect_test_del">
  43. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="removeLoading" @click="delModalClick">
  44. <HcIcon name="delete-bin-2"/>
  45. <span>删除</span>
  46. </el-button>
  47. </HcTooltip>
  48. <HcTooltip keys="tentative_detect_test_print">
  49. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="printPdfLoading" @click="printPdfClick">
  50. <HcIcon name="printer"/>
  51. <span>批量打印</span>
  52. </el-button>
  53. </HcTooltip>
  54. <HcTooltip keys="tentative_detect_test_print">
  55. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="reportPdfLoading" @click="reportPdfClick">
  56. <HcIcon name="printer"/>
  57. <span>批量上报</span>
  58. </el-button>
  59. </HcTooltip>
  60. <HcTooltip keys="tentative_detect_test_quit">
  61. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="quitPdfLoading" @click="quitPdfClick">
  62. <HcIcon name="printer"/>
  63. <span>批量废除</span>
  64. </el-button>
  65. </HcTooltip>
  66. <HcTooltip keys="tentative_detect_test_null">
  67. <el-button hc-btn :disabled="tableCheckedKeys.length <= 0" :loading="printNullPdfLoading" @click="printNullPdfClick">
  68. <HcIcon name="printer"/>
  69. <span>打印空表</span>
  70. </el-button>
  71. </HcTooltip>
  72. </template>
  73. <template #extra>
  74. <el-button :type="authBtnTabKey === '1'?'primary':''" hc-btn @click="authBtnTabClick('1')">
  75. <HcIcon name="folder-user"/>
  76. <span>施工自检</span>
  77. </el-button>
  78. <el-button :type="authBtnTabKey === '2'?'primary':''" hc-btn @click="authBtnTabClick('2')">
  79. <HcIcon name="folder-shield"/>
  80. <span>监理质检</span>
  81. </el-button>
  82. </template>
  83. <template #search>
  84. <div class="w-40">
  85. <el-input v-model="searchForm.trialUserName" placeholder="请输入试验人员" clearable @keyup="keyUpEvent"/>
  86. </div>
  87. <div class="w-40 ml-2">
  88. <el-select v-model="searchForm.queryStatus" placeholder="请选择是否合格" clearable>
  89. <el-option v-for="item in qualifiedData" :key="item.value" :label="item['label']" :value="item['value']"/>
  90. </el-select>
  91. </div>
  92. <div class="w-64 ml-2">
  93. <HcDatePicker :dates="betweenTime" clearable @change="betweenTimeUpdate"/>
  94. </div>
  95. <div class="w-72 ml-2">
  96. <el-input v-model="searchForm.queryValue" placeholder="请输入项目名称关键字" clearable @keyup="keyUpEvent"/>
  97. </div>
  98. <div class="ml-2">
  99. <el-button type="primary" @click="searchClick">
  100. <HcIcon name="search-2"/>
  101. <span>搜索</span>
  102. </el-button>
  103. </div>
  104. </template>
  105. <HcTable ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading" isCheck @selection-change="tableSelection">
  106. <template #recordNo="{row}">
  107. <span class="text-link" @click="tableRowEdit(row,'1')">{{row?.recordNo}}</span>
  108. </template>
  109. <template #reportNo="{row}">
  110. <span class="text-link" @click="tableRowEdit(row,'2')">{{row?.reportNo}}</span>
  111. </template>
  112. <template #trialProjectName="{row}">
  113. <span class="text-link font-bold" @click="tableRowPdf(row)">{{row?.trialProjectName}}</span>
  114. </template>
  115. <template #taskStatus="{row}">
  116. <!-- <el-tag :type="`${row.status === 2 ? 'success' : row.status === 0 ? 'warning' : row.status === 1 ? 'danger' : 'info'}`" -->
  117. <el-tag :type="`${row.taskStatus === '已审批' ? 'success' : row.taskStatus === '待审批' ? 'warning' : row.taskStatus === '已废除' ? 'danger' : 'info'}`"
  118. class="mx-1" effect="dark" v-if="row['taskStatus']">{{row['taskStatus']}}</el-tag>
  119. </template>
  120. <template #detectionCategory="{row}">
  121. <!-- <span>{{getArrKeyValue(categoryData, 'dictKey', 'dictValue', row.detectionCategory)}}</span> -->
  122. <span>{{row.detectionCategoryName}}</span>
  123. </template>
  124. <template #isUploadCertificate="{row}">
  125. <!-- <span>{{row.isUploadCertificate == 0 ? '是':row.isUploadCertificate == -1?'' : '否'}}</span> -->
  126. <span>{{row.isUploadCertificateName}}</span>
  127. </template>
  128. <template #contractId="{row}">
  129. <span>{{contractInfo?.name}}</span>
  130. </template>
  131. <template #detectionResult="{row}">
  132. <span>{{row.detectionResultName }}</span>
  133. </template>
  134. <template #action="{row}">
  135. <HcTooltip keys="tentative_detect_test_annex">
  136. <el-button type="primary" size="small" plain @click="viewAttachmentModalClick(row)">附件</el-button>
  137. </HcTooltip>
  138. <HcTooltip keys="tentative_detect_test_info">
  139. <el-button type="primary" size="small" plain @click="samplingRecordModalClick(row)">样品信息</el-button>
  140. </HcTooltip>
  141. </template>
  142. </HcTable>
  143. <template #action>
  144. <HcPages :pages="searchForm" @change="pageChange"/>
  145. </template>
  146. </HcCard>
  147. </div>
  148. <!--查看附件-->
  149. <HcDialog :show="viewAttachmentModal" title="查看附件" widths="70rem" :footer="false" isTable @close="viewAttachmentModalClose">
  150. <template #extra>
  151. <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" @change="tabTypeChange"/>
  152. </template>
  153. <div class="hc-switch-tab-content" v-loading="viewAttachmentLoading">
  154. <div class="h-full w-full flex">
  155. <div class="pdf-file-list-box">
  156. <template v-for="item in viewAttachmentData" >
  157. <div class="file-item" :class="[item.isCheck ? 'cur' : '']" @click="viewCurFile(item)">{{item.name||''}}</div>
  158. </template>
  159. <!-- <div class="file-item">文件名称2.pdf</div>
  160. <div class="file-item">文件名称3.pdf</div>
  161. <div class="file-item">文件名称4.pdf</div>
  162. <div class="file-item">文件名称5.pdf</div> -->
  163. </div>
  164. <!-- <iframe width='80%' height='100%' frameborder='1' :src="attachmentPdfUrl" v-if="attachmentPdfUrl"/> -->
  165. <div class="hc-no-table-form" >
  166. <div class="table-form-no">
  167. <HcDragUpload @progress="uploadprogress" @finished="uploadFinished" :datas="uploadData" :fileList="fileListData" v-if="listuploadref==='1'"/>
  168. <HcDragUpload @progress="uploadprogress" @finished="uploadFinished" :datas="uploadData" :fileList="fileListData" v-if="listuploadref==='2'"/>
  169. <HcDragUpload @progress="uploadprogress" @finished="uploadFinished" :datas="uploadData" :fileList="fileListData" v-if="listuploadref==='3'"/>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </HcDialog>
  175. <!--查看样品信息-->
  176. <HcDialog :show="samplingRecordModal" title="查看样品信息" widths="60%" :footer="false" isTable @close="samplingRecordModalClose">
  177. <HcTable :column="samplingTableColumn" :datas="samplingTableData" :loading="samplingTableLoading" :isIndex="false"></HcTable>
  178. </HcDialog>
  179. <!--批量上报审批-->
  180. <HcReportModal title="批量上报审批" url="informationWriteQuery/batchTask" :show="showReportModal" :projectId="projectId" :contractId="contractId" type="wbs" :typeData="reportTypeData"
  181. :taskName="reportTaskName" :ids="reportIds" :addition="reportAddition" :trialSelfInspectionRecordId="1" @hide="showReportModal = false" @finish="showReportFinish"/>
  182. </div>
  183. </template>
  184. <script setup>
  185. import {ref, watch, onMounted} from "vue";
  186. import {useRouter} from 'vue-router'
  187. import {useAppStore} from "~src/store";
  188. import TestTree from "../material/components/TestTree.vue"
  189. import {getStoreData, setStoreData, delStoreData} from '~src/utils/storage'
  190. import {getArrValue, getArrKeyValue, isString} from "vue-utils-plus";
  191. import HcDragUpload from "./components/HcDragUpload.vue"
  192. import dataApi from "~api/tentative/detect/test";
  193. import {delMessage, rowsToId} from "~uti/tools";
  194. import {getDictionary} from "~api/other";
  195. import { eVisaTaskCheckApi} from "~api/other"
  196. import wbsApi from "~api/data-fill/wbs"
  197. //变量
  198. const router = useRouter()
  199. const useAppState = useAppStore()
  200. const userInfo = ref(useAppState.getUserInfo);
  201. const projectId = ref(useAppState.getProjectId);
  202. const contractId = ref(useAppState.getContractId);
  203. const projectInfo = ref(useAppState.getProjectInfo);
  204. const contractInfo = ref(useAppState.getContractInfo);
  205. const isCollapse = ref(useAppState.getCollapse)
  206. const isBubble = ref(useAppState.getBubble);
  207. //监听
  208. watch(() => [
  209. useAppState.getCollapse,
  210. useAppState.getBubble,
  211. ], ([Collapse,bubble]) => {
  212. isCollapse.value = Collapse
  213. isBubble.value = bubble
  214. })
  215. //获取气泡数据
  216. const getButtonsVal = (value) => {
  217. return useAppState.getButtonsVal(value)
  218. }
  219. //自动展开缓存
  220. const treeAutoExpandKeys = ref(getStoreData('testTreeExpandKeys') || [])
  221. const btn_edit = ref(false)
  222. //渲染完成
  223. onMounted(() => {
  224. btn_edit.value = getButtonsVal('tentative_detect_test_edit')
  225. setContractType(contractInfo.value?.contractType)
  226. getCategoryData()
  227. })
  228. const qualifiedData = ref([
  229. {label: '不合格', value: '0'},
  230. {label: '合格', value: '1'}
  231. ])
  232. //获取检测类别类型
  233. const categoryData = ref([])
  234. const getCategoryData = async () => {
  235. const { data } = await getDictionary({
  236. code: 'trial_detection_category'
  237. })
  238. const arrData = getArrValue(data)
  239. arrData.forEach(item => {
  240. item.dictKey = Number(item.dictKey)
  241. })
  242. categoryData.value = arrData
  243. }
  244. //搜索表单
  245. const searchForm = ref({
  246. trialUserName: null, queryStatus: null, queryValue: null, type: '1',
  247. current: 1, size: 20, total: 0
  248. })
  249. //树相关的变量
  250. const primaryKeyId = ref('')
  251. const nodeDataInfo = ref({})
  252. //树被点击
  253. const wbsElTreeClick = ({data, keys}) => {
  254. nodeDataInfo.value = data
  255. primaryKeyId.value = data['primaryKeyId'] || ''
  256. setStoreData('testTreeItem',data)
  257. //缓存自动展开
  258. treeAutoExpandKeys.value = keys
  259. setStoreData('testTreeExpandKeys',keys)
  260. //改变搜索表单数据
  261. searchForm.value.nodeId = data['primaryKeyId'];
  262. searchForm.value.current = 1;
  263. getTableData()
  264. }
  265. //身份按钮切换数据
  266. const authBtnTabKey = ref('1')
  267. const authBtnTabClick = (val) => {
  268. if (val !== authBtnTabKey.value) {
  269. authBtnTabKey.value = val
  270. searchForm.value.type = val;
  271. searchForm.value.current = 1;
  272. getTableData()
  273. }
  274. }
  275. //contractType, 1施工,2监理
  276. const setContractType = (contractType) => {
  277. let typeValue = '1';
  278. if (contractType > 0) {
  279. typeValue = contractType + ''
  280. }
  281. authBtnTabKey.value = typeValue
  282. searchForm.value.type = typeValue
  283. searchForm.value.current = 1;
  284. }
  285. //日期时间被选择
  286. const betweenTime = ref(null)
  287. const betweenTimeUpdate = ({arr}) => {
  288. betweenTime.value = arr
  289. if (arr.length > 0) {
  290. searchForm.value.startTime = arr[0]
  291. searchForm.value.endTime = arr[1]
  292. }else{
  293. searchForm.value.startTime = ''
  294. searchForm.value.endTime =''
  295. }
  296. }
  297. //回车搜索
  298. const keyUpEvent = (e) => {
  299. if (e.key === "Enter") {
  300. searchForm.value.current = 1;
  301. getTableData()
  302. }
  303. }
  304. //搜索
  305. const searchClick = () => {
  306. searchForm.value.current = 1;
  307. getTableData()
  308. }
  309. //分页被点击
  310. const pageChange = ({current, size}) => {
  311. searchForm.value.current = current
  312. searchForm.value.size = size
  313. getTableData()
  314. }
  315. //表格数据
  316. const tableRef = ref(null)
  317. const tableColumn = ref([
  318. {key:'recordNo', name: '记录编号', width: 220},
  319. {key:'reportNo', name: '报告编号', width: 220},
  320. {key:'samplingLocation', name: '取样地点', width: 220},
  321. {key:'trialProjectName', name: '试验项目名称', width: 220},
  322. {key:'detectionResult', name: '检测结果', width: 160},
  323. {key:'taskStatus', name: '任务状态', width: 140},
  324. {key:'detectionCategory', name: '检测类别', width: 120},
  325. {key:'isUploadCertificate', name: '是否上传合格证', width: 130},
  326. {key:'contractId', name: '合同段', width: 220},
  327. {key:'company', name: '单位', width: 160},
  328. {key:'specificationNumber', name: '样品编号', width: 220},
  329. {key:'specificationModel', name: '规格类型', width: 200},
  330. //{key:'projectPosition', name: '工程部位及用途', width: 160},
  331. {key:'projectPositionName', name: '工程部位及用途', width: 160},
  332. {key:'reportDate', name: '报告日期', width: 170},
  333. {key:'trialUserName', name: '试验人员', width: 170},
  334. {key:'action', name: '操作', width: 150, fixed: 'right', align: 'center'},
  335. ])
  336. const tableData = ref([])
  337. //获取数据
  338. const tableLoading = ref(false)
  339. const getTableData = async () => {
  340. tableLoading.value = true
  341. const { error, code, data } = await dataApi.queryPage({
  342. ...searchForm.value,
  343. projectId: projectId.value,
  344. contractId: contractId.value
  345. })
  346. //处理数据
  347. tableLoading.value = false
  348. if (!error && code === 200) {
  349. tableData.value = getArrValue(data['records'])
  350. searchForm.value.total = data.total || 0
  351. } else {
  352. tableData.value = []
  353. searchForm.value.total = 0
  354. }
  355. }
  356. //多选
  357. const tableCheckedKeys = ref([]);
  358. const tableSelection = (rows) => {
  359. tableCheckedKeys.value = rows
  360. }
  361. //新增
  362. const addFormModalClick = () => {
  363. delStoreData('test-form')
  364. router.push({
  365. path: '/tentative/detect/test-form',
  366. query: {
  367. nodeId: primaryKeyId.value,
  368. dataType: authBtnTabKey.value,
  369. isaddType:true,
  370. }
  371. })
  372. }
  373. //编辑
  374. const tableRowEdit = (row,tabTypeKey) => {
  375. setStoreData('test-form', row)
  376. setStoreData('prenodeDataInfo', nodeDataInfo.value)
  377. console.log(JSON.stringify(nodeDataInfo.value),'JSON.stringify(nodeDataInfo.value)');
  378. router.push({
  379. path: '/tentative/detect/test-form',
  380. query: {
  381. id: row.id,
  382. nodeId: row.nodeId,
  383. dataType: row.type,
  384. tabTypeKey:tabTypeKey
  385. // prenodeDataInfo:JSON.stringify(nodeDataInfo.value)
  386. }
  387. })
  388. }
  389. //预览PDF
  390. const tableRowPdf = ({pdfUrl}) => {
  391. if (pdfUrl) {
  392. window.open(pdfUrl,'_blank')
  393. } else {
  394. window.$message?.warning('该数据暂无PDF')
  395. }
  396. }
  397. //复制
  398. const copyDataClick = () => {
  399. const rows = tableCheckedKeys.value;
  400. if (rows.length > 0) {
  401. const ids = rowsToId(rows)
  402. copyDataApi(ids)
  403. } else {
  404. window.$message?.warning('请先勾选需要复制的记录')
  405. }
  406. }
  407. //请求复制
  408. const copyLoading = ref(false)
  409. const copyDataApi = async (ids) => {
  410. //请求数据
  411. copyLoading.value = true
  412. const { error, code, msg } = await dataApi.copyData({
  413. ids: ids
  414. },false)
  415. //处理数据
  416. copyLoading.value = false
  417. if (!error && code === 200) {
  418. window.$message?.success('复制成功')
  419. searchClick()
  420. } else {
  421. window.$message?.error(msg)
  422. }
  423. }
  424. //删除
  425. const delModalClick = () => {
  426. const rows = tableCheckedKeys.value;
  427. if (rows.length > 0) {
  428. delMessage(() => {
  429. const ids = rowsToId(rows)
  430. removeDataApi(ids)
  431. })
  432. } else {
  433. window.$message?.warning('请先勾选需要删除的记录')
  434. }
  435. }
  436. //请求删除
  437. const removeLoading = ref(false)
  438. const removeDataApi = async (ids) => {
  439. //请求数据
  440. removeLoading.value = true
  441. const { error, code, msg } = await dataApi.removeData({
  442. ids: ids
  443. },false)
  444. //处理数据
  445. removeLoading.value = false
  446. if (!error && code === 200) {
  447. window.$message?.success('删除成功')
  448. searchClick()
  449. } else {
  450. window.$message?.error(msg)
  451. }
  452. }
  453. //批量打印
  454. const printPdfLoading = ref(false)
  455. const printPdfClick = async () => {
  456. const rows = tableCheckedKeys.value;
  457. if (rows.length > 0) {
  458. const ids = rowsToId(rows)
  459. //请求数据
  460. printPdfLoading.value = true
  461. const { error, code, msg, data } = await dataApi.printPdf({
  462. ids: ids
  463. },false)
  464. //处理数据
  465. const pdfUrl = isString(data) ? data || '' : ''
  466. printPdfLoading.value = false
  467. if (!error && code === 200 && pdfUrl) {
  468. window.open(pdfUrl,'_blank')
  469. } else {
  470. window.$message?.error(msg || '文件异常')
  471. }
  472. } else {
  473. window.$message?.warning('请先勾选需要批量打印的记录')
  474. }
  475. }
  476. //批量废除
  477. const quitPdfLoading = ref(false)
  478. const quitPdfClick = async () => {
  479. const rows = tableCheckedKeys.value;
  480. if (rows.length > 0) {
  481. const ids = rowsToId(rows)
  482. //请求数据
  483. quitPdfLoading.value = true
  484. const { error, code, msg, data } = await dataApi.batchAbolish({
  485. ids: ids
  486. },false)
  487. //处理数据
  488. if (!error && code === 200) {
  489. window.$message?.success('废除成功')
  490. quitPdfLoading.value = false
  491. searchClick()
  492. } else {
  493. quitPdfLoading.value = false
  494. window.$message?.error(msg)
  495. }
  496. } else {
  497. window.$message?.warning('请先勾选需要批量打印的记录')
  498. }
  499. }
  500. //批量上报
  501. const reportPdfLoading = ref(false)
  502. //批量上报
  503. const reportIds = ref('')
  504. const reportTaskName = ref('')
  505. const reportAddition = ref({})
  506. const showReportModal = ref(false)
  507. const reportLoading = ref(false)
  508. const reportTypeData = ref([])
  509. const reportPdfClick = async () => {
  510. const rows = tableCheckedKeys.value;
  511. if (rows.length > 0) {
  512. const info = getStoreData('prenodeDataInfo') || {}
  513. console.log(info,'info');
  514. const rows = tableCheckedKeys.value;
  515. if (rows.length > 0) {
  516. reportLoading.value = true
  517. const taskCheck = await eVisaTaskCheckApi({
  518. projectId: projectId.value,
  519. contractId: contractId.value
  520. })
  521. //处理数据
  522. let newArr = [];
  523. console.log(rows,'rows');
  524. for (let i = 0; i < rows.length; i++) {
  525. newArr.push(rows[i]['tableIds'])
  526. }
  527. reportTypeData.value = [...newArr];
  528. console.log( reportTypeData.value,' reportTypeData.value');
  529. reportLoading.value = false
  530. if (taskCheck) {
  531. //初始弹出弹窗,防呆
  532. reportIds.value = info['primaryKeyId']
  533. reportAddition.value = {
  534. classify: authBtnTabKey.value,
  535. contractIdRelation: info['contractIdRelation'],
  536. }
  537. showReportModal.value = true
  538. //请求文件题名
  539. const {data} = await wbsApi.queryDocumentTitle({
  540. // primaryKeyId: info['primaryKeyId'],
  541. primaryKeyId:info['primaryKeyId'],
  542. classify: authBtnTabKey.value
  543. })
  544. reportTaskName.value = isString(data)? data : ''
  545. }
  546. } else {
  547. window.$message?.warning('暂无相关数据')
  548. }
  549. } else {
  550. window.$message?.warning('请先勾选需要批量打印的记录')
  551. }
  552. }
  553. //上报完成
  554. const showReportFinish = () => {
  555. showReportModal.value = false
  556. getTableData()
  557. }
  558. //打印空表
  559. const printNullPdfLoading = ref(false)
  560. const printNullPdfClick = async () => {
  561. const rows = tableCheckedKeys.value;
  562. if (rows.length > 0) {
  563. const ids = rowsToId(rows)
  564. //请求数据
  565. printNullPdfLoading.value = true
  566. const { error, code, msg, data } = await dataApi.printNullPdf({
  567. ids: ids
  568. },false)
  569. //处理数据
  570. const pdfUrl = isString(data) ? data || '' : ''
  571. printNullPdfLoading.value = false
  572. if (!error && code === 200 && pdfUrl) {
  573. window.open(pdfUrl,'_blank')
  574. } else {
  575. window.$message?.error(msg || '文件异常')
  576. }
  577. } else {
  578. window.$message?.warning('请先勾选需要打印空表的记录')
  579. }
  580. }
  581. //查看附件
  582. const viewAttachmentModal = ref(false)
  583. const viewAttachmentLoading = ref(false)
  584. const viewAttachmentId = ref('')
  585. const viewAttachmentData = ref([])
  586. const viewAttachmentModalClick = async ({id}) => {
  587. viewAttachmentId.value=id
  588. viewAttachmentLoading.value = true
  589. const { error, code, data } = await dataApi.ancillaryDocumentsList({id: id})
  590. //处理数据
  591. viewAttachmentLoading.value = false
  592. if (!error && code === 200) {
  593. viewAttachmentData.value = getArrValue(data)
  594. if ( viewAttachmentData.value.length<1) {
  595. window.$message?.warning('该条记录不存在附件')
  596. }else{
  597. viewAttachmentModal.value = true
  598. viewCurFile( viewAttachmentData.value[0])
  599. }
  600. } else {
  601. viewAttachmentData.value = []
  602. }
  603. }
  604. const refeshAttachmentModalClick = async (id) => {
  605. const { error, code, data } = await dataApi.ancillaryDocumentsList({id: id})
  606. //处理数据
  607. viewAttachmentLoading.value = false
  608. if (!error && code === 200) {
  609. viewAttachmentData.value = getArrValue(data)
  610. if ( viewAttachmentData.value.length<1) {
  611. window.$message?.warning('该条记录不存在附件')
  612. }else{
  613. viewCurFile( viewAttachmentData.value[0])
  614. }
  615. } else {
  616. viewAttachmentData.value = []
  617. }
  618. }
  619. const attachmentPdfUrl = ref('')
  620. const curFileData =ref ({})
  621. //类型tab数据和相关处理
  622. const tabTypeKey = ref('productionCertificate')
  623. const tabTypeTab = ref([
  624. {key:'productionCertificate', name: '生产合格证'},
  625. {key:'qualityInspectionReport', name: '厂家质检报告'},
  626. {key:'otherAccessories', name: '其他文件'},
  627. ]);
  628. const tabTypeChange = (item) => {
  629. tabTypeKey.value = item?.key
  630. viewCurFile(curFileData.value)
  631. fileListData.value=[]
  632. refeshAttachmentModalClick(viewAttachmentId.value)
  633. }
  634. //关闭查看附件
  635. const viewAttachmentModalClose = () => {
  636. viewAttachmentModal.value = false
  637. curFileData.value=''
  638. attachmentPdfUrl.value=''
  639. }
  640. const uploadData = ref({})
  641. const fileListData=ref([])
  642. const listuploadref=ref('1')
  643. //截取文件名称
  644. const splitFileName=(str)=>{
  645. if(str.indexOf("https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload") != -1){
  646. let a=str.split('//')[2].split('/')[2]
  647. return a
  648. }else{
  649. return str
  650. }
  651. }
  652. //查看当前文件pdf
  653. const viewCurFile = (item) => {
  654. curFileData.value=item
  655. viewAttachmentData.value.forEach((ele)=>{
  656. if (ele.name===item.name) {
  657. ele.isCheck=true
  658. }else{
  659. ele.isCheck=false
  660. }
  661. })
  662. if(tabTypeKey.value=='productionCertificate'&&item.productionCertificate.length>0){
  663. let arr=[]
  664. arr.push({name:splitFileName(item.productionCertificateName),url:item.productionCertificate})
  665. fileListData.value =getArrValue(arr)
  666. listuploadref.value='1'
  667. }else if(tabTypeKey.value=='qualityInspectionReport'&&item.qualityInspectionReport.length>0){
  668. let arr=[]
  669. arr.push({name:splitFileName(item.qualityInspectionReportName),url:item.qualityInspectionReport})
  670. fileListData.value =getArrValue(arr)
  671. listuploadref.value='2'
  672. }else if(tabTypeKey.value=='otherAccessories'&&item.otherAccessories.length>0){
  673. let arr=[]
  674. arr.push({name:splitFileName(item.otherAccessoriesName),url:item.otherAccessories})
  675. console.log(arr,'arr');
  676. fileListData.value =getArrValue(arr)
  677. listuploadref.value='3'
  678. }else{
  679. attachmentPdfUrl.value=''
  680. }
  681. }
  682. //上传进度
  683. const uploadprogress = (res) => {
  684. console.log('进度');
  685. }
  686. const productionCertificatefile=ref('')
  687. const qualityInspectionReportfile=ref('')
  688. const otherAccessoriesfile=ref('')
  689. //上传完成
  690. const uploadFinished = async(res) => {
  691. if(tabTypeKey.value=='productionCertificate'){
  692. productionCertificatefile.value =res
  693. } else if (tabTypeKey.value=='qualityInspectionReport') {
  694. qualityInspectionReportfile.value=res
  695. }else{
  696. otherAccessoriesfile.value=res
  697. }
  698. const { error, code, data } = await dataApi.updateAncillaryDocument(
  699. {
  700. id:curFileData.value.id,
  701. productionCertificate:productionCertificatefile.value.link,
  702. qualityInspectionReport:qualityInspectionReportfile.value.link,
  703. otherAccessories:otherAccessoriesfile.value.link
  704. })
  705. }
  706. //样品信息数据
  707. const samplingTableColumn = ref([
  708. {key:'materialName', name: '样品名称'},
  709. {key:'samplingDate', name: '取样时间'},
  710. {key:'specificationNumber', name: '样品编号'},
  711. {key:'specificationModel', name: '规格型号'},
  712. {key:'materialCount', name: '试样数量'},
  713. {key:'calculationUnit', name: '计算单位'},
  714. {key:'proposedPosition', name: '拟用部位'},
  715. {key:'representativeCount', name: '代表数量'},
  716. {key:'userName', name: '取样人'},
  717. ])
  718. const samplingTableData = ref([])
  719. const samplingTableLoading = ref(false)
  720. //取样记录
  721. const samplingRecordModal = ref(false)
  722. const samplingRecordModalClick = async ({id}) => {
  723. samplingRecordModal.value = true
  724. samplingTableLoading.value = true
  725. const { error, code, data } = await dataApi.getSampleList({
  726. id: id
  727. })
  728. //处理数据
  729. samplingTableLoading.value = false
  730. if (!error && code === 200) {
  731. samplingTableData.value = getArrValue(data)
  732. } else {
  733. samplingTableData.value = []
  734. }
  735. }
  736. //关闭样品信息
  737. const samplingRecordModalClose = () => {
  738. samplingRecordModal.value = false
  739. samplingTableData.value = []
  740. }
  741. //左右拖动,改变树形结构宽度
  742. const leftWidth = ref(382);
  743. const onmousedown = () => {
  744. const leftNum = isCollapse.value ? 142 : 272
  745. document.onmousemove = (ve) => {
  746. let diffVal = ve.clientX - leftNum;
  747. if(diffVal >= 310 && diffVal <= 900) {
  748. leftWidth.value = diffVal;
  749. }
  750. }
  751. document.onmouseup = () => {
  752. document.onmousemove = null;
  753. document.onmouseup = null;
  754. }
  755. }
  756. </script>
  757. <style lang="scss" scoped>
  758. @import "../../../styles/tentative/detect/test.scss";
  759. .hc-switch-tab-content {
  760. .pdf-file-list-box {
  761. position: relative;
  762. border-right: 1px solid #e9e9e9;
  763. padding: 5px 0;
  764. overflow-y: auto;
  765. height: 100%;
  766. flex: 1;
  767. .file-item {
  768. position: relative;
  769. cursor: pointer;
  770. padding: 6px 10px;
  771. &:hover {
  772. color: var(--el-color-primary);
  773. background-color: var(--el-color-primary-light-8);
  774. }
  775. &.cur {
  776. color: var(--el-color-primary);
  777. background-color: var(--el-color-primary-light-8);
  778. }
  779. }
  780. }
  781. .hc-no-table-form {
  782. flex: 1;
  783. }
  784. }
  785. </style>