test.vue 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494
  1. <template>
  2. <div class="hc-page-layout-box">
  3. <div
  4. :style="`width:${isWbsTreeShow ? leftWidth : 0}px; ${isWbsTreeShow ? '' : 'display: none'}`"
  5. class="hc-layout-left-box bg-white" :class="[isWbsTreeShow ? 'show' : '']"
  6. >
  7. <div class="hc-project-box">
  8. <div class="hc-project-icon-box">
  9. <hc-icon name="stack" />
  10. </div>
  11. <div class="project-name-box ml-2">
  12. <div class="project-alias">{{ projectInfo.projectName }}</div>
  13. </div>
  14. </div>
  15. <div class="hc-tree-box">
  16. <el-scrollbar>
  17. <TestTree
  18. :auto-expand-keys="treeAutoExpandKeys"
  19. :project-id="projectId"
  20. :tenant-id="userInfo?.tenant_id"
  21. :wbs-temp-id="projectInfo?.referenceWbsTemplateIdTrial"
  22. :wbs-type="2"
  23. :entrust="1"
  24. @node-tap="wbsElTreeClick"
  25. />
  26. </el-scrollbar>
  27. </div>
  28. <!-- 左右拖动 -->
  29. <div class="horizontal-drag-line" @mousedown="onmousedown" />
  30. </div>
  31. <div class="hc-page-content-box">
  32. <!---展开收缩树 -->
  33. <div class="hc-expansion-contraction-tree" @click="setWbsTreeShow">
  34. <hc-icon v-show="isWbsTreeShow" name="arrow-left-s" />
  35. <hc-icon v-show="!isWbsTreeShow" name="arrow-right-s" />
  36. </div>
  37. <HcTabCard :tabs="authBtnTabdata" :tab-key="authBtnTabKey" @change="authBtnTabClick">
  38. <template #extra>
  39. <HcTooltip keys="tentative_detect_test_add">
  40. <el-button
  41. :disabled="!primaryKeyId" hc-btn color="#37c0fe" style="color: white;"
  42. @click="addFormModalClick"
  43. >
  44. <hc-icon name="add-circle" />
  45. <span>新增</span>
  46. </el-button>
  47. </HcTooltip>
  48. <!-- <HcTooltip keys="tentative_detect_test_copy">
  49. <el-button
  50. :disabled="tableCheckedKeys.length <= 0" :loading="copyLoading" hc-btn
  51. color="#A16222" @click="copyDataClick"
  52. >
  53. <hc-icon name="file-copy-2" />
  54. <span>复制</span>
  55. </el-button>
  56. </HcTooltip> -->
  57. <HcTooltip keys="tentative_detect_test_report">
  58. <el-button
  59. :disabled="tableCheckedKeys.length <= 0" :loading="reportPdfLoading" hc-btn
  60. color="#FF976A" style="color: white;" @click="reportPdfClick"
  61. >
  62. <hc-icon name="send-plane-2" />
  63. <span>批量上报</span>
  64. </el-button>
  65. </HcTooltip>
  66. <!-- <el-button
  67. :disabled="tableCheckedKeys.length <= 0" :loading="sortLoading" hc-btn
  68. color="#567722" @click="sortClick"
  69. >
  70. <HcIcon name="arrow-up-down" />
  71. <span>排序</span>
  72. </el-button> -->
  73. <!-- <HcTooltip keys="tentative_detect_test_quit">
  74. <el-button
  75. :disabled="tableCheckedKeys.length <= 0" :loading="quitPdfLoading" hc-btn
  76. color="#e54d42" @click="quitPdfClick"
  77. >
  78. <hc-icon name="delete-bin-3" />
  79. <span>批量废除</span>
  80. </el-button>
  81. </HcTooltip> -->
  82. <!-- <HcTooltip keys="tentative_detect_test_null">
  83. <el-button
  84. :disabled="tableCheckedKeys.length <= 0" :loading="printNullPdfLoading" hc-btn
  85. color="#567722" @click="printNullPdfClick"
  86. >
  87. <hc-icon name="printer" />
  88. <span>打印空表</span>
  89. </el-button>
  90. </HcTooltip> -->
  91. <HcTooltip keys="tentative_detect_test_del">
  92. <el-button
  93. :disabled="tableCheckedKeys.length <= 0" :loading="removeLoading" hc-btn
  94. color="#e03997" class="ml-2" @click="delModalClick"
  95. >
  96. <hc-icon name="delete-bin-2" />
  97. <span>删除</span>
  98. </el-button>
  99. </HcTooltip>
  100. <el-button class="ml-2" :disabled="tableCheckedKeys.length <= 0" :loading="signLoading" hc-btn type="primary" @click="resignClick">re-sign</el-button>
  101. <el-dropdown trigger="click">
  102. <el-button hc-btn type="success" :loading="dataBtnLoad">
  103. <span>综合功能</span>
  104. <hc-icon name="arrow-down-s" />
  105. </el-button>
  106. <template #dropdown>
  107. <el-dropdown-menu>
  108. <template v-for="item in dataSyncMenu" :key="item.key">
  109. <el-dropdown-item :disabled="tableCheckedKeys.length <= 0" @click="dataSyncMenuClick(item)">{{ item.name }}</el-dropdown-item>
  110. </template>
  111. </el-dropdown-menu>
  112. </template>
  113. </el-dropdown>
  114. </template>
  115. <template #search>
  116. <div class="w-40">
  117. <el-input
  118. v-model="searchForm.trialUserName" clearable placeholder="请输入试验人员"
  119. @keyup="keyUpEvent"
  120. />
  121. </div>
  122. <div class="ml-2 w-200px">
  123. <el-select v-model="searchForm.contractId" placeholder="选择合同段" filterable block>
  124. <el-option
  125. v-for="item in contractData" :key="item.id" :label="item.contractName"
  126. :value="item.id"
  127. />
  128. </el-select>
  129. </div>
  130. <div class="ml-2 w-32">
  131. <el-select v-model="searchForm.queryStatus" clearable placeholder="是否合格">
  132. <el-option
  133. v-for="item in qualifiedData" :key="item.value" :label="item.label"
  134. :value="item.value"
  135. />
  136. </el-select>
  137. </div>
  138. <div class="ml-2 w-250px">
  139. <hc-date-picker :dates="betweenTime" clearable @change="betweenTimeUpdate" />
  140. </div>
  141. <div class="ml-2 w-72">
  142. <el-input v-model="searchForm.queryValue" clearable placeholder="请输入项目名称关键字" @keyup="keyUpEvent" />
  143. </div>
  144. <div class="ml-2">
  145. <el-button type="primary" @click="searchClick">
  146. <hc-icon name="search-2" />
  147. <span>搜索</span>
  148. </el-button>
  149. </div>
  150. </template>
  151. <HcTable
  152. ref="tableRef" :column="tableColumn" :datas="tableData" :loading="tableLoading"
  153. is-new :index-style="{ width: 60 }" is-check :check-style="{ width: 29 }"
  154. @selection-change="tableSelection"
  155. >
  156. <template #recordNo="{ row }">
  157. <span class="text-link" @click="tableRowEdit(row, '1')">{{ row?.recordNo }}</span>
  158. </template>
  159. <template #reportNo="{ row }">
  160. <span class="text-link" @click="tableRowEdit(row, '2')">{{ row?.reportNo }}</span>
  161. </template>
  162. <template #trialProjectName="{ row }">
  163. <span class="text-link font-bold" @click="tableRowPdf(row)">{{ row?.trialProjectName }}</span>
  164. </template>
  165. <template #taskStatus="{ row }">
  166. <!-- <el-tag :type="`${row.status === 2 ? 'success' : row.status === 0 ? 'warning' : row.status === 1 ? 'danger' : 'info'}`" -->
  167. <el-tag
  168. v-if="row.taskStatus"
  169. :type="`${row.taskStatus === '已审批' ? 'success' : row.taskStatus === '待审批' ? 'warning' : row.taskStatus === '已废除' ? 'danger' : 'info'}`"
  170. class="mx-1" effect="dark"
  171. >
  172. {{ row.taskStatus }}
  173. </el-tag>
  174. </template>
  175. <template #detectionCategory="{ row }">
  176. <!-- <span>{{arrKeyValue(categoryData, 'dictKey', 'dictValue', row.detectionCategory)}}</span> -->
  177. <span>{{ row.detectionCategoryName }}</span>
  178. </template>
  179. <template #isUploadCertificate="{ row }">
  180. <!-- <span>{{row.isUploadCertificate == 0 ? '是':row.isUploadCertificate == -1?'' : '否'}}</span> -->
  181. <span>{{ row.isUploadCertificateName }}</span>
  182. </template>
  183. <template #contractId="{ row }">
  184. <span>{{ contractInfo?.name }}</span>
  185. </template>
  186. <template #detectionResult="{ row }">
  187. <span>{{ row?.reportNo && row?.reportNo.length > 0 ? row.detectionResultName : '' }}</span>
  188. </template>
  189. <template #action="{ row }">
  190. <HcTooltip keys="tentative_detect_test_annex">
  191. <el-link type="primary" @click="viewAttachmentModalClick(row)">附件</el-link>
  192. </HcTooltip>
  193. <el-link type="primary" @click="relatedSearchClick(row)">关联查阅</el-link>
  194. <!-- HcTooltip keys="tentative_detect_test_info">
  195. <el-link type="primary" @click="samplingRecordModalClick(row)">样品信息</el-link>
  196. </HcTooltip -->
  197. </template>
  198. </HcTable>
  199. <template #action>
  200. <HcPages :pages="searchForm" @change="pageChange" />
  201. </template>
  202. </HcTabCard>
  203. </div>
  204. <!-- 查看附件 -->
  205. <hc-new-dialog
  206. :footer="false" :show="viewAttachmentModal" is-table title="查看附件" widths="70rem"
  207. @close="viewAttachmentModalClose"
  208. >
  209. <template #extra>
  210. <HcNewSwitch :datas="tabTypeTab" :keys="tabTypeKey" size="default" @change="tabTypeChange" />
  211. </template>
  212. <div v-loading="viewAttachmentLoading" class="hc-switch-tab-content">
  213. <div class="h-full w-full flex">
  214. <div v-if="viewAttachmentData.length > 0" class="pdf-file-list-box">
  215. <template v-for="item in viewAttachmentData">
  216. <div :class="[item.isCheck ? 'cur' : '']" class="file-item" @click="viewCurFile(item)">
  217. {{ item.fileName || '' }}
  218. </div>
  219. </template>
  220. </div>
  221. <div v-else class="pdf-file-list-box">
  222. <hc-empty />
  223. </div>
  224. <!-- <iframe v-if="attachmentPdfUrl" :src="attachmentPdfUrl" frameborder="1" height="100%" width="80%" /> -->
  225. <div class="hc-no-table-form">
  226. <div class="table-form-no">
  227. <HcDragUpload
  228. :datas="uploadData" :file-list="fileListData" @del-file="delFileData"
  229. @finished="uploadFinished" @progress="uploadprogress" @close="viewAttachmentModalClose"
  230. />
  231. </div>
  232. </div>
  233. </div>
  234. </div>
  235. </hc-new-dialog>
  236. <!-- 查看样品信息 -->
  237. <hc-new-dialog
  238. :footer="false" :show="samplingRecordModal" is-table title="查看样品信息" widths="60%"
  239. @close="samplingRecordModalClose"
  240. >
  241. <HcTable
  242. :column="samplingTableColumn" :datas="samplingTableData" :is-index="false"
  243. :loading="samplingTableLoading" is-new
  244. />
  245. </hc-new-dialog>
  246. <!-- 关联查阅 -->
  247. <hc-dialog
  248. v-model="isRelatedSearch" :footer="false" is-table title="关联查阅" widths="80%" :padding="false"
  249. @close="relatedSearchModalClose"
  250. >
  251. <div class="hc-related-search-box relative mt-10px">
  252. <hc-card-item title="样品信息">
  253. <template #extra>
  254. <el-button :disabled="relatedData1.length <= 0" type="primary" size="small" @click="rowDispose">
  255. 样品处理
  256. </el-button>
  257. </template>
  258. <hc-table :column="relatedColumn1" :datas="relatedData1" :is-index="false" />
  259. </hc-card-item>
  260. <hc-card-item title="委托单信息" class="mt-14px">
  261. <hc-table :column="relatedColumn2" :datas="relatedData2" :is-index="false">
  262. <template #status="{ row }">
  263. <el-tag v-if="row.status === 1" type="info" effect="dark">未上报</el-tag>
  264. <el-tag v-if="row.status === 2" type="warning" effect="dark">已上报-待审批</el-tag>
  265. <el-tag v-if="row.status === 3" type="primary" effect="dark">待试验</el-tag>
  266. <el-tag v-if="row.status === 4" type="success" effect="dark">委托完成</el-tag>
  267. </template>
  268. </hc-table>
  269. </hc-card-item>
  270. <hc-card-item title="设备采集信息" class="mt-14px">
  271. <hc-table :column="relatedColumn3" :datas="relatedData3" :is-index="false" />
  272. </hc-card-item>
  273. </div>
  274. </hc-dialog>
  275. <!-- 样品处理 -->
  276. <hc-new-dialog v-model="disposeModal" is-footer-center title="样品处理" widths="40rem" @close="disposeClose">
  277. <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="left" label-width="auto">
  278. <el-form-item label="处理方式:" prop="repealType">
  279. <el-radio-group v-model="formModel.repealType">
  280. <el-radio :value="1">处理</el-radio>
  281. <el-radio :value="2">留样</el-radio>
  282. </el-radio-group>
  283. </el-form-item>
  284. <el-form-item v-if="formModel.repealType === 1" label="处理原因:" prop="repealReason">
  285. <el-input v-model="formModel.repealReason" type="textarea" :rows="5" resize="none" />
  286. </el-form-item>
  287. <el-form-item v-if="formModel.repealType === 2" label="留样时间:" prop="resamStartTime">
  288. <hc-date-picker :dates="formTime" clearable @change="formTimeUpdate" />
  289. </el-form-item>
  290. </el-form>
  291. <template #footer>
  292. <el-button @click="disposeClose">取消</el-button>
  293. <el-button hc-btn type="primary" :loading="saveLoading" @click="disposeSave">确定</el-button>
  294. </template>
  295. </hc-new-dialog>
  296. <!-- 批量上报审批 -->
  297. <HcReportModal
  298. :classify-type="authBtnTabKey"
  299. :addition="reportAddition" :contract-id="contractId" :ids="reportIds"
  300. :project-id="projectId" :show="showReportModal" :task-name="reportTaskName"
  301. :trial-self-inspection-record-id="1"
  302. :type-data="reportTypeData" title="批量上报审批" type="wbs"
  303. url="informationWriteQuery/batchTask" @finish="showReportFinish"
  304. @hide="showReportModal = false"
  305. />
  306. <!-- 一键重签弹窗 -->
  307. <hc-new-dialog v-model="resignModal" title="一键重签" widths="38rem" :loading="signLoading" @close="cancelresign" @save="signClick">
  308. <div>
  309. 是否重新生成pdf:
  310. <el-radio-group v-model="resignModalRadio">
  311. <el-radio :value="2">否</el-radio>
  312. <el-radio :value="1">是</el-radio>
  313. </el-radio-group>
  314. </div>
  315. </hc-new-dialog>
  316. </div>
  317. </template>
  318. <script setup>
  319. import { onActivated, onMounted, ref, watch } from 'vue'
  320. import { useRoute, useRouter } from 'vue-router'
  321. import { useAppStore } from '~src/store'
  322. import TestTree from '../material/components/TestTree.vue'
  323. import { delStoreValue, getStoreValue, setStoreValue } from '~src/utils/storage'
  324. import HcDragUpload from './components/HcDragUpload.vue'
  325. import { getDictionary } from '~api/other'
  326. import { eVisaTaskCheckApi } from '~api/other'
  327. import { getErtractInfo } from '~api/other'
  328. import wbsApi from '~api/data-fill/wbs'
  329. import dataApi from '~api/tentative/detect/test'
  330. import testSampleApi from '~api/tentative/material/testSample'
  331. import commissionApi from '~api/tentative/detect/commission'
  332. import acquisitionApi from '~api/tentative/acquisition/data'
  333. import { arrToId, arrToKey, formValidate, getArrValue, getObjVal, getObjValue, isNullES, isString } from 'js-fast-way'
  334. import { HcDelMsg } from 'hc-vue3-ui'
  335. import { toPdfPage } from '~uti/btn-auth'
  336. //变量
  337. const router = useRouter()
  338. const useRoutes = useRoute()
  339. const useAppState = useAppStore()
  340. const userInfo = ref(useAppState.getUserInfo)
  341. const projectId = ref(useAppState.getProjectId)
  342. const contractId = ref(useAppState.getContractId)
  343. const projectInfo = ref(useAppState.getProjectInfo)
  344. const contractInfo = ref(useAppState.getContractInfo)
  345. const isCollapse = ref(useAppState.getCollapse)
  346. const isBubble = ref(useAppState.getBubble)
  347. //监听
  348. watch(() => [useAppState.getCollapse, useAppState.getBubble], ([Collapse, bubble]) => {
  349. isCollapse.value = Collapse
  350. isBubble.value = bubble
  351. })
  352. //获取气泡数据
  353. const getButtonsVal = (value) => {
  354. return useAppState.getButtonsVal(value)
  355. }
  356. //自动展开缓存
  357. const treeAutoExpandKeys = ref(getStoreValue('testTreeExpandKeys') || [])
  358. const btn_edit = ref(false)
  359. //渲染完成
  360. onMounted(() => {
  361. btn_edit.value = getButtonsVal('tentative_detect_test_edit')
  362. setContractType(contractInfo.value?.contractType)
  363. getCategoryData()
  364. getContractData()
  365. })
  366. //缓存被激活时,重新获取表格数据
  367. onActivated(() => {
  368. getDataApi()
  369. })
  370. const isFirstTime = ref(false)
  371. const getDataApi = async () => {
  372. isFirstTime.value = true
  373. const routerQuery = useRoutes?.query
  374. let currentPage = routerQuery?.current
  375. if (isNullES(currentPage)) {
  376. searchForm.value.current = 1
  377. } else {
  378. searchForm.value.current = Number(currentPage)
  379. }
  380. console.log(searchForm.value)
  381. // setMountOnEventKey()
  382. getTableData().then()
  383. }
  384. //获取合同段信息
  385. const contractData = ref([])
  386. const getContractData = async () => {
  387. const { data } = await getErtractInfo({
  388. projectId: projectId.value,
  389. contractId: contractId.value,
  390. })
  391. const res = getArrValue(data)
  392. contractData.value = res
  393. if (res.length <= 0) return
  394. let cid
  395. for (let i = 0; i < res.length; i++) {
  396. if (contractId.value == res[i].id) {
  397. cid = res[i].id
  398. }
  399. }
  400. searchForm.value.contractId = isNullES(cid) ? res[0].id : cid
  401. }
  402. const qualifiedData = ref([
  403. { label: '不合格', value: '0' },
  404. { label: '合格', value: '1' },
  405. ])
  406. //树展开和收起
  407. const isWbsTreeShow = ref(true)
  408. const setWbsTreeShow = () => {
  409. isWbsTreeShow.value = !isWbsTreeShow.value
  410. }
  411. //获取检测类别类型
  412. const categoryData = ref([])
  413. const getCategoryData = async () => {
  414. const { data } = await getDictionary({
  415. code: 'trial_detection_category',
  416. })
  417. const arrData = getArrValue(data)
  418. arrData.forEach(item => {
  419. item.dictKey = Number(item.dictKey)
  420. })
  421. categoryData.value = arrData
  422. }
  423. //搜索表单
  424. const searchForm = ref({
  425. trialUserName: null, queryStatus: null, queryValue: null, type: '1',
  426. current: 1, size: 20, total: 0,
  427. })
  428. //树相关的变量
  429. const primaryKeyId = ref('')
  430. const nodeDataInfo = ref({})
  431. //树被点击
  432. const wbsElTreeClick = ({ data, keys }) => {
  433. nodeDataInfo.value = data
  434. primaryKeyId.value = data['primaryKeyId'] || ''
  435. setStoreValue('testTreeItem', data)
  436. //缓存自动展开
  437. treeAutoExpandKeys.value = keys
  438. setStoreValue('testTreeExpandKeys', keys)
  439. //改变搜索表单数据
  440. searchForm.value.nodeId = data['primaryKeyId']
  441. if (!isFirstTime.value) {
  442. searchForm.value.current = 1
  443. } else {
  444. isFirstTime.value = false
  445. }
  446. getTableData()
  447. }
  448. //身份按钮切换数据
  449. const authBtnTabKey = ref('1')
  450. const authBtnTabdata = ref([
  451. { key: '1', name: '施工自检' },
  452. { key: '2', name: '监理抽检' },
  453. { key: '3', name: '业主抽检' },
  454. ])
  455. const authBtnTabClick = (item) => {
  456. tableData.value = []
  457. if (item.key !== authBtnTabKey.value && item.key < 3) {
  458. authBtnTabKey.value = item.key
  459. searchForm.value.type = item.key
  460. searchForm.value.current = 1
  461. getTableData()
  462. } else if (item.key === '3') {
  463. authBtnTabKey.value = item.key
  464. searchForm.value.type = item.key
  465. searchForm.value.current = 1
  466. getTableData()
  467. }
  468. }
  469. //contractType, 1施工,2监理, 3业主
  470. const setContractType = (contractType) => {
  471. let typeValue = '1'
  472. if (contractType > 0) {
  473. typeValue = contractType + ''
  474. }
  475. authBtnTabKey.value = typeValue
  476. searchForm.value.type = typeValue
  477. searchForm.value.current = 1
  478. }
  479. //日期时间被选择
  480. const betweenTime = ref(null)
  481. const betweenTimeUpdate = ({ arr }) => {
  482. betweenTime.value = arr
  483. if (arr.length > 0) {
  484. searchForm.value.startTime = arr[0]
  485. searchForm.value.endTime = arr[1]
  486. } else {
  487. searchForm.value.startTime = ''
  488. searchForm.value.endTime = ''
  489. }
  490. }
  491. //回车搜索
  492. const keyUpEvent = (e) => {
  493. if (e.key === 'Enter') {
  494. searchForm.value.current = 1
  495. getTableData()
  496. }
  497. }
  498. //搜索
  499. const searchClick = () => {
  500. searchForm.value.current = 1
  501. getTableData()
  502. }
  503. //分页被点击
  504. const pageChange = ({ current, size }) => {
  505. searchForm.value.current = current
  506. searchForm.value.size = size
  507. getTableData()
  508. }
  509. const dataBtnLoad = ref(false)
  510. //综合功能菜单
  511. const dataSyncMenu = [
  512. { key: 'copy', name: '复制', load: true },
  513. { key: 'print', name: '批量打印', load: true },
  514. { key: 'delete', name: '批量废除', load: true },
  515. { key: 'printExcel', name: '打印空表', load: true },
  516. ]
  517. const dataSyncMenuClick = (item) => {
  518. const { key } = item
  519. if (key === 'copy') {
  520. copyDataClick()
  521. } else if (key === 'print') {
  522. printPdfClick()
  523. } else if (key === 'delete') {
  524. quitPdfClick()
  525. } else if (key === 'printExcel') {
  526. printNullPdfClick()
  527. }
  528. }
  529. //表格数据
  530. const tableRef = ref(null)
  531. const tableColumn = ref([
  532. { key: 'recordNo', name: '记录编号', width: 190 },
  533. { key: 'reportNo', name: '报告编号', width: 190, autoWidth: true },
  534. { key: 'entrustNo', name: '委托单编号', autoWidth: true },
  535. { key: 'specificationNumber', name: '样品编号', autoWidth: true },
  536. { key: 'trialProjectName', name: '试验项目名称', width: 100, autoWidth: true },
  537. { key: 'taskStatus', name: '任务状态', width: 80, autoWidth: true },
  538. { key: 'reportDate', name: '报告日期', width: 120, autoWidth: true },
  539. { key: 'trialUserName', name: '试验人员', width: 80, autoWidth: true },
  540. { key: 'detectionCategory', name: '检测类别', width: 100, autoWidth: true },
  541. { key: 'specificationModel', name: '规格类型', width: 200, autoWidth: true },
  542. { key: 'projectPositionName', name: '工程部位及用途', width: 160, autoWidth: true },
  543. { key: 'samplingLocation', name: '取样地点', width: 180, autoWidth: true },
  544. { key: 'isUploadCertificate', name: '是否上传合格证', width: 60, autoWidth: true },
  545. { key: 'entrustName', name: '委托单名称', autoWidth: true },
  546. { key: 'contractId', name: '合同段', width: 140, autoWidth: true },
  547. { key: 'company', name: '单位', width: 60, autoWidth: true },
  548. { key: 'detectionResult', name: '检测结果', width: 80, autoWidth: true },
  549. { key: 'action', name: '操作', width: 120, fixed: 'right', align: 'center' },
  550. ])
  551. const tableData = ref([])
  552. //获取数据
  553. const tableLoading = ref(false)
  554. const getTableData = async () => {
  555. tableLoading.value = true
  556. const { error, code, data } = await dataApi.queryPage({
  557. ...searchForm.value,
  558. projectId: projectId.value,
  559. //contractId: contractId.value,
  560. })
  561. //处理数据
  562. tableLoading.value = false
  563. if (!error && code === 200) {
  564. tableData.value = getArrValue(data?.records)
  565. searchForm.value.total = data?.total || 0
  566. } else {
  567. tableData.value = []
  568. searchForm.value.total = 0
  569. }
  570. }
  571. //多选
  572. const tableCheckedKeys = ref([])
  573. const tableSelection = (rows) => {
  574. tableCheckedKeys.value = rows
  575. }
  576. //新增
  577. const addFormModalClick = () => {
  578. delStoreValue('test-form')
  579. setStoreValue('prenodeDataInfo', nodeDataInfo.value)
  580. const obj = getObjValue(searchForm.value)
  581. router.push({
  582. path: '/tentative/detect/test-form',
  583. query: {
  584. nodeId: primaryKeyId.value,
  585. dataType: authBtnTabKey.value,
  586. cid: obj?.contractId,
  587. isaddType: true,
  588. current: obj?.current,
  589. },
  590. })
  591. }
  592. //编辑
  593. const tableRowEdit = (row, tabTypeKey) => {
  594. setStoreValue('test-form', row)
  595. setStoreValue('prenodeDataInfo', nodeDataInfo.value)
  596. const obj = getObjValue(searchForm.value)
  597. router.push({
  598. path: '/tentative/detect/test-form',
  599. query: {
  600. id: row.id,
  601. nodeId: row.nodeId,
  602. dataType: row.type,
  603. tabTypeKey: tabTypeKey,
  604. cid: obj?.contractId,
  605. current: obj?.current,
  606. // prenodeDataInfo:JSON.stringify(nodeDataInfo.value)
  607. },
  608. })
  609. }
  610. //预览PDF
  611. const tableRowPdf = ({ pdfUrl }) => {
  612. if (pdfUrl) {
  613. toPdfPage(pdfUrl)
  614. //window.open(pdfUrl, '_blank')
  615. } else {
  616. window.$message?.warning('该数据暂无PDF')
  617. }
  618. }
  619. //复制
  620. const copyDataClick = () => {
  621. const rows = tableCheckedKeys.value
  622. if (rows.length > 0) {
  623. const ids = arrToId(rows)
  624. copyDataApi(ids)
  625. } else {
  626. window.$message?.warning('请先勾选需要复制的记录')
  627. }
  628. }
  629. //请求复制
  630. const copyLoading = ref(false)
  631. const copyDataApi = async (ids) => {
  632. //请求数据
  633. copyLoading.value = true
  634. dataBtnLoad.value = true
  635. const { error, code, msg } = await dataApi.copyData({
  636. projectId: projectId.value,
  637. ids: ids,
  638. }, false)
  639. //处理数据
  640. copyLoading.value = false
  641. dataBtnLoad.value = false
  642. if (!error && code === 200) {
  643. window.$message?.success('复制成功')
  644. searchClick()
  645. }
  646. }
  647. //删除
  648. const delModalClick = () => {
  649. const rows = tableCheckedKeys.value
  650. if (rows.length > 0) {
  651. const ids = arrToId(rows)
  652. HcDelMsg(async (resolve) => {
  653. await removeDataApi(ids)
  654. resolve() //关闭弹窗的回调
  655. })
  656. } else {
  657. window.$message?.warning('请先勾选需要删除的记录')
  658. }
  659. }
  660. //请求删除
  661. const removeLoading = ref(false)
  662. const removeDataApi = async (ids) => {
  663. //请求数据
  664. removeLoading.value = true
  665. const { error, code, msg } = await dataApi.removeData({
  666. projectId: projectId.value,
  667. ids: ids,
  668. }, false)
  669. //处理数据
  670. removeLoading.value = false
  671. if (!error && code === 200) {
  672. window.$message?.success('删除成功')
  673. searchClick()
  674. }
  675. }
  676. //批量打印
  677. const printPdfLoading = ref(false)
  678. const printPdfClick = async () => {
  679. const rows = tableCheckedKeys.value
  680. if (rows.length > 0) {
  681. const ids = arrToId(rows)
  682. //请求数据
  683. printPdfLoading.value = true
  684. dataBtnLoad.value = true
  685. const { error, code, msg, data } = await dataApi.printPdf({
  686. projectId: projectId.value,
  687. ids: ids,
  688. }, false)
  689. //处理数据
  690. const pdfUrl = isString(data) ? data || '' : ''
  691. printPdfLoading.value = false
  692. dataBtnLoad.value = false
  693. if (!error && code === 200 && pdfUrl) {
  694. toPdfPage(pdfUrl)
  695. //window.open(pdfUrl, '_blank')
  696. } else {
  697. window.$message?.error(msg || '文件异常')
  698. }
  699. } else {
  700. window.$message?.warning('请先勾选需要批量打印的记录')
  701. }
  702. }
  703. //批量废除
  704. const quitPdfLoading = ref(false)
  705. const quitPdfClick = async () => {
  706. const rows = tableCheckedKeys.value
  707. if (rows.length > 0) {
  708. const ids = arrToId(rows)
  709. const res1 = rows.some(item => item.taskStatus === '未上报')
  710. const res2 = rows.some(item => item.taskStatus === '已废除')
  711. if (res1) {
  712. window.$message?.warning('未上报的文件不能废除')
  713. } else if (res2) {
  714. window.$message?.warning('已废除的文件不能再次废除')
  715. } else {
  716. //请求数据
  717. quitPdfLoading.value = true
  718. dataBtnLoad.value = true
  719. const { error, code, msg } = await dataApi.batchAbolish({
  720. projectId: projectId.value,
  721. contractId: contractId.value,
  722. primaryKeyId: primaryKeyId.value,
  723. ids: ids,
  724. }, false)
  725. dataBtnLoad.value = false
  726. //处理数据
  727. if (!error && code === 200) {
  728. window.$message?.success('废除成功')
  729. quitPdfLoading.value = false
  730. searchClick()
  731. } else {
  732. quitPdfLoading.value = false
  733. // window.$message?.error(msg)
  734. }
  735. }
  736. } else {
  737. window.$message?.warning('请先勾选需要批量打印的记录')
  738. }
  739. }
  740. //批量上报
  741. const reportPdfLoading = ref(false)
  742. //批量上报
  743. const reportIds = ref('')
  744. const reportTaskName = ref('')
  745. const reportAddition = ref({})
  746. const showReportModal = ref(false)
  747. const reportLoading = ref(false)
  748. const reportTypeData = ref([])
  749. const reportPdfClick = async () => {
  750. const rows = tableCheckedKeys.value
  751. if (rows.length > 0) {
  752. const info = getStoreValue('prenodeDataInfo') || {}
  753. const res1 = rows.some(item => item.pdfUrl.length < 1)
  754. const res2 = rows.some(item => item.taskStatus === '待审批' || item.taskStatus === '已审批')
  755. if (res1) {
  756. window.$message?.warning('当前数据暂无pdf无法上报')
  757. } else if (res2) {
  758. window.$message?.warning('已上报的数据无法再次上报')
  759. } else {
  760. reportLoading.value = true
  761. const ids = arrToId(rows)
  762. reportIds.value = ids
  763. const taskCheck = await eVisaTaskCheckApi({
  764. projectId: projectId.value,
  765. contractId: contractId.value,
  766. })
  767. //处理数据
  768. let newArr = []
  769. for (let i = 0; i < rows.length; i++) {
  770. newArr.push(rows[i]['tableIds'])
  771. }
  772. reportTypeData.value = [...newArr]
  773. console.log(reportTypeData.value, ' reportTypeData.value')
  774. reportLoading.value = false
  775. if (taskCheck) {
  776. //初始弹出弹窗,防呆
  777. reportAddition.value = {
  778. classify: authBtnTabKey.value,
  779. contractIdRelation: info['contractIdRelation'],
  780. }
  781. showReportModal.value = true
  782. //请求文件题名
  783. const { data } = await wbsApi.queryDocumentTitle({
  784. // primaryKeyId: info['primaryKeyId'],
  785. primaryKeyId: rows[0].id,
  786. classify: authBtnTabKey.value,
  787. })
  788. reportTaskName.value = isString(data) ? data : ''
  789. } else {
  790. window.$message?.warning('暂无相关数据')
  791. }
  792. }
  793. } else {
  794. window.$message?.warning('请先勾选需要批量上报的记录')
  795. }
  796. }
  797. //上报完成
  798. const showReportFinish = () => {
  799. showReportModal.value = false
  800. getTableData()
  801. }
  802. //打印空表
  803. const printNullPdfLoading = ref(false)
  804. const printNullPdfClick = async () => {
  805. const rows = tableCheckedKeys.value
  806. if (rows.length > 0) {
  807. const ids = arrToId(rows)
  808. //请求数据
  809. printNullPdfLoading.value = true
  810. dataBtnLoad.value = true
  811. const { error, code, msg, data } = await dataApi.printNullPdf({
  812. projectId: projectId.value,
  813. ids: ids,
  814. }, false)
  815. //处理数据
  816. const pdfUrl = isString(data) ? data || '' : ''
  817. printNullPdfLoading.value = false
  818. dataBtnLoad.value = false
  819. if (!error && code === 200 && pdfUrl) {
  820. toPdfPage(pdfUrl)
  821. //window.open(pdfUrl, '_blank')
  822. } else {
  823. window.$message?.error(msg || '文件异常')
  824. }
  825. } else {
  826. window.$message?.warning('请先勾选需要打印空表的记录')
  827. }
  828. }
  829. //查看附件
  830. const viewAttachmentModal = ref(false)
  831. const viewAttachmentLoading = ref(false)
  832. const viewAttachmentId = ref('')
  833. const viewAttachmentData = ref([])
  834. const viewAttachmentModalClick = async ({ id }) => {
  835. viewAttachmentId.value = id
  836. viewAttachmentModal.value = true
  837. getAttachmentModalClick(viewAttachmentId.value, '1')
  838. }
  839. const getCaption = (obj) => {
  840. const index = obj.lastIndexOf('pdf')
  841. return index
  842. }
  843. //获取附件
  844. const getAttachmentModalClick = async (id, type) => {
  845. viewAttachmentLoading.value = true
  846. const { error, code, data } = await dataApi.ancillaryDocumentsList({ id: id, type: type })
  847. console.log(data, 'data')
  848. viewAttachmentLoading.value = false
  849. if (!error && code === 200) {
  850. viewAttachmentData.value = getArrValue(data)
  851. curFileData.value = viewAttachmentData.value[0]
  852. viewCurFile(curFileData.value)
  853. } else {
  854. viewAttachmentData.value = []
  855. }
  856. }
  857. const refeshAttachmentModalClick = async (id, type) => {
  858. try {
  859. const { error, code, data } = await dataApi.ancillaryDocumentsList({
  860. id: id,
  861. type: type,
  862. })
  863. if (!error && code === 200) {
  864. viewAttachmentData.value = getArrValue(data)
  865. if (viewAttachmentData.value.length > 0) {
  866. await viewCurFile(viewAttachmentData.value[0])
  867. }
  868. } else {
  869. viewAttachmentData.value = []
  870. }
  871. } catch (error) {
  872. console.error('刷新附件列表失败:', error)
  873. }
  874. }
  875. const attachmentPdfUrl = ref('')
  876. const curFileData = ref({})
  877. //类型tab数据和相关处理
  878. const tabTypeKey = ref('1')
  879. const tabTypeTab = ref([
  880. { key: '1', name: '生产合格证' },
  881. { key: '2', name: '厂家质检报告' },
  882. { key: '3', name: '其他文件' },
  883. ])
  884. const tabTypeChange = (item) => {
  885. console.log(1111111111)
  886. tabTypeKey.value = item?.key
  887. getAttachmentModalClick(viewAttachmentId.value, item?.key)
  888. fileListData.value = []
  889. refeshAttachmentModalClick(viewAttachmentId.value, tabTypeKey.value)
  890. }
  891. //关闭查看附件
  892. const viewAttachmentModalClose = () => {
  893. viewAttachmentModal.value = false
  894. curFileData.value = ''
  895. attachmentPdfUrl.value = ''
  896. }
  897. const uploadData = ref({})
  898. const fileListData = ref([])
  899. const listuploadref = ref('1')
  900. //截取文件名称
  901. const splitFileName = (str) => {
  902. // if(str.indexOf("https://bladex-test-info.oss-cn-chengdu.aliyuncs.com//upload") != -1){
  903. if (str.indexOf('https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload') != -1) {
  904. let a = str.split('//')[2].split('/')[2]
  905. return a
  906. } else {
  907. return str
  908. }
  909. }
  910. //查看当前文件pdf
  911. const viewCurFile = (item) => {
  912. if (!item) return
  913. try {
  914. viewAttachmentLoading.value = true
  915. curFileData.value = item
  916. // 设置文件列表
  917. fileListData.value = [{ name: item.fileName, url: item.url }]
  918. // 更新选中状态
  919. viewAttachmentData.value.forEach(ele => {
  920. ele.isCheck = false
  921. })
  922. item.isCheck = true
  923. // 设置预览地址
  924. attachmentPdfUrl.value = item.url
  925. viewAttachmentLoading.value = false
  926. } catch (error) {
  927. viewAttachmentLoading.value = false
  928. window.$message.error('文件加载失败')
  929. }
  930. }
  931. //上传进度
  932. const uploadprogress = (res) => {
  933. console.log('进度')
  934. }
  935. //上传完成
  936. const uploadFinished = async (res) => {
  937. // const { error, code, data } = await dataApi.updateAncillaryDocument(
  938. // {
  939. // selfId: viewAttachmentId.value,
  940. // url: res.link,
  941. // type: tabTypeKey.value,
  942. // })
  943. // console.log(data, 'data')
  944. // if (!error && code === 200) {
  945. // refeshAttachmentModalClick(viewAttachmentId.value, tabTypeKey.value)
  946. // }
  947. try {
  948. // 1. 显示上传中状态
  949. viewAttachmentLoading.value = true
  950. // 2. 调用更新附件接口
  951. const { error, code, data } = await dataApi.updateAncillaryDocument({
  952. selfId: viewAttachmentId.value,
  953. url: res.link,
  954. type: tabTypeKey.value,
  955. })
  956. if (!error && code === 200) {
  957. // 3. 延迟刷新文件列表,给服务器一些处理时间
  958. setTimeout(async () => {
  959. await refeshAttachmentModalClick(viewAttachmentId.value, tabTypeKey.value)
  960. viewAttachmentLoading.value = false
  961. window.$message.success('上传成功')
  962. }, 1000)
  963. }
  964. } catch (error) {
  965. viewAttachmentLoading.value = false
  966. window.$message.error('上传失败')
  967. }
  968. }
  969. //上传文件delFileData
  970. const delFileData = async (res) => {
  971. console.log('删除文件', curFileData.value)
  972. if (curFileData.value.isDel == 0) {
  973. window.$message.warning('该文件不可删除')
  974. } else {
  975. const { error, code, data } = await dataApi.removedocuments({
  976. projectId: projectId.value,
  977. id: curFileData.value.id,
  978. })
  979. if (!error && code === 200) {
  980. window.$message.success('删除成功')
  981. refeshAttachmentModalClick(viewAttachmentId.value, tabTypeKey.value)
  982. }
  983. }
  984. }
  985. //样品信息数据
  986. const samplingTableColumn = ref([
  987. { key: 'materialName', name: '样品名称' },
  988. { key: 'samplingDate', name: '取样时间' },
  989. { key: 'specificationNumber', name: '样品编号' },
  990. { key: 'specificationModel', name: '规格型号' },
  991. { key: 'materialCount', name: '试样数量' },
  992. { key: 'calculationUnit', name: '计算单位' },
  993. { key: 'proposedPosition', name: '拟用部位' },
  994. { key: 'representativeCount', name: '代表数量' },
  995. { key: 'userName', name: '取样人' },
  996. ])
  997. const samplingTableData = ref([])
  998. const samplingTableLoading = ref(false)
  999. //取样记录
  1000. const samplingRecordModal = ref(false)
  1001. const samplingRecordModalClick = async ({ id }) => {
  1002. samplingRecordModal.value = true
  1003. samplingTableLoading.value = true
  1004. const { error, code, data } = await dataApi.getSampleList({
  1005. projectId: projectId.value,
  1006. id: id,
  1007. })
  1008. //处理数据
  1009. samplingTableLoading.value = false
  1010. if (!error && code === 200) {
  1011. samplingTableData.value = getArrValue(data)
  1012. } else {
  1013. samplingTableData.value = []
  1014. }
  1015. }
  1016. //关闭样品信息
  1017. const samplingRecordModalClose = () => {
  1018. samplingRecordModal.value = false
  1019. samplingTableData.value = []
  1020. }
  1021. //左右拖动,改变树形结构宽度
  1022. const leftWidth = ref(382)
  1023. const onmousedown = () => {
  1024. const leftNum = isCollapse.value ? 142 : 272
  1025. document.onmousemove = (ve) => {
  1026. let diffVal = ve.clientX - leftNum
  1027. if (diffVal >= 310 && diffVal <= 900) {
  1028. leftWidth.value = diffVal
  1029. }
  1030. }
  1031. document.onmouseup = () => {
  1032. document.onmousemove = null
  1033. document.onmouseup = null
  1034. }
  1035. }
  1036. //关联查阅
  1037. const isRelatedSearch = ref(false)
  1038. const relatedSearchClick = (row) => {
  1039. isRelatedSearch.value = true
  1040. //获取样品信息
  1041. getSampleList(row.id)
  1042. //获取委托单
  1043. getCommissionData(row.entrustId)
  1044. //获取关联设备
  1045. getAcquisitionData(row.loadDataId)
  1046. }
  1047. //样品信息
  1048. const relatedColumn1 = [
  1049. { key: 'materialName', name: '样品名称' },
  1050. { key: 'samplingDate', name: '取样日期' },
  1051. { key: 'specificationNumber', name: '样品编号' },
  1052. { key: 'specificationModel', name: '规格型号' },
  1053. { key: 'materialCount', name: '试样数量' },
  1054. { key: 'calculationUnit', name: '计算单位' },
  1055. { key: 'proposedPosition', name: '拟用部位' },
  1056. { key: 'representativeCount', name: '代表数量' },
  1057. { key: 'userName', name: '取样人' },
  1058. { key: 'carryTime', name: '入库时间', align: 'center' },
  1059. { key: 'createTime', name: '试验时间', align: 'center' },
  1060. { key: 'no-key', name: '样品处理' },
  1061. { key: 'no-key', name: '时间(或处理原因)' },
  1062. ]
  1063. const relatedData1 = ref([])
  1064. const getSampleList = async (id) => {
  1065. relatedData1.value = []
  1066. if (isNullES(id) || id == 0) return
  1067. const { data } = await dataApi.getSampleList({ id })
  1068. relatedData1.value = getArrValue(data)
  1069. }
  1070. //委托单信息
  1071. const relatedColumn2 = [
  1072. { key: 'entrustInfo', name: '委托单位' },
  1073. { key: 'entrustNo', name: '委托单编号' },
  1074. { key: 'entrustName', name: '委托单名称' },
  1075. { key: 'status', name: '委托单状态', width: 120, align: 'center' },
  1076. ]
  1077. const relatedData2 = ref([])
  1078. const getCommissionData = async (id) => {
  1079. relatedData2.value = []
  1080. if (isNullES(id) || id == 0) return
  1081. const { data } = await commissionApi.detail(id)
  1082. const res = getObjVal(data)
  1083. relatedData2.value = res ? [res] : []
  1084. }
  1085. //设备采集信息
  1086. const relatedColumn3 = [
  1087. { key: 'engineInfo', name: '工程部位' },
  1088. { key: 'deviceName', name: '设备名称' },
  1089. { key: 'equipmentAcquisitionNumber', name: '设备采集编号', width: 180, align: 'center' },
  1090. { key: 'testDate', name: '试验日期', width: 160, align: 'center' },
  1091. { key: 'specificationNumber', name: '样品编号', width: 180, align: 'center' },
  1092. { key: 'testTypeName', name: '试验类型', width: 100, align: 'center' },
  1093. { key: 'beArea', name: '承压面积(mm2)', width: 100, align: 'center' },
  1094. { key: 'specimenSize', name: '试件尺寸(mm)', width: 100, align: 'center' },
  1095. { key: 'desStrength', name: '设计强度(MPa)', width: 100, align: 'center' },
  1096. { key: 'ageDate', name: '龄期(d)', width: 100, align: 'center' },
  1097. { key: 'load1', name: '荷载1(KN)', width: 100, align: 'center' },
  1098. { key: 'load2', name: '荷载2(KN)', width: 100, align: 'center' },
  1099. { key: 'load3', name: '荷载3(KN)', width: 100, align: 'center' },
  1100. { key: 'no-key', name: '荷载4(KN)', width: 100, align: 'center' },
  1101. { key: 'no-key', name: '荷载5(KN)', width: 100, align: 'center' },
  1102. { key: 'no-key', name: '荷载6(KN)', width: 100, align: 'center' },
  1103. { key: 'strengthAVG', name: '强度代表值(MPa)', width: 100, align: 'center' },
  1104. {
  1105. name: '最大力总延伸(%)',
  1106. children: [
  1107. { key: 'maxConceal1', name: '1', width: 100, align: 'center' },
  1108. { key: 'maxConceal2', name: '2', width: 100, align: 'center' },
  1109. { key: 'maxConceal3', name: '3', width: 100, align: 'center' },
  1110. ],
  1111. },
  1112. //{ key: 'dataQualified', name: '试验结果是否合格', width: 100, align: 'center' },
  1113. { key: 'dataStatus', name: '数据状态', width: 100, align: 'center' },
  1114. ]
  1115. const relatedData3 = ref([])
  1116. const getAcquisitionData = async (id) => {
  1117. relatedData3.value = []
  1118. if (isNullES(id) || id == 0) return
  1119. const { data } = await acquisitionApi.selectDataInfoById(id)
  1120. const res = getObjVal(data)
  1121. if (res) {
  1122. relatedData3.value = res ? [res] : []
  1123. setRelatedColumn3(res.testTypePId)
  1124. }
  1125. }
  1126. //设置表头
  1127. const setRelatedColumn3 = (type) => {
  1128. //压力机
  1129. if (type === '1') {
  1130. relatedColumn3.value = [
  1131. { key: 'engineInfo', name: '工程部位' },
  1132. { key: 'deviceName', name: '设备名称' },
  1133. { key: 'equipmentAcquisitionNumber', name: '设备采集编号', width: 180, align: 'center' },
  1134. { key: 'testDate', name: '试验日期', width: 160, align: 'center' },
  1135. { key: 'specificationNumber', name: '样品编号', width: 180, align: 'center' },
  1136. { key: 'testTypeName', name: '试验类型', width: 100, align: 'center' },
  1137. { key: 'beArea', name: '承压面积(mm2)', width: 100, align: 'center' },
  1138. { key: 'specimenSize', name: '试件尺寸(mm)', width: 100, align: 'center' },
  1139. { key: 'desStrength', name: '设计强度(MPa)', width: 100, align: 'center' },
  1140. { key: 'no-key', name: '龄期(d)', width: 100, align: 'center' },
  1141. { key: 'load1', name: '荷载1(KN)', width: 100, align: 'center' },
  1142. { key: 'load2', name: '荷载2(KN)', width: 100, align: 'center' },
  1143. { key: 'load3', name: '荷载3(KN)', width: 100, align: 'center' },
  1144. { key: 'no-key', name: '荷载4(KN)', width: 100, align: 'center' },
  1145. { key: 'no-key', name: '荷载5(KN)', width: 100, align: 'center' },
  1146. { key: 'no-key', name: '荷载6(KN)', width: 100, align: 'center' },
  1147. { key: 'no-key', name: '强度代表值(MPa)', width: 100, align: 'center' },
  1148. {
  1149. name: '最大力总延伸(%)',
  1150. children: [
  1151. { key: 'maxConceal1', name: '1', width: 100, align: 'center' },
  1152. { key: 'maxConceal2', name: '2', width: 100, align: 'center' },
  1153. { key: 'maxConceal3', name: '3', width: 100, align: 'center' },
  1154. ],
  1155. },
  1156. //{ key: 'dataQualified', name: '试验结果是否合格', width: 100, align: 'center' },
  1157. { key: 'dataStatus', name: '数据状态', width: 100, align: 'center' },
  1158. ]
  1159. } else if (type === '2') {
  1160. //万能机
  1161. relatedColumn3.value = [
  1162. { key: 'engineInfo', name: '工程部位' },
  1163. { key: 'deviceName', name: '设备名称' },
  1164. { key: 'equipmentAcquisitionNumber', name: '设备采集编号', width: 180, align: 'center' },
  1165. { key: 'testDate', name: '试验日期', width: 160, align: 'center' },
  1166. { key: 'specificationNumber', name: '样品编号', width: 180, align: 'center' },
  1167. { key: 'testTypeName', name: '试验类型', width: 100, align: 'center' },
  1168. { key: 'no-key', name: '牌号', width: 100, align: 'center' },
  1169. { key: 'no-key', name: '公称直径(mm)', width: 100, align: 'center' },
  1170. { key: 'no-key', name: '规格', width: 100, align: 'center' },
  1171. {
  1172. name: '最大力/荷载(KN)',
  1173. children: [
  1174. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1175. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1176. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1177. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1178. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1179. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1180. ],
  1181. },
  1182. {
  1183. name: '抗拉强度/强度代表值(MPa)',
  1184. children: [
  1185. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1186. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1187. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1188. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1189. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1190. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1191. ],
  1192. },
  1193. {
  1194. name: '上屈服力(KN)',
  1195. children: [
  1196. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1197. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1198. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1199. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1200. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1201. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1202. ],
  1203. },
  1204. {
  1205. name: '下屈服力(KN)',
  1206. children: [
  1207. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1208. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1209. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1210. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1211. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1212. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1213. ],
  1214. },
  1215. {
  1216. name: '上屈服强度(MPa)',
  1217. children: [
  1218. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1219. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1220. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1221. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1222. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1223. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1224. ],
  1225. },
  1226. {
  1227. name: '下屈服强度(MPa)',
  1228. children: [
  1229. { key: 'no-key', name: '1', width: 100, align: 'center' },
  1230. { key: 'no-key', name: '2', width: 100, align: 'center' },
  1231. { key: 'no-key', name: '3', width: 100, align: 'center' },
  1232. { key: 'no-key', name: '4', width: 100, align: 'center' },
  1233. { key: 'no-key', name: '5', width: 100, align: 'center' },
  1234. { key: 'no-key', name: '6', width: 100, align: 'center' },
  1235. ],
  1236. },
  1237. { key: 'dataStatus', name: '数据状态', width: 100, align: 'center' },
  1238. ]
  1239. }
  1240. }
  1241. //关闭关联查阅
  1242. const relatedSearchModalClose = () => {
  1243. isRelatedSearch.value = false
  1244. relatedData1.value = []
  1245. relatedData2.value = []
  1246. relatedData3.value = []
  1247. }
  1248. //表单数据
  1249. const formRef = ref(null)
  1250. const formModel = ref({})
  1251. const formRules = {
  1252. repealType: {
  1253. required: true,
  1254. trigger: 'blur',
  1255. message: '请选择处理方式',
  1256. },
  1257. repealReason: {
  1258. required: true,
  1259. trigger: 'blur',
  1260. message: '请填写处理原因',
  1261. },
  1262. resamStartTime: {
  1263. required: true,
  1264. trigger: 'blur',
  1265. message: '请选择留样时间',
  1266. },
  1267. }
  1268. //样品处理
  1269. const disposeModal = ref(false)
  1270. const rowDispose = () => {
  1271. disposeModal.value = true
  1272. const rows = relatedData1.value
  1273. formModel.value = {
  1274. id: arrToId(rows),
  1275. repealType: 1,
  1276. }
  1277. }
  1278. //日期时间被选择
  1279. const formTime = ref(null)
  1280. const formTimeUpdate = ({ arr }) => {
  1281. formTime.value = arr
  1282. if (arr.length > 0) {
  1283. formModel.value.resamStartTime = arr[0]
  1284. formModel.value.resamEndTime = arr[1]
  1285. } else {
  1286. formModel.value.resamStartTime = ''
  1287. formModel.value.resamEndTime = ''
  1288. }
  1289. }
  1290. //确定提交
  1291. const saveLoading = ref(false)
  1292. const disposeSave = async () => {
  1293. const isForm = await formValidate(formRef.value)
  1294. if (!isForm) return
  1295. const { error, code, msg } = await testSampleApi.update(formModel.value)
  1296. saveLoading.value = false
  1297. if (!error && code === 200) {
  1298. window.$message.success('提交成功')
  1299. disposeClose()
  1300. getTableData().then()
  1301. } else {
  1302. window.$message.error(msg || '操作失败')
  1303. }
  1304. }
  1305. //关闭弹窗
  1306. const disposeClose = () => {
  1307. disposeModal.value = false
  1308. formModel.value = {}
  1309. }
  1310. //一键重签
  1311. const signLoading = ref(false)
  1312. const resignModal = ref(false)
  1313. const resignModalRadio = ref(0)
  1314. const resignClick = async ()=>{
  1315. const rows = tableCheckedKeys.value
  1316. if (rows.length <= 0) {
  1317. window.$message?.warning('请先勾选已审批的数据')
  1318. return
  1319. }
  1320. resignModal.value = true
  1321. }
  1322. const signClick = async () => {
  1323. const rows = tableCheckedKeys.value
  1324. //获取任务id
  1325. const taskIds = arrToKey(rows, 'id')
  1326. //发起请求
  1327. signLoading.value = true
  1328. const { error, code, msg } = await dataApi.reSigningTrial({
  1329. projectId: projectId.value,
  1330. trialIds: taskIds,
  1331. type:resignModalRadio.value,
  1332. })
  1333. //处理数据
  1334. signLoading.value = false
  1335. if (!error && code === 200) {
  1336. window.$message?.success(msg ?? '提交成功,请请耐心等待重签,可继续操作其它的功能。')
  1337. getTableData().then()
  1338. } else {
  1339. window.$message?.error(msg ?? '操作失败')
  1340. }
  1341. resignModal.value = false
  1342. }
  1343. const cancelresign = ()=>{
  1344. resignModalRadio.value = 0
  1345. resignModal.value = false
  1346. }
  1347. </script>
  1348. <style lang="scss" scoped>
  1349. @import "../../../styles/tentative/detect/test.scss";
  1350. .hc-switch-tab-content {
  1351. .pdf-file-list-box {
  1352. position: relative;
  1353. border-right: 1px solid #e9e9e9;
  1354. padding: 5px 0;
  1355. overflow-y: auto;
  1356. height: 100%;
  1357. flex: 1;
  1358. .file-item {
  1359. position: relative;
  1360. cursor: pointer;
  1361. padding: 6px 10px;
  1362. &:hover {
  1363. color: var(--el-color-primary);
  1364. background-color: var(--el-color-primary-light-8);
  1365. }
  1366. &.cur {
  1367. color: var(--el-color-primary);
  1368. background-color: var(--el-color-primary-light-8);
  1369. }
  1370. }
  1371. }
  1372. .hc-no-table-form {
  1373. flex: 1;
  1374. }
  1375. }
  1376. </style>
  1377. <style lang="scss">
  1378. .hc-related-search-box .hc-card-item-box {
  1379. background: #f5f5f5;
  1380. .hc-card-item-header {
  1381. color: #101010;
  1382. padding-bottom: 14px;
  1383. border-bottom: 1px solid #d6d6d6;
  1384. }
  1385. .hc-card-item-header .item-header {
  1386. font-size: 16px;
  1387. }
  1388. }
  1389. </style>