Manualdocuments.vue 54 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674
  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. }
  488. const getTableData = async() => {
  489. // const response = await getDateList(params);
  490. // console.log(response)
  491. // if (response.code === 0) {
  492. // const processedData = response.data.data.map(item => {
  493. // return {
  494. // ...item,
  495. // combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
  496. // combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
  497. // };
  498. // });
  499. // tableData.splice(0, tableData.length, ...processedData);
  500. // }
  501. const response = await getDateList({
  502. date: params.date, sys_id: params.sys_id,
  503. page: page.value.toString(), limit: limit.value.toString(),
  504. })
  505. if (response.code === 0) {
  506. console.log(response)
  507. const processedData = response.data.data.map(item => {
  508. return {
  509. ...item,
  510. combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
  511. combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
  512. };
  513. });
  514. tableData.splice(0, tableData.length, ...processedData);
  515. }
  516. }
  517. const handleNodeClick = (node,check) => {
  518. //存放当前节点的nodeId
  519. if (node.params) {
  520. params.date = node.params.date.replace(/\./g, '-');
  521. params.sys_id = node.params.sys_id;
  522. total.value = node.params.total;
  523. params.type = 'getTableData'
  524. page.value = 1
  525. getTableData();
  526. }
  527. }
  528. //定位
  529. const GetLocate = async () => {
  530. const response = await shougonglocate({
  531. gdbh: params.gdbh,
  532. page: page.value.toString(), limit: limit.value.toString(),
  533. })
  534. console.log(response)
  535. if (response.code === 0) {
  536. const processedData = response.data.rows.map(item => {
  537. return {
  538. ...item,
  539. combinedProp: item.sczl_gdbh + '--'+item.yj_yjmc,
  540. combinedProp2: item.sczl_yjgx + '-'+item.sczl_gxmc
  541. };
  542. });
  543. total.value = response.data.total
  544. tableData.splice(0, tableData.length, ...processedData);
  545. }
  546. }
  547. let positionvalue=ref()
  548. // 搜索
  549. function onSearch() {
  550. params.gdbh = positionvalue.value
  551. params.type = 'getLocateTable'
  552. page.value = 1
  553. GetLocate()
  554. }
  555. //获取详细信息
  556. const GetInfo = async (value) => {
  557. const response = await shougonggetInfo({UniqId:value});
  558. if (response.code === 0) {
  559. formData.value=response.data;
  560. }
  561. }
  562. //键盘 input框跳转
  563. const ent1 = (event) => {
  564. const inputs = document.getElementsByTagName('input');
  565. const currentIndex = Array.from(inputs).indexOf(event.target);
  566. if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
  567. if(event.target.id=='其他备注'){
  568. ElMessageBox.confirm('数据存盘?', '提示', {
  569. confirmButtonText: '确定',
  570. cancelButtonText: '取消',
  571. type: 'warning'
  572. }).then(() => {
  573. enterDialog()
  574. })
  575. }
  576. for (let i = currentIndex + 1; i < inputs.length; i++) {
  577. if (!inputs[i].readOnly) {
  578. nextTick(()=>{
  579. inputs[i].focus();
  580. inputs[i].select();
  581. })
  582. break;
  583. }
  584. }
  585. if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
  586. ent_sum()
  587. }
  588. } else if (event.keyCode === 38) { // 向上箭头
  589. for (let i = currentIndex - 1; i >= 0; i--) {
  590. if (!inputs[i].readOnly) {
  591. nextTick(()=>{
  592. inputs[i].focus();
  593. inputs[i].select();
  594. })
  595. break;
  596. }
  597. }
  598. if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
  599. ent_sum()
  600. }
  601. } else if (event.keyCode === 8) { // 删除箭头
  602. if (event.target.selectionStart === 0) {
  603. for (let i = currentIndex - 1; i >= 0; i--) {
  604. if (!inputs[i].readOnly) {
  605. nextTick(()=>{
  606. inputs[i].focus();
  607. inputs[i].setSelectionRange(0, 0);
  608. })
  609. break;
  610. }
  611. }
  612. if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
  613. ent_sum()
  614. }
  615. }
  616. } else if (event.keyCode === 37) { // 向左箭头
  617. if (event.target.selectionStart === 0) {
  618. for (let i = currentIndex - 1; i >= 0; i--) {
  619. if (!inputs[i].readOnly) {
  620. nextTick(()=>{
  621. inputs[i].focus();
  622. inputs[i].select();
  623. })
  624. break;
  625. }
  626. }
  627. if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
  628. ent_sum()
  629. }
  630. }
  631. } else if (event.keyCode === 39) { // 向右箭头
  632. if(event.target.id=='其他备注'){
  633. ElMessageBox.confirm('数据存盘?', '提示', {
  634. confirmButtonText: '确定',
  635. cancelButtonText: '取消',
  636. type: 'warning'
  637. }).then(() => {
  638. enterDialog()
  639. })
  640. }
  641. if (event.target.selectionStart === event.target.value.length) {
  642. for (let i = currentIndex + 1; i < inputs.length; i++) {
  643. if (!inputs[i].readOnly) {
  644. nextTick(()=>{
  645. inputs[i].focus();
  646. inputs[i].select();
  647. })
  648. break;
  649. }
  650. }
  651. }
  652. if(event.target.id.substring(0, 2)=='cl' || event.target.id.substring(0, 2)=='fp'){
  653. ent_sum()
  654. }
  655. }
  656. }
  657. //追加字体颜色和不可输入
  658. const setColorReadonly = (id) => {
  659. const newInput = document.getElementById(id)
  660. newInput.style.color = 'red';
  661. newInput.setAttribute('readonly', true);
  662. }
  663. //追加字体颜色和可输入
  664. const unsetColorReadonly = (id) => {
  665. const newInput = document.getElementById(id)
  666. newInput.style.color = 'black';
  667. newInput.removeAttribute('readonly');
  668. }
  669. //日期获得焦点事件
  670. const rqHandleFocus = () =>{
  671. if(formData.value.sczl_rq==''){
  672. formData.value.sczl_rq = new Date().toISOString().split('T')[0]
  673. }
  674. }
  675. //班组失去焦点事件
  676. const getBzsubmit = () => {
  677. //弹出选择
  678. const data = [{'sczl_bzdh':'A班'},{'sczl_bzdh':'B班'}]
  679. selectDataBz.splice(0, selectDataBz.length, ...data)
  680. BzVisible.value=true
  681. }
  682. //班组选择
  683. const selectDataBz = reactive([])
  684. const BzVisible = ref(false)
  685. const SelectClickBz = (row, column, event) => {
  686. const {sczl_bzdh } = row
  687. formData.value.sczl_bzdh=row.sczl_bzdh
  688. BzVisible.value = false
  689. }
  690. //员工编号失去焦点事件
  691. const getygsubmit = async (event, inputName) => {
  692. let combinedString = 'sczl_bh' + inputName;
  693. let value = eval('formData.value.' + combinedString);
  694. if(value){
  695. const response = await getYg({sczl_bh:value});
  696. if (response.code === 0) {
  697. let Bname = 'sczl_bh' + inputName+'_name';
  698. formData.value[Bname]=response.data.ygxm;
  699. //设置姓名样式
  700. if(inputName>0){
  701. unsetColorReadonly('cl'+inputName)
  702. unsetColorReadonly('fp'+inputName)
  703. }
  704. }
  705. }
  706. }
  707. const ent_sum = () =>{
  708. let sum = 0;
  709. for(var i=1;i<=12;i++){
  710. sum += formData.value['sczl_cl'+i] * formData.value['sczl_fp'+i]
  711. }
  712. formData.value.sczl_cl = sum
  713. }
  714. //员工编号键盘事件
  715. const ent = (event, inputName) => {
  716. let combinedString = 'sczl_bh' + inputName;
  717. let value = eval('formData.value.' + combinedString);
  718. if (event.keyCode === 13 || event.keyCode === 40) { // Enter 或向下箭头
  719. if(value){
  720. getYg({sczl_bh:value}).then(response => {
  721. if (response.code == 0) {
  722. let Bname = 'sczl_bh' + inputName+'_name';
  723. formData.value[Bname]=response.data.ygxm;
  724. //设置姓名样式
  725. unsetColorReadonly('cl'+inputName)
  726. unsetColorReadonly('fp'+inputName)
  727. document.getElementById('cl'+inputName).focus()
  728. document.getElementById('cl'+inputName).select()
  729. }else{
  730. formData.value['sczl_bh' + inputName+'_name']='';
  731. formData.value['sczl_cl' + inputName]='0';
  732. formData.value['sczl_fp' + inputName]='0';
  733. //设置姓名样式
  734. setColorReadonly('cl'+inputName);
  735. setColorReadonly('fp'+inputName);
  736. if(inputName!=12){
  737. document.getElementById('bh'+(parseInt(inputName)+1)).focus()
  738. document.getElementById('bh'+(parseInt(inputName)+1)).select()
  739. }else{
  740. document.getElementById('其他备注').focus()
  741. document.getElementById('其他备注').select()
  742. }
  743. }
  744. });
  745. }else{
  746. formData.value['sczl_bh' + inputName+'_name']='';
  747. formData.value['sczl_cl' + inputName]='0';
  748. formData.value['sczl_fp' + inputName]='0';
  749. //设置姓名样式
  750. setColorReadonly('cl'+inputName);
  751. setColorReadonly('fp'+inputName);
  752. console.log('bh'+(parseInt(inputName)+1))
  753. if(inputName!=12){
  754. document.getElementById('bh'+(parseInt(inputName)+1)).focus()
  755. document.getElementById('bh'+(parseInt(inputName)+1)).select()
  756. }else{
  757. document.getElementById('其他备注').focus()
  758. document.getElementById('其他备注').select()
  759. }
  760. }
  761. ent_sum()
  762. } else if (event.keyCode === 38) { // 向上箭头
  763. if(value){
  764. getYg({sczl_bh:value}).then(response => {
  765. if (response.code == 0) {
  766. let Bname = 'sczl_bh' + inputName+'_name';
  767. formData.value[Bname]=response.data.ygxm;
  768. //设置姓名样式
  769. unsetColorReadonly('cl'+inputName)
  770. unsetColorReadonly('fp'+inputName)
  771. if(inputName!=1){
  772. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  773. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  774. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  775. }else{
  776. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  777. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  778. }
  779. }else{
  780. document.getElementById('备注').focus()
  781. document.getElementById('备注').select()
  782. }
  783. }else{
  784. formData.value['sczl_bh' + inputName+'_name']='';
  785. formData.value['sczl_cl' + inputName]='0';
  786. formData.value['sczl_fp' + inputName]='0';
  787. //设置姓名样式
  788. setColorReadonly('cl'+inputName);
  789. setColorReadonly('fp'+inputName);
  790. if(inputName!=1){
  791. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  792. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  793. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  794. }else{
  795. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  796. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  797. }
  798. }else{
  799. document.getElementById('备注').focus()
  800. document.getElementById('备注').select()
  801. }
  802. }
  803. });
  804. }else{
  805. formData.value['sczl_bh' + inputName+'_name']='';
  806. formData.value['sczl_cl' + inputName]='0';
  807. formData.value['sczl_fp' + inputName]='0';
  808. //设置姓名样式
  809. setColorReadonly('cl'+inputName);
  810. setColorReadonly('fp'+inputName);
  811. if(inputName!=1){
  812. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  813. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  814. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  815. }else{
  816. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  817. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  818. }
  819. }else{
  820. document.getElementById('备注').focus()
  821. document.getElementById('备注').select()
  822. }
  823. }
  824. ent_sum()
  825. } else if (event.keyCode === 8) { // 删除箭头
  826. if (event.target.selectionStart === 0) {
  827. if(value){
  828. getYg({sczl_bh:value}).then(response => {
  829. if (response.code == 0) {
  830. let Bname = 'sczl_bh' + inputName+'_name';
  831. formData.value[Bname]=response.data.ygxm;
  832. //设置姓名样式
  833. unsetColorReadonly('cl'+inputName)
  834. unsetColorReadonly('fp'+inputName)
  835. if(inputName!=1){
  836. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  837. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  838. document.getElementById('bh'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  839. }else{
  840. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  841. document.getElementById('fp'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  842. }
  843. }else{
  844. document.getElementById('备注').focus()
  845. document.getElementById('备注').setSelectionRange(0, 0)
  846. }
  847. }else{
  848. formData.value['sczl_bh' + inputName+'_name']='';
  849. formData.value['sczl_cl' + inputName]='0';
  850. formData.value['sczl_fp' + inputName]='0';
  851. //设置姓名样式
  852. setColorReadonly('cl'+inputName);
  853. setColorReadonly('fp'+inputName);
  854. if(inputName!=1){
  855. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  856. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  857. document.getElementById('bh'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  858. }else{
  859. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  860. document.getElementById('fp'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  861. }
  862. }else{
  863. document.getElementById('备注').focus()
  864. document.getElementById('备注').setSelectionRange(0, 0)
  865. }
  866. }
  867. });
  868. }else{
  869. formData.value['sczl_bh' + inputName+'_name']='';
  870. formData.value['sczl_cl' + inputName]='0';
  871. formData.value['sczl_fp' + inputName]='0';
  872. //设置姓名样式
  873. setColorReadonly('cl'+inputName);
  874. setColorReadonly('fp'+inputName);
  875. if(inputName!=1){
  876. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  877. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  878. document.getElementById('bh'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  879. }else{
  880. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  881. document.getElementById('fp'+(parseInt(inputName)-1)).setSelectionRange(0, 0)
  882. }
  883. }else{
  884. document.getElementById('备注').focus()
  885. document.getElementById('备注').setSelectionRange(0, 0)
  886. }
  887. }
  888. ent_sum()
  889. }
  890. } else if (event.keyCode === 37) { // 向左箭头
  891. if (event.target.selectionStart === 0) {
  892. if(value){
  893. getYg({sczl_bh:value}).then(response => {
  894. if (response.code == 0) {
  895. let Bname = 'sczl_bh' + inputName+'_name';
  896. formData.value[Bname]=response.data.ygxm;
  897. //设置姓名样式
  898. unsetColorReadonly('cl'+inputName)
  899. unsetColorReadonly('fp'+inputName)
  900. if(inputName!=1){
  901. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  902. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  903. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  904. }else{
  905. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  906. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  907. }
  908. }else{
  909. document.getElementById('备注').focus()
  910. document.getElementById('备注').select()
  911. }
  912. }else{
  913. formData.value['sczl_bh' + inputName+'_name']='';
  914. formData.value['sczl_cl' + inputName]='0';
  915. formData.value['sczl_fp' + inputName]='0';
  916. //设置姓名样式
  917. setColorReadonly('cl'+inputName);
  918. setColorReadonly('fp'+inputName);
  919. if(inputName!=1){
  920. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  921. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  922. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  923. }else{
  924. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  925. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  926. }
  927. }else{
  928. document.getElementById('备注').focus()
  929. document.getElementById('备注').select()
  930. }
  931. }
  932. });
  933. }else{
  934. formData.value['sczl_bh' + inputName+'_name']='';
  935. formData.value['sczl_cl' + inputName]='0';
  936. formData.value['sczl_fp' + inputName]='0';
  937. //设置姓名样式
  938. setColorReadonly('cl'+inputName);
  939. setColorReadonly('fp'+inputName);
  940. if(inputName!=1){
  941. if(document.getElementById('fp'+(parseInt(inputName)-1)).readOnly){
  942. document.getElementById('bh'+(parseInt(inputName)-1)).focus()
  943. document.getElementById('bh'+(parseInt(inputName)-1)).select()
  944. }else{
  945. document.getElementById('fp'+(parseInt(inputName)-1)).focus()
  946. document.getElementById('fp'+(parseInt(inputName)-1)).select()
  947. }
  948. }else{
  949. document.getElementById('备注').focus()
  950. document.getElementById('备注').select()
  951. }
  952. }
  953. ent_sum()
  954. }
  955. } else if (event.keyCode === 39) { // 向右箭头
  956. if (event.target.selectionStart === event.target.value.length) {
  957. if(value){
  958. getYg({sczl_bh:value}).then(response => {
  959. if (response.code == 0) {
  960. let Bname = 'sczl_bh' + inputName+'_name';
  961. formData.value[Bname]=response.data.ygxm;
  962. //设置姓名样式
  963. unsetColorReadonly('cl'+inputName)
  964. unsetColorReadonly('fp'+inputName)
  965. document.getElementById('cl'+inputName).focus()
  966. document.getElementById('cl'+inputName).select()
  967. }else{
  968. formData.value['sczl_bh' + inputName+'_name']='';
  969. formData.value['sczl_cl' + inputName]='0';
  970. formData.value['sczl_fp' + inputName]='0';
  971. //设置姓名样式
  972. setColorReadonly('cl'+inputName);
  973. setColorReadonly('fp'+inputName);
  974. if(inputName!=12){
  975. document.getElementById('bh'+(parseInt(inputName)+1)).focus()
  976. document.getElementById('bh'+(parseInt(inputName)+1)).select()
  977. }else{
  978. document.getElementById('其他备注').focus()
  979. document.getElementById('其他备注').select()
  980. }
  981. }
  982. });
  983. }else{
  984. formData.value['sczl_bh' + inputName+'_name']='';
  985. formData.value['sczl_cl' + inputName]='0';
  986. formData.value['sczl_fp' + inputName]='0';
  987. //设置姓名样式
  988. setColorReadonly('cl'+inputName);
  989. setColorReadonly('fp'+inputName);
  990. console.log('bh'+(parseInt(inputName)+1))
  991. if(inputName!=12){
  992. document.getElementById('bh'+(parseInt(inputName)+1)).focus()
  993. document.getElementById('bh'+(parseInt(inputName)+1)).select()
  994. }else{
  995. document.getElementById('其他备注').focus()
  996. document.getElementById('其他备注').select()
  997. }
  998. }
  999. ent_sum()
  1000. }
  1001. }
  1002. }
  1003. //工单编号失去焦点事件
  1004. const getGxMcsubmit = async() => {
  1005. if(formData.value.sczl_gdbh!=''){
  1006. const response = await shougonggetGxMc({gdbh:formData.value.sczl_gdbh});
  1007. if (response.code === 0) {
  1008. if(response.data.length==0){
  1009. ElMessage({
  1010. type: 'error',
  1011. message: '查无此编号的工单,请仔细检查后重新输入'
  1012. })
  1013. //设置输入框的值为空
  1014. formData.value.sczl_gdbh = ''
  1015. formData.value.sczl_yjgx = ''
  1016. formData.value.sczl_gxmc = ''
  1017. formData.value.yj_yjmc = ''
  1018. }else if(response.data.length==1){
  1019. const { Gd_cpmc, Gy0_yjno, Gy0_gxh, Gy0_gxmc,jyGx} = response.data[0]
  1020. formData.value.yj_yjmc=Gd_cpmc
  1021. formData.value.sczl_gxmc=Gy0_gxmc
  1022. formData.value.sczl_yjgx=jyGx
  1023. setColorReadonly('yjgx');
  1024. setColorReadonly('gxmc');
  1025. setColorReadonly('yjmc');
  1026. }else{
  1027. if(GetDedhVisible.value){
  1028. return false
  1029. }
  1030. selectData.splice(0, selectData.length, ...response.data)
  1031. dialogSelectVisible.value=true
  1032. }
  1033. }
  1034. }else{
  1035. ElMessage({
  1036. type: 'error',
  1037. message: '请注意, 工单编号输入空置, 除非有特殊需要!'
  1038. })
  1039. formData.value.sczl_yjgx = ''
  1040. formData.value.sczl_gxmc = ''
  1041. formData.value.yj_yjmc = ''
  1042. }
  1043. }
  1044. const dialogSelectVisible = ref(false)
  1045. const selectData = reactive([])
  1046. // 工单选择框
  1047. const handleSelectClick = (row, column, event) => {
  1048. const { Gd_cpmc, Gy0_yjno, Gy0_gxh, Gy0_gxmc,jyGx } = row
  1049. formData.value.yj_yjmc=Gd_cpmc
  1050. formData.value.sczl_gxmc=Gy0_gxmc
  1051. formData.value.sczl_yjgx=jyGx
  1052. setColorReadonly('yjgx');
  1053. setColorReadonly('gxmc');
  1054. setColorReadonly('yjmc');
  1055. dialogSelectVisible.value = false
  1056. }
  1057. //定额代号回车事件
  1058. const getDedhsubmit = () => {
  1059. if(dialogSelectVisible.value){
  1060. return false
  1061. }
  1062. if(LbVisible.value){
  1063. return false
  1064. }
  1065. GetDedh()
  1066. }
  1067. let GetDedhtreeData = reactive([]);
  1068. const GetDedhVisible = ref(false)
  1069. //获取定额代号
  1070. const GetDedh = async (value) => {
  1071. const response = await shougonggetDedh();
  1072. const treeData = {};
  1073. // const data = [];
  1074. // data[0] = response.data;
  1075. // //判断值是否在选项中存在
  1076. // const buildTree1 = (node) => {
  1077. // const arr = [];
  1078. // // 如果存在子节点,递归地添加它们
  1079. // if (node.bh_mc && Array.isArray(node.bh_mc)) {
  1080. // node.bh_mc.forEach(childNode => {
  1081. // arr.push(...buildTree1(childNode)); // 递归调用
  1082. // });
  1083. // }else{
  1084. // arr.push(node.sys_bh)
  1085. // }
  1086. // return arr;
  1087. // };
  1088. // // 构建树形结构的根节点
  1089. // const Data = data.map(buildTree1);
  1090. if(response.code==0){
  1091. const data = [];
  1092. data[0] = response.data;
  1093. // 递归函数来构建树形结构
  1094. const buildTree = (node) => {
  1095. const treeNode = {
  1096. label: node.sys_bh + '【' + node.sys_mc+'】',
  1097. children: []
  1098. };
  1099. // 如果存在子节点,递归地添加它们
  1100. if (node.bh_mc && Array.isArray(node.bh_mc)) {
  1101. node.bh_mc.forEach(childNode => {
  1102. treeNode.children.push(buildTree(childNode)); // 递归调用
  1103. });
  1104. }
  1105. return treeNode;
  1106. };
  1107. // 构建树形结构的根节点
  1108. const treeData = data.map(buildTree);
  1109. GetDedhtreeData = treeData;
  1110. GetDedhVisible.value=true
  1111. }
  1112. }
  1113. //定额代号树形结构单机
  1114. const GetDedhhandleNodeClick = (nodeData, node, component) => {
  1115. //存放当前节点的nodeId
  1116. if (!nodeData.children || nodeData.children.length === 0) {
  1117. // 点击的是子节点
  1118. formData.value.sczl_dedh=nodeData.label.split("【")[0]
  1119. GetDedhVisible.value=false
  1120. }
  1121. // 执行相应的父节点单击事件处理逻辑
  1122. }
  1123. //检验类别失去焦点事件
  1124. const getLbsubmit = () => {
  1125. if(GetDedhVisible.value){
  1126. return false
  1127. }
  1128. //弹出选择
  1129. const data = [{'sczl_检验类别':''},{'sczl_检验类别':'正品板'},{'sczl_检验类别':'次品板'},{'sczl_检验类别':'废品板'}]
  1130. selectDataLb.splice(0, selectDataLb.length, ...data)
  1131. LbVisible.value=true
  1132. }
  1133. //班组选择
  1134. const selectDataLb = reactive([])
  1135. const LbVisible = ref(false)
  1136. const SelectClickLb = (row, column, event) => {
  1137. const {sczl_检验类别 } = row
  1138. formData.value.sczl_检验类别=row.sczl_检验类别
  1139. //查询废品系数
  1140. if(row.sczl_检验类别!=''){
  1141. var value = {
  1142. 'gdbh':formData.value.sczl_gdbh,
  1143. 'yjno':parseInt(formData.value.sczl_yjgx.split('-')[0]),
  1144. 'gxh':parseInt(formData.value.sczl_yjgx.split('-')[1]),
  1145. 'type':formData.value.sczl_检验类别
  1146. }
  1147. shougonggetScrapFactor(value).then(response=>{
  1148. if(response.code==0){
  1149. if(response.data!=null){
  1150. formData.value.sczl_废品率系数 = response.data.num;
  1151. }
  1152. setColorReadonly('废品率系数')
  1153. }
  1154. });
  1155. }else{
  1156. unsetColorReadonly('废品率系数')
  1157. }
  1158. LbVisible.value = false
  1159. }
  1160. //刷新废品率系数
  1161. const GetScrapFactor = async (value) => {
  1162. const response = await shougonggetScrapFactor(value);
  1163. if(response.code==0){
  1164. console.log(response.data.num)
  1165. const rowIndex = tableData.findIndex(row => row.UniqId === lastCellValue);
  1166. console.log(rowIndex)
  1167. tableData[rowIndex].sczl_废品率系数 = response.data.num;
  1168. }
  1169. // console.log(response)
  1170. // const rowIndex = tableData.findIndex(row => row.UniqId === 123);
  1171. }
  1172. const ADD=ref('0')
  1173. //新增
  1174. function onAdd() {
  1175. ADD.value='新增'
  1176. type.value = 'create'
  1177. if(typeof(lastCellValue)=='number'){
  1178. GetInfo(lastCellValue)
  1179. }
  1180. initFormData()
  1181. dialogFormVisible.value = true
  1182. // Productionadd()
  1183. }
  1184. const ScrapFactor={
  1185. gdbh:'',
  1186. yjno:'',
  1187. gxh:'',
  1188. type:'',
  1189. }
  1190. // 刷新废品率系数
  1191. function onRefresh() {
  1192. GetScrapFactor(ScrapFactor)
  1193. }
  1194. // 更新数据
  1195. const updateDetailData = async() => {
  1196. const restoredData = {
  1197. UniqId: lastCellValue,
  1198. sczl_rq: formData.value.sczl_rq,
  1199. sczl_bzdh: formData.value.sczl_bzdh,
  1200. sczl_bh0: formData.value.sczl_bh0,
  1201. sczl_cl0: formData.value.sczl_cl0,
  1202. sczl_fp0: formData.value.sczl_fp0,
  1203. sczl_gdbh: formData.value.sczl_gdbh,
  1204. sczl_yjgx: formData.value.sczl_yjgx,
  1205. sczl_gxmc: formData.value.sczl_gxmc,
  1206. sczl_cl:formData.value.sczl_cl,
  1207. sczl_dedh: formData.value.sczl_dedh,
  1208. sczl_检验类别: formData.value.sczl_检验类别,
  1209. sczl_废品率系数: formData.value.sczl_废品率系数,
  1210. sczl_jsss: formData.value.sczl_jsss,
  1211. sczl_冲定额: formData.value.sczl_冲定额,
  1212. qczl_Num:formData.value.qczl_NumDesc,
  1213. qczl_NumDesc:formData.value.流程单号1,
  1214. qczl_NumDesc1: formData.value.流程单号2,
  1215. qczl_NumDesc2: formData.value.流程单号3,
  1216. qczl_NumDesc3: formData.value.流程单号4,
  1217. qczl_NumDesc4: formData.value.流程单号5,
  1218. qczl_NumDesc5: formData.value.流程单号6,
  1219. qczl_NumDesc6: formData.value.流程单号7,
  1220. qczl_NumDesc7: formData.value.流程单号8,
  1221. qczl_NumDesc8: formData.value.流程单号9,
  1222. sczl_desc: formData.value.sczl_desc,
  1223. sczl_bh1: formData.value.sczl_bh1,
  1224. sczl_bh2: formData.value.sczl_bh2,
  1225. sczl_bh3:formData.value.sczl_bh3,
  1226. sczl_bh4: formData.value.sczl_bh4,
  1227. sczl_bh5: formData.value.sczl_bh5,
  1228. sczl_bh6: formData.value.sczl_bh6,
  1229. sczl_bh7: formData.value.sczl_bh7,
  1230. sczl_bh8: formData.value.sczl_bh8,
  1231. sczl_bh9: formData.value.sczl_bh9,
  1232. sczl_bh10: formData.value.sczl_bh10,
  1233. sczl_bh11: formData.value.sczl_bh11,
  1234. sczl_bh12: formData.value.sczl_bh12,
  1235. sczl_cl1: formData.value.sczl_cl1,
  1236. sczl_cl2: formData.value.sczl_cl2,
  1237. sczl_cl3: formData.value.sczl_cl3,
  1238. sczl_cl4: formData.value.sczl_cl4,
  1239. sczl_cl5: formData.value.sczl_cl5,
  1240. sczl_cl6: formData.value.sczl_cl6,
  1241. sczl_cl7: formData.value.sczl_cl7,
  1242. sczl_cl8: formData.value.sczl_cl8,
  1243. sczl_cl9: formData.value.sczl_cl9,
  1244. sczl_cl10: formData.value.sczl_cl10,
  1245. sczl_cl11:formData.value.sczl_cl11,
  1246. sczl_cl12: formData.value.sczl_cl12,
  1247. sczl_fp1: formData.value.sczl_fp1,
  1248. sczl_fp2: formData.value.sczl_fp2,
  1249. sczl_fp3: formData.value.sczl_fp3,
  1250. sczl_fp4: formData.value.sczl_fp4,
  1251. sczl_fp5: formData.value.sczl_fp5,
  1252. sczl_fp6: formData.value.sczl_fp6,
  1253. sczl_fp7: formData.value.sczl_fp7,
  1254. sczl_fp8: formData.value.sczl_fp8,
  1255. sczl_fp9: formData.value.sczl_fp9,
  1256. sczl_fp10: formData.value.sczl_fp10,
  1257. sczl_fp11: formData.value.sczl_fp11,
  1258. sczl_fp12: formData.value.sczl_fp12,
  1259. sys_id:'[1013/洪丽]',
  1260. }
  1261. // detailData.table.forEach((item, index, array) => {
  1262. // const num = index + 1
  1263. // restoredData[`sczl_gdbh${num}`] = item.sczl_gdbh
  1264. // restoredData[`sczl_yjGx${num}`] = item.sczl_yjGx
  1265. // restoredData[`sczl_gxmc${num}`] = item.sczl_gxmc
  1266. // // restoredData[`Gd_cpmc${num}`] = item.Gd_cpmc
  1267. // restoredData[`sczl_cl${num}`] = item.sczl_cl
  1268. // restoredData[`sczl_PgCl${num}`] = item.sczl_PgCl
  1269. // restoredData[`sczl_clAdd${num}`] = item.sczl_clAdd
  1270. // })
  1271. if(ADD.value=='新增'){
  1272. // console.log('新增')
  1273. console.log('新增')
  1274. console.log(ADD.value)
  1275. console.log(restoredData)
  1276. const response = await inspectadd(restoredData);
  1277. // ADD.value='1'
  1278. // console.log(ADD.value)
  1279. ADD.value='0'
  1280. console.log(response)
  1281. if(response.code==0){
  1282. ElMessage({
  1283. type: 'success',
  1284. message: '新增成功',
  1285. })
  1286. }
  1287. dialogFormVisible.value = false
  1288. }else{
  1289. const response = await shougongedit(restoredData);
  1290. console.log('修改')
  1291. console.log(ADD.value)
  1292. console.log(response)
  1293. if(response.code==0){
  1294. ElMessage({
  1295. type: 'success',
  1296. message: '更新成功',
  1297. })
  1298. }
  1299. dialogFormVisible.value = false
  1300. // ADD.value='0'
  1301. // console.log(ADD.value)
  1302. }
  1303. // console.log(restoredData)
  1304. // console.log(lastCellValue)
  1305. // formData.value.UniqId=lastCellValue
  1306. // console.log(formData)
  1307. // restoredData.UniqId='5'
  1308. // console.log(FormData)
  1309. // console.log(response)
  1310. }
  1311. // 删除
  1312. function onDel() {
  1313. Del()
  1314. }
  1315. //删除
  1316. const Del = async () => {
  1317. const response = await shougongdel({UniqId:lastCellValue});
  1318. if (response.code === 0) {
  1319. ElMessage({
  1320. type: 'success',
  1321. message: '删除成功',
  1322. })
  1323. }
  1324. getTableData()
  1325. }
  1326. const displayMod = ref('')
  1327. // 按工单显示
  1328. function onCountByGdbh() {
  1329. console.log(displayMod.value)
  1330. if (displayMod.value === 'date') {
  1331. displayMod.value = 'gd'
  1332. CountByGdbh()
  1333. console.log(displayMod.value)
  1334. } else {
  1335. getTabdata()
  1336. }
  1337. // CountByGdbh()
  1338. }
  1339. //按工单显示
  1340. const CountByGdbh = async () => {
  1341. const response = await getInspectCountByGdbh();
  1342. // console.log(response)
  1343. if (response.code === 0) {
  1344. console.log(response)
  1345. const transformedData = response.data.map(item => ({
  1346. label: `${item.sczl_gdbh+item.cpmc}`,
  1347. children: item.sys.map(sysItem => ({
  1348. label: `${sysItem.sys_id} 【记录数: ${sysItem.count}张】`,
  1349. params: {
  1350. date: item.sczl_gdbh,
  1351. sys_id: sysItem.sys_id,
  1352. total: sysItem.count,
  1353. },
  1354. })),
  1355. }));
  1356. treeData.splice(0, treeData.length, ...transformedData);
  1357. }
  1358. // getTableData()
  1359. }
  1360. // ============== 表格控制部分结束 ===============
  1361. // 获取需要的字典 可能为空 按需保留
  1362. const setOptions = async () => {
  1363. }
  1364. // 获取需要的字典 可能为空 按需保留
  1365. setOptions()
  1366. // 多选数据
  1367. const multipleSelection = ref([])
  1368. // 多选
  1369. const handleSelectionChange = (val) => {
  1370. if(val.length>0){
  1371. multipleSelection.value = val
  1372. const lenth=val.length
  1373. ScrapFactor.gdbh=val[lenth-1].combinedProp.split('-')[0];
  1374. const parts = val[lenth-1].combinedProp2.split('-')
  1375. ScrapFactor.yjno=parts[0];
  1376. ScrapFactor.gxh=parts[1];
  1377. // ScrapFactor.type=val[lenth-1].sczl_检验类别
  1378. ScrapFactor.type='正品板'
  1379. console.log(ScrapFactor)
  1380. lastCellValue=val[lenth-1].UniqId
  1381. console.log(ScrapFactor)
  1382. val.splice(0, val.length); // 清空 val 数组
  1383. console.log(lastCellValue)
  1384. }
  1385. }
  1386. // 批量删除控制标记
  1387. const deleteVisible = ref(false)
  1388. // 多选删除
  1389. const onDelete = async () => {
  1390. const ids = []
  1391. if (multipleSelection.value.length === 0) {
  1392. ElMessage({
  1393. type: 'warning',
  1394. message: '请选择要删除的数据'
  1395. })
  1396. return
  1397. }
  1398. multipleSelection.value &&
  1399. multipleSelection.value.map(item => {
  1400. ids.push(item.ID)
  1401. })
  1402. const res = await deleteCompanyByIds({ ids })
  1403. if (res.code === 0) {
  1404. ElMessage({
  1405. type: 'success',
  1406. message: '删除成功'
  1407. })
  1408. if (tableData.value.length === ids.length && page.value > 1) {
  1409. page.value--
  1410. }
  1411. deleteVisible.value = false
  1412. getTableData()
  1413. }
  1414. }
  1415. // 行为控制标记(弹窗内部需要增还是改)
  1416. const type = ref('')
  1417. // 更新行
  1418. const updateCompanyFunc = async (row) => {
  1419. const res = await findCompany({ ID: row.ID })
  1420. type.value = 'update'
  1421. if (res.code === 0) {
  1422. formData.value = res.data.recompany
  1423. dialogFormVisible.value = true
  1424. }
  1425. }
  1426. // 弹窗控制标记
  1427. const dialogFormVisible = ref(false)
  1428. // 打开弹窗
  1429. const openDialog = () => {
  1430. type.value = 'create'
  1431. dialogFormVisible.value = true
  1432. }
  1433. // 关闭弹窗
  1434. const closeDialog = () => {
  1435. dialogFormVisible.value = false
  1436. formData.value = {
  1437. address: '',
  1438. image: '',
  1439. name: '',
  1440. }
  1441. }
  1442. // 弹窗确定
  1443. const enterDialog = async () => {
  1444. ElMessageBox.confirm('数据存盘?', '提示', {
  1445. confirmButtonText: '确定',
  1446. cancelButtonText: '取消',
  1447. type: 'warning'
  1448. }).then(() => {
  1449. if(formData.value.sczl_rq==''){
  1450. ElMessage({
  1451. type: 'error',
  1452. message: '请填写日期'
  1453. });
  1454. document.getElementById('日期').focus()
  1455. document.getElementById('日期').select()
  1456. return;
  1457. }
  1458. if(formData.value.sczl_gdbh==''){
  1459. ElMessage({
  1460. type: 'error',
  1461. message: '请填写工单编号'
  1462. });
  1463. document.getElementById('工单编号').focus()
  1464. document.getElementById('工单编号').select()
  1465. return;
  1466. }
  1467. if(formData.value.sczl_bzdh==''){
  1468. ElMessage({
  1469. type: 'error',
  1470. message: '请选择班组'
  1471. });
  1472. document.getElementById('组别').focus()
  1473. document.getElementById('组别').select()
  1474. return;
  1475. }
  1476. if(formData.value.sczl_dedh==''){
  1477. ElMessage({
  1478. type: 'error',
  1479. message: '请选择定额代号'
  1480. });
  1481. document.getElementById('定额代号').focus()
  1482. document.getElementById('定额代号').select()
  1483. return;
  1484. }
  1485. updateDetailData()
  1486. });
  1487. }
  1488. let table=ref(5);
  1489. let lastCellValue=ref()
  1490. // 双击表格操作
  1491. function doubleClick(row, column, event) {
  1492. type.value = 'update';
  1493. lastCellValue= row['UniqId'];
  1494. console.log(lastCellValue)
  1495. table.value=lastCellValue
  1496. dialogFormVisible.value = true
  1497. // dialogSelectVisible.value = true
  1498. GetInfo(table.value)
  1499. // dialogFormVisible.value = true
  1500. }
  1501. // 单击表格操作
  1502. function Click(row, column, event) {
  1503. lastCellValue= row['UniqId'];
  1504. console.log(lastCellValue)
  1505. }
  1506. // 导出excel
  1507. function exportExcel() {
  1508. console.log('导出到excel');
  1509. }
  1510. // 生命周期钩子
  1511. onMounted(async () => {
  1512. });
  1513. </script>
  1514. <style>
  1515. .JKWTree-container {
  1516. display: flex;
  1517. }
  1518. .JKWTree-tree {
  1519. width: 300px;
  1520. background-color: #fff;
  1521. padding: 10px;
  1522. margin-right: 20px;
  1523. }
  1524. .JKWTree-tree h3 {
  1525. font-size: 15px;
  1526. font-weight: 700;
  1527. margin: 10px 0;
  1528. }
  1529. .JKWTree-content {
  1530. flex: 1;
  1531. }
  1532. /* 选中某行时的背景色*/
  1533. .el-table__body tr.current-row>td {
  1534. background: #ff80ff !important;
  1535. /* 背景颜色 */
  1536. }
  1537. </style>
  1538. <style scoped>
  1539. :deep(.el-table td .cell) {
  1540. line-height: 20px !important;
  1541. }
  1542. :deep(.el-tabs__header){
  1543. margin-bottom: 0;
  1544. }
  1545. .search{
  1546. margin-left: 0px !important;
  1547. margin-right: 10px !important;
  1548. }
  1549. .bt{
  1550. margin-left: 2px !important;
  1551. padding: 3px !important;
  1552. font-size: 12px;
  1553. }
  1554. .el-tabs__header{
  1555. margin: 0px !important;
  1556. }
  1557. .gva-table-box{
  1558. padding: 0px !important;
  1559. }
  1560. .mab{
  1561. margin-bottom: 5px;
  1562. }
  1563. </style>