Manualdocuments.vue 54 KB

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