index.vue 13 KB

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