Manualdocuments.vue 53 KB

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