Manualdocuments.vue 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247
  1. <template>
  2. <div>
  3. <!-- 左侧树形结构 -->
  4. <el-container>
  5. <layout-sider :resize-directions="['right']" :width="220" style="margin-right: 10px;">
  6. <div class="JKWTree-tree" style="height: 70vh;">
  7. <h3>手工检验计件单据维护</h3>
  8. <el-tree :data="treeData" highlight-current @node-click="handleNodeClick" />
  9. </div>
  10. </layout-sider>
  11. <el-container>
  12. <el-main>
  13. <!-- 按钮区域 -->
  14. <div class="gva-table-box">
  15. <el-form-item>
  16. <el-input v-model="positionvalue" placeholder="输入工单编号或产品名称" style="width: 180px;" />
  17. <el-button type="primary" class="search" icon="search" @click="onSearch"></el-button>
  18. <el-button type="primary" class="bt" icon="plus" @click="onAdd">新增</el-button>
  19. <!-- <el-button type="primary" class="bt" icon="copy-document" @click="onCountByGdbh">切换显示方式</el-button> -->
  20. <el-button type="primary" class="bt" icon="refresh" @click="onRefresh">刷新质检系数</el-button>
  21. <el-button type="primary" class="bt" icon="delete" @click="onDel">删除</el-button>
  22. <div style="margin-left: auto;">
  23. <el-button type="primary" :icon="Download" @click="exportExcel">导出到Excel</el-button>
  24. </div>
  25. </el-form-item>
  26. <!-- 数据展示 -->
  27. <el-table ref="multipleTable" style="width: 100%" tooltip-effect="dark" :data="tableData"
  28. row-key="ID" highlight-current-row="true" border @selection-change="handleSelectionChange"
  29. @row-click="Click" :show-overflow-tooltip="true" @row-dblclick="doubleClick">
  30. <el-table-column type="selection" width="55" />
  31. <el-table-column align="left" sortable label="工单印件" prop="combinedProp" width="340" />
  32. <el-table-column align="left" sortable label="印件工序" prop="combinedProp2" width="150" />
  33. <el-table-column align="left" sortable label="日期" prop="sczl_rq" width="120" />
  34. <el-table-column align="left" sortable label="产量" prop="sczl_cl" width="77" />
  35. <el-table-column align="left" sortable label="千件工价" prop="千件工价" width="105" />
  36. <el-table-column align="left" sortable label="检验类别" prop="sczl_检验类别" width="105" />
  37. <el-table-column align="left" sortable label="废品率系数" prop="sczl_废品率系数" width="120" />
  38. <el-table-column align="left" sortable label="日定额" prop="日定额" width="91" />
  39. <el-table-column align="left" sortable label="组长编号" prop="sczl_bh0" width="105" />
  40. <el-table-column align="left" sortable label="组长姓名" prop="员工姓名" width="105" />
  41. <el-table-column align="left" sortable label="流程单备注" prop="qczl_NumDesc" width="120" />
  42. <el-table-column align="left" sortable label="创建用户" prop="sys_id" width="120" />
  43. <el-table-column align="left" sortable label="创建时间" prop="sys_rq" width="160" />
  44. <el-table-column align="left" sortable label="修改时间" prop="mod_rq" width="160" />
  45. <el-table-column align="left" sortable label="UNIQID" prop="UniqId" width="120" />
  46. </el-table>
  47. <!-- 分页 -->
  48. <div class="gva-pagination">
  49. <el-pagination layout="total, sizes, prev, pager, next, jumper" v-model:current-page="page"
  50. v-model:page-size="limit" :page-sizes="[10, 30, 50, 100]" :total="total"
  51. @current-change="handleCurrentChange" @size-change="handleSizeChange" />
  52. </div>
  53. </div>
  54. <!-- 弹出框 -->
  55. <el-dialog v-model="dialogFormVisible" :before-close="closeDialog"
  56. :title="type === 'create' ? '添加' : '修改'" destroy-on-close width="1000px">
  57. <el-form :model="formData" label-position="right" ref="elFormRef" :rules="rule"
  58. label-width="70px" @keyup="moveFocus">
  59. <el-row :gutter="24">
  60. <el-col :span="4">
  61. <el-form-item label="日期" prop="id" class="mab">
  62. <el-input type="date" max="9999-12-31" v-model="formData.sczl_rq" id="日期"
  63. @focus="rqHandleFocus()" @keydown="ent1($event)" style="width: 120px; " />
  64. </el-form-item>
  65. </el-col>
  66. <el-col :span="4">
  67. <el-form-item label="组别" prop="name" label-width="90px" class="mab">
  68. <el-input v-model="formData.sczl_bzdh" id="组别" @keydown="ent1($event)"
  69. @blur="getBzsubmit()" style="width: 80px; " />
  70. </el-form-item>
  71. </el-col>
  72. <el-col :span="8">
  73. <el-form-item label="组长" prop="name" class="mab" label-width="50px">
  74. <!-- <el-input v-model="formData.sczl_bh0" id="bh0" @keydown="ent1($event,'组别','bh0','name0')"
  75. @blur="getygsubmit($event, '0')" style="width: 100px; margin-right: 5px;" /> -->
  76. <el-input v-model="formData.sczl_bh0" id="bh0" @keydown="ent1($event,'组别','bh0','name0')"
  77. style="width: 100px; margin-right: 5px;" />
  78. <el-input v-model="formData.sczl_bh0_name" id="name0" disabled
  79. @keydown="ent1($event)" style="width: 100px; " />
  80. </el-form-item>
  81. </el-col>
  82. <el-col :span="4">
  83. <el-form-item label="箱数" prop="name" class="mab" label-width="50px">
  84. <el-input v-model="formData.sczl_cl0" id="箱数" @keydown="ent1($event)"
  85. style="width: 100px; " />
  86. </el-form-item>
  87. </el-col>
  88. <el-col :span="4">
  89. <el-form-item label="每箱数" prop="name" class="mab" label-width="55px">
  90. <el-input v-model="formData.sczl_fp0" id="每箱数" @keydown="ent1($event)"
  91. style="width: 100px;" />
  92. </el-form-item>
  93. </el-col>
  94. </el-row>
  95. <el-row :gutter="24">
  96. <el-col :span="24">
  97. <el-form-item label="工单编号" prop="id" class="mab">
  98. <el-input v-model="formData.sczl_gdbh" id="工单编号" placeholder="Enter回车"
  99. @keydown="ent1($event)" @blur="getGxMcsubmit"
  100. style="width: 118px; margin-right: 5px;" />
  101. <el-input v-model="formData.sczl_yjgx" id="yjgx" :readonly="true"
  102. @keydown="ent1($event)" style="width: 80px; margin-right: 5px;" />
  103. <el-input v-model="formData.sczl_gxmc" id="gxmc" :readonly="true"
  104. @keydown="ent1($event)" style="width: 135px; margin-right: 5px;" />
  105. <el-input v-model="formData.yj_yjmc" id="yjmc" :readonly="true"
  106. @keydown="ent1($event)" style="width: 542px;" />
  107. </el-form-item>
  108. </el-col>
  109. </el-row>
  110. <el-row :gutter="24">
  111. <el-col :span="6">
  112. <el-form-item label="产量合计" prop="id" class="mab">
  113. <el-input v-model="formData.sczl_cl" id="产量合计" @keydown="ent1($event)"
  114. style="width: 150px;" />
  115. </el-form-item>
  116. </el-col>
  117. <el-col :span="6">
  118. <el-form-item label="定额代号" prop="id" label-width="100px" class="mab">
  119. <el-input v-model="formData.sczl_dedh" id="定额代号" @keydown="ent1($event,index,row,'定额代号')" style="width: 150px;" />
  120. </el-form-item>
  121. </el-col>
  122. <el-col :span="6">
  123. <el-form-item label="检验类别" prop="name" class="mab">
  124. <el-input v-model="formData.sczl_检验类别" id="检验类别" placeholder="Enter回车"
  125. @keydown="ent1($event,index,row,'检验类别')"style="width: 150px;" />
  126. </el-form-item>
  127. </el-col>
  128. <el-col :span="6">
  129. <el-form-item label="废品率系数" prop="name" label-width="100px" class="mab">
  130. <el-input v-model="formData.sczl_废品率系数" id="废品率系数" @keydown="ent1($event)"
  131. style="width: 150px;" />
  132. </el-form-item>
  133. </el-col>
  134. </el-row>
  135. <el-row :gutter="24">
  136. <el-col :span="6">
  137. <el-form-item label="计时时数" prop="id" class="mab">
  138. <el-input v-model="formData.sczl_jsss" id="计时时数" @keydown="ent1($event)"
  139. style="width: 100px;" />
  140. </el-form-item>
  141. </el-col>
  142. <el-col :span="6">
  143. <el-form-item label="冲月定额" prop="id" class="mab" label-width="100px">
  144. <el-input v-model="formData.sczl_冲定额" id="冲月定额" placeholder="Enter回车"
  145. @keydown="ent1($event,index,row,'冲月定额')" style="width: 100px;" />
  146. </el-form-item>
  147. </el-col>
  148. </el-row>
  149. <el-row :gutter="24">
  150. <el-col :span="17">
  151. <el-form-item label="流程单号" prop="id" class="mab">
  152. <el-input v-model="formData.流程单号1" id="流程单号1" @keydown="ent1($event,index,row,'流程单号')"
  153. style="width: 60px; margin-right: 5px;" />
  154. <el-input v-model="formData.流程单号2" id="流程单号2" @keydown="ent1($event,index,row,'流程单号')"
  155. style="width: 60px; margin-right: 5px;" />
  156. <el-input v-model="formData.流程单号3" id="流程单号3" @keydown="ent1($event,index,row,'流程单号')"
  157. style="width: 60px; margin-right: 5px;" />
  158. <el-input v-model="formData.流程单号4" id="流程单号4" @keydown="ent1($event,index,row,'流程单号')"
  159. style="width: 60px; margin-right: 5px;" />
  160. <el-input v-model="formData.流程单号5" id="流程单号5" @keydown="ent1($event,index,row,'流程单号')"
  161. style="width: 60px; margin-right: 5px;" />
  162. <el-input v-model="formData.流程单号6" id="流程单号6" @keydown="ent1($event,index,row,'流程单号')"
  163. style="width: 60px; margin-right: 5px;" />
  164. <el-input v-model="formData.流程单号7" id="流程单号7" @keydown="ent1($event,index,row,'流程单号')"
  165. style="width: 60px; margin-right: 5px;" />
  166. <el-input v-model="formData.流程单号8" id="流程单号8" @keydown="ent1($event,index,row,'流程单号')"
  167. style="width: 60px; margin-right: 5px;" />
  168. <el-input v-model="formData.流程单号9" id="流程单号9" @keydown="ent1($event,index,row,'流程单号')"
  169. style="width: 60px;" />
  170. </el-form-item>
  171. </el-col>
  172. <el-col :span="7">
  173. <el-form-item label="备注" prop="id" label-width="50px">
  174. <el-input v-model="formData.qczl_NumDesc" id="备注" @keydown="ent1($event)" />
  175. </el-form-item>
  176. </el-col>
  177. </el-row>
  178. <el-row :gutter="19" style="margin-bottom: 5px; margin-left: 30px;">
  179. <span style="margin-left: 25px; margin-right: 50px;">员工编号</span>
  180. <span style="margin-right: 50px;">员工姓名</span>
  181. <span style="margin-right: 50px;">&nbsp;&nbsp;箱数&nbsp;&nbsp;</span>
  182. <span style="margin-right: 120px;">每箱数量</span>
  183. <span style="margin-right: 50px;">员工编号</span>
  184. <span style="margin-right: 50px;">员工姓名</span>
  185. <span style="margin-right: 50px;">&nbsp;&nbsp;箱数&nbsp;&nbsp;</span>
  186. <span>每箱数量</span>
  187. </el-row>
  188. <el-row :gutter="24" style="margin-bottom: 5px; margin-left: 30px;">
  189. <div style="width: 450px;margin-right: 30px;">
  190. <div v-for="index in 6" :key="index">
  191. <el-input style="width: 100px; margin-right: 5px;" placeholder="Enter回车"
  192. v-model="formData['sczl_bh' + index]" :id="'bh' + index"
  193. @keydown="ent($event, index.toString())" />
  194. <el-input style="width: 100px; margin-right: 5px; color: red;" :readonly="true"
  195. v-model="formData['sczl_bh' + index + '_name']" :id="'name' + index"
  196. @keydown="ent1($event)" />
  197. <el-input style="width: 100px; margin-right: 5px;"
  198. v-model="formData['sczl_cl' + index]" :id="'cl' + index"
  199. @keydown="ent1($event)" />
  200. <el-input style="width: 100px;" v-model="formData['sczl_fp' + index]"
  201. :id="'fp' + index" @keydown="ent1($event)" />
  202. </div>
  203. </div>
  204. <div style="width: 450px;">
  205. <div v-for="index in 6" :key="index + 6">
  206. <el-input style="width: 100px; margin-right: 5px;"
  207. v-model="formData['sczl_bh' + (index + 6)]" :id="'bh' + (index + 6)"
  208. @keydown="ent($event, (index + 6).toString())" />
  209. <el-input style="width: 100px; margin-right: 5px; color: red;" :readonly="true"
  210. v-model="formData['sczl_bh' + (index + 6) + '_name']"
  211. :id="'name' + (index + 6)" @keydown="ent1($event)" />
  212. <el-input style="width: 100px; margin-right: 5px;"
  213. v-model="formData['sczl_cl' + (index + 6)]" :id="'cl' + (index + 6)"
  214. @keydown="ent1($event)" />
  215. <el-input style="width: 100px;" v-model="formData['sczl_fp' + (index + 6)]"
  216. :id="'fp' + (index + 6)" @keydown="ent1($event)" />
  217. </div>
  218. </div>
  219. </el-row>
  220. <el-row :gutter="24">
  221. <el-col :span="24">
  222. <el-form-item label="其他备注" prop="id" class="mab">
  223. <el-input v-model="formData.sczl_desc" id="其他备注" @keydown="ent1($event)" />
  224. </el-form-item>
  225. </el-col>
  226. </el-row>
  227. </el-form>
  228. <el-dialog v-model="blModel" title="选择" destroy-on-close width="300px" @keydown="selectygbh($event)">
  229. <el-table :data="employeeData" ref="tableygbh" border :show-overflow-tooltip="true"
  230. :cell-class-name="blplanUsageCellClass"
  231. highlight-current-row="true"
  232. @row-dblclick="SelectClickygbh">
  233. <el-table-column prop="员工编号" label="员工编号"></el-table-column>
  234. <el-table-column prop="ygxm" label="员工姓名"></el-table-column>
  235. </el-table>
  236. </el-dialog>
  237. <el-dialog v-model="BzVisible" title="选择" destroy-on-close width="200px"
  238. @keydown="selectBZ($event)">
  239. <el-table tooltip-effect="dark" :data="selectDataBz" row-key="ID"
  240. highlight-current-row="true" border style="width:100%" @row-dblclick="SelectClickBz"
  241. ref="table">
  242. <el-table-column prop="sczl_bzdh" label="班组" width="150" />
  243. </el-table>
  244. </el-dialog>
  245. <el-dialog v-model="CdeVisible" title="选择" destroy-on-close width="200px"
  246. @keydown="selectCde($event)">
  247. <el-table tooltip-effect="dark" :data="selectDataCde" row-key="ID"
  248. highlight-current-row="true" border style="width:100%" :row-style="{ height: '30px' }"
  249. @row-dblclick="SelectClickCde" ref="tableCde">
  250. <el-table-column prop="sczl_冲定额" width="150" />
  251. </el-table>
  252. </el-dialog>
  253. <el-dialog v-model="dialogSelectVisible" title="选择" destroy-on-close width="800px"
  254. @keydown="selectGX($event)">
  255. <el-table tooltip-effect="dark" :data="selectData" row-key="ID" highlight-current-row="true"
  256. border style="width:100%" @row-dblclick="handleSelectClick" ref="table2">
  257. <el-table-column prop="Gd_cpmc" label="印件名称" width="450" />
  258. <el-table-column prop="jyGx" label="检验工序" width="85" />
  259. <el-table-column prop="Gy0_gxmc" label="工序名称" width="225" />
  260. </el-table>
  261. </el-dialog>
  262. <template #footer>
  263. <div class="dialog-footer">
  264. <el-button @click="closeDialog">取 消</el-button>
  265. <el-button type="primary" @click="enterDialog">确 定</el-button>
  266. </div>
  267. </template>
  268. </el-dialog>
  269. <!-- <el-dialog v-model="GetDedhVisible" title="选择" destroy-on-close width="600px">
  270. <el-aside width="250px">
  271. <div class="JKWTree-tree">
  272. <el-tree :data="GetDedhtreeData" :props="defaultProps" highlight-current="true"
  273. @node-click="GetDedhhandleNodeClick"
  274. @node-dblclick="handleNodeDoubleClick"></el-tree>
  275. </div>
  276. </el-aside>
  277. </el-dialog> -->
  278. <el-dialog
  279. v-model="GetDedhVisible"
  280. title="定额代号"
  281. id="tableFplb"
  282. @keydown="entdedh($event)"
  283. style="margin-top: 5%;"
  284. >
  285. <el-form>
  286. <el-form-item label="定额代号" class="mab" prop="keyOrder"></el-form-item>
  287. <div style="border:1px solid #eee; width:100%; height: 600px; overflow-y: auto;">
  288. <el-tree
  289. :data="GetDedhtreeData"
  290. ref="table_fplb"
  291. @keydown="handleTreeKeydown"
  292. :props="{ children: 'children', label: 'label' }"
  293. node-key="id"
  294. @node-click="GetDedhhandleNodeClick"
  295. ></el-tree>
  296. </div>
  297. </el-form>
  298. </el-dialog>
  299. <el-dialog v-model="LbVisible" title="选择" destroy-on-close width="200px"
  300. @keydown="selectJY($event)">
  301. <el-table tooltip-effect="dark" :data="selectDataLb" row-key="ID" highlight-current-row="true"
  302. border style="width:100%" :row-style="{ height: '30px' }" @row-dblclick="SelectClickLb"
  303. ref="table3">
  304. <el-table-column prop="sczl_检验类别" label="可选名称" width="150" />
  305. </el-table>
  306. </el-dialog>
  307. <!-- 员工选择 -->
  308. <el-dialog v-model="dialogSelectVisible_Yg" title="选择" destroy-on-close width="300px"
  309. @keydown="selectGX_Yg($event)">
  310. <el-table tooltip-effect="dark" :data="selectData_Yg" row-key="ID" highlight-current-row="true"
  311. border style="width:100%" @row-dblclick="handleSelectClick_Yg" ref="table_Yg">
  312. <el-table-column prop="员工编号" label="员工编号" width="100" />
  313. <el-table-column prop="ygxm" label="员工姓名" width="200" />
  314. </el-table>
  315. </el-dialog>
  316. </el-main>
  317. </el-container>
  318. </el-container>
  319. </div>
  320. </template>
  321. <script setup>
  322. import {
  323. getDateList,
  324. getInspectCount,
  325. shougonglocate,
  326. shougonggetInfo,
  327. shougonggetGxMc,
  328. shougonggetDedh,
  329. shougonggetScrapFactor,
  330. shougongedit,
  331. shougongdel,
  332. getYg,
  333. getInspectCountByGdbh,
  334. inspectadd
  335. } from '@/api/jixiaoguanli/jitairibaobiao'
  336. // 全量引入格式化工具 请按需保留
  337. import {
  338. getDictFunc,
  339. formatDate,
  340. formatBoolean,
  341. filterDict,
  342. ReturnArrImg,
  343. onDownloadFile
  344. } from '@/utils/format'
  345. import {
  346. ElMessage,
  347. ElMessageBox
  348. } from 'element-plus'
  349. import {
  350. Search,
  351. Refresh,
  352. Download
  353. } from '@element-plus/icons-vue'
  354. import {
  355. ref,
  356. reactive,
  357. nextTick,
  358. onMounted,
  359. onBeforeMount
  360. } from 'vue'
  361. import {
  362. getPackingSideTable,
  363. getPackingTable
  364. } from '@/api/mes_api_gty/myapi'
  365. import {
  366. Layout,
  367. LayoutContent,
  368. LayoutHeader,
  369. LayoutSider
  370. } from '@arco-design/web-vue'
  371. import {
  372. useUserStore
  373. } from '@/pinia/modules/user'
  374. const userStore = useUserStore()
  375. const sys_id = '[' + userStore.userInfo.userName + '/' + userStore.userInfo.nickName + ']'
  376. defineOptions({
  377. name: '06-packingDocuments'
  378. })
  379. // 侧边栏数据请求
  380. const treeData = reactive([]);
  381. const getTabdata = async () => {
  382. //接口调用函数
  383. const response = await getInspectCount();
  384. const transformedData = response.data.map(item => ({
  385. label: `${item.date.replace(/-/g, '.')}【单据数: ${item.counts}张】`,
  386. children: item.sys.map(sysItem => ({
  387. label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
  388. params: {
  389. date: item.date.replace(/-/g, '.'),
  390. sys_id: sysItem.sys_id,
  391. total: sysItem.count,
  392. },
  393. })),
  394. }));
  395. treeData.splice(0, treeData.length, ...transformedData);
  396. displayMod.value = 'date'
  397. }
  398. getTabdata();
  399. // 自动化生成的字典(可能为空)以及字段
  400. const formData = ref({
  401. sczl_rq: '',
  402. sczl_bzdh: '',
  403. sczl_bh0: '',
  404. sczl_bh0_name: '',
  405. sczl_cl0: '',
  406. sczl_fp0: '',
  407. sczl_gdbh: '',
  408. sczl_yjgx: '',
  409. sczl_gxmc: '',
  410. yj_yjmc: '',
  411. sczl_cl: '',
  412. sczl_dedh: '',
  413. sczl_检验类别: '',
  414. sczl_废品率系数: '',
  415. sczl_jsss: '',
  416. sczl_冲定额: '',
  417. 流程单号1: '',
  418. 流程单号2: '',
  419. 流程单号3: '',
  420. 流程单号4: '',
  421. 流程单号5: '',
  422. 流程单号6: '',
  423. 流程单号7: '',
  424. 流程单号8: '',
  425. 流程单号9: '',
  426. qczl_NumDesc: '',
  427. sczl_desc: '',
  428. sczl_bh1: '',
  429. sczl_bh2: '',
  430. sczl_bh3: '',
  431. sczl_bh4: '',
  432. sczl_bh5: '',
  433. sczl_bh6: '',
  434. sczl_bh7: '',
  435. sczl_bh8: '',
  436. sczl_bh9: '',
  437. sczl_bh10: '',
  438. sczl_bh11: '',
  439. sczl_bh12: '',
  440. sczl_bh1_name: '',
  441. sczl_bh2_name: '',
  442. sczl_bh3_name: '',
  443. sczl_bh4_name: '',
  444. sczl_bh5_name: '',
  445. sczl_bh6_name: '',
  446. sczl_bh7_name: '',
  447. sczl_bh8_name: '',
  448. sczl_bh9_name: '',
  449. sczl_bh10_name: '',
  450. sczl_bh11_name: '',
  451. sczl_bh12_name: '',
  452. sczl_cl1: '',
  453. sczl_cl2: '',
  454. sczl_cl3: '',
  455. sczl_cl4: '',
  456. sczl_cl5: '',
  457. sczl_cl6: '',
  458. sczl_cl7: '',
  459. sczl_cl8: '',
  460. sczl_cl9: '',
  461. sczl_cl10: '',
  462. sczl_cl11: '',
  463. sczl_cl12: '',
  464. sczl_fp1: '',
  465. sczl_fp2: '',
  466. sczl_fp3: '',
  467. sczl_fp4: '',
  468. sczl_fp5: '',
  469. sczl_fp6: '',
  470. sczl_fp7: '',
  471. sczl_fp8: '',
  472. sczl_fp9: '',
  473. sczl_fp10: '',
  474. sczl_fp11: '',
  475. sczl_fp12: '',
  476. })
  477. // 验证规则
  478. const rule = reactive({})
  479. const elFormRef = ref()
  480. const elSearchFormRef = ref()
  481. // =========== 表格控制部分 ===========
  482. const tableData = reactive([])
  483. const detailData = reactive([])
  484. const total = ref(0)
  485. const page = ref(1)
  486. const limit = ref(10)
  487. const searchInfo = ref('')
  488. const params = {
  489. type: '',
  490. date: '',
  491. sys_id: '',
  492. gdbh: '',
  493. }
  494. // 分页设置
  495. const handleSizeChange = (val) => {
  496. switch (params.type) {
  497. case 'getTableData':
  498. getTableData()
  499. break
  500. case 'getLocateTable':
  501. GetLocate()
  502. break
  503. default:
  504. break
  505. }
  506. }
  507. // 页面跳转
  508. const handleCurrentChange = (val) => {
  509. switch (params.type) {
  510. case 'getTableData':
  511. getTableData()
  512. break
  513. case 'getLocateTable':
  514. GetLocate()
  515. break
  516. default:
  517. break
  518. }
  519. console.log(params.type)
  520. }
  521. const getTableData = async () => {
  522. // const response = await getDateList(params);
  523. // console.log(response)
  524. // if (response.code === 0) {
  525. // const processedData = response.data.data.map(item => {
  526. // return {
  527. // ...item,
  528. // combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
  529. // combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
  530. // };
  531. // });
  532. // tableData.splice(0, tableData.length, ...processedData);
  533. // }
  534. const response = await getDateList({
  535. date: params.date,
  536. sys_id: params.sys_id,
  537. page: page.value.toString(),
  538. limit: limit.value.toString(),
  539. })
  540. if (response.code === 0) {
  541. const processedData = response.data.data.map(item => {
  542. return {
  543. ...item,
  544. combinedProp: item.sczl_gdbh + '--' + item.yj_yjmc,
  545. combinedProp2: item.sczl_yjgx + '-' + item.sczl_gxmc
  546. };
  547. });
  548. tableData.splice(0, tableData.length, ...processedData);
  549. }
  550. }
  551. const handleNodeClick = (node, check) => {
  552. //存放当前节点的nodeId
  553. if (node.params) {
  554. params.date = node.params.date.replace(/\./g, '-');
  555. params.sys_id = node.params.sys_id;
  556. params.type = 'getTableData'
  557. total.value = node.params.total;
  558. page.value = 1
  559. getTableData();
  560. }
  561. }
  562. //定位
  563. const GetLocate = async () => {
  564. const response = await shougonglocate({
  565. gdbh: params.gdbh,
  566. page: page.value.toString(),
  567. limit: limit.value.toString(),
  568. })
  569. if (response.code === 0) {
  570. const processedData = response.data.rows.map(item => {
  571. return {
  572. ...item,
  573. combinedProp: item.sczl_gdbh + '--' + item.yj_yjmc,
  574. combinedProp2: item.sczl_yjgx + '-' + item.sczl_gxmc
  575. };
  576. });
  577. total.value = response.data.total
  578. tableData.splice(0, tableData.length, ...processedData);
  579. }
  580. }
  581. let positionvalue = ref()
  582. // 搜索
  583. function onSearch() {
  584. params.gdbh = positionvalue.value
  585. params.type = 'getLocateTable'
  586. page.value = 1
  587. GetLocate()
  588. }
  589. //获取详细信息
  590. const GetInfo = async (value) => {
  591. const response = await shougonggetInfo({ UniqId: value });
  592. if (response.code === 0) {
  593. formData.value = response.data;
  594. }
  595. }
  596. //员工弹窗
  597. const blModel = ref(false)
  598. const employeeData = ref('')
  599. const maxygnum = ref('')
  600. //员工列表接口
  601. const getyglist = async ()=>{
  602. if(formData.value.sczl_bh0 === ''){
  603. ElMessage.warning('请输入员工编号')
  604. return;
  605. }
  606. const response = await getYg({sczl_bh: formData.value.sczl_bh0});
  607. if (response.code === 0) {
  608. if(response.data.length === 1){
  609. formData.value.sczl_bh0 = response.data[0].员工编号; ;
  610. formData.value.sczl_bh0_name = response.data[0].ygxm;
  611. }else{
  612. blModel.value = true;
  613. employeeData.value = response.data
  614. tableygbh_setCurrent(employeeData.value[0])
  615. maxygnum.value = response.data.length-1
  616. }
  617. }
  618. }
  619. //默认高亮
  620. const tableygbh = ref()
  621. const tableygbh_setCurrent = (row) => {
  622. setTimeout(() => {
  623. tableygbh.value?.setCurrentRow(row)
  624. const {
  625. ygxm,
  626. 员工编号
  627. } = row
  628. formData.value.sczl_bh0 = row.员工编号
  629. formData.value.sczl_bh0_name = row.ygxm
  630. })
  631. }
  632. let ygnum = 0
  633. const selectygbh = (event) => {
  634. if (event.keyCode === 40) { // 向下箭头
  635. ygnum = Math.min(ygnum + 1, maxygnum.value); // 增加 ygnum,但不超过 maxygnum
  636. tableygbh_setCurrent(employeeData.value[ygnum]);
  637. } else if (event.keyCode === 38) { // 向上箭头
  638. ygnum = Math.max(ygnum - 1, 0); // 减少 ygnum,但不小于 0
  639. tableygbh_setCurrent(employeeData.value[ygnum]);
  640. } else if (event.keyCode === 13) { // Enter
  641. blModel.value = false;
  642. setTimeout(() => {
  643. const inputElement = document.getElementById('箱数');
  644. if (inputElement) {
  645. inputElement.focus();
  646. }
  647. }, 100);
  648. }
  649. }
  650. //员工选择
  651. const SelectClickgdbh = reactive([])
  652. const SelectClickygbh = (row, column, event) => {
  653. const {
  654. ygxm,
  655. 员工编号
  656. } = row
  657. formData.value.sczl_bh0 = row.员工编号
  658. formData.value.sczl_bh0_name = row.ygxm
  659. blModel.value = false
  660. setTimeout(() => {
  661. const inputElement = document.getElementById('箱数');
  662. if (inputElement) {
  663. inputElement.focus();
  664. }
  665. }, 100);
  666. }
  667. let isProcessing = false; // 标志位
  668. let lastFpSl = null; // 记录上一次输入的数量
  669. const dialogbutton = ref(false); // 控制对话框显示
  670. let enterCount = 0; // 记录回车键按下的次数
  671. //键盘 input框跳转
  672. const ent1 = (event,id1,id2,id3) => {
  673. const inputs = document.getElementsByTagName('input');
  674. const currentIndex = Array.from(inputs).indexOf(event.target);
  675. console.log(id3)
  676. if (event.keyCode === 13 && id3 === '流程单号') {
  677. console.log(id3);
  678. // 获取所有相关的输入框值
  679. const allValues = [
  680. formData.value.流程单号1,
  681. formData.value.流程单号2,
  682. formData.value.流程单号3,
  683. formData.value.流程单号4,
  684. formData.value.流程单号5,
  685. formData.value.流程单号6,
  686. formData.value.流程单号7,
  687. formData.value.流程单号8,
  688. formData.value.流程单号9,
  689. formData.value.流程单号10,
  690. ];
  691. // 获取当前输入框的值
  692. const currentValue = event.target.value;
  693. // 如果当前值为 0,不进行校验,直接跳转到下一个输入框
  694. if (currentValue === "0") {
  695. console.log("输入值为 0,无需校验");
  696. // 跳转到下一个输入框
  697. let nextIndex = currentIndex + 1;
  698. let foundNext = false; // 标记是否找到下一个可用输入框
  699. while (nextIndex < inputs.length) {
  700. if (inputs[nextIndex].disabled) {
  701. console.log("当前输入框为 disabled,跳过");
  702. nextIndex++; // 跳过 disabled 的输入框
  703. continue;
  704. }
  705. if (!inputs[nextIndex].readOnly) {
  706. nextTick(() => {
  707. inputs[nextIndex].focus();
  708. inputs[nextIndex].select();
  709. });
  710. foundNext = true; // 找到下一个可用输入框
  711. break;
  712. }
  713. nextIndex++;
  714. }
  715. if (!foundNext) {
  716. console.log("没有更多可用的输入框");
  717. }
  718. return;
  719. }
  720. // 检查是否有重复的值
  721. const isDuplicate = allValues.filter((val) => val === currentValue).length > 1;
  722. if (isDuplicate) {
  723. // 如果有重复值,提示用户并清空当前输入框
  724. event.target.value = 0;
  725. ElMessage({
  726. type: 'error',
  727. message: '输入的值已存在,请重新输入'
  728. });
  729. } else {
  730. console.log('输入值无重复');
  731. // 跳转到下一个输入框
  732. let nextIndex = currentIndex + 1;
  733. let foundNext = false; // 标记是否找到下一个可用输入框
  734. while (nextIndex < inputs.length) {
  735. if (inputs[nextIndex].disabled) {
  736. console.log("当前输入框为 disabled,跳过");
  737. nextIndex++; // 跳过 disabled 的输入框
  738. continue;
  739. }
  740. if (!inputs[nextIndex].readOnly) {
  741. nextTick(() => {
  742. inputs[nextIndex].focus();
  743. inputs[nextIndex].select();
  744. });
  745. foundNext = true; // 找到下一个可用输入框
  746. break;
  747. }
  748. nextIndex++;
  749. }
  750. if (!foundNext) {
  751. console.log("没有更多可用的输入框");
  752. }
  753. }
  754. }else if (event.keyCode === 13 && id3 === '定额代号') {
  755. console.log("定额代号");
  756. GetDedh()
  757. // getDedhsubmit(event,id1,id2,id3)
  758. let nextIndex = currentIndex + 1;
  759. let foundNext = false; // 标记是否找到下一个可用的输入框
  760. while (nextIndex < inputs.length) {
  761. if (inputs[nextIndex].disabled) {
  762. console.log("当前输入框为disabled,跳过");
  763. nextIndex++; // 跳过disabled的输入框
  764. continue;
  765. }
  766. if (!inputs[nextIndex].readOnly) {
  767. nextTick(() => {
  768. inputs[nextIndex].focus();
  769. inputs[nextIndex].select();
  770. });
  771. foundNext = true; // 找到下一个可用输入框
  772. break;
  773. }
  774. nextIndex++;
  775. }
  776. }else if(id2 === 'bh0' && event.keyCode === 13){
  777. getyglist()
  778. }else if (event.keyCode === 13 && id3 === '检验类别') {
  779. console.log("检验类别");
  780. getLbsubmit()
  781. let nextIndex = currentIndex + 1;
  782. let foundNext = false; // 标记是否找到下一个可用的输入框
  783. while (nextIndex < inputs.length) {
  784. if (inputs[nextIndex].disabled) {
  785. nextIndex++; // 跳过disabled的输入框
  786. continue;
  787. }
  788. if (!inputs[nextIndex].readOnly) {
  789. nextTick(() => {
  790. inputs[nextIndex].focus();
  791. inputs[nextIndex].select();
  792. });
  793. foundNext = true; // 找到下一个可用输入框
  794. break;
  795. }
  796. nextIndex++;
  797. }
  798. }else if (event.keyCode === 13 && id3 === '冲月定额') {
  799. getCdesubmit()
  800. let nextIndex = currentIndex + 1;
  801. let foundNext = false; // 标记是否找到下一个可用的输入框
  802. while (nextIndex < inputs.length) {
  803. if (inputs[nextIndex].disabled) {
  804. nextIndex++; // 跳过disabled的输入框
  805. continue;
  806. }
  807. if (!inputs[nextIndex].readOnly) {
  808. nextTick(() => {
  809. inputs[nextIndex].focus();
  810. inputs[nextIndex].select();
  811. });
  812. foundNext = true; // 找到下一个可用输入框
  813. break;
  814. }
  815. nextIndex++;
  816. }
  817. }else if (event.keyCode === 13 || event.keyCode === 40) {
  818. console.log('其他')
  819. let nextIndex = currentIndex + 1;
  820. let foundNext = false; // 标记是否找到下一个可用的输入框
  821. while (nextIndex < inputs.length) {
  822. if (inputs[nextIndex].disabled) {
  823. nextIndex++; // 跳过disabled的输入框
  824. continue;
  825. }
  826. if (!inputs[nextIndex].readOnly) {
  827. nextTick(() => {
  828. inputs[nextIndex].focus();
  829. inputs[nextIndex].select();
  830. });
  831. foundNext = true; // 找到下一个可用输入框
  832. break;
  833. }
  834. nextIndex++;
  835. }
  836. // 如果没有找到下一个可用输入框,提示用户
  837. if (!foundNext) {
  838. console.log("已经是最后一个输入框");
  839. ElMessageBox.confirm('数据存盘?', '提示', {
  840. confirmButtonText: '确定',
  841. cancelButtonText: '取消',
  842. type: 'warning'
  843. }).then(() => {
  844. enterDialog()
  845. })
  846. }
  847. }else if (event.keyCode === 13 || event.keyCode === 40) {
  848. if (event.target.id == '其他备注') {
  849. ElMessageBox.confirm('数据存盘?', '提示', {
  850. confirmButtonText: '确定',
  851. cancelButtonText: '取消',
  852. type: 'warning'
  853. }).then(() => {
  854. enterDialog()
  855. })
  856. }
  857. for (let i = currentIndex + 1; i < inputs.length; i++) {
  858. if (!inputs[i].readOnly) {
  859. nextTick(() => {
  860. inputs[i].focus();
  861. inputs[i].select();
  862. })
  863. break;
  864. }
  865. }
  866. if (event.target.id.substring(0, 2) == 'cl' || event.target.id.substring(0, 2) == 'fp') {
  867. ent_sum()
  868. }
  869. } else if (event.keyCode === 38) { // 向上箭头
  870. for (let i = currentIndex - 1; i >= 0; i--) {
  871. if (!inputs[i].readOnly) {
  872. nextTick(() => {
  873. inputs[i].focus();
  874. inputs[i].select();
  875. })
  876. break;
  877. }
  878. }
  879. if (event.target.id.substring(0, 2) == 'cl' || event.target.id.substring(0, 2) == 'fp') {
  880. ent_sum()
  881. }
  882. } else if (event.keyCode === 37) { // 向左箭头
  883. if (event.target.selectionStart === 0) {
  884. for (let i = currentIndex - 1; i >= 0; i--) {
  885. if (!inputs[i].readOnly) {
  886. nextTick(() => {
  887. inputs[i].focus();
  888. inputs[i].select();
  889. })
  890. break;
  891. }
  892. }
  893. if (event.target.id.substring(0, 2) == 'cl' || event.target.id.substring(0, 2) == 'fp') {
  894. ent_sum()
  895. }
  896. }
  897. } else if (event.keyCode === 39) { // 向右箭头
  898. if (event.target.id == '其他备注') {
  899. ElMessageBox.confirm('数据存盘?', '提示', {
  900. confirmButtonText: '确定',
  901. cancelButtonText: '取消',
  902. type: 'warning'
  903. }).then(() => {
  904. enterDialog()
  905. })
  906. }
  907. if (event.target.selectionStart === event.target.value.length) {
  908. for (let i = currentIndex + 1; i < inputs.length; i++) {
  909. if (!inputs[i].readOnly) {
  910. nextTick(() => {
  911. inputs[i].focus();
  912. inputs[i].select();
  913. })
  914. break;
  915. }
  916. }
  917. }
  918. if (event.target.id.substring(0, 2) == 'cl' || event.target.id.substring(0, 2) == 'fp') {
  919. ent_sum()
  920. }
  921. }
  922. }
  923. //追加字体颜色和不可输入
  924. const setColorReadonly = (id) => {
  925. const newInput = document.getElementById(id)
  926. newInput.style.color = 'red';
  927. newInput.setAttribute('readonly', true);
  928. }
  929. //追加字体颜色和可输入
  930. const unsetColorReadonly = (id) => {
  931. const newInput = document.getElementById(id)
  932. newInput.style.color = 'black';
  933. newInput.removeAttribute('readonly');
  934. }
  935. //日期获得焦点事件
  936. const rqHandleFocus = () => {
  937. if (formData.value.sczl_rq == '') {
  938. formData.value.sczl_rq = new Date().toISOString().split('T')[0]
  939. }
  940. }
  941. const num = ref(0)
  942. //班组失去焦点事件
  943. const getBzsubmit = () => {
  944. //弹出选择
  945. const data = [{
  946. 'sczl_bzdh': 'A班'
  947. }, {
  948. 'sczl_bzdh': 'B班'
  949. }]
  950. selectDataBz.splice(0, selectDataBz.length, ...data)
  951. BzVisible.value = true
  952. setCurrent(data[0])
  953. }
  954. const table = ref()
  955. const setCurrent = (row) => {
  956. setTimeout(() => {
  957. table.value?.setCurrentRow(row)
  958. const {
  959. sczl_bzdh
  960. } = row
  961. formData.value.sczl_bzdh = row.sczl_bzdh
  962. })
  963. }
  964. //班组选择
  965. const selectDataBz = reactive([])
  966. const BzVisible = ref(false)
  967. const SelectClickBz = (row, column, event) => {
  968. const {
  969. sczl_bzdh
  970. } = row
  971. formData.value.sczl_bzdh = row.sczl_bzdh
  972. BzVisible.value = false
  973. }
  974. const selectBZ = (event) => {
  975. if (event.keyCode === 40) { // Enter 或向下箭头
  976. setCurrent(selectDataBz[1]);
  977. } else if (event.keyCode === 38) {
  978. setCurrent(selectDataBz[0]);
  979. } else if (event.keyCode === 13) {
  980. BzVisible.value = false
  981. }
  982. }
  983. //冲定额失去焦点事件
  984. const getCdesubmit = () => {
  985. //弹出选择
  986. const data = [{
  987. 'sczl_冲定额': ''
  988. }, {
  989. 'sczl_冲定额': '是'
  990. }]
  991. selectDataCde.splice(0, selectDataCde.length, ...data)
  992. CdeVisible.value = true
  993. setCdeCurrent(data[0])
  994. }
  995. const tableCde = ref()
  996. const setCdeCurrent = (row) => {
  997. setTimeout(() => {
  998. tableCde.value?.setCurrentRow(row)
  999. const {
  1000. sczl_冲定额
  1001. } = row
  1002. formData.value.sczl_冲定额 = row.sczl_冲定额
  1003. })
  1004. }
  1005. //冲定额选择
  1006. const selectDataCde = reactive([])
  1007. const CdeVisible = ref(false)
  1008. const SelectClickCde = (row, column, event) => {
  1009. const {
  1010. sczl_冲定额
  1011. } = row
  1012. formData.value.sczl_冲定额 = row.sczl_冲定额
  1013. CdeVisible.value = false
  1014. }
  1015. const selectCde = (event) => {
  1016. if (event.keyCode === 40) { // Enter 或向下箭头
  1017. setCdeCurrent(selectDataCde[1]);
  1018. } else if (event.keyCode === 38) {
  1019. setCdeCurrent(selectDataCde[0]);
  1020. } else if (event.keyCode === 13) {
  1021. CdeVisible.value = false
  1022. }
  1023. }
  1024. const ent_sum = () => {
  1025. let sum = 0;
  1026. for (var i = 1; i <= 12; i++) {
  1027. sum += formData.value['sczl_cl' + i] * formData.value['sczl_fp' + i]
  1028. }
  1029. formData.value.sczl_cl = sum
  1030. }
  1031. let Bname = '';
  1032. let Bbh = '';
  1033. let input_name = '';
  1034. //员工编号键盘事件
  1035. const ent = (event, inputName) => {
  1036. input_name = inputName;
  1037. let combinedString = 'sczl_bh' + inputName;
  1038. let value = eval('formData.value.' + combinedString);
  1039. if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
  1040. if (value) {
  1041. getYg({ sczl_bh: value }).then(response => {
  1042. if (response.code == 0) {
  1043. Bname = 'sczl_bh' + inputName + '_name';
  1044. Bbh = 'sczl_bh' + inputName;
  1045. if (response.data.length == 1) {
  1046. formData.value[Bname] = response.data[0].ygxm
  1047. formData.value[Bbh] = response.data[0].员工编号
  1048. //设置姓名样式
  1049. unsetColorReadonly('cl' + inputName)
  1050. unsetColorReadonly('fp' + inputName)
  1051. document.getElementById('cl' + inputName).focus()
  1052. document.getElementById('cl' + inputName).select()
  1053. } else if (response.data.length > 1) {
  1054. selectData_Yg.splice(0, selectData_Yg.length, ...response.data)
  1055. setGXCurrent_Yg(selectData_Yg[0])
  1056. dialogSelectVisible_Yg.value = true
  1057. } else {
  1058. ElMessage({
  1059. type: 'warning',
  1060. message: '未查询到该员工'
  1061. })
  1062. formData.value['sczl_bh' + inputName + '_name'] = '';
  1063. formData.value['sczl_cl' + inputName] = '0';
  1064. formData.value['sczl_fp' + inputName] = '0';
  1065. //设置姓名样式
  1066. setColorReadonly('cl' + inputName);
  1067. setColorReadonly('fp' + inputName);
  1068. if (inputName != 12) {
  1069. document.getElementById('bh' + (parseInt(inputName) + 1)).focus()
  1070. document.getElementById('bh' + (parseInt(inputName) + 1)).select()
  1071. } else {
  1072. document.getElementById('其他备注').focus()
  1073. document.getElementById('其他备注').select()
  1074. }
  1075. }
  1076. // formData.value[Bname] = response.data[0].ygxm;
  1077. // formData.value[Bbh] = response.data[0].员工编号;
  1078. // //设置姓名样式
  1079. // unsetColorReadonly('cl' + inputName)
  1080. // unsetColorReadonly('fp' + inputName)
  1081. // document.getElementById('cl' + inputName).focus()
  1082. // document.getElementById('cl' + inputName).select()
  1083. } else {
  1084. formData.value['sczl_bh' + inputName + '_name'] = '';
  1085. formData.value['sczl_cl' + inputName] = '0';
  1086. formData.value['sczl_fp' + inputName] = '0';
  1087. //设置姓名样式
  1088. setColorReadonly('cl' + inputName);
  1089. setColorReadonly('fp' + inputName);
  1090. if (inputName != 12) {
  1091. document.getElementById('bh' + (parseInt(inputName) + 1)).focus()
  1092. document.getElementById('bh' + (parseInt(inputName) + 1)).select()
  1093. } else {
  1094. document.getElementById('其他备注').focus()
  1095. document.getElementById('其他备注').select()
  1096. }
  1097. }
  1098. });
  1099. } else {
  1100. formData.value['sczl_bh' + inputName + '_name'] = '';
  1101. formData.value['sczl_cl' + inputName] = '0';
  1102. formData.value['sczl_fp' + inputName] = '0';
  1103. //设置姓名样式
  1104. setColorReadonly('cl' + inputName);
  1105. setColorReadonly('fp' + inputName);
  1106. if (inputName != 12) {
  1107. document.getElementById('bh' + (parseInt(inputName) + 1)).focus()
  1108. document.getElementById('bh' + (parseInt(inputName) + 1)).select()
  1109. } else {
  1110. document.getElementById('其他备注').focus()
  1111. document.getElementById('其他备注').select()
  1112. }
  1113. }
  1114. ent_sum()
  1115. } else if (event.keyCode === 38) { // 向上箭头
  1116. if (inputName != 1) {
  1117. if (document.getElementById('fp' + (parseInt(inputName) - 1)).readOnly) {
  1118. document.getElementById('bh' + (parseInt(inputName) - 1)).focus()
  1119. document.getElementById('bh' + (parseInt(inputName) - 1)).select()
  1120. } else {
  1121. document.getElementById('fp' + (parseInt(inputName) - 1)).focus()
  1122. document.getElementById('fp' + (parseInt(inputName) - 1)).select()
  1123. }
  1124. } else {
  1125. document.getElementById('备注').focus()
  1126. document.getElementById('备注').select()
  1127. }
  1128. ent_sum()
  1129. } else if (event.keyCode === 8) { // 删除箭头
  1130. if (event.target.selectionStart === 0) {
  1131. if (inputName != 1) {
  1132. if (document.getElementById('fp' + (parseInt(inputName) - 1)).readOnly) {
  1133. document.getElementById('bh' + (parseInt(inputName) - 1)).focus()
  1134. document.getElementById('bh' + (parseInt(inputName) - 1)).setSelectionRange(0, 0)
  1135. } else {
  1136. document.getElementById('fp' + (parseInt(inputName) - 1)).focus()
  1137. document.getElementById('fp' + (parseInt(inputName) - 1)).setSelectionRange(0, 0)
  1138. }
  1139. } else {
  1140. document.getElementById('备注').focus()
  1141. document.getElementById('备注').setSelectionRange(0, 0)
  1142. }
  1143. ent_sum()
  1144. }
  1145. } else if (event.keyCode === 37) { // 向左箭头
  1146. if (event.target.selectionStart === 0) {
  1147. if (inputName != 1) {
  1148. if (document.getElementById('fp' + (parseInt(inputName) - 1)).readOnly) {
  1149. document.getElementById('bh' + (parseInt(inputName) - 1)).focus()
  1150. document.getElementById('bh' + (parseInt(inputName) - 1)).select()
  1151. } else {
  1152. document.getElementById('fp' + (parseInt(inputName) - 1)).focus()
  1153. document.getElementById('fp' + (parseInt(inputName) - 1)).select()
  1154. }
  1155. } else {
  1156. document.getElementById('备注').focus()
  1157. document.getElementById('备注').select()
  1158. }
  1159. ent_sum()
  1160. }
  1161. } else if (event.keyCode === 39) { // 向右箭头
  1162. if (event.target.selectionStart === event.target.value.length) {
  1163. if (inputName != 12) {
  1164. document.getElementById('bh' + (parseInt(inputName) + 1)).focus()
  1165. document.getElementById('bh' + (parseInt(inputName) + 1)).select()
  1166. } else {
  1167. document.getElementById('其他备注').focus()
  1168. document.getElementById('其他备注').select()
  1169. }
  1170. ent_sum()
  1171. }
  1172. }
  1173. }
  1174. //员工选择
  1175. const dialogSelectVisible_Yg = ref(false)
  1176. const selectData_Yg = reactive([])
  1177. // 处理选择框
  1178. const handleSelectClick_Yg = (row, column, event) => {
  1179. formData.value[Bname] = row.ygxm
  1180. formData.value[Bbh] = row.员工编号
  1181. //设置姓名样式
  1182. unsetColorReadonly('cl' + input_name)
  1183. unsetColorReadonly('fp' + input_name)
  1184. document.getElementById('cl' + input_name).focus()
  1185. document.getElementById('cl' + input_name).select()
  1186. ent_sum()
  1187. dialogSelectVisible_Yg.value = false
  1188. }
  1189. const currentIndex_Yg = ref(0);
  1190. const GXCurrent_Yg = ref(0);
  1191. const selectGX_Yg = (event) => {
  1192. if (event.keyCode === 40) { // 向下箭头
  1193. if (currentIndex_Yg.value < selectData_Yg.length - 1) {
  1194. currentIndex_Yg.value++;
  1195. setGXCurrent_Yg(selectData_Yg[currentIndex_Yg.value]);
  1196. } else {
  1197. currentIndex_Yg.value = 0;
  1198. setGXCurrent_Yg(selectData_Yg[currentIndex_Yg.value]); // 到达最后一行时回到第一行
  1199. }
  1200. } else if (event.keyCode === 38) { // 向上箭头
  1201. if (currentIndex_Yg.value > 0) {
  1202. currentIndex_Yg.value--;
  1203. setGXCurrent_Yg(selectData_Yg[currentIndex_Yg.value]);
  1204. } else {
  1205. currentIndex_Yg.value = selectData_Yg.length - 1;
  1206. setGXCurrent_Yg(selectData_Yg[currentIndex_Yg.value]); // 到达第一行时回到最后一行
  1207. }
  1208. } else if (event.keyCode === 13) { // 回车键
  1209. dialogSelectVisible_Yg.value = false;
  1210. }
  1211. }
  1212. const table_Yg = ref()
  1213. const setGXCurrent_Yg = (row) => {
  1214. setTimeout(() => {
  1215. table_Yg.value?.setCurrentRow(row)
  1216. formData.value[Bname] = row.ygxm
  1217. formData.value[Bbh] = row.员工编号
  1218. //设置姓名样式
  1219. unsetColorReadonly('cl' + input_name)
  1220. unsetColorReadonly('fp' + input_name)
  1221. document.getElementById('cl' + input_name).focus()
  1222. document.getElementById('cl' + input_name).select()
  1223. ent_sum()
  1224. })
  1225. }
  1226. const getGxMcsubmit = async () => {
  1227. if (formData.value.sczl_gdbh != '') {
  1228. const response = await shougonggetGxMc({
  1229. gdbh: formData.value.sczl_gdbh
  1230. });
  1231. if (response.code === 0) {
  1232. if (response.data.length == 0) {
  1233. ElMessage({
  1234. type: 'error',
  1235. message: '查无此编号的工单,请仔细检查后重新输入'
  1236. })
  1237. //设置输入框的值为空
  1238. formData.value.sczl_gdbh = ''
  1239. formData.value.sczl_yjgx = ''
  1240. formData.value.sczl_gxmc = ''
  1241. formData.value.yj_yjmc = ''
  1242. } else if (response.data.length == 1) {
  1243. const {
  1244. Gd_cpmc,
  1245. Gy0_yjno,
  1246. Gy0_gxh,
  1247. Gy0_gxmc,
  1248. jyGx
  1249. } = response.data[0]
  1250. formData.value.yj_yjmc = Gd_cpmc
  1251. formData.value.sczl_gxmc = Gy0_gxmc
  1252. formData.value.sczl_yjgx = jyGx
  1253. setColorReadonly('yjgx');
  1254. setColorReadonly('gxmc');
  1255. setColorReadonly('yjmc');
  1256. } else {
  1257. if (GetDedhVisible.value) {
  1258. return false
  1259. }
  1260. selectData.splice(0, selectData.length, ...response.data)
  1261. dialogSelectVisible.value = true
  1262. setGXCurrent(selectData[0])
  1263. }
  1264. }
  1265. } else {
  1266. ElMessage({
  1267. type: 'error',
  1268. message: '请注意, 工单编号输入空置, 除非有特殊需要!'
  1269. })
  1270. formData.value.sczl_yjgx = ''
  1271. formData.value.sczl_gxmc = ''
  1272. formData.value.yj_yjmc = ''
  1273. }
  1274. }
  1275. const dialogSelectVisible = ref(false)
  1276. const selectData = reactive([])
  1277. // 工单选择框
  1278. const handleSelectClick = (row, column, event) => {
  1279. const {
  1280. Gd_cpmc,
  1281. Gy0_yjno,
  1282. Gy0_gxh,
  1283. Gy0_gxmc,
  1284. jyGx
  1285. } = row
  1286. formData.value.yj_yjmc = Gd_cpmc
  1287. formData.value.sczl_gxmc = Gy0_gxmc
  1288. formData.value.sczl_yjgx = jyGx
  1289. setColorReadonly('yjgx');
  1290. setColorReadonly('gxmc');
  1291. setColorReadonly('yjmc');
  1292. dialogSelectVisible.value = false
  1293. }
  1294. const currentIndex = ref(0);
  1295. const GXCurrent = ref(0);
  1296. const selectGX = (event) => {
  1297. if (event.keyCode === 40) { // 向下箭头
  1298. if (currentIndex.value < selectData.length - 1) {
  1299. currentIndex.value++;
  1300. setGXCurrent(selectData[currentIndex.value]);
  1301. } else {
  1302. currentIndex.value = 0;
  1303. setGXCurrent(selectData[currentIndex.value]); // 到达最后一行时回到第一行
  1304. }
  1305. } else if (event.keyCode === 38) { // 向上箭头
  1306. if (currentIndex.value > 0) {
  1307. currentIndex.value--;
  1308. setGXCurrent(selectData[currentIndex.value]);
  1309. } else {
  1310. currentIndex.value = selectData.length - 1;
  1311. setGXCurrent(selectData[currentIndex.value]); // 到达第一行时回到最后一行
  1312. }
  1313. } else if (event.keyCode === 13) { // 回车键
  1314. dialogSelectVisible.value = false;
  1315. }
  1316. }
  1317. const table2 = ref()
  1318. const setGXCurrent = (row) => {
  1319. setTimeout(() => {
  1320. table2.value?.setCurrentRow(row)
  1321. const {
  1322. Gd_cpmc,
  1323. Gy0_yjno,
  1324. Gy0_gxh,
  1325. Gy0_gxmc,
  1326. jyGx
  1327. } = row
  1328. formData.value.yj_yjmc = Gd_cpmc
  1329. formData.value.sczl_gxmc = Gy0_gxmc
  1330. formData.value.sczl_yjgx = jyGx
  1331. })
  1332. }
  1333. // 定义状态
  1334. let GetDedhtreeData = reactive([]); // 树形数据
  1335. const GetDedhVisible = ref(false); // 弹窗显隐状态
  1336. const activeNodeKey = ref(null); // 当前选中节点的 key
  1337. const table_fplb = ref(null); // el-tree 的 ref
  1338. const defaultExpandedKey = ref(null); // 默认展开的节点 key
  1339. const selectIndex = ref(0); // 当前选中的索引
  1340. // 获取定额代号并构建树形结构
  1341. const GetDedh = async () => {
  1342. const response = await shougonggetDedh();
  1343. if (response.code === 0) {
  1344. // 封装数据为数组,便于递归处理根节点
  1345. const data = [];
  1346. data[0] = response.data;
  1347. // 递归构建树形结构
  1348. const buildTree = (node) => {
  1349. return {
  1350. label: `${node.sys_bh}【${node.sys_mc}】`,
  1351. id: node.sys_bh,
  1352. children: Array.isArray(node.bh_mc) ? node.bh_mc.map(buildTree) : []
  1353. };
  1354. };
  1355. // 构建树形结构并赋值给响应变量
  1356. GetDedhtreeData = data.map(buildTree);
  1357. GetDedhVisible.value = true; // 显示弹窗
  1358. }
  1359. };
  1360. // 节点点击事件
  1361. const GetDedhhandleNodeClick = (nodeData) => {
  1362. console.log("单击节点:", nodeData);
  1363. if (!nodeData.children || nodeData.children.length === 0) {
  1364. // 如果点击的是子节点,则关闭弹窗并更新数据
  1365. formData.value.sczl_dedh = nodeData.label.split("【")[0]; // 提取定额代号
  1366. GetDedhVisible.value = false; // 关闭弹窗
  1367. }
  1368. };
  1369. // 树组件键盘事件
  1370. const handleTreeKeydown = (event) => {
  1371. const tree = table_fplb.value; // 获取树实例
  1372. if (!tree) {
  1373. console.error("树组件未加载");
  1374. return;
  1375. }
  1376. const focusedElement = document.activeElement;
  1377. const focusedNodeId = focusedElement?.getAttribute("data-key"); // 获取 DOM 的 data-key 属性
  1378. // 回车键
  1379. if (event.keyCode === 13 && focusedNodeId) {
  1380. tree.setCurrentKey(focusedNodeId); // 设置当前节点为选中
  1381. tree.$nextTick(() => {
  1382. const currentNode = tree.getCurrentNode(); // 获取当前选中的节点
  1383. if (!currentNode) {
  1384. console.warn("没有选中的节点");
  1385. return;
  1386. }
  1387. // 展开当前节点并收起其他节点
  1388. Object.keys(tree.store.nodesMap).forEach((key) => {
  1389. tree.store.nodesMap[key].expanded = false; // 收起所有节点
  1390. });
  1391. tree.store.nodesMap[currentNode.id].expanded = true; // 展开当前节点
  1392. // 如果有子节点,选中第一个子节点
  1393. if (currentNode.children && currentNode.children.length > 0) {
  1394. const firstChild = currentNode.children[0];
  1395. const firstChildKey = firstChild.id.toString();
  1396. tree.setCurrentKey(firstChildKey); // 选中第一个子节点
  1397. setTimeout(() => {
  1398. const firstChildDom = tree.$el.querySelector(`[data-key="${firstChildKey}"]`);
  1399. if (firstChildDom) {
  1400. firstChildDom.focus();
  1401. firstChildDom.scrollIntoView({ block: "nearest" });
  1402. }
  1403. });
  1404. } else {
  1405. // 如果没有子节点,执行确认操作
  1406. console.log("当前子节点:", currentNode.label);
  1407. formData.value.sczl_dedh = currentNode.label.split("【")[0]
  1408. GetDedhVisible.value = false; // 关闭弹窗
  1409. }
  1410. });
  1411. }
  1412. // 上下箭头键
  1413. else if (event.keyCode === 38 || event.keyCode === 40) {
  1414. const currentNode = tree.getCurrentNode();
  1415. if (currentNode) {
  1416. const currentNodeDom = tree.$el.querySelector(`[data-key="${currentNode.id}"]`);
  1417. if (currentNodeDom) {
  1418. currentNodeDom.focus();
  1419. }
  1420. }
  1421. }
  1422. };
  1423. // 弹窗键盘事件处理(绑定在弹窗上)
  1424. const entdedh = (event) => {
  1425. console.log("键盘事件触发"); // 用于调试
  1426. event.preventDefault(); // 阻止浏览器默认行为(如滚动页面)
  1427. event.stopPropagation(); // 阻止事件冒泡
  1428. const tree = table_fplb.value?.$el;
  1429. if (!tree) return;
  1430. if (event.key === "ArrowDown" || event.key === "ArrowUp") {
  1431. // 上下箭头键:切换选中的兄弟节点
  1432. const focusedElement = document.activeElement;
  1433. const focusedNodeId = focusedElement?.getAttribute("data-key");
  1434. const currentNode = table_fplb.value?.store.nodesMap[focusedNodeId];
  1435. if (currentNode) {
  1436. let nextNode;
  1437. if (event.key === "ArrowDown") {
  1438. nextNode = table_fplb.value?.getNextSibling(currentNode);
  1439. } else if (event.key === "ArrowUp") {
  1440. nextNode = table_fplb.value?.getPreviousSibling(currentNode);
  1441. }
  1442. if (nextNode) {
  1443. const nextNodeKey = nextNode.data.id.toString();
  1444. table_fplb.value?.setCurrentKey(nextNodeKey); // 设置选中下一个节点
  1445. focusAndScrollToNode(nextNodeKey); // 聚焦到下一个节点并滚动到视图中
  1446. }
  1447. }
  1448. } else {
  1449. // 默认行为:展开所有节点并选中第一个节点
  1450. const firstNodeDom = tree.querySelector("[data-key]");
  1451. if (firstNodeDom) {
  1452. firstNodeDom.focus();
  1453. firstNodeDom.scrollIntoView({ block: "nearest" });
  1454. // 设置第一个节点为当前选中节点
  1455. const firstNodeId = firstNodeDom.getAttribute("data-key");
  1456. table_fplb.value?.setCurrentKey(firstNodeId);
  1457. // 获取第一个节点对象并展开所有子节点
  1458. const firstNode = table_fplb.value?.store.nodesMap[firstNodeId];
  1459. if (firstNode) {
  1460. table_fplb.value?.store.expandNode(firstNode, true);
  1461. expandAllNodes(firstNode); // 递归展开第一个节点的所有子节点
  1462. }
  1463. }
  1464. }
  1465. };
  1466. // let GetDedhtreeData = reactive([]);
  1467. // const GetDedhVisible = ref(false)
  1468. // //获取定额代号
  1469. // const GetDedh = async (value) => {
  1470. // const response = await shougonggetDedh();
  1471. // const treeData = {};
  1472. // if (response.code == 0) {
  1473. // const data = [];
  1474. // data[0] = response.data;
  1475. // // 递归函数来构建树形结构
  1476. // const buildTree = (node) => {
  1477. // const treeNode = {
  1478. // label: node.sys_bh + '【' + node.sys_mc + '】',
  1479. // children: []
  1480. // };
  1481. // // 如果存在子节点,递归地添加它们
  1482. // if (node.bh_mc && Array.isArray(node.bh_mc)) {
  1483. // node.bh_mc.forEach(childNode => {
  1484. // treeNode.children.push(buildTree(childNode)); // 递归调用
  1485. // });
  1486. // }
  1487. // return treeNode;
  1488. // };
  1489. // // 构建树形结构的根节点
  1490. // const treeData = data.map(buildTree);
  1491. // GetDedhtreeData = treeData;
  1492. // GetDedhVisible.value = true
  1493. // }
  1494. // }
  1495. // //定额代号树形结构单机
  1496. // const GetDedhhandleNodeClick = (nodeData, node, component) => {
  1497. // //存放当前节点的nodeId
  1498. // if (!nodeData.children || nodeData.children.length === 0) {
  1499. // // 点击的是子节点
  1500. // formData.value.sczl_dedh = nodeData.label.split("【")[0]
  1501. // GetDedhVisible.value = false
  1502. // }
  1503. // // 执行相应的父节点单击事件处理逻辑
  1504. // }
  1505. //检验类别失去焦点事件
  1506. const getLbsubmit = () => {
  1507. if (GetDedhVisible.value) {
  1508. return false
  1509. }
  1510. //弹出选择
  1511. const data = [{
  1512. 'sczl_检验类别': ''
  1513. }, {
  1514. 'sczl_检验类别': '正品板'
  1515. }, {
  1516. 'sczl_检验类别': '次品板'
  1517. }, {
  1518. 'sczl_检验类别': '废品板'
  1519. }]
  1520. selectDataLb.splice(0, selectDataLb.length, ...data)
  1521. setJYCurrent(selectDataLb[0])
  1522. LbVisible.value = true
  1523. }
  1524. //检验类别选择
  1525. const selectDataLb = reactive([])
  1526. const LbVisible = ref(false)
  1527. const SelectClickLb = (row, column, event) => {
  1528. const {
  1529. sczl_检验类别
  1530. } = row
  1531. formData.value.sczl_检验类别 = row.sczl_检验类别
  1532. //查询废品系数
  1533. if (row.sczl_检验类别 != '') {
  1534. var value = {
  1535. 'gdbh': formData.value.sczl_gdbh,
  1536. 'yjno': parseInt(formData.value.sczl_yjgx.split('-')[0]),
  1537. 'gxh': parseInt(formData.value.sczl_yjgx.split('-')[1]),
  1538. 'type': formData.value.sczl_检验类别
  1539. }
  1540. shougonggetScrapFactor(value).then(response => {
  1541. if (response.code == 0) {
  1542. if (response.data != null) {
  1543. formData.value.sczl_废品率系数 = response.data.num;
  1544. }
  1545. setColorReadonly('废品率系数')
  1546. }
  1547. });
  1548. } else {
  1549. unsetColorReadonly('废品率系数')
  1550. }
  1551. LbVisible.value = false
  1552. }
  1553. const table3 = ref()
  1554. const setJYCurrent = (row) => {
  1555. setTimeout(() => {
  1556. table3.value?.setCurrentRow(row)
  1557. const {
  1558. sczl_检验类别
  1559. } = row
  1560. formData.value.sczl_检验类别 = row.sczl_检验类别
  1561. //查询废品系数
  1562. if (row.sczl_检验类别 != '') {
  1563. var value = {
  1564. 'gdbh': formData.value.sczl_gdbh,
  1565. 'yjno': parseInt(formData.value.sczl_yjgx.split('-')[0]),
  1566. 'gxh': parseInt(formData.value.sczl_yjgx.split('-')[1]),
  1567. 'type': formData.value.sczl_检验类别
  1568. }
  1569. shougonggetScrapFactor(value).then(response => {
  1570. if (response.code == 0) {
  1571. if (response.data != null) {
  1572. formData.value.sczl_废品率系数 = response.data.num;
  1573. }
  1574. setColorReadonly('废品率系数')
  1575. }
  1576. });
  1577. } else {
  1578. unsetColorReadonly('废品率系数')
  1579. }
  1580. })
  1581. }
  1582. const JYIndex = ref(0);
  1583. const JYCurrent = ref(0);
  1584. const selectJY = (event) => {
  1585. if (event.keyCode === 40) { // 向下箭头
  1586. if (JYIndex.value < selectDataLb.length - 1) {
  1587. JYIndex.value++;
  1588. setJYCurrent(selectDataLb[JYIndex.value]);
  1589. } else {
  1590. JYIndex.value = 0;
  1591. setJYCurrent(selectDataLb[JYIndex.value]); // 到达最后一行时回到第一行
  1592. }
  1593. } else if (event.keyCode === 38) { // 向上箭头
  1594. if (JYIndex.value > 0) {
  1595. JYIndex.value--;
  1596. setJYCurrent(selectDataLb[JYIndex.value]);
  1597. } else {
  1598. JYIndex.value = selectDataLb.length - 1;
  1599. setJYCurrent(selectDataLb[JYIndex.value]); // 到达第一行时回到最后一行
  1600. }
  1601. } else if (event.keyCode === 13) { // 回车键
  1602. LbVisible.value = false
  1603. }
  1604. }
  1605. //刷新废品率系数
  1606. const GetScrapFactor = async (value) => {
  1607. const response = await shougonggetScrapFactor(value);
  1608. if (response.code == 0) {
  1609. const rowIndex = tableData.findIndex(row => row.UniqId === lastCellValue);
  1610. tableData[rowIndex].sczl_废品率系数 = response.data.num;
  1611. ElMessage({
  1612. type: 'success',
  1613. message: '刷新成功',
  1614. })
  1615. } else {
  1616. ElMessage({
  1617. type: 'error',
  1618. message: '刷新失败',
  1619. })
  1620. }
  1621. // console.log(response)
  1622. // const rowIndex = tableData.findIndex(row => row.UniqId === 123);
  1623. }
  1624. const ADD = ref('0')
  1625. //新增
  1626. function onAdd() {
  1627. dialogFormVisible.value = true
  1628. setTimeout(() => {
  1629. const inputElement = document.getElementById('日期');
  1630. if (inputElement) {
  1631. inputElement.focus();
  1632. }
  1633. }, 100);
  1634. ADD.value = '新增'
  1635. type.value = 'create'
  1636. if (typeof(lastCellValue) == 'number') {
  1637. shougonggetInfo({ UniqId: lastCellValue }).then(response=>{
  1638. if (response.code === 0) {
  1639. formData.value = response.data;
  1640. formData.value.sczl_废品率系数 = ''
  1641. formData.value.sczl_cl1 = 0
  1642. formData.value.sczl_cl2 = 0
  1643. formData.value.sczl_cl3 = 0
  1644. formData.value.sczl_cl4 = 0
  1645. formData.value.sczl_cl5 = 0
  1646. formData.value.sczl_cl6 = 0
  1647. formData.value.sczl_cl7 = 0
  1648. formData.value.sczl_cl8 = 0
  1649. formData.value.sczl_cl9 = 0
  1650. formData.value.sczl_cl10 = 0
  1651. formData.value.sczl_cl11 = 0
  1652. formData.value.sczl_cl12 = 0
  1653. formData.value.sczl_fp1 = 0
  1654. formData.value.sczl_fp2 = 0
  1655. formData.value.sczl_fp3 = 0
  1656. formData.value.sczl_fp4 = 0
  1657. formData.value.sczl_fp5 = 0
  1658. formData.value.sczl_fp6 = 0
  1659. formData.value.sczl_fp7 = 0
  1660. formData.value.sczl_fp8 = 0
  1661. formData.value.sczl_fp9 = 0
  1662. formData.value.sczl_fp10 = 0
  1663. formData.value.sczl_fp11 = 0
  1664. formData.value.sczl_fp12 = 0
  1665. formData.value.流程单号1 = 0
  1666. formData.value.流程单号2 = 0
  1667. formData.value.流程单号3 = 0
  1668. formData.value.流程单号4 = 0
  1669. formData.value.流程单号5 = 0
  1670. formData.value.流程单号6 = 0
  1671. formData.value.流程单号7 = 0
  1672. formData.value.流程单号8 = 0
  1673. formData.value.流程单号9 = 0
  1674. formData.value.流程单号10 = 0
  1675. }
  1676. });
  1677. }
  1678. }
  1679. const ScrapFactor = {
  1680. gdbh: '',
  1681. yjno: '',
  1682. gxh: '',
  1683. type: '',
  1684. }
  1685. // 刷新废品率系数
  1686. function onRefresh() {
  1687. if (params.date == '' || ScrapFactor.gdbh == '') {
  1688. ElMessage({
  1689. type: 'warning',
  1690. message: '未选中记录',
  1691. })
  1692. return
  1693. }
  1694. if (ScrapFactor.type == '') {
  1695. ElMessage({
  1696. type: 'warning',
  1697. message: '该记录检验类别为空',
  1698. })
  1699. return
  1700. }
  1701. GetScrapFactor(ScrapFactor)
  1702. }
  1703. // 更新数据
  1704. const updateDetailData = async () => {
  1705. const restoredData = {
  1706. UniqId: lastCellValue,
  1707. sczl_rq: formData.value.sczl_rq,
  1708. sczl_bzdh: formData.value.sczl_bzdh,
  1709. sczl_bh0: formData.value.sczl_bh0,
  1710. sczl_cl0: formData.value.sczl_cl0,
  1711. sczl_fp0: formData.value.sczl_fp0,
  1712. sczl_gdbh: formData.value.sczl_gdbh,
  1713. sczl_yjgx: formData.value.sczl_yjgx,
  1714. sczl_gxmc: formData.value.sczl_gxmc,
  1715. sczl_cl: formData.value.sczl_cl,
  1716. sczl_dedh: formData.value.sczl_dedh,
  1717. sczl_检验类别: formData.value.sczl_检验类别,
  1718. sczl_废品率系数: formData.value.sczl_废品率系数,
  1719. sczl_jsss: formData.value.sczl_jsss,
  1720. sczl_冲定额: formData.value.sczl_冲定额,
  1721. qczl_Num: formData.value.流程单号1,
  1722. qczl_NumDesc1: formData.value.流程单号2,
  1723. qczl_NumDesc2: formData.value.流程单号3,
  1724. qczl_NumDesc3: formData.value.流程单号4,
  1725. qczl_NumDesc4: formData.value.流程单号5,
  1726. qczl_NumDesc5: formData.value.流程单号6,
  1727. qczl_NumDesc6: formData.value.流程单号7,
  1728. qczl_NumDesc7: formData.value.流程单号8,
  1729. qczl_NumDesc8: formData.value.流程单号9,
  1730. qczl_NumDesc: formData.value.qczl_NumDesc,
  1731. sczl_desc: formData.value.sczl_desc,
  1732. sczl_bh1: formData.value.sczl_bh1,
  1733. sczl_bh2: formData.value.sczl_bh2,
  1734. sczl_bh3: formData.value.sczl_bh3,
  1735. sczl_bh4: formData.value.sczl_bh4,
  1736. sczl_bh5: formData.value.sczl_bh5,
  1737. sczl_bh6: formData.value.sczl_bh6,
  1738. sczl_bh7: formData.value.sczl_bh7,
  1739. sczl_bh8: formData.value.sczl_bh8,
  1740. sczl_bh9: formData.value.sczl_bh9,
  1741. sczl_bh10: formData.value.sczl_bh10,
  1742. sczl_bh11: formData.value.sczl_bh11,
  1743. sczl_bh12: formData.value.sczl_bh12,
  1744. sczl_cl1: formData.value.sczl_cl1,
  1745. sczl_cl2: formData.value.sczl_cl2,
  1746. sczl_cl3: formData.value.sczl_cl3,
  1747. sczl_cl4: formData.value.sczl_cl4,
  1748. sczl_cl5: formData.value.sczl_cl5,
  1749. sczl_cl6: formData.value.sczl_cl6,
  1750. sczl_cl7: formData.value.sczl_cl7,
  1751. sczl_cl8: formData.value.sczl_cl8,
  1752. sczl_cl9: formData.value.sczl_cl9,
  1753. sczl_cl10: formData.value.sczl_cl10,
  1754. sczl_cl11: formData.value.sczl_cl11,
  1755. sczl_cl12: formData.value.sczl_cl12,
  1756. sczl_fp1: formData.value.sczl_fp1,
  1757. sczl_fp2: formData.value.sczl_fp2,
  1758. sczl_fp3: formData.value.sczl_fp3,
  1759. sczl_fp4: formData.value.sczl_fp4,
  1760. sczl_fp5: formData.value.sczl_fp5,
  1761. sczl_fp6: formData.value.sczl_fp6,
  1762. sczl_fp7: formData.value.sczl_fp7,
  1763. sczl_fp8: formData.value.sczl_fp8,
  1764. sczl_fp9: formData.value.sczl_fp9,
  1765. sczl_fp10: formData.value.sczl_fp10,
  1766. sczl_fp11: formData.value.sczl_fp11,
  1767. sczl_fp12: formData.value.sczl_fp12,
  1768. sys_id: sys_id,
  1769. }
  1770. if (ADD.value == '新增') {
  1771. console.log(restoredData)
  1772. return;
  1773. const response = await inspectadd(restoredData);
  1774. // ADD.value='1'
  1775. // console.log(ADD.value)
  1776. ADD.value = '0'
  1777. console.log(response)
  1778. if (response.code == 0) {
  1779. ElMessage({
  1780. type: 'success',
  1781. message: '新增成功',
  1782. })
  1783. //刷新侧边栏
  1784. getTabdata()
  1785. if (params.date != '') {
  1786. //刷新页面
  1787. getTableData()
  1788. }
  1789. }
  1790. } else {
  1791. const response = await shougongedit(restoredData);
  1792. if (response.code == 0) {
  1793. ElMessage({
  1794. type: 'success',
  1795. message: '更新成功',
  1796. })
  1797. }
  1798. dialogFormVisible.value = false
  1799. }
  1800. }
  1801. // 删除
  1802. function onDel() {
  1803. Del()
  1804. }
  1805. //删除
  1806. const Del = () => {
  1807. if (typeof(lastCellValue) == 'object') {
  1808. ElMessage({
  1809. type: 'warning',
  1810. message: '未选中记录',
  1811. })
  1812. return
  1813. }
  1814. ElMessageBox.confirm(
  1815. `确认删除这条数据么?`,
  1816. '警告', {
  1817. confirmButtonText: '确认',
  1818. cancelButtonText: '取消',
  1819. type: 'warning',
  1820. }
  1821. ).then(async () => {
  1822. const response = await shougongdel({
  1823. UniqId: lastCellValue
  1824. });
  1825. if (response.code === 0) {
  1826. ElMessage({
  1827. type: 'success',
  1828. message: '删除成功',
  1829. })
  1830. //刷新侧边栏
  1831. getTabdata()
  1832. //刷新页面
  1833. getTableData()
  1834. }
  1835. })
  1836. }
  1837. const displayMod = ref('')
  1838. // 按工单显示
  1839. function onCountByGdbh() {
  1840. console.log(displayMod.value)
  1841. if (displayMod.value === 'date') {
  1842. displayMod.value = 'gd'
  1843. CountByGdbh()
  1844. console.log(displayMod.value)
  1845. } else {
  1846. getTabdata()
  1847. }
  1848. // CountByGdbh()
  1849. }
  1850. //按工单显示
  1851. const CountByGdbh = async () => {
  1852. const response = await getInspectCountByGdbh();
  1853. // console.log(response)
  1854. if (response.code === 0) {
  1855. console.log(response)
  1856. const transformedData = response.data.map(item => ({
  1857. label: `${item.sczl_gdbh+item.cpmc}`,
  1858. children: item.sys.map(sysItem => ({
  1859. label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
  1860. params: {
  1861. date: item.sczl_gdbh,
  1862. sys_id: sysItem.sys_id,
  1863. total: sysItem.count,
  1864. },
  1865. })),
  1866. }));
  1867. treeData.splice(0, treeData.length, ...transformedData);
  1868. }
  1869. // getTableData()
  1870. }
  1871. // ============== 表格控制部分结束 ===============
  1872. // 获取需要的字典 可能为空 按需保留
  1873. const setOptions = async () => {}
  1874. // 获取需要的字典 可能为空 按需保留
  1875. setOptions()
  1876. // 多选数据
  1877. const multipleSelection = ref([])
  1878. // 多选
  1879. const handleSelectionChange = (val) => {
  1880. if (val.length > 0) {
  1881. multipleSelection.value = val
  1882. const lenth = val.length
  1883. ScrapFactor.gdbh = val[lenth - 1].combinedProp.split('-')[0];
  1884. const parts = val[lenth - 1].combinedProp2.split('-')
  1885. ScrapFactor.yjno = parts[0];
  1886. ScrapFactor.gxh = parts[1];
  1887. // ScrapFactor.type=val[lenth-1].sczl_检验类别
  1888. ScrapFactor.type = '正品板'
  1889. console.log(ScrapFactor)
  1890. lastCellValue = val[lenth - 1].UniqId
  1891. console.log(ScrapFactor)
  1892. val.splice(0, val.length); // 清空 val 数组
  1893. console.log(lastCellValue)
  1894. }
  1895. }
  1896. // 批量删除控制标记
  1897. const deleteVisible = ref(false)
  1898. // 多选删除
  1899. const onDelete = async () => {
  1900. const ids = []
  1901. if (multipleSelection.value.length === 0) {
  1902. ElMessage({
  1903. type: 'warning',
  1904. message: '请选择要删除的数据'
  1905. })
  1906. return
  1907. }
  1908. multipleSelection.value &&
  1909. multipleSelection.value.map(item => {
  1910. ids.push(item.ID)
  1911. })
  1912. const res = await deleteCompanyByIds({
  1913. ids
  1914. })
  1915. if (res.code === 0) {
  1916. ElMessage({
  1917. type: 'success',
  1918. message: '删除成功'
  1919. })
  1920. if (tableData.value.length === ids.length && page.value > 1) {
  1921. page.value--
  1922. }
  1923. deleteVisible.value = false
  1924. getTableData()
  1925. }
  1926. }
  1927. // 行为控制标记(弹窗内部需要增还是改)
  1928. const type = ref('')
  1929. // 更新行
  1930. const updateCompanyFunc = async (row) => {
  1931. const res = await findCompany({
  1932. ID: row.ID
  1933. })
  1934. type.value = 'update'
  1935. if (res.code === 0) {
  1936. formData.value = res.data.recompany
  1937. dialogFormVisible.value = true
  1938. }
  1939. }
  1940. // 弹窗控制标记
  1941. const dialogFormVisible = ref(false)
  1942. // 打开弹窗
  1943. const openDialog = () => {
  1944. type.value = 'create'
  1945. dialogFormVisible.value = true
  1946. }
  1947. // 关闭弹窗
  1948. const closeDialog = () => {
  1949. dialogFormVisible.value = false
  1950. formData.value = {
  1951. address: '',
  1952. image: '',
  1953. name: '',
  1954. }
  1955. }
  1956. // 弹窗确定
  1957. const enterDialog = async () => {
  1958. ElMessageBox.confirm('数据存盘?', '提示', {
  1959. confirmButtonText: '确定',
  1960. cancelButtonText: '取消',
  1961. type: 'warning'
  1962. }).then(() => {
  1963. if (formData.value.sczl_rq == '') {
  1964. ElMessage({
  1965. type: 'error',
  1966. message: '请填写日期'
  1967. });
  1968. document.getElementById('日期').focus()
  1969. document.getElementById('日期').select()
  1970. return;
  1971. }
  1972. if (formData.value.sczl_gdbh == '') {
  1973. ElMessage({
  1974. type: 'error',
  1975. message: '请填写工单编号'
  1976. });
  1977. document.getElementById('工单编号').focus()
  1978. document.getElementById('工单编号').select()
  1979. return;
  1980. }
  1981. if (formData.value.sczl_bzdh == '') {
  1982. ElMessage({
  1983. type: 'error',
  1984. message: '请选择班组'
  1985. });
  1986. document.getElementById('组别').focus()
  1987. document.getElementById('组别').select()
  1988. return;
  1989. }
  1990. if (formData.value.sczl_dedh == '') {
  1991. ElMessage({
  1992. type: 'error',
  1993. message: '请选择定额代号'
  1994. });
  1995. document.getElementById('定额代号').focus()
  1996. document.getElementById('定额代号').select()
  1997. return;
  1998. }
  1999. updateDetailData()
  2000. for (let i = 1; i < 10; i++) {
  2001. formData.value[`流程单号${i}`]=0;
  2002. }
  2003. for (let i = 0; i < 12; i++) {
  2004. formData.value[`sczl_bh${i}`] = '';
  2005. formData.value[`sczl_bh${i}_name`] = '';
  2006. formData.value[`sczl_cl${i}`] = 0;
  2007. formData.value[`sczl_fp${i}`] = 0;
  2008. }
  2009. });
  2010. }
  2011. let tables = ref(5);
  2012. let lastCellValue = ref()
  2013. // 双击表格操作
  2014. function doubleClick(row, column, event) {
  2015. type.value = 'update';
  2016. lastCellValue = row['UniqId'];
  2017. tables.value = lastCellValue
  2018. dialogFormVisible.value = true
  2019. GetInfo(tables.value)
  2020. }
  2021. // 单击表格操作
  2022. function Click(row, column, event) {
  2023. lastCellValue = row['UniqId'];
  2024. console.log(row)
  2025. const parts = row['sczl_yjgx'].split('-')
  2026. ScrapFactor.yjno = parts[0]
  2027. ScrapFactor.gdbh = row['sczl_gdbh']
  2028. ScrapFactor.type = row['sczl_检验类别']
  2029. ScrapFactor.gxh = parts[1]
  2030. console.log(lastCellValue)
  2031. }
  2032. // 导出excel
  2033. function exportExcel() {
  2034. console.log('导出到excel');
  2035. }
  2036. // 生命周期钩子
  2037. onMounted(async () => {});
  2038. </script>
  2039. <style>
  2040. .JKWTree-container {
  2041. display: flex;
  2042. }
  2043. .JKWTree-tree {
  2044. width: 300px;
  2045. background-color: #fff;
  2046. padding: 10px;
  2047. margin-right: 20px;
  2048. }
  2049. .JKWTree-tree h3 {
  2050. font-size: 15px;
  2051. font-weight: 700;
  2052. margin: 10px 0;
  2053. }
  2054. .JKWTree-content {
  2055. flex: 1;
  2056. }
  2057. /* 选中某行时的背景色*/
  2058. .el-table__body tr.current-row>td {
  2059. background: #ff80ff !important;
  2060. /* 背景颜色 */
  2061. }
  2062. </style>
  2063. <style scoped>
  2064. :deep(.el-table td .cell) {
  2065. line-height: 20px !important;
  2066. }
  2067. :deep(.el-tabs__header) {
  2068. margin-bottom: 0;
  2069. }
  2070. .search {
  2071. margin-left: 0px !important;
  2072. margin-right: 10px !important;
  2073. }
  2074. .bt {
  2075. margin-left: 2px !important;
  2076. padding: 3px !important;
  2077. font-size: 12px;
  2078. }
  2079. .el-tabs__header {
  2080. margin: 0px !important;
  2081. }
  2082. .gva-table-box {
  2083. padding: 0px !important;
  2084. }
  2085. .mab {
  2086. margin-bottom: 5px;
  2087. }
  2088. </style>