index.vue 19 KB

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