Manualdocuments.vue 54 KB

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