unit.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. <template>
  2. <div class="relative h-full flex">
  3. <div :id="`hc_tree_card_${uuid}`">
  4. <hc-new-card scrollbar>
  5. <template #header>
  6. <div class="w-full flex justify-between">
  7. <el-button hc-btn type="primary" :loading="setLoading" @click="setTree">重新设置treeCode</el-button>
  8. <el-button hc-btn type="primary" :loading="linkLoading" @click="linkDataClick(1)">关联资料</el-button>
  9. </div>
  10. </template>
  11. <hc-lazy-tree
  12. v-if="ishowTree"
  13. :auto-expand-keys="TreeAutoExpandKeys"
  14. tree-key="id"
  15. :h-props="treeProps"
  16. is-load-menu
  17. @load="treeLoadNode"
  18. @load-menu="treeLoadMenu"
  19. @menu-tap="treeMenuTap"
  20. @node-tap="treeNodeTap"
  21. />
  22. </hc-new-card>
  23. </div>
  24. <div :id="`hc_table_card_${uuid}`" class="flex-1">
  25. <hc-new-card scrollbar title="合同计量单元">
  26. <template #extra>
  27. <el-button hc-btn type="primary" @click="editModalShow = true">修改</el-button>
  28. <el-button hc-btn type="danger">删除</el-button>
  29. <el-button hc-btn type="warning" @click="treeModalShow = true">增补单元</el-button>
  30. <el-button hc-btn type="success" @click="leadModal">导入</el-button>
  31. </template>
  32. <div class="relative">
  33. <infoTable :info-data="curTreeData" />
  34. <HcTitle title="清单分解汇总列表">
  35. <template #extra>
  36. <div class="text-sm text-orange">温馨提示:累计分解量 > 合同变更后量,整行文字红色</div>
  37. </template>
  38. </HcTitle>
  39. <div style="height: calc(50vh - 210px);">
  40. <hc-table
  41. :is-stripe="false" :column="tableColumn" :datas="tableData" :loading="tableLoading"
  42. is-new :index-style="{ width: 60 }" :row-style="tableRowStyle"
  43. >
  44. <template #key1="{ row }">
  45. <i class="i-iconoir-open-select-hand-gesture inline-block" />
  46. </template>
  47. </hc-table>
  48. </div>
  49. <HcTitle title="质检关联清单">
  50. <template #extra>
  51. <el-button hc-btn type="primary" @click="linkDataClick(2)">关联</el-button>
  52. <el-button hc-btn type="primary" :loading="batchCancleload" :disabled="cancelKeys.length == 0" @click="batchCancle">批量取消</el-button>
  53. </template>
  54. </HcTitle>
  55. <div style="height: calc(50vh - 250px);">
  56. <hc-table
  57. :is-stripe="false" :column="qualtableColumn" :datas="qualtableData" :loading="tableLoading"
  58. is-new :index-style="{ width: 60 }"
  59. is-check @selection-change="tableSelectionChange"
  60. >
  61. <template #appStatusName="{ row }">
  62. <el-tag
  63. v-if="row.appStatusName"
  64. :type="`${row.appStatusName === '已审批' ? 'success' : row.appStatusName === '已填报-待审批' ? 'warning' : row.appStatusName === '已填报-未上报' ? 'primary' : 'info'}`"
  65. class="mx-1" effect="dark"
  66. >
  67. {{ row.appStatusName }}
  68. </el-tag>
  69. </template>
  70. <template #action="{ row }">
  71. <el-button hc-btn type="primary" size="small" :loading="row?.load" @click="cancleLink(row)">取消关联</el-button>
  72. </template>
  73. </hc-table>
  74. </div>
  75. </div>
  76. </hc-new-card>
  77. </div>
  78. <!-- 节点新增和编辑 -->
  79. <treeForm
  80. v-model="treeModalShow" :ids="curTreeData.id" :menu-type="menuType"
  81. :template-id="curTreeData.templateId" @finish="finishForm"
  82. />
  83. <!-- 修改合同计量单元 -->
  84. <rowData
  85. v-model="editModalShow" :is-table="isInfoView" :ids="curTreeData.id" :cur-tree-data="curTreeData"
  86. @finish="finishEdit" @close="closeEdit" @get-detail="getTreeNodeDetail"
  87. />
  88. <!-- 调整排序 -->
  89. <hc-new-dialog
  90. v-model="sortModalShow" is-table widths="1100px" title="调整排序" :loading="sortNodeLoading"
  91. @save="sortModalSave"
  92. >
  93. <hc-table
  94. ui="hc-table-row-drop"
  95. :column="sortTableColumn" :datas="sortTableData" :loading="sortTableLoading"
  96. is-row-drop quick-sort is-new :index-style="{ width: 80 }"
  97. @row-drop="sortTableRowDrop" @row-sort="sortTableRowDrop"
  98. >
  99. <template #key2="{ row }">
  100. <span class="text-link">{{ row?.key2 }}</span>
  101. </template>
  102. <template #action="{ index }">
  103. <span class="text-link text-xl" @click="upSortClick(index)">
  104. <HcIcon name="arrow-up" fill />
  105. </span>
  106. <span class="text-link ml-2 text-xl" @click="downSortClick(index)">
  107. <HcIcon name="arrow-down" fill />
  108. </span>
  109. </template>
  110. </hc-table>
  111. </hc-new-dialog>
  112. <!-- 导入合同计量单元 -->
  113. <hc-new-dialog v-model="leadModalShow" scrollbar widths="1100px" title="合同计量单元导入" @save="leadModalSave">
  114. <div class="hc-el-upload-drag">
  115. <el-upload
  116. ref="leadUploadRef" hc drag :show-file-list="true" :auto-upload="false" :headers="getHeader()"
  117. action="/api/blade-meter/tree/contract/import" :data="{ id: checkTreeId, type: typevalue }" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
  118. :on-error="handFileError"
  119. :on-success="handleFileDUcess"
  120. :disabled="!typevalue"
  121. @click="beforeUpload"
  122. >
  123. <div class="hc-ui-upload-btn">
  124. <div class="hc-uploader-drop">
  125. <div class="upload-icon">
  126. <HcIcon name="upload-cloud" />
  127. </div>
  128. <div class="text">将文件拖动到此处,或点击上传</div>
  129. </div>
  130. <div class="hc-uploader-accept">支持的文件格式: Excel(xls、xlsx)</div>
  131. </div>
  132. </el-upload>
  133. </div>
  134. <hc-title>
  135. <span>范例模板</span>
  136. <template #extra>
  137. <span style="color: red;">*</span> 切换范例模板:
  138. <el-select
  139. v-model="typevalue"
  140. placeholder="请选择"
  141. style="width: 240px"
  142. clearable
  143. >
  144. <el-option
  145. v-for="item in typeoptions"
  146. :key="item.value"
  147. :label="item.label"
  148. :value="item.value"
  149. />
  150. </el-select>
  151. <el-link type="primary" @click="downLoadExel">下载范例模板.xls</el-link>
  152. </template>
  153. </hc-title>
  154. <el-table v-if="typevalue === '2'" :data="tableLeadData" style="width: 100%;" row-key="id" border>
  155. <el-table-column prop="k1" label="工程编号" width="90" />
  156. <el-table-column prop="k2" label="节点编号" width="90" />
  157. <el-table-column prop="k3" label="清单编号" width="90" />
  158. <el-table-column prop="k4" label="工程名称" />
  159. <el-table-column prop="k5" label="施工图数量" width="100" />
  160. <el-table-column prop="k6" label="合同图号" width="90" />
  161. <el-table-column prop="k7" label="备注" />
  162. </el-table>
  163. <el-table v-if="typevalue === '1'" :data="tableLeadData1" style="width: 100%;" row-key="id" border>
  164. <el-table-column prop="k1" label="桩号支付编号" />
  165. <el-table-column prop="k2" label="图号" />
  166. <el-table-column prop="k3" label="403-1-1" />
  167. <el-table-column prop="k4" label="403-1-2" />
  168. <el-table-column prop="k5" label="403-1-3" />
  169. <el-table-column prop="k6" label="404-1-4" />
  170. <el-table-column prop="k7" label="清单编号..." />
  171. <el-table-column prop="k8" label="备注" />
  172. </el-table>
  173. <div v-if="typevalue === '1'" class="mt-3 text-orange font-400">温馨提示:清单编号需手动填写,清单编号列填写施工图数量,若有关联则填写数字,反之保留空白</div>
  174. </hc-new-dialog>
  175. <!--
  176. 关联资料 -->
  177. <linkData :link-modal="linkModal" :is-check-id="isCheckId" :check-ids="checkTreeId" :right-tree-check="rightTreeCheck" @close="closeLink" @save="saveLink" />
  178. </div>
  179. </template>
  180. <script setup>
  181. import { nextTick, onMounted, ref } from 'vue'
  182. import { arrToId, arrToKey, getArrValue, getObjValue, getRandom } from 'js-fast-way'
  183. import infoTable from './components/unit/info-table.vue'
  184. import treeForm from './components/unit/tree-form.vue'
  185. import rowData from './components/unit/row-data.vue'
  186. import unitApi from '~api/project/debit/contract/unit.js'
  187. import linkData from './components/unit/link-data.vue'
  188. import { useAppStore } from '~src/store'
  189. import { getStoreValue, setStoreValue } from '~src/utils/storage'
  190. import { delMessageV2 } from '~com/message/index.js'
  191. import { getDictionary } from '~api/other'
  192. import BigNumber from 'bignumber.js'
  193. import { getHeader } from 'hc-vue3-ui'
  194. const useAppState = useAppStore()
  195. const projectId = ref(useAppState.getProjectId || '')
  196. const contractId = ref(useAppState.getContractId || '')
  197. defineOptions({
  198. name: 'ProjectDebitContractUnit',
  199. })
  200. const uuid = getRandom(4)
  201. //渲染完成
  202. onMounted(() => {
  203. setSplitRef()
  204. // getNodeType()
  205. })
  206. //初始化设置拖动分割线
  207. const setSplitRef = () => {
  208. //配置参考: https://split.js.org/#/?direction=vertical&snapOffset=0
  209. nextTick(() => {
  210. window.$split(['#hc_tree_card_' + uuid, '#hc_table_card_' + uuid], {
  211. sizes: [20, 80],
  212. snapOffset: 0,
  213. minSize: [50, 500],
  214. })
  215. })
  216. }
  217. //获节点类型
  218. const nodeOptions = ref([])
  219. const getNodeType = async (id) => {
  220. const { data } = await unitApi.getNodeTypeList({
  221. id,
  222. })
  223. nodeOptions.value = getArrValue(data)
  224. nodeOptions.value.forEach((ele) => {
  225. ele.dictKey = Number(ele.dictKey)
  226. })
  227. }
  228. //搜索表单
  229. const searchForm = ref({})
  230. //数据格式
  231. const treeProps = {
  232. label: 'nodeName',
  233. children: 'children',
  234. isLeaf: 'notExsitChild',
  235. }
  236. const ishowTree = ref(true)
  237. //重新设置树
  238. const setLoading = ref(false)
  239. const setTree = async () => {
  240. setLoading.value = true
  241. const { error, code, msg } = await unitApi.refresh({
  242. projectId: projectId.value,
  243. contractId: contractId.value,
  244. })
  245. setLoading.value = false
  246. if (!error && code === 200) {
  247. window.$message.success(msg)
  248. ishowTree.value = false
  249. setTimeout(() => {
  250. ishowTree.value = true
  251. }, 100)
  252. } else {
  253. window.$message.error(msg)
  254. }
  255. }
  256. //懒加载的数据
  257. const TreeAutoExpandKeys = ref(getStoreValue('wbsTreeExpandKeys') || [])
  258. const treeLoadNode = async ({ node, item, level }, resolve) => {
  259. let id = 0
  260. if (level !== 0) {
  261. const nodeData = getObjValue(item)
  262. id = nodeData?.id || ''
  263. }
  264. //获取数据
  265. const { error, code, data } = await unitApi.lazyTree({
  266. contractId: contractId.value,
  267. id: id,
  268. })
  269. resolve(getArrValue(data))
  270. }
  271. //节点点击
  272. const isInfoView = ref(false)
  273. const checkTreeId = ref('')
  274. const checkTreeLevel = ref('')
  275. const treeNodeTap = ({ node, data, keys }) => {
  276. treeClickdata.value = data
  277. const { level } = node
  278. checkTreeLevel.value = level
  279. checkTreeId.value = data.id
  280. getNodeType(data.id)
  281. isInfoView.value = node.isLeaf
  282. TreeAutoExpandKeys.value = keys || []
  283. setStoreValue('wbsTreeExpandKeys', keys)
  284. getTreeNodeDetail(data)
  285. }
  286. //获取节点详情
  287. //选中的节点数组
  288. const rightTreeCheck = ref([])
  289. const curTreeData = ref({})
  290. const getTreeNodeDetail = async ({ id }) => {
  291. const { error, code, data } = await unitApi.getNodeDetail({ id })
  292. if (!error && code === 200) {
  293. curTreeData.value = getObjValue(data)
  294. tableData.value = curTreeData.value['decompositionList']
  295. qualtableData.value = curTreeData.value['linkNodeList']
  296. rightTreeCheck.value = arrToKey(qualtableData.value, 'wbsTreeId', ',').split(',')
  297. nodeOptions.value.forEach((ele) => {
  298. if (curTreeData.value.nodeType === ele.dictKey) {
  299. curTreeData.value.nodeTypeName = ele.dictValue
  300. }
  301. })
  302. } else {
  303. curTreeData.value = {}
  304. tableData.value = []
  305. qualtableData.value = []
  306. }
  307. }
  308. //菜单
  309. const treeLoadMenu = ({ item, level }, resolve) => {
  310. const { isLock } = item
  311. if (level === 1) {
  312. if (isLock === 1) {
  313. return resolve([
  314. { icon: 'lock', label: '解锁', key: 'lock' },
  315. { icon: 'upload-cloud', label: '导入', key: 'lead' },
  316. { icon: 'add', label: '新增', key: 'add' },
  317. { icon: 'arrow-up-down-line', label: '排序', key: 'sort' },
  318. ])
  319. } else {
  320. return resolve([
  321. { icon: 'lock', label: '锁定', key: 'lock' },
  322. { icon: 'upload-cloud', label: '导入', key: 'lead' },
  323. { icon: 'add', label: '新增', key: 'add' },
  324. { icon: 'arrow-up-down-line', label: '排序', key: 'sort' },
  325. ])
  326. }
  327. } else {
  328. if (isLock === 1) {
  329. return resolve([
  330. { icon: 'lock', label: '解锁', key: 'lock' },
  331. { icon: 'upload-cloud', label: '导入', key: 'lead' },
  332. { icon: 'add', label: '新增', key: 'add' },
  333. { icon: 'pencil', label: '修改', key: 'edit' },
  334. { icon: 'arrow-up-down-line', label: '排序', key: 'sort' },
  335. { icon: 'close', label: '删除', key: 'del' },
  336. ])
  337. } else {
  338. return resolve([
  339. { icon: 'lock', label: '锁定', key: 'lock' },
  340. { icon: 'upload-cloud', label: '导入', key: 'lead' },
  341. { icon: 'add', label: '新增', key: 'add' },
  342. { icon: 'pencil', label: '修改', key: 'edit' },
  343. { icon: 'arrow-up-down-line', label: '排序', key: 'sort' },
  344. { icon: 'close', label: '删除', key: 'del' },
  345. ])
  346. }
  347. }
  348. }
  349. const menuType = ref('')
  350. const treeClickdata = ref()
  351. const treeMenuTap = ({ key, node, data, keys }) => {
  352. const { isDecompositionData } = data
  353. isInfoView.value = node.isLeaf
  354. menuType.value = key
  355. getTreeNodeDetail(data)
  356. setStoreValue('wbsTreeExpandKeys', keys)
  357. TreeAutoExpandKeys.value = keys || []
  358. if (data?.isLock !== 1) {
  359. if (key === 'add') {
  360. if (isDecompositionData === 1) {
  361. window.$message.warning('该节点下面不允许新增节点')
  362. } else {
  363. treeModalShow.value = true
  364. }
  365. }
  366. if (key === 'edit') {
  367. editModalShow.value = true
  368. }
  369. if (key === 'sort') {
  370. let nodes = [], childNodes = []
  371. childNodes = node?.parent?.childNodes || node?.parent?.children || []
  372. for (let i = 0; i < childNodes.length; i++) {
  373. const res = childNodes[i]?.data
  374. nodes.push({
  375. nodeName: res?.nodeName,
  376. id: res?.id,
  377. })
  378. }
  379. sortTableData.value = nodes
  380. sortModalShow.value = true
  381. }
  382. if (key === 'del') {
  383. delModalClick()
  384. }
  385. }
  386. if (data?.isLock === 1 && key !== 'lock') {
  387. window.$message.warning('当前节点为锁定状态,不允许操作')
  388. }
  389. if (key === 'lock') {
  390. handleLockNode()
  391. }
  392. }
  393. //锁定节点
  394. const handleLockNode = async () => {
  395. const { error, code, msg } = await unitApi.getLock({
  396. id: curTreeData.value.id || '',
  397. lockStatus: curTreeData.value?.isLock === 1 ? 0 : 1,
  398. })
  399. if (!error && code === 200) {
  400. window?.$message?.success(msg)
  401. window?.location?.reload() //刷新页面
  402. }
  403. }
  404. //删除节点
  405. const delModalClick = () => {
  406. delMessageV2(async (action, instance, done) => {
  407. if (action === 'confirm') {
  408. instance.confirmButtonLoading = true
  409. removeContractTreeNode()
  410. instance.confirmButtonLoading = false
  411. done()
  412. } else {
  413. done()
  414. }
  415. })
  416. }
  417. const removeContractTreeNode = async () => {
  418. const loadingInstance = window.$loading.service({
  419. fullscreen: true,
  420. text: '删除节点中,请耐心等待...',
  421. background: 'rgba(0, 0, 0, 0.7)',
  422. })
  423. const { error, code, msg } = await unitApi.deleteNode({
  424. id: curTreeData.value.id || '',
  425. })
  426. loadingInstance.close()
  427. if (!error && code === 200) {
  428. window?.$message?.success('删除成功')
  429. window?.location?.reload() //刷新页面
  430. } else {
  431. window.$message.error(msg)
  432. }
  433. }
  434. //表格数据
  435. const tableLoading = ref(false)
  436. const tableColumn = ref([
  437. { key: 'key1', name: '分解明细', width: 80, align: 'center' },
  438. { key: 'formNumber', name: '清单编号', width: 120, align: 'center' },
  439. { key: 'formName', name: '清单名称', align: 'center' },
  440. { key: 'currentPrice', name: '单价', width: 90, align: 'center' },
  441. { key: 'contractTotal', name: '合同数量', width: 100, align: 'center' },
  442. { key: 'changeTotal', name: '变更后数量', width: 110, align: 'center' },
  443. { key: 'buildPictureTotal', name: '施工图数量', align: 'center' },
  444. { key: 'changeBuildPictureTotal', name: '施工图变更后数量', align: 'center' },
  445. ])
  446. const tableData = ref([])
  447. //质检关联清单
  448. const qualtableColumn = ref([
  449. { key: 'part', name: '分/子分项部位', align: 'center' },
  450. { key: 'appStatusName', name: '审核状态', align: 'center' },
  451. { key: 'action', name: '操作', align: 'center' },
  452. ])
  453. const qualtableData = ref([])
  454. const cancelKeys = ref('')
  455. //多选事件
  456. const tableSelectionChange = (rows) => {
  457. console.log(rows)
  458. cancelKeys.value = arrToKey(rows, 'id', ',')
  459. }
  460. //设置某一行的样式
  461. const tableRowStyle = ({ row }) => {
  462. let residueNum = new BigNumber(row.residueNum) //a
  463. let contract = new BigNumber('0') //b
  464. //a 大于 b = 1,a 等于 b = 0,a 小于 b = -1, a 或 b 的值异常时 = null
  465. const isCompared = residueNum.comparedTo(contract)
  466. if (isCompared === -1 || isCompared === null) {
  467. return '--el-table-tr-bg-color: #fe0000; --el-table-row-hover-bg-color: #fe0000; color: white;'
  468. }
  469. }
  470. //弹窗
  471. const treeModalShow = ref(false)
  472. const editModalShow = ref(false)
  473. const finishForm = () => {
  474. treeModalShow.value = false
  475. ishowTree.value = false
  476. setTimeout(() => {
  477. ishowTree.value = true
  478. }, 100)
  479. }
  480. const finishEdit = () => {
  481. editModalShow.value = false
  482. ishowTree.value = false
  483. setTimeout(() => {
  484. ishowTree.value = true
  485. }, 100)
  486. }
  487. const closeEdit = () => {
  488. editModalShow.value = false
  489. ishowTree.value = false
  490. setTimeout(() => {
  491. ishowTree.value = true
  492. }, 100)
  493. }
  494. //调整排序
  495. const sortModalShow = ref(false)
  496. //表格数据
  497. const sortTableColumn = ref([
  498. { key: 'nodeName', name: '节点名称' },
  499. { key: 'action', name: '排序', width: 90 },
  500. ])
  501. const sortTableLoading = ref(false)
  502. const sortTableData = ref([])
  503. //拖动完成
  504. const sortTableRowDrop = (rows) => {
  505. sortTableData.value = [] // 先清空,否则排序会异常
  506. nextTick(() => {
  507. sortTableData.value = rows
  508. })
  509. }
  510. //向下
  511. const downSortClick = (index) => {
  512. const indexs = index + 1
  513. const data = sortTableData.value
  514. if (indexs !== data.length) {
  515. const tmp = data.splice(indexs, 1)
  516. sortTableData.value.splice(index, 0, tmp[0])
  517. } else {
  518. window?.$message?.warning('已经处于置底,无法下移')
  519. }
  520. }
  521. //向上
  522. const upSortClick = (index) => {
  523. const data = sortTableData.value || []
  524. if (index !== 0) {
  525. const tmp = data.splice(index - 1, 1)
  526. sortTableData.value.splice(index, 0, tmp[0])
  527. } else {
  528. window?.$message?.warning('已经处于置顶,无法上移')
  529. }
  530. }
  531. const sortNodeLoading = ref(false)
  532. const sortModalSave = async () => {
  533. const ids = arrToId(sortTableData.value)
  534. //发起请求
  535. sortNodeLoading.value = true
  536. const { error, code, msg } = await unitApi.sortForm({ ids })
  537. sortNodeLoading.value = false
  538. //判断状态
  539. if (!error && code === 200) {
  540. window?.$message?.success('保存成功')
  541. sortModalShow.value = false
  542. window?.location?.reload() //刷新页面
  543. } else {
  544. window.$message.error(msg)
  545. }
  546. }
  547. //合同计量单元导入
  548. const leadModalShow = ref(false)
  549. const leadUploadRef = ref(null)
  550. const leadModal = ()=>{
  551. if (!checkTreeId.value) {
  552. window.$message.warning('请先选择左侧节点')
  553. return
  554. }
  555. // if (checkTreeLevel.value > 3) {
  556. // window.$message.warning('只能从前三层节点开始导入,操作失败')
  557. // return
  558. // }
  559. leadModalShow.value = true
  560. }
  561. const handleFileDUcess = (res)=>{
  562. const { msg, code } = res
  563. if ( code === 200) {
  564. window?.$message?.success(msg)
  565. } else {
  566. window.$message.warning(msg)
  567. }
  568. }
  569. const beforeUpload = ()=>{
  570. if (!typevalue.value) {
  571. window.$message.warning('请先选择模板')
  572. return
  573. }
  574. }
  575. const handFileError = (err)=>{
  576. const msg = JSON.parse(err.message).msg
  577. window.$message.warning(msg)
  578. }
  579. const tableLeadData = ref([
  580. { id: 1, k1: '100', k2: '100-1', k3: '', k4: 'K01+000~K015+000(举例本标段里程号)', k5: '', k6: '', k7: '' },
  581. { id: 2, k1: '100', k2: '100-1', k3: '101-1a', k4: '按合同条款规定,提供建筑工程一切险', k5: '5', k6: '', k7: '' },
  582. { id: 3, k1: '100', k2: '100-1', k3: '101-1b', k4: '线外供电干线设施', k5: '3', k6: '', k7: '' },
  583. { id: 4, k1: '200', k2: '100-2', k3: '', k4: 'K01+000~K015+000(举例本标段里程桩号)', k5: '', k6: '', k7: '' },
  584. { id: 5, k1: '200', k2: '100-2', k3: '200-2-a', k4: '按合同条款规定,提供建筑工程一切险', k5: '5', k6: '', k7: '' },
  585. { id: 6, k1: '200', k2: '100-2', k3: '200-2-b', k4: '线外供电干线设施', k5: '3', k6: '', k7: '' },
  586. ])
  587. const tableLeadData1 = ref([
  588. { id: 1, k1: '0-A#桩基', k2: '', k3: '1', k4: '', k5: '1', k6: '1', k7: '1', k8:'' },
  589. { id: 2, k1: '0-A#桩基', k2: '', k3: '1', k4: '1', k5: '0', k6: '1', k7: '1', k8:'' },
  590. { id: 3, k1: '0-A#桩基', k2: '', k3: '', k4: '1', k5: '1', k6: '1', k7: '1', k8:'' },
  591. ])
  592. const leadModalSave = async () => {
  593. await leadUploadRef.value.submit()
  594. leadModalShow.value = false
  595. ishowTree.value = false
  596. setTimeout(() => {
  597. ishowTree.value = true
  598. }, 1000)
  599. }
  600. //下载范例模板
  601. const downLoadExel = ()=>{
  602. if (typevalue.value) {
  603. if (typevalue.value === '1') {
  604. window.open('https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20240307/1430b65643615f80156ec328a9a09ff8.xlsx', '_blank')
  605. } else {
  606. window.open('https://bladex-chongqing-info.oss-cn-hangzhou.aliyuncs.com//upload/20240109/98addbf48d620030504b2cb03b1c24f5.xls', '_blank')
  607. }
  608. } else {
  609. window.$message.warning('请先选择模板')
  610. }
  611. }
  612. const typeoptions = ref([
  613. {
  614. value: '1',
  615. label: '模板1',
  616. },
  617. {
  618. value: '2',
  619. label: '模板2',
  620. },
  621. ])
  622. const typevalue = ref('')
  623. //关联资料
  624. const isCheckId = ref(1)
  625. const linkLoading = ref(false)
  626. const linkModal = ref(false)
  627. const linkDataClick = (type)=>{
  628. linkModal.value = true
  629. isCheckId.value = type
  630. }
  631. const closeLink = ()=>{
  632. linkModal.value = false
  633. getTreeNodeDetail(treeClickdata.value)
  634. }
  635. const saveLink = ()=>{
  636. linkModal.value = false
  637. getTreeNodeDetail(treeClickdata.value)
  638. }
  639. const cancleLink = async (row)=>{
  640. row.load = true
  641. const { error, code, msg } = await unitApi.deleteLinkWbsTree({ ids:row.id })
  642. row.load = false
  643. //判断状态
  644. if (!error && code === 200) {
  645. window?.$message?.success(msg)
  646. getTreeNodeDetail(treeClickdata.value)
  647. } else {
  648. window.$message.error(msg)
  649. }
  650. }
  651. const batchCancleload = ref(false)
  652. const batchCancle = async ()=>{
  653. batchCancleload.value = true
  654. const { error, code, msg } = await unitApi.deleteLinkWbsTree({ ids:cancelKeys.value })
  655. batchCancleload.value = false
  656. //判断状态
  657. if (!error && code === 200) {
  658. window?.$message?.success(msg)
  659. getTreeNodeDetail(treeClickdata.value)
  660. } else {
  661. window.$message.error(msg)
  662. }
  663. }
  664. </script>