test.vue 26 KB

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