index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  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-form-item>
  77. </el-form>
  78. <!-- 弹窗 -->
  79. <div>
  80. <!-- 查改 -->
  81. <Detail
  82. v-if="dialogDetail"
  83. :is-show="dialogDetail"
  84. :gdbh="gdbh"
  85. @destroy="()=>{dialogDetail = false}"
  86. />
  87. <!-- 工单超节损统计 -->
  88. <el-dialog
  89. v-model="dialogGdcjstj"
  90. title="工单超节损统计"
  91. destroy-on-close
  92. >
  93. <Gdcjstj :gdbh="gdbh" />
  94. </el-dialog>
  95. <!-- 修正工单印件质量考核设置 -->
  96. <Khsz
  97. v-if="dialogKhsz"
  98. v-model="dialogKhsz"
  99. :gdbh="gdbh"
  100. />
  101. <!-- 修正工单投料 -->
  102. <Xzgdtl
  103. v-if="dialogXzgdtl"
  104. v-model="dialogXzgdtl"
  105. :date="date"
  106. />
  107. <!-- 工序产量核查 -->
  108. <Gxclhc
  109. v-if="dialogGxclhc"
  110. v-model="dialogGxclhc"
  111. :gdbh="gdbh"
  112. />
  113. <!-- 工单质检废品统计 -->
  114. <Gongdanzhijianfeipintongji
  115. v-if="dialogGdzjfptj"
  116. v-model="dialogGdzjfptj"
  117. :val="gdbh"
  118. />
  119. <!-- 核检废品分布 -->
  120. <Hjfpfb
  121. v-if="dialogHjfpfb"
  122. v-model="dialogHjfpfb"
  123. :val="gdbh"
  124. />
  125. </div>
  126. </div>
  127. </layout-header>
  128. <layout>
  129. <!-- 左侧树侧形结构-->
  130. <layout-sider
  131. :resize-directions="['right']"
  132. :width="190"
  133. style="margin-right: 10px;"
  134. >
  135. <div
  136. class="JKWTree-tree"
  137. style="height: 70vh;"
  138. >
  139. <h3> 产品管理</h3>
  140. <el-tree
  141. :data="treeData"
  142. highlight-current
  143. @node-click="handleNodeClick"
  144. />
  145. </div>
  146. </layout-sider>
  147. <!-- 右侧内容区域 -->
  148. <layout-content>
  149. <!-- 上方列表 -->
  150. <div class="gva-table-box">
  151. <el-table
  152. style="width: 100%;height:30vh;"
  153. :data="tableData1"
  154. row-key="ID"
  155. highlight-current-row
  156. border
  157. :row-class-name="rowClassName"
  158. :cell-class-name="cellClassName"
  159. :row-style="{ height: '20px' }"
  160. :cell-style="{ padding: '0px' }"
  161. :header-row-style="{ height: '20px' }"
  162. :header-cell-style="{ padding: '0px' }"
  163. @row-click="showOrderSuperLossGy"
  164. @current-change="(row, oldRow) => { currentRow = row}"
  165. >
  166. <el-table-column
  167. type="selection"
  168. width="55"
  169. />
  170. <!-- 使用 v-for 循环渲染每一列 -->
  171. <el-table-column
  172. v-for="column in tableCols1"
  173. :key="column.prop"
  174. :prop="column.prop"
  175. :label="column.label"
  176. :width="column.width"
  177. show-overflow-tooltip="true"
  178. sortable
  179. />
  180. </el-table>
  181. </div>
  182. <!-- 下方表格 -->
  183. <el-table
  184. style="width: 100%;height: 40vh;"
  185. row-key="ID"
  186. highlight-current-row
  187. border
  188. :data="tableData2"
  189. :row-style="{ height: '20px' }"
  190. :cell-style="{ padding: '0px' }"
  191. :header-row-style="{ height: '20px' }"
  192. :header-cell-style="{ padding: '0px' }"
  193. >
  194. <el-table-column
  195. type="selection"
  196. width="55"
  197. />
  198. <!-- 使用 v-for 循环渲染每一列 -->
  199. <el-table-column
  200. v-for="column in tableCols2"
  201. :key="column.prop"
  202. :prop="column.prop"
  203. :label="column.label"
  204. :width="column.width"
  205. show-overflow-tooltip="true"
  206. sortable
  207. />
  208. </el-table>
  209. </layout-content>
  210. </layout>
  211. </layout>
  212. </div>
  213. </template>
  214. <script setup>
  215. import { Layout, LayoutContent, LayoutHeader, LayoutSider } from '@arco-design/web-vue'
  216. import { ref, watch } from 'vue'
  217. import { getOrderSuperLossGy, getSide, getTable } from '@/api/mes_api_gty/orderAccounting'
  218. import Gdcjstj from '@/view/performance/12-orderAccounting/componets/gdcjstj.vue'
  219. import Khsz from '@/view/performance/12-orderAccounting/componets/khsz.vue'
  220. import Xzgdtl from '@/view/performance/12-orderAccounting/componets/xzgdtl.vue'
  221. import Gxclhc from '@/view/performance/12-orderAccounting/componets/gxclhc.vue'
  222. import Gongdanzhijianfeipintongji
  223. from '@/view/performance/09-workOrderVerification/componets/gongdanzhijianfeipintongji.vue'
  224. import Detail from '@/view/performance/12-orderAccounting/componets/detail.vue'
  225. import Hjfpfb from './componets/hjfpfb.vue'
  226. // 弹窗
  227. const dialogGdcjstj = ref(false)
  228. const dialogDetail = ref(false)
  229. const dialogKhsz = ref(false)
  230. const dialogXzgdtl = ref(false)
  231. const dialogGxclhc = ref(false)
  232. const dialogGdzjfptj = ref(false)
  233. const dialogHjfpfb = ref(false)
  234. // 侧边栏数据
  235. const treeData = ref([])
  236. const getSideData = async() => {
  237. const res = await getSide()
  238. if (res.code === 0) {
  239. const { data } = res
  240. const transformedData = []
  241. for (const [key, value] of Object.entries(data)) {
  242. const [date, total] = key.split('-') // 提取日期和数量
  243. const transformedItem = {
  244. label: `${date}(工单数:${total})`,
  245. date: date,
  246. children: value.map(item => ({
  247. label: `${item['客户编号']}【${item['客户名称']}】(工单数:${item.total})`,
  248. date: date,
  249. code: item?.['客户编号'],
  250. })),
  251. }
  252. transformedData.push(transformedItem)
  253. }
  254. treeData.value = transformedData
  255. }
  256. }
  257. getSideData()
  258. // 表格数据
  259. const tableCols1 = [
  260. { label: '超损工单', prop: 'csgd', width: '90' },
  261. { label: '工单编号', prop: 'Gd_gdbh', width: '100' },
  262. { label: '印件号', prop: 'jjcp_yjno', width: '100' },
  263. { label: '联数', prop: 'yj_ls', width: '80' },
  264. { label: '产品代号', prop: '成品编码', width: '150' },
  265. { label: '产品名称', prop: '成品名称', width: '250' },
  266. { label: '实际投料', prop: '实际投料', width: '100' },
  267. { label: '计量单位', prop: '计量单位', width: '100' },
  268. { label: '入仓日期', prop: 'warehousing_date', width: '120' },
  269. { label: '入仓数量', prop: 'warehousing_num', width: '100' },
  270. { label: '目标合格率', prop: 'target_rate', width: '100' },
  271. { label: '实际合格率', prop: 'real_rate', width: '100' },
  272. { label: '奖惩系数', prop: 'reward_rate', width: '100' },
  273. { label: '奖罚金额合计', prop: '', width: '120' },
  274. { label: '废品合计', prop: '废品合计', width: '100' },
  275. { label: '工单无形损', prop: '工单无形损', width: '100' },
  276. { label: '材料废', prop: '材料废', width: '100' },
  277. { label: '零头处理', prop: '零头处理', width: '100' },
  278. { label: '处发废', prop: '外发废', width: '100' },
  279. { label: '外摊废', prop: '分摊废', width: '100' },
  280. { label: '工单计划损耗', prop: '工单计划损耗', width: '120' },
  281. { label: '工单制程废', prop: '', width: '100' },
  282. { label: '工单检验废', prop: '工单质检废', width: '100' },
  283. { label: '年月', prop: 'date', width: '100' },
  284. ]
  285. const tableCols2 = [
  286. { label: '工单编号', prop: 'Gy0_gdbh', width: '100' },
  287. { label: '印件及工序', prop: 'Gy0_yjno', width: '100' },
  288. { label: '工序名称', prop: 'Gy0_gxmc', width: '200' },
  289. { label: '联数', prop: 'Gy0_ls', width: '80' },
  290. { label: '基础损耗', prop: 'Gy0_Rate0', width: '100' },
  291. { label: '损耗率', prop: 'Gy0_Rate1', width: '100' },
  292. { label: '损耗系数', prop: '损耗系数', width: '100' },
  293. { label: '计损色数', prop: 'Gy0_ms', width: '100' },
  294. { label: '计划产量', prop: 'Gy0_计划接货数', width: '100' },
  295. { label: '计划损耗', prop: 'Gy0_计划损耗', width: '100' },
  296. { label: '上报产量', prop: 'total_cl', width: '100' },
  297. { label: '制程废', prop: 'total_fp', width: '100' },
  298. ]
  299. const tableData1 = ref([])
  300. const tableData2 = ref([])
  301. const currentRow = ref({})
  302. const gdbh = ref('')
  303. const date = ref('')
  304. const searchInfo = ref('')
  305. watch(currentRow, (value, oldValue, onCleanup) => {
  306. gdbh.value = value?.['Gd_gdbh']
  307. date.value = value?.['date']
  308. })
  309. // 显示上方表格
  310. const handleNodeClick = async(node) => {
  311. console.log(node)
  312. if (!node.children) {
  313. const { date, code } = node
  314. const res = await getTable({ date, code, limit: 9999, page: 1 })
  315. tableData1.value = res.data.data.map(item => ({
  316. ...item,
  317. csgd: parseFloat(item['target_rate']) - parseFloat(item['real_rate']) > 0 ? '√' : '',
  318. date: date,
  319. }))
  320. console.log(res.data)
  321. } else {
  322. // console.log(node.date, node.code)
  323. }
  324. }
  325. // 显示下方表格
  326. const showOrderSuperLossGy = async() => {
  327. const { Gd_gdbh: order } = currentRow.value
  328. const res = await getOrderSuperLossGy({ order })
  329. if (res.code === 0) {
  330. const { data } = res
  331. tableData2.value = data.map(item => ({
  332. ...item,
  333. Gy0_yjno: `${item.Gy0_yjno}-${item.Gy0_gxh}`,
  334. Gy0_gxmc: item.Add_gxmc === '' ? item.Gy0_gxmc : `${item.Gy0_gxmc}〖${item.Add_gxmc}〗`,
  335. }))
  336. }
  337. }
  338. // 定位
  339. const handleSearch = () => {
  340. if (searchInfo.value) {
  341. tableData1.value = tableData1.value.filter(item => {
  342. return item['Gd_gdbh'] === searchInfo.value ?? item
  343. })
  344. }
  345. }
  346. const rowClassName = ({ row, rowIndex }) => {
  347. if (row['csgd'] === '√') {
  348. return 'yellow-row'
  349. }
  350. return ''
  351. }
  352. const cellClassName = ({ row, column, rowIndex, columnIndex }) => {
  353. if ([7, 11, 13, 21].includes(columnIndex)) {
  354. return 'red-cell'
  355. }
  356. return ''
  357. }
  358. </script>
  359. <style scoped>
  360. :deep(.plan-usage-low div) {
  361. color: red !important;
  362. }
  363. .JKWTree-container {
  364. display: flex;
  365. }
  366. .JKWTree-tree {
  367. width: 100%;
  368. background-color: #fff;
  369. /*background-color: rgba(241, 224, 224, 0.99);*/
  370. padding: 10px;
  371. margin-right: 20px;
  372. }
  373. .JKWTree-tree h3 {
  374. font-size: 15px;
  375. font-weight: 700;
  376. margin: 10px 0;
  377. }
  378. .JKWTree-content {
  379. flex: 1;
  380. }
  381. :deep(.el-table .yellow-row) {
  382. background: #FFFF80;
  383. }
  384. :deep(.red-cell div) {
  385. color: #FF0000 !important;
  386. }
  387. /* 选中某行时的背景色 */
  388. :deep(.el-table__body tr.current-row) > td {
  389. background: #ff80ff !important;
  390. }
  391. </style>
  392. <style scoped>
  393. :deep(.el-table td .cell) {
  394. line-height: 20px !important;
  395. }
  396. :deep(.el-tabs__header) {
  397. margin-bottom: 0;
  398. }
  399. .search {
  400. margin-left: 0px !important;
  401. margin-right: 10px !important;
  402. }
  403. .bt {
  404. margin-left: 2px !important;
  405. padding: 3px !important;
  406. font-size: 12px;
  407. }
  408. .el-tabs__header {
  409. margin: 0px !important;
  410. }
  411. .gva-table-box {
  412. padding: 0px !important;
  413. }
  414. .mab {
  415. margin-bottom: 5px;
  416. }
  417. </style>