commission.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766
  1. <template>
  2. <hc-body split :project-nmae="projectInfo?.projectName">
  3. <template #tree>
  4. <TestTree
  5. :auto-expand-keys="treeAutoExpandKeys" :project-id="projectId" :tenant-id="userInfo?.tenant_id"
  6. :wbs-temp-id="projectInfo?.referenceWbsTemplateIdTrial" :wbs-type="2" :entrust="1"
  7. @node-tap="wbsElTreeClick"
  8. />
  9. </template>
  10. <hc-new-card w-to="1919">
  11. <template #headerToSearch>
  12. <div class="w-50">
  13. <el-select v-model="searchForm.contractId" placeholder="选择合同段" filterable block>
  14. <el-option v-for="item in contractData" :key="item.id" :label="item.contractName" :value="item.id" />
  15. </el-select>
  16. </div>
  17. <div class="ml-2 w-40">
  18. <el-select v-model="searchForm.status" placeholder="委托单状态" filterable clearable block>
  19. <el-option v-for="item in entrustStatus" :key="item.value" :label="item.label" :value="item.value" />
  20. </el-select>
  21. </div>
  22. <div class="ml-2 w-250px">
  23. <hc-search-input v-model="searchForm.entrustName" @search="searchClick" />
  24. </div>
  25. </template>
  26. <template #extraToHeader>
  27. <hc-tooltip keys="tentative_detect_commission_add">
  28. <el-button hc-btn type="primary" @click="addFormData">
  29. <hc-icon name="add-circle" />
  30. <span>新增</span>
  31. </el-button>
  32. </hc-tooltip>
  33. <el-button :disabled="tableCheckedKeys.length <= 0" :loading="signLoading" hc-btn type="primary" @click="resignClick">re-sign</el-button>
  34. <hc-tooltip keys="tentative_detect_commission_repeal">
  35. <el-button hc-btn type="danger" :disabled="tableCheckedKeys.length <= 0" @click="repealFormData">
  36. <hc-icon name="arrow-go-back" />
  37. <span>废除</span>
  38. </el-button>
  39. </hc-tooltip>
  40. <hc-tooltip keys="tentative_detect_commission_del">
  41. <el-button v-del-com:[delModalClick] :disabled="tableCheckedKeys.length <= 0" hc-btn type="danger">
  42. <hc-icon name="delete-bin-2" />
  43. <span>删除</span>
  44. </el-button>
  45. </hc-tooltip>
  46. <hc-tooltip keys="tentative_material_commission_prin">
  47. <el-button :disabled="tableCheckedKeys.length <= 0" hc-btn color="#567722" @click="batchPrinting">
  48. <hc-icon name="printer" />
  49. <span>批量打印</span>
  50. </el-button>
  51. </hc-tooltip>
  52. <hc-tooltip keys="tentative_detect_commission_report">
  53. <el-button :disabled="tableCheckedKeys.length <= 0" class="text-white" hc-btn color="#FF976A" @click="reportClick">
  54. <HcIcon name="send-plane-2" />
  55. <span>上报</span>
  56. </el-button>
  57. </hc-tooltip>
  58. <hc-tooltip keys="tentative_material_commission_null">
  59. <el-button hc-btn color="#567722" @click="printerNull">
  60. <hc-icon name="printer" />
  61. <span>打印空表</span>
  62. </el-button>
  63. </hc-tooltip>
  64. </template>
  65. <hc-table
  66. :column="tableColumn" :datas="tableData" :loading="tableLoading" is-check
  67. :index-style="{ width: 60 }" :check-style="{ width: 29 }" @selection-change="tableSelection"
  68. >
  69. <template #status="{ row }">
  70. <el-tag v-if="row.status === 1" type="info" effect="dark">未上报</el-tag>
  71. <el-tag v-if="row.status === 2" type="warning" effect="dark">已上报-待审批</el-tag>
  72. <el-tag v-if="row.status === 3" type="primary" effect="dark">待试验</el-tag>
  73. <el-tag v-if="row.status === 4" type="success" effect="dark">委托完成</el-tag>
  74. </template>
  75. <template #action="{ row }">
  76. <hc-tooltip keys="tentative_material_commission_edit">
  77. <el-link v-if="row.status === 1" v-loading="row.rowLoad" type="primary" @click="rowEdit(row)">修改</el-link>
  78. <el-link v-else type="success" @click="rowView(row)">查看</el-link>
  79. </hc-tooltip>
  80. <hc-tooltip keys="tentative_material_commission_fill">
  81. <el-link v-if="row.status === 4" type="info" disabled>创建成功</el-link>
  82. <el-link v-else-if="!isNullES(row.testId)" type="danger" :disabled="row.status !== 3" @click="rowFillReports(row)">填写报告</el-link>
  83. <el-link v-else type="danger" :disabled="row.status !== 3" @click="rowReports(row)">创建报告</el-link>
  84. </hc-tooltip>
  85. </template>
  86. </hc-table>
  87. <template #action>
  88. <hc-pages :pages="searchForm" @change="pageChange" />
  89. </template>
  90. </hc-new-card>
  91. <!-- 新增委托 -->
  92. <hc-new-dialog v-model="delegateModal" ui="hc-delegate-html-modal" is-footer-center is-table :title="`${editHtmlId ? '修改' : '新增'}委托`" widths="60rem" @close="delegateModalClose">
  93. <div class="hc-delegate-contract hc-flex h-40px">
  94. <el-select v-model="delegateContractId" placeholder="请先选择合同段" filterable class="w-400px" @change="delegateContractChange">
  95. <el-option v-for="item in contractData" :key="item.id" :label="item.contractName" :value="item.id" />
  96. </el-select>
  97. </div>
  98. <div class="hc-delegate-html" :class="delegateContractId ? 'is-show' : ''">
  99. <hc-table-form ref="htmlRef" :pkey="nodeErTreeId" :form="delegateHtmlForm" :html="delegateHtml" :loading="delegateHtmlLoading" @render="delegateHtmlRender" />
  100. </div>
  101. <template #footer>
  102. <el-button @click="delegateModalClose">取消</el-button>
  103. <el-button hc-btn type="warning" @click="linkSamplingModal = true">关联取样材料</el-button>
  104. <el-button v-if="editHtmlId" hc-btn type="primary" @click="creatingDelegate">保存</el-button>
  105. <el-button v-else hc-btn type="primary" :loading="creatingDelegateLoad" @click="creatingDelegate">创建</el-button>
  106. </template>
  107. </hc-new-dialog>
  108. <!-- 关联取样材料 -->
  109. <SamplingPage v-model="linkSamplingModal" v-model:id="delegateHtmlForm.sampleId" :cid="searchForm.contractId" @change="linkSamplingChange" />
  110. <!-- 创建报告 -->
  111. <hc-new-dialog v-model="rowActionModal" is-footer-center title="创建报告" widths="40rem" @close="rowActionModalClose">
  112. <el-form ref="formRef" :model="formModel" :rules="formRules" label-position="top" label-width="auto">
  113. <el-row :gutter="20">
  114. <el-col :span="12">
  115. <el-form-item label="委托单位:">
  116. <el-input v-model="formModel.entrustInfo" placeholder="委托单位" disabled />
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="12">
  120. <el-form-item label="委托单位名称:">
  121. <el-input v-model="formModel.entrustName" placeholder="委托单位名称" disabled />
  122. </el-form-item>
  123. </el-col>
  124. <el-col :span="12">
  125. <el-form-item label="取样名称:">
  126. <el-input v-model="formModel.materialName" placeholder="取样名称" disabled />
  127. </el-form-item>
  128. </el-col>
  129. <el-col :span="12">
  130. <el-form-item label="取样数量:">
  131. <el-input v-model="formModel.materialCount" placeholder="取样数量" disabled />
  132. </el-form-item>
  133. </el-col>
  134. <el-col :span="12">
  135. <el-form-item label="样品编号:">
  136. <el-input v-model="formModel.entrustNo" placeholder="样品编号" disabled />
  137. </el-form-item>
  138. </el-col>
  139. <el-col :span="12">
  140. <el-form-item label="试验数量:" prop="expCount">
  141. <el-input v-model="formModel.expCount" placeholder="试验数量" />
  142. </el-form-item>
  143. </el-col>
  144. <el-col :span="12">
  145. <el-form-item label="规格型号:">
  146. <el-input v-model="formModel.specificationModel" placeholder="规格型号" disabled />
  147. </el-form-item>
  148. </el-col>
  149. <el-col :span="12">
  150. <el-form-item label="计算单位:">
  151. <el-input v-model="formModel.calculationUnit" placeholder="计算单位" disabled />
  152. </el-form-item>
  153. </el-col>
  154. </el-row>
  155. </el-form>
  156. <template #footer>
  157. <el-button @click="rowActionModalClose">取消</el-button>
  158. <el-button hc-btn type="primary" :loading="rowActionLoading" @click="rowActionSave">创建</el-button>
  159. </template>
  160. </hc-new-dialog>
  161. <!-- 上报审批 -->
  162. <hc-report-modal
  163. :show="showReportModal"
  164. :classify-type="classifyType"
  165. :addition="reportAddition"
  166. :contract-id="contractId"
  167. :ids="reportIds"
  168. :project-id="projectId"
  169. :task-name="reportTaskName"
  170. :trial-self-inspection-record-id="2"
  171. title="上报审批" type="wbs"
  172. url="informationWriteQuery/batchTask"
  173. @finish="showReportFinish"
  174. @hide="hideReport"
  175. />
  176. </hc-body>
  177. <!-- 一键重签弹窗 -->
  178. <hc-new-dialog v-model="resignModal" title="一键重签" widths="38rem" :loading="signLoading" @close="cancelresign" @save="signClick">
  179. <div>
  180. 是否重新生成pdf:
  181. <el-radio-group v-model="resignModalRadio">
  182. <el-radio :value="2">否</el-radio>
  183. <el-radio :value="1">是</el-radio>
  184. </el-radio-group>
  185. </div>
  186. </hc-new-dialog>
  187. </template>
  188. <script setup>
  189. import { onActivated, onMounted, ref } from 'vue'
  190. import { useAppStore } from '~src/store'
  191. import { useRouter } from 'vue-router'
  192. import { getStoreValue, setStoreValue } from '~src/utils/storage'
  193. import { arrToId, arrToKey, deepClone, formValidate, getArrValue, getObjValue, isNullES, isString } from 'js-fast-way'
  194. import { toPdfPage } from '~uti/btn-auth'
  195. import { getDictionaryData } from '~uti/tools'
  196. import { getErtractInfo } from '~api/other'
  197. import mainApi from '~api/tentative/detect/commission'
  198. import samplingApi from '~api/tentative/material/sampling'
  199. import TestTree from '~src/views/tentative/material/components/TestTree.vue'
  200. import SamplingPage from './commission/sampling.vue'
  201. import { isCancel } from 'axios'
  202. import wbsApi from '~api/data-fill/wbs'
  203. //变量
  204. const router = useRouter()
  205. const useAppState = useAppStore()
  206. const userInfo = ref(useAppState.getUserInfo)
  207. const projectId = ref(useAppState.getProjectId)
  208. const contractId = ref(useAppState.getContractId)
  209. const projectInfo = ref(useAppState.getProjectInfo)
  210. const contractInfo = ref(useAppState.getContractInfo)
  211. //渲染完成
  212. onActivated(() => {
  213. getContractData()
  214. getEntrustStatusData()
  215. })
  216. //搜索表单
  217. const searchForm = ref({ entrustName: null, current: 1, size: 20, total: 0 })
  218. //自动展开缓存
  219. const treeAutoExpandKeys = ref(getStoreValue('testTreeExpandKeys') || [])
  220. //树被点击
  221. const nodeDataInfo = ref({})
  222. const nodeErTreeId = ref('')
  223. const wbsElTreeClick = ({ data, keys }) => {
  224. nodeDataInfo.value = data
  225. //nodeErTreeId.value = data['erTreeId'] || ''
  226. //缓存自动展开
  227. treeAutoExpandKeys.value = keys
  228. setStoreValue('testTreeExpandKeys', keys)
  229. searchForm.value.nodeId = data['primaryKeyId'] || ''
  230. //获取表格
  231. searchClick()
  232. }
  233. //获取合同段信息
  234. const contractData = ref([])
  235. const getContractData = async () => {
  236. const { data } = await getErtractInfo({
  237. projectId: projectId.value,
  238. contractId: contractId.value,
  239. })
  240. const res = getArrValue(data)
  241. contractData.value = res
  242. if (res.length <= 0) return
  243. let cid
  244. for (let i = 0; i < res.length; i++) {
  245. if (contractId.value == res[i].id) {
  246. cid = res[i].id
  247. }
  248. }
  249. searchForm.value.contractId = isNullES(cid) ? res[0].id : cid
  250. }
  251. //获取状态
  252. const entrustStatus = ref([])
  253. const getEntrustStatusData = async () => {
  254. entrustStatus.value = await getDictionaryData('entrust_status', true)
  255. }
  256. //搜索
  257. const searchClick = () => {
  258. searchForm.value.current = 1
  259. getTableData()
  260. }
  261. //分页被点击
  262. const pageChange = ({ current, size }) => {
  263. searchForm.value.current = current
  264. searchForm.value.size = size
  265. getTableData()
  266. }
  267. //表格数据
  268. const tableData = ref([])
  269. const tableColumn = ref([
  270. { key: 'entrustInfo', name: '委托单位' },
  271. { key: 'entrustNo', name: '委托单编号' },
  272. { key: 'entrustName', name: '委托单名称' },
  273. { key: 'materialName', name: '关联材料名称' },
  274. { key: 'status', name: '委托单状态', width: 120, align: 'center' },
  275. { key: 'action', name: '操作', width: 120, align: 'center', fixed: 'right' },
  276. ])
  277. //获取数据
  278. const tableLoading = ref(false)
  279. const getTableData = async () => {
  280. tableLoading.value = true
  281. const { error, code, data } = await mainApi.page(searchForm.value)
  282. //处理数据
  283. tableLoading.value = false
  284. if (!error && code === 200) {
  285. tableData.value = getArrValue(data['records'])
  286. searchForm.value.total = data.total || 0
  287. } else {
  288. tableData.value = []
  289. searchForm.value.total = 0
  290. }
  291. }
  292. //多选
  293. const tableCheckedKeys = ref([])
  294. const tableSelection = (rows) => {
  295. tableCheckedKeys.value = rows
  296. }
  297. //删除
  298. const delModalClick = async (_, resolve) => {
  299. const rows = tableCheckedKeys.value
  300. if (rows.length <= 0) {
  301. window.$message.warning('请先勾选需要删除的数据')
  302. return
  303. }
  304. const { error, code, msg } = await mainApi.remove(arrToId(rows))
  305. resolve()
  306. if (!error && code === 200) {
  307. window.$message.success('删除成功')
  308. getTableData().then()
  309. } else {
  310. window.$message.error(msg || '删除失败')
  311. }
  312. }
  313. //委托单变量
  314. const htmlRef = ref(null)
  315. const delegateHtml = ref('')
  316. const delegateHtmlForm = ref({})
  317. const delegateHtmlLoading = ref(false)
  318. const delegateContractId = ref(null)
  319. //新增
  320. const delegateModal = ref(false)
  321. const addFormData = () => {
  322. if ( !searchForm.value.nodeId) {
  323. window.$message.warning('请先选择节点')
  324. return
  325. }
  326. delegateModal.value = true
  327. editHtmlId.value = ''
  328. const { contractId } = deepClone(searchForm.value)
  329. delegateContractId.value = contractId
  330. if (!isNullES(contractId)) {
  331. delegateContractChange()
  332. }
  333. }
  334. //合同段被选择
  335. const delegateContractChange = async () => {
  336. delegateHtmlLoading.value = true
  337. //await getDelegateDataInfo(editHtmlId.value)
  338. await getDelegateExcelHtml()
  339. delegateHtmlLoading.value = false
  340. }
  341. //获取委托html
  342. const getDelegateExcelHtml = async () => {
  343. const { error, code, msg, data } = await samplingApi.getExcelHtml({
  344. nodeId: searchForm.value.nodeId,
  345. contractId: contractId.value,
  346. })
  347. if (!error && code === 200) {
  348. delegateHtml.value = isString(data) ? data : ''
  349. nodeErTreeId.value = msg === '未知错误' ? null : msg
  350. } else {
  351. delegateHtml.value = ''
  352. window.$message.error(msg || '获取委托信息失败')
  353. }
  354. }
  355. //关联材料选择
  356. const linkSamplingChange = async ({ id, entrustId }) => {
  357. await getDelegateExcelHtml()
  358. await getDelegateDataInfo(id, entrustId, delegateHtmlForm.value)
  359. }
  360. //获取委托数据
  361. const getDelegateDataInfo = async (id, entrustId, formData) => {
  362. const { primaryKeyId } = nodeDataInfo.value
  363. const { error, code, msg, data } = await samplingApi.getBussDataInfoTrialEntrust({
  364. id: entrustId,
  365. sampleId: id,
  366. pkeyId: nodeErTreeId.value,
  367. projectId: projectId.value,
  368. contractId: delegateContractId.value,
  369. nodeId: primaryKeyId,
  370. formData: JSON.stringify(formData),
  371. isCancel:id ? false : true,
  372. })
  373. if (!error && code === 200) {
  374. delegateHtmlForm.value = getObjValue(data[0])
  375. } else {
  376. delegateHtmlForm.value = {}
  377. window.$message.error(msg || '获取委托信息失败')
  378. }
  379. }
  380. //委托单html渲染完成
  381. const delegateHtmlRender = (form) => {
  382. delegateHtmlForm.value = form
  383. }
  384. //修改
  385. const editHtmlId = ref('')
  386. const rowEdit = async (row) => {
  387. editHtmlId.value = row.id
  388. const { contractId } = deepClone(searchForm.value)
  389. delegateContractId.value = contractId
  390. if (!isNullES(contractId)) {
  391. // delegateContractChange()
  392. row.rowLoad = true
  393. delegateHtmlLoading.value = true
  394. await getDelegateExcelHtml()
  395. await getDelegateDataInfo('', row.id)
  396. row. rowLoad = false
  397. delegateHtmlLoading.value = false
  398. delegateModal.value = true
  399. }
  400. }
  401. //关联取样材料
  402. const linkSamplingModal = ref(false)
  403. //创建委托
  404. const creatingDelegateLoad = ref(false)
  405. const creatingDelegate = async () => {
  406. if (isNullES(delegateHtml.value)) {
  407. window.$message.error('暂无委托单信息')
  408. return
  409. }
  410. const form = delegateHtmlForm.value
  411. if (isNullES(delegateContractId.value)) {
  412. window.$message.warning('请先选择合同段')
  413. return
  414. }
  415. const { title } = nodeDataInfo.value
  416. let isCan = (title === '回弹法检测混凝土抗压强度' || title === '路基压实度' || title === '地基承载力' || title === '路基路面弯沉' || title === '锚杆' || title === '喷射混凝土厚度')
  417. if (isNullES(form.sampleId) && !isCan ) {
  418. window.$message.warning('请先关联取样材料')
  419. return
  420. }
  421. //修改时的id
  422. if (!isNullES(editHtmlId.value)) {
  423. form.id = editHtmlId.value
  424. }
  425. //处理数据
  426. const { primaryKeyId } = nodeDataInfo.value
  427. form.contractId = delegateContractId.value
  428. form.nodeErTreeId = nodeErTreeId.value
  429. form.nodeId = primaryKeyId
  430. //发起请求
  431. creatingDelegateLoad.value = true
  432. const { error, code, msg } = await mainApi.htmlSave(form)
  433. creatingDelegateLoad.value = false
  434. if (!error && code === 200) {
  435. window.$message.success('创建成功')
  436. delegateModalClose()
  437. getTableData().then()
  438. } else {
  439. window.$message.error(msg || '创建失败')
  440. }
  441. }
  442. //关闭委托
  443. const delegateModalClose = () => {
  444. delegateModal.value = false
  445. delegateHtmlForm.value = {}
  446. delegateHtml.value = ''
  447. delegateContractId.value = null
  448. delegateHtmlLoading.value = false
  449. }
  450. //查看
  451. const rowView = ({ entrustEPdf, entrustPdf }) => {
  452. if (isNullES(entrustPdf) && isNullES(entrustEPdf)) {
  453. window.$message.warning('暂无PDF数据')
  454. return
  455. }
  456. if (!isNullES(entrustEPdf)) {
  457. toPdfPage(entrustEPdf)
  458. } else if (!isNullES(entrustPdf)) {
  459. toPdfPage(entrustPdf)
  460. }
  461. }
  462. //表单数据
  463. const formRef = ref(null)
  464. const formModel = ref({})
  465. const formRules = {
  466. expCount: {
  467. required: true,
  468. trigger: 'blur',
  469. message: '请填写试验数量',
  470. },
  471. }
  472. //创建报告
  473. const rowActionModal = ref(false)
  474. const creatRow = ref({})
  475. const rowReports = async (row) => {
  476. rowActionModal.value = true
  477. const { data } = await mainApi.detail(row.id)
  478. formModel.value = getObjValue(data)
  479. creatRow.value = row
  480. }
  481. //提交保存
  482. const rowActionLoading = ref(false)
  483. const rowActionSave = async () => {
  484. const isForm = await formValidate(formRef.value)
  485. if (!isForm) return
  486. rowActionLoading.value = true
  487. const { contractType } = contractInfo.value
  488. const { expCount } = formModel.value
  489. const { primaryKeyId } = nodeDataInfo.value
  490. setStoreValue('testTreeItem', nodeDataInfo.value)
  491. setStoreValue('prenodeDataInfo', nodeDataInfo.value)
  492. const { repealType, sampleStatus, id } = creatRow.value
  493. const { error, code, msg } = await mainApi.update({ id, expCount, repealType, sampleStatus })
  494. if (!error && code === 200) {
  495. window.$message.success('创建成功')
  496. rowActionLoading.value = false
  497. rowActionModalClose()
  498. router.push({
  499. path: '/tentative/detect/test-form',
  500. query: {
  501. nodeId: primaryKeyId || '',
  502. dataType: contractType > 0 ? contractType + '' : '1',
  503. commissionId: id,
  504. cid: searchForm.value?.contractId,
  505. isaddType: true,
  506. },
  507. }).then()
  508. } else {
  509. rowActionLoading.value = false
  510. window.$message.error(msg || '创建失败')
  511. }
  512. }
  513. //关闭弹窗
  514. const rowActionModalClose = () => {
  515. rowActionModal.value = false
  516. formModel.value = {}
  517. }
  518. //填写报告
  519. const rowFillReports = async ({ id, testId }) => {
  520. const { error, code, data, msg } = await mainApi.selfDetail(testId)
  521. if (!error && code === 200) {
  522. const res = getObjValue(data)
  523. setStoreValue('test-form', res)
  524. setStoreValue('testTreeItem', nodeDataInfo.value)
  525. setStoreValue('prenodeDataInfo', nodeDataInfo.value)
  526. router.push({
  527. path: '/tentative/detect/test-form',
  528. query: {
  529. id: testId,
  530. nodeId: res.nodeId,
  531. dataType: res.type,
  532. commissionId: id,
  533. tabTypeKey: 1,
  534. cid: searchForm.value?.contractId,
  535. },
  536. }).then()
  537. } else {
  538. window.$message.error(msg || '操作失败')
  539. }
  540. }
  541. //批量打印
  542. const batchPrinting = () => {
  543. }
  544. //上报
  545. const classifyType = ref('')
  546. const reportIds = ref('')
  547. const reportTaskName = ref('')
  548. const showReportModal = ref(false)
  549. const reportAddition = ref({})
  550. const reportClick = async () => {
  551. const rows = tableCheckedKeys.value
  552. if (rows.length <= 0) {
  553. window.$message.warning('请先勾选一条需要上报的数据')
  554. return
  555. } else if (rows.length > 1) {
  556. window.$message.warning('只能选择其中一条数据进行上报')
  557. return
  558. }
  559. //判断状态
  560. const { status, entrustName } = { ...rows[0] }
  561. if (status !== 1) {
  562. window.$message.warning('只能选择未上报的数据进行上报')
  563. return
  564. }
  565. // 委托单上报设置为1
  566. classifyType.value = '1'
  567. //其它数据
  568. reportIds.value = rows[0].id //数据ID
  569. // reportTaskName.value = entrustName //任务名称
  570. //附加数据
  571. const { contractIdRelation } = nodeDataInfo.value
  572. reportAddition.value = {
  573. taskType: '1', //用来区分委托单
  574. classify: classifyType.value,
  575. contractIdRelation: contractIdRelation,
  576. }
  577. //请求文件题名
  578. const { data } = await wbsApi.queryDocumentTitle({
  579. // primaryKeyId: info['primaryKeyId'],
  580. primaryKeyId: rows[0].id,
  581. classify: '1',
  582. })
  583. reportTaskName.value = isString(data) ? data : ''
  584. //显示任务上报
  585. showReportModal.value = true
  586. }
  587. //上报完成
  588. const showReportFinish = () => {
  589. hideReport()
  590. getTableData()
  591. }
  592. //关闭上报弹窗
  593. const hideReport = () => {
  594. showReportModal.value = false
  595. classifyType.value = ''
  596. reportAddition.value = {}
  597. reportIds.value = ''
  598. reportTaskName.value = ''
  599. }
  600. //打印空表
  601. const printerNull = () => {
  602. }
  603. //废除
  604. const repealFormData = async ()=>{
  605. const rows = tableCheckedKeys.value
  606. if (rows.length <= 0) {
  607. window.$message.warning('请先勾选需要废除的数据')
  608. return
  609. }
  610. //判断是否满足条件
  611. const result = rows.every(({ status, expCount }) => {
  612. return status === 2 && expCount === 0 || status === 2 && expCount === null || status === 3 && expCount === null || status === 3 && expCount === 0
  613. })
  614. if (!result) return window.$message.warning('所选择的数据不能进行废除操作')
  615. const { error, code, msg } = await mainApi.annul({ id:arrToId(rows) })
  616. if (!error && code === 200) {
  617. window.$message.success(msg)
  618. getTableData().then()
  619. } else {
  620. window.$message.error(msg || '删除失败')
  621. }
  622. }
  623. //一键重签
  624. //一键重签
  625. const signLoading = ref(false)
  626. const resignModal = ref(false)
  627. const resignModalRadio = ref(1)
  628. const resignClick = async ()=>{
  629. const rows = tableCheckedKeys.value
  630. if (rows.length <= 0) {
  631. window.$message?.warning('请先勾选已审批的数据')
  632. return
  633. }
  634. resignModal.value = true
  635. }
  636. const signClick = async () => {
  637. const rows = tableCheckedKeys.value
  638. const { primaryKeyId } = nodeDataInfo.value
  639. let objArr = []
  640. rows.forEach((item)=>{
  641. objArr.push({
  642. // taskId:item.taskId || '',
  643. entrustId:item.id,
  644. type:resignModalRadio.value,
  645. nodeId:primaryKeyId,
  646. contractId: contractId.value,
  647. status:item.status,
  648. })
  649. })
  650. //发起请求
  651. signLoading.value = true
  652. const { error, code, msg } = await mainApi.reSigningEntrust(objArr)
  653. //处理数据
  654. signLoading.value = false
  655. if (!error && code === 200) {
  656. window.$message?.success(msg ?? '提交成功,请请耐心等待重签,可继续操作其它的功能。')
  657. getTableData().then()
  658. } else {
  659. window.$message?.error(msg ?? '操作失败')
  660. }
  661. resignModal.value = false
  662. }
  663. const cancelresign = ()=>{
  664. resignModalRadio.value = 0
  665. resignModal.value = false
  666. }
  667. </script>
  668. <style lang="scss">
  669. .el-overlay-dialog .el-dialog.hc-new-dialog.hc-delegate-html-modal {
  670. .hc-new-dialog-body {
  671. padding: 0;
  672. }
  673. .hc-table-form-data-item {
  674. padding: 0;
  675. .el-scrollbar__bar.is-vertical {
  676. right: 0;
  677. }
  678. }
  679. }
  680. .hc-delegate-html-modal {
  681. .hc-delegate-html {
  682. position: relative;
  683. height: calc(100% - 40px);
  684. .hc-table-form-data-item {
  685. background-color: #efefef;
  686. }
  687. &::after {
  688. content: "";
  689. position: absolute;
  690. inset: 0;
  691. background: rgb(161 161 161 / 40%);
  692. z-index: 22;
  693. }
  694. &.is-show {
  695. &::after {
  696. display: none;
  697. z-index: -1;
  698. }
  699. }
  700. }
  701. }
  702. </style>