chafengbaogong.vue 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539
  1. <template>
  2. <div>
  3. <layout>
  4. <layout-content>
  5. <div class="gva-table-box">
  6. <h1 style="margin: 0%;margin-bottom: 10px;">车缝完工报工</h1>
  7. <el-row :gutter="10" style="align-items: center; margin-bottom: 20px;">
  8. <!-- 子订单编号输入框 -->
  9. <el-col :span="4" style="padding: 0px;margin: 0px;">
  10. <el-input v-model="add_searchInfo" placeholder="请扫描子订单编号"@keyup.enter="add_onSubmit" id="searchInput" style="width: 100%; height: 50px;"/>
  11. </el-col>
  12. <!-- 查询按钮 -->
  13. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  14. <el-button type="primary" icon="search" @click="add_onSubmit"style="height: 50px;width: 80px;">查询</el-button>
  15. </el-col>
  16. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  17. <el-text style="font-size: 30px;">机台号</el-text>
  18. </el-col>
  19. <!-- 机台号输入框 -->
  20. <el-col :span="2"><el-input v-model="add_formData['机台号']" readonly style="width: 100%; height: 40px;"/></el-col>
  21. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  22. <el-text style="font-size: 30px;">工序</el-text>
  23. </el-col>
  24. <!-- 工序输入框 -->
  25. <el-col :span="2"><el-input v-model="add_formData['工序']" readonly style="width: 100%; height: 40px;" /></el-col>
  26. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  27. <el-text style="font-size: 30px;">组别</el-text>
  28. </el-col>
  29. <!-- 组别输入框 -->
  30. <el-col :span="2"><el-input v-model="add_formData['组别']" readonly style="width: 100%; height: 40px;" /></el-col>
  31. <el-col :span="1.5" style="padding: 0px;margin: 0px;">
  32. <el-text style="font-size: 30px;">人员</el-text>
  33. </el-col>
  34. <!-- 人员输入框 -->
  35. <el-col :span="2"><el-input v-model="add_formData['人员']" readonly style="width: 100%; height: 40px;"/></el-col>
  36. </el-row>
  37. <!-- 是否尾包 -->
  38. <el-row :gutter="10" style="align-items: center; margin-bottom: 20px;">
  39. <!-- 是否尾包文本 -->
  40. <el-col :span="2.5">
  41. <el-text style="font-size: 30px;">是否尾包</el-text>
  42. </el-col>
  43. <!-- 是否尾包按钮 -->
  44. <el-col :span="5">
  45. <el-button
  46. :type="activeButton === 'yes' ? 'info' : 'primary'"
  47. @click="setActiveButton('yes')"
  48. :style="activeButton === 'yes' ? activeButtonStyle : defaultButtonStyle"
  49. style="height: 45px; width: 60px; margin-right: 10px; font-size: 24px;"
  50. >
  51. </el-button>
  52. <el-button
  53. :type="activeButton === 'no' ? 'info' : 'primary'"
  54. @click="setActiveButton('no')"
  55. :style="activeButton === 'no' ? activeButtonStyle : defaultButtonStyle"
  56. style="height: 45px; width: 60px; margin-right: 10px; font-size: 24px;"
  57. >
  58. </el-button>
  59. </el-col>
  60. </el-row>
  61. <el-row :gutter="0">
  62. <el-col :span="2.5">
  63. <el-text style="font-size: 24px; margin-left: 45px;">尺 码&nbsp;</el-text>
  64. </el-col>
  65. <el-col v-for="(item, index) in 10" :key="index" :span="1" style="padding: 0; margin: 0;">
  66. <el-input v-model="cmformdata[`cm${index + 1}`]" :id="`cm${index + 1}`" readonly style="width: 70px; height: 40px;"/>
  67. </el-col>
  68. <el-col :span="1"><el-input v-model="cmformdata.cmtotal" id="cmtotal" readonly style="width: 80px;height: 40px;" /></el-col>
  69. <!-- 删除报工按钮 -->
  70. <el-col :span="2">
  71. <el-button type="danger" icon="delete" @click="del_delclick"
  72. v-if="delall === true" :disabled="Selection === ''"
  73. :style="{
  74. backgroundColor: Selection === '' ? '' : 'red',
  75. borderColor: Selection === '' ? '' : 'red',
  76. color: Selection === '' ? '' : '#fff'
  77. }"
  78. style="width: 150px; height: 40px; font-size: 20px; margin-left: 30px;">删除报工</el-button>
  79. </el-col>
  80. </el-row>
  81. <el-row :gutter="0">
  82. <el-col :span="2.5">
  83. <el-text style="font-size: 24px; margin-left: 35px;">制单数</el-text>
  84. </el-col>
  85. <el-col v-for="(item, index) in 10" :key="index" :span="1" style="padding: 0; margin: 0;">
  86. <el-input v-model="zdslformdata[`cmsl${index + 1}`]" :id="`cm${index + 1}`" readonly style="width: 70px; height: 40px;"/>
  87. </el-col>
  88. <el-col :span="1"><el-input v-model="zdslformdata.zdtotal" id="zdtotal" readonly style="width: 80px;height: 40px;" /></el-col>
  89. <el-button type="primary" @click="cp_gdprintonClick" style="width: 150px; height: 40px; font-size: 20px; margin-left: 30px;" > 子订单详情页 </el-button>
  90. </el-row>
  91. <el-row :gutter="0">
  92. <el-col :span="2.5">
  93. <el-text style="font-size: 24px; margin-left: 35px;">实裁数</el-text>
  94. </el-col>
  95. <el-col v-for="(item, index) in 10" :key="index" :span="1" style="padding: 0; margin: 0;">
  96. <el-input v-model="scslformdata[`scsl${index + 1}`]" :id="`scsl${index + 1}`" readonly style="width: 70px; height: 40px;"/>
  97. </el-col>
  98. <el-col :span="1"><el-input v-model="scslformdata.sctotal" id="sctotal" readonly style="width: 80px;height: 40px;" /></el-col>
  99. </el-row>
  100. <el-row :gutter="0">
  101. <el-col :span="2.5"><el-text style="font-size: 24px;margin-left: 10px;">上报数量</el-text></el-col>
  102. <el-col :span="1" style="padding-right: 0px;margin-right: 0px;"><el-input v-model="slformdata.sl1" id="sl1" :readonly="!scslformdata.scsl1" @input="updateTotal" style="width: 65px;height: 40px;" /></el-col>
  103. <el-col :span="1" style="padding-right: 0px;margin-right: 0px;"><el-input v-model="slformdata.sl2" id="sl2" :readonly="!scslformdata.scsl2" @input="updateTotal" style="width: 65px;height: 40px;" /></el-col>
  104. <el-col :span="1" style="padding-right: 0px;margin-right: 0px;"><el-input v-model="slformdata.sl3" id="sl3" :readonly="!scslformdata.scsl3" @input="updateTotal" style="width: 65px;height: 40px;" /></el-col>
  105. <el-col :span="1" style="padding-right: 0px;margin-right: 0px;"><el-input v-model="slformdata.sl4" id="sl4" :readonly="!scslformdata.scsl4" @input="updateTotal" style="width: 65px;height: 40px;" /></el-col>
  106. <el-col :span="1" style="padding-right: 0px;margin-right: 0px;"><el-input v-model="slformdata.sl5" id="sl5" :readonly="!scslformdata.scsl5" @input="updateTotal" style="width: 65px;height: 40px;" /></el-col>
  107. <el-col :span="1" style="padding-right: 0px;margin-right: 0px;"><el-input v-model="slformdata.sl6" id="sl6" :readonly="!scslformdata.scsl6" @input="updateTotal" style="width: 65px;height: 40px;" /></el-col>
  108. <el-col :span="1" style="padding-right: 0px;margin-right: 0px;"><el-input v-model="slformdata.sl7" id="sl7" :readonly="!scslformdata.scsl7" @input="updateTotal" style="width: 65px;height: 40px;" /></el-col>
  109. <el-col :span="1" style="padding-right: 0px;margin-right: 0px;"><el-input v-model="slformdata.sl8" id="sl8" :readonly="!scslformdata.scsl8" @input="updateTotal" style="width: 65px;height: 40px;" /></el-col>
  110. <el-col :span="1" style="padding-right: 0px;margin-right: 0px;"><el-input v-model="slformdata.sl9" id="sl9" :readonly="!scslformdata.scsl9" @input="updateTotal" style="width: 65px;height: 40px;" /></el-col>
  111. <el-col :span="1" style="padding-right: 0px;margin-right: 0px;"><el-input v-model="slformdata.sl10" id="sl10" :readonly="!scslformdata.scsl10" @input="updateTotal" style="width: 65px;height: 40px;" /></el-col>
  112. <el-col :span="1"><el-input v-model="slformdata.sctotal" id="cm11" readonly style="width: 80px;height: 40px;" /></el-col>
  113. <el-col :span="2">
  114. <el-button type="primary" @click="add_Dialog" style="width: 150px; height: 40px; font-size: 20px; margin-left: 30px;" >报工</el-button>
  115. </el-col>
  116. </el-row>
  117. <!-- 表格数据 -->
  118. <el-tabs v-model="activeName">
  119. <el-tab-pane label="报工历史记录" name="first">
  120. <el-table
  121. ref="multipleTable"
  122. style="width: 100%; height: 52vh"
  123. tooltip-effect="dark"
  124. :row-style="{ height: '50px' }"
  125. :header-cell-style="{ padding: '5px', fontSize: '20px' }"
  126. :cell-style="{ padding: '10px', fontSize: '20px' }"
  127. :header-row-style="{ height: '20px' }"
  128. :data="add_tableData"
  129. border
  130. row-key="ID"
  131. size="small"
  132. highlight-current-row="true"
  133. @row-dblclick="updateCompanyFunc"
  134. @row-click="tableRowClick"
  135. :show-overflow-tooltip="true"
  136. @selection-change="selectionChange"
  137. >
  138. <el-table-column type="selection" width="60" />
  139. <!-- 操作列 -->
  140. <el-table-column align="left" label="操作" width="150">
  141. <template v-slot="scope">
  142. <!-- 当 sys_rq、组别和 serial 不为空时显示按钮 -->
  143. <el-button
  144. v-if="scope.row.sys_rq && scope.row.组别 && scope.row.serial"
  145. type="primary"
  146. @click="add_bdprintxp(scope.row)"
  147. style="width: 110px; height: 40px; font-size: 20px;"
  148. >
  149. 补打小票
  150. </el-button>
  151. </template>
  152. </el-table-column>
  153. <!-- 报工时间 -->
  154. <el-table-column align="center" label="报工时间" prop="sys_rq" width="150" />
  155. <!-- 子订单编号 -->
  156. <el-table-column align="center" label="子订单编号" prop="子订单编号" width="110" />
  157. <!-- 组别 -->
  158. <el-table-column align="center" label="组别" prop="组别" width="80" />
  159. <!-- 尺码列表 -->
  160. <el-table-column
  161. v-for="item in sizeDatas"
  162. :key="item"
  163. align="center"
  164. :label="item"
  165. width="100"
  166. :cell-style="cellStyle"
  167. >
  168. <template v-slot="scope">
  169. <div
  170. :class="{ 'highlight-cell': isCellHighlighted(scope.$index, item) }"
  171. style="margin-left: -5px; width: 80px;"
  172. @click="handleSizeClick(scope.$index, item, scope.row)"
  173. >
  174. {{ scope.row[item] || '—' }}
  175. </div>
  176. </template>
  177. </el-table-column>
  178. <!-- 数量 -->
  179. <el-table-column align="left" sortable label="数量" prop="数量" width="100" />
  180. <!-- 流水号 -->
  181. <el-table-column align="center" label="流水号" width="150">
  182. <template v-slot="scope">
  183. <!-- 当 sys_rq、组别和 serial 不为空时显示流水号 -->
  184. <div v-if="scope.row.sys_rq && scope.row.组别 && scope.row.serial">
  185. 第{{ scope.row.serial }}包
  186. </div>
  187. </template>
  188. </el-table-column>
  189. </el-table>
  190. </el-tab-pane>
  191. <el-tab-pane label="订单资料附件" name="third">
  192. <el-table ref="multipleTable"
  193. :row-style="{ height: '30px' }"
  194. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '30px' }"
  195. :header-cell-style="{ padding: '0px' }"
  196. :show-overflow-tooltip="true"
  197. :cell-class-name="planUsageCellClass"
  198. highlight-current-row="true"
  199. @row-dblclick="gdbomupdateCompanyFunc"
  200. style="width: 100%;height: 36vh" border tooltip-effect="dark" :data="ddtableData" row-key="ID"
  201. @selection-change="fjSelectionChange">
  202. <el-table-column align="left" label="关联编号" prop="关联编号" width="115"/>
  203. <el-table-column align="left" label="备注" prop="附件备注" width="110"/>
  204. <el-table-column align="left" label="文件类型" prop="附件类型" width="100"/>
  205. <el-table-column align="left" label="建档时间" prop="sys_rq" width="160"/>
  206. <el-table-column align="left" label="建档用户" prop="sys_id" width="200"/>
  207. <el-table-column align="left" label="操作"width="100"fixed="right">
  208. <template #default="scope">
  209. <el-button type="success" size="small" :data="ddtableData" @click="showPdf(scope.row)" >PDF预览</el-button>
  210. </template>
  211. </el-table-column>
  212. </el-table>
  213. </el-tab-pane>
  214. <el-tab-pane label="技术附件" @click="showTable('技术附件')" name="fourth">
  215. <el-table ref="multipleTable"
  216. :row-style="{ height: '30px' }"
  217. :cell-style="{ padding: '0px' }" :header-row-style="{ height: '30px' }"
  218. :header-cell-style="{ padding: '0px' }"
  219. :show-overflow-tooltip="true"
  220. :cell-class-name="planUsageCellClass"
  221. highlight-current-row="true"
  222. @row-dblclick="ExcelShow"
  223. style="width: 100%;height: 36vh" border tooltip-effect="dark" :data="jstableData" row-key="ID" @selection-change="fjSelectionChange">
  224. <el-table-column align="left" label="关联编号" prop="关联编号" width="115"/>
  225. <el-table-column align="left" label="备注" prop="附件备注" width="110"/>
  226. <el-table-column align="left" label="文件类型" prop="附件类型" width="100"/>
  227. <el-table-column align="left" label="建档时间" prop="sys_rq" width="160"/>
  228. <el-table-column align="left" label="建档用户" prop="sys_id" width="200"/>
  229. <el-table-column align="left" label="操作"width="100"fixed="right">
  230. <template #default="scope">
  231. <el-button type="success" size="small" :data="ddtableData" @click="showPdf(scope.row)" >PDF预览</el-button>
  232. </template>
  233. </el-table-column>
  234. </el-table>
  235. </el-tab-pane>
  236. </el-tabs>
  237. </div>
  238. <!-- 是否订单尾包确认弹窗 -->
  239. <el-dialog v-model="DialogVisible" title="是否订单尾包" destroy-on-close width="30%" style="top: 20%;">
  240. <h3>请再次确认是否该订单产品已全部报工,该批为订单尾包?</h3>
  241. <div class="dialog-footer" style="text-align: right;">
  242. <el-button @click="confirmDialogVisible">取消</el-button>
  243. <el-button type="primary" @click="handleConfirm">确认</el-button>
  244. </div>
  245. </el-dialog>
  246. <SubOrderPage ref="SubOrderPageRef" />
  247. <PrintPage ref="printPageRef" />
  248. <!-- 子订单详情页 -->
  249. <luckyexcelPage ref="luckyexcelPageRef" />
  250. </layout-content>
  251. </layout>
  252. </div>
  253. </template>
  254. <script>
  255. export default {
  256. data() {
  257. return {
  258. currentTable: '', // 当前展示的表格
  259. activeName: 'first',
  260. };
  261. },
  262. methods: {
  263. handleKeyDown(event, prevId, currentId, nextId) {
  264. const currentElement = document.getElementById(currentId);
  265. const isEmpty = currentElement.value === '';
  266. const atStart = currentElement.selectionStart === 0;
  267. const atEnd = currentElement.selectionStart === currentElement.value.length;
  268. switch (event.keyCode) {
  269. case 13: // Enter
  270. case 40: // 向下箭头
  271. if (nextId) {
  272. document.getElementById(nextId).focus();
  273. }
  274. break;
  275. case 38: // 向上箭头
  276. if (prevId) {
  277. document.getElementById(prevId).focus();
  278. }
  279. break;
  280. case 8: // 删除键
  281. if (prevId && (isEmpty || atStart)) {
  282. document.getElementById(prevId).focus();
  283. }
  284. break;
  285. case 37: // 向左箭头
  286. if (prevId && atStart) {
  287. document.getElementById(prevId).focus();
  288. }
  289. break;
  290. case 39: // 向右箭头
  291. if (nextId && atEnd) {
  292. document.getElementById(nextId).focus();
  293. }
  294. break;
  295. default:
  296. break;
  297. }
  298. },
  299. },
  300. };
  301. </script>
  302. <script setup>
  303. // 全量引入格式化工具 请按需保留
  304. import $script from 'scriptjs'
  305. import $ from 'jquery';
  306. import LuckyExcel from 'luckyexcel';
  307. import {Layout,LayoutSider,LayoutContent} from '@arco-design/web-vue';
  308. import {hiprint} from "vue-plugin-hiprint";
  309. import {ref,reactive,nextTick,watch,setBlockTracking} from 'vue'
  310. import {getSpotList,search,SubWorkOrderStatusList,getTab,OrderAttachments,getTabByGdbh,processAdd,spotcheckdel,Mabaolist} from '@/api/mes/job'
  311. import {getMachineMac} from '@/api/jixiaoguanli/jitairibaobiao'
  312. import {getMac} from '@/api/jixiaoguanli/baogong'
  313. import {ElMessage} from "element-plus";
  314. import {get} from 'scriptjs';
  315. import PrintPage from '../yunyin/shengchanguanli/components/print.vue'
  316. import luckyexcelPage from '../yunyin/shengchanguanli/components/luckyexcel.vue';
  317. import SubOrderPage from '../yunyin/shengchanguanli/components/SubOrder.vue';
  318. import { useUserStore } from '@/pinia/modules/user';
  319. defineOptions({name: 'Company'})
  320. const path = `${import.meta.env.VITE_BASE_PATH}:${import.meta.env.VITE_UPLOADS_PORT}`
  321. console.log(path)
  322. //定义跳转页面
  323. const SubOrderPageRef = ref()//子订单详情页
  324. const printPageRef = ref()//打印预览
  325. const luckyexcelPageRef = ref()//pdf预览
  326. //子订单详情页
  327. const cp_gdprintonClick = async () => {
  328. if(add_searchInfo.value === '' || add_searchInfo.value === null){
  329. ElMessage({ type: 'warning', message: '请扫描子订单(条码)后再查看' });
  330. return false;
  331. }
  332. SubOrderPageRef.value.open(add_searchInfo.value,add_formData['工序'])
  333. }
  334. //获取登录用户信息
  335. const userStore = useUserStore()
  336. const _username = ref('')
  337. _username.value = userStore.userInfo.userName + '/' + userStore.userInfo.nickName
  338. console.log('获取用户名称',_username.value)
  339. //全局获取当前日期
  340. const today = new Date();
  341. const year = today.getFullYear();
  342. const month = String(today.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需要补零
  343. const day = String(today.getDate()).padStart(2, '0');
  344. const hours = String(today.getHours()).padStart(2, '0');
  345. const minutes = String(today.getMinutes()).padStart(2, '0');
  346. const seconds = String(today.getSeconds()).padStart(2, '0');
  347. const currentDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  348. const currentDates = `${year}-${month}-${day}`;
  349. //全局获取code,接口接收code
  350. const _code = '车缝'
  351. //全局接口接受的物理地址
  352. const Machine = ref('')
  353. //全局获取UniqId
  354. const UniqId = ref('')
  355. //物理地址获取机台编号
  356. const getMachineMacdata = async () => {
  357. console.log("车缝机台获取物理地址", Machine.value)
  358. try {
  359. const data = await getMachineMac({sys_sbID: Machine.value});
  360. if (data.data === null) {
  361. // ElMessage({
  362. // type: 'error',
  363. // message: '未获取到机台编号请确认MAC地址或与管理员联系'
  364. // })
  365. add_formData['机台号'] = '测试机台'
  366. add_formData['工序'] = _code
  367. add_formData['组别'] = "测试"
  368. add_formData['人员'] = "测试"
  369. return;
  370. } else {
  371. add_formData['机台号'] = data.data['机台号']
  372. add_formData['工序'] = data.data['生产工序']
  373. add_formData['工序名称'] = data.data['生产工序']
  374. add_formData['组别'] = data.data['组别']
  375. add_formData['人员'] = data.data['组长']
  376. setTimeout(() => {
  377. const inputElement = document.getElementById('searchInput');
  378. if (inputElement) {
  379. inputElement.focus();
  380. }
  381. }, 100); // 延迟100毫秒
  382. }
  383. } catch (error) {
  384. console.error(error)
  385. }
  386. }
  387. //自动获取物理地址
  388. const GetAddr = () => {
  389. var xmlhttp = null;
  390. var res;
  391. if (window.XMLHttpRequest) {
  392. xmlhttp = new XMLHttpRequest();
  393. } else if (window.ActiveXObject) {
  394. xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
  395. }
  396. // 2. 设置回调函数
  397. xmlhttp.onreadystatechange = function() {
  398. if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
  399. res = eval('(' + xmlhttp.response + ')');
  400. let result = ''
  401. for (let i = 0; i < res.macAddress.length; i++) {
  402. if (i % 2 === 0 && i !== 0) {
  403. result += '-' // 根据实际需求修改分隔符
  404. }
  405. result += res.macAddress[i]
  406. }
  407. Machine.value = result
  408. getMachineMacdata(Machine.value)
  409. }
  410. }
  411. // 3. 打开一个连接
  412. xmlhttp.open("get", "http://127.0.0.1:8090/init")
  413. // 5. 发送
  414. xmlhttp.send();
  415. }
  416. // getMachineMacdata();
  417. GetAddr()
  418. // PDF预览
  419. const showPdf = async (row) => {
  420. luckyexcelPageRef.value.open(row)
  421. }
  422. // 尺码
  423. const cmformdata = reactive({
  424. cm1: '',
  425. cm2: '',
  426. cm3: '',
  427. cm4: '',
  428. cm5: '',
  429. cm6: '',
  430. cm7: '',
  431. cm8: '',
  432. cm9: '',
  433. cm10: '',
  434. cmtotal: '合计',
  435. });
  436. // 制单数
  437. const zdslformdata = reactive({
  438. cmsl1: '',
  439. cmsl2: '',
  440. cmsl3: '',
  441. cmsl4: '',
  442. cmsl5: '',
  443. cmsl6: '',
  444. cmsl7: '',
  445. cmsl8: '',
  446. cmsl9: '',
  447. cmsl10: '',
  448. zdtotal: '',
  449. });
  450. // 实裁量
  451. const scslformdata = reactive({
  452. scsl1: '',
  453. scsl2: '',
  454. scsl3: '',
  455. scsl4: '',
  456. scsl5: '',
  457. scsl6: '',
  458. scsl7: '',
  459. scsl8: '',
  460. scsl9: '',
  461. scsl10: '',
  462. sctotal: '',
  463. });
  464. // 数量
  465. const slformdata = reactive({
  466. sl1: '',
  467. sl2: '',
  468. sl3: '',
  469. sl4: '',
  470. sl5: '',
  471. sl6: '',
  472. sl7: '',
  473. sl8: '',
  474. sl9: '',
  475. sl10: '',
  476. sctotal: '',
  477. });
  478. //实裁相加
  479. function updateTotal() {
  480. // 直接指定要累加的属性名
  481. const relevantKeys = ['sl1', 'sl2', 'sl3', 'sl4', 'sl5', 'sl6', 'sl7', 'sl8', 'sl9', 'sl10'];
  482. const values = relevantKeys.map(key => parseInt(slformdata[key], 10) ||
  483. 0); // 使用 || 0 来处理可能的 NaN 或 undefined/null
  484. slformdata.sctotal = values.reduce((sum, value) => sum + value, 0);
  485. const relevantKeyss = ['scsl1', 'scsl2', 'scsl3', 'scsl4', 'scsl5', 'scsl6', 'scsl7', 'scsl8', 'scsl9', 'scsl0'];
  486. const valuess = relevantKeyss.map(key => parseInt(scslformdata[key], 10) ||
  487. 0); // 使用 || 0 来处理可能的 NaN 或 undefined/null
  488. scslformdata.sctotal = valuess.reduce((sum, value) => sum + value, 0);
  489. }
  490. //历史记录表格
  491. const add_tableData = reactive([]);
  492. //全局获取颜色款式款号
  493. const _yskskh = ref('')
  494. //全局获取新增流水号
  495. const _serial = ref('')
  496. //全局获取序号
  497. const _serial_num = ref('')
  498. const _list = ref('')
  499. //流水号补零
  500. function padNumber(num, length) {
  501. let str = '' + num;
  502. while (str.length < length) {
  503. str = '0' + str;
  504. }
  505. return str;
  506. }
  507. // 代表扫描两次自动保存
  508. const searcs = ref('')
  509. //尺寸列表
  510. const sizeDatas = reactive([])
  511. //搜索
  512. const add_searchInfo = ref('')
  513. //技术附件
  514. const jstableData = reactive([])
  515. const ddtableData = reactive([])
  516. //查询
  517. const add_onSubmit = async () => {
  518. if(add_formData['机台号'] === ''){
  519. ElMessage({type: 'warning',message: '未获取到机台'})
  520. return false;
  521. }
  522. sizeDatas.length = 0;
  523. add_tableData.length = 0;
  524. if (!add_searchInfo.value.startsWith('DC')) {
  525. // 如果没有以"DC"开头,则添加前缀
  526. add_searchInfo.value = 'DC' + add_searchInfo.value;
  527. }
  528. if (add_searchInfo.value === '' || add_searchInfo.value === undefined) {
  529. const WorkListdata = [];
  530. add_tableData.splice(0, add_tableData.length, ...WorkListdata);
  531. ElMessage({
  532. type: 'warning',
  533. message: '请扫描小票二维码'
  534. })
  535. } else {
  536. // //领料
  537. // let llparams = {};
  538. // llparams.子订单编号 = add_searchInfo.value
  539. // llparams.班组 = add_formData['机台号']
  540. // llparams.订单编号 = add_searchInfo.value.split('-')[0]
  541. // llparams.Sys_id = _username.value
  542. // const processAdd_post = await processAdd(llparams);
  543. //获取报工历史记录
  544. const getSpotLists = await getSpotList({order: add_searchInfo.value,code: _code,sys_sbID: add_formData['机台号']});
  545. // console.log(getSpotLists)
  546. sizeDatas.splice(0, getSpotLists.data.headers.length, ...getSpotLists.data.headers); //型号数据
  547. add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.records); //表格数据
  548. _list.value = getSpotLists.data.list
  549. if (!add_searchInfo.value.includes('-') && getSpotLists.data.records.length === 0) {
  550. ElMessage({
  551. type: 'warning',
  552. message: '未查询到报工历史数据'
  553. })
  554. return false;
  555. }
  556. //xlsx附件
  557. const searchValue = add_searchInfo.value.split('-')[0];
  558. const jsOrderAttachments = await OrderAttachments({order:searchValue,desc:'技术附件'})
  559. const ddOrderAttachments = await OrderAttachments({order:searchValue,desc:'订单资料附件'})
  560. jstableData.splice(0,jsOrderAttachments.data.length,...jsOrderAttachments.data);
  561. ddtableData.splice(0,ddOrderAttachments.data.length,...ddOrderAttachments.data);
  562. _yskskh.value = getSpotLists.data.list //颜色、款式、款号
  563. _serial.value = String(getSpotLists.data.serial) //流水号
  564. _serial_num.value = String(getSpotLists.data.serial_num);//序号
  565. console.log(_serial_num.value)
  566. //获取尺码、制单数/实裁量上面信息
  567. const keys1 = ['cm1', 'cm2', 'cm3', 'cm4', 'cm5', 'cm6', 'cm7', 'cm8', 'cm9', 'cm10', ];
  568. const keys2 = ['cmsl1', 'cmsl2', 'cmsl3', 'cmsl4', 'cmsl5', 'cmsl6', 'cmsl7', 'cmsl8', 'cmsl9',
  569. 'cmsl10', 'zdtotal',
  570. ];
  571. const keys3 = ['scsl1', 'scsl2', 'scsl3', 'scsl4', 'scsl5', 'scsl6', 'scsl7', 'scsl8', 'scsl9',
  572. 'scsl10', 'sctotal',
  573. ];
  574. //如果搜索是子订单编号
  575. if (add_searchInfo.value.includes('-')) {
  576. for (let key of keys1) {
  577. if (getSpotLists.data.list.hasOwnProperty(key)) { // 确保键存在于对象中
  578. cmformdata[key] = getSpotLists.data.list[key];
  579. }
  580. }
  581. for (let key of keys2) {
  582. if (getSpotLists.data.list.hasOwnProperty(key)) { // 确保键存在于对象中
  583. zdslformdata[key] = getSpotLists.data.list[key];
  584. }
  585. }
  586. for (let key of keys3) {
  587. if (getSpotLists.data.list.hasOwnProperty(key)) { // 确保键存在于对象中
  588. scslformdata[key] = getSpotLists.data.list[key];
  589. }
  590. }
  591. setTimeout(() => {
  592. const inputElement = document.getElementById('sl1');
  593. if (inputElement) {
  594. inputElement.focus();
  595. }
  596. }, 100); // 延迟100毫秒
  597. } else {
  598. for (let key of keys1) {
  599. cmformdata[key] = '';
  600. }
  601. for (let key of keys2) {
  602. zdslformdata[key] = '';
  603. }
  604. }
  605. updateTotal()
  606. // //历史记录
  607. // if (getSpotLists.data.headers) {
  608. // }
  609. }
  610. }
  611. const AttendanceVisible = ref(false)
  612. //清空对象的属性值
  613. const gd_clearFormData = () => {
  614. Object.keys(add_formData).forEach(key => {
  615. add_formData[key] = '';
  616. });
  617. };
  618. const add_formData = reactive({
  619. 机台号: '',
  620. 工序: '',
  621. 组别: '',
  622. 人员: '',
  623. 尺码: '',
  624. 数量: '',
  625. 是否订单尾包: '0',
  626. });
  627. const currentSlValue = ref('')
  628. //车缝报工
  629. const add_Dialog = async () => {
  630. if(add_formData['机台号'] === '测试机台'){
  631. ElMessage({ type: 'warning', message: '测试机台禁止报工' });
  632. return;
  633. }
  634. sizeDatas.length = 0;
  635. add_tableData.length = 0;
  636. // console.log(_serial.value)
  637. if (_serial.value === NaN) {
  638. ElMessage({type: 'warning',message: '网络异常.请检查'})
  639. return fasle;
  640. }
  641. if (add_searchInfo.value === '') {
  642. ElMessage({type: 'warning',message: '请扫描子订单编号输入数量后,再进行上报'})
  643. return fasle;
  644. }
  645. //尺码
  646. let cmArray = [cmformdata.cm1, cmformdata.cm2, cmformdata.cm3, cmformdata.cm4, cmformdata.cm5, cmformdata
  647. .cm6, cmformdata.cm7, cmformdata.cm8, cmformdata.cm9, cmformdata.cm10
  648. ];
  649. //制单数
  650. let zdsl1Array = [zdslformdata.zdsl1, zdslformdata.zdsl12, zdslformdata.zdsl13, zdslformdata.zdsl14,
  651. zdslformdata.zdsl15, zdslformdata.zdsl16, zdslformdata.zdsl17, zdslformdata.zdsl18, zdslformdata
  652. .zdsl19, zdslformdata.zdsl110
  653. ];
  654. //上报数量
  655. let slArray = [slformdata.sl1, slformdata.sl2, slformdata.sl3, slformdata.sl4, slformdata.sl5, slformdata
  656. .sl6, slformdata.sl7, slformdata.sl8, slformdata.sl9, slformdata.sl10
  657. ];
  658. let resultArrays = [];
  659. for (let i = 0; i < slArray.length; i++) {
  660. // 创建一个新数组来存储当前索引下的所有值
  661. let currentValues = [add_formData['机台号'], cmArray[i], zdsl1Array[i], slArray[i]];
  662. // 添加到结果数组中
  663. resultArrays.push(currentValues);
  664. }
  665. //获取报工历史记录
  666. const getSpotLists = await getSpotList({order: add_searchInfo.value,code: _code,sys_sbID: add_formData['机台号']});
  667. let paramsList = []; // 用于存储每个元素的 cm 和 sl
  668. let serialNumber = parseInt(getSpotLists.data.serial, 10);
  669. for (let i = 0; i < resultArrays.length; i++) {
  670. if (slArray[i]) {
  671. let params = {};
  672. params.order_id = add_searchInfo.value;
  673. params.sczl_jtbh = add_formData['机台号'];
  674. params.gxmc = add_formData['工序'];
  675. params.sys_id = add_formData['人员'];
  676. params.wb = add_formData['是否订单尾包'];
  677. params.cm = resultArrays[i][1];
  678. params.sl = resultArrays[i][3];
  679. params.sys_rq = currentDates;
  680. params.code = '车缝';
  681. params.sczl_bh = add_formData['组别'];
  682. // 流水号(包数)
  683. serialNumber++;
  684. params.serial = padNumber(serialNumber, 3);
  685. //流水号序号
  686. // _serial_num.value++;
  687. // params.serial_num = _serial_num.value;
  688. // 流水号序号
  689. params.serial_num = serialNumber;
  690. paramsList.push(params);
  691. }
  692. }
  693. console.log("新增报工",paramsList)
  694. // return;
  695. if (paramsList.length === 0) {
  696. ElMessage({type: 'info',message: '请填写报工尺码数量'});
  697. return;
  698. }
  699. let allSuccess = true;
  700. for (let i = 0; i < paramsList.length; i++) {
  701. const cf_gettab = await search(paramsList[i]);
  702. console.log("新增报工返回状态",cf_gettab)
  703. if (cf_gettab.code !== 0) {
  704. allSuccess = false;
  705. break; // 如果某个报工失败,则中断循环
  706. }
  707. }
  708. //光标跳转input框
  709. setTimeout(() => {
  710. const inputElement = document.getElementById('searchInput');
  711. if (inputElement) {
  712. inputElement.focus();
  713. }
  714. }, 100); // 延迟100毫秒
  715. if (allSuccess) {
  716. const lsjltable = await getTab({
  717. order_id: add_searchInfo.value,
  718. sczl_jtbh: add_formData['机台号']
  719. });
  720. const getSpotLists = await getSpotList({
  721. order: add_searchInfo.value,
  722. code: _code,
  723. sys_sbID: add_formData['机台号']
  724. });
  725. sizeDatas.splice(0, getSpotLists.data.headers.length, ...getSpotLists.data.headers);
  726. add_tableData.splice(0, add_tableData.length, ...getSpotLists.data.records);
  727. add_printxp();
  728. searcs.value = '';
  729. // add_searchInfo.value = '';
  730. ElMessage({
  731. type: 'success',
  732. message: '报工成功'
  733. });
  734. // 上报成功后 清空所有输入框上报数量
  735. if (slformdata) {
  736. for (let i = 1; i <= 10; i++) {
  737. slformdata['sl' + i] = '';
  738. }
  739. // 清空总和
  740. slformdata.sctotal = '';
  741. } else {
  742. console.error('未定义');
  743. }
  744. }
  745. }
  746. // 新增取消
  747. const add_closeDialog = () => {
  748. AttendanceVisible.value = false
  749. };
  750. //是否订单尾包选择是否按钮
  751. const activeButton = ref('no')
  752. const DialogVisible = ref(false)
  753. // 定义按钮的默认样式和激活样式
  754. const defaultButtonStyle = {
  755. backgroundColor: '#808080', //用于默认状态
  756. color: 'white',
  757. };
  758. const activeButtonStyle = {
  759. backgroundColor: 'red', //用于选中状态
  760. color: 'white',
  761. };
  762. //点击尾包是否按钮
  763. const setActiveButton = (button) => {
  764. console.log("setActiveButton")
  765. activeButton.value = button;
  766. //1 = 是 0 = 否
  767. if (button === 'yes') {
  768. console.log("yes")
  769. add_formData['是否订单尾包'] = '1';
  770. DialogVisible.value = true;
  771. } else if (button === 'no') {
  772. console.log("no")
  773. add_formData['是否订单尾包'] = '0';
  774. DialogVisible.value = false;
  775. }
  776. };
  777. //是否尾包弹窗确定
  778. const handleConfirm = () => {
  779. add_formData['是否订单尾包'] = '1'
  780. activeButton.value = 'yes';
  781. DialogVisible.value = false
  782. };
  783. //是否尾包弹窗取消
  784. const confirmDialogVisible = () => {
  785. add_formData['是否订单尾包'] = '0'
  786. activeButton.value = 'no';
  787. DialogVisible.value = false
  788. };
  789. // =========== 打印小票 ===========
  790. const jsondata = {"panels":[{"index":0,"name":1,"height":296.6,"width":210,"paperHeader":19.5,"paperFooter":832.5,"printElements":[{"options":{"left":435,"top":61.5,"height":159,"width":159,"title":"二维码","qrcodeType":"qrcode","testData":"qrcode","right":597.75,"bottom":218.25,"vCenter":518.25,"hCenter":138.75,"field":"emm","qrCodeLevel":2,"coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"zIndex":1},"printElementType":{"title":"二维码","type":"qrcode"}},{"options":{"left":3,"top":456,"height":45,"width":199.5,"title":"2024-10-22","right":419.25,"bottom":200.25,"vCenter":319.5,"hCenter":177.75,"field":"dyrq","coordinateSync":false,"widthHeightSync":false,"fontSize":30,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_6","textAlign":"left","hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":21,"height":37,"width":291,"title":"DC2410023-0100","right":291,"bottom":64,"vCenter":145.5,"hCenter":45.5,"field":"zddbh","coordinateSync":false,"widthHeightSync":false,"fontSize":33,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"zddbh_1","lineHeight":33,"hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":112.5,"top":64.5,"height":43,"width":193.5,"title":"","right":285,"bottom":508,"vCenter":188.25,"hCenter":486.5,"field":"zb","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_5"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":64.5,"height":43,"width":126,"title":"组别:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":92,"bottom":114.99999713897705,"vCenter":46,"hCenter":93.49999713897705},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":430.5,"top":225,"height":44,"width":40.5,"title":"第","right":459,"bottom":313.5,"vCenter":438.75,"hCenter":287.25,"coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":553.5,"top":225,"height":44,"width":40.5,"title":"包","right":597.7500457763672,"bottom":268.25,"vCenter":577.5000457763672,"hCenter":246.25,"coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":474,"top":225,"height":44,"width":78,"title":"005","right":538.5,"bottom":313.5,"vCenter":498.75,"hCenter":287.25,"field":"lsh","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textAlign":"center","textContentVerticalAlign":"middle","qrCodeLevel":0},"printElementType":{"title":"文本","type":"text"}},{"options":{"left":112.5,"top":112.5,"height":43,"width":190.5,"title":"这是更新后的元素","right":282.75,"bottom":362.5,"vCenter":187.5,"hCenter":341,"field":"cm","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_3","textContentWrap":"ellipsis"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":114,"height":43,"width":124.5,"title":"尺码:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":88.25,"bottom":290.5,"vCenter":42.25,"hCenter":269},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":219,"height":44,"width":123,"title":"尾包:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":120,"bottom":270.50000858306885,"vCenter":70.5,"hCenter":248.50000858306885},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":115.5,"top":219,"height":44,"width":55.5,"title":"否","right":573.7500228881836,"bottom":437.75001430511475,"vCenter":546.0000228881836,"hCenter":415.75001430511475,"field":"wb","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_7"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":114,"top":163.5,"height":43,"width":190.5,"title":"这是更新后的元素","right":280.5,"bottom":334.00000858306885,"vCenter":185.25,"hCenter":312.50000858306885,"field":"sl","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"kh_4"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":163.5,"height":43,"width":124.5,"title":"数量:","coordinateSync":false,"widthHeightSync":false,"fontSize":40,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":70.25,"bottom":275.50001430511475,"vCenter":24.25,"hCenter":254.00001430511475},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":1.5,"top":286.5,"height":46,"width":157.5,"title":"生产款号:","coordinateSync":false,"widthHeightSync":false,"fontSize":30,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":156,"bottom":459.25,"vCenter":75,"hCenter":437.75},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":142.5,"top":286.5,"height":46,"width":444,"title":"MMGPayton Coach Jacket506880","right":454.5000114440918,"bottom":340.75,"vCenter":291.0000114440918,"hCenter":317.75,"field":"kh","coordinateSync":false,"widthHeightSync":false,"fontSize":30,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"zddbh_1","hideTitle":true,"lineHeight":36,"textContentWrap":"nowrap"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":343.5,"height":46,"width":121.5,"title":"款式:","coordinateSync":false,"widthHeightSync":false,"fontSize":30,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":94.25,"bottom":464.50001430511475,"vCenter":48.25,"hCenter":443.00001430511475},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":85.5,"top":343.5,"height":47,"width":493.5,"title":"西装","right":572.25,"bottom":394.25000858306885,"vCenter":343.5,"hCenter":370.75000858306885,"field":"pm","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":30,"qrCodeLevel":0,"qid":"kh_1","lineHeight":36,"textContentWrap":"nowrap","textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":84,"top":400.5,"height":46,"width":495,"title":"","right":570.75,"bottom":451.7500057220459,"vCenter":327,"hCenter":428.7500057220459,"field":"ys","coordinateSync":false,"widthHeightSync":false,"hideTitle":true,"fontSize":30,"qrCodeLevel":0,"qid":"kh_2","lineHeight":36,"textContentWrap":"nowrap","textContentVerticalAlign":"middle"},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":0,"top":400.5,"height":46.5,"width":120,"title":"颜色:","coordinateSync":false,"widthHeightSync":false,"fontSize":30,"textContentVerticalAlign":"middle","qrCodeLevel":0,"right":72.75,"bottom":480.75,"vCenter":37.5,"hCenter":457.5},"printElementType":{"title":"这是更新后的元素","type":"text"}},{"options":{"left":303,"top":19.5,"height":37,"width":291,"title":"DC2410023-0100","right":595.0000076293945,"bottom":55.24998474121094,"vCenter":449.50000762939453,"hCenter":36.74998474121094,"field":"zddbh","coordinateSync":false,"widthHeightSync":false,"fontSize":33,"textContentVerticalAlign":"middle","qrCodeLevel":0,"qid":"zddbh_1","lineHeight":33,"hideTitle":true},"printElementType":{"title":"这是更新后的元素","type":"text"}}],"paperNumberLeft":568.5,"paperNumberTop":339,"paperNumberDisabled":true,"paperNumberContinue":true,"watermarkOptions":{"content":"vue-plugin-hiprint","rotate":25,"timestamp":true,"format":"YYYY-MM-DD HH:mm"},"panelLayoutOptions":{}}]}
  791. //点击显示表格高亮
  792. function isCellHighlighted(rowIndex, item) {
  793. return highlightedCells.value.some(hc => hc.rowIndex === rowIndex && hc.item === item);
  794. console.log(highlightedCells.value)
  795. }
  796. const highlightedCells = ref([]);
  797. const selectedSizes = ref([]);
  798. let _table_row = ref('');
  799. //点击表格行事件
  800. function handleSizeClick(rowIndex, item, row) {
  801. _table_row = row
  802. // 查找当前单元格是否已高亮
  803. const index = highlightedCells.value.findIndex(hc => hc.rowIndex === rowIndex && hc.item === item);
  804. if (index !== -1) {
  805. // 如果已高亮,则移除
  806. highlightedCells.value.splice(index, 1);
  807. } else {
  808. // 如果已经有一个高亮条目,移除第一个高亮条目
  809. if (highlightedCells.value.length > 0) {
  810. highlightedCells.value.splice(0, 1);
  811. }
  812. // 添加新的高亮信息
  813. highlightedCells.value.push({
  814. rowIndex,
  815. item
  816. });
  817. }
  818. let newSizeItem = {
  819. size: item
  820. };
  821. const quantityWithParentheses = row[item];
  822. const match = quantityWithParentheses.match(/^([^()]+)\(([^()]+)\)$/);
  823. if (match) {
  824. // console.log("点击尺码包数据",match)
  825. //获取流水号(包数)
  826. newSizeItem.serial = match[1];
  827. //获取数量
  828. newSizeItem.sl = parseInt(match[2], 10);
  829. const existingIndex = selectedSizes.value.findIndex(s => s.size === item);
  830. if (existingIndex !== -1) {
  831. selectedSizes.value.splice(existingIndex, 1);
  832. }
  833. // 清空 selectedSizes 数组
  834. selectedSizes.value = [];
  835. selectedSizes.value.push(newSizeItem);
  836. } else {
  837. console.error('Invalid match format:', quantityWithParentheses);
  838. }
  839. }
  840. let _table_print = ref([]);//打印小票数据
  841. let allParams = [];
  842. //补打小票按钮
  843. const add_bdprintxp = () => {
  844. if (selectedSizes.value.length === 0) {
  845. ElMessage({
  846. type: 'warning',
  847. message: '请选择补打尺码'
  848. });
  849. return false;
  850. }
  851. console.log(_table_row['组别'])
  852. if(_table_row['组别'] != add_formData['组别']){
  853. ElMessage({
  854. type: 'warning',
  855. message: '请到对应小组进行补打小票'
  856. });
  857. return false;
  858. }
  859. let params = {};
  860. params.order_id = _table_row['子订单编号'];
  861. params.kh = _table_row['款号'];
  862. params.ks = _table_row['款式'];
  863. params.color = _table_row['颜色备注'];
  864. params.cm = selectedSizes.value[0].size;
  865. params.sl = selectedSizes.value[0].sl;
  866. params.sczl_jtbh = _table_row['组别'];
  867. params.sys_rq = currentDate;
  868. params.serial = selectedSizes.value[0].serial;
  869. params.wb = _table_row['尾包'];
  870. const weibao = _table_row['尾包'] === '是' ? '1' : '0';
  871. const ewm = `${params.order_id},${add_formData['机台号']},3,${params.cm},${params.sl},${weibao},${params.serial}`;
  872. _table_print.value = [{
  873. emm: ewm,
  874. zddbh: params.order_id,
  875. kh: params.kh,
  876. pm: params.ks,
  877. ys: params.color,
  878. cm: params.cm,
  879. sl: params.sl,
  880. zb: params.sczl_jtbh,
  881. dyrq: currentDates,
  882. wb: _table_row['尾包'],
  883. lsh: params.serial
  884. }];
  885. const hiprintTemplate = new hiprint.PrintTemplate({
  886. template: jsondata
  887. });
  888. hiprintTemplate.print(_table_print.value);
  889. };
  890. const _print = ref('')
  891. // 打印预览
  892. const add_printxp = async () => {
  893. console.log("打印小票")
  894. let cmArray = [cmformdata.cm1, cmformdata.cm2, cmformdata.cm3, cmformdata.cm4, cmformdata.cm5, cmformdata.cm6,
  895. cmformdata.cm7, cmformdata.cm8, cmformdata.cm9, cmformdata.cm10
  896. ];
  897. let slArray = [slformdata.sl1, slformdata.sl2, slformdata.sl3, slformdata.sl4, slformdata.sl5, slformdata.sl6,
  898. slformdata.sl7, slformdata.sl8, slformdata.sl9, slformdata.sl10
  899. ];
  900. let allParams = []; // 用于存储所有要打印的参数对象
  901. let allParamss = ref([]); // 用于存储所有要打印的参数对象
  902. if (!slArray.some(item => item !== "" && item !== null && item !== undefined)) {
  903. ElMessage({
  904. type: 'warning',
  905. message: '请填写上报数量后再使用打印功能'
  906. });
  907. return;
  908. } else {
  909. for (let i = 0; i < slArray.length; i++) {
  910. if (slArray[i]) {
  911. let params = {};
  912. params.order_id = add_searchInfo.value;
  913. params.sczl_jtbh = add_formData['组别'];
  914. params.gx = add_formData['工序'];
  915. params.sys_id = add_formData['人员'];
  916. params.wb = add_formData['是否订单尾包'];
  917. params.cm = cmArray[i];
  918. params.sl = slArray[i];
  919. params.sys_rq = currentDate;
  920. // 流水号(包数)
  921. _serial.value++;
  922. console.log('小票打印前的流水号', _serial.value)
  923. params.serial = padNumber( _serial.value, 3);
  924. allParams.push(params);
  925. allParamss.value = allParams.map((row) => {
  926. console.log("row",row)
  927. let weibao = add_formData['是否订单尾包'] === '1' ? '是' : '否';
  928. // 二维码数据:订单子编号,组别,工序(固定),尺码,数量,是否尾包(1代表是0代表否),流水号
  929. const ewm =
  930. `${row['order_id']},${add_formData['机台号']},3,${row['cm']},${row['sl']},${add_formData['是否订单尾包']},${row['serial']}`;
  931. return {
  932. emm: ewm,
  933. zddbh: row['order_id'],
  934. kh: _yskskh.value['款号'],
  935. pm: _yskskh.value['款式'],
  936. ys: _yskskh.value['颜色备注'],
  937. cm: row['cm'],
  938. sl: row['sl'],
  939. zb: row['sczl_jtbh'],
  940. dyrq: currentDates,
  941. wb: weibao,
  942. lsh: row['serial']
  943. };
  944. });
  945. const hiprintTemplate = new hiprint.PrintTemplate({
  946. template: jsondata
  947. });
  948. hiprintTemplate.print(allParamss.value);
  949. }
  950. }
  951. }
  952. };
  953. //报工删除
  954. const delall = ref(true)
  955. const Selection = ref('')
  956. const selectionChange = (selection, type) => {
  957. const ids = selection.map(item => {
  958. return item.UniqId
  959. })
  960. Selection.value = ids.join(',')
  961. console.log(Selection.value)
  962. }
  963. const del_delclick = async () => {
  964. console.log(Selection.value)
  965. console.log(add_formData['组别'])
  966. const res1 = await spotcheckdel({UniqId:Selection.value,sys_id:add_formData['组别']})
  967. res1.code === 0 && ElMessage.success('删除成功')
  968. add_onSubmit()
  969. }
  970. // =========== 分页 ===========
  971. // 分页相关的响应式变量
  972. const page = ref(1)
  973. const total = ref(0)
  974. const pageSize = ref(10)
  975. // 分页
  976. const handleCurrentChange = (val) => {
  977. page.value = val;
  978. _getStaffList();
  979. };
  980. // 修改页面容量 点击多少条/页
  981. const handleSizeChange = (val) => {
  982. page.value = 10; //默认显示
  983. pageSize.value = val;
  984. _getStaffList();
  985. };
  986. </script>
  987. <style scoped>
  988. :deep(.el-table__body .status-plan-usage-low) {
  989. background: #ff80ff !important;
  990. }
  991. :deep(.el-table__body .status-plan-usage-lows) {
  992. background: white !important;
  993. }
  994. .form-container {
  995. display: flex;
  996. flex-wrap: wrap;
  997. }
  998. .form-column {
  999. /*flex: 1;*/
  1000. margin-right: 15px;
  1001. /* 调整列之间的间距 */
  1002. }
  1003. /* 左侧输入框宽度调整 */
  1004. .form-column .el-form-item .el-input {
  1005. width: 150px;
  1006. /* 调整左侧输入框的宽度 */
  1007. }
  1008. /* 媒体查询,根据需要调整断点 */
  1009. @media screen and (max-width: 768px) {
  1010. .form-column {
  1011. flex: 1 0 100%;
  1012. /* 在小屏幕下变成单列布局 */
  1013. margin-right: 0;
  1014. }
  1015. }
  1016. /* 表格复选框大小调整 */
  1017. :deep(.el-checkbox.el-checkbox--small .el-checkbox__inner) {
  1018. width: 30px;
  1019. /* 复选框宽度 */
  1020. height: 20px;
  1021. /* 复选框高度 */
  1022. }
  1023. :deep(.el-checkbox.el-checkbox--small.is-checked .el-checkbox__inner::after) {
  1024. transform: scale(1.2) rotate(45deg);
  1025. /* 调整选中后的对勾大小 */
  1026. top: 5%;
  1027. /* 调整对勾位置 */
  1028. left: 40%;
  1029. /* 调整对勾位置 */
  1030. width: 5px;
  1031. /* 调整对勾宽度 */
  1032. height: 9px;
  1033. /* 调整对勾高度 */
  1034. }
  1035. /*:deep(.el-table td .cell) {*/
  1036. /* line-height: 30px !important;*/
  1037. /*}*/
  1038. .JKWTree-container {
  1039. display: flex;
  1040. }
  1041. .JKWTree-tree {
  1042. /*width: 300px;*/
  1043. background-color: #fff;
  1044. padding: 10px;
  1045. margin-right: 20px;
  1046. }
  1047. .JKWTree-tree h3 {
  1048. font-size: 15px;
  1049. font-weight: 700;
  1050. margin: 10px 0;
  1051. }
  1052. .JKWTree-content {
  1053. flex: 1;
  1054. }
  1055. /* 图片上传 */
  1056. .upload-box {
  1057. width: 200px;
  1058. height: 200px;
  1059. border: 2px dashed #e2e2e2;
  1060. display: flex;
  1061. justify-content: center;
  1062. align-items: center;
  1063. position: relative;
  1064. cursor: pointer;
  1065. }
  1066. .uploaded-image {
  1067. width: 100%;
  1068. height: 100%;
  1069. object-fit: cover;
  1070. }
  1071. .upload-icon {
  1072. font-size: 40px;
  1073. color: #c0c4cc;
  1074. }
  1075. .file-input {
  1076. display: none;
  1077. }
  1078. .el-table .warning-row {
  1079. background: oldlace;
  1080. }
  1081. :deep(.el-input .is-disabled .cm_input) {
  1082. color: red;
  1083. }
  1084. /* 选中某行时的背景色 */
  1085. :deep(.el-table__body tr.current-row)>td {
  1086. background: #ff80ff !important;
  1087. }
  1088. </style>
  1089. <style scoped>
  1090. :deep(.el-table td .cell) {
  1091. line-height: 20px !important;
  1092. }
  1093. :deep(.el-tabs__header) {
  1094. margin-bottom: 0;
  1095. }
  1096. .search {
  1097. margin-left: 0px !important;
  1098. margin-right: 10px !important;
  1099. }
  1100. .bt {
  1101. margin-left: 2px !important;
  1102. padding: 3px !important;
  1103. font-size: 12px;
  1104. }
  1105. .el-tabs__header {
  1106. margin: 0px !important;
  1107. }
  1108. .gva-table-box {
  1109. max-width: 1400px;
  1110. padding: 0px !important;
  1111. margin-left: -10px !important;
  1112. }
  1113. .mab {
  1114. margin-bottom: 5px;
  1115. }
  1116. /* 点击按钮改变颜色 */
  1117. .active-button {
  1118. background-color: #ff0000;
  1119. }
  1120. .default-button {
  1121. background-color: #808080;
  1122. }
  1123. ::v-deep .el-input_inner {
  1124. font-size: 20px;
  1125. /* 更改为你想要的字体大小 */
  1126. }
  1127. /* 搜索样式 */
  1128. ::v-deep .el-input__wrapper #searchInput {
  1129. font-size: 16px;
  1130. }
  1131. ::v-deep .el-input__wrapper #jitaihao {
  1132. font-size: 18px;
  1133. }
  1134. ::v-deep .el-input__wrapper #gongxu {
  1135. font-size: 18px;
  1136. }
  1137. ::v-deep .el-input__wrapper #zubie {
  1138. font-size: 18px;
  1139. }
  1140. ::v-deep .el-input__wrapper #renyuan {
  1141. font-size: 18px;
  1142. }
  1143. ::v-deep .el-input__wrapper #shuliang {
  1144. font-size: 18px;
  1145. color: red;
  1146. }
  1147. ::v-deep .el-input__wrapper #chima {
  1148. font-size: 18px;
  1149. }
  1150. /* 尺码 */
  1151. ::v-deep .el-input__wrapper #cm1 {
  1152. font-size: 20px;
  1153. }
  1154. ::v-deep .el-input__wrapper #cm2 {
  1155. font-size: 20px;
  1156. }
  1157. ::v-deep .el-input__wrapper #cm3 {
  1158. font-size: 20px;
  1159. }
  1160. ::v-deep .el-input__wrapper #cm4 {
  1161. font-size: 20px;
  1162. }
  1163. ::v-deep .el-input__wrapper #cm5 {
  1164. font-size: 20px;
  1165. }
  1166. ::v-deep .el-input__wrapper #cm6 {
  1167. font-size: 20px;
  1168. }
  1169. ::v-deep .el-input__wrapper #cm7 {
  1170. font-size: 20px;
  1171. }
  1172. ::v-deep .el-input__wrapper #cm8 {
  1173. font-size: 20px;
  1174. }
  1175. ::v-deep .el-input__wrapper #cm9 {
  1176. font-size: 20px;
  1177. }
  1178. ::v-deep .el-input__wrapper #cm10 {
  1179. font-size: 20px;
  1180. }
  1181. ::v-deep .el-input__wrapper #cm11 {
  1182. font-size: 20px;
  1183. }
  1184. ::v-deep .el-input__wrapper #cmtotal {
  1185. font-size: 20px;
  1186. }
  1187. /* 制单数 */
  1188. ::v-deep .el-input__wrapper #zdsc1 {
  1189. font-size: 20px;
  1190. }
  1191. ::v-deep .el-input__wrapper #zdsc2 {
  1192. font-size: 20px;
  1193. }
  1194. ::v-deep .el-input__wrapper #zdsc3 {
  1195. font-size: 20px;
  1196. }
  1197. ::v-deep .el-input__wrapper #zdsc4 {
  1198. font-size: 20px;
  1199. }
  1200. ::v-deep .el-input__wrapper #zdsc5 {
  1201. font-size: 20px;
  1202. }
  1203. ::v-deep .el-input__wrapper #zdsc6 {
  1204. font-size: 20px;
  1205. }
  1206. ::v-deep .el-input__wrapper #zdsc7 {
  1207. font-size: 20px;
  1208. }
  1209. ::v-deep .el-input__wrapper #zdsc8 {
  1210. font-size: 20px;
  1211. }
  1212. ::v-deep .el-input__wrapper #zdsc9 {
  1213. font-size: 20px;
  1214. }
  1215. ::v-deep .el-input__wrapper #zdsc10 {
  1216. font-size: 20px;
  1217. }
  1218. ::v-deep .el-input__wrapper #zdtotal {
  1219. font-size: 20px;
  1220. }
  1221. /* 实裁数 */
  1222. ::v-deep .el-input__wrapper #scsl1 {
  1223. font-size: 20px;
  1224. color: red !important;
  1225. }
  1226. ::v-deep .el-input__wrapper #scsl2 {
  1227. font-size: 20px;
  1228. color: red !important;
  1229. }
  1230. ::v-deep .el-input__wrapper #scsl3 {
  1231. font-size: 20px;
  1232. color: red !important;
  1233. }
  1234. ::v-deep .el-input__wrapper #scsl4 {
  1235. font-size: 20px;
  1236. color: red !important;
  1237. }
  1238. ::v-deep .el-input__wrapper #scsl5 {
  1239. font-size: 20px;
  1240. color: red !important;
  1241. }
  1242. ::v-deep .el-input__wrapper #scsl6 {
  1243. font-size: 20px;
  1244. color: red !important;
  1245. }
  1246. ::v-deep .el-input__wrapper #scsl7 {
  1247. font-size: 20px;
  1248. color: red !important;
  1249. }
  1250. ::v-deep .el-input__wrapper #scsl8 {
  1251. font-size: 20px;
  1252. color: red !important;
  1253. }
  1254. ::v-deep .el-input__wrapper #scsl9 {
  1255. font-size: 20px;
  1256. color: red !important;
  1257. }
  1258. ::v-deep .el-input__wrapper #scsl10 {
  1259. font-size: 20px;
  1260. color: red !important;
  1261. }
  1262. ::v-deep .el-input__wrapper #sctotal {
  1263. font-size: 20px;
  1264. color: red !important;
  1265. }
  1266. /* 数量 */
  1267. ::v-deep .el-input__wrapper #sl1 {
  1268. font-size: 20px;
  1269. }
  1270. ::v-deep .el-input__wrapper #sl2 {
  1271. font-size: 20px;
  1272. }
  1273. ::v-deep .el-input__wrapper #sl3 {
  1274. font-size: 20px;
  1275. }
  1276. ::v-deep .el-input__wrapper #sl4 {
  1277. font-size: 20px;
  1278. }
  1279. ::v-deep .el-input__wrapper #sl5 {
  1280. font-size: 20px;
  1281. }
  1282. ::v-deep .el-input__wrapper #sl6 {
  1283. font-size: 20px;
  1284. }
  1285. ::v-deep .el-input__wrapper #sl7 {
  1286. font-size: 20px;
  1287. }
  1288. ::v-deep .el-input__wrapper #sl8 {
  1289. font-size: 20px;
  1290. }
  1291. ::v-deep .el-input__wrapper #sl9 {
  1292. font-size: 20px;
  1293. }
  1294. ::v-deep .el-input__wrapper #sl10 {
  1295. font-size: 20px;
  1296. }
  1297. ::v-deep .el-input__wrapper #sctotal {
  1298. font-size: 20px;
  1299. }
  1300. /* 选择历史记录改变颜色 */
  1301. .highlight-cell {
  1302. height: 40px;
  1303. /* 背景 */
  1304. background-color: rgba(190, 79, 79, 0.7) !important;
  1305. /* 使用 Flexbox 布局 */
  1306. display: flex;
  1307. /* 垂直居中 */
  1308. align-items: center;
  1309. /* 水平居中 */
  1310. justify-content: center;
  1311. /* 可选,确保 div 宽度填满单元格 */
  1312. width: 100%;
  1313. /* 可选,确保 padding 和 border 不会增加 div 的宽度 */
  1314. box-sizing: border-box;
  1315. }
  1316. .custom-button-text {
  1317. font-size: 25px;
  1318. /* 或者你想要的任何大小 */
  1319. }
  1320. /* 自定义表格样式 */
  1321. .custom-table >>> .el-table {
  1322. border: 2px solid #333; /* 表格整体边框加深 */
  1323. }
  1324. .custom-table >>> .el-table__header-wrapper th {
  1325. border-bottom: 2px solid #333; /* 表头底部边框加深 */
  1326. }
  1327. .custom-table >>> .el-table__body-wrapper td {
  1328. border: 1px solid #666; /* 表格单元格边框加深 */
  1329. }
  1330. .custom-table >>> .el-table__cell {
  1331. font-size: 20px; /* 单元格字体大小 */
  1332. font-weight: 600; /* 单元格字体加粗 */
  1333. }
  1334. .number-container {
  1335. display: flex;
  1336. flex-wrap: wrap;
  1337. gap: 4px;
  1338. margin-top: 3px;
  1339. }
  1340. .number-box {
  1341. display: flex;
  1342. justify-content: center;
  1343. align-items: center;
  1344. width: 40px;
  1345. height: 40px;
  1346. background-color: #f2f2f2;
  1347. border: 1px solid #ddd;
  1348. border-radius: 8px;
  1349. font-size: 18px;
  1350. color: #333;
  1351. font-weight: bold;
  1352. transition: background-color 0.3s;
  1353. }
  1354. .number-box.green {
  1355. /* 完成包数(绿色) */
  1356. background-color: palegreen;
  1357. color: #155724;
  1358. border-color: #c3e6cb;
  1359. }
  1360. .number-box.red {
  1361. background-color: red; /* 废弃包数(红色) */
  1362. color: #721c24;
  1363. border-color: #f5c6cb;
  1364. }
  1365. </style>