index.vue 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-header>
  5. <div class="">
  6. <!--按钮部分-->
  7. <el-form ref="elSearchFormRef" inline class="demo-form-inline" @submit.native.prevent>
  8. <el-form-item>
  9. <el-input v-model="searchInfo" placeholder="搜索工单编号或产品名称 " clearable style="width: 180px"/>
  10. <el-button type="primary" icon="search" class="search" @click="handleSearch"/>
  11. <el-button type="primary"icon="edit"class="bt"@click=" () => { dialogDetail = true; } "><i class="el-icon-edit" />查改</el-button>
  12. <!--<el-button type="primary" disabled icon="edit" @click="" style="margin-left: 10px">工艺方案复制</el-button>-->
  13. <el-button type="primary" icon="edit" class="bt" @click=" () => { dialogGdcjstj = true; }">工单超节损统计</el-button>
  14. <!-- <el-button type="primary" icon="edit" class="bt" @click=" () => { dialogKhsz = true}">考核设置</el-button> -->
  15. <el-button type="primary" icon="edit" class="bt" @click="dialogKhszclick">考核设置</el-button>
  16. <el-button type="primary" icon="edit" class="bt"@click=" () => { dialogXzgdtl = true; }">修正工单投料</el-button>
  17. <el-button type="primary" icon="edit" class="bt"@click=" () => { dialogGxclhc = true;}">工序产量核查</el-button>
  18. <el-button type="primary" icon="edit"class="bt"@click="() => {dialogGdzjfptj = true;}">工单质检废品统计</el-button>
  19. <el-button type="primary" icon="edit" class="bt"@click="() => {dialogHjfpfb = true;}">核检废品分布</el-button>
  20. <el-button type="primary" icon="edit" class="bt"@click="handleGddy">工单打印</el-button>
  21. <el-button type="primary" icon="edit" class="bt" @click="pd_lcdlistonClick">流程单查询</el-button>
  22. <el-button type="primary" icon="edit" class="bt" @click="exportExcel">导出Excel</el-button>
  23. <el-button type="primary" icon="edit" class="bt" @click="ygdy">超节损员工打印</el-button>
  24. <el-button type="success" icon="edit" class="bt" @click="rcgdsj">数据处理</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <div>
  28. <!-- 查改 -->
  29. <Detail v-if="dialogDetail" :is-show="dialogDetail" :gdbh="gdbh" :yjno="yjno"
  30. @destroy="() => {dialogDetail = false;}"/>
  31. <!-- 工单超节损统计 -->
  32. <el-dialog v-model="dialogGdcjstj" title="工单超节损统计" destroy-on-close >
  33. <Gdcjstj :gdbh="gdbh" :yjno ="yjno" />
  34. </el-dialog>
  35. <!-- 员工打印 -->
  36. <el-dialog v-model="dialogygdy" title="员工打印" destroy-on-close style="height: 50%;">
  37. <el-date-picker
  38. v-model="ygdy_formData['ygriqi']"
  39. type="month"
  40. placeholder="选择年月"
  41. :default-value="new Date()"
  42. @change="onchange_ygdy"
  43. style="width: 200px"
  44. />
  45. <el-button type="primary" icon="edit" class="bt" @click="onclick_ygdy">按员工打印</el-button>
  46. <el-button type="primary" icon="Download" class="bt" @click="exportToExcel">导出到Excel</el-button>
  47. <el-table ref="multipleTable"
  48. :row-style="{ height: '20px' }"
  49. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '20px' }"
  50. :header-cell-style="{ padding: '0px' }"
  51. :show-overflow-tooltip="true"
  52. id="cjsjetableData"
  53. highlight-current-row="true"
  54. style="width: 100%;height: 40vh"
  55. border tooltip-effect="dark"
  56. :data="cjsjetableData"
  57. row-key="ID"
  58. @row-dblclick="ExcelShow"
  59. @selection-change="handleSelectionChange">
  60. <!-- <el-table-column type="selection" width="55" />-->
  61. <el-table-column align="left" sortable label="车间" prop="cj" width="150"/>
  62. <el-table-column align="left" sortable label="员工编号" prop="bh" width="150" />
  63. <el-table-column align="left" sortable label="班组" prop="bz" width="80"/>
  64. <el-table-column align="left" sortable label="员工姓名" prop="xm" width="150"/>
  65. <el-table-column align="left" sortable label="超节损金额" prop="je" width="150" >
  66. <template v-slot="{ row }">
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. </el-dialog>
  71. <el-dialog v-model="dialogkhszlog" title="修正工单印件质量考核设置" destroy-on-close fullscreen >
  72. <el-button type="primary" style="width:80px; height: 40px;margin-bottom: 20px" @click="renew">更新</el-button>
  73. <el-button type="primary" style="width:80px; height: 40px;margin-bottom: 20px" @click="modelValuelog">退出</el-button>
  74. <el-form inline >
  75. <el-form-item label="工单编号">
  76. <el-input v-model="gdbh" style="width: 100px" @keyup.enter="handleGetTable" placeholder="Enter回车"/>
  77. </el-form-item>
  78. <el-form-item label="印件号">
  79. <el-input v-model="yjno" style="width: 100px" @keyup.enter="handleGetTable" placeholder="Enter回车" />
  80. </el-form-item>
  81. <el-table :data="khsztableData" border height="70vh"
  82. :row-style="{ height: '20px' }" :cell-style="{ padding: '0px' }"
  83. :header-row-style="{ height: '20px' }" :header-cell-style="{ padding: '0px' }" >
  84. <el-table-column label="工单编号" width="100" prop="Yj_gdbh"/>
  85. <el-table-column label="印件编码" width="100" prop="yj_Yjdh"/>
  86. <el-table-column label="印件号" width="100" prop="yj_Yjno"/>
  87. <el-table-column label="印件名称" width="400" prop="yj_yjmc"/>
  88. <el-table-column label="当前考核设置" width="150" prop="当前考核设置"/>
  89. <el-table-column label="新考核设置" width="150">
  90. <template #default="{ row }">
  91. <!-- 使用 el-select 来创建选择框 -->
  92. <el-select v-model="row.新考核设置" placeholder="请选择">
  93. <el-option label="参与" value="参与"/>
  94. <el-option label="剔除" value="剔除"/>
  95. </el-select>
  96. </template>
  97. </el-table-column>
  98. </el-table>
  99. </el-form>
  100. </el-dialog>
  101. <!-- 修正工单投料 -->
  102. <!-- 修正工单印件质量考核设置 -->
  103. <!-- <Khsz v-if="dialogKhsz" v-model="dialogKhsz" :gdbh="gdbh" :yjno="yjno" /> -->
  104. <!-- 修正工单投料 -->
  105. <Xzgdtl v-if="dialogXzgdtl" v-model="dialogXzgdtl" @update-data = "exitXzgdtl" :gdbh="gdbh" :yjno="yjno"/>
  106. <!-- 工序产量核查 -->
  107. <Gxclhc v-if="dialogGxclhc" v-model="dialogGxclhc"
  108. :gdbh="gdbh" :jjcp_yjno = "jjcp_yjno"
  109. />
  110. <!-- 工单质检废品统计 -->
  111. <Gongdanzhijianfeipintongji
  112. v-if="dialogGdzjfptj"
  113. v-model="dialogGdzjfptj"
  114. :val="gdbh"
  115. />
  116. <!-- 核检废品分布 -->
  117. <Hjfpfb
  118. v-if="dialogHjfpfb"
  119. v-model="dialogHjfpfb"
  120. :val="gdbh"
  121. :jjcp_yjno="jjcp_yjno"
  122. />
  123. <!-- 数据处理 -->
  124. <el-dialog v-model="onrcgdsj" title="工单质量考核数据核算" destroy-on-close style="height: 30%;width: 20%;">
  125. <el-form-item label="选择年月" label-width="100px">
  126. <el-date-picker
  127. v-model="rcgdsjrq"
  128. type="month"
  129. placeholder="选择年月"
  130. :default-value="new Date()"
  131. @change="onchange_data"
  132. style="width: 200px;"
  133. />
  134. </el-form-item>
  135. <el-form-item label="工单编号" label-width="100px">
  136. <el-input v-model="gdbh" style="width: 200px;" />
  137. </el-form-item>
  138. <el-form-item label="印件号" label-width="100px">
  139. <el-input v-model="jjcp_yjno" style="width: 200px;"/>
  140. </el-form-item>
  141. <template #footer>
  142. <div class="dialog-footer" style="text-align: right;">
  143. <el-button @click="rcgdsjcloseDialog">取消</el-button>
  144. <el-button type="primary" @click="rcgdsjonDialog">确定</el-button>
  145. </div>
  146. </template>
  147. </el-dialog>
  148. <!-- 工单打印 -->
  149. <PrintPage ref="printPageRef" />
  150. <!--流程单查询【弹窗】-->
  151. <el-dialog v-model="pd_lcdlist" title="工单工序生产进程" fullscreen>
  152. <div style="width: 100%; height: 100%">
  153. <el-button type="" @click=" () => {pd_lcdlist = false;}">退出</el-button>
  154. </div>
  155. <div style=" width: 100%; height: 100%; display: flex; align-items: center;">
  156. <el-form-item label="工单编号" style="margin-right: 20px; padding: 0">
  157. <el-input v-model="pd_lcdformData['gdbh']" @keyup.enter="pd_lcdProductValue" placeholder="Enter回车"/>
  158. </el-form-item>
  159. <el-form-item label="印件号" style="margin-right: 20px; padding: 0">
  160. <el-input v-model="pd_lcdformData['yjno']" @keyup.enter="pd_lcdProductValue" placeholder="Enter回车"/>
  161. </el-form-item>
  162. <el-form-item label="" style="margin-right: 5px; padding: 0">
  163. <el-input v-model="pd_lcdformData['code']" disabled/>
  164. </el-form-item>
  165. <el-form-item label="" style="margin-right: 5px; padding: 0">
  166. <el-input v-model="pd_lcdformData['name']" disabled style="width: 500px" />
  167. </el-form-item>
  168. </div>
  169. <div style="width: 100%; height: 70vh; display: flex">
  170. <layout>
  171. <layout-sider
  172. :resize-directions="['right']"
  173. :width="240"
  174. style="margin-right: 10px; height: 70vh"
  175. >
  176. <div class="JKWTree-tree">
  177. <el-tree
  178. :data="pd_lcd_treeData"
  179. default-expand-all
  180. @node-click="pd_lcd_handleNodeClick"
  181. />
  182. </div>
  183. </layout-sider>
  184. <layout-main>
  185. <!-- 这里放右侧的内容 -->
  186. <div style="display: flex; align-items: center;margin-left: 20px;">
  187. <el-tag type="success" style="width: 55px; height: 40px; margin-right: 10px;"><h2>流程号</h2></el-tag>
  188. <h2 style="margin: 0 20px 0 0;">绿格子图标表示“已完成”</h2>
  189. <el-tag type="danger" style="width: 55px; height: 40px; margin-right: 10px;"><h2>流程号</h2></el-tag>
  190. <h2 style="margin: 0;">红格子图标表示“未完成”</h2>
  191. </div>
  192. <br>
  193. <el-space wrap style="margin-left: 20px;">
  194. <!-- 右侧内容 -->
  195. <template v-for="item in processList.total_process">
  196. <el-button class="custom-button" disabled :type="! processList.process.includes(item) ? 'danger' : 'info'" plain style="width: 50px;">{{ item }}</el-button>
  197. <!-- <el-button disabled :type="! processList.process.includes(item) ? 'danger' : 'info'" plain style="width: 50px">{{ item }}</el-button> -->
  198. </template>
  199. </el-space>
  200. </layout-main>
  201. </layout>
  202. </div>
  203. </el-dialog>
  204. </div>
  205. </div>
  206. </layout-header>
  207. <layout>
  208. <!-- 左侧树侧形结构-->
  209. <layout-sider
  210. :resize-directions="['right']"
  211. :width="190"
  212. style="margin-right: 10px"
  213. >
  214. <div class="JKWTree-tree" style="height: 70vh" >
  215. <h3>工单超节损核算</h3>
  216. <el-tree :data="treeData" highlight-current @node-click="handleNodeClick"/>
  217. </div>
  218. </layout-sider>
  219. <!-- 右侧内容区域 -->
  220. <layout-content>
  221. <!-- 上方列表 -->
  222. <div class="gva-table-box">
  223. <el-table
  224. style="width: 100%; height: 33vh"
  225. :data="tableData1"
  226. row-key="ID" id="cjstable"
  227. highlight-current-row
  228. border
  229. :row-class-name="rowClassName"
  230. :cell-class-name="cellClassName"
  231. :row-style="{ height: '20px' }"
  232. :cell-style="{ padding: '0px' }"
  233. :header-row-style="{ height: '20px' }"
  234. :header-cell-style="{ padding: '0px' }"
  235. @row-click="showOrderSuperLossGy"
  236. @current-change="
  237. (row, oldRow) => {
  238. currentRow = row;
  239. }
  240. "
  241. >
  242. <el-table-column
  243. type="selection"
  244. width="55"
  245. />
  246. <!-- 使用 v-for 循环渲染每一列 -->
  247. <el-table-column
  248. v-for="column in tableCols1"
  249. :key="column.prop"
  250. :prop="column.prop"
  251. :label="column.label"
  252. :width="column.width"
  253. :align='column.left'
  254. :fixed='column.fixed'
  255. :sortable="column.sortable"
  256. show-overflow-tooltip="true"
  257. sortable
  258. />
  259. </el-table>
  260. </div>
  261. <!-- 下方表格 -->
  262. <el-table
  263. style="width: 100%; height: 40vh"
  264. row-key="ID"
  265. highlight-current-row
  266. border
  267. :data="tableData2"
  268. :row-style="{ height: '20px' }"
  269. :cell-style="{ padding: '0px' }"
  270. :header-row-style="{ height: '20px' }"
  271. :header-cell-style="{ padding: '0px' }"
  272. >
  273. <el-table-column
  274. type="selection"
  275. width="55"
  276. />
  277. <!-- 使用 v-for 循环渲染每一列 -->
  278. <el-table-column
  279. v-for="column in tableCols2"
  280. :key="column.prop"
  281. :prop="column.prop"
  282. :label="column.label"
  283. :width="column.width"
  284. show-overflow-tooltip="true"
  285. />
  286. </el-table>
  287. </layout-content>
  288. </layout>
  289. </layout>
  290. </div>
  291. </template>
  292. <script>
  293. import service from '@/utils/request'
  294. import { writeXLSX } from 'xlsx'
  295. // 5.1流程单查询-工单工序生产进程菜单栏
  296. export const getOrderProcessLeft = (params) => {
  297. return service({
  298. url: '/mes_server/work_order_verification/getOrderProcessLeft',
  299. method: 'get',
  300. params,
  301. })
  302. }
  303. // 5.2流程单查询-获取工单工序生产进程右侧
  304. export const getOrderProcessRight = (params) => {
  305. return service({
  306. url: '/mes_server/work_order_verification/getOrderProcessRight',
  307. method: 'get',
  308. params,
  309. })
  310. }
  311. // 4.1考核设置-获取工单印件资料
  312. export const getOrderYj = (params) => {
  313. return service({
  314. url: '/mes_server/order_super_loss/getOrderYj',
  315. method: 'get',
  316. params
  317. })
  318. }
  319. export const updateOrderYj = (params) => {
  320. return service({
  321. url: '/mes_server/order_super_loss/updateOrderYj',
  322. method: 'get',
  323. params
  324. })
  325. }
  326. </script>
  327. <script setup>
  328. import { ElMessage, ElMessageBox } from 'element-plus'
  329. import {
  330. Layout,
  331. LayoutContent,
  332. LayoutHeader,
  333. LayoutSider,
  334. } from '@arco-design/web-vue'
  335. import { ref, watch } from 'vue'
  336. import {
  337. getOrderSuperLossGy,
  338. getSide,
  339. EmployeeDataCollect,
  340. getTable,
  341. } from '@/api/mes_api_gty/orderAccounting'
  342. // import Khsz from '@/view/performance/12-orderAccounting/componets/khsz.vue'
  343. import {hiprint} from "vue-plugin-hiprint";
  344. import Gdcjstj from '@/view/performance/12-orderAccounting/componets/gdcjstj.vue'
  345. import Xzgdtl from '@/view/performance/12-orderAccounting/componets/xzgdtl.vue'
  346. import Gxclhc from '@/view/performance/12-orderAccounting/componets/gxclhc.vue'
  347. import Gongdanzhijianfeipintongji from '@/view/performance/09-workOrderVerification/componets/gongdanzhijianfeipintongji.vue'
  348. import Detail from '@/view/performance/12-orderAccounting/componets/detail.vue'
  349. import Hjfpfb from './componets/hjfpfb.vue'
  350. import PrintPage from '@/view/yunyin/shengchanguanli/components/print.vue'
  351. import {
  352. orderLossData,
  353. } from '@/api/jixiaoguanli/jitairibaobiao'
  354. import { reactive } from 'vue'
  355. import * as XLSX from 'xlsx'
  356. import FileSaver from 'file-saver'
  357. import { exportExcelFile } from '@/utils/excel'
  358. import { useUserStore } from '@/pinia/modules/user'
  359. const userStore = useUserStore()
  360. const sys_id =
  361. '[' + userStore.userInfo.userName + '/' + userStore.userInfo.nickName + ']'
  362. // 获取当前日期
  363. const today = new Date();
  364. const year = today.getFullYear();
  365. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  366. const day = String(today.getDate()).padStart(2, '0');
  367. const hours = String(today.getHours()).padStart(2, '0');
  368. const minutes = String(today.getMinutes()).padStart(2, '0');
  369. const seconds = String(today.getSeconds()).padStart(2, '0');
  370. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  371. const currentDates = `${year}-${month}-${day}`;
  372. // 弹窗
  373. const dialogGdcjstj = ref(false)
  374. const dialogDetail = ref(false)
  375. // const dialogKhsz = ref(false)
  376. const dialogXzgdtl = ref(false)
  377. const dialogGxclhc = ref(false)
  378. const dialogGdzjfptj = ref(false)
  379. const dialogHjfpfb = ref(false)
  380. //===========考核设置==============
  381. //弹窗
  382. const dialogkhszlog = ref(false)
  383. // 考核设置按钮
  384. const dialogKhszclick = async() => {
  385. if (!gdbh.value?.trim() && !yjno.value?.trim()) {
  386. ElMessage.error('请先选择工单后再点击此按钮')
  387. return
  388. }
  389. dialogkhszlog.value = true;
  390. console.log('工单编号',gdbh.value)
  391. console.log('印件编号',yjno.value)
  392. const res = await getOrderYj({ order: gdbh.value ,yjno:yjno.value})
  393. if (res['code'] === 0) {
  394. const { data } = res
  395. data['当前考核设置'] = data['质量考核'] === 0 ? '参与' : '剔除'
  396. data['新考核设置'] = data['当前考核设置']
  397. const arr = [data]
  398. console.log(arr)
  399. khsztableData.value = arr
  400. }
  401. }
  402. //表格
  403. const khsztableData = ref([])
  404. //更新按钮
  405. const renew = async() => {
  406. let params = {};
  407. params.order = khsztableData.value['0']['Yj_gdbh']
  408. params.yj_yjno = khsztableData.value['0']['yj_Yjno']
  409. params.examine = khsztableData.value['0']['新考核设置']
  410. console.log(params)
  411. const res = await updateOrderYj(params);
  412. if (res['code'] === 0) {
  413. ElMessage({type: 'success',message: '更新成功'})
  414. //更新成功刷新表格,获取最新的数据
  415. const res = await getTable({ date:cjsriqi.value, code: _code.value, limit: 9999, page: 1 });
  416. tableData1.value = res.data.map((item) => ({
  417. ...item,
  418. csgd:
  419. parseFloat(item['target_rate']) - parseFloat(item['real_rate']) > 0
  420. ? '√'
  421. : '',
  422. date: date,
  423. 考核: String(item['考核']) === '是' ? '参与' : '否' // 确保数据类型一致
  424. }));
  425. } else {
  426. ElMessage({type: 'error',message: '更新失败'})
  427. }
  428. console.log(res)
  429. }
  430. const handleGetTable = async() => {
  431. const res = await getOrderYj({ order: gdbh.value ,yjno:yjno.value})
  432. if (res['code'] === 0) {
  433. const { data } = res
  434. data['当前考核设置'] = data['质量考核'] === 0 ? '参与' : '剔除'
  435. data['新考核设置'] = data['当前考核设置']
  436. const arr = [data]
  437. console.log(arr)
  438. tableData.value = arr
  439. }
  440. }
  441. //退出按钮
  442. const modelValuelog = async() => {
  443. dialogkhszlog.value = false;
  444. }
  445. // 侧边栏数据
  446. const treeData = ref([])
  447. const getSideData = async() => {
  448. const res = await getSide()
  449. if (res.code === 0) {
  450. const { data } = res
  451. const transformedData = []
  452. for (const [key, value] of Object.entries(data)) {
  453. const [date, total] = key.split('-') // 提取日期和数量
  454. const transformedItem = {
  455. label: `${date}(工单数:${total})`,
  456. date: date,
  457. children: value.map((item) => ({
  458. label: `${item['客户编号']}【${item['客户名称']}】(工单数:${item.total})`,
  459. date: date,
  460. code: item?.['客户编号'],
  461. })),
  462. }
  463. transformedData.push(transformedItem)
  464. }
  465. treeData.value = transformedData
  466. }
  467. }
  468. getSideData()
  469. // 表格数据
  470. const tableCols1 = [
  471. // { label: '超损工单', prop: 'csgd', width: '110' ,sortable:'sortable'},
  472. { label: '工单编号', prop: 'Gd_gdbh', width: '110',sortable:'sortable',fixed:'fixed',align:'left'},
  473. { label: '参与考核', prop: '考核', width: '110' ,sortable:'sortable'},
  474. { label: '印件号', prop: 'jjcp_yjno', width: '70'},
  475. { label: '联数', prop: 'yj_ls', width: '70'},
  476. { label: '产品代号', prop: '成品编码', width: '110' ,sortable:'sortable'},
  477. { label: '印件代号', prop: 'yjdh', width: '110' ,sortable:'sortable'},
  478. { label: '产品名称', prop: '成品名称', width: '250' ,sortable:'sortable'},
  479. { label: '实际投料', prop: '实际投料', width: '90'},
  480. { label: '计量单位', prop: '计量单位', width: '85'},
  481. { label: '入仓日期', prop: 'warehousing_date', width: '110' ,sortable:'sortable'},
  482. { label: '入仓数量', prop: 'warehousing_num', width: '90'},
  483. { label: '目标合格率', prop: 'target_rate', width: '120' ,sortable:'sortable'},
  484. { label: '实际合格率', prop: 'real_rate', width: '120' ,sortable:'sortable'},
  485. { label: '奖惩系数', prop: 'reward_rate', width: '110' ,sortable:'sortable'},
  486. { label: '奖罚金额合计', prop: 'reward_money', width: '140',sortable:'sortable' },
  487. { label: '废品合计', prop: '废品合计', width: '120' ,sortable:'sortable'},
  488. { label: '工单无形损', prop: '工单无形损', width: '120',sortable:'sortable' },
  489. { label: '材料废', prop: '材料废', width: '80' },
  490. { label: '零头处理', prop: '零头处理', width: '90'},
  491. { label: '处发废', prop: '外发废', width: '80' },
  492. { label: '外摊废', prop: '分摊废', width: '80'},
  493. { label: '工单计划损耗', prop: '工单计划损耗', width: '110'},
  494. { label: '工单制程废', prop: 'zcfp', width: '100' },
  495. { label: '工单检验废', prop: '工单质检废', width: '100'},
  496. { label: '年月', prop: 'date', width: '80'},
  497. ]
  498. const tableCols2 = [
  499. { label: '工单编号', prop: 'Gy0_gdbh', width: '115' },
  500. { label: '印件及工序', prop: 'Gy0_yjno', width: '115' },
  501. { label: '工序名称', prop: 'Gy0_gxmc', width: '210' },
  502. { label: '联数', prop: 'Gy0_ls', width: '80' },
  503. { label: '基础损耗', prop: 'Gy0_Rate0', width: '115' },
  504. { label: '损耗率', prop: 'Gy0_Rate1', width: '115' },
  505. { label: '损耗系数', prop: '损耗系数', width: '110' },
  506. { label: '计损色数', prop: 'Gy0_ms', width: '110' },
  507. { label: '计划产量', prop: 'Gy0_计划接货数', width: '110' },
  508. { label: '计划损耗', prop: 'Gy0_计划损耗', width: '110' },
  509. { label: '上报产量', prop: 'total_cl', width: '110' },
  510. { label: '制程废', prop: 'total_fp', width: '110' },
  511. ]
  512. const tableData1 = ref([])
  513. const tableData2 = ref([])
  514. const currentRow = ref({})
  515. const gdbh = ref('')
  516. const jjcp_yjno = ref('')
  517. const date = ref('')
  518. const yjno = ref ('')
  519. const searchInfo = ref('')
  520. watch(currentRow, (value, oldValue, onCleanup) => {
  521. gdbh.value = value?.['Gd_gdbh']
  522. date.value = value?.['date']
  523. yjno.value = value?.['yj_Yjno']
  524. jjcp_yjno.value = value?.['jjcp_yjno']
  525. })
  526. const cjsriqi = ref ('')
  527. const _code = ref('')
  528. // 显示上方表格
  529. const handleNodeClick = async (node) => {
  530. cjsriqi.value = node.date;
  531. if (!node.children) {
  532. const { date, code } = node;
  533. //全局客户编号
  534. _code.value = code
  535. const res = await getTable({ date, code, limit: 9999, page: 1 });
  536. console.log(res.data); // 调试数据
  537. tableData1.value = res.data.map((item) => ({
  538. ...item,
  539. csgd:
  540. parseFloat(item['target_rate']) - parseFloat(item['real_rate']) > 0
  541. ? '√'
  542. : '',
  543. date: date,
  544. 考核: String(item['考核']) === '是' ? '参与' : '否' // 确保数据类型一致
  545. }));
  546. } else {
  547. const { date, code } = node;
  548. const res = await getTable({ date, code: '', limit: 9999, page: 1 });
  549. console.log(res.data); // 调试数据
  550. tableData1.value = res.data.map((item) => ({
  551. ...item,
  552. csgd:
  553. parseFloat(item['target_rate']) - parseFloat(item['real_rate']) > 0
  554. ? '√'
  555. : '',
  556. date: date,
  557. 考核: String(item['考核']) === '是' ? '参与' : '否' // 确保数据类型一致
  558. }));
  559. }
  560. };
  561. // 显示下方表格
  562. const showOrderSuperLossGy = async() => {
  563. jjcp_yjno.value = currentRow.value['jjcp_yjno']
  564. const { Gd_gdbh: order } = currentRow.value
  565. const yjno = jjcp_yjno.value
  566. console.log(yjno)
  567. console.log("order",order)
  568. console.log("yjno",yjno)
  569. const res = await getOrderSuperLossGy({ order,yjno })
  570. if (res.code === 0) {
  571. const { data } = res
  572. tableData2.value = data.map((item) => ({
  573. ...item,
  574. Gy0_yjno: `${item.Gy0_yjno}-${item.Gy0_gxh}`,
  575. Gy0_gxmc:
  576. item.Add_gxmc === ''
  577. ? item.Gy0_gxmc
  578. : `${item.Gy0_gxmc}〖${item.Add_gxmc}〗`,
  579. }))
  580. }
  581. }
  582. // 定位
  583. const handleSearch = async() => {
  584. console.log(searchInfo.value)
  585. //调用搜索接口
  586. const res = await getTable({ search:searchInfo.value,limit:999,page:1})
  587. console.log(res)
  588. tableData1.value = res.data.map((item) => ({
  589. ...item,
  590. csgd:
  591. parseFloat(item['target_rate']) - parseFloat(item['real_rate']) > 0
  592. ? '√'
  593. : '',
  594. date: date,
  595. 考核: String(item['考核']) === '是' ? '参与' : '否'
  596. }))
  597. }
  598. //上方表格字体颜色
  599. function cellClassName({ row, column, rowIndex, columnIndex }) {
  600. if(column.property === '考核' && row.考核 === '参与'){
  601. return 'red-cell'
  602. }
  603. // if ([8,12,].includes(columnIndex)) {
  604. // return 'red-cell'
  605. // }
  606. return ''
  607. }
  608. const printPageRef = ref()
  609. function handleGddy() {
  610. printPageRef.value.open(gdbh.value)
  611. }
  612. const _Gd_gdbh = ref(null)
  613. // =========== 流程单查询 ===========
  614. const pd_lcdlist = ref(false)
  615. const pd_lcdformData = reactive({
  616. gdbh: '',
  617. code: '',
  618. name: '',
  619. yjno: '',
  620. });
  621. // 流程单查询按钮
  622. const processList = ref([])
  623. const pd_lcdlistonClick = async () => {
  624. _Gd_gdbh.value = currentRow.value['Gd_gdbh']
  625. console.log(_Gd_gdbh)
  626. if(_Gd_gdbh.value === '' || _Gd_gdbh.value === null || _Gd_gdbh.value === undefined){
  627. ElMessage({type: 'warning',message: '请选择具体的工单,在进行操作'})
  628. return false;
  629. }else{
  630. pd_lcdformData['gdbh'] = _Gd_gdbh.value;
  631. pd_lcdformData['yjno'] = currentRow.value['jjcp_yjno'];
  632. pd_lcdlist.value = true;
  633. processList.value = []
  634. _getOrderProcessLeft_list();
  635. }
  636. }
  637. const pd_lcdProductValue = async () => {
  638. _getOrderProcessLeft_list();
  639. }
  640. const pd_lcd_treeData = ref([])
  641. const _getOrderProcessLeft_list = async() => {
  642. const order = pd_lcdformData['gdbh']
  643. const yjno = pd_lcdformData['yjno']
  644. try {
  645. // 5.1流程单查询-工单工序生产进程菜单栏
  646. const getOrderProcessLeft_list = await getOrderProcessLeft({order: order,yjno:yjno})
  647. console.log(getOrderProcessLeft_list)
  648. pd_lcdformData['code'] = getOrderProcessLeft_list.data.Gd_info['code']
  649. pd_lcdformData['name'] = getOrderProcessLeft_list.data.Gd_info['name']
  650. pd_lcd_treeData.value = [
  651. {
  652. label: order + '-' + getOrderProcessLeft_list.data.Gd_info['name'],
  653. // label: order + '-' + getOrderProcessLeft_list.data.Gd_info['code'] + '-' + getOrderProcessLeft_list.data.Gd_info['name'],
  654. value: undefined,
  655. children: [],
  656. },
  657. ]
  658. const newData = []
  659. for (const key in getOrderProcessLeft_list.data.Gy_info) {
  660. const temp = getOrderProcessLeft_list.data.Gy_info[key]
  661. const concatenatedValue = `${temp.Gy0_yjno}-${temp.Gy0_gxh} ---> ${temp.Gy0_gxmc}`
  662. newData.push({ label: concatenatedValue, value: temp.Gy0_gxh })
  663. }
  664. pd_lcd_treeData.value[0].children = newData
  665. // 5.2流程单查询-获取工单工序生产进程右侧【进入页面默认显示第一个】
  666. const getOrderProcessRight_list = await getOrderProcessRight({order: order,gxNo: newData[0].value,yjno:yjno})
  667. processList.value = getOrderProcessRight_list.data
  668. } catch (error) {
  669. console.error(error)
  670. }
  671. }
  672. const pd_lcd_handleNodeClick = async(node) => {
  673. if (node.value === undefined) return
  674. const order = pd_lcdformData['gdbh']
  675. const yjno = currentRow.value['jjcp_yjno']
  676. // //5.2流程单查询-获取工单工序生产进程右侧
  677. const getOrderProcessRight_list = await getOrderProcessRight({order: order,gxNo: node.value,yjno:yjno})
  678. console.log(getOrderProcessRight_list)
  679. processList.value = getOrderProcessRight_list.data
  680. }
  681. const exportExcel = () => {
  682. const el = document.getElementById('cjstable');
  683. const filename = '超节损导出.xlsx';
  684. // 1. 获取原始表格数据
  685. const wb = XLSX.utils.table_to_book(el, { raw: true });
  686. const ws = wb.Sheets[wb.SheetNames[0]];
  687. // 2. 定义需要转换为数字的列(基于原始列字母)
  688. const originalNumberColumns = {
  689. 'C': 0,
  690. 'D': 2,
  691. 'G': 4,
  692. 'N': 2,
  693. 'O': 0,
  694. 'P': 0,
  695. 'Q': 0,
  696. 'R': 0,
  697. 'S': 0,
  698. 'T': 0,
  699. 'U': 0,
  700. 'V': 0,
  701. 'W': 0
  702. };
  703. // 3. 创建新工作表(左移后的数据)
  704. const newWs = {};
  705. const range = XLSX.utils.decode_range(ws['!ref']);
  706. // 调整列范围(删除A列)
  707. range.s.c = 0; // 从A列开始(原B列)
  708. range.e.c -= 1; // 结束列减1
  709. newWs['!ref'] = XLSX.utils.encode_range(range);
  710. // 复制其他工作表属性(排除A列)
  711. if (ws['!cols']) newWs['!cols'] = ws['!cols'].slice(1);
  712. if (ws['!rows']) newWs['!rows'] = ws['!rows'];
  713. if (ws['!merges']) newWs['!merges'] = ws['!merges'];
  714. // 4. 左移所有列数据(A列→删除,B列→A列,C列→B列...)
  715. Object.keys(ws).forEach(address => {
  716. if (!address.startsWith('!')) {
  717. const col = address.charAt(0);
  718. const row = address.slice(1);
  719. if (col !== 'A') { // 跳过A列
  720. // 计算新列字母(左移一列)
  721. const newCol = String.fromCharCode(col.charCodeAt(0) - 1);
  722. const newAddress = newCol + row;
  723. // 复制单元格数据
  724. newWs[newAddress] = { ...ws[address] };
  725. }
  726. }
  727. });
  728. // 5. 转换数字格式(基于左移后的列字母)
  729. Object.keys(newWs).forEach(address => {
  730. const col = address.charAt(0);
  731. const originalCol = String.fromCharCode(col.charCodeAt(0));
  732. if (originalNumberColumns[originalCol] !== undefined) {
  733. const cell = newWs[address];
  734. const num = parseFloat(cell.v);
  735. if (!isNaN(num)) {
  736. cell.t = 'n';
  737. cell.v = num;
  738. cell.z = originalNumberColumns[originalCol] === 0
  739. ? '0'
  740. : `0.${'0'.repeat(originalNumberColumns[originalCol])}`;
  741. }
  742. }
  743. });
  744. // 6. 更新工作簿并导出
  745. wb.Sheets[wb.SheetNames[0]] = newWs;
  746. const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
  747. try {
  748. FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
  749. } catch (e) {
  750. console.error('导出失败:', e);
  751. }
  752. return wbout;
  753. };
  754. //选择月份后显示表格数据
  755. const cjsjetableData = reactive([]);
  756. const onchange_ygdy = async () => {
  757. // 获取用户选择的日期
  758. const selectedDate = new Date(ygdy_formData['ygriqi']);
  759. // 手动增加一个月
  760. selectedDate.setMonth(selectedDate.getMonth() + 1);
  761. // 格式化为 YYYY-MM
  762. const formattedDate = selectedDate.toISOString().slice(0, 7);
  763. const EmployeeDataCollectdata = await EmployeeDataCollect({ date: formattedDate });
  764. console.log(EmployeeDataCollectdata);
  765. if (EmployeeDataCollectdata.data.length === 0) {
  766. ElMessage({
  767. type: 'warning',
  768. message: '该月暂无数据',
  769. });
  770. }
  771. // 清空 cjsjetableData
  772. cjsjetableData.splice(0, cjsjetableData.length);
  773. // 遍历 EmployeeDataCollectdata.data 并将所有数组数据合并到 cjsjetableData
  774. if (EmployeeDataCollectdata.data) {
  775. for (const key in EmployeeDataCollectdata.data) {
  776. if (Array.isArray(EmployeeDataCollectdata.data[key])) {
  777. // 对每个数组中的 je 字段进行处理
  778. const processedData = EmployeeDataCollectdata.data[key].map(item => ({
  779. ...item,
  780. je: parseFloat(parseFloat(item.je).toFixed(2)) // 四舍五入并保留两位小数
  781. }));
  782. cjsjetableData.push(...processedData);
  783. }
  784. }
  785. }
  786. };
  787. //导出到Excel
  788. const exportToExcel = ()=>{
  789. const el = document.getElementById('cjsjetableData');
  790. // 获取用户选择的日期
  791. const selectedDate = new Date(ygdy_formData['ygriqi']);
  792. // 手动增加一个月
  793. selectedDate.setMonth(selectedDate.getMonth() + 1);
  794. // 格式化为 YYYY-MM
  795. const formattedDate = selectedDate.toISOString().slice(0, 7);
  796. // 文件名
  797. const filename = `员工超节损金额_${formattedDate}.xlsx`;
  798. const wb = XLSX.utils.table_to_book(el, { raw: true });
  799. // 获取第一个工作表
  800. const ws = wb.Sheets[wb.SheetNames[0]];
  801. // 遍历单元格,设置数字格式(设置从Excel列转化数字格式)
  802. Object.keys(ws).forEach(address => {
  803. if(!address.startsWith('!')) { // 跳过非单元格数据
  804. if(address.startsWith('D')) {
  805. const cell = ws[address];
  806. // 尝试转换为数字
  807. const num = parseFloat(cell.v);
  808. if(!isNaN(num)) {
  809. cell.t = 'n'; // 设置为数字类型
  810. cell.v = num; // 更新值
  811. cell.z = '0.00'; // 设置数字格式(可选)
  812. }
  813. }
  814. }
  815. });
  816. const wbout = XLSX.write(wb, { bookType: 'xlsx', bookSST: true, type: 'array' });
  817. try {
  818. FileSaver.saveAs(new Blob([wbout], { type: 'application/octet-stream' }), filename);
  819. } catch (e) {
  820. console.log(e);
  821. }
  822. return wbout;
  823. }
  824. // 员工打印
  825. // false是弹窗默认关闭
  826. const dialogygdy = ref(false)
  827. const ygdy_formData = reactive({
  828. ygriqi : '',
  829. })
  830. // 点击 超节损员工打印打开弹窗
  831. const ygdy = () => {
  832. dialogygdy.value = true
  833. }
  834. // json
  835. const jsondatas = {"panels":[{"index":0,"name":1,"paperType":"A4","height":210,"width":297,"paperHeader":76.5,"paperFooter":567,"printElements":[{"options":{"left":12,"top":9,"height":40,"width":40,"src":"https://shangbiaopic.11467.com/13/85/13855845.jpg","fit":"","coordinateSync":false,"widthHeightSync":false,"right":55,"bottom":45.989585876464844,"vCenter":35,"hCenter":25.989585876464844,"field":"minong"},"printElementType":{"title":"图片","type":"image"}},{"options":{"left":57,"top":15,"height":14,"width":180,"title":"浙江翌星包装科技有限公司","coordinateSync":false,"widthHeightSync":false,"fontSize":13.5,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":319.5,"top":15,"height":30,"width":168,"title":"员工超结损奖罚统计","right":393,"bottom":36,"vCenter":333,"hCenter":31.125,"coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"fontSize":16.5,"fontWeight":"bold","textAlign":"center","textContentVerticalAlign":"middle"},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":46.5,"top":54,"height":16,"width":90,"title":"文本","field":"riqi","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0,"right":203.2474136352539,"bottom":92.23958587646484,"vCenter":154.4974136352539,"hCenter":71.98958587646484,"hideTitle":true},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":510,"top":52.5,"height":16,"width":48,"title":"打印时间","coordinateSync":false,"widthHeightSync":false,"qrCodeLevel":0},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":556.5,"top":52.5,"height":16,"width":141,"field":"dysj","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"qrCodeLevel":0},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":15,"top":54,"height":16,"width":31.5,"title":"日期","right":90.74478149414062,"bottom":93.0000228881836,"vCenter":48.744781494140625,"hCenter":71.2500228881836,"coordinateSync":false,"widthHeightSync":false,"fontSize":12,"qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":19.5,"top":85.5,"height":202.5,"width":735,"field":"table","groupFieldsFormatter":"function(type,options,data){ return [\"name\"] }","qid":"table_1","right":755.2421951293945,"bottom":147.74480438232422,"vCenter":387.74219512939453,"hCenter":116.99480438232422,"coordinateSync":false,"widthHeightSync":false,"maxRows":25,"tableHeaderBorder":"border","columns":[[{"width":159.78260869565221,"title":"所在部门","field":"szbm","checked":true,"columnId":"szbm","fixed":false,"rowspan":1,"colspan":1},{"width":191.73913043478257,"title":"员工编号","field":"ygbh","checked":true,"columnId":"ygbh","fixed":false,"rowspan":1,"colspan":1},{"width":191.73913043478257,"title":"员工姓名","field":"ygxm","checked":true,"columnId":"ygxm","fixed":false,"rowspan":1,"colspan":1},{"width":191.73913043478257,"title":"超节损金额","field":"cjsje","checked":true,"columnId":"cjsje","fixed":false,"rowspan":1,"colspan":1}]]},"printElementType":{"title":"表格","type":"table","editable":true,"columnDisplayEditable":true,"columnDisplayIndexEditable":true,"columnTitleEditable":true,"columnResizable":true,"columnAlignEditable":true,"isEnableEditField":true,"isEnableContextMenu":true,"isEnableInsertRow":true,"isEnableDeleteRow":true,"isEnableInsertColumn":true,"isEnableDeleteColumn":true,"isEnableMergeCell":true}}],"paperNumberLeft":822,"paperNumberTop":501,"paperNumberDisabled":true,"paperNumberContinue":true,"rotate":true,"orient":2,"watermarkOptions":{},"panelLayoutOptions":{}}]}
  836. const onclick_ygdy = async () => {
  837. // 获取用户选择的日期
  838. const selectedDate = new Date(ygdy_formData['ygriqi']);
  839. // 手动增加一个月
  840. selectedDate.setMonth(selectedDate.getMonth() + 1);
  841. // 格式化为 YYYY-MM
  842. const formattedDate = selectedDate.toISOString().slice(0, 7);
  843. // 引入打印初始化
  844. hiprint.init();
  845. const hiprintTemplate = new hiprint.PrintTemplate({ template: jsondatas });
  846. // 获取数据
  847. const res = await EmployeeDataCollect({ date: formattedDate });
  848. console.log(res);
  849. const { data } = res;
  850. // 将数据转换为目标格式
  851. const dataSource = { 'table': [] };
  852. // 定义需要处理的车间列表
  853. const workshops = ['凹丝印车间', '印后车间', '检验车间', '烫模车间', '胶印车间'];
  854. // 遍历车间列表,处理每个车间的数据
  855. workshops.forEach(workshop => {
  856. if (data[workshop] && Array.isArray(data[workshop])) {
  857. data[workshop].forEach(value => {
  858. dataSource.table.push({
  859. 'szbm': value.cj,
  860. 'ygbh': value.bh,
  861. 'ygxm': value.xm,
  862. 'cjsje': parseFloat(value.je).toFixed(2) // 保留两位小数
  863. });
  864. });
  865. } else {
  866. console.warn(`车间 "${workshop}" 数据不存在或格式不正确,已跳过`);
  867. }
  868. });
  869. console.log(dataSource); // 打印处理后的数据
  870. // 这里可以继续使用 hiprintTemplate 打印数据
  871. // // 处理“印刷车间”B班的数据
  872. // let isFirstB班 = true;
  873. // for (const [key, value] of Object.entries(data['印刷车间']['B班'])) {
  874. // const [ygbh, ygxm] = key.split('(');
  875. // dataSource.table.push({
  876. // 'szbm': isFirstB班 ? '印刷车间' : '',
  877. // 'banzu': isFirstB班 ? 'B班' : '',
  878. // 'ygbh': ygbh,
  879. // 'ygxm': ygxm.replace(')', ''),
  880. // 'cjsje': value.money,
  881. // 'beizhu': value.gdbh
  882. // });
  883. // isFirstB班 = false;
  884. // }
  885. // // 添加“印刷车间”B班的合计行
  886. // dataSource.table.push({
  887. // 'szbm': '',
  888. // 'banzu': '车间班组合计',
  889. // 'ygbh': '',
  890. // 'ygxm': '',
  891. // 'cjsje': data['yinshuaB']
  892. // });
  893. // // 处理“印后车间”A班的数据
  894. // let isFirst印后A班 = true;
  895. // for (const [key, value] of Object.entries(data['印后车间']['A班'])) {
  896. // const [ygbh, ygxm] = key.split('(');
  897. // dataSource.table.push({
  898. // 'szbm': isFirst印后A班 ? '印后车间' : '',
  899. // 'banzu': isFirst印后A班 ? 'A班' : '',
  900. // 'ygbh': ygbh,
  901. // 'ygxm': ygxm.replace(')', ''),
  902. // 'cjsje': value.money,
  903. // 'beizhu': value.gdbh
  904. // });
  905. // isFirst印后A班 = false;
  906. // }
  907. // // 添加“印后车间”A班的合计行
  908. // dataSource.table.push({
  909. // 'szbm': '',
  910. // 'banzu': '车间班组合计',
  911. // 'ygbh': '',
  912. // 'ygxm': '',
  913. // 'cjsje': data['yinhouA']
  914. // });
  915. // // 处理“印后车间”B班的数据
  916. // let isFirst印后B班 = true;
  917. // for (const [key, value] of Object.entries(data['印后车间']['B班'])) {
  918. // const [ygbh, ygxm] = key.split('(');
  919. // dataSource.table.push({
  920. // 'szbm': isFirst印后B班 ? '印后车间' : '',
  921. // 'banzu': isFirst印后B班 ? 'B班' : '',
  922. // 'ygbh': ygbh,
  923. // 'ygxm': ygxm.replace(')', ''),
  924. // 'cjsje': value.money,
  925. // 'beizhu': value.gdbh
  926. // });
  927. // isFirst印后B班 = false;
  928. // }
  929. // // 添加“印后车间”B班的合计行
  930. // dataSource.table.push({
  931. // 'szbm': '',
  932. // 'banzu': '车间班组合计',
  933. // 'ygbh': '',
  934. // 'ygxm': '',
  935. // 'cjsje': data['yinhouB']
  936. // });
  937. // 获取当前日期
  938. const today = new Date();
  939. const year = today.getFullYear();
  940. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  941. const day = String(today.getDate()).padStart(2, '0');
  942. const hours = String(today.getHours()).padStart(2, '0');
  943. const minutes = String(today.getMinutes()).padStart(2, '0');
  944. const seconds = String(today.getSeconds()).padStart(2, '0');
  945. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  946. const currentDates = `${year}-${month}-${day}`;
  947. // 初始化数据结构
  948. const tableDataFormatted = {
  949. "minong": "/src/assets/logotx.png",
  950. "dysj": currentDate,
  951. "riqi": data['日期'],
  952. "table": dataSource['table'],
  953. "cjbzhj": data['total'] // 将total作为车间班组合计
  954. };
  955. // 输出结果,确保数据格式正确
  956. console.log(tableDataFormatted);
  957. // 打印结果
  958. hiprintTemplate.print(tableDataFormatted);
  959. }
  960. //入仓工单数据按钮
  961. const onrcgdsj = ref(false)
  962. const rcgdsjrq = ref('')
  963. const rcgdsj = async () => {
  964. console.log('点击了入仓工单数据')
  965. if(gdbh.value && jjcp_yjno.value){
  966. rcgdsjrq.value=''
  967. }else{
  968. rcgdsjrq.value = `${cjsriqi.value.slice(0, 4)}-${cjsriqi.value.slice(4)}`;
  969. console.log(rcgdsjrq.value)
  970. }
  971. onrcgdsj.value = true
  972. }
  973. //选择日期
  974. const onchange_data = (val) => {
  975. if (val) {
  976. // 将日期对象转换为本地时间的年月格式
  977. const year = val.getFullYear()
  978. const month = (val.getMonth() + 1).toString().padStart(2, '0')
  979. rcgdsjrq.value = `${year}-${month}`
  980. } else {
  981. rcgdsjrq.value = ''
  982. }
  983. }
  984. const rcgdsjonDialog = async () => {
  985. console.log('点击了入仓工单数据确定')
  986. //如果有工单和印件号
  987. if(gdbh.value && jjcp_yjno.value ){
  988. console.log('计算单个工单')
  989. const res = await orderLossData({ mouth:'',gdbh:gdbh.value,yjno:jjcp_yjno.value})
  990. if(res.code === 0){
  991. ElMessage({type:'success',message:'计算成功'})
  992. handleNodeClick();
  993. } else{ElMessage({type:'error',message:'计算失败'})
  994. }
  995. }else if(gdbh.value === '' && jjcp_yjno.value === ''){
  996. console.log('计算整月')
  997. const res = await orderLossData({ mouth:rcgdsjrq.value,gdbh:gdbh.value,yjno:jjcp_yjno.value})
  998. if(res.code === 0){
  999. ElMessage({type:'success',message:'计算成功'})
  1000. handleNodeClick();
  1001. } else{ElMessage({type:'error',message:'计算失败'})
  1002. }
  1003. }
  1004. }
  1005. const rcgdsjcloseDialog = () => {onrcgdsj.value = false}
  1006. //关闭窗口
  1007. const exitXzgdtl = (data) => {
  1008. dialogXzgdtl.value = data;
  1009. };
  1010. </script>
  1011. <style scoped>
  1012. :deep(.plan-usage-low div) {
  1013. color: red !important;
  1014. }
  1015. .JKWTree-container {
  1016. display: flex;
  1017. }
  1018. .JKWTree-tree {
  1019. width: 100%;
  1020. background-color: #fff;
  1021. /*background-color: rgba(241, 224, 224, 0.99);*/
  1022. padding: 10px;
  1023. margin-right: 20px;
  1024. }
  1025. .JKWTree-tree h3 {
  1026. font-size: 15px;
  1027. font-weight: 700;
  1028. margin: 10px 0;
  1029. }
  1030. .JKWTree-content {
  1031. flex: 1;
  1032. }
  1033. :deep(.el-table .yellow-row) {
  1034. background: #ffff80;
  1035. }
  1036. :deep(.red-cell div) {
  1037. color: #ff0000 !important;
  1038. }
  1039. /* 选中某行时的背景色 */
  1040. :deep(.el-table__body tr.current-row) > td {
  1041. background: #ff80ff !important;
  1042. }
  1043. </style>
  1044. <style scoped>
  1045. :deep(.el-table td .cell) {
  1046. line-height: 20px !important;
  1047. }
  1048. :deep(.el-tabs__header) {
  1049. margin-bottom: 0;
  1050. }
  1051. .search {
  1052. margin-left: 0px !important;
  1053. margin-right: 10px !important;
  1054. }
  1055. .bt {
  1056. margin-left: 2px !important;
  1057. padding: 3px !important;
  1058. font-size: 12px;
  1059. }
  1060. .el-tabs__header {
  1061. margin: 0px !important;
  1062. }
  1063. .gva-table-box {
  1064. padding: 0px !important;
  1065. }
  1066. .mab {
  1067. margin-bottom: 5px;
  1068. }
  1069. /*!* 流程单查询按钮颜色控制未完成*/
  1070. :deep(.custom-button.el-button--info) {
  1071. background-color: palegreen !important;
  1072. color: #155724;
  1073. font-size: 20px;
  1074. border-color: #c3e6cb;
  1075. }
  1076. /* 已完成 */
  1077. :deep(.custom-button.el-button--danger) {
  1078. background-color: rgb(236, 135, 135) !important;
  1079. color: #721c24;
  1080. font-size: 20px;
  1081. border-color: #f5c6cb;
  1082. }
  1083. /* 表格选中表变文字字体 */
  1084. :deep(.el-table__body tr.current-row)>td .el-tooltip {
  1085. font-size: 16px;
  1086. color: black;
  1087. }
  1088. :deep(.el-table .el-table__header th .cell) {
  1089. white-space: nowrap;
  1090. overflow: hidden;
  1091. text-overflow: ellipsis;
  1092. }
  1093. </style>