index.vue 50 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731
  1. <template>
  2. <div class="container">
  3. <div class="infobox">
  4. <div class="header">
  5. <div class="text">工序名称:</div>
  6. <el-select
  7. v-model="value"
  8. placeholder="Select"
  9. ref="selectRef"
  10. @change="changeSelect"
  11. >
  12. <el-option
  13. v-for="item in opOptions"
  14. :key="item.value"
  15. :label="item.dictLabel"
  16. :value="item.remark"
  17. />
  18. </el-select>
  19. </div>
  20. <div class="body">
  21. <div class="text">
  22. 规格上限:{{ value ? JSON.parse(value).up : "-" }}
  23. </div>
  24. <div class="text">
  25. 规格下限:{{ value ? JSON.parse(value).down : "-" }}
  26. </div>
  27. <div class="text">
  28. 计量单位:{{ value ? JSON.parse(value).unit : "-" }}
  29. </div>
  30. </div>
  31. </div>
  32. <div class="databox">
  33. <el-scrollbar :style="{ height: Height + 'px' }">
  34. <div class="box">
  35. <div class="title">
  36. <div style="display: flex; align-items: center">
  37. <div class="bg"></div>
  38. 样本数据录入
  39. </div>
  40. <div class="btns">
  41. <!-- <el-button
  42. v-if="!editStatus && !addStatus"
  43. type="primary"
  44. class="btn"
  45. @click="changeEditstatus"
  46. >编辑</el-button
  47. > -->
  48. <el-button
  49. v-if="!addStatus && !editStatus"
  50. type="primary"
  51. class="btn"
  52. v-print="'#print'"
  53. @click="printFnc"
  54. >打印</el-button
  55. >
  56. <el-button
  57. v-if="!addStatus && !editStatus"
  58. type="primary"
  59. class="btn"
  60. @click="changeaddstatus"
  61. >新增</el-button
  62. >
  63. <el-button
  64. v-if="editStatus || addStatus"
  65. type="success"
  66. class="btn"
  67. @click="submit"
  68. id="submit"
  69. >确定</el-button
  70. >
  71. <el-button
  72. v-if="editStatus || addStatus"
  73. type="info"
  74. class="btn"
  75. @click="canceleOp"
  76. id="cancel"
  77. >取消</el-button
  78. ><span v-if="!addStatus && !editStatus" style="margin: 10px"
  79. >年份:</span
  80. >
  81. <el-date-picker
  82. v-if="!addStatus && !editStatus"
  83. v-model="year"
  84. class="btn"
  85. type="year"
  86. style="width: 160px"
  87. value-format="YYYY"
  88. placeholder="Pick a year"
  89. :clear-icon="''"
  90. @change="getTableData"
  91. />
  92. </div>
  93. <!-- 导入代码 -->
  94. <!-- <div class="btns">
  95. <el-button
  96. class="btn"
  97. :type="disabled ? 'success' : 'primary'"
  98. @click="changeEdit"
  99. v-if="importStatus"
  100. >{{ disabled ? "保存" : "编辑" }}</el-button
  101. >
  102. <el-button
  103. v-if="disabled && importStatus"
  104. type="info"
  105. class="btn"
  106. @click="cancelEdit"
  107. >取消</el-button
  108. >
  109. <el-upload
  110. class="btn"
  111. :action="url"
  112. :show-file-list="false"
  113. accept=".xlsx, .xls"
  114. multiple
  115. :on-success="onSuccess"
  116. :headers="headers"
  117. >
  118. <el-button class="btn" type="primary">导入</el-button>
  119. </el-upload>
  120. </div> -->
  121. </div>
  122. <!-- <div class="tableTitle">
  123. 调阻精度一致性检测表
  124. <span style="float: right; right: 30px">2024年</span>
  125. </div> -->
  126. <div class="info" v-show="!addStatus">
  127. <div id="print" v-loading="printLoading">
  128. <div class="tableTitle">
  129. <div></div>
  130. <div>{{ title }}一致性检测表</div>
  131. <div>{{ year }}年</div>
  132. </div>
  133. <el-table
  134. v-if="!printStatus"
  135. :data="showTableData"
  136. :span-method="objectSpanMethod"
  137. id="table"
  138. border
  139. :style="{
  140. height: Height - 230 + 'px',
  141. width: maxWidth + 'px',
  142. }"
  143. :show-overflow-tooltip="true"
  144. >
  145. <el-table-column
  146. align="center"
  147. width="100"
  148. prop="dateStr"
  149. sortable
  150. label="日期"
  151. >
  152. <template #default="{ row }"
  153. ><span>{{ row.dateStr }}</span>
  154. </template>
  155. </el-table-column>
  156. <el-table-column
  157. align="center"
  158. width="110"
  159. prop="model"
  160. label="产品型号"
  161. >
  162. <template #default="{ row }"
  163. ><span>{{ row.model }}</span>
  164. </template>
  165. </el-table-column>
  166. <el-table-column
  167. align="center"
  168. width="100"
  169. prop="batchNo"
  170. label="生产批号"
  171. >
  172. <template #default="{ row }"
  173. ><span>{{ row.accuracy1 }}</span>
  174. </template>
  175. </el-table-column>
  176. <el-table-column align="center" :label="title">
  177. <el-table-column
  178. align="center"
  179. prop="accuracy1"
  180. width="60"
  181. label="数值1"
  182. >
  183. <template #default="{ row }"
  184. ><span>{{ row.accuracy1 }}</span>
  185. </template>
  186. </el-table-column>
  187. <el-table-column
  188. align="center"
  189. prop="accuracy2"
  190. width="60"
  191. label="数值2"
  192. >
  193. <template #default="{ row }"
  194. ><span>{{ row.accuracy2 }}</span>
  195. </template>
  196. </el-table-column>
  197. <el-table-column
  198. align="center"
  199. prop="accuracy3"
  200. width="60"
  201. label="数值3"
  202. >
  203. <template #default="{ row }"
  204. ><span>{{ row.accuracy3 }}</span>
  205. </template>
  206. </el-table-column>
  207. <el-table-column
  208. align="center"
  209. prop="accuracy4"
  210. width="60"
  211. label="数值4"
  212. >
  213. <template #default="{ row }"
  214. ><span>{{ row.accuracy4 }}</span>
  215. </template>
  216. </el-table-column>
  217. <el-table-column
  218. align="center"
  219. prop="accuracy5"
  220. width="60"
  221. label="数值5"
  222. >
  223. <template #default="{ row }"
  224. ><span>{{ row.accuracy5 }}</span>
  225. </template>
  226. </el-table-column>
  227. <el-table-column
  228. align="center"
  229. prop="accuracy6"
  230. width="60"
  231. label="数值6"
  232. >
  233. <template #default="{ row }"
  234. ><span>{{ row.accuracy6 }}</span>
  235. </template>
  236. </el-table-column>
  237. <el-table-column
  238. align="center"
  239. prop="accuracy7"
  240. width="60"
  241. label="数值7"
  242. >
  243. <template #default="{ row }"
  244. ><span>{{ row.accuracy7 }}</span>
  245. </template>
  246. </el-table-column>
  247. <el-table-column
  248. align="center"
  249. prop="accuracy8"
  250. width="60"
  251. label="数值8"
  252. >
  253. <template #default="{ row }"
  254. ><span>{{ row.accuracy8 }}</span>
  255. </template>
  256. </el-table-column>
  257. <el-table-column
  258. align="center"
  259. prop="accuracy9"
  260. width="60"
  261. label="数值9"
  262. >
  263. <template #default="{ row }"
  264. ><span>{{ row.accuracy9 }}</span>
  265. </template>
  266. </el-table-column>
  267. <el-table-column
  268. align="center"
  269. prop="accuracy10"
  270. width="60"
  271. label="数值10"
  272. >
  273. <template #default="{ row }"
  274. ><span>{{ row.accuracy10 }}</span>
  275. </template>
  276. </el-table-column> </el-table-column
  277. ><el-table-column
  278. align="center"
  279. prop="Cpk"
  280. label="Cpk值"
  281. width="80"
  282. >
  283. <template #default="{ row }"
  284. ><span>{{ Number(row.cpk).toFixed(2) }}</span>
  285. </template>
  286. </el-table-column>
  287. <el-table-column
  288. align="center"
  289. width="70"
  290. prop="checkUser"
  291. label="检测人"
  292. >
  293. <template #default="{ row }"
  294. ><span>{{ row.checkUser }}</span>
  295. </template> </el-table-column
  296. ><el-table-column
  297. align="center"
  298. prop="checkDeviceNo"
  299. label="检查设备编号"
  300. >
  301. <template #default="{ row }"
  302. ><span>{{ row.checkDeviceNo }}</span>
  303. </template>
  304. </el-table-column>
  305. <el-table-column
  306. align="center"
  307. prop="abnormal"
  308. width="60"
  309. label="是否异常"
  310. >
  311. <template #default="{ row }"
  312. ><span>{{ row.abnormal }}</span>
  313. </template>
  314. </el-table-column>
  315. <el-table-column
  316. align="center"
  317. prop="analyseUser"
  318. label="分析人"
  319. >
  320. <template #default="{ row }"
  321. ><span>{{ row.analyseUser }}</span>
  322. </template>
  323. </el-table-column>
  324. <el-table-column align="center" prop="measure" label="处置措施">
  325. <template #default="{ row }"
  326. ><span>{{ row.measure }}</span>
  327. </template>
  328. </el-table-column>
  329. <el-table-column align="center" prop="remark" label="备注">
  330. <template #default="{ row }"
  331. ><span>{{ row.remark }}</span>
  332. </template>
  333. </el-table-column>
  334. <el-table-column
  335. align="center"
  336. width="160"
  337. prop=""
  338. label="操作"
  339. id="opear"
  340. >
  341. <template #default="{ row }">
  342. <el-button
  343. type="primary"
  344. class="btn"
  345. @click="updataItem(row.Index)"
  346. style="height: 25px"
  347. >修改</el-button
  348. >
  349. <el-button
  350. type="info"
  351. class="btn"
  352. style="height: 25px"
  353. @click="deleteSubmit(row.id)"
  354. >删除</el-button
  355. >
  356. </template>
  357. </el-table-column>
  358. </el-table>
  359. <!-- 打印table -->
  360. <el-table
  361. v-else
  362. :data="showTableData"
  363. :span-method="objectSpanMethod"
  364. id="table1"
  365. border
  366. :style="{
  367. height: Height - 160 + 'px',
  368. width: maxWidth + 'px',
  369. }"
  370. cell-class-name="printStyle"
  371. >
  372. <el-table-column
  373. align="center"
  374. width="60"
  375. prop="dateStr"
  376. sortable
  377. label="日期"
  378. >
  379. <template #default="{ row }"
  380. ><span>{{ row.dateStr }}</span>
  381. </template>
  382. </el-table-column>
  383. <el-table-column
  384. align="center"
  385. width="60"
  386. prop="model"
  387. label="产品型号"
  388. >
  389. <template #default="{ row }"
  390. ><span>{{ row.model }}</span>
  391. </template>
  392. </el-table-column>
  393. <el-table-column
  394. align="center"
  395. width="60"
  396. prop="batchNo"
  397. label="生产批号"
  398. >
  399. <template #default="{ row }"
  400. ><span>{{ row.accuracy1 }}</span>
  401. </template>
  402. </el-table-column>
  403. <el-table-column align="center" :label="title">
  404. <el-table-column
  405. align="center"
  406. prop="accuracy1"
  407. width="44"
  408. label="数值1"
  409. >
  410. <template #default="{ row }"
  411. ><span>{{ row.accuracy1 }}</span>
  412. </template>
  413. </el-table-column>
  414. <el-table-column
  415. align="center"
  416. prop="accuracy2"
  417. width="44"
  418. label="数值2"
  419. >
  420. <template #default="{ row }"
  421. ><span>{{ row.accuracy2 }}</span>
  422. </template>
  423. </el-table-column>
  424. <el-table-column
  425. align="center"
  426. prop="accuracy3"
  427. width="44"
  428. label="数值3"
  429. >
  430. <template #default="{ row }"
  431. ><span>{{ row.accuracy3 }}</span>
  432. </template>
  433. </el-table-column>
  434. <el-table-column
  435. align="center"
  436. prop="accuracy4"
  437. width="44"
  438. label="数值4"
  439. >
  440. <template #default="{ row }"
  441. ><span>{{ row.accuracy4 }}</span>
  442. </template>
  443. </el-table-column>
  444. <el-table-column
  445. align="center"
  446. prop="accuracy5"
  447. width="44"
  448. label="数值5"
  449. >
  450. <template #default="{ row }"
  451. ><span>{{ row.accuracy5 }}</span>
  452. </template>
  453. </el-table-column>
  454. <el-table-column
  455. align="center"
  456. prop="accuracy6"
  457. width="44"
  458. label="数值6"
  459. >
  460. <template #default="{ row }"
  461. ><span>{{ row.accuracy6 }}</span>
  462. </template>
  463. </el-table-column>
  464. <el-table-column
  465. align="center"
  466. prop="accuracy7"
  467. width="44"
  468. label="数值7"
  469. >
  470. <template #default="{ row }"
  471. ><span>{{ row.accuracy7 }}</span>
  472. </template>
  473. </el-table-column>
  474. <el-table-column
  475. align="center"
  476. prop="accuracy8"
  477. width="44"
  478. label="数值8"
  479. >
  480. <template #default="{ row }"
  481. ><span>{{ row.accuracy8 }}</span>
  482. </template>
  483. </el-table-column>
  484. <el-table-column
  485. align="center"
  486. prop="accuracy9"
  487. width="44"
  488. label="数值9"
  489. >
  490. <template #default="{ row }"
  491. ><span>{{ row.accuracy9 }}</span>
  492. </template>
  493. </el-table-column>
  494. <el-table-column
  495. align="center"
  496. prop="accuracy10"
  497. width="44"
  498. label="数值10"
  499. >
  500. <template #default="{ row }"
  501. ><span>{{ row.accuracy10 }}</span>
  502. </template>
  503. </el-table-column> </el-table-column
  504. ><el-table-column
  505. align="center"
  506. prop="Cpk"
  507. label="Cpk值"
  508. width="50"
  509. >
  510. <template #default="{ row }"
  511. ><span>{{ Number(row.cpk).toFixed(2) }}</span>
  512. </template>
  513. </el-table-column>
  514. <el-table-column
  515. align="center"
  516. width="60"
  517. prop="checkUser"
  518. label="检测人"
  519. >
  520. <template #default="{ row }"
  521. ><span>{{ row.checkUser }}</span>
  522. </template> </el-table-column
  523. ><el-table-column
  524. align="center"
  525. prop="checkDeviceNo"
  526. label="检查设备编号"
  527. width="80"
  528. >
  529. <template #default="{ row }"
  530. ><span>{{ row.checkDeviceNo }}</span>
  531. </template>
  532. </el-table-column>
  533. <el-table-column
  534. align="center"
  535. prop="abnormal"
  536. width="40"
  537. label="是否异常"
  538. >
  539. <template #default="{ row }"
  540. ><span>{{ row.abnormal }}</span>
  541. </template>
  542. </el-table-column>
  543. <el-table-column
  544. align="center"
  545. prop="analyseUser"
  546. label="分析人"
  547. width="60"
  548. >
  549. <template #default="{ row }"
  550. ><span>{{ row.analyseUser }}</span>
  551. </template>
  552. </el-table-column>
  553. <el-table-column
  554. width="60"
  555. align="center"
  556. prop="measure"
  557. label="处置措施"
  558. >
  559. <template #default="{ row }"
  560. ><span>{{ row.measure }}</span>
  561. </template>
  562. </el-table-column>
  563. <el-table-column
  564. width="60"
  565. align="center"
  566. prop="remark"
  567. label="备注"
  568. >
  569. <template #default="{ row }"
  570. ><span>{{ row.remark }}</span>
  571. </template>
  572. </el-table-column>
  573. </el-table>
  574. <div class="illustrate">
  575. <div>
  576. 1)Cpx值为表征内引线键合强度一致性的参数,通过相应的软件计算得出,内引线键合强度一致性是否符合要求的判据:Cpk值≥1.33。
  577. </div>
  578. <div>2)“备注”栏填写被测内引线的材料和规格。</div>
  579. </div>
  580. </div>
  581. <Pagination
  582. :total="currentOption.total"
  583. :page="currentOption.page"
  584. :limit="currentOption.limit"
  585. :pageSizes="currentOption.pageSizes"
  586. v-model:page="currentOption.page"
  587. @pagination="getTableData"
  588. />
  589. </div>
  590. <div class="info" v-if="addStatus">
  591. <!-- <el-table
  592. :data="addData"
  593. border
  594. :style="{ height: 120 + 'px', width: maxWidth + 'px' }"
  595. :show-overflow-tooltip="true"
  596. >
  597. <el-table-column
  598. align="center"
  599. width="60"
  600. prop="dateStr"
  601. label="日期"
  602. >
  603. <template #default="{ row }"
  604. >
  605. <el-input-number
  606. v-model="row.accuracy1"
  607. :precision="2"
  608. :step="0.01"
  609. width="60"
  610. />
  611. </template>
  612. </el-table-column>
  613. <el-table-column
  614. align="center"
  615. width="140"
  616. prop="model"
  617. label="产品型号"
  618. >
  619. <template #default="{ row }"
  620. >
  621. <el-input-number
  622. v-model="row.accuracy1"
  623. :precision="2"
  624. :step="0.01"
  625. width="60"
  626. />
  627. </template>
  628. </el-table-column>
  629. <el-table-column
  630. align="center"
  631. width="140"
  632. prop="batchNo"
  633. label="生产批号"
  634. >
  635. <template #default="{ row }"
  636. >
  637. <el-input-number
  638. v-model="row.accuracy1"
  639. :precision="2"
  640. :step="0.01"
  641. width="60"
  642. />
  643. </template>
  644. </el-table-column>
  645. <el-table-column align="center" :label="showLable + '精度'">
  646. <el-table-column
  647. align="center"
  648. prop="accuracy1"
  649. width="180"
  650. label="精度1"
  651. >
  652. <template #default="{ row }"
  653. >
  654. <el-input-number
  655. v-model="row.accuracy1"
  656. :precision="2"
  657. :step="0.01"
  658. width="60"
  659. />
  660. </template>
  661. </el-table-column>
  662. <el-table-column
  663. align="center"
  664. prop="accuracy2"
  665. width="180"
  666. label="精度2"
  667. >
  668. <template #default="{ row }"
  669. >
  670. <el-input-number
  671. v-model="row.accuracy2"
  672. :precision="2"
  673. :step="0.01"
  674. />
  675. </template>
  676. </el-table-column>
  677. <el-table-column
  678. align="center"
  679. prop="accuracy3"
  680. width="180"
  681. label="精度3"
  682. >
  683. <template #default="{ row }"
  684. >
  685. <el-input-number
  686. v-model="row.accuracy3"
  687. :precision="2"
  688. :step="0.01"
  689. />
  690. </template>
  691. </el-table-column>
  692. <el-table-column
  693. align="center"
  694. prop="accuracy4"
  695. width="180"
  696. label="精度4"
  697. >
  698. <template #default="{ row }"
  699. >
  700. <el-input-number
  701. v-model="row.accuracy4"
  702. :precision="2"
  703. :step="0.01"
  704. />
  705. </template>
  706. </el-table-column>
  707. <el-table-column
  708. align="center"
  709. prop="accuracy5"
  710. width="180"
  711. label="精度5"
  712. >
  713. <template #default="{ row }"
  714. >
  715. <el-input-number
  716. v-model="row.accuracy5"
  717. :precision="2"
  718. :step="0.01"
  719. />
  720. </template>
  721. </el-table-column> </el-table-column
  722. ><el-table-column align="center" prop="avg" label="平均值">
  723. <template #default="{ row }"
  724. >
  725. <el-input-number
  726. v-model="row.accuracy1"
  727. :precision="2"
  728. :step="0.01"
  729. width="60"
  730. />
  731. </template> </el-table-column
  732. ><el-table-column align="center" prop="range" label="极差">
  733. <template #default="{ row }"
  734. >
  735. <el-input-number
  736. v-model="row.accuracy1"
  737. :precision="2"
  738. :step="0.01"
  739. width="60"
  740. />
  741. </template> </el-table-column
  742. ><el-table-column align="center" prop="checkUser" label="检测人">
  743. <template #default="{ row }"
  744. >
  745. <el-input-number
  746. v-model="row.accuracy1"
  747. :precision="2"
  748. :step="0.01"
  749. width="60"
  750. />
  751. </template> </el-table-column
  752. ><el-table-column
  753. align="center"
  754. prop="checkDeviceNo"
  755. label="检查设备编号"
  756. >
  757. <template #default="{ row }"
  758. >
  759. <el-input-number
  760. v-model="row.accuracy1"
  761. :precision="2"
  762. :step="0.01"
  763. width="60"
  764. />
  765. </template>
  766. </el-table-column>
  767. <el-table-column align="center" prop="abnormal" label="是否异常">
  768. <template #default="{ row }"
  769. >
  770. <el-input-number
  771. v-model="row.accuracy1"
  772. :precision="2"
  773. :step="0.01"
  774. width="60"
  775. />
  776. </template>
  777. </el-table-column>
  778. <el-table-column align="center" prop="analyseUser" label="分析人">
  779. <template #default="{ row }"
  780. >
  781. <el-input-number
  782. v-model="row.accuracy1"
  783. :precision="2"
  784. :step="0.01"
  785. width="60"
  786. />
  787. </template>
  788. </el-table-column>
  789. <el-table-column align="center" prop="measure" label="处置措施" />
  790. <template #empty>
  791. <div>
  792. <span style="color: green; font-size: 16px"
  793. >请先导入文件</span
  794. >
  795. </div>
  796. </template>
  797. </el-table> -->
  798. <el-scrollbar :style="{ height: Height - 80 + 'px' }">
  799. <el-form
  800. ref="ruleFormRef"
  801. :model="addData"
  802. :rules="rules"
  803. label-width="auto"
  804. class="formStyle"
  805. >
  806. <el-form-item label="日期" prop="dateStr">
  807. <el-date-picker
  808. v-model="addData.dateStr"
  809. type="date"
  810. aria-label="Pick a date"
  811. placeholder="Pick a date"
  812. style="width: 100%"
  813. format="YYYY-MM-DD"
  814. value-format="YYYY-MM-DD"
  815. />
  816. </el-form-item>
  817. <el-form-item label="产品型号" prop="model">
  818. <el-select :disabled="editStatus" v-model="addData.model">
  819. <el-option
  820. v-for="item in modelOptions"
  821. :key="item.dictLabel"
  822. :label="item.dictLabel"
  823. :value="item.dictValue"
  824. />
  825. </el-select>
  826. </el-form-item>
  827. <el-form-item label="生产批号" prop="batchNo">
  828. <el-input v-model="addData.batchNo" />
  829. </el-form-item>
  830. <template v-for="(item, index) in 30" :key="index">
  831. <el-form-item
  832. :label="'数值' + addIndex(index)"
  833. :prop="'accuracy' + addIndex(index)"
  834. :rules="[
  835. {
  836. required: true,
  837. trigger: 'change',
  838. },
  839. ]"
  840. >
  841. <el-input-number
  842. :precision="2"
  843. :step="0.01"
  844. style="width: 100%"
  845. v-model="addData[`accuracy${addIndex(index)}`]"
  846. />
  847. </el-form-item>
  848. </template>
  849. <!-- <el-form-item label="平均值" prop="avg">
  850. <el-input v-model="addData.avg" />
  851. </el-form-item>
  852. <el-form-item label="极差" prop="range">
  853. <el-input v-model="addData.range" />
  854. </el-form-item> -->
  855. <el-form-item label="检测人" prop="checkUser">
  856. <el-input v-model="addData.checkUser" />
  857. </el-form-item>
  858. <el-form-item label="检查设备编号" prop="checkDeviceNo">
  859. <el-input v-model="addData.checkDeviceNo" />
  860. </el-form-item>
  861. <el-form-item label="是否异常" prop="abnormal">
  862. <el-input v-model="addData.abnormal" />
  863. </el-form-item>
  864. <el-form-item label="分析人" prop="analyseUser">
  865. <el-input v-model="addData.analyseUser" />
  866. </el-form-item>
  867. <el-form-item label="处置措施" prop="measure">
  868. <el-input v-model="addData.measure" />
  869. </el-form-item>
  870. <el-form-item label="备注" prop="remark">
  871. <el-input
  872. maxlength="40"
  873. show-word-limit
  874. type="textarea"
  875. v-model="addData.remark"
  876. />
  877. </el-form-item>
  878. </el-form>
  879. </el-scrollbar>
  880. </div>
  881. </div>
  882. <!-- <div class="box" v-show="!addStatus">
  883. <div
  884. style="
  885. display: flex;
  886. align-items: center;
  887. justify-content: space-between;
  888. "
  889. >
  890. <div style="display: flex; align-items: center">
  891. <div class="bg"></div>
  892. 控制图绘制
  893. </div>
  894. <el-button
  895. type="primary"
  896. v-print="'#charts'"
  897. style="margin-left: 10px; height: 25px"
  898. >打 印</el-button
  899. >
  900. </div>
  901. <div class="info">
  902. <div id="charts" :style="{ height: maxHeight / 2 + 'px' }"></div>
  903. <div id="charts1" :style="{ height: maxHeight / 2 + 'px' }"></div>
  904. </div>
  905. </div> -->
  906. </el-scrollbar>
  907. </div>
  908. </div>
  909. </template>
  910. <script setup>
  911. import { useDictionaryStore } from "@/store";
  912. import { getData2, addDatas, deleteData, updateData } from "@/api/analysis";
  913. const tableData = ref([]);
  914. const printStatus = ref(false);
  915. const printLoading = ref(false);
  916. //打印功能
  917. const printFnc = () => {
  918. printLoading.value = true;
  919. printStatus.value = true;
  920. setTimeout(() => {
  921. printStatus.value = false;
  922. printLoading.value = false;
  923. }, 0);
  924. };
  925. const showTableData = ref([]);
  926. const year = ref("0");
  927. //写死存放合并列 行参数【3,0,0,3,0,0...】
  928. const state = reactive({
  929. spanArr: [], // 生成一个与行数相同的数组记录每一行设置的合并数
  930. });
  931. //设置合并列
  932. const objectSpanMethod = ({ row, column, rowIndex, columnIndex }) => {
  933. if (
  934. columnIndex !== 3 &&
  935. columnIndex !== 4 &&
  936. columnIndex !== 5 &&
  937. columnIndex !== 6 &&
  938. columnIndex !== 7 &&
  939. columnIndex !== 8 &&
  940. columnIndex !== 9 &&
  941. columnIndex !== 10 &&
  942. columnIndex !== 11 &&
  943. columnIndex !== 12
  944. ) {
  945. if (state.spanArr[rowIndex]) {
  946. return {
  947. rowspan: 3,
  948. colspan: 1,
  949. };
  950. } else {
  951. return {
  952. rowspan: 0,
  953. colspan: 0,
  954. };
  955. }
  956. } else {
  957. return {
  958. rowspan: 1,
  959. colspan: 1,
  960. };
  961. }
  962. };
  963. //解决动态表格数据视图不更新问题
  964. const filterData = (data) => {
  965. // 合并内容相同的单元格
  966. let spanArr = [];
  967. data.forEach((item, index) => {
  968. spanArr.push(3);
  969. spanArr.push(0);
  970. spanArr.push(0);
  971. });
  972. state.spanArr = spanArr;
  973. };
  974. //分页参数
  975. const currentOption = reactive({
  976. total: 0,
  977. page: 1,
  978. limit: 4,
  979. pageSizes: [4],
  980. });
  981. //设置展示tableData
  982. const setTableData = (array) => {
  983. showTableData.value = [];
  984. //★Index 为实际接口数据Index
  985. array.forEach((item, index) => {
  986. let obj1 = { ...item, Index: index };
  987. let obj2 = { ...item, Index: index };
  988. let obj3 = { ...item, Index: index };
  989. for (let i = 1; i < 11; i++) {
  990. obj2[`accuracy${i}`] = obj2[`accuracy${i + 10}`];
  991. obj3[`accuracy${i}`] = obj3[`accuracy${i + 20}`];
  992. }
  993. showTableData.value.push(obj1);
  994. showTableData.value.push(obj2);
  995. showTableData.value.push(obj3);
  996. });
  997. };
  998. //接口获取实际data
  999. const getTableData = async () => {
  1000. const { data, code, msg } = await getData2({
  1001. pageNo: currentOption.page,
  1002. pageSize: currentOption.limit,
  1003. yearStr: year.value,
  1004. });
  1005. if (code == "200") {
  1006. tableData.value = data.records;
  1007. showData.value = { ...data, list: null };
  1008. setTableData(tableData.value);
  1009. // setChart1();
  1010. // setChart2();
  1011. currentOption.total = data.totalCount;
  1012. currentOption.page = data.pageNo;
  1013. oldDataJSON.value = JSON.stringify(data.records);
  1014. }
  1015. disabled.value = false;
  1016. };
  1017. //编辑状态
  1018. const editStatus = ref(false);
  1019. //新增状态
  1020. const addStatus = ref(false);
  1021. const changeEditstatus = () => {
  1022. editStatus.value = !changeEditstatus.value;
  1023. addStatus.value = false;
  1024. };
  1025. const changeaddstatus = () => {
  1026. addStatus.value = !addStatus.value;
  1027. editStatus.value = false;
  1028. };
  1029. //取消操作
  1030. const canceleOp = () => {
  1031. addStatus.value = false;
  1032. editStatus.value = false;
  1033. reset();
  1034. };
  1035. const Y1value = ref([]);
  1036. const X1array = ref([]);
  1037. const setY1value = () => {
  1038. Y1value.value = [];
  1039. tableData.value.forEach((item) => {
  1040. Y1value.value.push(item.avg);
  1041. });
  1042. Y1value.value.unshift("");
  1043. Y1value.value.push("");
  1044. chartsOption1.value.series[0].data = Y1value.value;
  1045. };
  1046. const setX1array = () => {
  1047. X1array.value = [];
  1048. tableData.value.forEach((item, index) => {
  1049. X1array.value.push(index + 1);
  1050. });
  1051. X1array.value.unshift("");
  1052. X1array.value.push("");
  1053. chartsOption1.value.xAxis[0].data = X1array.value;
  1054. };
  1055. const { dicts } = useDictionaryStore();
  1056. const importStatus = ref(false);
  1057. const disabled = ref(false);
  1058. //Form
  1059. const ruleFormRef = ref(null);
  1060. const addIndex = (index) => {
  1061. return index + 1;
  1062. };
  1063. const rules = {
  1064. dateStr: [
  1065. {
  1066. required: true,
  1067. trigger: "change",
  1068. },
  1069. ],
  1070. model: [
  1071. {
  1072. required: true,
  1073. trigger: "change",
  1074. },
  1075. ],
  1076. batchNo: [
  1077. {
  1078. required: true,
  1079. trigger: "change",
  1080. },
  1081. ],
  1082. checkUser: [
  1083. {
  1084. required: true,
  1085. trigger: "change",
  1086. },
  1087. ],
  1088. checkDeviceNo: [
  1089. {
  1090. required: true,
  1091. trigger: "change",
  1092. },
  1093. ],
  1094. abnormal: [
  1095. {
  1096. required: true,
  1097. trigger: "change",
  1098. },
  1099. ],
  1100. analyseUser: [
  1101. {
  1102. required: true,
  1103. trigger: "change",
  1104. },
  1105. ],
  1106. measure: [
  1107. {
  1108. required: false,
  1109. trigger: "change",
  1110. },
  1111. ],
  1112. };
  1113. const resItem = {
  1114. abnormal: "",
  1115. analyseUser: "",
  1116. avg: 0,
  1117. batchNo: "",
  1118. checkDeviceNo: "",
  1119. checkUser: "",
  1120. dateStr: "",
  1121. measure: "",
  1122. model: "",
  1123. range: 0,
  1124. };
  1125. const addData = ref({
  1126. abnormal: "",
  1127. analyseUser: "",
  1128. avg: 0,
  1129. batchNo: "",
  1130. checkDeviceNo: "",
  1131. checkUser: "",
  1132. dateStr: "",
  1133. measure: "",
  1134. model: "",
  1135. range: 0,
  1136. });
  1137. const oldDataJSON = ref("");
  1138. const showData = ref({});
  1139. const url = ref(import.meta.env.VITE_APP_BASE_API + "/api/v1/spc/import");
  1140. const headers = { Authorization: `${localStorage.getItem("token")}` };
  1141. const opOptions = ref([...dicts.spc_operation]);
  1142. const modelOptions = ref([...dicts.quality_spec_data]);
  1143. const setChart1Info = () => {
  1144. // chartsOption1.value.title[0].text = `上限=${showData.value.avgMax ? showData.value.avgMax : "-"}`;
  1145. // chartsOption1.value.title[0].text = `x̄=${showData.value.avgAvg ? showData.value.avgAvg : "-"}`;
  1146. chartsOption1.value.series[0].markLine.data[0].yAxis = showData.value.avgMax;
  1147. chartsOption1.value.series[0].markLine.data[0].label.formatter = ` 上限=${showData.value.avgMax ? showData.value.avgMax : "0"}`;
  1148. chartsOption1.value.series[0].markLine.data[1].yAxis = showData.value.avgMin
  1149. ? showData.value.avgMin
  1150. : 0;
  1151. chartsOption1.value.series[0].markLine.data[1].label.formatter = ` 下限=${showData.value.avgMin ? showData.value.avgMin : "0"}`;
  1152. chartsOption1.value.series[0].markLine.data[2].yAxis = showData.value.avgAvg;
  1153. chartsOption1.value.series[0].markLine.data[2].label.formatter = `x̄=${showData.value.avgAvg}`;
  1154. // chartsOption1.value.title[2].text = `下限=${showData.value.avgMin ? showData.value.avgMin : "0"}`;
  1155. };
  1156. const setChart2Info = () => {
  1157. // chartsOption2.value.title[0].text = `上限=${showData.value.rangeMax ? showData.value.rangeMax : "-"}`;
  1158. // chartsOption2.value.title[0].text = `R=${showData.value.rangeAvg ? showData.value.rangeAvg : "-"}`;
  1159. chartsOption2.value.series[0].markLine.data[0].yAxis =
  1160. showData.value.rangeMax;
  1161. chartsOption2.value.series[0].markLine.data[0].label.formatter = ` 上限=${showData.value.rangeMax ? showData.value.rangeMax : "0"}`;
  1162. chartsOption2.value.series[0].markLine.data[1].yAxis = showData.value.rangeMin
  1163. ? showData.value.rangeMin
  1164. : 0;
  1165. chartsOption2.value.series[0].markLine.data[1].label.formatter = ` 下限=${showData.value.rangeMin ? showData.value.rangeMin : "0"}`;
  1166. chartsOption2.value.series[0].markLine.data[2].yAxis =
  1167. showData.value.rangeAvg;
  1168. chartsOption2.value.series[0].markLine.data[2].label.formatter = `x̄=${showData.value.rangeAvg}`;
  1169. // chartsOption2.value.title[2].text = `下限=${showData.value.rangeMin ? showData.value.rangeMin : "0"}`;
  1170. };
  1171. const setChart1 = () => {
  1172. setChart1Info();
  1173. setY1value();
  1174. setX1array();
  1175. charts1.value.setOption(chartsOption1.value, true);
  1176. };
  1177. const setChart2 = () => {
  1178. setChart2Info();
  1179. setY2value();
  1180. setX2array();
  1181. charts2.value.setOption(chartsOption2.value, true);
  1182. };
  1183. //修改
  1184. const updataItem = (index) => {
  1185. editStatus.value = true;
  1186. addData.value = tableData.value[index];
  1187. addStatus.value = true;
  1188. };
  1189. //导入按钮
  1190. const onSuccess = (res) => {
  1191. const { code, msg, data } = res;
  1192. if (code != "200") {
  1193. ElMessage.error(msg);
  1194. } else {
  1195. tableData.value = data.list;
  1196. showData.value = { ...data, list: null };
  1197. setChart1();
  1198. setChart2();
  1199. oldDataJSON.value = JSON.stringify(data.list);
  1200. importStatus.value = true;
  1201. ElMessage.success(msg);
  1202. }
  1203. };
  1204. const value = ref(opOptions.value[0].remark);
  1205. const title = ref("调阻精度");
  1206. const showLable = ref("调阻");
  1207. const changeSelect = () => {
  1208. setTimeout(() => {
  1209. showLable.value = selectRef.value.currentPlaceholder;
  1210. switch (showLable.value) {
  1211. case "调阻":
  1212. title.value = "调阻精度";
  1213. break;
  1214. case "粘片":
  1215. title.value = "剪切强度";
  1216. break;
  1217. case "键合":
  1218. title.value = "键合强度";
  1219. break;
  1220. default:
  1221. title.value = "调阻精度";
  1222. break;
  1223. }
  1224. // chartsOption1.value.title[3].text = `${title.value}的Xbar-R控制图`;
  1225. // tableData.value.forEach((item) => {
  1226. // item.accuracy1 = 0;
  1227. // item.accuracy2 = 0;
  1228. // item.accuracy3 = 0;
  1229. // item.accuracy4 = 0;
  1230. // item.accuracy5 = 0;
  1231. // item.avg = 0;
  1232. // item.range = 0;
  1233. // });
  1234. // setChart1();
  1235. // setChart2();
  1236. }, 0);
  1237. };
  1238. // const searchData = computed(() =>
  1239. // tableData.value.filter((item) => item.data.includes(searchValue.value))
  1240. // );
  1241. const selectRef = ref(null);
  1242. //保存
  1243. const changeEdit = async () => {
  1244. if (disabled.value == false) {
  1245. disabled.value = true;
  1246. } else {
  1247. const { data, code, msg } = await getHandleData([...tableData.value]);
  1248. if (code == "200") {
  1249. ElMessage.success(msg);
  1250. tableData.value = data.list;
  1251. showData.value = { ...data, list: null };
  1252. setChart1();
  1253. setChart2();
  1254. oldDataJSON.value = JSON.stringify(data.list);
  1255. }
  1256. disabled.value = false;
  1257. }
  1258. };
  1259. const cancelEdit = () => {
  1260. tableData.value = JSON.parse(oldDataJSON.value);
  1261. disabled.value = false;
  1262. };
  1263. const maxHeight = ref(null);
  1264. const maxWidth = ref(null);
  1265. const charts1 = shallowRef(null);
  1266. const charts2 = shallowRef(null);
  1267. const chartsOption1 = ref({
  1268. title: [
  1269. // {
  1270. // text: `x̄=${showData.value.avgAvg ? showData.value.avgAvg : "-"}`,
  1271. // right: "5%",
  1272. // top: "42%",
  1273. // textStyle: {
  1274. // fontSize: 15,
  1275. // color: "#333",
  1276. // fontWeight: 100,
  1277. // },
  1278. // },
  1279. {
  1280. text: `${title.value}的Xbar-R控制图`,
  1281. left: "40%",
  1282. },
  1283. {
  1284. text: "样",
  1285. left: "4%",
  1286. top: "28%",
  1287. },
  1288. {
  1289. text: "本",
  1290. left: "4%",
  1291. top: "35%",
  1292. },
  1293. {
  1294. text: "均",
  1295. left: "4%",
  1296. top: "42%",
  1297. },
  1298. {
  1299. text: "值",
  1300. left: "4%",
  1301. top: "49%",
  1302. },
  1303. ],
  1304. grid: {
  1305. right: "15%",
  1306. },
  1307. toolbox: {
  1308. feature: {
  1309. saveAsImage: {},
  1310. },
  1311. },
  1312. tooltip: {
  1313. show: true,
  1314. },
  1315. xAxis: [
  1316. {
  1317. type: "category",
  1318. boundaryGap: false,
  1319. data: [],
  1320. },
  1321. ],
  1322. yAxis: [
  1323. {
  1324. type: "value",
  1325. },
  1326. ],
  1327. series: [
  1328. {
  1329. type: "line",
  1330. lineStyle: {
  1331. color: "rgb(26, 122, 240)",
  1332. },
  1333. symbolSize: 13,
  1334. symbol: "circle",
  1335. markLine: {
  1336. silent: true,
  1337. data: [
  1338. {
  1339. silent: false,
  1340. yAxis: 0,
  1341. label: {
  1342. position: "end",
  1343. formatter: `上限=${showData.value.avgMax ? showData.value.avgMax : "-"}`,
  1344. color: "#333",
  1345. },
  1346. lineStyle: { type: "solid", color: "#333", width: 2 },
  1347. },
  1348. {
  1349. silent: false,
  1350. yAxis: 0,
  1351. label: {
  1352. position: "end",
  1353. formatter: `下限=${showData.value.avgMin ? showData.value.avgMin : "-"}`,
  1354. color: "#333",
  1355. },
  1356. lineStyle: {
  1357. type: "solid",
  1358. color: "#333",
  1359. width: 2,
  1360. },
  1361. },
  1362. {
  1363. yAxis: 0,
  1364. silent: false,
  1365. label: {
  1366. position: "end",
  1367. formatter: ``,
  1368. color: "#333",
  1369. },
  1370. lineStyle: {
  1371. type: "solid",
  1372. color: "#333",
  1373. width: 2,
  1374. type: "dashed",
  1375. },
  1376. },
  1377. ],
  1378. },
  1379. },
  1380. ],
  1381. });
  1382. const chartsOption2 = ref({
  1383. title: [
  1384. // {
  1385. // text: `R=${showData.value.rangeAvg ? showData.value.rangeAvg : "-"}`,
  1386. // right: "5%",
  1387. // top: "42%",
  1388. // textStyle: {
  1389. // fontSize: 15,
  1390. // color: "#333",
  1391. // fontWeight: 100,
  1392. // },
  1393. // },
  1394. {
  1395. text: "样",
  1396. left: "4%",
  1397. top: "28%",
  1398. },
  1399. {
  1400. text: "本",
  1401. left: "4%",
  1402. top: "35%",
  1403. },
  1404. {
  1405. text: "极",
  1406. left: "4%",
  1407. top: "42%",
  1408. },
  1409. {
  1410. text: "值",
  1411. left: "4%",
  1412. top: "49%",
  1413. },
  1414. ],
  1415. toolbox: {
  1416. feature: {
  1417. saveAsImage: {},
  1418. },
  1419. },
  1420. grid: {
  1421. right: "15%",
  1422. },
  1423. xAxis: [
  1424. {
  1425. type: "category",
  1426. boundaryGap: false,
  1427. data: [],
  1428. },
  1429. ],
  1430. yAxis: [
  1431. {
  1432. type: "value",
  1433. },
  1434. ],
  1435. tooltip: {
  1436. show: true,
  1437. },
  1438. series: [
  1439. {
  1440. type: "line",
  1441. lineStyle: {
  1442. color: "rgb(26, 122, 240)",
  1443. },
  1444. symbolSize: 13,
  1445. symbol: "circle",
  1446. markLine: {
  1447. silent: true,
  1448. data: [
  1449. {
  1450. silent: false,
  1451. yAxis: 0,
  1452. label: {
  1453. position: "end",
  1454. formatter: `上限=${showData.value.rangeMax ? showData.value.rangeMax : "-"}`,
  1455. color: "#333",
  1456. },
  1457. lineStyle: { type: "solid", color: "#333", width: 2 },
  1458. },
  1459. {
  1460. silent: false,
  1461. yAxis: 0,
  1462. label: {
  1463. position: "end",
  1464. formatter: `下限=${showData.value.rangeMin ? showData.value.rangeMin : "-"}`,
  1465. color: "#333",
  1466. },
  1467. lineStyle: { type: "solid", color: "#333", width: 2 },
  1468. },
  1469. {
  1470. yAxis: 0,
  1471. silent: false,
  1472. label: {
  1473. position: "end",
  1474. formatter: ``,
  1475. color: "#333",
  1476. },
  1477. lineStyle: {
  1478. type: "solid",
  1479. color: "#333",
  1480. width: 2,
  1481. type: "dashed",
  1482. },
  1483. },
  1484. ],
  1485. },
  1486. },
  1487. ],
  1488. });
  1489. const Height = ref(0);
  1490. const setHeight = () => {
  1491. Height.value = document.querySelector(".databox").clientHeight;
  1492. maxHeight.value = document.querySelector(".info").clientHeight;
  1493. maxWidth.value = document.querySelector(".info").clientWidth;
  1494. };
  1495. const Y2value = ref([]);
  1496. const X2array = ref([]);
  1497. const setY2value = () => {
  1498. Y2value.value = [];
  1499. tableData.value.forEach((item) => {
  1500. Y2value.value.push(item.range);
  1501. });
  1502. Y2value.value.unshift("");
  1503. Y2value.value.push("");
  1504. chartsOption2.value.series[0].data = Y2value.value;
  1505. };
  1506. const setX2array = () => {
  1507. X2array.value = [];
  1508. tableData.value.forEach((item, index) => {
  1509. X2array.value.push(index + 1);
  1510. });
  1511. X2array.value.unshift("");
  1512. X2array.value.push("");
  1513. chartsOption2.value.xAxis[0].data = X2array.value;
  1514. };
  1515. //当新增或者编辑的确定操作
  1516. const submit = () => {
  1517. if (editStatus.value == true) {
  1518. updateSubmit();
  1519. } else {
  1520. addSubmit();
  1521. }
  1522. };
  1523. const addSubmit = async () => {
  1524. await ruleFormRef.value.validate(async (valid, fields) => {
  1525. if (valid) {
  1526. const { data, code } = await addDatas({
  1527. ...addData.value,
  1528. yearStr: year.value,
  1529. });
  1530. if (code == "200") {
  1531. ElMessage.success("添加成功!");
  1532. reset();
  1533. getTableData();
  1534. }
  1535. } else {
  1536. ElMessage.error("请检查表单信息");
  1537. }
  1538. });
  1539. };
  1540. const deleteSubmit = async (id) => {
  1541. const { data, code } = await deleteData({
  1542. id,
  1543. });
  1544. if (code == "200") {
  1545. ElMessage.success("删除成功!");
  1546. getTableData();
  1547. }
  1548. };
  1549. const updateSubmit = async () => {
  1550. const { data, code } = await updateData({
  1551. ...addData.value,
  1552. });
  1553. if (code == "200") {
  1554. ElMessage.success("更新成功!");
  1555. reset();
  1556. getTableData();
  1557. }
  1558. };
  1559. const reset = () => {
  1560. addStatus.value = false;
  1561. editStatus.value = false;
  1562. addData.value = { ...resItem };
  1563. currentOption.value = {
  1564. total: 0,
  1565. page: 0,
  1566. limit: 4,
  1567. pageSizes: [4],
  1568. };
  1569. };
  1570. watch(
  1571. () => showTableData.value,
  1572. (newVal, oldVal) => {
  1573. filterData(showTableData.value); // 在监测到tableData有更新后调用filterData
  1574. },
  1575. {
  1576. deep: true,
  1577. }
  1578. );
  1579. onMounted(() => {
  1580. setHeight();
  1581. year.value = new Date().getFullYear() + "";
  1582. getTableData();
  1583. // nextTick(() => {
  1584. // charts1.value = echarts.init(document.getElementById("charts"));
  1585. // charts2.value = echarts.init(document.getElementById("charts1"));
  1586. // charts1.value.setOption(chartsOption1.value, true);
  1587. // charts2.value.setOption(chartsOption2.value, true);
  1588. // });
  1589. });
  1590. </script>
  1591. <style lang="scss" scoped>
  1592. @media print {
  1593. #print {
  1594. margin: 0;
  1595. width: 100%;
  1596. padding-right: 10px;
  1597. }
  1598. .illustrate {
  1599. margin-top: 10px;
  1600. padding-left: 20px;
  1601. }
  1602. .tableTitle {
  1603. margin-bottom: 10px;
  1604. }
  1605. #table1 {
  1606. span {
  1607. font-size: 10px;
  1608. fontweight: 300px;
  1609. color: black;
  1610. line-height: 11px !important;
  1611. }
  1612. :deep(.cell) {
  1613. padding: 0 1px !important;
  1614. font-size: 12px !important;
  1615. line-height: 11px !important;
  1616. }
  1617. :deep(.el-table__cell) {
  1618. padding: 0px !important;
  1619. height: 36px !important;
  1620. margin: 0px !important;
  1621. border: 0.5px solid rgb(0, 0, 0, 1) !important;
  1622. }
  1623. height: 503px !important;
  1624. width: 1030px !important;
  1625. border: 2px solid rgba(0, 0, 0, 1);
  1626. padding: 0px !important;
  1627. }
  1628. #opear {
  1629. display: none;
  1630. }
  1631. .tableTitle {
  1632. display: flex;
  1633. justify-content: space-between;
  1634. alignitems: center;
  1635. }
  1636. }
  1637. .formStyle {
  1638. width: 400px;
  1639. margin: 20px auto;
  1640. padding: 20px 0;
  1641. }
  1642. .container {
  1643. width: 100%;
  1644. height: 100%;
  1645. display: flex;
  1646. background-color: white;
  1647. .infobox {
  1648. width: 200px;
  1649. .header {
  1650. height: 120px;
  1651. border-bottom: 2px solid #00000010;
  1652. padding: 20px;
  1653. }
  1654. .body {
  1655. padding: 20px;
  1656. }
  1657. }
  1658. .databox {
  1659. flex: 1;
  1660. border-left: 2px solid #00000010;
  1661. .box {
  1662. height: 100%;
  1663. padding: 5px 20px;
  1664. display: flex;
  1665. flex-direction: column;
  1666. .illustrate {
  1667. padding: 20px 60px;
  1668. }
  1669. .tableTitle {
  1670. text-align: center;
  1671. margin: 10px 0;
  1672. padding-right: 40px;
  1673. }
  1674. .title {
  1675. height: 30px;
  1676. display: flex;
  1677. align-items: center;
  1678. margin-bottom: 10px;
  1679. justify-content: space-between;
  1680. .btns {
  1681. display: flex;
  1682. align-items: center;
  1683. .btn {
  1684. height: 24px;
  1685. font-size: 14px;
  1686. margin: 0 5px;
  1687. }
  1688. }
  1689. }
  1690. .info {
  1691. flex: 1;
  1692. .tableTitle {
  1693. display: flex;
  1694. justify-content: space-between;
  1695. align-items: center;
  1696. }
  1697. }
  1698. }
  1699. }
  1700. }
  1701. </style>