index.vue 12 KB

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