index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-header>
  5. <div class="">
  6. <!--按钮部分-->
  7. <el-form
  8. ref="elSearchFormRef"
  9. inline
  10. class="demo-form-inline"
  11. @submit.native.prevent
  12. >
  13. <el-form-item>
  14. <el-input
  15. v-model="searchInfo"
  16. placeholder="搜索产品编号或产品名称"
  17. clearable
  18. style="width: 180px"
  19. />
  20. <el-button
  21. type="primary"
  22. icon="search"
  23. class="search"
  24. @click="handleSearch"
  25. />
  26. <el-button
  27. type="primary"
  28. icon="edit"
  29. class="bt"
  30. @click="
  31. () => {
  32. dialogDetail = true;
  33. }
  34. "
  35. ><i class="el-icon-edit" />查改
  36. </el-button>
  37. <!-- <el-button type="primary" disabled icon="edit" @click="" style="margin-left: 10px">工艺方案复制</el-button>-->
  38. <el-button
  39. type="primary"
  40. icon="edit"
  41. class="bt"
  42. @click="
  43. () => {
  44. dialogGdcjstj = true;
  45. }
  46. "
  47. >工单超节损统计
  48. </el-button>
  49. <el-button
  50. type="primary"
  51. icon="edit"
  52. class="bt"
  53. @click="
  54. () => {
  55. dialogKhsz = true;
  56. }
  57. "
  58. >考核设置
  59. </el-button>
  60. <el-button
  61. type="primary"
  62. icon="edit"
  63. class="bt"
  64. @click="
  65. () => {
  66. dialogXzgdtl = true;
  67. }
  68. "
  69. >修正工单投料
  70. </el-button>
  71. <el-button
  72. type="primary"
  73. icon="edit"
  74. class="bt"
  75. @click="
  76. () => {
  77. dialogGxclhc = true;
  78. }
  79. "
  80. >工序产量核查
  81. </el-button>
  82. <el-button
  83. type="primary"
  84. icon="edit"
  85. class="bt"
  86. @click="
  87. () => {
  88. dialogGdzjfptj = true;
  89. }
  90. "
  91. >工单质检废品统计
  92. </el-button>
  93. <el-button
  94. type="primary"
  95. icon="edit"
  96. class="bt"
  97. @click="
  98. () => {
  99. dialogHjfpfb = true;
  100. }
  101. "
  102. >核检废品分布
  103. </el-button>
  104. <el-button
  105. type="primary"
  106. icon="edit"
  107. class="bt"
  108. @click="handleGddy"
  109. >工单打印
  110. </el-button>
  111. <el-button
  112. type="primary"
  113. icon="edit"
  114. class="bt"
  115. @click="
  116. () => {
  117. pd_lcdlist = true;
  118. pd_lcdProductValue();
  119. }
  120. "
  121. >流程单查询
  122. </el-button>
  123. <el-button
  124. type="primary"
  125. icon="edit"
  126. class="bt"
  127. @click="exportExcel"
  128. >导出Excel
  129. </el-button>
  130. </el-form-item>
  131. </el-form>
  132. <!-- 弹窗 -->
  133. <div>
  134. <!-- 查改 -->
  135. <Detail
  136. v-if="dialogDetail"
  137. :is-show="dialogDetail"
  138. :gdbh="gdbh"
  139. @destroy="
  140. () => {
  141. dialogDetail = false;
  142. }
  143. "
  144. />
  145. <!-- 工单超节损统计 -->
  146. <el-dialog
  147. v-model="dialogGdcjstj"
  148. title="工单超节损统计"
  149. destroy-on-close
  150. >
  151. <Gdcjstj :gdbh="gdbh" />
  152. </el-dialog>
  153. <!-- 修正工单印件质量考核设置 -->
  154. <Khsz
  155. v-if="dialogKhsz"
  156. v-model="dialogKhsz"
  157. :gdbh="gdbh"
  158. />
  159. <!-- 修正工单投料 -->
  160. <Xzgdtl
  161. v-if="dialogXzgdtl"
  162. v-model="dialogXzgdtl"
  163. :date="date"
  164. />
  165. <!-- 工序产量核查 -->
  166. <Gxclhc
  167. v-if="dialogGxclhc"
  168. v-model="dialogGxclhc"
  169. :gdbh="gdbh"
  170. />
  171. <!-- 工单质检废品统计 -->
  172. <Gongdanzhijianfeipintongji
  173. v-if="dialogGdzjfptj"
  174. v-model="dialogGdzjfptj"
  175. :val="gdbh"
  176. />
  177. <!-- 核检废品分布 -->
  178. <Hjfpfb
  179. v-if="dialogHjfpfb"
  180. v-model="dialogHjfpfb"
  181. :val="gdbh"
  182. />
  183. <!-- 工单打印 -->
  184. <PrintPage ref="printPageRef" />
  185. <!--流程单查询【弹窗】-->
  186. <el-dialog
  187. v-model="pd_lcdlist"
  188. title="工单工序生产进程"
  189. fullscreen
  190. >
  191. <div style="width: 100%; height: 100%">
  192. <el-button
  193. type=""
  194. @click="
  195. () => {
  196. pd_lcdlist = false;
  197. }
  198. "
  199. >退出</el-button>
  200. </div>
  201. <div
  202. style="
  203. width: 100%;
  204. height: 100%;
  205. display: flex;
  206. align-items: center;
  207. "
  208. >
  209. <el-form-item
  210. label="工单编号"
  211. style="margin-right: 20px; padding: 0"
  212. >
  213. <el-input
  214. v-model="pd_lcdformData['gdbh']"
  215. @keyup.enter="pd_lcdProductValue"
  216. placeholder="Enter回车"
  217. />
  218. </el-form-item>
  219. <el-form-item
  220. label=""
  221. style="margin-right: 5px; padding: 0"
  222. >
  223. <el-input
  224. v-model="pd_lcdformData['code']"
  225. disabled
  226. />
  227. </el-form-item>
  228. <el-form-item
  229. label=""
  230. style="margin-right: 5px; padding: 0"
  231. >
  232. <el-input
  233. v-model="pd_lcdformData['name']"
  234. disabled
  235. style="width: 500px"
  236. />
  237. </el-form-item>
  238. </div>
  239. <div style="width: 100%; height: 70vh; display: flex">
  240. <layout>
  241. <layout-sider
  242. :resize-directions="['right']"
  243. :width="240"
  244. style="margin-right: 10px; height: 70vh"
  245. >
  246. <div class="JKWTree-tree">
  247. <el-tree
  248. :data="pd_lcd_treeData"
  249. default-expand-all
  250. @node-click="pd_lcd_handleNodeClick"
  251. />
  252. </div>
  253. </layout-sider>
  254. <layout-main>
  255. <!-- 这里放右侧的内容 -->
  256. <el-space wrap>
  257. <!-- 右侧内容 -->
  258. <template v-for="item in processList.total_process">
  259. <el-button
  260. disabled
  261. :type="
  262. !processList.process.includes(item)
  263. ? 'danger'
  264. : 'info'
  265. "
  266. plain
  267. style="width: 50px"
  268. >{{ item }}</el-button>
  269. </template>
  270. </el-space>
  271. </layout-main>
  272. </layout>
  273. </div>
  274. </el-dialog>
  275. </div>
  276. </div>
  277. </layout-header>
  278. <layout>
  279. <!-- 左侧树侧形结构-->
  280. <layout-sider
  281. :resize-directions="['right']"
  282. :width="190"
  283. style="margin-right: 10px"
  284. >
  285. <div
  286. class="JKWTree-tree"
  287. style="height: 70vh"
  288. >
  289. <h3>工单超节损核算</h3>
  290. <el-tree
  291. :data="treeData"
  292. highlight-current
  293. @node-click="handleNodeClick"
  294. />
  295. </div>
  296. </layout-sider>
  297. <!-- 右侧内容区域 -->
  298. <layout-content>
  299. <!-- 上方列表 -->
  300. <div class="gva-table-box">
  301. <el-table
  302. style="width: 100%; height: 30vh"
  303. :data="tableData1"
  304. row-key="ID"
  305. highlight-current-row
  306. border
  307. :row-class-name="rowClassName"
  308. :cell-class-name="cellClassName"
  309. :row-style="{ height: '20px' }"
  310. :cell-style="{ padding: '0px' }"
  311. :header-row-style="{ height: '20px' }"
  312. :header-cell-style="{ padding: '0px' }"
  313. @row-click="showOrderSuperLossGy"
  314. @current-change="
  315. (row, oldRow) => {
  316. currentRow = row;
  317. }
  318. "
  319. >
  320. <el-table-column
  321. type="selection"
  322. width="55"
  323. />
  324. <!-- 使用 v-for 循环渲染每一列 -->
  325. <el-table-column
  326. v-for="column in tableCols1"
  327. :key="column.prop"
  328. :prop="column.prop"
  329. :label="column.label"
  330. :width="column.width"
  331. show-overflow-tooltip="true"
  332. sortable
  333. />
  334. </el-table>
  335. </div>
  336. <!-- 下方表格 -->
  337. <el-table
  338. style="width: 100%; height: 40vh"
  339. row-key="ID"
  340. highlight-current-row
  341. border
  342. :data="tableData2"
  343. :row-style="{ height: '20px' }"
  344. :cell-style="{ padding: '0px' }"
  345. :header-row-style="{ height: '20px' }"
  346. :header-cell-style="{ padding: '0px' }"
  347. >
  348. <el-table-column
  349. type="selection"
  350. width="55"
  351. />
  352. <!-- 使用 v-for 循环渲染每一列 -->
  353. <el-table-column
  354. v-for="column in tableCols2"
  355. :key="column.prop"
  356. :prop="column.prop"
  357. :label="column.label"
  358. :width="column.width"
  359. show-overflow-tooltip="true"
  360. sortable
  361. />
  362. </el-table>
  363. </layout-content>
  364. </layout>
  365. </layout>
  366. </div>
  367. </template>
  368. <script>
  369. import service from '@/utils/request'
  370. import { writeXLSX } from 'xlsx'
  371. // 5.1流程单查询-工单工序生产进程菜单栏
  372. export const getOrderProcessLeft = (params) => {
  373. return service({
  374. url: '/mes_server/work_order_verification/getOrderProcessLeft',
  375. method: 'get',
  376. params,
  377. })
  378. }
  379. // 5.2流程单查询-获取工单工序生产进程右侧
  380. export const getOrderProcessRight = (params) => {
  381. return service({
  382. url: '/mes_server/work_order_verification/getOrderProcessRight',
  383. method: 'get',
  384. params,
  385. })
  386. }
  387. </script>
  388. <script setup>
  389. import {
  390. Layout,
  391. LayoutContent,
  392. LayoutHeader,
  393. LayoutSider,
  394. } from '@arco-design/web-vue'
  395. import { ref, watch } from 'vue'
  396. import {
  397. getOrderSuperLossGy,
  398. getSide,
  399. getTable,
  400. } from '@/api/mes_api_gty/orderAccounting'
  401. import Gdcjstj from '@/view/performance/12-orderAccounting/componets/gdcjstj.vue'
  402. import Khsz from '@/view/performance/12-orderAccounting/componets/khsz.vue'
  403. import Xzgdtl from '@/view/performance/12-orderAccounting/componets/xzgdtl.vue'
  404. import Gxclhc from '@/view/performance/12-orderAccounting/componets/gxclhc.vue'
  405. import Gongdanzhijianfeipintongji from '@/view/performance/09-workOrderVerification/componets/gongdanzhijianfeipintongji.vue'
  406. import Detail from '@/view/performance/12-orderAccounting/componets/detail.vue'
  407. import Hjfpfb from './componets/hjfpfb.vue'
  408. import PrintPage from '@/view/yunyin/shengchanguanli/components/print.vue'
  409. import { reactive } from 'vue'
  410. import { exportExcelFile } from '@/utils/excel'
  411. import { useUserStore } from '@/pinia/modules/user'
  412. const userStore = useUserStore()
  413. const sys_id =
  414. '[' + userStore.userInfo.userName + '/' + userStore.userInfo.nickName + ']'
  415. // 弹窗
  416. const dialogGdcjstj = ref(false)
  417. const dialogDetail = ref(false)
  418. const dialogKhsz = ref(false)
  419. const dialogXzgdtl = ref(false)
  420. const dialogGxclhc = ref(false)
  421. const dialogGdzjfptj = ref(false)
  422. const dialogHjfpfb = ref(false)
  423. // 侧边栏数据
  424. const treeData = ref([])
  425. const getSideData = async() => {
  426. const res = await getSide()
  427. if (res.code === 0) {
  428. const { data } = res
  429. const transformedData = []
  430. for (const [key, value] of Object.entries(data)) {
  431. const [date, total] = key.split('-') // 提取日期和数量
  432. const transformedItem = {
  433. label: `${date}(工单数:${total})`,
  434. date: date,
  435. children: value.map((item) => ({
  436. label: `${item['客户编号']}【${item['客户名称']}】(工单数:${item.total})`,
  437. date: date,
  438. code: item?.['客户编号'],
  439. })),
  440. }
  441. transformedData.push(transformedItem)
  442. }
  443. treeData.value = transformedData
  444. }
  445. }
  446. getSideData()
  447. // 表格数据
  448. const tableCols1 = [
  449. { label: '超损工单', prop: 'csgd', width: '120' },
  450. { label: '工单编号', prop: 'Gd_gdbh', width: '120' },
  451. { label: '印件号', prop: 'jjcp_yjno', width: '100' },
  452. { label: '联数', prop: 'yj_ls', width: '80' },
  453. { label: '产品代号', prop: '成品编码', width: '150' },
  454. { label: '产品名称', prop: '成品名称', width: '250' },
  455. { label: '实际投料', prop: '实际投料', width: '120' },
  456. { label: '计量单位', prop: '计量单位', width: '120' },
  457. { label: '入仓日期', prop: 'warehousing_date', width: '120' },
  458. { label: '入仓数量', prop: 'warehousing_num', width: '120' },
  459. { label: '目标合格率', prop: 'target_rate', width: '120' },
  460. { label: '实际合格率', prop: 'real_rate', width: '120' },
  461. { label: '奖惩系数', prop: 'reward_rate', width: '120' },
  462. // { label: '奖罚金额合计', prop: '', width: '140' },
  463. { label: '废品合计', prop: '废品合计', width: '120' },
  464. { label: '工单无形损', prop: '工单无形损', width: '120' },
  465. { label: '材料废', prop: '材料废', width: '120' },
  466. { label: '零头处理', prop: '零头处理', width: '120' },
  467. { label: '处发废', prop: '外发废', width: '120' },
  468. { label: '外摊废', prop: '分摊废', width: '120' },
  469. { label: '工单计划损耗', prop: '工单计划损耗', width: '140' },
  470. { label: '工单制程废', prop: '', width: '120' },
  471. { label: '工单检验废', prop: '工单质检废', width: '120' },
  472. { label: '年月', prop: 'date', width: '120' },
  473. ]
  474. const tableCols2 = [
  475. { label: '工单编号', prop: 'Gy0_gdbh', width: '120' },
  476. { label: '印件及工序', prop: 'Gy0_yjno', width: '120' },
  477. { label: '工序名称', prop: 'Gy0_gxmc', width: '200' },
  478. { label: '联数', prop: 'Gy0_ls', width: '80' },
  479. { label: '基础损耗', prop: 'Gy0_Rate0', width: '120' },
  480. { label: '损耗率', prop: 'Gy0_Rate1', width: '120' },
  481. { label: '损耗系数', prop: '损耗系数', width: '120' },
  482. { label: '计损色数', prop: 'Gy0_ms', width: '120' },
  483. { label: '计划产量', prop: 'Gy0_计划接货数', width: '120' },
  484. { label: '计划损耗', prop: 'Gy0_计划损耗', width: '120' },
  485. { label: '上报产量', prop: 'total_cl', width: '120' },
  486. { label: '制程废', prop: 'total_fp', width: '120' },
  487. ]
  488. const tableData1 = ref([])
  489. const tableData2 = ref([])
  490. const currentRow = ref({})
  491. const gdbh = ref('')
  492. const date = ref('')
  493. const searchInfo = ref('')
  494. watch(currentRow, (value, oldValue, onCleanup) => {
  495. gdbh.value = value?.['Gd_gdbh']
  496. date.value = value?.['date']
  497. pd_lcdformData['gdbh'] = value?.['Gd_gdbh']
  498. })
  499. // 显示上方表格
  500. const handleNodeClick = async(node) => {
  501. console.log(node)
  502. if (!node.children) {
  503. const { date, code } = node
  504. const res = await getTable({ date, code, limit: 9999, page: 1 })
  505. tableData1.value = res.data.data.map((item) => ({
  506. ...item,
  507. csgd:
  508. parseFloat(item['target_rate']) - parseFloat(item['real_rate']) > 0
  509. ? '√'
  510. : '',
  511. date: date,
  512. }))
  513. console.log(res.data)
  514. } else {
  515. // console.log(node.date, node.code)
  516. }
  517. }
  518. // 显示下方表格
  519. const showOrderSuperLossGy = async() => {
  520. const { Gd_gdbh: order } = currentRow.value
  521. const res = await getOrderSuperLossGy({ order })
  522. if (res.code === 0) {
  523. const { data } = res
  524. tableData2.value = data.map((item) => ({
  525. ...item,
  526. Gy0_yjno: `${item.Gy0_yjno}-${item.Gy0_gxh}`,
  527. Gy0_gxmc:
  528. item.Add_gxmc === ''
  529. ? item.Gy0_gxmc
  530. : `${item.Gy0_gxmc}〖${item.Add_gxmc}〗`,
  531. }))
  532. }
  533. }
  534. // 定位
  535. const handleSearch = () => {
  536. if (searchInfo.value) {
  537. tableData1.value = tableData1.value.filter((item) => {
  538. return item['Gd_gdbh'] === searchInfo.value ?? item
  539. })
  540. }
  541. }
  542. /* const rowClassName = ({ row, rowIndex }) => {
  543. if (row['csgd'] === '√') {
  544. return 'yellow-row'
  545. }
  546. return ''
  547. }*/
  548. const cellClassName = ({ row, column, rowIndex, columnIndex }) => {
  549. if ([7, 11, 13, 21].includes(columnIndex)) {
  550. return 'red-cell'
  551. }
  552. return ''
  553. }
  554. const printPageRef = ref()
  555. function handleGddy() {
  556. printPageRef.value.open(gdbh.value)
  557. }
  558. const pd_lcdlist = ref(false)
  559. const processList = ref([])
  560. const pd_lcdformData = reactive({})
  561. const pd_lcdProductValue = async() => {
  562. _getOrderProcessLeft_list()
  563. }
  564. const pd_lcd_treeData = ref([])
  565. const _getOrderProcessLeft_list = async() => {
  566. const order = pd_lcdformData['gdbh']
  567. console.log(order)
  568. try {
  569. // 5.1流程单查询-工单工序生产进程菜单栏
  570. const getOrderProcessLeft_list = await getOrderProcessLeft({
  571. order: order,
  572. })
  573. console.log(getOrderProcessLeft_list)
  574. pd_lcdformData['code'] = getOrderProcessLeft_list.data.Gd_info['code']
  575. pd_lcdformData['name'] = getOrderProcessLeft_list.data.Gd_info['name']
  576. pd_lcd_treeData.value = [
  577. {
  578. label: order + '-' + getOrderProcessLeft_list.data.Gd_info['name'],
  579. // label: order + '-' + getOrderProcessLeft_list.data.Gd_info['code'] + '-' + getOrderProcessLeft_list.data.Gd_info['name'],
  580. value: undefined,
  581. children: [],
  582. },
  583. ]
  584. const newData = []
  585. for (const key in getOrderProcessLeft_list.data.Gy_info) {
  586. const temp = getOrderProcessLeft_list.data.Gy_info[key]
  587. const concatenatedValue = `${temp.Gy0_yjno}-${temp.Gy0_gxh} ---> ${temp.Gy0_gxmc}`
  588. newData.push({ label: concatenatedValue, value: temp.Gy0_gxh })
  589. }
  590. pd_lcd_treeData.value[0].children = newData
  591. // 5.2流程单查询-获取工单工序生产进程右侧【进入页面默认显示第一个】
  592. const getOrderProcessRight_list = await getOrderProcessRight({
  593. order: order,
  594. gxNo: newData[0].value,
  595. })
  596. processList.value = getOrderProcessRight_list.data
  597. } catch (error) {
  598. console.error(error)
  599. }
  600. }
  601. const pd_lcd_handleNodeClick = async(node) => {
  602. if (node.value === undefined) return
  603. const order = pd_lcdformData['gdbh']
  604. // //5.2流程单查询-获取工单工序生产进程右侧
  605. const getOrderProcessRight_list = await getOrderProcessRight({
  606. order: order,
  607. gxNo: node.value,
  608. })
  609. console.log(getOrderProcessRight_list)
  610. processList.value = getOrderProcessRight_list.data
  611. }
  612. // 导出excel
  613. const exportExcel = () => {
  614. const labels = tableCols1.map((item) => item.label)
  615. const props = tableCols1.map((item) => item.prop)
  616. const data = tableData1.value.map((item) => {
  617. const row = {}
  618. props.forEach((prop, index) => {
  619. row[labels[index]] = item?.[prop]
  620. })
  621. return row
  622. })
  623. if (data[0]?.[labels[0]] === undefined) {
  624. return
  625. }
  626. exportExcelFile(data)
  627. }
  628. </script>
  629. <style scoped>
  630. :deep(.plan-usage-low div) {
  631. color: red !important;
  632. }
  633. .JKWTree-container {
  634. display: flex;
  635. }
  636. .JKWTree-tree {
  637. width: 100%;
  638. background-color: #fff;
  639. /*background-color: rgba(241, 224, 224, 0.99);*/
  640. padding: 10px;
  641. margin-right: 20px;
  642. }
  643. .JKWTree-tree h3 {
  644. font-size: 15px;
  645. font-weight: 700;
  646. margin: 10px 0;
  647. }
  648. .JKWTree-content {
  649. flex: 1;
  650. }
  651. :deep(.el-table .yellow-row) {
  652. background: #ffff80;
  653. }
  654. :deep(.red-cell div) {
  655. color: #ff0000 !important;
  656. }
  657. /* 选中某行时的背景色 */
  658. :deep(.el-table__body tr.current-row) > td {
  659. background: #ff80ff !important;
  660. }
  661. </style>
  662. <style scoped>
  663. :deep(.el-table td .cell) {
  664. line-height: 20px !important;
  665. }
  666. :deep(.el-tabs__header) {
  667. margin-bottom: 0;
  668. }
  669. .search {
  670. margin-left: 0px !important;
  671. margin-right: 10px !important;
  672. }
  673. .bt {
  674. margin-left: 2px !important;
  675. padding: 3px !important;
  676. font-size: 12px;
  677. }
  678. .el-tabs__header {
  679. margin: 0px !important;
  680. }
  681. .gva-table-box {
  682. padding: 0px !important;
  683. }
  684. .mab {
  685. margin-bottom: 5px;
  686. }
  687. </style>