Xbar-SList.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902
  1. <template>
  2. <div class="container1">
  3. <div class="databox">
  4. <el-scrollbar :style="{ height: Height + 'px' }">
  5. <div class="box">
  6. <div class="title">
  7. <div style="display: flex; align-items: center">
  8. <div class="bg"></div>
  9. 样本数据录入
  10. </div>
  11. <div class="header" v-show="!addStatus && !editStatus">
  12. <Search
  13. :searchOptions="searchForm"
  14. ref="searchRef"
  15. @data-list="getTableData"
  16. @reset-list="reset"
  17. />
  18. </div>
  19. <div class="btns">
  20. <el-upload
  21. v-if="!addStatus && !editStatus"
  22. style="float: left"
  23. :action="uploadUrl"
  24. :on-success="handleSuccess"
  25. :before-upload="beforeUpload"
  26. :limit="1"
  27. accept=".xlsx, .xls"
  28. :show-file-list="false"
  29. ref="uploadRef"
  30. >
  31. <el-button size="small" type="primary">Excel导入</el-button>
  32. </el-upload>
  33. <el-button
  34. v-if="!addStatus && !editStatus"
  35. style="margin-left: 15px"
  36. type="primary"
  37. size="small"
  38. class="btn"
  39. @click="
  40. downloadSPCTemplate(
  41. '/api/v1/spc/downloadTemplate',
  42. '/spc/template/XBarS控制图数据导入模板.xlsx'
  43. )
  44. "
  45. >模板下载</el-button
  46. >
  47. <el-button
  48. style="margin-left: 15px"
  49. v-if="!addStatus && !editStatus"
  50. type="primary"
  51. size="small"
  52. class="btn"
  53. @click="changeaddstatus"
  54. >新增</el-button
  55. >
  56. <el-button
  57. style="margin-left: 15px"
  58. v-if="!addStatus && !editStatus"
  59. type="primary"
  60. size="small"
  61. class="btn"
  62. @click="compute"
  63. >计算</el-button
  64. >
  65. <el-button
  66. v-if="editStatus || addStatus"
  67. type="success"
  68. size="small"
  69. class="btn"
  70. @click="submit"
  71. >确定</el-button
  72. >
  73. <el-button
  74. v-if="editStatus || addStatus"
  75. type="info"
  76. size="small"
  77. class="btn"
  78. @click="canceleOp"
  79. >取消</el-button
  80. >
  81. <el-button
  82. style="margin-left: 15px"
  83. v-if="!addStatus && !editStatus"
  84. type="primary"
  85. size="small"
  86. class="btn"
  87. @click="downloadExceptionData"
  88. >保存异常数据</el-button
  89. >
  90. </div>
  91. </div>
  92. <div class="info" v-if="!addStatus">
  93. <el-table
  94. :data="tableData"
  95. border
  96. :style="{
  97. height: maxHeight - 150 + 'px',
  98. width: maxWidth + 'px',
  99. }"
  100. :show-overflow-tooltip="true"
  101. :row-class-name="tableRowClassName"
  102. >
  103. <el-table-column
  104. align="center"
  105. prop="dateStr"
  106. sortable
  107. label="日期"
  108. >
  109. <template #default="{ row }"
  110. ><span>{{ row.dateStr }}</span>
  111. </template>
  112. </el-table-column>
  113. <el-table-column align="center" prop="model" label="产品型号">
  114. <template #default="{ row }"
  115. ><span>{{ row.model }}</span>
  116. </template>
  117. </el-table-column>
  118. <el-table-column align="center" prop="code" label="产品编号">
  119. <template #default="{ row }"
  120. ><span>{{ row.code }}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column align="center" prop="batchNo" label="生产批号">
  124. <template #default="{ row }"
  125. ><span>{{ row.batchNo }}</span>
  126. </template>
  127. </el-table-column>
  128. <el-table-column align="center" prop="source" label="数据来源">
  129. <template #default="{ row }"
  130. ><span>{{ row.source }}</span>
  131. </template>
  132. </el-table-column>
  133. <el-table-column
  134. align="center"
  135. prop="accuracys"
  136. label="数据"
  137. :show-overflow-tooltip="false"
  138. >
  139. <template #default="{ row }">
  140. <el-tooltip placement="top">
  141. <template #content>
  142. <div v-for="(item, index) in row.accuracys" :key="index">
  143. <span>数值{{ index + 1 }}: {{ item }}</span>
  144. </div>
  145. </template>
  146. <div class="ellipsis-text">
  147. {{ row.accuracys.join(", ") }}
  148. </div>
  149. </el-tooltip>
  150. </template>
  151. </el-table-column>
  152. <!-- <el-table-column
  153. align="center"
  154. prop="avg"
  155. label="平均值"
  156. width="60"
  157. /><el-table-column
  158. align="center"
  159. prop="range"
  160. label="极差"
  161. width="60"
  162. />--><!--<el-table-column
  163. align="center"
  164. prop="checkUser"
  165. label="检测人"
  166. >
  167. <template #default="{ row }"
  168. ><span>{{ row.checkUser }}</span>
  169. </template> </el-table-column
  170. ><el-table-column
  171. align="center"
  172. prop="checkDeviceNo"
  173. label="检查设备编号"
  174. >
  175. <template #default="{ row }"
  176. ><span>{{ row.checkDeviceNo }}</span>
  177. </template>
  178. </el-table-column>-->
  179. <el-table-column align="center" prop="abnormal" label="是否异常">
  180. <template #default="{ row }"
  181. ><span>{{ row.abnormal }}</span>
  182. </template>
  183. </el-table-column>
  184. <el-table-column
  185. align="center"
  186. prop="abnormal1"
  187. label="异常原因"
  188. :show-overflow-tooltip="false"
  189. >
  190. <template #default="{ row }">
  191. <el-tooltip placement="top">
  192. <template #content>
  193. <div
  194. v-for="(item, index) in row.abnormal1.split(',')"
  195. :key="index"
  196. >
  197. <span>{{ item }}</span>
  198. </div>
  199. </template>
  200. <div class="ellipsis-text">
  201. {{ row.abnormal1 }}
  202. </div>
  203. </el-tooltip>
  204. </template>
  205. </el-table-column>
  206. <!-- <el-table-column align="center" prop="analyseUser" label="分析人">
  207. <template #default="{ row }"
  208. ><span>{{ row.analyseUser }}</span>
  209. </template>
  210. </el-table-column>-->
  211. <el-table-column align="center" prop="measure" label="处置措施">
  212. <template #default="{ row }"
  213. ><span>{{ row.measure }}</span>
  214. </template>
  215. </el-table-column>
  216. <el-table-column align="center" width="255" prop="" label="操作">
  217. <template #default="{ row }">
  218. <el-button
  219. v-if="row.source === '自动'"
  220. :type="loadingRows[row.id] ? 'info' : 'primary'"
  221. size="small"
  222. :loading="loadingRows[row.id]"
  223. @click="dataAcquisition(row)"
  224. :disabled="loadingRows[row.id]"
  225. style="height: 25px"
  226. >
  227. {{ loadingRows[row.id] ? "数据采集中..." : "采集数据" }}
  228. </el-button>
  229. <el-button
  230. type="primary"
  231. size="small"
  232. class="btn"
  233. @click="updataItem(row)"
  234. style="height: 25px"
  235. >修改</el-button
  236. >
  237. <el-button
  238. type="info"
  239. size="small"
  240. class="btn"
  241. style="height: 25px"
  242. @click="deleteSubmit(row.id)"
  243. >删除</el-button
  244. >
  245. </template>
  246. </el-table-column>
  247. </el-table>
  248. <Pagination
  249. :total="currentOption.total"
  250. :page="currentOption.page"
  251. :limit="currentOption.limit"
  252. :pageSizes="currentOption.pageSizes"
  253. v-model:page="currentOption.page"
  254. v-model:limit="currentOption.limit"
  255. @pagination="getTableData"
  256. />
  257. </div>
  258. <div class="info" v-else>
  259. <el-form
  260. ref="ruleFormRef"
  261. :model="addData"
  262. :rules="rules"
  263. label-width="auto"
  264. class="formStyle"
  265. >
  266. <el-form-item label="日期" prop="dateStr">
  267. <el-date-picker
  268. v-model="addData.dateStr"
  269. type="date"
  270. aria-label="Pick a date"
  271. placeholder="Pick a date"
  272. style="width: 100%"
  273. format="YYYY-MM-DD"
  274. value-format="YYYY-MM-DD"
  275. />
  276. </el-form-item>
  277. <el-form-item label="任务编号" prop="qualityTaskId">
  278. <el-select
  279. v-model="addData.qualityTaskId"
  280. @change="
  281. (value) => {
  282. taskChange(value);
  283. }
  284. "
  285. >
  286. <el-option
  287. v-for="(item, index) in taskOption"
  288. :key="index"
  289. :label="item.taskCode"
  290. :value="Number(item.id)"
  291. />
  292. </el-select>
  293. </el-form-item>
  294. <el-form-item label="产品型号" prop="model">
  295. <el-input :disabled="true" v-model="addData.model" />
  296. </el-form-item>
  297. <el-form-item label="产品编号" prop="code">
  298. <el-input :disabled="true" v-model="addData.code" />
  299. </el-form-item>
  300. <el-form-item label="数据来源" prop="source">
  301. <el-input :disabled="true" v-model="addData.source" />
  302. </el-form-item>
  303. <el-form-item label="生产批号" prop="batchNo">
  304. <el-input v-model="addData.batchNo" />
  305. </el-form-item>
  306. <el-form-item
  307. v-for="(item, index) in addData.accuracys"
  308. :label="'数值' + (index + 1)"
  309. :key="index"
  310. :rules="[
  311. {
  312. required: true,
  313. trigger: 'change',
  314. },
  315. ]"
  316. >
  317. <el-input-number
  318. :precision="2"
  319. :step="0.01"
  320. style="width: 100%"
  321. v-model="addData.accuracys[index]"
  322. />
  323. </el-form-item>
  324. <!-- <el-form-item label="平均值" prop="avg">
  325. <el-input v-model="addData.avg" />
  326. </el-form-item>
  327. <el-form-item label="极差" prop="range">
  328. <el-input v-model="addData.range" />
  329. </el-form-item> -->
  330. <!-- <el-form-item label="检测人" prop="checkUser">
  331. <el-input v-model="addData.checkUser" />
  332. </el-form-item>
  333. <el-form-item label="检查设备编号" prop="checkDeviceNo">
  334. <el-input v-model="addData.checkDeviceNo" />
  335. </el-form-item>-->
  336. <!-- <el-form-item label="是否异常" prop="abnormal">
  337. <el-input v-model="addData.abnormal" />
  338. </el-form-item> -->
  339. <!-- <el-form-item label="分析人" prop="analyseUser">-->
  340. <!-- <el-input v-model="addData.analyseUser" />-->
  341. <!-- </el-form-item>-->
  342. <el-form-item label="处置措施" prop="measure" v-if="addData.id">
  343. <el-input v-model="addData.measure" />
  344. </el-form-item>
  345. </el-form>
  346. </div>
  347. </div>
  348. </el-scrollbar>
  349. </div>
  350. </div>
  351. </template>
  352. <script setup>
  353. import { ref } from "vue";
  354. import { useDictionaryStore } from "@/store";
  355. import {
  356. getData,
  357. addDatas,
  358. deleteData,
  359. updateData,
  360. getTaskCode,
  361. saveExceptionData,
  362. } from "@/api/analysis";
  363. import Search from "@/components/Search/index.vue";
  364. import { XBarSCompute, collectData } from "@/api/analysis";
  365. import { useCrud } from "@/hooks/userCrud";
  366. import {ElMessage, ElMessageBox} from "element-plus";
  367. const { Utils } = useCrud({
  368. src: "/api/v1/spc/pDownloadTemplate",
  369. });
  370. const { downloadSPCTemplate } = Utils;
  371. const emit = defineEmits([
  372. "tableData",
  373. "update:addStatus",
  374. "update:editStatus",
  375. ]);
  376. // 在你的组件 setup 中
  377. const loadingRows = ref({});
  378. const dataAcquisition = async (row) => {
  379. loadingRows.value = { ...loadingRows.value, [row.id]: true };
  380. try {
  381. // 这里替换为你的实际请求
  382. const { code } = await collectData({
  383. qualitySpcRecordId: row.id,
  384. model: row.model,
  385. batchNo: row.batchNo,
  386. operation: lableValue.value,
  387. });
  388. if (200 == code) {
  389. ElMessage.success("数据采集成功!");
  390. getTableData();
  391. }
  392. } catch (error) {
  393. console.error("数据采集失败:", error);
  394. // 可以在这里添加错误处理,比如显示错误消息
  395. } finally {
  396. loadingRows.value = { ...loadingRows.value, [row.id]: false };
  397. }
  398. };
  399. const compute = async () => {
  400. // 存储提取的 accuracys 数据
  401. const accuracysList = ref([]);
  402. // 提取 accuracys 数据
  403. tableData.value.forEach((v) => {
  404. accuracysList.value.push(v.accuracys);
  405. });
  406. const { data } = await XBarSCompute({
  407. dataList: accuracysList.value,
  408. scale: 4,
  409. });
  410. emit("tableData", data);
  411. };
  412. const tableRowClassName = ({ row }) => {
  413. if (row.abnormal === "是") {
  414. return "warning-row";
  415. }
  416. return "";
  417. };
  418. const { dicts } = useDictionaryStore();
  419. const year = ref("0");
  420. const currentOption = reactive({
  421. total: 0,
  422. page: 1,
  423. limit: 10,
  424. pageSizes: [10, 20, 30, 40, 50],
  425. });
  426. const lableValue = ref("");
  427. const searchRef = ref(null);
  428. const getTaskOption = async () => {
  429. const { data } = await getTaskCode({
  430. operationCode: lableValue.value,
  431. });
  432. taskOption.value = data;
  433. };
  434. const getTableData = async () => {
  435. const { data, code, msg } = await getData({
  436. ...searchRef.value.searchForm,
  437. pageNo: currentOption.page,
  438. pageSize: currentOption.limit,
  439. // yearStr: year.value,
  440. operation: lableValue.value,
  441. });
  442. if (code == "200") {
  443. tableData.value = data.records;
  444. showData.value = { ...data, list: null };
  445. currentOption.total = data.totalCount;
  446. currentOption.page = data.pageNo;
  447. oldDataJSON.value = JSON.stringify(data.records);
  448. }
  449. disabled.value = false;
  450. };
  451. const downloadExceptionData = async () => {
  452. saveExceptionData({
  453. ...searchRef.value.searchForm,
  454. pageNo: currentOption.page,
  455. pageSize: currentOption.limit,
  456. // yearStr: year.value,
  457. operation: lableValue.value,
  458. }).then((response) => {
  459. const fileData = response.data;
  460. // const fileName = decodeURI(
  461. // response.headers["content-disposition"].split(";")[1].split("=")[1]
  462. // );
  463. const fileName = "异常数据.xlsx";
  464. const fileType =
  465. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8";
  466. const blob = new Blob([fileData], { type: fileType });
  467. const downloadUrl = window.URL.createObjectURL(blob);
  468. const downloadLink = document.createElement("a");
  469. downloadLink.href = downloadUrl;
  470. downloadLink.download = fileName;
  471. document.body.appendChild(downloadLink);
  472. downloadLink.click();
  473. document.body.removeChild(downloadLink);
  474. window.URL.revokeObjectURL(downloadUrl);
  475. });
  476. };
  477. const searchForm = [
  478. {
  479. label: "日期",
  480. prop: "createds",
  481. type: "daterange",
  482. },
  483. {
  484. label: "产品型号",
  485. prop: "model",
  486. type: "input",
  487. },
  488. {
  489. label: "生产批号",
  490. prop: "batchNo",
  491. type: "input",
  492. },
  493. ];
  494. //编辑状态
  495. const editStatus = ref(false);
  496. const addStatus = ref(false);
  497. const changeEditstatus = () => {
  498. editStatus.value = !changeEditstatus.value;
  499. addStatus.value = false;
  500. };
  501. const changeaddstatus = () => {
  502. addStatus.value = !addStatus.value;
  503. editStatus.value = false;
  504. emit("update:addStatus", addStatus.value);
  505. };
  506. const canceleOp = () => {
  507. addStatus.value = false;
  508. editStatus.value = false;
  509. emit("update:addStatus", addStatus.value);
  510. emit("update:editStatus", editStatus.value);
  511. reset();
  512. };
  513. const disabled = ref(false);
  514. const tableData = ref([]);
  515. //Form
  516. const ruleFormRef = ref(null);
  517. const rules = {
  518. qualityTaskId: [
  519. {
  520. required: true,
  521. trigger: "change",
  522. },
  523. ],
  524. dateStr: [
  525. {
  526. required: true,
  527. trigger: "change",
  528. },
  529. ],
  530. model: [
  531. {
  532. required: true,
  533. trigger: "change",
  534. },
  535. ],
  536. batchNo: [
  537. {
  538. required: true,
  539. trigger: "change",
  540. },
  541. ],
  542. accuracy1: [
  543. {
  544. required: true,
  545. trigger: "change",
  546. },
  547. ],
  548. accuracy2: [
  549. {
  550. required: true,
  551. trigger: "change",
  552. },
  553. ],
  554. accuracy3: [
  555. {
  556. required: true,
  557. trigger: "change",
  558. },
  559. ],
  560. accuracy4: [
  561. {
  562. required: true,
  563. trigger: "change",
  564. },
  565. ],
  566. accuracy5: [
  567. {
  568. required: true,
  569. trigger: "change",
  570. },
  571. ],
  572. checkUser: [
  573. {
  574. required: true,
  575. trigger: "change",
  576. },
  577. ],
  578. checkDeviceNo: [
  579. {
  580. required: true,
  581. trigger: "change",
  582. },
  583. ],
  584. // abnormal: [
  585. // {
  586. // required: true,
  587. // trigger: "change",
  588. // },
  589. // ],
  590. analyseUser: [
  591. {
  592. required: true,
  593. trigger: "change",
  594. },
  595. ],
  596. measure: [
  597. {
  598. required: false,
  599. trigger: "change",
  600. },
  601. ],
  602. };
  603. const resItem = {
  604. // abnormal: "",
  605. analyseUser: "",
  606. batchNo: "",
  607. checkDeviceNo: "",
  608. checkUser: "",
  609. dateStr: "",
  610. measure: "",
  611. model: "",
  612. };
  613. const addData = ref({
  614. // abnormal: "",
  615. analyseUser: "",
  616. batchNo: "",
  617. checkDeviceNo: "",
  618. checkUser: "",
  619. dateStr: "",
  620. measure: "",
  621. model: "",
  622. });
  623. const accuracysSum = ref(0);
  624. const taskChange = (value) => {
  625. taskOption.value.forEach((item) => {
  626. if (item.id == value) {
  627. addData.value.model = item.prodtModel;
  628. addData.value.code = item.prodtCode;
  629. addData.value.source = item.source;
  630. if (item.source === "手动") {
  631. accuracysSum.value = Number(item.processCount);
  632. addData.value.accuracys = [];
  633. let array = [];
  634. for (let i = 0; i < accuracysSum.value; i++) {
  635. array.push(0);
  636. }
  637. addData.value.accuracys = array;
  638. } else {
  639. addData.value.accuracys = [];
  640. }
  641. }
  642. });
  643. };
  644. const oldDataJSON = ref("");
  645. const showData = ref({});
  646. const opOptions = ref([...dicts.spc_operation]);
  647. //修改
  648. const updataItem = (row) => {
  649. editStatus.value = true;
  650. const data = JSON.parse(JSON.stringify(row));
  651. addData.value = data;
  652. addStatus.value = true;
  653. emit("update:addStatus", addStatus.value);
  654. emit("update:editStatus", editStatus.value);
  655. };
  656. const taskOption = ref([]);
  657. const value = ref(opOptions.value[0].remark);
  658. const showLable = ref("调阻");
  659. const maxHeight = ref(null);
  660. const maxWidth = ref(null);
  661. const Height = ref(0);
  662. const setHeight = () => {
  663. Height.value = document.querySelector(".databox").clientHeight;
  664. maxHeight.value = document.querySelector(".info").clientHeight;
  665. maxWidth.value = document.querySelector(".info").clientWidth;
  666. };
  667. //当新增或者编辑的确定操作
  668. const submit = () => {
  669. if (editStatus.value == true) {
  670. updateSubmit();
  671. } else {
  672. addSubmit();
  673. }
  674. };
  675. const addSubmit = async () => {
  676. await ruleFormRef.value.validate(async (valid, fields) => {
  677. if (valid) {
  678. addData.value.type = "1";
  679. const { data, code } = await addDatas({
  680. ...addData.value,
  681. yearStr: year.value,
  682. operation: lableValue.value,
  683. });
  684. if (code == "200") {
  685. ElMessage.success("添加成功!");
  686. reset();
  687. getTableData();
  688. }
  689. } else {
  690. ElMessage.error("请检查表单信息");
  691. }
  692. });
  693. };
  694. const deleteSubmit = async (id) => {
  695. ElMessageBox.confirm("是否删除所选中数据?", "提示", {
  696. confirmButtonText: "确定",
  697. cancelButtonText: "取消",
  698. type: "warning",
  699. }).then(async () => {
  700. const { data, code } = await deleteData({
  701. id,
  702. });
  703. if (code == "200") {
  704. ElMessage.success("删除成功!");
  705. getTableData();
  706. }
  707. });
  708. };
  709. const updateSubmit = async () => {
  710. addData.value.abnormal = null;
  711. const { data, code } = await updateData({
  712. ...addData.value,
  713. });
  714. if (code == "200") {
  715. ElMessage.success("更新成功!");
  716. reset();
  717. getTableData();
  718. }
  719. };
  720. const reset = () => {
  721. addStatus.value = false;
  722. editStatus.value = false;
  723. emit("update:addStatus", addStatus.value);
  724. emit("update:editStatus", editStatus.value);
  725. addData.value = { ...resItem };
  726. searchRef.value.searchForm = {};
  727. currentOption.value = {
  728. total: 0,
  729. page: 0,
  730. limit: 12,
  731. pageSizes: [12],
  732. operation: value.value,
  733. };
  734. getTableData();
  735. };
  736. const uploadUrl = ref("");
  737. const beforeUpload = (file) => {
  738. const isExcel =
  739. file.type === "application/vnd.ms-excel" ||
  740. file.type ===
  741. "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
  742. if (!isExcel) {
  743. ElMessage.error("只能上传Excel文件!");
  744. }
  745. return isExcel;
  746. };
  747. const uploadRef = ref("uploadRef");
  748. const handleSuccess = (response) => {
  749. if (response.code === "200") {
  750. ElMessage.success("Excel导入成功!");
  751. getTableData();
  752. } else {
  753. ElMessage.error(response.msg);
  754. }
  755. uploadRef.value.clearFiles();
  756. };
  757. onMounted(async () => {
  758. setHeight();
  759. year.value = new Date().getFullYear() + "";
  760. opOptions.value.forEach((item) => {
  761. if (item.dictLabel == showLable.value) {
  762. lableValue.value = item.dictValue;
  763. }
  764. });
  765. await getTaskOption();
  766. // await getTableData();
  767. uploadUrl.value =
  768. import.meta.env.VITE_APP_BASE_API +
  769. "/api/v1/spc/xBarRUpload?type=1&operation=" +
  770. lableValue.value;
  771. });
  772. onBeforeUnmount(() => {});
  773. const init = (data) => {
  774. lableValue.value = data;
  775. getTaskOption();
  776. getTableData();
  777. };
  778. // 暴露 init 方法
  779. defineExpose({
  780. init,
  781. });
  782. </script>
  783. <style lang="scss" scoped>
  784. @media print {
  785. #print {
  786. margin-left: -18%;
  787. }
  788. }
  789. :deep(.el-table .warning-row) {
  790. background-color: rgb(241, 142, 142) !important;
  791. }
  792. .ellipsis-text {
  793. white-space: nowrap; /* 禁止换行 */
  794. overflow: hidden; /* 隐藏超出部分 */
  795. text-overflow: ellipsis; /* 显示省略号 */
  796. width: 100%; /* 宽度占满单元格 */
  797. }
  798. .formStyle {
  799. width: 400px;
  800. margin: 20px auto;
  801. }
  802. .container1 {
  803. width: 100%;
  804. height: 100%;
  805. display: flex;
  806. background-color: white;
  807. .infobox {
  808. width: 200px;
  809. .header {
  810. height: 120px;
  811. border-bottom: 2px solid #00000010;
  812. padding: 20px;
  813. }
  814. .body {
  815. padding: 20px;
  816. }
  817. }
  818. .databox {
  819. flex: 1;
  820. border-left: 2px solid #00000010;
  821. .box {
  822. height: 710px;
  823. padding: 5px 20px;
  824. display: flex;
  825. flex-direction: column;
  826. .illustrate {
  827. padding: 20px 60px;
  828. }
  829. .tableTitle {
  830. text-align: center;
  831. margin: 10px 0;
  832. padding-right: 40px;
  833. }
  834. .header {
  835. margin-top: 20px;
  836. //margin-left: 100px;
  837. display: flex;
  838. width: 100%;
  839. height: auto;
  840. }
  841. //.title {
  842. // height: 50px;
  843. // display: flex;
  844. // align-items: center;
  845. // margin-bottom: 10px;
  846. // justify-content: space-between;
  847. // .btns {
  848. // display: flex;
  849. // align-items: center;
  850. // .btn {
  851. // height: 24px;
  852. // font-size: 14px;
  853. // margin: 0 5px;
  854. // }
  855. // }
  856. //}
  857. .info {
  858. margin-top: 20px;
  859. flex: 1;
  860. height: 300px;
  861. }
  862. }
  863. }
  864. }
  865. </style>