caiqiebaogong.vue 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-content >
  5. <div class="gva-table-box">
  6. <div style="display: flex; align-items: baseline; margin-bottom: 10px;">
  7. <h1 style="margin: 0;">{{_code}}完工报工</h1>
  8. </div>
  9. <el-row :gutter="10" style="align-items: center; margin-bottom: 20px;">
  10. <!-- 子订单编号输入框 -->
  11. <el-col :span="4" style="padding: 0px;margin: 0px;">
  12. <el-input v-model="add_searchInfo" placeholder="请扫描子订单编号"@keyup.enter="add_onSubmit" id="searchInput" style="width: 100%; height: 50px;"/>
  13. </el-col>
  14. <!-- 查询按钮 -->
  15. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  16. <el-button type="primary" icon="search" @click="add_onSubmit"style="height: 50px;width: 80px;">查询</el-button>
  17. </el-col>
  18. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  19. <el-text style="font-size: 30px;">机台号</el-text>
  20. </el-col>
  21. <!-- 机台号输入框 -->
  22. <el-col :span="2"><el-input v-model="add_formData['机台号']" readonly style="width: 100%; height: 40px;"/></el-col>
  23. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  24. <el-text style="font-size: 30px;">工序</el-text>
  25. </el-col>
  26. <!-- 工序输入框 -->
  27. <el-col :span="2"><el-input v-model="add_formData['工序']" readonly style="width: 100%; height: 40px;" /></el-col>
  28. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  29. <el-text style="font-size: 30px;">组别</el-text>
  30. </el-col>
  31. <!-- 组别输入框 -->
  32. <el-col :span="2"><el-input v-model="add_formData['组别']" readonly style="width: 100%; height: 40px;" /></el-col>
  33. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  34. <el-text style="font-size: 30px;">人员</el-text>
  35. </el-col>
  36. <!-- 人员输入框 -->
  37. <el-col :span="2"><el-input v-model="add_formData['人员']" readonly style="width: 100%; height: 40px;"/></el-col>
  38. </el-row>
  39. <el-row :gutter="0">
  40. <el-col :span="2.5"><el-text style="font-size: 30px;margin-left: 90px;">尺 码</el-text></el-col>
  41. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmformdata.cm1" id="cm1" readonly style="width: 65px;height: 40px;" /></el-col>
  42. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmformdata.cm2" id="cm2" readonly style="width: 65px;height: 40px;" /></el-col>
  43. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmformdata.cm3" id="cm3" readonly style="width: 65px;height: 40px;" /></el-col>
  44. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmformdata.cm4" id="cm4" readonly style="width: 65px;height: 40px;" /></el-col>
  45. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmformdata.cm5" id="cm5" readonly style="width: 65px;height: 40px;" /></el-col>
  46. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmformdata.cm6" id="cm6" readonly style="width: 65px;height: 40px;" /></el-col>
  47. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmformdata.cm7" id="cm7" readonly style="width: 65px;height: 40px;" /></el-col>
  48. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmformdata.cm8" id="cm8" readonly style="width: 65px;height: 40px;" /></el-col>
  49. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmformdata.cm9" id="cm9" readonly style="width: 65px;height: 40px;" /></el-col>
  50. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmformdata.cm10" id="cm10" readonly style="width: 65px;height: 40px;" /></el-col>
  51. <el-col :span="1"><el-input v-model="cmformdata.cm11" id="cm11" readonly style="width: 65px;height: 40px;" /></el-col>
  52. </el-row>
  53. <el-row :gutter="0">
  54. <el-col :span="2.5"><el-text style="font-size: 30px;margin-left: 70px;">制单数</el-text></el-col>
  55. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmslformdata.cmsl1" id="zdsc1" readonly style="width: 65px;height: 40px;" /></el-col>
  56. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmslformdata.cmsl2" id="zdsc2" readonly style="width: 65px;height: 40px;" /></el-col>
  57. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmslformdata.cmsl3" id="zdsc3" readonly style="width: 65px;height: 40px;" /></el-col>
  58. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmslformdata.cmsl4" id="zdsc4" readonly style="width: 65px;height: 40px;" /></el-col>
  59. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmslformdata.cmsl5" id="zdsc5" readonly style="width: 65px;height: 40px;" /></el-col>
  60. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmslformdata.cmsl6" id="zdsc6" readonly style="width: 65px;height: 40px;" /></el-col>
  61. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmslformdata.cmsl7" id="zdsc7" readonly style="width: 65px;height: 40px;" /></el-col>
  62. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmslformdata.cmsl8" id="zdsc8" readonly style="width: 65px;height: 40px;" /></el-col>
  63. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmslformdata.cmsl9" id="zdsc9" readonly style="width: 65px;height: 40px;" /></el-col>
  64. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="cmslformdata.cmsl10" id="zdsc10" readonly style="width: 65px;height: 40px;" /></el-col>
  65. <el-col :span="1"><el-input v-model="cmslformdata.zdtotal" id="zdtotal" readonly style="width: 65px;height: 40px;" /></el-col>
  66. </el-row>
  67. <el-row :gutter="0">
  68. <el-col :span="2.5"><el-text style="font-size: 30px;margin-left: 10px;">新增实裁数</el-text></el-col>
  69. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="scsformdata.scs1" @input="updateTotal" id="scs1" style="width: 65px;height: 40px;" /></el-col>
  70. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="scsformdata.scs2" @input="updateTotal" id="scs2" style="width: 65px;height: 40px;" /></el-col>
  71. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="scsformdata.scs3" @input="updateTotal" id="scs3" style="width: 65px;height: 40px;" /></el-col>
  72. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="scsformdata.scs4" @input="updateTotal" id="scs4" style="width: 65px;height: 40px;" /></el-col>
  73. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="scsformdata.scs5" @input="updateTotal" id="scs5" style="width: 65px;height: 40px;" /></el-col>
  74. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="scsformdata.scs6" @input="updateTotal" id="scs6" style="width: 65px;height: 40px;" /></el-col>
  75. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="scsformdata.scs7" @input="updateTotal" id="scs7" style="width: 65px;height: 40px;" /></el-col>
  76. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="scsformdata.scs8" @input="updateTotal" id="scs8" style="width: 65px;height: 40px;" /></el-col>
  77. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="scsformdata.scs9" @input="updateTotal" id="scs9" style="width: 65px;height: 40px;" /></el-col>
  78. <el-col :span="1" style="padding-right: 5px;margin-right: 11px;"><el-input v-model="scsformdata.scs10" @input="updateTotal" id="scs10" style="width: 65px;height: 40px;" /></el-col>
  79. <el-col :span="1"><el-input v-model="scsformdata.sctotal" id="sctotal" readonly style="width: 65px;height: 40px;" /></el-col>
  80. <el-button type="primary" @click="add_Dialog"
  81. style="width: 100px;height: 60px;font-size: 20px;margin: 0px 0 0 20px">报工</el-button>
  82. <el-button type="primary" @click="gd_yulan"
  83. style="width: 100px;height: 60px;font-size: 20px;margin: 0px 0 0 15px">工单预览</el-button>
  84. </el-row>
  85. <el-main>
  86. <!-- 表格数据 -->
  87. <el-tabs v-model="activeName">
  88. <el-tab-pane label="产量进度汇总记录" @click="showTable('产量进度汇总记录')" name="first">
  89. <el-table ref="multipleTable" style="width: 100%;height: 52vh" tooltip-effect="dark"
  90. :row-style="{ height: '50px' }" :header-cell-style="{ padding: '5px', fontSize: '20px' }"
  91. :cell-style="{ padding: '10px', fontSize: '20px' }" :header-row-style="{ height: '20px' }"
  92. :data="jdhz_tableData" border row-key="ID"
  93. size="small"
  94. show-summary :summary-method="getSummaries"
  95. highlight-current-row="true" @row-dblclick="updateCompanyFunc"
  96. @row-click="tableRowClick" :show-overflow-tooltip="true"
  97. @selection-change="handleSelectionChange">
  98. <!-- <el-table-column type="selection" width="55" /> -->
  99. <!-- <el-table-column sortable align="center" label="订单编号" prop="订单编号" width="120"/> -->
  100. <el-table-column align="left" label="订单子编号" prop="子订单编号" width="130"/>
  101. <!-- <el-table-column sortable align="left" label="客户编号" prop="客户编号" width="120"/> -->
  102. <el-table-column align="left" label="款号" prop="款号" width="140" />
  103. <!-- <el-table-column sortable align="left" label="款式" prop="款式" width="100" /> -->
  104. <el-table-column align="left" label="色系名称" prop="颜色" width="100" />
  105. <!-- <el-table-column sortable align="left" label="组别" prop="组别" width="100" /> -->
  106. <el-table-column v-for="item in sizeDatas" :key="item" align="left" :label="item"
  107. :prop="item" width="60" :cell-style="cellStyle">
  108. <template v-slot="scope">
  109. <div
  110. style="width: 80px;"
  111. @click="handleSizeClick(scope.$index, item, scope.row)">
  112. {{ scope.row[item] }}
  113. </div>
  114. </template>
  115. </el-table-column>
  116. <!-- <el-table-column sortable align="left" label="制单总数" prop="制单数" width="108" /> -->
  117. <el-table-column align="left" label="裁剪数" prop="裁剪数" width="90" />
  118. <el-table-column align="left" label="上报时间" prop="上报时间" width="160" />
  119. </el-table>
  120. </el-tab-pane>
  121. <el-tab-pane label="订单资料附件" name="third">
  122. <el-table ref="multipleTable"
  123. :row-style="{ height: '30px' }"
  124. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '30px' }"
  125. :header-cell-style="{ padding: '0px' }"
  126. :show-overflow-tooltip="true"
  127. :cell-class-name="planUsageCellClass"
  128. highlight-current-row="true"
  129. @row-dblclick="gdbomupdateCompanyFunc"
  130. style="width: 100%;height: 36vh" border tooltip-effect="dark" :data="ddtableData" row-key="ID"
  131. @selection-change="fjSelectionChange">
  132. <el-table-column align="left" label="关联编号" prop="关联编号" width="115"/>
  133. <el-table-column align="left" label="备注" prop="附件备注" width="110"/>
  134. <el-table-column align="left" label="文件类型" prop="附件类型" width="100"/>
  135. <el-table-column align="left" label="建档时间" prop="sys_rq" width="160"/>
  136. <el-table-column align="left" label="建档用户" prop="sys_id" width="200"/>
  137. </el-table>
  138. </el-tab-pane>
  139. <el-tab-pane label="技术附件" @click="showTable('技术附件')" name="fourth">
  140. <el-table ref="multipleTable"
  141. :row-style="{ height: '30px' }"
  142. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '30px' }"
  143. :header-cell-style="{ padding: '0px' }"
  144. :show-overflow-tooltip="true"
  145. :cell-class-name="planUsageCellClass"
  146. highlight-current-row="true"
  147. @row-dblclick="ExcelShow"
  148. style="width: 100%;height: 36vh" border tooltip-effect="dark" :data="jstableData" row-key="ID" @selection-change="handleSelectionChange">
  149. <!-- <el-table-column type="selection" width="55" /> -->
  150. <el-table-column align="left" label="关联编号" prop="关联编号" width="115"/>
  151. <el-table-column align="left" label="备注" prop="附件备注" width="110"/>
  152. <el-table-column align="left" label="文件类型" prop="附件类型" width="100"/>
  153. <el-table-column align="left" label="建档时间" prop="sys_rq" width="160"/>
  154. <el-table-column align="left" label="建档用户" prop="sys_id" width="200"/>
  155. </el-table>
  156. </el-tab-pane>
  157. </el-tabs>
  158. </el-main>
  159. </div>
  160. <!-- 是否订单尾包确认弹窗 -->
  161. <el-dialog v-model="DialogVisible" title="是否订单尾包" destroy-on-close width="30%" style="top: 20%;">
  162. <h3>请再次确认是否该订单产品已全部报工,该批为订单尾包?</h3>
  163. <div class="dialog-footer" style="text-align: right;">
  164. <el-button @click="confirmDialogVisible">取消</el-button>
  165. <el-button type="primary" @click="handleConfirm">确认</el-button>
  166. </div>
  167. </el-dialog>
  168. <!-- 查看技术附件弹窗 -->
  169. <el-dialog v-model="luckyexcelVisible" :before-close="luckyexcelCloseDialog" width="100%" top="0vh">
  170. <div id="luckyexcel" style="width: 100%;height: 100vh;"></div>
  171. </el-dialog>
  172. </layout-content>
  173. </layout>
  174. <PrintPage ref="printPageRef" />
  175. <!-- </el-main> -->
  176. </div>
  177. </template>
  178. <script>
  179. export default {
  180. data() {
  181. return {
  182. currentTable: '', // 当前展示的表格
  183. activeName: 'first',
  184. dialogFormVisible: false,
  185. formDataTest: {
  186. imageUrl: '' // 添加一个字段来保存上传的图片路径
  187. },
  188. rule: {} // 初始化rule对象
  189. };
  190. },
  191. methods: {
  192. handleKeyDown(event, prevId, currentId, nextId) {
  193. const currentElement = document.getElementById(currentId);
  194. const isEmpty = currentElement.value === '';
  195. const atStart = currentElement.selectionStart === 0;
  196. const atEnd = currentElement.selectionStart === currentElement.value.length;
  197. switch (event.keyCode) {
  198. case 13: // Enter
  199. case 40: // 向下箭头
  200. if (nextId) {
  201. document.getElementById(nextId).focus();
  202. }
  203. break;
  204. case 38: // 向上箭头
  205. if (prevId) {
  206. document.getElementById(prevId).focus();
  207. }
  208. break;
  209. case 8: // 删除键
  210. if (prevId && (isEmpty || atStart)) {
  211. document.getElementById(prevId).focus();
  212. }
  213. break;
  214. case 37: // 向左箭头
  215. if (prevId && atStart) {
  216. document.getElementById(prevId).focus();
  217. }
  218. break;
  219. case 39: // 向右箭头
  220. if (nextId && atEnd) {
  221. document.getElementById(nextId).focus();
  222. }
  223. break;
  224. default:
  225. break;
  226. }
  227. },
  228. },
  229. };
  230. </script>
  231. <script setup>
  232. // 全量引入格式化工具 请按需保留
  233. import $script from 'scriptjs'
  234. import $ from 'jquery';
  235. import LuckyExcel from 'luckyexcel';
  236. import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue';
  237. import {ref, reactive} from 'vue';
  238. import {getSpotList,getInfo,OrderAttachments,getTabByGdbh,search} from '@/api/mes/job';
  239. import {getMachineMac} from '@/api/jixiaoguanli/jitairibaobiao'
  240. import {getMac} from '@/api/jixiaoguanli/baogong'
  241. import {ElMessage} from "element-plus";
  242. import PrintPage from '../yunyin/shengchanguanli/components/print.vue';
  243. import { useUserStore } from '@/pinia/modules/user';
  244. defineOptions({name: 'Company'})
  245. //获取登录用户信息
  246. const userStore = useUserStore()
  247. const _username = ref('')
  248. _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
  249. console.log('获取用户名称',_username.value)
  250. //全局获取当前日期
  251. const today = new Date();
  252. const year = today.getFullYear();
  253. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  254. const day = String(today.getDate()).padStart(2, '0');
  255. const hours = String(today.getHours()).padStart(2, '0');
  256. const minutes = String(today.getMinutes()).padStart(2, '0');
  257. const seconds = String(today.getSeconds()).padStart(2, '0');
  258. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  259. const currentDates = `${year}-${month}-${day}`;
  260. const printPageRef = ref()
  261. const add_searchInfo = ref('')
  262. //全局获取code,接口接收code
  263. const _code = '裁剪'
  264. //全局接口接受的物理地址
  265. const Machine = ref('')
  266. //全局获取UniqId
  267. const UniqId = ref('')
  268. //物理地址获取机台编号
  269. const getMachineMacdata = async () => {
  270. try {
  271. const data = await getMachineMac({sys_sbID:Machine.value});
  272. if (data.data === null) {
  273. ElMessage({
  274. type: 'error',
  275. message: '未获取到机台编号请确认MAC地址或与管理员联系'
  276. })
  277. return;
  278. }
  279. // console.log(data)
  280. add_formData['机台号'] = data.data['机台号']
  281. add_formData['工序'] = data.data['生产工序']
  282. add_formData['组别'] = data.data['组别']
  283. add_formData['人员'] = data.data['组长']
  284. setTimeout(() => {
  285. const inputElement = document.getElementById('searchInput');
  286. if (inputElement) {
  287. inputElement.focus();
  288. }
  289. }, 100); // 延迟100毫秒
  290. } catch (error) {
  291. console.error(error)
  292. }
  293. }
  294. //自动获取物理地址
  295. const GetAddr = () => {
  296. var xmlhttp = null;
  297. var res;
  298. if (window.XMLHttpRequest) {
  299. xmlhttp = new XMLHttpRequest();
  300. } else if (window.ActiveXObject) {
  301. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  302. }
  303. // 2. 设置回调函数
  304. xmlhttp.onreadystatechange = function() {
  305. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  306. res = eval('('+xmlhttp.response+')');
  307. let result = ''
  308. for (let i = 0; i < res.macAddress.length; i++) {
  309. if (i % 2 === 0 && i !== 0) {
  310. result += '-' // 根据实际需求修改分隔符
  311. }
  312. result += res.macAddress[i]
  313. }
  314. Machine.value = result
  315. getMachineMacdata(Machine.value)
  316. }
  317. }
  318. // 3. 打开一个连接
  319. xmlhttp.open("get", "http://127.0.0.1:8090/init")
  320. // 5. 发送
  321. xmlhttp.send();
  322. }
  323. // getMachineMacdata();
  324. GetAddr()
  325. //技术附件
  326. const add_formData = reactive({
  327. 机台号: '',
  328. 工序: '',
  329. 组别: '',
  330. 人员: '',
  331. 尺码: '',
  332. 数量: '',
  333. 是否订单尾包: '',
  334. });
  335. //清空对象的属性值
  336. const gd_clearFormData = () => {
  337. Object.keys(add_formData).forEach(key => {
  338. add_formData[key] = '';
  339. });
  340. };
  341. // 尺码
  342. const cmformdata = reactive({
  343. cm1:'',
  344. cm2:'',
  345. cm3:'',
  346. cm4:'',
  347. cm5:'',
  348. cm6:'',
  349. cm7:'',
  350. cm8:'',
  351. cm9:'',
  352. cm10:'',
  353. cm11:'合计',
  354. });
  355. // 制单数
  356. const cmslformdata = reactive({
  357. cmsl1: '',
  358. cmsl2: '',
  359. cmsl3: '',
  360. cmsl4: '',
  361. cmsl5: '',
  362. cmsl6: '',
  363. cmsl7: '',
  364. cmsl8: '',
  365. cmsl9: '',
  366. cmsl10: '',
  367. zdtotal: ''
  368. });
  369. // 实裁数
  370. const scsformdata = reactive({
  371. scs1:'',
  372. scs2:'',
  373. scs3:'',
  374. scs4:'',
  375. scs5:'',
  376. scs6:'',
  377. scs7:'',
  378. scs8:'',
  379. scs9:'',
  380. scs10:'',
  381. sctotal:'',
  382. });
  383. //实裁相加
  384. function updateTotal() {
  385. // 直接指定要累加的属性名
  386. const relevantKeys = ['scs1', 'scs2', 'scs3', 'scs4', 'scs5', 'scs6', 'scs7', 'scs8', 'scs9', 'scs10'];
  387. const values = relevantKeys.map(key => parseInt(scsformdata[key], 10) || 0); // 使用 || 0 来处理可能的 NaN 或 undefined/null
  388. scsformdata.sctotal = values.reduce((sum, value) => sum + value, 0);
  389. }
  390. //进度汇总表格数据
  391. const add_tableData = reactive([]);
  392. const jdhz_tableData = reactive([]);
  393. const _order = ref('');
  394. const _UniqId = ref('');
  395. //尺寸列表
  396. const sizeDatas = reactive([])
  397. //技术附件
  398. const jstableData = reactive([])
  399. const ddtableData = reactive([])
  400. const _list = ref('');
  401. //查询
  402. const add_onSubmit = async ()=>{
  403. if(add_searchInfo.value === '' || add_searchInfo.value === undefined){
  404. const WorkListdata = [];
  405. // add_tableData.splice(0,add_tableData.length,...WorkListdata);
  406. jdhz_tableData.splice(0,jdhz_tableData.length,...WorkListdata);
  407. ElMessage({type: 'warning',message: '搜索内容不能为空' })
  408. return;
  409. }
  410. // 如果没有以"DC"开头,自动补充添加DC
  411. if (!add_searchInfo.value.startsWith('DC')) {
  412. add_searchInfo.value = 'DC' + add_searchInfo.value;
  413. }
  414. sizeDatas.length = 0;
  415. _order.value = add_searchInfo.value;
  416. //进度汇总表格数据
  417. const getSpotLists = await getSpotList({order:_order.value,code:_code});
  418. if(getSpotLists.data.total === 0){
  419. ElMessage({type: 'warning',message: '此订单未出库,请先出库' })
  420. return false
  421. }
  422. if(add_searchInfo.value === ''){
  423. //光标跳转搜索框
  424. _searchInput()
  425. }else{
  426. setTimeout(() => {
  427. const inputElement = document.getElementById('scs1');
  428. if (inputElement) {
  429. inputElement.focus();
  430. }
  431. }, 100);//100毫秒
  432. }
  433. sizeDatas.splice(0, getSpotLists.data.headers.length, ...getSpotLists.data.headers);
  434. jdhz_tableData.splice(0, jdhz_tableData.length, ...getSpotLists.data.table);
  435. //xlsx附件
  436. const searchValue = add_searchInfo.value.split('-')[0];
  437. const jsOrderAttachments = await OrderAttachments({order:searchValue,desc:'技术附件'})
  438. const ddOrderAttachments = await OrderAttachments({order:searchValue,desc:'订单资料附件'})
  439. jstableData.splice(0,jsOrderAttachments.data.length,...jsOrderAttachments.data);
  440. ddtableData.splice(0,ddOrderAttachments.data.length,...ddOrderAttachments.data);
  441. _list.value = getSpotLists.data.list
  442. _UniqId.value = getSpotLists.data.list.UniqId
  443. const keys1 = ['cm1', 'cm2', 'cm3', 'cm4','cm5','cm6','cm7','cm8','cm9','cm10',];
  444. const keys2 = ['cmsl1', 'cmsl2', 'cmsl3', 'cmsl4','cmsl5','cmsl6','cmsl7','cmsl8','cmsl9','cmsl10','zdtotal',];
  445. if(_order.value.includes('-')){
  446. for (let key of keys1) {
  447. if (getSpotLists.data.list.hasOwnProperty(key)) { // 确保键存在于对象中
  448. cmformdata[key] = getSpotLists.data.list[key];
  449. }
  450. }
  451. for (let key of keys2) {
  452. if (getSpotLists.data.list.hasOwnProperty(key)) { // 确保键存在于对象中
  453. cmslformdata[key] = getSpotLists.data.list[key];
  454. }
  455. }
  456. }else{
  457. for (let key of keys1) {
  458. cmformdata[key] = '';
  459. }
  460. for (let key of keys2) {
  461. cmslformdata[key] = '';
  462. }
  463. }
  464. // getSummaries();
  465. };
  466. //合计
  467. const getSummaries = (param) => {
  468. const { columns, data } = param;
  469. const sums = {};
  470. const summableLabels = [...sizeDatas, "裁剪总数"];
  471. columns.forEach((column, index) => {
  472. if (index === 1) {
  473. sums[index] = '总数量合计';
  474. return;
  475. }
  476. if (summableLabels.includes(column.label)) {
  477. const values = data.map(item => Number(item[column.property]));
  478. // 检查数组中是否所有值都是 NaN
  479. if (!values.every(value => isNaN(value))) {
  480. sums[index] = values.reduce((prev, curr) => {
  481. const value = Number(curr);
  482. if (!isNaN(value)) {
  483. return prev + value;
  484. }
  485. return prev;
  486. }, 0);
  487. // 如果需要,可以在这里添加单位
  488. // sums[index] += ' 件';
  489. } else {
  490. sums[index] = '';
  491. }
  492. }
  493. });
  494. return sums;
  495. };
  496. //订单资料excel展示
  497. const gdbomupdateCompanyFunc = (row) =>{
  498. // 加载插件和样式
  499. const loadScriptsAndStyles = () => {
  500. $.getScript('/luckysheet/plugins/js/plugin.js', () => {
  501. $script('/luckysheet/luckysheet.umd.js', () => {
  502. initializeLuckysheet();
  503. });
  504. });
  505. const styles = [
  506. '/luckysheet/plugins/css/pluginsCss.css',
  507. '/luckysheet/plugins/plugins.css',
  508. '/luckysheet/css/luckysheet.css',
  509. '/luckysheet/assets/iconfont/iconfont.css'
  510. ];
  511. styles.forEach(style => {
  512. $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', style));
  513. });
  514. };
  515. // 初始化 Luckysheet
  516. const initializeLuckysheet = () => {
  517. const callback = (exportJson, luckysheetfile) => {
  518. if (!exportJson.sheets || exportJson.sheets.length === 0) {
  519. alert("Failed to read the content of the excel file, currently does not support xls files!");
  520. return;
  521. }
  522. if (luckyExcel) luckyExcel.destroy();
  523. luckysheet.create({
  524. container: 'luckyexcel',
  525. data: exportJson.sheets,
  526. title: exportJson.info.name,
  527. lang: "zh",
  528. showtoolbar: false,
  529. showinfobar: false,
  530. allowEdit: false,
  531. enableAddRow: false,
  532. enableAddCol: false,
  533. userInfo: false,
  534. showRowBar: false,
  535. showColumnBar: false,
  536. sheetFormulaBar: false,
  537. enableAddBackTop: false,
  538. });
  539. luckyExcel = luckysheet;
  540. };
  541. if (row['url'] === null || row['url'] === '') {
  542. const blob = dataURLtoBlob(row.附件内容);
  543. luckyexcelVisible.value = true;
  544. LuckyExcel.transformExcelToLucky(blob, callback);
  545. } else {
  546. const excelPath = `/${row.url.replace(/\\/g, "/")}`;
  547. const excelName = excelPath.split('/').pop();
  548. luckyexcelVisible.value = true;
  549. LuckyExcel.transformExcelToLuckyByUrl(excelPath, excelName, callback);
  550. }
  551. };
  552. // Data URL 转 Blob
  553. const dataURLtoBlob = (dataUrl) => {
  554. const byteString = atob(dataUrl.split(',')[1]);
  555. const ab = new ArrayBuffer(byteString.length);
  556. const ia = new Uint8Array(ab);
  557. for (let i = 0; i < byteString.length; i++) {
  558. ia[i] = byteString.charCodeAt(i);
  559. }
  560. return new Blob([ab], { type: 'application/octet-stream' });
  561. };
  562. loadScriptsAndStyles();
  563. }
  564. //技术资料excel展示
  565. const ExcelShow = (row) =>{
  566. // 加载插件和样式
  567. const loadScriptsAndStyles = () => {
  568. $.getScript('/luckysheet/plugins/js/plugin.js', () => {
  569. $script('/luckysheet/luckysheet.umd.js', () => {
  570. initializeLuckysheet();
  571. });
  572. });
  573. const styles = [
  574. '/luckysheet/plugins/css/pluginsCss.css',
  575. '/luckysheet/plugins/plugins.css',
  576. '/luckysheet/css/luckysheet.css',
  577. '/luckysheet/assets/iconfont/iconfont.css'
  578. ];
  579. styles.forEach(style => {
  580. $('head').append($('<link rel="stylesheet" type="text/css" />').attr('href', style));
  581. });
  582. };
  583. // 初始化 Luckysheet
  584. const initializeLuckysheet = () => {
  585. const callback = (exportJson, luckysheetfile) => {
  586. if (!exportJson.sheets || exportJson.sheets.length === 0) {
  587. alert("Failed to read the content of the excel file, currently does not support xls files!");
  588. return;
  589. }
  590. if (luckyExcel) luckyExcel.destroy();
  591. luckysheet.create({
  592. container: 'luckyexcel',
  593. data: exportJson.sheets,
  594. title: exportJson.info.name,
  595. lang: "zh",
  596. showtoolbar: false,
  597. showinfobar: false,
  598. allowEdit: false,
  599. enableAddRow: false,
  600. enableAddCol: false,
  601. userInfo: false,
  602. showRowBar: false,
  603. showColumnBar: false,
  604. sheetFormulaBar: false,
  605. enableAddBackTop: false,
  606. });
  607. luckyExcel = luckysheet;
  608. };
  609. if (row['url'] === null || row['url'] === '') {
  610. const blob = dataURLtoBlob(row.附件内容);
  611. luckyexcelVisible.value = true;
  612. LuckyExcel.transformExcelToLucky(blob, callback);
  613. } else {
  614. const excelPath = `/${row.url.replace(/\\/g, "/")}`;
  615. const excelName = excelPath.split('/').pop();
  616. luckyexcelVisible.value = true;
  617. LuckyExcel.transformExcelToLuckyByUrl(excelPath, excelName, callback);
  618. }
  619. };
  620. // Data URL 转 Blob
  621. const dataURLtoBlob = (dataUrl) => {
  622. const byteString = atob(dataUrl.split(',')[1]);
  623. const ab = new ArrayBuffer(byteString.length);
  624. const ia = new Uint8Array(ab);
  625. for (let i = 0; i < byteString.length; i++) {
  626. ia[i] = byteString.charCodeAt(i);
  627. }
  628. return new Blob([ab], { type: 'application/octet-stream' });
  629. };
  630. loadScriptsAndStyles();
  631. }
  632. let luckyExcel = null
  633. const luckyexcelVisible = ref(false)
  634. const luckyexcelCloseDialog = () => {
  635. luckyexcelVisible.value = false
  636. }
  637. //表格行点击
  638. const tableRowClick = async (row)=>{
  639. add_searchInfo.value = row.子订单编号
  640. _order.value = row.子订单编号
  641. }
  642. //复选框选择
  643. const ckSelection = ref('')
  644. const handleSelectionChange = (selection, type) => {
  645. const ids = selection.map(item => {
  646. return item.子订单编号
  647. })
  648. ckSelection.value = ids.join(',')
  649. console.log(ckSelection.value)
  650. }
  651. const _searchInput = async ()=>{
  652. setTimeout(() => {
  653. const inputElement = document.getElementById('searchInput');
  654. if (inputElement) {
  655. inputElement.focus();
  656. }
  657. }, 100);
  658. }
  659. //报工
  660. const add_Dialog = async ()=>{
  661. if (!add_formData['机台号']) {
  662. ElMessage({ type: 'warning', message: '未获取到机台' });
  663. return false;
  664. }
  665. if (!_order.value) {
  666. ElMessage({ type: 'warning', message: '请扫描子订单(条码)后,在进行报工' });
  667. return;
  668. }
  669. // 检查新增实裁数是否都为空
  670. const isAllEmpty = Array.from({ length: 10 }, (_, i) => scsformdata[`scs${i + 1}`]).every(value => !value);
  671. if (isAllEmpty) {
  672. ElMessage({ type: 'warning', message: '请至少填写一个报工数据' });
  673. return;
  674. }
  675. //尺码
  676. let cmArray = [cmformdata.cm1, cmformdata.cm2, cmformdata.cm3, cmformdata.cm4, cmformdata.cm5, cmformdata
  677. .cm6, cmformdata.cm7, cmformdata.cm8, cmformdata.cm9, cmformdata.cm10
  678. ];
  679. //制单数
  680. let zdsl1Array = [cmslformdata.cmsl1, cmslformdata.cmsl2, cmslformdata.cmsl3, cmslformdata.cmsl4,
  681. cmslformdata.cmsl5, cmslformdata.cmsl6, cmslformdata.cmsl7, cmslformdata.cmsl8, cmslformdata
  682. .cmsl9, cmslformdata.cmsl10
  683. ];
  684. //上报数量
  685. let scArray = [scsformdata.scs1, scsformdata.scs2, scsformdata.scs3, scsformdata.scs4, scsformdata.scs5, scsformdata.scs6, scsformdata.scs7, scsformdata.scs8, scsformdata.scs9, scsformdata.scs10
  686. ];
  687. let resultArrays = [];
  688. for (let i = 0; i < scArray.length; i++) {
  689. // 创建一个新数组来存储当前索引下的所有值
  690. let currentValues = [add_formData['机台号'], cmArray[i], zdsl1Array[i], scArray[i]];
  691. // 添加到结果数组中
  692. resultArrays.push(currentValues);
  693. }
  694. let paramsList = [];
  695. for (let i = 0; i < resultArrays.length; i++) {
  696. if (scArray[i]) {
  697. let params = {};
  698. params.order_id = add_searchInfo.value;
  699. params.sczl_jtbh = add_formData['机台号'];
  700. params.gxmc = add_formData['工序'];
  701. params.sys_id = add_formData['人员'];
  702. params.sczl_bh = add_formData['组别'];
  703. params.cm = resultArrays[i][1];
  704. params.sl = resultArrays[i][3];
  705. params.sys_rq = currentDates;
  706. params.code = _code;
  707. paramsList.push(params);
  708. }
  709. }
  710. if (paramsList.length === 0) {
  711. ElMessage({type: 'info',message: '请填写实裁数'});
  712. return;
  713. }
  714. let allSuccess = true;
  715. for (let i = 0; i < paramsList.length; i++) {
  716. const cf_gettab = await search(paramsList[i]);
  717. console.log('新增产量计酬返回信息',cf_gettab)
  718. if (cf_gettab.code !== 0) {
  719. // ElMessage({ type: 'error', message: '报工失败' });
  720. allSuccess = false;
  721. break; // 如果某个报工失败,则中断循环
  722. }
  723. }
  724. //报工修改印件资料一条数据
  725. if (_order.value.indexOf('-') !== -1) {
  726. let params = {}
  727. params.scsl1 = scsformdata.scs1
  728. params.scsl2 = scsformdata.scs2
  729. params.scsl3 = scsformdata.scs3
  730. params.scsl4 = scsformdata.scs4
  731. params.scsl5 = scsformdata.scs5
  732. params.scsl6 = scsformdata.scs6
  733. params.scsl7 = scsformdata.scs7
  734. params.scsl8 = scsformdata.scs8
  735. params.scsl9 = scsformdata.scs9
  736. params.scsl10 = scsformdata.scs10
  737. params.sctotal = scsformdata['sctotal']
  738. params.order_id = _order.value;//子订单编号
  739. params.rq = currentDates;//时间
  740. params.UniqId = _UniqId.value
  741. console.log(params)
  742. const baogong_getInfo = await getInfo(params);
  743. if (baogong_getInfo.code === 0) {
  744. ElMessage({ type: 'success', message: '报工成功' });
  745. //查询更新数据
  746. add_onSubmit()
  747. //光标跳转input
  748. _searchInput()
  749. // 清空搜索信息
  750. add_searchInfo.value = '';
  751. // 批量清空新增实裁数input数据
  752. if (scsformdata) {
  753. for (let i = 1; i <= 10; i++) {
  754. scsformdata[`scs${i}`] = '';
  755. }
  756. scsformdata.sctotal = '';
  757. } else {
  758. console.error('scsformdata 未定义');
  759. }
  760. } else {
  761. ElMessage({ type: 'error', message: '报工失败' });
  762. }
  763. }
  764. }
  765. const gd_yulan = () => {
  766. if(add_searchInfo.value === '' || add_searchInfo.value === null){
  767. ElMessage({type: 'warning',message: '请选择具体的工单后,再操作此功能'})
  768. return false;
  769. }else{
  770. const order = add_searchInfo.value.split('-')[0]
  771. printPageRef.value.open(order)
  772. }
  773. }
  774. // =========== 分页 ===========
  775. // 分页相关的响应式变量
  776. const page = ref(1)
  777. const total = ref(0)
  778. const pageSize = ref(10)
  779. // 分页
  780. const handleCurrentChange = (val) => {
  781. page.value = val;
  782. _getStaffList();
  783. };
  784. // 修改页面容量 点击多少条/页
  785. const handleSizeChange = (val) => {
  786. page.value = 10;//默认显示
  787. pageSize.value = val;
  788. _getStaffList();
  789. };
  790. </script>
  791. <style scoped>
  792. .form-container {
  793. display: flex;
  794. flex-wrap: wrap;
  795. }
  796. .form-column {
  797. /*flex: 1;*/
  798. margin-right: 15px; /* 调整列之间的间距 */
  799. }
  800. /* 左侧输入框宽度调整 */
  801. .form-column .el-form-item .el-input {
  802. width: 150px; /* 调整左侧输入框的宽度 */
  803. }
  804. /* 媒体查询,根据需要调整断点 */
  805. @media screen and (max-width: 768px) {
  806. .form-column {
  807. flex: 1 0 100%; /* 在小屏幕下变成单列布局 */
  808. margin-right: 0;
  809. }
  810. }
  811. /*:deep(.el-table td .cell) {*/
  812. /* line-height: 30px !important;*/
  813. /*}*/
  814. .JKWTree-container {
  815. display: flex;
  816. }
  817. .JKWTree-tree {
  818. /*width: 300px;*/
  819. background-color: #fff;
  820. padding: 10px;
  821. margin-right: 20px;
  822. }
  823. .JKWTree-tree h3 {
  824. font-size: 15px;
  825. font-weight: 700;
  826. margin: 10px 0;
  827. }
  828. .JKWTree-content {
  829. flex: 1;
  830. }
  831. /* 图片上传 */
  832. .upload-box {
  833. width: 200px;
  834. height: 200px;
  835. border: 2px dashed #e2e2e2;
  836. display: flex;
  837. justify-content: center;
  838. align-items: center;
  839. position: relative;
  840. cursor: pointer;
  841. }
  842. .uploaded-image {
  843. width: 100%;
  844. height: 100%;
  845. object-fit: cover;
  846. }
  847. .upload-icon {
  848. font-size: 40px;
  849. color: #c0c4cc;
  850. }
  851. .file-input {
  852. display: none;
  853. }
  854. .el-table .warning-row {
  855. background: oldlace;
  856. }
  857. /* 选中某行时的背景色 */
  858. :deep(.el-table__body tr.current-row) > td {
  859. background: #ff80ff !important;
  860. }
  861. </style>
  862. <style scoped>
  863. :deep(.el-table td .cell) {
  864. line-height: 20px !important;
  865. }
  866. :deep(.el-tabs__header){
  867. margin-bottom: 0;
  868. }
  869. .search{
  870. margin-left: 0px !important;
  871. margin-right: 10px !important;
  872. }
  873. .bt{
  874. margin-left: 2px !important;
  875. padding: 3px !important;
  876. font-size: 12px;
  877. }
  878. .el-tabs__header{
  879. margin: 0px !important;
  880. }
  881. .gva-table-box{
  882. padding: 0px !important;
  883. margin-left: -10px !important;
  884. }
  885. .mab{
  886. margin-bottom: 5px;
  887. }
  888. /* 搜索样式 */
  889. ::v-deep .el-input__wrapper #searchInput {
  890. font-size: 16px;
  891. }
  892. ::v-deep .el-input__wrapper #jitaihao {
  893. font-size: 18px;
  894. }
  895. ::v-deep .el-input__wrapper #gongxu {
  896. font-size: 18px;
  897. }
  898. ::v-deep .el-input__wrapper #zubie {
  899. font-size: 18px;
  900. }
  901. ::v-deep .el-input__wrapper #renyuan {
  902. font-size: 18px;
  903. }
  904. ::v-deep .el-input__wrapper #shuliang {
  905. font-size: 18px;
  906. color: red;
  907. }
  908. ::v-deep .el-input__wrapper #chima {
  909. font-size: 18px;
  910. }
  911. /* 尺码/制单数合计样式 */
  912. ::v-deep .el-input__wrapper #cm1{
  913. font-size: 20px;
  914. }
  915. ::v-deep .el-input__wrapper #cm2{
  916. font-size: 20px;
  917. }
  918. ::v-deep .el-input__wrapper #cm3{
  919. font-size: 20px;
  920. }
  921. ::v-deep .el-input__wrapper #cm4{
  922. font-size: 20px;
  923. }
  924. ::v-deep .el-input__wrapper #cm5{
  925. font-size: 20px;
  926. }
  927. ::v-deep .el-input__wrapper #cm6{
  928. font-size: 20px;
  929. }
  930. ::v-deep .el-input__wrapper #cm7{
  931. font-size: 20px;
  932. }
  933. ::v-deep .el-input__wrapper #cm8{
  934. font-size: 20px;
  935. }
  936. ::v-deep .el-input__wrapper #cm9{
  937. font-size: 20px;
  938. }
  939. ::v-deep .el-input__wrapper #cm10{
  940. font-size: 20px;
  941. }
  942. ::v-deep .el-input__wrapper #cm11{
  943. font-size: 20px;
  944. }
  945. /* 本次实裁新增样式 */
  946. ::v-deep .el-input__wrapper #cmsl1{
  947. font-size: 20px;
  948. color: red !important;
  949. }
  950. ::v-deep .el-input__wrapper #cmsl2{
  951. font-size: 20px;
  952. color: red !important;
  953. }
  954. ::v-deep .el-input__wrapper #cmsl3{
  955. font-size: 20px;
  956. color: red !important;
  957. }
  958. ::v-deep .el-input__wrapper #cmsl4{
  959. font-size: 20px;
  960. color: red !important;
  961. }
  962. ::v-deep .el-input__wrapper #cmsl5{
  963. font-size: 20px;
  964. color: red !important;
  965. }
  966. ::v-deep .el-input__wrapper #cmsl6{
  967. font-size: 20px;
  968. color: red !important;
  969. }
  970. ::v-deep .el-input__wrapper #cmsl7{
  971. font-size: 20px;
  972. color: red !important;
  973. }
  974. ::v-deep .el-input__wrapper #cmsl8{
  975. font-size: 20px;
  976. color: red !important;
  977. }
  978. ::v-deep .el-input__wrapper #cmsl9{
  979. font-size: 20px;
  980. color: red !important;
  981. }
  982. ::v-deep .el-input__wrapper #cmsl10{
  983. font-size: 20px;
  984. color: red !important;
  985. }
  986. ::v-deep .el-input__wrapper #zdtotal{
  987. font-size: 20px;
  988. color: red !important;
  989. }
  990. </style>