Manualdocuments.vue 54 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675
  1. <template>
  2. <div>
  3. <!-- 左侧树形结构 -->
  4. <el-container>
  5. <el-aside width="250px">
  6. <div class="JKWTree-tree">
  7. <h3>手工检验计件单据维护</h3>
  8. <el-tree :data="treeData" :props="defaultProps" highlight-current="true"
  9. @node-click="handleNodeClick"></el-tree>
  10. </div>
  11. </el-aside>
  12. <el-container>
  13. <el-main>
  14. <!-- 按钮区域 -->
  15. <div class="gva-table-box">
  16. <div class="gva-btn-list">
  17. <el-row :span="6">
  18. <el-input v-model="positionvalue" placeholder="输入工单编号或产品名称" />
  19. </el-row>
  20. <el-button type="primary" class="search" icon="search" @click="onSearch"></el-button>
  21. <el-button type="primary" class="bt" icon="plus" @click="onAdd">新增</el-button>
  22. <el-button type="primary" class="bt" icon="refresh" @click="onRefresh">刷新质检系数</el-button>
  23. <el-button type="primary" class="bt" icon="thumb" @click="onCountByGdbh">切换显示方式</el-button>
  24. <el-button type="primary" class="bt" icon="delete" @click="onDel">删除</el-button>
  25. <div style="margin-left: auto;">
  26. <el-button type="primary" :icon="Download" @click="exportExcel">导出到Excel</el-button>
  27. </div>
  28. </div>
  29. <!-- 数据展示 -->
  30. <el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData" row-key="ID"
  31. highlight-current-row="true" border @selection-change="handleSelectionChange" @row-click="Click"
  32. :show-overflow-tooltip="true" @row-dblclick="doubleClick">
  33. <el-table-column type="selection" width="55" />
  34. <el-table-column align="left" label="工单印件" prop="combinedProp" width="340"/>
  35. <el-table-column align="left" label="印件工序" prop="combinedProp2" width="340"/>
  36. <el-table-column align="left" label="日期" prop="sczl_rq" width="120" />
  37. <el-table-column align="left" label="产量" prop="sczl_cl" width="120" />
  38. <el-table-column align="left" label="千件工价" prop="千件工价" width="120" />
  39. <el-table-column align="left" label="检验类别" prop="sczl_检验类别" width="120" />
  40. <el-table-column align="left" label="废品率系数" prop="sczl_废品率系数" width="120" />
  41. <el-table-column align="left" label="日定额" prop="日定额" width="120" />
  42. <el-table-column align="left" label="组长编号" prop="sczl_bh0" width="120" />
  43. <el-table-column align="left" label="组长姓名" prop="员工姓名" width="120" />
  44. <el-table-column align="left" label="流程单备注" prop="qczl_NumDesc" width="120" />
  45. <el-table-column align="left" label="创建用户" prop="sys_id" width="120" />
  46. <el-table-column align="left" label="创建时间" prop="sys_rq" width="160" />
  47. <el-table-column align="left" label="修改时间" prop="mod_rq" width="160" />
  48. <el-table-column align="left" label="UNIQID" prop="UniqId" width="120" />
  49. </el-table>
  50. <!-- 分页 -->
  51. <div class="gva-pagination">
  52. <el-pagination layout="total, sizes, prev, pager, next, jumper" v-model:current-page="page"
  53. v-model:page-size="limit"
  54. :page-sizes="[10, 30, 50, 100]" :total="total" @current-change="handleCurrentChange"
  55. @size-change="handleSizeChange" />
  56. </div>
  57. </div>
  58. <!-- 弹出框 -->
  59. <el-dialog v-model="dialogFormVisible" :before-close="closeDialog" :title="type === 'create' ? '添加' : '修改'"
  60. destroy-on-close width="1000px">
  61. <el-form :model="formData" label-position="right" ref="elFormRef" :rules="rule" label-width="70px" >
  62. <el-row :gutter="24">
  63. <el-col :span="4">
  64. <el-form-item label="日期" prop="id" class="mab">
  65. <el-input type="date" max="9999-12-31" v-model="formData.sczl_rq" id="日期" @focus="rqHandleFocus()" @keydown="ent1($event, '其他备注', '日期', '组别')" style="width: 120px; " />
  66. </el-form-item>
  67. </el-col>
  68. <el-col :span="4">
  69. <el-form-item label="组别" prop="name" label-width="90px" class="mab">
  70. <el-input v-model="formData.sczl_bzdh" id="组别" @keydown="ent1($event, '日期', '组别', 'bh0')" @blur="getBzsubmit()" style="width: 80px; "/>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="8">
  74. <el-form-item label="组长" prop="name" class="mab" label-width="50px">
  75. <el-input v-model="formData.sczl_bh0" id="bh0" @keydown="ent1($event, '组别', 'bh0', 'name0')" @blur="getygsubmit($event, '0')" style="width: 100px; margin-right: 5px;" />
  76. <el-input v-model="formData.sczl_bh0_name" id="name0" :readonly=true @keydown="ent1($event, 'bh0', 'name0', '箱数')" style="width: 100px; " />
  77. </el-form-item>
  78. </el-col>
  79. <el-col :span="4">
  80. <el-form-item label="箱数" prop="name" class="mab" label-width="50px">
  81. <el-input v-model="formData.sczl_cl0" id="箱数" @keydown="ent1($event, 'name0', '箱数', '每箱数')" style="width: 100px; " />
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="4">
  85. <el-form-item label="每箱数" prop="name" class="mab" label-width="55px">
  86. <el-input v-model="formData.sczl_fp0" id="每箱数" @keydown="ent1($event, '箱数', '每箱数', '工单编号')" style="width: 100px;" />
  87. </el-form-item>
  88. </el-col>
  89. </el-row>
  90. <el-row :gutter="24">
  91. <el-col :span="24">
  92. <el-form-item label="工单编号" prop="id" class="mab">
  93. <el-input v-model="formData.sczl_gdbh" id="工单编号" @keydown="ent1($event, '每箱数', '工单编号', 'yjgx')" @blur="getGxMcsubmit" style="width: 118px; margin-right: 5px;"/>
  94. <el-input v-model="formData.sczl_yjgx" id="yjgx" :readonly=true @keydown="ent1($event, '工单编号', 'yjgx', 'gxmc')" style="width: 80px; margin-right: 5px;"/>
  95. <el-input v-model="formData.sczl_gxmc" id="gxmc" :readonly=true @keydown="ent1($event, 'yjgx', 'gxmc', 'yjmc')" style="width: 135px; margin-right: 5px;"/>
  96. <el-input v-model="formData.yj_yjmc" id="yjmc" :readonly=true @keydown="ent1($event, 'gxmc', 'yjmc', '产量合计')" style="width: 542px;"/>
  97. </el-form-item>
  98. </el-col>
  99. </el-row>
  100. <el-row :gutter="24">
  101. <el-col :span="6">
  102. <el-form-item label="产量合计" prop="id" class="mab">
  103. <el-input v-model="formData.sczl_cl" id="产量合计" :readonly=true @keydown="ent1($event, 'gxmc', '产量合计', '定额代号')" style="width: 150px;" />
  104. </el-form-item>
  105. </el-col>
  106. <el-col :span="6">
  107. <el-form-item label="定额代号" prop="id" label-width="100px" class="mab">
  108. <el-input v-model="formData.sczl_dedh" id="定额代号" @keydown="ent1($event, '产量合计', '定额代号', '检验类别')" @blur="getDedhsubmit" style="width: 150px;" />
  109. </el-form-item>
  110. </el-col>
  111. <el-col :span="6">
  112. <el-form-item label="检验类别" prop="name" class="mab">
  113. <el-input v-model="formData.sczl_检验类别" id="检验类别" @keydown="ent1($event, '定额代号', '检验类别', '废品率系数')" @blur="getLbsubmit" style="width: 150px;"/>
  114. </el-form-item>
  115. </el-col>
  116. <el-col :span="6">
  117. <el-form-item label="废品率系数" prop="name" label-width="100px" class="mab">
  118. <el-input v-model="formData.sczl_废品率系数" id="废品率系数" @keydown="ent1($event, '检验类别', '废品率系数', '计时时数')" style="width: 150px;"/>
  119. </el-form-item>
  120. </el-col>
  121. </el-row>
  122. <el-row :gutter="24">
  123. <el-col :span="6">
  124. <el-form-item label="计时时数" prop="id" class="mab">
  125. <el-input v-model="formData.sczl_jsss" id="计时时数" @keydown="ent1($event, '废品率系数', '计时时数', '冲月定额')" style="width: 100px;"/>
  126. </el-form-item>
  127. </el-col>
  128. <el-col :span="6">
  129. <el-form-item label="冲月定额" prop="id" class="mab" label-width="100px">
  130. <el-input v-model="formData.sczl_冲定额" id="冲月定额" @keydown="ent1($event, '计时时数', '冲月定额', '流程单号1')" style="width: 100px;"/>
  131. </el-form-item>
  132. </el-col>
  133. </el-row>
  134. <el-row :gutter="24">
  135. <el-col :span="17">
  136. <el-form-item label="流程单号" prop="id" class="mab">
  137. <el-input v-model="formData.流程单号1" id="流程单号1" @keydown="ent1($event, '冲月定额', '流程单号1', '流程单号2')" style="width: 60px; margin-right: 5px;"/>
  138. <el-input v-model="formData.流程单号2" id="流程单号2" @keydown="ent1($event, '流程单号1', '流程单号2', '流程单号3')" style="width: 60px; margin-right: 5px;"/>
  139. <el-input v-model="formData.流程单号3" id="流程单号3" @keydown="ent1($event, '流程单号2', '流程单号3', '流程单号4')" style="width: 60px; margin-right: 5px;"/>
  140. <el-input v-model="formData.流程单号4" id="流程单号4" @keydown="ent1($event, '流程单号3', '流程单号4', '流程单号5')" style="width: 60px; margin-right: 5px;"/>
  141. <el-input v-model="formData.流程单号5" id="流程单号5" @keydown="ent1($event, '流程单号4', '流程单号5', '流程单号6')" style="width: 60px; margin-right: 5px;"/>
  142. <el-input v-model="formData.流程单号6" id="流程单号6" @keydown="ent1($event, '流程单号5', '流程单号6', '流程单号7')" style="width: 60px; margin-right: 5px;"/>
  143. <el-input v-model="formData.流程单号7" id="流程单号7" @keydown="ent1($event, '流程单号6', '流程单号7', '流程单号8')" style="width: 60px; margin-right: 5px;"/>
  144. <el-input v-model="formData.流程单号8" id="流程单号8" @keydown="ent1($event, '流程单号7', '流程单号8', '流程单号9')" style="width: 60px; margin-right: 5px;"/>
  145. <el-input v-model="formData.流程单号9" id="流程单号9" @keydown="ent1($event, '流程单号8', '流程单号9', '备注')" style="width: 60px;"/>
  146. </el-form-item>
  147. </el-col>
  148. <el-col :span="7">
  149. <el-form-item label="备注" prop="id" label-width="50px">
  150. <el-input v-model="formData.qczl_NumDesc" id="备注" @keydown="ent1($event, '流程单号9', '备注', 'bh1')" />
  151. </el-form-item>
  152. </el-col>
  153. </el-row>
  154. <el-row :gutter="19" style="margin-bottom: 5px; margin-left: 30px;">
  155. <span style="margin-left: 25px; margin-right: 50px;">员工编号</span>
  156. <span style="margin-right: 50px;">员工姓名</span>
  157. <span style="margin-right: 50px;">&nbsp;&nbsp;箱数&nbsp;&nbsp;</span>
  158. <span style="margin-right: 120px;">每箱数量</span>
  159. <span style="margin-right: 50px;">员工编号</span>
  160. <span style="margin-right: 50px;">员工姓名</span>
  161. <span style="margin-right: 50px;">&nbsp;&nbsp;箱数&nbsp;&nbsp;</span>
  162. <span>每箱数量</span>
  163. </el-row>
  164. <el-row :gutter="24" style="margin-bottom: 5px; margin-left: 30px;">
  165. <div style="width: 450px;margin-right: 30px;">
  166. <div v-for="index in 6" :key="index">
  167. <el-input style="width: 100px; margin-right: 5px;" v-model="formData['sczl_bh' + index]" :id="'bh' + index" @keydown="ent($event, index.toString())" />
  168. <el-input style="width: 100px; margin-right: 5px; color: red;" :readonly="true" :value="formData['sczl_bh' + index + '_name']" :id="'name' + index" @keydown="ent1($event)"/>
  169. <el-input style="width: 100px; margin-right: 5px;" v-model="formData['sczl_cl' + index]" :id="'cl' + index" @keydown="ent1($event)"/>
  170. <el-input style="width: 100px;" v-model="formData['sczl_fp' + index]" :id="'fp' + index" @keydown="ent1($event)"/>
  171. </div>
  172. </div>
  173. <div style="width: 450px;">
  174. <div v-for="index in 6" :key="index + 6">
  175. <el-input style="width: 100px; margin-right: 5px;" v-model="formData['sczl_bh' + (index + 6)]" :id="'bh' + (index + 6)" @keydown="ent($event, (index + 6).toString())" />
  176. <el-input style="width: 100px; margin-right: 5px; color: red;" :readonly="true" :value="formData['sczl_bh' + (index + 6) + '_name']" :id="'name' + (index + 6)" @keydown="ent1($event)"/>
  177. <el-input style="width: 100px; margin-right: 5px;" :value="formData['sczl_cl' + (index + 6)]" :id="'cl' + (index + 6)" @keydown="ent1($event)"/>
  178. <el-input style="width: 100px;" :value="formData['sczl_fp' + (index + 6)]" :id="'fp' + (index + 6)" @keydown="ent1($event)"/>
  179. </div>
  180. </div>
  181. </el-row>
  182. <el-row :gutter="24">
  183. <el-col :span="24">
  184. <el-form-item label="其他备注" prop="id" class="mab">
  185. <el-input v-model="formData.sczl_desc" id="其他备注" @keydown="ent1($event, 'fp12', '其他备注', '日期')" />
  186. </el-form-item>
  187. </el-col>
  188. </el-row>
  189. </el-form>
  190. <el-dialog v-model="dialogSelectVisible" title="选择"
  191. destroy-on-close width="800px" >
  192. <el-table tooltip-effect="dark" :data="selectData" row-key="ID"
  193. highlight-current-row="true" border style="width:100%"
  194. @row-dblclick="handleSelectClick" >
  195. <el-table-column prop="Gd_cpmc" label="印件名称" width="450" />
  196. <el-table-column prop="jyGx" label="检验工序" width="85" />
  197. <el-table-column prop="Gy0_gxmc" label="工序名称" width="225" />
  198. </el-table>
  199. </el-dialog>
  200. <template #footer>
  201. <div class="dialog-footer">
  202. <el-button @click="closeDialog">取 消</el-button>
  203. <el-button type="primary" @click="enterDialog">确 定</el-button>
  204. </div>
  205. </template>
  206. </el-dialog>
  207. <el-dialog
  208. v-model="GetDedhVisible"
  209. title="选择"
  210. destroy-on-close
  211. width="600px"
  212. >
  213. <el-aside width="250px">
  214. <div class="JKWTree-tree">
  215. <el-tree :data="GetDedhtreeData" :props="defaultProps" highlight-current="true"
  216. @node-click="GetDedhhandleNodeClick" @node-dblclick="handleNodeDoubleClick"></el-tree>
  217. </div>
  218. </el-aside>
  219. </el-dialog>
  220. <el-dialog v-model="BzVisible" title="选择" destroy-on-close width="200px" >
  221. <el-table tooltip-effect="dark" :data="selectDataBz" row-key="ID"
  222. highlight-current-row="true" border style="width:100%"
  223. @row-dblclick="SelectClickBz"
  224. >
  225. <el-table-column prop="sczl_bzdh" label="班组" width="150" />
  226. </el-table>
  227. </el-dialog>
  228. <el-dialog v-model="LbVisible" title="选择" destroy-on-close width="200px" >
  229. <el-table tooltip-effect="dark" :data="selectDataLb" row-key="ID"
  230. highlight-current-row="true" border style="width:100%"
  231. :row-style="{ height: '30px' }"
  232. @row-dblclick="SelectClickLb"
  233. >
  234. <el-table-column prop="sczl_检验类别" label="可选名称" width="150" />
  235. </el-table>
  236. </el-dialog>
  237. </el-main>
  238. </el-container>
  239. </el-container>
  240. </div>
  241. </template>
  242. <script setup>
  243. import {
  244. getDateList,
  245. getInspectCount,
  246. shougonglocate,
  247. shougonggetInfo,
  248. shougonggetGxMc,
  249. shougonggetDedh,
  250. shougonggetScrapFactor,
  251. shougongedit,
  252. shougongdel,
  253. getYg,
  254. getInspectCountByGdbh,
  255. inspectadd
  256. } from '@/api/jixiaoguanli/jitairibaobiao'
  257. // 全量引入格式化工具 请按需保留
  258. import { getDictFunc, formatDate, formatBoolean, filterDict, ReturnArrImg, onDownloadFile } from '@/utils/format'
  259. import { ElMessage, ElMessageBox } from 'element-plus'
  260. import { Search, Refresh, Download } from '@element-plus/icons-vue'
  261. import { ref, reactive, nextTick, onMounted, onBeforeMount } from 'vue'
  262. import { getPackingSideTable, getPackingTable } from '@/api/mes_api_gty/myapi'
  263. defineOptions({
  264. name: '06-packingDocuments'
  265. })
  266. // 侧边栏数据请求
  267. const treeData = reactive([]);
  268. const getTabdata = async () => {
  269. //接口调用函数
  270. const response = await getInspectCount();
  271. console.log(response)
  272. const transformedData = response.data.map(item => ({
  273. label: `${item.date.replace(/-/g, '.')}【单据数: ${item.counts}张】`,
  274. children: item.sys.map(sysItem => ({
  275. label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
  276. params: {
  277. date: item.date.replace(/-/g, '.'),
  278. sys_id: sysItem.sys_id,
  279. total: sysItem.count,
  280. },
  281. })),
  282. }));
  283. treeData.splice(0, treeData.length, ...transformedData);
  284. displayMod.value = 'date'
  285. }
  286. getTabdata();
  287. // 自动化生成的字典(可能为空)以及字段
  288. const formData = ref({
  289. sczl_rq: '',
  290. sczl_bzdh: '',
  291. sczl_bh0: '',
  292. sczl_bh0_name: '',
  293. sczl_cl0: '',
  294. sczl_fp0: '',
  295. sczl_gdbh: '',
  296. sczl_yjgx: '',
  297. sczl_gxmc: '',
  298. yj_yjmc: '',
  299. sczl_cl: '',
  300. sczl_dedh: '',
  301. sczl_检验类别: '',
  302. sczl_废品率系数: '',
  303. sczl_jsss: '',
  304. sczl_冲定额: '',
  305. 流程单号1: '',
  306. 流程单号2: '',
  307. 流程单号3: '',
  308. 流程单号4: '',
  309. 流程单号5: '',
  310. 流程单号6: '',
  311. 流程单号7: '',
  312. 流程单号8: '',
  313. 流程单号9: '',
  314. qczl_NumDesc: '',
  315. sczl_desc: '',
  316. sczl_bh1: '',
  317. sczl_bh2: '',
  318. sczl_bh3:'',
  319. sczl_bh4: '',
  320. sczl_bh5: '',
  321. sczl_bh6: '',
  322. sczl_bh7: '',
  323. sczl_bh8: '',
  324. sczl_bh9: '',
  325. sczl_bh10: '',
  326. sczl_bh11: '',
  327. sczl_bh12: '',
  328. sczl_bh1_name: '',
  329. sczl_bh2_name: '',
  330. sczl_bh3_name: '',
  331. sczl_bh4_name: '',
  332. sczl_bh5_name: '',
  333. sczl_bh6_name: '',
  334. sczl_bh7_name: '',
  335. sczl_bh8_name: '',
  336. sczl_bh9_name: '',
  337. sczl_bh10_name: '',
  338. sczl_bh11_name: '',
  339. sczl_bh12_name: '',
  340. sczl_cl1: '',
  341. sczl_cl2: '',
  342. sczl_cl3: '',
  343. sczl_cl4: '',
  344. sczl_cl5: '',
  345. sczl_cl6: '',
  346. sczl_cl7: '',
  347. sczl_cl8: '',
  348. sczl_cl9: '',
  349. sczl_cl10: '',
  350. sczl_cl11:'',
  351. sczl_cl12: '',
  352. sczl_fp1: '',
  353. sczl_fp2: '',
  354. sczl_fp3: '',
  355. sczl_fp4: '',
  356. sczl_fp5: '',
  357. sczl_fp6: '',
  358. sczl_fp7: '',
  359. sczl_fp8: '',
  360. sczl_fp9: '',
  361. sczl_fp10: '',
  362. sczl_fp11: '',
  363. sczl_fp12: '',
  364. })
  365. const initFormData = () => {
  366. formData.value = {
  367. sczl_rq: '',
  368. sczl_bzdh: '',
  369. sczl_bh0: '',
  370. sczl_bh0_name: '',
  371. sczl_cl0: '0.00',
  372. sczl_fp0: '0',
  373. sczl_gdbh: '',
  374. sczl_yjgx: '',
  375. sczl_gxmc: '',
  376. yj_yjmc: '',
  377. sczl_cl: '0',
  378. sczl_dedh: '',
  379. sczl_检验类别: '',
  380. sczl_废品率系数: '0.000',
  381. sczl_jsss: '0.00',
  382. sczl_冲定额: '',
  383. 流程单号1: '',
  384. 流程单号2: '',
  385. 流程单号3: '',
  386. 流程单号4: '',
  387. 流程单号5: '',
  388. 流程单号6: '',
  389. 流程单号7: '',
  390. 流程单号8: '',
  391. 流程单号9: '',
  392. qczl_NumDesc: '',
  393. sczl_desc: '',
  394. sczl_bh1: '',
  395. sczl_bh2: '',
  396. sczl_bh3:'',
  397. sczl_bh4: '',
  398. sczl_bh5: '',
  399. sczl_bh6: '',
  400. sczl_bh7: '',
  401. sczl_bh8: '',
  402. sczl_bh9: '',
  403. sczl_bh10: '',
  404. sczl_bh11: '',
  405. sczl_bh12: '',
  406. sczl_bh1_name: '',
  407. sczl_bh2_name: '',
  408. sczl_bh3_name: '',
  409. sczl_bh4_name: '',
  410. sczl_bh5_name: '',
  411. sczl_bh6_name: '',
  412. sczl_bh7_name: '',
  413. sczl_bh8_name: '',
  414. sczl_bh9_name: '',
  415. sczl_bh10_name: '',
  416. sczl_bh11_name: '',
  417. sczl_bh12_name: '',
  418. sczl_cl1: '0',
  419. sczl_cl2: '0',
  420. sczl_cl3: '0',
  421. sczl_cl4: '0',
  422. sczl_cl5: '0',
  423. sczl_cl6: '0',
  424. sczl_cl7: '0',
  425. sczl_cl8: '0',
  426. sczl_cl9: '0',
  427. sczl_cl10: '0',
  428. sczl_cl11:'0',
  429. sczl_cl12: '0',
  430. sczl_fp1: '0',
  431. sczl_fp2: '0',
  432. sczl_fp3: '0',
  433. sczl_fp4: '0',
  434. sczl_fp5: '0',
  435. sczl_fp6: '0',
  436. sczl_fp7: '0',
  437. sczl_fp8: '0',
  438. sczl_fp9: '0',
  439. sczl_fp10: '0',
  440. sczl_fp11: '0',
  441. sczl_fp12: '0',
  442. };
  443. }
  444. // 验证规则
  445. const rule = reactive({
  446. })
  447. const elFormRef = ref()
  448. const elSearchFormRef = ref()
  449. // =========== 表格控制部分 ===========
  450. const tableData = reactive([])
  451. const detailData = reactive([])
  452. const total = ref(0)
  453. const page = ref(1)
  454. const limit = ref(10)
  455. const searchInfo = ref('')
  456. const params = {
  457. type: '',
  458. date: '',
  459. sys_id: '',
  460. gdbh: '',
  461. }
  462. // 分页设置
  463. const handleSizeChange = (val) => {
  464. switch (params.type) {
  465. case 'getTableData':
  466. getTableData()
  467. break
  468. case 'getLocateTable':
  469. GetLocate()
  470. break
  471. default:
  472. break
  473. }
  474. }
  475. // 页面跳转
  476. const handleCurrentChange = (val) => {
  477. switch (params.type) {
  478. case 'getTableData':
  479. getTableData()
  480. break
  481. case 'getLocateTable':
  482. GetLocate()
  483. break
  484. default:
  485. break
  486. }
  487. console.log(params.type)
  488. }
  489. const getTableData = async() => {
  490. // const response = await getDateList(params);
  491. // console.log(response)
  492. // if (response.code === 0) {
  493. // const processedData = response.data.data.map(item => {
  494. // return {
  495. // ...item,
  496. // combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
  497. // combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
  498. // };
  499. // });
  500. // tableData.splice(0, tableData.length, ...processedData);
  501. // }
  502. const response = await getDateList({
  503. date: params.date, sys_id: params.sys_id,
  504. page: page.value.toString(), limit: limit.value.toString(),
  505. })
  506. if (response.code === 0) {
  507. console.log(response)
  508. const processedData = response.data.data.map(item => {
  509. return {
  510. ...item,
  511. combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
  512. combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
  513. };
  514. });
  515. tableData.splice(0, tableData.length, ...processedData);
  516. console.log(tableData)
  517. }
  518. }
  519. const handleNodeClick = (node,check) => {
  520. //存放当前节点的nodeId
  521. if (node.params) {
  522. params.date = node.params.date.replace(/\./g, '-');
  523. params.sys_id = node.params.sys_id;
  524. params.type = 'getTableData'
  525. total.value = node.params.total;
  526. page.value = 1
  527. getTableData();
  528. }
  529. }
  530. //定位
  531. const GetLocate = async () => {
  532. const response = await shougonglocate({
  533. gdbh: params.gdbh,
  534. page: page.value.toString(), limit: limit.value.toString(),
  535. })
  536. console.log(response)
  537. if (response.code === 0) {
  538. const processedData = response.data.rows.map(item => {
  539. return {
  540. ...item,
  541. combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
  542. combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
  543. };
  544. });
  545. total.value = response.data.total
  546. tableData.splice(0, tableData.length, ...processedData);
  547. }
  548. }
  549. let positionvalue=ref()
  550. // 搜索
  551. function onSearch() {
  552. params.gdbh = positionvalue.value
  553. params.type = 'getLocateTable'
  554. page.value = 1
  555. GetLocate()
  556. }
  557. //获取详细信息
  558. const GetInfo = async (value) => {
  559. const response = await shougonggetInfo({UniqId:value});
  560. if (response.code === 0) {
  561. formData.value=response.data;
  562. }
  563. }
  564. //键盘 input框跳转
  565. const ent1 = (event) => {
  566. const inputs = document.getElementsByTagName('input');
  567. const currentIndex = Array.from(inputs).indexOf(event.target);
  568. if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
  569. if(event.target.id=='其他备注'){
  570. ElMessageBox.confirm('数据存盘?', '提示', {
  571. confirmButtonText: '确定',
  572. cancelButtonText: '取消',
  573. type: 'warning'
  574. }).then(() => {
  575. enterDialog()
  576. })
  577. }
  578. for (let i = currentIndex + 1; i < inputs.length; i++) {
  579. if (!inputs[i].readOnly) {
  580. nextTick(()=>{
  581. inputs[i].focus();
  582. inputs[i].select();
  583. })
  584. break;
  585. }
  586. }
  587. if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
  588. ent_sum()
  589. }
  590. } else if (event.keyCode === 38) { // 向上箭头
  591. for (let i = currentIndex - 1; i >= 0; i--) {
  592. if (!inputs[i].readOnly) {
  593. nextTick(()=>{
  594. inputs[i].focus();
  595. inputs[i].select();
  596. })
  597. break;
  598. }
  599. }
  600. if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
  601. ent_sum()
  602. }
  603. } else if (event.keyCode === 8) { // 删除箭头
  604. if (event.target.selectionStart === 0) {
  605. for (let i = currentIndex - 1; i >= 0; i--) {
  606. if (!inputs[i].readOnly) {
  607. nextTick(()=>{
  608. inputs[i].focus();
  609. inputs[i].setSelectionRange(0, 0);
  610. })
  611. break;
  612. }
  613. }
  614. if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
  615. ent_sum()
  616. }
  617. }
  618. } else if (event.keyCode === 37) { // 向左箭头
  619. if (event.target.selectionStart === 0) {
  620. for (let i = currentIndex - 1; i >= 0; i--) {
  621. if (!inputs[i].readOnly) {
  622. nextTick(()=>{
  623. inputs[i].focus();
  624. inputs[i].select();
  625. })
  626. break;
  627. }
  628. }
  629. if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
  630. ent_sum()
  631. }
  632. }
  633. } else if (event.keyCode === 39) { // 向右箭头
  634. if(event.target.id=='其他备注'){
  635. ElMessageBox.confirm('数据存盘?', '提示', {
  636. confirmButtonText: '确定',
  637. cancelButtonText: '取消',
  638. type: 'warning'
  639. }).then(() => {
  640. enterDialog()
  641. })
  642. }
  643. if (event.target.selectionStart === event.target.value.length) {
  644. for (let i = currentIndex + 1; i < inputs.length; i++) {
  645. if (!inputs[i].readOnly) {
  646. nextTick(()=>{
  647. inputs[i].focus();
  648. inputs[i].select();
  649. })
  650. break;
  651. }
  652. }
  653. }
  654. if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
  655. ent_sum()
  656. }
  657. }
  658. }
  659. //追加字体颜色和不可输入
  660. const setColorReadonly = (id) => {
  661. const newInput = document.getElementById(id)
  662. newInput.style.color = 'red';
  663. newInput.setAttribute('readonly', true);
  664. }
  665. //追加字体颜色和可输入
  666. const unsetColorReadonly = (id) => {
  667. const newInput = document.getElementById(id)
  668. newInput.style.color = 'black';
  669. newInput.removeAttribute('readonly');
  670. }
  671. //日期获得焦点事件
  672. const rqHandleFocus = () =>{
  673. if(formData.value.sczl_rq==''){
  674. formData.value.sczl_rq = new Date().toISOString().split('T')[0]
  675. }
  676. }
  677. //班组失去焦点事件
  678. const getBzsubmit = () => {
  679. //弹出选择
  680. const data = [{'sczl_bzdh':'A班'},{'sczl_bzdh':'B班'}]
  681. selectDataBz.splice(0, selectDataBz.length, ...data)
  682. BzVisible.value=true
  683. }
  684. //班组选择
  685. const selectDataBz = reactive([])
  686. const BzVisible = ref(false)
  687. const SelectClickBz = (row, column, event) => {
  688. const {sczl_bzdh } = row
  689. formData.value.sczl_bzdh=row.sczl_bzdh
  690. BzVisible.value = false
  691. }
  692. //员工编号失去焦点事件
  693. const getygsubmit = async (event, inputName) => {
  694. let combinedString = 'sczl_bh' + inputName;
  695. let value = eval('formData.value.' + combinedString);
  696. if(value){
  697. const response = await getYg({sczl_bh:value});
  698. if (response.code === 0) {
  699. let Bname = 'sczl_bh' + inputName+'_name';
  700. formData.value[Bname]=response.data.ygxm;
  701. //设置姓名样式
  702. if(inputName>0){
  703. unsetColorReadonly('cl'+inputName)
  704. unsetColorReadonly('fp'+inputName)
  705. }
  706. }
  707. }
  708. }
  709. const ent_sum = () =>{
  710. let sum = 0;
  711. for(var i=1;i<=12;i++){
  712. sum += formData.value['sczl_cl'+i] * formData.value['sczl_fp'+i]
  713. }
  714. formData.value.sczl_cl = sum
  715. }
  716. //员工编号键盘事件
  717. const ent = (event, inputName) => {
  718. let combinedString = 'sczl_bh' + inputName;
  719. let value = eval('formData.value.' + combinedString);
  720. if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
  721. if(value){
  722. getYg({sczl_bh:value}).then(response => {
  723. if (response.code == 0) {
  724. let Bname = 'sczl_bh' + inputName+'_name';
  725. formData.value[Bname]=response.data.ygxm;
  726. //设置姓名样式
  727. unsetColorReadonly('cl'+inputName)
  728. unsetColorReadonly('fp'+inputName)
  729. document.getElementById('cl'+inputName).focus()
  730. document.getElementById('cl'+inputName).select()
  731. }else{
  732. formData.value['sczl_bh' + inputName+'_name']='';
  733. formData.value['sczl_cl' + inputName]='0';
  734. formData.value['sczl_fp' + inputName]='0';
  735. //设置姓名样式
  736. setColorReadonly('cl'+inputName);
  737. setColorReadonly('fp'+inputName);
  738. if(inputName!=12){
  739. document.getElementById('bh'+(parseInt(inputName)+1)).focus()
  740. document.getElementById('bh'+(parseInt(inputName)+1)).select()
  741. }else{
  742. document.getElementById('其他备注').focus()
  743. document.getElementById('其他备注').select()
  744. }
  745. }
  746. });
  747. }else{
  748. formData.value['sczl_bh' + inputName+'_name']='';
  749. formData.value['sczl_cl' + inputName]='0';
  750. formData.value['sczl_fp' + inputName]='0';
  751. //设置姓名样式
  752. setColorReadonly('cl'+inputName);
  753. setColorReadonly('fp'+inputName);
  754. console.log('bh'+(parseInt(inputName)+1))
  755. if(inputName!=12){
  756. document.getElementById('bh'+(parseInt(inputName)+1)).focus()
  757. document.getElementById('bh'+(parseInt(inputName)+1)).select()
  758. }else{
  759. document.getElementById('其他备注').focus()
  760. document.getElementById('其他备注').select()
  761. }
  762. }
  763. ent_sum()
  764. } else if (event.keyCode === 38) { // 向上箭头
  765. if(value){
  766. getYg({sczl_bh:value}).then(response => {
  767. if (response.code == 0) {
  768. let Bname = 'sczl_bh' + inputName+'_name';
  769. formData.value[Bname]=response.data.ygxm;
  770. //设置姓名样式
  771. unsetColorReadonly('cl'+inputName)
  772. unsetColorReadonly('fp'+inputName)
  773. if(inputName!=1){
  774. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  775. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  776. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  777. }else{
  778. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  779. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  780. }
  781. }else{
  782. document.getElementById('备注').focus()
  783. document.getElementById('备注').select()
  784. }
  785. }else{
  786. formData.value['sczl_bh' + inputName+'_name']='';
  787. formData.value['sczl_cl' + inputName]='0';
  788. formData.value['sczl_fp' + inputName]='0';
  789. //设置姓名样式
  790. setColorReadonly('cl'+inputName);
  791. setColorReadonly('fp'+inputName);
  792. if(inputName!=1){
  793. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  794. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  795. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  796. }else{
  797. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  798. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  799. }
  800. }else{
  801. document.getElementById('备注').focus()
  802. document.getElementById('备注').select()
  803. }
  804. }
  805. });
  806. }else{
  807. formData.value['sczl_bh' + inputName+'_name']='';
  808. formData.value['sczl_cl' + inputName]='0';
  809. formData.value['sczl_fp' + inputName]='0';
  810. //设置姓名样式
  811. setColorReadonly('cl'+inputName);
  812. setColorReadonly('fp'+inputName);
  813. if(inputName!=1){
  814. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  815. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  816. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  817. }else{
  818. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  819. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  820. }
  821. }else{
  822. document.getElementById('备注').focus()
  823. document.getElementById('备注').select()
  824. }
  825. }
  826. ent_sum()
  827. } else if (event.keyCode === 8) { // 删除箭头
  828. if (event.target.selectionStart === 0) {
  829. if(value){
  830. getYg({sczl_bh:value}).then(response => {
  831. if (response.code == 0) {
  832. let Bname = 'sczl_bh' + inputName+'_name';
  833. formData.value[Bname]=response.data.ygxm;
  834. //设置姓名样式
  835. unsetColorReadonly('cl'+inputName)
  836. unsetColorReadonly('fp'+inputName)
  837. if(inputName!=1){
  838. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  839. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  840. document.getElementById('bh'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  841. }else{
  842. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  843. document.getElementById('fp'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  844. }
  845. }else{
  846. document.getElementById('备注').focus()
  847. document.getElementById('备注').setSelectionRange(0, 0)
  848. }
  849. }else{
  850. formData.value['sczl_bh' + inputName+'_name']='';
  851. formData.value['sczl_cl' + inputName]='0';
  852. formData.value['sczl_fp' + inputName]='0';
  853. //设置姓名样式
  854. setColorReadonly('cl'+inputName);
  855. setColorReadonly('fp'+inputName);
  856. if(inputName!=1){
  857. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  858. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  859. document.getElementById('bh'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  860. }else{
  861. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  862. document.getElementById('fp'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  863. }
  864. }else{
  865. document.getElementById('备注').focus()
  866. document.getElementById('备注').setSelectionRange(0, 0)
  867. }
  868. }
  869. });
  870. }else{
  871. formData.value['sczl_bh' + inputName+'_name']='';
  872. formData.value['sczl_cl' + inputName]='0';
  873. formData.value['sczl_fp' + inputName]='0';
  874. //设置姓名样式
  875. setColorReadonly('cl'+inputName);
  876. setColorReadonly('fp'+inputName);
  877. if(inputName!=1){
  878. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  879. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  880. document.getElementById('bh'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  881. }else{
  882. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  883. document.getElementById('fp'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  884. }
  885. }else{
  886. document.getElementById('备注').focus()
  887. document.getElementById('备注').setSelectionRange(0, 0)
  888. }
  889. }
  890. ent_sum()
  891. }
  892. } else if (event.keyCode === 37) { // 向左箭头
  893. if (event.target.selectionStart === 0) {
  894. if(value){
  895. getYg({sczl_bh:value}).then(response => {
  896. if (response.code == 0) {
  897. let Bname = 'sczl_bh' + inputName+'_name';
  898. formData.value[Bname]=response.data.ygxm;
  899. //设置姓名样式
  900. unsetColorReadonly('cl'+inputName)
  901. unsetColorReadonly('fp'+inputName)
  902. if(inputName!=1){
  903. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  904. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  905. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  906. }else{
  907. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  908. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  909. }
  910. }else{
  911. document.getElementById('备注').focus()
  912. document.getElementById('备注').select()
  913. }
  914. }else{
  915. formData.value['sczl_bh' + inputName+'_name']='';
  916. formData.value['sczl_cl' + inputName]='0';
  917. formData.value['sczl_fp' + inputName]='0';
  918. //设置姓名样式
  919. setColorReadonly('cl'+inputName);
  920. setColorReadonly('fp'+inputName);
  921. if(inputName!=1){
  922. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  923. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  924. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  925. }else{
  926. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  927. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  928. }
  929. }else{
  930. document.getElementById('备注').focus()
  931. document.getElementById('备注').select()
  932. }
  933. }
  934. });
  935. }else{
  936. formData.value['sczl_bh' + inputName+'_name']='';
  937. formData.value['sczl_cl' + inputName]='0';
  938. formData.value['sczl_fp' + inputName]='0';
  939. //设置姓名样式
  940. setColorReadonly('cl'+inputName);
  941. setColorReadonly('fp'+inputName);
  942. if(inputName!=1){
  943. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  944. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  945. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  946. }else{
  947. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  948. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  949. }
  950. }else{
  951. document.getElementById('备注').focus()
  952. document.getElementById('备注').select()
  953. }
  954. }
  955. ent_sum()
  956. }
  957. } else if (event.keyCode === 39) { // 向右箭头
  958. if (event.target.selectionStart === event.target.value.length) {
  959. if(value){
  960. getYg({sczl_bh:value}).then(response => {
  961. if (response.code == 0) {
  962. let Bname = 'sczl_bh' + inputName+'_name';
  963. formData.value[Bname]=response.data.ygxm;
  964. //设置姓名样式
  965. unsetColorReadonly('cl'+inputName)
  966. unsetColorReadonly('fp'+inputName)
  967. document.getElementById('cl'+inputName).focus()
  968. document.getElementById('cl'+inputName).select()
  969. }else{
  970. formData.value['sczl_bh' + inputName+'_name']='';
  971. formData.value['sczl_cl' + inputName]='0';
  972. formData.value['sczl_fp' + inputName]='0';
  973. //设置姓名样式
  974. setColorReadonly('cl'+inputName);
  975. setColorReadonly('fp'+inputName);
  976. if(inputName!=12){
  977. document.getElementById('bh'+(parseInt(inputName)+1)).focus()
  978. document.getElementById('bh'+(parseInt(inputName)+1)).select()
  979. }else{
  980. document.getElementById('其他备注').focus()
  981. document.getElementById('其他备注').select()
  982. }
  983. }
  984. });
  985. }else{
  986. formData.value['sczl_bh' + inputName+'_name']='';
  987. formData.value['sczl_cl' + inputName]='0';
  988. formData.value['sczl_fp' + inputName]='0';
  989. //设置姓名样式
  990. setColorReadonly('cl'+inputName);
  991. setColorReadonly('fp'+inputName);
  992. console.log('bh'+(parseInt(inputName)+1))
  993. if(inputName!=12){
  994. document.getElementById('bh'+(parseInt(inputName)+1)).focus()
  995. document.getElementById('bh'+(parseInt(inputName)+1)).select()
  996. }else{
  997. document.getElementById('其他备注').focus()
  998. document.getElementById('其他备注').select()
  999. }
  1000. }
  1001. ent_sum()
  1002. }
  1003. }
  1004. }
  1005. //工单编号失去焦点事件
  1006. const getGxMcsubmit = async() => {
  1007. if(formData.value.sczl_gdbh!=''){
  1008. const response = await shougonggetGxMc({gdbh:formData.value.sczl_gdbh});
  1009. if (response.code === 0) {
  1010. if(response.data.length==0){
  1011. ElMessage({
  1012. type: 'error',
  1013. message: '查无此编号的工单,请仔细检查后重新输入'
  1014. })
  1015. //设置输入框的值为空
  1016. formData.value.sczl_gdbh = ''
  1017. formData.value.sczl_yjgx = ''
  1018. formData.value.sczl_gxmc = ''
  1019. formData.value.yj_yjmc = ''
  1020. }else if(response.data.length==1){
  1021. const { Gd_cpmc, Gy0_yjno, Gy0_gxh, Gy0_gxmc,jyGx} = response.data[0]
  1022. formData.value.yj_yjmc=Gd_cpmc
  1023. formData.value.sczl_gxmc=Gy0_gxmc
  1024. formData.value.sczl_yjgx=jyGx
  1025. setColorReadonly('yjgx');
  1026. setColorReadonly('gxmc');
  1027. setColorReadonly('yjmc');
  1028. }else{
  1029. if(GetDedhVisible.value){
  1030. return false
  1031. }
  1032. selectData.splice(0, selectData.length, ...response.data)
  1033. dialogSelectVisible.value=true
  1034. }
  1035. }
  1036. }else{
  1037. ElMessage({
  1038. type: 'error',
  1039. message: '请注意, 工单编号输入空置, 除非有特殊需要!'
  1040. })
  1041. formData.value.sczl_yjgx = ''
  1042. formData.value.sczl_gxmc = ''
  1043. formData.value.yj_yjmc = ''
  1044. }
  1045. }
  1046. const dialogSelectVisible = ref(false)
  1047. const selectData = reactive([])
  1048. // 工单选择框
  1049. const handleSelectClick = (row, column, event) => {
  1050. const { Gd_cpmc, Gy0_yjno, Gy0_gxh, Gy0_gxmc,jyGx } = row
  1051. formData.value.yj_yjmc=Gd_cpmc
  1052. formData.value.sczl_gxmc=Gy0_gxmc
  1053. formData.value.sczl_yjgx=jyGx
  1054. setColorReadonly('yjgx');
  1055. setColorReadonly('gxmc');
  1056. setColorReadonly('yjmc');
  1057. dialogSelectVisible.value = false
  1058. }
  1059. //定额代号回车事件
  1060. const getDedhsubmit = () => {
  1061. if(dialogSelectVisible.value){
  1062. return false
  1063. }
  1064. if(LbVisible.value){
  1065. return false
  1066. }
  1067. GetDedh()
  1068. }
  1069. let GetDedhtreeData = reactive([]);
  1070. const GetDedhVisible = ref(false)
  1071. //获取定额代号
  1072. const GetDedh = async (value) => {
  1073. const response = await shougonggetDedh();
  1074. const treeData = {};
  1075. // const data = [];
  1076. // data[0] = response.data;
  1077. // //判断值是否在选项中存在
  1078. // const buildTree1 = (node) => {
  1079. // const arr = [];
  1080. // // 如果存在子节点,递归地添加它们
  1081. // if (node.bh_mc && Array.isArray(node.bh_mc)) {
  1082. // node.bh_mc.forEach(childNode => {
  1083. // arr.push(...buildTree1(childNode)); // 递归调用
  1084. // });
  1085. // }else{
  1086. // arr.push(node.sys_bh)
  1087. // }
  1088. // return arr;
  1089. // };
  1090. // // 构建树形结构的根节点
  1091. // const Data = data.map(buildTree1);
  1092. if(response.code==0){
  1093. const data = [];
  1094. data[0] = response.data;
  1095. // 递归函数来构建树形结构
  1096. const buildTree = (node) => {
  1097. const treeNode = {
  1098. label: node.sys_bh + '【' + node.sys_mc+'】',
  1099. children: []
  1100. };
  1101. // 如果存在子节点,递归地添加它们
  1102. if (node.bh_mc && Array.isArray(node.bh_mc)) {
  1103. node.bh_mc.forEach(childNode => {
  1104. treeNode.children.push(buildTree(childNode)); // 递归调用
  1105. });
  1106. }
  1107. return treeNode;
  1108. };
  1109. // 构建树形结构的根节点
  1110. const treeData = data.map(buildTree);
  1111. GetDedhtreeData = treeData;
  1112. GetDedhVisible.value=true
  1113. }
  1114. }
  1115. //定额代号树形结构单机
  1116. const GetDedhhandleNodeClick = (nodeData, node, component) => {
  1117. //存放当前节点的nodeId
  1118. if (!nodeData.children || nodeData.children.length === 0) {
  1119. // 点击的是子节点
  1120. formData.value.sczl_dedh=nodeData.label.split("【")[0]
  1121. GetDedhVisible.value=false
  1122. }
  1123. // 执行相应的父节点单击事件处理逻辑
  1124. }
  1125. //检验类别失去焦点事件
  1126. const getLbsubmit = () => {
  1127. if(GetDedhVisible.value){
  1128. return false
  1129. }
  1130. //弹出选择
  1131. const data = [{'sczl_检验类别':''},{'sczl_检验类别':'正品板'},{'sczl_检验类别':'次品板'},{'sczl_检验类别':'废品板'}]
  1132. selectDataLb.splice(0, selectDataLb.length, ...data)
  1133. LbVisible.value=true
  1134. }
  1135. //班组选择
  1136. const selectDataLb = reactive([])
  1137. const LbVisible = ref(false)
  1138. const SelectClickLb = (row, column, event) => {
  1139. const {sczl_检验类别 } = row
  1140. formData.value.sczl_检验类别=row.sczl_检验类别
  1141. //查询废品系数
  1142. if(row.sczl_检验类别!=''){
  1143. var value = {
  1144. 'gdbh':formData.value.sczl_gdbh,
  1145. 'yjno':parseInt(formData.value.sczl_yjgx.split('-')[0]),
  1146. 'gxh':parseInt(formData.value.sczl_yjgx.split('-')[1]),
  1147. 'type':formData.value.sczl_检验类别
  1148. }
  1149. shougonggetScrapFactor(value).then(response=>{
  1150. if(response.code==0){
  1151. if(response.data!=null){
  1152. formData.value.sczl_废品率系数 = response.data.num;
  1153. }
  1154. setColorReadonly('废品率系数')
  1155. }
  1156. });
  1157. }else{
  1158. unsetColorReadonly('废品率系数')
  1159. }
  1160. LbVisible.value = false
  1161. }
  1162. //刷新废品率系数
  1163. const GetScrapFactor = async (value) => {
  1164. const response = await shougonggetScrapFactor(value);
  1165. if(response.code==0){
  1166. console.log(response.data.num)
  1167. const rowIndex = tableData.findIndex(row => row.UniqId === lastCellValue);
  1168. console.log(rowIndex)
  1169. tableData[rowIndex].sczl_废品率系数 = response.data.num;
  1170. }
  1171. // console.log(response)
  1172. // const rowIndex = tableData.findIndex(row => row.UniqId === 123);
  1173. }
  1174. const ADD=ref('0')
  1175. //新增
  1176. function onAdd() {
  1177. ADD.value='新增'
  1178. type.value = 'create'
  1179. if(typeof(lastCellValue)=='number'){
  1180. GetInfo(lastCellValue)
  1181. }
  1182. initFormData()
  1183. dialogFormVisible.value = true
  1184. // Productionadd()
  1185. }
  1186. const ScrapFactor={
  1187. gdbh:'',
  1188. yjno:'',
  1189. gxh:'',
  1190. type:'',
  1191. }
  1192. // 刷新废品率系数
  1193. function onRefresh() {
  1194. GetScrapFactor(ScrapFactor)
  1195. }
  1196. // 更新数据
  1197. const updateDetailData = async() => {
  1198. const restoredData = {
  1199. UniqId: lastCellValue,
  1200. sczl_rq: formData.value.sczl_rq,
  1201. sczl_bzdh: formData.value.sczl_bzdh,
  1202. sczl_bh0: formData.value.sczl_bh0,
  1203. sczl_cl0: formData.value.sczl_cl0,
  1204. sczl_fp0: formData.value.sczl_fp0,
  1205. sczl_gdbh: formData.value.sczl_gdbh,
  1206. sczl_yjgx: formData.value.sczl_yjgx,
  1207. sczl_gxmc: formData.value.sczl_gxmc,
  1208. sczl_cl:formData.value.sczl_cl,
  1209. sczl_dedh: formData.value.sczl_dedh,
  1210. sczl_检验类别: formData.value.sczl_检验类别,
  1211. sczl_废品率系数: formData.value.sczl_废品率系数,
  1212. sczl_jsss: formData.value.sczl_jsss,
  1213. sczl_冲定额: formData.value.sczl_冲定额,
  1214. qczl_Num:formData.value.qczl_NumDesc,
  1215. qczl_NumDesc:formData.value.流程单号1,
  1216. qczl_NumDesc1: formData.value.流程单号2,
  1217. qczl_NumDesc2: formData.value.流程单号3,
  1218. qczl_NumDesc3: formData.value.流程单号4,
  1219. qczl_NumDesc4: formData.value.流程单号5,
  1220. qczl_NumDesc5: formData.value.流程单号6,
  1221. qczl_NumDesc6: formData.value.流程单号7,
  1222. qczl_NumDesc7: formData.value.流程单号8,
  1223. qczl_NumDesc8: formData.value.流程单号9,
  1224. sczl_desc: formData.value.sczl_desc,
  1225. sczl_bh1: formData.value.sczl_bh1,
  1226. sczl_bh2: formData.value.sczl_bh2,
  1227. sczl_bh3:formData.value.sczl_bh3,
  1228. sczl_bh4: formData.value.sczl_bh4,
  1229. sczl_bh5: formData.value.sczl_bh5,
  1230. sczl_bh6: formData.value.sczl_bh6,
  1231. sczl_bh7: formData.value.sczl_bh7,
  1232. sczl_bh8: formData.value.sczl_bh8,
  1233. sczl_bh9: formData.value.sczl_bh9,
  1234. sczl_bh10: formData.value.sczl_bh10,
  1235. sczl_bh11: formData.value.sczl_bh11,
  1236. sczl_bh12: formData.value.sczl_bh12,
  1237. sczl_cl1: formData.value.sczl_cl1,
  1238. sczl_cl2: formData.value.sczl_cl2,
  1239. sczl_cl3: formData.value.sczl_cl3,
  1240. sczl_cl4: formData.value.sczl_cl4,
  1241. sczl_cl5: formData.value.sczl_cl5,
  1242. sczl_cl6: formData.value.sczl_cl6,
  1243. sczl_cl7: formData.value.sczl_cl7,
  1244. sczl_cl8: formData.value.sczl_cl8,
  1245. sczl_cl9: formData.value.sczl_cl9,
  1246. sczl_cl10: formData.value.sczl_cl10,
  1247. sczl_cl11:formData.value.sczl_cl11,
  1248. sczl_cl12: formData.value.sczl_cl12,
  1249. sczl_fp1: formData.value.sczl_fp1,
  1250. sczl_fp2: formData.value.sczl_fp2,
  1251. sczl_fp3: formData.value.sczl_fp3,
  1252. sczl_fp4: formData.value.sczl_fp4,
  1253. sczl_fp5: formData.value.sczl_fp5,
  1254. sczl_fp6: formData.value.sczl_fp6,
  1255. sczl_fp7: formData.value.sczl_fp7,
  1256. sczl_fp8: formData.value.sczl_fp8,
  1257. sczl_fp9: formData.value.sczl_fp9,
  1258. sczl_fp10: formData.value.sczl_fp10,
  1259. sczl_fp11: formData.value.sczl_fp11,
  1260. sczl_fp12: formData.value.sczl_fp12,
  1261. sys_id:'[1013/洪丽]',
  1262. }
  1263. // detailData.table.forEach((item, index, array) => {
  1264. // const num = index + 1
  1265. // restoredData[`sczl_gdbh${num}`] = item.sczl_gdbh
  1266. // restoredData[`sczl_yjGx${num}`] = item.sczl_yjGx
  1267. // restoredData[`sczl_gxmc${num}`] = item.sczl_gxmc
  1268. // // restoredData[`Gd_cpmc${num}`] = item.Gd_cpmc
  1269. // restoredData[`sczl_cl${num}`] = item.sczl_cl
  1270. // restoredData[`sczl_PgCl${num}`] = item.sczl_PgCl
  1271. // restoredData[`sczl_clAdd${num}`] = item.sczl_clAdd
  1272. // })
  1273. if(ADD.value=='新增'){
  1274. // console.log('新增')
  1275. console.log('新增')
  1276. console.log(ADD.value)
  1277. console.log(restoredData)
  1278. const response = await inspectadd(restoredData);
  1279. // ADD.value='1'
  1280. // console.log(ADD.value)
  1281. ADD.value='0'
  1282. console.log(response)
  1283. if(response.code==0){
  1284. ElMessage({
  1285. type: 'success',
  1286. message: '新增成功',
  1287. })
  1288. }
  1289. dialogFormVisible.value = false
  1290. }else{
  1291. const response = await shougongedit(restoredData);
  1292. console.log('修改')
  1293. console.log(ADD.value)
  1294. console.log(response)
  1295. if(response.code==0){
  1296. ElMessage({
  1297. type: 'success',
  1298. message: '更新成功',
  1299. })
  1300. }
  1301. dialogFormVisible.value = false
  1302. // ADD.value='0'
  1303. // console.log(ADD.value)
  1304. }
  1305. // console.log(restoredData)
  1306. // console.log(lastCellValue)
  1307. // formData.value.UniqId=lastCellValue
  1308. // console.log(formData)
  1309. // restoredData.UniqId='5'
  1310. // console.log(FormData)
  1311. // console.log(response)
  1312. }
  1313. // 删除
  1314. function onDel() {
  1315. Del()
  1316. }
  1317. //删除
  1318. const Del = async () => {
  1319. const response = await shougongdel({UniqId:lastCellValue});
  1320. if (response.code === 0) {
  1321. ElMessage({
  1322. type: 'success',
  1323. message: '删除成功',
  1324. })
  1325. }
  1326. getTableData()
  1327. }
  1328. const displayMod = ref('')
  1329. // 按工单显示
  1330. function onCountByGdbh() {
  1331. console.log(displayMod.value)
  1332. if (displayMod.value === 'date') {
  1333. displayMod.value = 'gd'
  1334. CountByGdbh()
  1335. console.log(displayMod.value)
  1336. } else {
  1337. getTabdata()
  1338. }
  1339. // CountByGdbh()
  1340. }
  1341. //按工单显示
  1342. const CountByGdbh = async () => {
  1343. const response = await getInspectCountByGdbh();
  1344. // console.log(response)
  1345. if (response.code === 0) {
  1346. console.log(response)
  1347. const transformedData = response.data.map(item => ({
  1348. label: `${item.sczl_gdbh+item.cpmc}`,
  1349. children: item.sys.map(sysItem => ({
  1350. label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
  1351. params: {
  1352. date: item.sczl_gdbh,
  1353. sys_id: sysItem.sys_id,
  1354. total: sysItem.count,
  1355. },
  1356. })),
  1357. }));
  1358. treeData.splice(0, treeData.length, ...transformedData);
  1359. }
  1360. // getTableData()
  1361. }
  1362. // ============== 表格控制部分结束 ===============
  1363. // 获取需要的字典 可能为空 按需保留
  1364. const setOptions = async () => {
  1365. }
  1366. // 获取需要的字典 可能为空 按需保留
  1367. setOptions()
  1368. // 多选数据
  1369. const multipleSelection = ref([])
  1370. // 多选
  1371. const handleSelectionChange = (val) => {
  1372. if(val.length>0){
  1373. multipleSelection.value = val
  1374. const lenth=val.length
  1375. ScrapFactor.gdbh=val[lenth-1].combinedProp.split('-')[0];
  1376. const parts = val[lenth-1].combinedProp2.split('-')
  1377. ScrapFactor.yjno=parts[0];
  1378. ScrapFactor.gxh=parts[1];
  1379. // ScrapFactor.type=val[lenth-1].sczl_检验类别
  1380. ScrapFactor.type='正品板'
  1381. console.log(ScrapFactor)
  1382. lastCellValue=val[lenth-1].UniqId
  1383. console.log(ScrapFactor)
  1384. val.splice(0, val.length); // 清空 val 数组
  1385. console.log(lastCellValue)
  1386. }
  1387. }
  1388. // 批量删除控制标记
  1389. const deleteVisible = ref(false)
  1390. // 多选删除
  1391. const onDelete = async () => {
  1392. const ids = []
  1393. if (multipleSelection.value.length === 0) {
  1394. ElMessage({
  1395. type: 'warning',
  1396. message: '请选择要删除的数据'
  1397. })
  1398. return
  1399. }
  1400. multipleSelection.value &&
  1401. multipleSelection.value.map(item => {
  1402. ids.push(item.ID)
  1403. })
  1404. const res = await deleteCompanyByIds({ ids })
  1405. if (res.code === 0) {
  1406. ElMessage({
  1407. type: 'success',
  1408. message: '删除成功'
  1409. })
  1410. if (tableData.value.length === ids.length && page.value > 1) {
  1411. page.value--
  1412. }
  1413. deleteVisible.value = false
  1414. getTableData()
  1415. }
  1416. }
  1417. // 行为控制标记(弹窗内部需要增还是改)
  1418. const type = ref('')
  1419. // 更新行
  1420. const updateCompanyFunc = async (row) => {
  1421. const res = await findCompany({ ID: row.ID })
  1422. type.value = 'update'
  1423. if (res.code === 0) {
  1424. formData.value = res.data.recompany
  1425. dialogFormVisible.value = true
  1426. }
  1427. }
  1428. // 弹窗控制标记
  1429. const dialogFormVisible = ref(false)
  1430. // 打开弹窗
  1431. const openDialog = () => {
  1432. type.value = 'create'
  1433. dialogFormVisible.value = true
  1434. }
  1435. // 关闭弹窗
  1436. const closeDialog = () => {
  1437. dialogFormVisible.value = false
  1438. formData.value = {
  1439. address: '',
  1440. image: '',
  1441. name: '',
  1442. }
  1443. }
  1444. // 弹窗确定
  1445. const enterDialog = async () => {
  1446. ElMessageBox.confirm('数据存盘?', '提示', {
  1447. confirmButtonText: '确定',
  1448. cancelButtonText: '取消',
  1449. type: 'warning'
  1450. }).then(() => {
  1451. if(formData.value.sczl_rq==''){
  1452. ElMessage({
  1453. type: 'error',
  1454. message: '请填写日期'
  1455. });
  1456. document.getElementById('日期').focus()
  1457. document.getElementById('日期').select()
  1458. return;
  1459. }
  1460. if(formData.value.sczl_gdbh==''){
  1461. ElMessage({
  1462. type: 'error',
  1463. message: '请填写工单编号'
  1464. });
  1465. document.getElementById('工单编号').focus()
  1466. document.getElementById('工单编号').select()
  1467. return;
  1468. }
  1469. if(formData.value.sczl_bzdh==''){
  1470. ElMessage({
  1471. type: 'error',
  1472. message: '请选择班组'
  1473. });
  1474. document.getElementById('组别').focus()
  1475. document.getElementById('组别').select()
  1476. return;
  1477. }
  1478. if(formData.value.sczl_dedh==''){
  1479. ElMessage({
  1480. type: 'error',
  1481. message: '请选择定额代号'
  1482. });
  1483. document.getElementById('定额代号').focus()
  1484. document.getElementById('定额代号').select()
  1485. return;
  1486. }
  1487. updateDetailData()
  1488. });
  1489. }
  1490. let table=ref(5);
  1491. let lastCellValue=ref()
  1492. // 双击表格操作
  1493. function doubleClick(row, column, event) {
  1494. type.value = 'update';
  1495. lastCellValue= row['UniqId'];
  1496. console.log(lastCellValue)
  1497. table.value=lastCellValue
  1498. dialogFormVisible.value = true
  1499. // dialogSelectVisible.value = true
  1500. GetInfo(table.value)
  1501. // dialogFormVisible.value = true
  1502. }
  1503. // 单击表格操作
  1504. function Click(row, column, event) {
  1505. lastCellValue= row['UniqId'];
  1506. console.log(lastCellValue)
  1507. }
  1508. // 导出excel
  1509. function exportExcel() {
  1510. console.log('导出到excel');
  1511. }
  1512. // 生命周期钩子
  1513. onMounted(async () => {
  1514. });
  1515. </script>
  1516. <style>
  1517. .JKWTree-container {
  1518. display: flex;
  1519. }
  1520. .JKWTree-tree {
  1521. width: 300px;
  1522. background-color: #fff;
  1523. padding: 10px;
  1524. margin-right: 20px;
  1525. }
  1526. .JKWTree-tree h3 {
  1527. font-size: 15px;
  1528. font-weight: 700;
  1529. margin: 10px 0;
  1530. }
  1531. .JKWTree-content {
  1532. flex: 1;
  1533. }
  1534. /* 选中某行时的背景色*/
  1535. .el-table__body tr.current-row>td {
  1536. background: #ff80ff !important;
  1537. /* 背景颜色 */
  1538. }
  1539. </style>
  1540. <style scoped>
  1541. :deep(.el-table td .cell) {
  1542. line-height: 20px !important;
  1543. }
  1544. :deep(.el-tabs__header){
  1545. margin-bottom: 0;
  1546. }
  1547. .search{
  1548. margin-left: 0px !important;
  1549. margin-right: 10px !important;
  1550. }
  1551. .bt{
  1552. margin-left: 2px !important;
  1553. padding: 3px !important;
  1554. font-size: 12px;
  1555. }
  1556. .el-tabs__header{
  1557. margin: 0px !important;
  1558. }
  1559. .gva-table-box{
  1560. padding: 0px !important;
  1561. }
  1562. .mab{
  1563. margin-bottom: 5px;
  1564. }
  1565. </style>