index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880
  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="dialogMrhjtj = 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. v-if="dialogMrhjtj"
  383. v-model="dialogMrhjtj"
  384. />
  385. <!-- 工单质检废品统计 -->
  386. <Gongdanzhijianfeipintongji
  387. v-if="dialogGdzjfptj"
  388. v-model="dialogGdzjfptj"
  389. :val="value1"
  390. />
  391. <!-- 测试图表 -->
  392. <Shebeizhuangtai
  393. v-if="dialogSbyxgl"
  394. v-model="dialogSbyxgl"
  395. title="【01.30 08:30】【JY01#--海德堡对开八色平版胶印机(JY08-01)】【2311116-->钻石(荷花)盒包装纸】【01--胶印】"
  396. />
  397. </el-main>
  398. </el-container>
  399. </el-container>
  400. </div>
  401. </template>
  402. <script setup>
  403. import {
  404. createCompany,
  405. deleteCompany,
  406. deleteCompanyByIds,
  407. updateCompany,
  408. findCompany,
  409. getCompanyList
  410. } from '@/api/company'
  411. // 全量引入格式化工具 请按需保留
  412. import { ElMessage } from 'element-plus'
  413. import { Search, Refresh, Download } from '@element-plus/icons-vue'
  414. import { ref, reactive } from 'vue'
  415. import { getSide, getTable, getOneWorkOrder, getOrderInfo, getGxAndLeader, getWastInfo, updateData } from '@/api/mes_api_gty/workOrderVerification'
  416. import Meirihejiantongji from './componets/meirihejiantongji.vue'
  417. import Gongdanzhijianfeipintongji from './componets/gongdanzhijianfeipintongji.vue'
  418. import Shebeizhuangtai from '@/view/performance/09-workOrderVerification/componets/shebeizhuangtai.vue'
  419. defineOptions({
  420. name: '06PackingDocuments'
  421. })
  422. // 侧边栏数据请求
  423. const treeData = reactive([])
  424. const getSideData = async() => {
  425. const response = await getSide()
  426. if (response.code === 0) {
  427. const transformedData = response.data.map(item => ({
  428. label: `${item.date.replace(/-/g, '.')}【单据数: ${item.counts}张】`,
  429. children: item.sys.map(sysItem => ({
  430. label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
  431. params: {
  432. date: item.date.replace(/\./g, '-'),
  433. sys_id: sysItem.sys_id,
  434. },
  435. })),
  436. }))
  437. treeData.splice(0, treeData.length, ...transformedData)
  438. }
  439. }
  440. getSideData()
  441. // 验证规则
  442. const rule = reactive({
  443. })
  444. const elFormRef = ref()
  445. const elSearchFormRef = ref()
  446. // =========== 表格控制部分 ===========
  447. const tableColumns = [
  448. { label: '工单编号', prop: 'qczl_gdbh', width: '100' },
  449. { label: '印件号', prop: 'qczl_yjno', width: '100' },
  450. { label: '印件名称', prop: 'Gd_cpmc', width: '400' },
  451. { label: '日期', prop: 'qczl_rq', width: '100' },
  452. { label: '流程单号', prop: 'qczl_num', width: '100' },
  453. { label: '流程单备注', prop: 'qczl_NumDesc', width: '100' },
  454. { label: '总废品', prop: 'qczl_fp', width: '100' },
  455. { label: '废品1', prop: 'sl_lb1', width: '250' },
  456. { label: '废品2', prop: 'sl_lb2', width: '250' },
  457. { label: '废品3', prop: 'sl_lb3', width: '250' },
  458. { label: '废品4', prop: 'sl_lb4', width: '250' },
  459. { label: '废品5', prop: 'sl_lb5', width: '250' },
  460. { label: '废品6', prop: 'sl_lb6', width: '250' },
  461. { label: '废品7', prop: 'sl_lb7', width: '250' },
  462. { label: '废品8', prop: 'sl_lb8', width: '250' },
  463. { label: '废品9', prop: 'sl_lb9', width: '250' },
  464. { label: '废品10', prop: 'sl_lb10', width: '250' },
  465. { label: '废品11', prop: 'sl_lb11', width: '250' },
  466. { label: '废品12', prop: 'sl_lb12', width: '250' },
  467. { label: '废品13', prop: 'sl_lb13', width: '250' },
  468. { label: '废品14', prop: 'sl_lb14', width: '250' },
  469. { label: '废品15', prop: 'sl_lb15', width: '250' },
  470. { label: '废品16', prop: 'sl_lb16', width: '250' },
  471. { label: '废品17', prop: 'sl_lb17', width: '250' },
  472. { label: '创建用户', prop: 'sys_id', width: '200' }
  473. ]
  474. const tableData = reactive([])
  475. const total = ref(0)
  476. const page = ref(1)
  477. const limit = ref(10)
  478. const searchInfo = ref('')
  479. const params = {
  480. date: '',
  481. sys_id: '',
  482. order: '',
  483. page: page.value.toString(),
  484. limit: limit.value.toString(),
  485. }
  486. // 批量删除控制标记
  487. const deleteVisible = ref(false)
  488. const multipleSelection = ref([])
  489. const getTableData = async() => {
  490. const response = await getTable(params)
  491. if (response.code === 0) {
  492. total.value = response.data.total
  493. // Object.assign(tableData, response.data.rows)
  494. tableData.splice(0, tableData.length, ...response.data.rows)
  495. }
  496. }
  497. // 左侧树结构点击
  498. const handleNodeClick = (node, check) => {
  499. if (node.params) {
  500. params.date = node.params.date
  501. params.sys_id = node.params.sys_id
  502. page.value = 1
  503. handleCurrentChange()
  504. }
  505. }
  506. // 搜索
  507. function handleSearch() {
  508. params.sys_id = ''
  509. params.date = ''
  510. params.order = searchInfo.value
  511. page.value = 1
  512. handleCurrentChange()
  513. }
  514. // 分页
  515. const handleSizeChange = () => {
  516. params.limit = limit.value.toString()
  517. getTableData()
  518. }
  519. // 页面跳转
  520. const handleCurrentChange = () => {
  521. params.page = page.value.toString()
  522. getTableData()
  523. }
  524. // ============== 详情页面 ==============
  525. const detailData = reactive({})
  526. const selectData = reactive([])
  527. const selectColumns = [
  528. { label: '', prop: 'sczl_gxmc', width: '600' },
  529. { label: '', prop: 'sczl_bzdh', width: '100' },
  530. { label: '', prop: 'name', width: '100' },
  531. ]
  532. let selecTreeData = []
  533. // 行为控制标记(弹窗内部需要增还是改)
  534. const type = ref('')
  535. // 弹窗控制标记
  536. const dialogFormVisible = ref(false)
  537. const dialogSelectVisible1 = ref(false)
  538. const dialogSelectVisible2 = ref(false)
  539. let selectIndex = 0
  540. const getDetailData = async(id) => {
  541. try {
  542. const res = await getOneWorkOrder({ UniqId: id })
  543. if (res.code === 0) {
  544. const obj = res.data
  545. // 裁剪返回数据的前后空格
  546. for (const key in obj) {
  547. if (Object.prototype.hasOwnProperty.call(obj, key) && typeof obj[key] === 'string') {
  548. obj[key] = obj[key].trim()
  549. }
  550. }
  551. // 修改日期格式
  552. if (Object.prototype.hasOwnProperty.call(obj, 'qczl_rq') && typeof obj['qczl_rq'] === 'string') {
  553. obj['qczl_rq'] = obj['qczl_rq'].split(' ')[0]
  554. }
  555. Object.assign(detailData, obj)
  556. const table = []
  557. // 循环13行数据
  558. for (let i = 1; i <= 13; i++) {
  559. table.push({
  560. fp_lb: detailData[`fp_lb${i}`] || '',
  561. fp_sl: detailData[`fp_sl${i}`] || '',
  562. fp_gxmc: detailData[`fp_gxmc${i}`] || '',
  563. fp_bz: detailData[`fp_bz${i}`] || '',
  564. fp_bh: detailData[`fp_bh${i}`] || '',
  565. fp_name: detailData[`fp_name${i}`] || '',
  566. })
  567. // 从原对象中删除这些属性
  568. delete detailData[`fp_lb${i}`]
  569. delete detailData[`fp_sl${i}`]
  570. delete detailData[`fp_gxmc${i}`]
  571. delete detailData[`fp_bz${i}`]
  572. delete detailData[`fp_bh${i}`]
  573. delete detailData[`fp_name${i}`]
  574. }
  575. detailData.table = table
  576. try {
  577. const res = await getOrderInfo({ order: detailData.qczl_gdbh })
  578. if (res.code === 0) {
  579. detailData.Gd_cpmc = res.data.Gd_cpmc
  580. dialogFormVisible.value = true
  581. }
  582. } catch (e) {
  583. console.log(e)
  584. }
  585. }
  586. } catch (e) {
  587. console.log(e)
  588. }
  589. }
  590. // 工单编号回车
  591. const handleGdbhEnter = async() => {
  592. const res = await getOrderInfo({ order: detailData.qczl_gdbh })
  593. if (res.code === 0) {
  594. const { Gd_cpmc, yj_Yjno, yj_yjmc } = res.data
  595. detailData.Gd_cpmc = Gd_cpmc
  596. detailData.qczl_yjno = yj_Yjno
  597. detailData.yj_yjmc = yj_yjmc
  598. }
  599. }
  600. // 废品类别回车
  601. const handleFplbEnter = async(index, row) => {
  602. let res
  603. try {
  604. res = await getWastInfo({ search: row.fp_lb })
  605. if (res.code !== 0) {
  606. return
  607. }
  608. } catch (e) {
  609. console.log(e)
  610. return
  611. }
  612. const obj = res.data
  613. const treeData = []
  614. for (const category in obj) {
  615. if (Object.prototype.hasOwnProperty.call(obj, category)) {
  616. const children = []
  617. for (const subCategory in obj[category]) {
  618. if (Object.prototype.hasOwnProperty.call(obj[category], subCategory)) {
  619. const subChildren = obj[category][subCategory].map(item => {
  620. return { label: item }
  621. })
  622. children.push({
  623. label: subCategory,
  624. children: subChildren
  625. })
  626. }
  627. }
  628. treeData.push({
  629. label: category,
  630. children: children
  631. })
  632. }
  633. }
  634. selecTreeData = treeData
  635. selectIndex = index
  636. dialogSelectVisible1.value = true
  637. }
  638. const handleFplbClick = (node, check) => {
  639. if (!node.children) {
  640. detailData.table[selectIndex].fp_lb = node.label
  641. dialogSelectVisible1.value = false
  642. }
  643. }
  644. // 废品数量回车
  645. const handleFpslEnter = async(index, row) => {
  646. if (row.fp_sl === '0') {
  647. detailData.table[index].fp_gxmc = ''
  648. detailData.table[index].fp_bz = ''
  649. detailData.table[index].fp_bh = ''
  650. detailData.table[index].fp_name = ''
  651. return
  652. }
  653. const params = {
  654. type: row.fp_lb,
  655. order: detailData.qczl_gdbh,
  656. }
  657. let res
  658. try {
  659. res = await getGxAndLeader(params)
  660. if (res.code !== 0) {
  661. return
  662. }
  663. } catch (e) {
  664. console.log(e)
  665. return
  666. }
  667. selectIndex = index
  668. Object.assign(selectData, res.data)
  669. dialogSelectVisible2.value = true
  670. }
  671. // 双击表格操作
  672. function doubleClick(row, column, event) {
  673. type.value = 'update'
  674. getDetailData(row.UniqId)
  675. }
  676. // 处理选择框回车操作
  677. const handleSelectClick = (row, column, event) => {
  678. const { sczl_gxmc, sczl_bzdh, sczl_bh1, name } = row
  679. const index = selectIndex
  680. detailData.table[index].fp_gxmc = sczl_gxmc
  681. detailData.table[index].fp_bz = sczl_bzdh
  682. detailData.table[index].fp_bh = sczl_bh1
  683. detailData.table[index].fp_name = name
  684. dialogSelectVisible2.value = false
  685. }
  686. // 弹窗确定
  687. const enterDialog = async() => {
  688. const restoredData = {
  689. UniqId: detailData.UniqId,
  690. qczl_gdbh: detailData.qczl_gdbh,
  691. qczl_yjno: detailData.qczl_yjno,
  692. qczl_gxh: detailData.qczl_gxh,
  693. qczl_gxmc: detailData.qczl_gxmc,
  694. qczl_rq: detailData.qczl_rq,
  695. qczl_fp: detailData.qczl_fp,
  696. qczl_num: detailData.qczl_num,
  697. qczl_NumDesc: detailData.qczl_NumDesc,
  698. qczl_NumDesc1: detailData.qczl_NumDesc1,
  699. qczl_NumDesc2: detailData.qczl_NumDesc2,
  700. qczl_NumDesc3: detailData.qczl_NumDesc3,
  701. qczl_NumDesc4: detailData.qczl_NumDesc4,
  702. qczl_NumDesc5: detailData.qczl_NumDesc5,
  703. qczl_NumDesc6: detailData.qczl_NumDesc6,
  704. qczl_NumDesc7: detailData.qczl_NumDesc7,
  705. qczl_NumDesc8: detailData.qczl_NumDesc8,
  706. }
  707. detailData.table.forEach((item, index) => {
  708. const num = index + 1
  709. restoredData[`fp_lb${num}`] = item.fp_lb
  710. restoredData[`fp_sl${num}`] = item.fp_sl
  711. restoredData[`fp_bh${num}`] = item.fp_bh
  712. restoredData[`fp_bz${num}`] = item.fp_bz
  713. restoredData[`fp_gxmc${num}`] = item.fp_gxmc
  714. })
  715. const res = await updateData(restoredData)
  716. if (res.code === 0) {
  717. ElMessage({
  718. type: 'success',
  719. message: res.msg,
  720. })
  721. dialogFormVisible.value = false
  722. }
  723. }
  724. // 多选
  725. const handleSelectionChange = (val) => {
  726. multipleSelection.value = val
  727. }
  728. // 多选删除
  729. const onDelete = async() => {
  730. const ids = []
  731. if (multipleSelection.value.length === 0) {
  732. ElMessage({
  733. type: 'warning',
  734. message: '请选择要删除的数据'
  735. })
  736. return
  737. }
  738. multipleSelection.value &&
  739. multipleSelection.value.map(item => {
  740. ids.push(item.ID)
  741. })
  742. const res = await deleteCompanyByIds({ ids })
  743. if (res.code === 0) {
  744. ElMessage({
  745. type: 'success',
  746. message: '删除成功'
  747. })
  748. if (tableData.value.length === ids.length && page.value > 1) {
  749. page.value--
  750. }
  751. deleteVisible.value = false
  752. getTableData()
  753. }
  754. }
  755. // 更新行
  756. const updateCompanyFunc = async(row) => {
  757. const res = await findCompany({ ID: row.ID })
  758. type.value = 'update'
  759. if (res.code === 0) {
  760. formData.value = res.data.recompany
  761. dialogFormVisible.value = true
  762. }
  763. }
  764. // 关闭弹窗
  765. const closeDialog = () => {
  766. dialogFormVisible.value = false
  767. }
  768. // 导出excel
  769. function exportExcel() {
  770. console.log('导出到excel')
  771. dialogSbyxgl.value = true
  772. }
  773. const dialogMrhjtj = ref(false)
  774. const dialogGdzjfptj = ref(false)
  775. const dialogSbyxgl = ref(false)
  776. const value1 = ref('')
  777. const table = ref(null)
  778. const currentRow = ref()
  779. const showGdzjfptj = () => {
  780. value1.value = currentRow.value?.qczl_gdbh
  781. dialogGdzjfptj.value = true
  782. }
  783. const handleSelectChange = (row, column, event) => {
  784. currentRow.value = row
  785. }
  786. </script>
  787. <style scoped>
  788. .JKWTree-container {
  789. display: flex;
  790. }
  791. .JKWTree-tree {
  792. width: 300px;
  793. background-color: #fff;
  794. padding: 10px;
  795. margin-right: 20px;
  796. }
  797. .JKWTree-tree h3 {
  798. font-size: 15px;
  799. font-weight: 700;
  800. margin: 10px 0;
  801. }
  802. .JKWTree-content {
  803. flex: 1;
  804. }
  805. /* 选中某行时的背景色 */
  806. :deep(.el-table__body tr.current-row) > td {
  807. background: #ff80ff !important;
  808. }
  809. </style>