index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870
  1. <template>
  2. <div>
  3. <el-container>
  4. <!-- 左侧树形结构 -->
  5. <el-scrollbar max-height="75vh">
  6. <el-aside>
  7. <div class="JKWTree-tree">
  8. <h3>工单核验单维护</h3>
  9. <el-tree
  10. :data="treeData"
  11. highlight-current
  12. @node-click="handleNodeClick"
  13. />
  14. </div>
  15. </el-aside>
  16. </el-scrollbar>
  17. <el-container>
  18. <el-main>
  19. <div class="gva-table-box">
  20. <!-- 按钮区域 -->
  21. <div class="gva-btn-list">
  22. <el-row :span="6">
  23. <el-input
  24. v-model="searchInfo"
  25. placeholder="输入工单编号"
  26. />
  27. </el-row>
  28. <el-button
  29. type="primary"
  30. :icon="Search"
  31. @click="handleSearch"
  32. >搜索
  33. </el-button>
  34. <el-button
  35. type="primary"
  36. :icon="Search"
  37. @click="isShowMrhjtj = true"
  38. >每日核检统计
  39. </el-button>
  40. <el-button
  41. type="primary"
  42. :icon="Search"
  43. @click="showGdzjfptj"
  44. >工单质检废品统计
  45. </el-button>
  46. <div style="margin-left: auto;">
  47. <el-button
  48. type="primary"
  49. :icon="Download"
  50. @click="exportExcel"
  51. >导出到Excel</el-button>
  52. </div>
  53. </div>
  54. <!-- 数据展示 -->
  55. <el-table
  56. ref="table"
  57. style="width: 100%"
  58. :data="tableData"
  59. row-key="ID"
  60. highlight-current-row
  61. border
  62. show-overflow-tooltip
  63. :row-style="{ height: '20px' }"
  64. :cell-style="{ padding: '0px' }"
  65. :header-row-style="{ height: '20px' }"
  66. :header-cell-style="{ padding: '0px' }"
  67. @row-click="handleSelectChange"
  68. @row-dblclick="doubleClick"
  69. >
  70. <el-table-column
  71. type="selection"
  72. width="55"
  73. />
  74. <!-- 循环渲染表格列 -->
  75. <el-table-column
  76. v-for="column in tableColumns"
  77. :key="column.prop"
  78. :prop="column.prop"
  79. :label="column.label"
  80. :width="column.width"
  81. />
  82. </el-table>
  83. <!-- 分页 -->
  84. <div class="gva-pagination">
  85. <el-pagination
  86. v-model:current-page="page"
  87. v-model:page-size="limit"
  88. layout="total, sizes, prev, pager, next, jumper"
  89. :page-sizes="[10, 30, 50, 100]"
  90. :total="total"
  91. @current-change="handleCurrentChange"
  92. @size-change="handleSizeChange"
  93. />
  94. </div>
  95. </div>
  96. <!-- 弹出框 -->
  97. <el-dialog
  98. v-model="dialogFormVisible"
  99. :before-close="closeDialog"
  100. :title="type === 'create' ? '添加' : '修改'"
  101. destroy-on-close
  102. width="70%"
  103. style="position: fixed; top: 35%; left: 50%; transform: translate(-50%, -50%);"
  104. >
  105. <el-form
  106. ref="elFormRef"
  107. :model="detailData"
  108. inline
  109. label-position="left"
  110. :rules="rule"
  111. >
  112. <el-form-item
  113. label="日期"
  114. >
  115. <el-date-picker
  116. v-model="detailData.qczl_rq"
  117. type="date"
  118. style="width: 150px;"
  119. />
  120. <!-- <el-input
  121. v-model="detailData.qczl_rq"
  122. style="width: 120px;"
  123. />-->
  124. </el-form-item>
  125. <el-form-item
  126. label="工单编号"
  127. >
  128. <el-input
  129. v-model="detailData.qczl_gdbh"
  130. style="width: 100px;"
  131. @keyup.enter="handleGdbhEnter"
  132. />
  133. </el-form-item>
  134. <el-form-item label="拼印主工单">
  135. <el-input
  136. v-model="detailData.qczl_Pygd"
  137. style="width: 100px;"
  138. />
  139. </el-form-item>
  140. <el-form-item
  141. label="产品名称"
  142. >
  143. <el-input
  144. v-model="detailData.Gd_cpmc"
  145. style="width: 400px;"
  146. readonly
  147. />
  148. </el-form-item>
  149. <br>
  150. <el-form-item
  151. label="印件号"
  152. >
  153. <el-input
  154. v-model="detailData.qczl_yjno"
  155. style="width: 60px;"
  156. />
  157. </el-form-item>
  158. <el-form-item
  159. label="印件名称"
  160. style="margin-left: 47px"
  161. >
  162. <el-input
  163. v-model="detailData.yj_yjmc"
  164. style="width: 500px;"
  165. readonly
  166. />
  167. </el-form-item>
  168. <el-form-item
  169. label="废品总数"
  170. >
  171. <el-input
  172. v-model="detailData.qczl_fp"
  173. style="width: 100px;"
  174. />
  175. </el-form-item>
  176. <br>
  177. <el-form-item
  178. label="工序"
  179. >
  180. <el-input
  181. v-model="detailData.qczl_gxmc"
  182. style="width: 200px;"
  183. />
  184. </el-form-item>
  185. <el-form-item
  186. label="工序号"
  187. >
  188. <el-input
  189. v-model="detailData.qczl_gxh"
  190. style="width: 100px;"
  191. readonly
  192. />
  193. </el-form-item>
  194. <el-form-item
  195. label="总流程号"
  196. >
  197. <el-input
  198. v-model="detailData.total_liucheng"
  199. style="width: 100px;"
  200. readonly
  201. />
  202. </el-form-item>
  203. <el-form-item
  204. label="流程单号"
  205. >
  206. <el-input
  207. v-model="detailData.qczl_num"
  208. style="width: 60px; margin-left: 5px;"
  209. />
  210. <el-input
  211. v-model="detailData.qczl_NumDesc1"
  212. style="width: 60px; margin-left: 5px;"
  213. />
  214. <el-input
  215. v-model="detailData.qczl_NumDesc2"
  216. style="width: 60px; margin-left: 5px;"
  217. />
  218. <el-input
  219. v-model="detailData.qczl_NumDesc3"
  220. style="width: 60px; margin-left: 5px;"
  221. />
  222. <el-input
  223. v-model="detailData.qczl_NumDesc4"
  224. style="width: 60px; margin-left: 5px;"
  225. />
  226. <el-input
  227. v-model="detailData.qczl_NumDesc5"
  228. style="width: 60px; margin-left: 5px;"
  229. />
  230. <el-input
  231. v-model="detailData.qczl_NumDesc6"
  232. style="width: 60px; margin-left: 5px;"
  233. />
  234. <el-input
  235. v-model="detailData.qczl_NumDesc7"
  236. style="width: 60px; margin-left: 5px;"
  237. />
  238. <el-input
  239. v-model="detailData.qczl_NumDesc8"
  240. style="width: 60px; margin-left: 5px;"
  241. />
  242. </el-form-item>
  243. <el-form-item
  244. label="备注"
  245. >
  246. <el-input
  247. v-model="detailData.qczl_NumDesc"
  248. style="width: 200px;"
  249. />
  250. </el-form-item>
  251. <el-scrollbar height="400px">
  252. <el-table
  253. :data="detailData.table"
  254. border
  255. tooltip-effect="dark"
  256. :row-style="{ height: '20px' }"
  257. :cell-style="{ padding: '0px' }"
  258. :header-row-style="{ height: '20px' }"
  259. :header-cell-style="{ padding: '0px' }"
  260. >
  261. <el-table-column
  262. label="废品类别"
  263. width="200"
  264. >
  265. <template #default="{ row, $index }">
  266. <el-input
  267. v-model="row.fp_lb"
  268. @keyup.enter="handleFplbEnter($index, row)"
  269. />
  270. </template>
  271. </el-table-column>
  272. <el-table-column
  273. label="数量"
  274. width="100"
  275. >
  276. <template #default="{ row, $index }">
  277. <el-input
  278. v-model="row.fp_sl"
  279. @keyup.enter="handleFpslEnter($index, row)"
  280. />
  281. </template>
  282. </el-table-column>
  283. <el-table-column
  284. label="工序及责任机长"
  285. width="500"
  286. >
  287. <template #default="{ row }">
  288. <el-input
  289. v-model="row.fp_gxmc"
  290. readonly
  291. />
  292. </template>
  293. </el-table-column>
  294. <el-table-column
  295. label=""
  296. width="100"
  297. >
  298. <template #default="{ row }">
  299. <el-input
  300. v-model="row.fp_bz"
  301. readonly
  302. />
  303. </template>
  304. </el-table-column>
  305. <el-table-column
  306. label=""
  307. width="100"
  308. >
  309. <template #default="{ row }">
  310. <el-input
  311. v-model="row.fp_bh"
  312. readonly
  313. />
  314. </template>
  315. </el-table-column>
  316. <el-table-column
  317. label=""
  318. width="100"
  319. >
  320. <template #default="{ row }">
  321. <el-input
  322. v-model="row.fp_name"
  323. readonly
  324. />
  325. </template>
  326. </el-table-column>
  327. </el-table>
  328. </el-scrollbar>
  329. </el-form>
  330. <template #footer>
  331. <div class="dialog-footer">
  332. <el-button @click="closeDialog">取 消</el-button>
  333. <el-button
  334. type="primary"
  335. @click="enterDialog"
  336. >确 定
  337. </el-button>
  338. </div>
  339. </template>
  340. </el-dialog>
  341. <!-- 废品类别弹出选项框 -->
  342. <el-dialog
  343. v-model="dialogSelectVisible1"
  344. title="选择"
  345. destroy-on-close
  346. width="600px"
  347. >
  348. <el-tree
  349. :data="selecTreeData"
  350. :props="defaultProps"
  351. highlight-current
  352. @node-click="handleFplbClick"
  353. />
  354. </el-dialog>
  355. <!-- 弹出选项框 数量 -->
  356. <el-dialog
  357. v-model="dialogSelectVisible2"
  358. title="选择"
  359. destroy-on-close
  360. width="800px"
  361. >
  362. <el-table
  363. tooltip-effect="dark"
  364. :data="selectData"
  365. row-key="ID"
  366. highlight-current-row
  367. border
  368. style="width:100%"
  369. @row-dblclick="handleSelectClick"
  370. >
  371. <el-table-column
  372. v-for=" column in selectColumns "
  373. :key="column.prop"
  374. :prop="column.prop"
  375. :label="column.label"
  376. :width="column.width"
  377. />
  378. </el-table>
  379. </el-dialog>
  380. <!-- 核验废品日统计弹出框 -->
  381. <Meirihejiantongji
  382. :is-show="isShowMrhjtj"
  383. @my-close="isShowMrhjtj = false"
  384. />
  385. <!-- 工单质检废品统计 -->
  386. <Gongdanzhijianfeipintongji
  387. :is-show="isShowGdzjfptj"
  388. :val="value1"
  389. @my-close="isShowGdzjfptj =false"
  390. />
  391. </el-main>
  392. </el-container>
  393. </el-container>
  394. </div>
  395. </template>
  396. <script setup>
  397. import {
  398. createCompany,
  399. deleteCompany,
  400. deleteCompanyByIds,
  401. updateCompany,
  402. findCompany,
  403. getCompanyList
  404. } from '@/api/company'
  405. // 全量引入格式化工具 请按需保留
  406. import { ElMessage } from 'element-plus'
  407. import { Search, Refresh, Download } from '@element-plus/icons-vue'
  408. import { ref, reactive } from 'vue'
  409. import { getSide, getTable, getOneWorkOrder, getOrderInfo, getGxAndLeader, getWastInfo, updateData } from '@/api/mes_api_gty/workOrderVerification'
  410. import Meirihejiantongji from './meirihejiantongji.vue'
  411. import Gongdanzhijianfeipintongji from './gongdanzhijianfeipintongji.vue'
  412. defineOptions({
  413. name: '06PackingDocuments'
  414. })
  415. // 侧边栏数据请求
  416. const treeData = reactive([])
  417. const getSideData = async() => {
  418. const response = await getSide()
  419. if (response.code === 0) {
  420. const transformedData = response.data.map(item => ({
  421. label: `${item.date.replace(/-/g, '.')}【单据数: ${item.counts}张】`,
  422. children: item.sys.map(sysItem => ({
  423. label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
  424. params: {
  425. date: item.date.replace(/\./g, '-'),
  426. sys_id: sysItem.sys_id,
  427. },
  428. })),
  429. }))
  430. treeData.splice(0, treeData.length, ...transformedData)
  431. }
  432. }
  433. getSideData()
  434. // 验证规则
  435. const rule = reactive({
  436. })
  437. const elFormRef = ref()
  438. const elSearchFormRef = ref()
  439. // =========== 表格控制部分 ===========
  440. const tableColumns = [
  441. { label: '工单编号', prop: 'qczl_gdbh', width: '100' },
  442. { label: '印件号', prop: 'qczl_yjno', width: '100' },
  443. { label: '印件名称', prop: 'Gd_cpmc', width: '400' },
  444. { label: '日期', prop: 'qczl_rq', width: '100' },
  445. { label: '流程单号', prop: 'qczl_num', width: '100' },
  446. { label: '流程单备注', prop: 'qczl_NumDesc', width: '100' },
  447. { label: '总废品', prop: 'qczl_fp', width: '100' },
  448. { label: '废品1', prop: 'sl_lb1', width: '250' },
  449. { label: '废品2', prop: 'sl_lb2', width: '250' },
  450. { label: '废品3', prop: 'sl_lb3', width: '250' },
  451. { label: '废品4', prop: 'sl_lb4', width: '250' },
  452. { label: '废品5', prop: 'sl_lb5', width: '250' },
  453. { label: '废品6', prop: 'sl_lb6', width: '250' },
  454. { label: '废品7', prop: 'sl_lb7', width: '250' },
  455. { label: '废品8', prop: 'sl_lb8', width: '250' },
  456. { label: '废品9', prop: 'sl_lb9', width: '250' },
  457. { label: '废品10', prop: 'sl_lb10', width: '250' },
  458. { label: '废品11', prop: 'sl_lb11', width: '250' },
  459. { label: '废品12', prop: 'sl_lb12', width: '250' },
  460. { label: '废品13', prop: 'sl_lb13', width: '250' },
  461. { label: '废品14', prop: 'sl_lb14', width: '250' },
  462. { label: '废品15', prop: 'sl_lb15', width: '250' },
  463. { label: '废品16', prop: 'sl_lb16', width: '250' },
  464. { label: '废品17', prop: 'sl_lb17', width: '250' },
  465. { label: '创建用户', prop: 'sys_id', width: '200' }
  466. ]
  467. const tableData = reactive([])
  468. const total = ref(0)
  469. const page = ref(1)
  470. const limit = ref(10)
  471. const searchInfo = ref('')
  472. const params = {
  473. date: '',
  474. sys_id: '',
  475. order: '',
  476. page: page.value.toString(),
  477. limit: limit.value.toString(),
  478. }
  479. // 批量删除控制标记
  480. const deleteVisible = ref(false)
  481. const multipleSelection = ref([])
  482. const getTableData = async() => {
  483. const response = await getTable(params)
  484. if (response.code === 0) {
  485. total.value = response.data.total
  486. // Object.assign(tableData, response.data.rows)
  487. tableData.splice(0, tableData.length, ...response.data.rows)
  488. }
  489. }
  490. // 左侧树结构点击
  491. const handleNodeClick = (node, check) => {
  492. if (node.params) {
  493. params.date = node.params.date
  494. params.sys_id = node.params.sys_id
  495. page.value = 1
  496. handleCurrentChange()
  497. }
  498. }
  499. // 搜索
  500. function handleSearch() {
  501. params.sys_id = ''
  502. params.date = ''
  503. params.order = searchInfo.value
  504. page.value = 1
  505. handleCurrentChange()
  506. }
  507. // 分页
  508. const handleSizeChange = () => {
  509. params.limit = limit.value.toString()
  510. getTableData()
  511. }
  512. // 页面跳转
  513. const handleCurrentChange = () => {
  514. params.page = page.value.toString()
  515. getTableData()
  516. }
  517. // ============== 详情页面 ==============
  518. const detailData = reactive({})
  519. const selectData = reactive([])
  520. const selectColumns = [
  521. { label: '', prop: 'sczl_gxmc', width: '600' },
  522. { label: '', prop: 'sczl_bzdh', width: '100' },
  523. { label: '', prop: 'name', width: '100' },
  524. ]
  525. let selecTreeData = []
  526. // 行为控制标记(弹窗内部需要增还是改)
  527. const type = ref('')
  528. // 弹窗控制标记
  529. const dialogFormVisible = ref(false)
  530. const dialogSelectVisible1 = ref(false)
  531. const dialogSelectVisible2 = ref(false)
  532. let selectIndex = 0
  533. const getDetailData = async(id) => {
  534. try {
  535. const res = await getOneWorkOrder({ UniqId: id })
  536. if (res.code === 0) {
  537. const obj = res.data
  538. // 裁剪返回数据的前后空格
  539. for (const key in obj) {
  540. if (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === 'string') {
  541. obj[key] = obj[key].trim()
  542. }
  543. }
  544. // 修改日期格式
  545. if (Object.prototype.hasOwnProperty.call(obj, 'qczl_rq') && typeof obj['qczl_rq'] === 'string') {
  546. obj['qczl_rq'] = obj['qczl_rq'].split(' ')[0]
  547. }
  548. Object.assign(detailData, obj)
  549. const table = []
  550. // 循环13行数据
  551. for (let i = 1; i <= 13; i++) {
  552. table.push({
  553. fp_lb: detailData[`fp_lb${i}`] || '',
  554. fp_sl: detailData[`fp_sl${i}`] || '',
  555. fp_gxmc: detailData[`fp_gxmc${i}`] || '',
  556. fp_bz: detailData[`fp_bz${i}`] || '',
  557. fp_bh: detailData[`fp_bh${i}`] || '',
  558. fp_name: detailData[`fp_name${i}`] || '',
  559. })
  560. // 从原对象中删除这些属性
  561. delete detailData[`fp_lb${i}`]
  562. delete detailData[`fp_sl${i}`]
  563. delete detailData[`fp_gxmc${i}`]
  564. delete detailData[`fp_bz${i}`]
  565. delete detailData[`fp_bh${i}`]
  566. delete detailData[`fp_name${i}`]
  567. }
  568. detailData.table = table
  569. try {
  570. const res = await getOrderInfo({ order: detailData.qczl_gdbh })
  571. if (res.code === 0) {
  572. detailData.Gd_cpmc = res.data.Gd_cpmc
  573. dialogFormVisible.value = true
  574. }
  575. } catch (e) {
  576. console.log(e)
  577. }
  578. }
  579. } catch (e) {
  580. console.log(e)
  581. }
  582. }
  583. // 工单编号回车
  584. const handleGdbhEnter = async() => {
  585. const res = await getOrderInfo({ order: detailData.qczl_gdbh })
  586. if (res.code === 0) {
  587. const { Gd_cpmc, yj_Yjno, yj_yjmc } = res.data
  588. detailData.Gd_cpmc = Gd_cpmc
  589. detailData.qczl_yjno = yj_Yjno
  590. detailData.yj_yjmc = yj_yjmc
  591. }
  592. }
  593. // 废品类别回车
  594. const handleFplbEnter = async(index, row) => {
  595. let res
  596. try {
  597. res = await getWastInfo({ search: row.fp_lb })
  598. if (res.code !== 0) {
  599. return
  600. }
  601. } catch (e) {
  602. console.log(e)
  603. return
  604. }
  605. const obj = res.data
  606. const treeData = []
  607. for (const category in obj) {
  608. if (Object.prototype.hasOwnProperty.call(obj, category)) {
  609. const children = []
  610. for (const subCategory in obj[category]) {
  611. if (Object.prototype.hasOwnProperty.call(obj[category], subCategory)) {
  612. const subChildren = obj[category][subCategory].map(item => {
  613. return { label: item }
  614. })
  615. children.push({
  616. label: subCategory,
  617. children: subChildren
  618. })
  619. }
  620. }
  621. treeData.push({
  622. label: category,
  623. children: children
  624. })
  625. }
  626. }
  627. selecTreeData = treeData
  628. selectIndex = index
  629. dialogSelectVisible1.value = true
  630. }
  631. const handleFplbClick = (node, check) => {
  632. if (!node.children) {
  633. detailData.table[selectIndex].fp_lb = node.label
  634. dialogSelectVisible1.value = false
  635. }
  636. }
  637. // 废品数量回车
  638. const handleFpslEnter = async(index, row) => {
  639. if (row.fp_sl === '0') {
  640. detailData.table[index].fp_gxmc = ''
  641. detailData.table[index].fp_bz = ''
  642. detailData.table[index].fp_bh = ''
  643. detailData.table[index].fp_name = ''
  644. return
  645. }
  646. const params = {
  647. type: row.fp_lb,
  648. order: detailData.qczl_gdbh,
  649. }
  650. let res
  651. try {
  652. res = await getGxAndLeader(params)
  653. if (res.code !== 0) {
  654. return
  655. }
  656. } catch (e) {
  657. console.log(e)
  658. return
  659. }
  660. selectIndex = index
  661. Object.assign(selectData, res.data)
  662. dialogSelectVisible2.value = true
  663. }
  664. // 双击表格操作
  665. function doubleClick(row, column, event) {
  666. type.value = 'update'
  667. getDetailData(row.UniqId)
  668. }
  669. // 处理选择框回车操作
  670. const handleSelectClick = (row, column, event) => {
  671. const { sczl_gxmc, sczl_bzdh, sczl_bh1, name } = row
  672. const index = selectIndex
  673. detailData.table[index].fp_gxmc = sczl_gxmc
  674. detailData.table[index].fp_bz = sczl_bzdh
  675. detailData.table[index].fp_bh = sczl_bh1
  676. detailData.table[index].fp_name = name
  677. dialogSelectVisible2.value = false
  678. }
  679. // 弹窗确定
  680. const enterDialog = async() => {
  681. const restoredData = {
  682. UniqId: detailData.UniqId,
  683. qczl_gdbh: detailData.qczl_gdbh,
  684. qczl_yjno: detailData.qczl_yjno,
  685. qczl_gxh: detailData.qczl_gxh,
  686. qczl_gxmc: detailData.qczl_gxmc,
  687. qczl_rq: detailData.qczl_rq,
  688. qczl_fp: detailData.qczl_fp,
  689. qczl_num: detailData.qczl_num,
  690. qczl_NumDesc: detailData.qczl_NumDesc,
  691. qczl_NumDesc1: detailData.qczl_NumDesc1,
  692. qczl_NumDesc2: detailData.qczl_NumDesc2,
  693. qczl_NumDesc3: detailData.qczl_NumDesc3,
  694. qczl_NumDesc4: detailData.qczl_NumDesc4,
  695. qczl_NumDesc5: detailData.qczl_NumDesc5,
  696. qczl_NumDesc6: detailData.qczl_NumDesc6,
  697. qczl_NumDesc7: detailData.qczl_NumDesc7,
  698. qczl_NumDesc8: detailData.qczl_NumDesc8,
  699. }
  700. detailData.table.forEach((item, index) => {
  701. const num = index + 1
  702. restoredData[`fp_lb${num}`] = item.fp_lb
  703. restoredData[`fp_sl${num}`] = item.fp_sl
  704. restoredData[`fp_bh${num}`] = item.fp_bh
  705. restoredData[`fp_bz${num}`] = item.fp_bz
  706. restoredData[`fp_gxmc${num}`] = item.fp_gxmc
  707. })
  708. const res = await updateData(restoredData)
  709. if (res.code === 0) {
  710. ElMessage({
  711. type: 'success',
  712. message: res.msg,
  713. })
  714. dialogFormVisible.value = false
  715. }
  716. }
  717. // 多选
  718. const handleSelectionChange = (val) => {
  719. multipleSelection.value = val
  720. }
  721. // 多选删除
  722. const onDelete = async() => {
  723. const ids = []
  724. if (multipleSelection.value.length === 0) {
  725. ElMessage({
  726. type: 'warning',
  727. message: '请选择要删除的数据'
  728. })
  729. return
  730. }
  731. multipleSelection.value &&
  732. multipleSelection.value.map(item => {
  733. ids.push(item.ID)
  734. })
  735. const res = await deleteCompanyByIds({ ids })
  736. if (res.code === 0) {
  737. ElMessage({
  738. type: 'success',
  739. message: '删除成功'
  740. })
  741. if (tableData.value.length === ids.length && page.value > 1) {
  742. page.value--
  743. }
  744. deleteVisible.value = false
  745. getTableData()
  746. }
  747. }
  748. // 更新行
  749. const updateCompanyFunc = async(row) => {
  750. const res = await findCompany({ ID: row.ID })
  751. type.value = 'update'
  752. if (res.code === 0) {
  753. formData.value = res.data.recompany
  754. dialogFormVisible.value = true
  755. }
  756. }
  757. // 关闭弹窗
  758. const closeDialog = () => {
  759. dialogFormVisible.value = false
  760. }
  761. // 导出excel
  762. function exportExcel() {
  763. console.log('导出到excel')
  764. }
  765. const isShowMrhjtj = ref(false)
  766. const isShowGdzjfptj = ref(false)
  767. const value1 = ref('')
  768. const table = ref(null)
  769. const currentRow = ref()
  770. const showGdzjfptj = () => {
  771. value1.value = currentRow.value?.qczl_gdbh
  772. isShowGdzjfptj.value = true
  773. }
  774. const handleSelectChange = (row, column, event) => {
  775. currentRow.value = row
  776. }
  777. </script>
  778. <style scoped>
  779. .JKWTree-container {
  780. display: flex;
  781. }
  782. .JKWTree-tree {
  783. width: 300px;
  784. background-color: #fff;
  785. padding: 10px;
  786. margin-right: 20px;
  787. }
  788. .JKWTree-tree h3 {
  789. font-size: 15px;
  790. font-weight: 700;
  791. margin: 10px 0;
  792. }
  793. .JKWTree-content {
  794. flex: 1;
  795. }
  796. /* 选中某行时的背景色 */
  797. :deep(.el-table__body tr.current-row) > td {
  798. background: #ff80ff !important;
  799. }
  800. </style>