index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983
  1. <template>
  2. <div class="container1">
  3. <div class="infobox">
  4. <div class="header">
  5. <div>
  6. <div class="text">控制图:</div>
  7. <el-select
  8. v-model="value2"
  9. placeholder="Select"
  10. ref="selectRef2"
  11. @change="changeSelect2"
  12. >
  13. <el-option
  14. v-for="item in sccOptions"
  15. :key="item.value"
  16. :label="item.dictLabel"
  17. :value="item.dictValue"
  18. />
  19. </el-select>
  20. </div>
  21. <!-- <div class="text">
  22. 计量单位:{{ value ? JSON.parse(value).unit : "-" }}
  23. </div>-->
  24. </div>
  25. <div class="body" v-if="value2 === 'Xbar-R' || value2 === 'Xbar-S'">
  26. <div>
  27. <div class="text">工序名称:</div>
  28. <el-select
  29. v-model="value"
  30. placeholder="Select"
  31. ref="selectRef"
  32. @change="changeSelect"
  33. >
  34. <el-option
  35. v-for="item in opOptions"
  36. :key="item.value"
  37. :label="item.dictLabel"
  38. :value="item.remark"
  39. />
  40. </el-select>
  41. <!-- <div class="text" style="margin-top: 20px">-->
  42. <!-- 上限(3σ):{{ value ? JSON.parse(value).ucl : "-" }}-->
  43. <!-- </div>-->
  44. <!-- <div class="text">-->
  45. <!-- 上限子界限(2σ):{{ value ? JSON.parse(value).ucl_c : "-" }}-->
  46. <!-- </div>-->
  47. <!-- <div class="text">-->
  48. <!-- 上限子界限(σ):{{ value ? JSON.parse(value).ucl_b : "-" }}-->
  49. <!-- </div>-->
  50. <!-- <div class="text">-->
  51. <!-- 中心线:{{ value ? JSON.parse(value).cl : "-" }}-->
  52. <!-- </div>-->
  53. <!-- <div class="text">-->
  54. <!-- 下限子界限(σ):{{ value ? JSON.parse(value).lcl_c : "-" }}-->
  55. <!-- </div>-->
  56. <!-- <div class="text">-->
  57. <!-- 下限子界限(2σ):{{ value ? JSON.parse(value).lcl_b : "-" }}-->
  58. <!-- </div>-->
  59. <!-- <div class="text">-->
  60. <!-- 下限(3σ):{{ value ? JSON.parse(value).lcl : "-" }}-->
  61. <!-- </div>-->
  62. <div
  63. class="edit-item"
  64. @dblclick="startEdit('ucl')"
  65. style="margin-top: 20px"
  66. >
  67. <span v-if="!editing.ucl" class="text"
  68. >上限(3σ):{{ displayValue.ucl }}</span
  69. >
  70. <input
  71. v-else
  72. v-model.number="editValue.ucl"
  73. ref="uclInput"
  74. @blur="saveEdit('ucl')"
  75. @keyup.enter="saveEdit('ucl')"
  76. @keyup.escape="cancelEdit1('ucl')"
  77. class="edit-input"
  78. />
  79. </div>
  80. <div class="edit-item" @dblclick="startEdit('ucl_c')">
  81. <span v-if="!editing.ucl_c" class="text"
  82. >上限子界限(2σ):{{ displayValue.ucl_c }}</span
  83. >
  84. <input
  85. v-else
  86. v-model.number="editValue.ucl_c"
  87. ref="ucl_cInput"
  88. @blur="saveEdit('ucl_c')"
  89. @keyup.enter="saveEdit('ucl_c')"
  90. @keyup.escape="cancelEdit1('ucl_c')"
  91. class="edit-input"
  92. />
  93. </div>
  94. <div class="edit-item" @dblclick="startEdit('ucl_b')">
  95. <span v-if="!editing.ucl_b" class="text"
  96. >上限子界限(σ):{{ displayValue.ucl_b }}</span
  97. >
  98. <input
  99. v-else
  100. v-model.number="editValue.ucl_b"
  101. ref="ucl_bInput"
  102. @blur="saveEdit('ucl_b')"
  103. @keyup.enter="saveEdit('ucl_b')"
  104. @keyup.escape="cancelEdit1('ucl_b')"
  105. class="edit-input"
  106. />
  107. </div>
  108. <div class="edit-item" @dblclick="startEdit('cl')">
  109. <span v-if="!editing.cl" class="text"
  110. >中心线:{{ displayValue.cl }}</span
  111. >
  112. <input
  113. v-else
  114. v-model.number="editValue.cl"
  115. ref="clInput"
  116. @blur="saveEdit('cl')"
  117. @keyup.enter="saveEdit('cl')"
  118. @keyup.escape="cancelEdit1('cl')"
  119. class="edit-input"
  120. />
  121. </div>
  122. <div class="edit-item" @dblclick="startEdit('lcl_c')">
  123. <span v-if="!editing.lcl_c" class="text"
  124. >下限子界限(σ):{{ displayValue.lcl_c }}</span
  125. >
  126. <input
  127. v-else
  128. v-model.number="editValue.lcl_c"
  129. ref="lcl_cInput"
  130. @blur="saveEdit('lcl_c')"
  131. @keyup.enter="saveEdit('lcl_c')"
  132. @keyup.escape="cancelEdit1('lcl_c')"
  133. class="edit-input"
  134. />
  135. </div>
  136. <div class="edit-item" @dblclick="startEdit('lcl_b')">
  137. <span v-if="!editing.lcl_b" class="text"
  138. >下限子界限(2σ):{{ displayValue.lcl_b }}</span
  139. >
  140. <input
  141. v-else
  142. v-model.number="editValue.lcl_b"
  143. ref="lcl_bInput"
  144. @blur="saveEdit('lcl_b')"
  145. @keyup.enter="saveEdit('lcl_b')"
  146. @keyup.escape="cancelEdit1('lcl_b')"
  147. class="edit-input"
  148. />
  149. </div>
  150. <div class="edit-item" @dblclick="startEdit('lcl')">
  151. <span v-if="!editing.lcl" class="text"
  152. >下限(3σ):{{ displayValue.lcl }}</span
  153. >
  154. <input
  155. v-else
  156. v-model.number="editValue.lcl"
  157. ref="lclInput"
  158. @blur="saveEdit('lcl')"
  159. @keyup.enter="saveEdit('lcl')"
  160. @keyup.escape="cancelEdit1('lcl')"
  161. class="edit-input"
  162. />
  163. </div>
  164. </div>
  165. </div>
  166. </div>
  167. <div class="databox">
  168. <el-scrollbar :style="{ height: Height + 'px' }">
  169. <div class="box">
  170. <div class="info" v-if="value2 === 'Xbar-R'">
  171. <XbarRList
  172. ref="xbarrListRef"
  173. @table-data="handleDataFromChildXbarR"
  174. v-model:addStatus="addStatus"
  175. v-model:editStatus="editStatus"
  176. />
  177. </div>
  178. <div class="info" v-if="value2 === 'Xbar-S'">
  179. <XbarSList
  180. ref="xbarsListRef"
  181. @table-data="handleDataFromChildXbarS"
  182. v-model:addStatus="addStatus"
  183. v-model:editStatus="editStatus"
  184. />
  185. </div>
  186. <div class="info" v-if="value2 === 'P'">
  187. <PList
  188. ref="pListRef"
  189. @table-data="handleDataFromChildP"
  190. :chart="chart"
  191. />
  192. </div>
  193. <div class="info" v-if="value2 === 'NP'">
  194. <NPList
  195. ref="npListRef"
  196. @table-data="handleDataFromChildNP"
  197. :chart="chart"
  198. />
  199. </div>
  200. <div class="info" v-if="value2 === 'C'">
  201. <CList
  202. ref="cListRef"
  203. @table-data="handleDataFromChildC"
  204. :chart="chart"
  205. />
  206. </div>
  207. <div class="info" v-if="value2 === 'U'">
  208. <UList
  209. ref="uListRef"
  210. @table-data="handleDataFromChildU"
  211. :chart="chart"
  212. />
  213. </div>
  214. <div class="info" v-if="value2 === 'I-MR'">
  215. <IMRList
  216. ref="imrListRef"
  217. @table-data="handleDataFromChildIMR"
  218. :chart="chart"
  219. />
  220. </div>
  221. <div class="info" v-if="value2 === 'EWMA'">
  222. <EWMAList
  223. ref="imrListRef"
  224. @table-data="handleDataFromChildEWMA"
  225. :chart="chart"
  226. />
  227. </div>
  228. </div>
  229. <div class="box" v-show="!addStatus && !editStatus">
  230. <div class="info" v-if="value2 === 'Xbar-R'">
  231. <XbarR ref="xbarRRef" :process="showLable" />
  232. </div>
  233. <div class="info" v-if="value2 === 'Xbar-S'">
  234. <XbarS ref="xbarSRef" :process="showLable" />
  235. </div>
  236. <div class="info" v-if="value2 === 'P'">
  237. <P ref="pRef" :process="showLable" />
  238. </div>
  239. <div class="info" v-if="value2 === 'NP'">
  240. <NP ref="npRef" :process="showLable" />
  241. </div>
  242. <div class="info" v-if="value2 === 'C'">
  243. <C ref="cRef" :process="showLable" />
  244. </div>
  245. <div class="info" v-if="value2 === 'U'">
  246. <U ref="uRef" :process="showLable" />
  247. </div>
  248. <div class="info" v-if="value2 === 'I-MR'">
  249. <IMR ref="iMRRef" :process="showLable" />
  250. </div>
  251. <div class="info" v-if="value2 === 'EWMA'">
  252. <EWMA ref="eWMARef" :process="showLable" />
  253. </div>
  254. </div>
  255. </el-scrollbar>
  256. </div>
  257. </div>
  258. </template>
  259. <script setup>
  260. import { ref } from "vue";
  261. import XbarRList from "./Xbar-RList.vue";
  262. import XbarSList from "./Xbar-SList.vue";
  263. import PList from "./PList.vue";
  264. import NPList from "./NPList.vue";
  265. import CList from "./CList.vue";
  266. import UList from "./UList.vue";
  267. import IMRList from "./I-MRList.vue";
  268. import EWMAList from "./EWMAList.vue";
  269. import { useDictionaryStore } from "@/store";
  270. import XbarR from "@/views/analysis/process/Xbar-R-2.vue";
  271. import NP from "@/views/analysis/process/NP.vue";
  272. import C from "@/views/analysis/process/C.vue";
  273. import XbarS from "@/views/analysis/process/Xbar-S-2.vue";
  274. import P from "@/views/analysis/process/P.vue";
  275. import EWMA from "@/views/analysis/process/EWMA.vue";
  276. import IMR from "@/views/analysis/process/I-MR.vue";
  277. import U from "@/views/analysis/process/U.vue";
  278. import { getDictList, updateDict } from "@/api/dict";
  279. const operationList = ref();
  280. const initOpOptions = () => {
  281. getDictList({ dictCode: "spc_operation" }).then(({ data }) => {
  282. operationList.value = data;
  283. opOptions.value = data;
  284. });
  285. };
  286. initOpOptions();
  287. // 初始值
  288. let initialValue = ref({
  289. ucl: 0,
  290. ucl_c: 0,
  291. ucl_b: 0,
  292. cl: 0,
  293. lcl_c: 0,
  294. lcl_b: 0,
  295. lcl: 0,
  296. });
  297. // 显示的值
  298. const displayValue = ref(reactive({ ...initialValue.value }));
  299. // 编辑状态
  300. const editing = reactive({
  301. ucl: false,
  302. ucl_c: false,
  303. ucl_b: false,
  304. cl: false,
  305. lcl_c: false,
  306. lcl_b: false,
  307. lcl: false,
  308. });
  309. // 编辑时的临时值
  310. const editValue = reactive({ ...initialValue.value });
  311. // 输入框引用
  312. const uclInput = ref(null);
  313. const ucl_cInput = ref(null);
  314. const ucl_bInput = ref(null);
  315. const clInput = ref(null);
  316. const lcl_cInput = ref(null);
  317. const lcl_bInput = ref(null);
  318. const lclInput = ref(null);
  319. // 开始编辑
  320. const startEdit = (field) => {
  321. editing[field] = true;
  322. editValue[field] = displayValue.value[field];
  323. nextTick(() => {
  324. let inputRef = null;
  325. switch (field) {
  326. case "ucl":
  327. inputRef = uclInput.value;
  328. break;
  329. case "ucl_c":
  330. inputRef = ucl_cInput.value;
  331. break;
  332. case "ucl_b":
  333. inputRef = ucl_bInput.value;
  334. break;
  335. case "cl":
  336. inputRef = clInput.value;
  337. break;
  338. case "lcl_c":
  339. inputRef = lcl_cInput.value;
  340. break;
  341. case "lcl_b":
  342. inputRef = lcl_bInput.value;
  343. break;
  344. case "lcl":
  345. inputRef = lclInput.value;
  346. break;
  347. }
  348. inputRef?.focus();
  349. inputRef?.select();
  350. });
  351. };
  352. // 保存编辑
  353. const saveEdit = (field) => {
  354. editing[field] = false;
  355. displayValue.value[field] = editValue[field];
  356. console.log(`保存${field}值:`, displayValue.value[field]);
  357. operationList.value.forEach((v) => {
  358. if (v.dictLabel === showLable.value) {
  359. v.remark = JSON.stringify(displayValue.value);
  360. updateDict(v);
  361. value.value = JSON.stringify(displayValue.value);
  362. }
  363. });
  364. };
  365. // 取消编辑
  366. const cancelEdit1 = (field) => {
  367. editing[field] = false;
  368. };
  369. const handleDataFromChildXbarR = async (data) => {
  370. await nextTick();
  371. xbarRRefMethod(data);
  372. };
  373. const handleDataFromChildXbarS = async (data) => {
  374. await nextTick();
  375. xbarSRefMethod(data);
  376. };
  377. const handleDataFromChildEWMA = async (data) => {
  378. await nextTick();
  379. eWMARefMethod(data);
  380. };
  381. const handleDataFromChildIMR = async (data) => {
  382. await nextTick();
  383. imrRefMethod(data);
  384. };
  385. const handleDataFromChildU = async (data) => {
  386. await nextTick();
  387. uRefMethod(data);
  388. };
  389. const handleDataFromChildC = async (data) => {
  390. await nextTick();
  391. cRefMethod(data);
  392. };
  393. const handleDataFromChildNP = async (data) => {
  394. await nextTick();
  395. npRefMethod(data);
  396. };
  397. const handleDataFromChildP = async (data) => {
  398. await nextTick();
  399. pRefMethod(data);
  400. };
  401. const xbarRRef = ref("xbarRRef");
  402. const xbarRRefMethod = async (data) => {
  403. await nextTick(() => {
  404. if (xbarRRef.value) {
  405. xbarRRef.value.init(data);
  406. }
  407. });
  408. };
  409. const xbarSRef = ref("xbarSRef");
  410. const xbarSRefMethod = async (data) => {
  411. await nextTick();
  412. if (xbarSRef.value) {
  413. xbarSRef.value.init(data);
  414. }
  415. };
  416. const pRef = ref("pRef");
  417. const pRefMethod = async (data) => {
  418. await nextTick();
  419. if (pRef.value) {
  420. pRef.value.init(data);
  421. }
  422. };
  423. const npRef = ref("npRef");
  424. const npRefMethod = async (data) => {
  425. await nextTick();
  426. if (npRef.value) {
  427. npRef.value.init(data);
  428. }
  429. };
  430. const cRef = ref("cRef");
  431. const cRefMethod = async (data) => {
  432. await nextTick();
  433. if (cRef.value) {
  434. cRef.value.init(data);
  435. }
  436. };
  437. const uRef = ref("uRef");
  438. const uRefMethod = async (data) => {
  439. await nextTick();
  440. if (uRef.value) {
  441. uRef.value.init(data);
  442. }
  443. };
  444. const iMRRef = ref("iMRRef");
  445. const imrRefMethod = async (data) => {
  446. await nextTick();
  447. if (iMRRef.value) {
  448. iMRRef.value.init(data);
  449. }
  450. };
  451. const eWMARef = ref("EWMA");
  452. const eWMARefMethod = async (data) => {
  453. await nextTick();
  454. if (eWMARef.value) {
  455. eWMARef.value.init(data);
  456. }
  457. };
  458. const year = ref("0");
  459. const lableValue = ref("");
  460. const { dicts } = useDictionaryStore();
  461. const sccOptions = ref([...dicts.spc_control_chart]);
  462. const value2 = ref(sccOptions.value[0].dictValue);
  463. //编辑状态
  464. const editStatus = ref(false);
  465. const addStatus = ref(false);
  466. const changeEditstatus = () => {
  467. editStatus.value = !changeEditstatus.value;
  468. addStatus.value = false;
  469. };
  470. const tableData = ref([]);
  471. const opOptions = ref([...dicts.spc_operation]);
  472. const value = ref(opOptions.value[0].remark);
  473. const title = ref("调阻精度");
  474. const xbarrListRef = ref("xbarrListRef");
  475. const xbarsListRef = ref("xbarsListRef");
  476. const showLable = ref("调阻");
  477. const changeSelect = () => {
  478. setTimeout(() => {
  479. displayValue.value = JSON.parse(value.value);
  480. showLable.value = selectRef.value.currentPlaceholder;
  481. opOptions.value.forEach((item) => {
  482. if (item.dictLabel == showLable.value) {
  483. lableValue.value = item.dictValue;
  484. }
  485. });
  486. switch (showLable.value) {
  487. case "调阻":
  488. title.value = "调阻精度";
  489. break;
  490. case "粘片":
  491. title.value = "剪切强度";
  492. break;
  493. case "键合":
  494. title.value = "键合强度";
  495. break;
  496. default:
  497. title.value = "调阻精度";
  498. break;
  499. }
  500. chartsOption1.value.title[0].text = `${title.value}的Xbar-R控制图`;
  501. if (value2.value === "Xbar-R") {
  502. xbarrListRef.value.init(lableValue.value);
  503. } else if (value2.value === "Xbar-S") {
  504. xbarsListRef.value.init(lableValue.value);
  505. }
  506. }, 0);
  507. };
  508. const changeSelect2 = () => {
  509. setTimeout(() => {
  510. if (value2.value === "Xbar-R") {
  511. xbarRRefMethod();
  512. xbarrListRef.value.init(lableValue.value);
  513. } else if (value2.value === "Xbar-S") {
  514. xbarSRefMethod();
  515. console.log(lableValue.value, "2200")
  516. xbarsListRef.value.init(lableValue.value);
  517. } else if (value2.value === "P") {
  518. pRefMethod();
  519. } else if (value2.value === "NP") {
  520. npRefMethod();
  521. } else if (value2.value === "C") {
  522. cRefMethod();
  523. } else if (value2.value === "U") {
  524. uRefMethod();
  525. } else if (value2.value === "I-MR") {
  526. imrRefMethod();
  527. } else if (value2.value === "EWMA") {
  528. eWMARefMethod();
  529. }
  530. }, 0);
  531. };
  532. // const searchData = computed(() =>
  533. // tableData.value.filter((item) => item.data.includes(searchValue.value))
  534. // );
  535. const selectRef = ref(null);
  536. //保存
  537. const maxHeight = ref(null);
  538. const maxWidth = ref(null);
  539. const charts1 = shallowRef(null);
  540. const charts2 = shallowRef(null);
  541. const chartsOption1 = ref({
  542. title: [
  543. // {
  544. // text: `x̄=${showData.value.avgAvg ? showData.value.avgAvg : "-"}`,
  545. // right: "5%",
  546. // top: "42%",
  547. // textStyle: {
  548. // fontSize: 15,
  549. // color: "#333",
  550. // fontWeight: 100,
  551. // },
  552. // },
  553. {
  554. text: `${title.value}的Xbar-R控制图`,
  555. left: "40%",
  556. },
  557. {
  558. text: "样",
  559. left: "4%",
  560. top: "28%",
  561. },
  562. {
  563. text: "本",
  564. left: "4%",
  565. top: "35%",
  566. },
  567. {
  568. text: "均",
  569. left: "4%",
  570. top: "42%",
  571. },
  572. {
  573. text: "值",
  574. left: "4%",
  575. top: "49%",
  576. },
  577. ],
  578. grid: {
  579. right: "15%",
  580. },
  581. toolbox: {
  582. feature: {
  583. saveAsImage: {},
  584. },
  585. },
  586. tooltip: {
  587. show: true,
  588. },
  589. xAxis: [
  590. {
  591. type: "category",
  592. boundaryGap: false,
  593. data: [],
  594. },
  595. ],
  596. yAxis: [
  597. {
  598. type: "value",
  599. },
  600. ],
  601. series: [
  602. {
  603. type: "line",
  604. lineStyle: {
  605. color: "rgb(26, 122, 240)",
  606. },
  607. symbolSize: 13,
  608. symbol: "circle",
  609. itemStyle: {
  610. color: (params) => {
  611. const avg = JSON.parse(value.value);
  612. const paramValue = Number(params.value);
  613. if (
  614. paramValue <= Number(avg.avgMax) &&
  615. paramValue >= Number(avg.avgMin)
  616. ) {
  617. return "rgb(26, 122, 240)";
  618. } else {
  619. return "red";
  620. }
  621. },
  622. },
  623. markLine: {
  624. silent: true,
  625. data: [
  626. {
  627. silent: false,
  628. yAxis: 0,
  629. label: {
  630. position: "end",
  631. formatter: `上限=${JSON.parse(value.value).avgMax ? JSON.parse(value.value).avgMax : "-"}`,
  632. color: "#333",
  633. },
  634. lineStyle: { type: "solid", color: "#333", width: 2 },
  635. },
  636. {
  637. silent: false,
  638. yAxis: 0,
  639. label: {
  640. position: "end",
  641. formatter: `下限=${JSON.parse(value.value).avgMin ? JSON.parse(value.value).avgMin : "-"}`,
  642. color: "#333",
  643. },
  644. lineStyle: {
  645. type: "solid",
  646. color: "#333",
  647. width: 2,
  648. },
  649. },
  650. {
  651. yAxis: 0,
  652. silent: false,
  653. label: {
  654. position: "end",
  655. formatter: ``,
  656. color: "#333",
  657. },
  658. lineStyle: {
  659. type: "solid",
  660. color: "#333",
  661. width: 2,
  662. },
  663. },
  664. ],
  665. },
  666. },
  667. ],
  668. });
  669. const chartsOption2 = ref({
  670. title: [
  671. // {
  672. // text: `R=${showData.value.rangeAvg ? showData.value.rangeAvg : "-"}`,
  673. // right: "5%",
  674. // top: "42%",
  675. // textStyle: {
  676. // fontSize: 15,
  677. // color: "#333",
  678. // fontWeight: 100,
  679. // },
  680. // },
  681. {
  682. text: "样",
  683. left: "4%",
  684. top: "28%",
  685. },
  686. {
  687. text: "本",
  688. left: "4%",
  689. top: "35%",
  690. },
  691. {
  692. text: "极",
  693. left: "4%",
  694. top: "42%",
  695. },
  696. {
  697. text: "值",
  698. left: "4%",
  699. top: "49%",
  700. },
  701. ],
  702. toolbox: {
  703. feature: {
  704. saveAsImage: {},
  705. },
  706. },
  707. grid: {
  708. right: "15%",
  709. },
  710. xAxis: [
  711. {
  712. type: "category",
  713. boundaryGap: false,
  714. data: [],
  715. },
  716. ],
  717. yAxis: [
  718. {
  719. type: "value",
  720. },
  721. ],
  722. tooltip: {
  723. show: true,
  724. },
  725. series: [
  726. {
  727. type: "line",
  728. lineStyle: {
  729. color: "rgb(26, 122, 240)",
  730. },
  731. symbolSize: 13,
  732. symbol: "circle",
  733. itemStyle: {
  734. color: (params) => {
  735. const range = JSON.parse(value.value);
  736. const paramValue = Number(params.value);
  737. if (
  738. paramValue <= Number(range.rangeMax) &&
  739. paramValue >= Number(range.rangeMin)
  740. ) {
  741. return "rgb(26, 122, 240)";
  742. } else {
  743. return "red";
  744. }
  745. },
  746. },
  747. markLine: {
  748. silent: true,
  749. data: [
  750. {
  751. silent: false,
  752. yAxis: 0,
  753. label: {
  754. position: "end",
  755. formatter: `上限=${JSON.parse(value.value).rangeMax ? JSON.parse(value.value).rangeMax : "-"}`,
  756. color: "#333",
  757. },
  758. lineStyle: { type: "solid", color: "#333", width: 2 },
  759. },
  760. {
  761. silent: false,
  762. yAxis: 0,
  763. label: {
  764. position: "end",
  765. formatter: `下限=${JSON.parse(value.value).rangeMin ? JSON.parse(value.value).rangeMin : "-"}`,
  766. color: "#333",
  767. },
  768. lineStyle: { type: "solid", color: "#333", width: 2 },
  769. },
  770. {
  771. yAxis: 0,
  772. silent: false,
  773. label: {
  774. position: "end",
  775. formatter: ``,
  776. color: "#333",
  777. },
  778. lineStyle: {
  779. type: "solid",
  780. color: "#333",
  781. width: 2,
  782. },
  783. },
  784. ],
  785. },
  786. },
  787. ],
  788. });
  789. const Height = ref(0);
  790. const setHeight = () => {
  791. Height.value = document.querySelector(".databox").clientHeight;
  792. maxHeight.value = document.querySelector(".info").clientHeight;
  793. maxWidth.value = document.querySelector(".info").clientWidth;
  794. };
  795. const Y2value = ref([]);
  796. const X2array = ref([]);
  797. const setY2value = () => {
  798. Y2value.value = [];
  799. tableData.value.forEach((item) => {
  800. Y2value.value.push(item.range);
  801. });
  802. Y2value.value.unshift("");
  803. Y2value.value.push("");
  804. chartsOption2.value.series[0].data = Y2value.value;
  805. };
  806. const setX2array = () => {
  807. X2array.value = [];
  808. tableData.value.forEach((item, index) => {
  809. X2array.value.push(index + 1);
  810. });
  811. X2array.value.unshift("");
  812. X2array.value.push("");
  813. chartsOption2.value.xAxis[0].data = X2array.value;
  814. };
  815. // 父组件的数据
  816. const chart = ref(value2);
  817. onMounted(async () => {
  818. setHeight();
  819. year.value = new Date().getFullYear() + "";
  820. opOptions.value.forEach((item) => {
  821. if (item.dictLabel == showLable.value) {
  822. lableValue.value = item.dictValue;
  823. }
  824. });
  825. value2.value = "Xbar-R";
  826. xbarrListRef.value.init(lableValue.value);
  827. displayValue.value = JSON.parse(value.value);
  828. });
  829. onBeforeUnmount(() => {
  830. // window.removeEventListener("resize", setView);
  831. });
  832. </script>
  833. <style lang="scss" scoped>
  834. @media print {
  835. #print {
  836. margin-left: -18%;
  837. }
  838. }
  839. .ctext {
  840. margin-bottom: 20px;
  841. }
  842. .double-edit-container {
  843. display: flex;
  844. flex-direction: column;
  845. gap: 8px;
  846. }
  847. .edit-item {
  848. padding: 8px 0px;
  849. border-radius: 4px;
  850. cursor: pointer;
  851. transition: background-color 0.2s;
  852. font-size: 15px;
  853. }
  854. .edit-item:hover {
  855. background-color: #f5f5f5;
  856. }
  857. .edit-input {
  858. width: 100px;
  859. padding: 4px 8px;
  860. border: 1px solid #dcdfe6;
  861. border-radius: 4px;
  862. outline: none;
  863. }
  864. .edit-input:focus {
  865. border-color: #409eff;
  866. }
  867. .ellipsis-text {
  868. white-space: nowrap; /* 禁止换行 */
  869. overflow: hidden; /* 隐藏超出部分 */
  870. text-overflow: ellipsis; /* 显示省略号 */
  871. width: 100%; /* 宽度占满单元格 */
  872. }
  873. .formStyle {
  874. width: 400px;
  875. margin: 20px auto;
  876. }
  877. .container1 {
  878. width: 100%;
  879. height: 100%;
  880. display: flex;
  881. background-color: white;
  882. .infobox {
  883. width: 250px;
  884. .header {
  885. //height: 120px;
  886. //border-bottom: 2px solid #00000010;
  887. padding: 20px;
  888. }
  889. .body {
  890. border-top: 2px solid #00000010;
  891. padding: 20px;
  892. }
  893. }
  894. .databox {
  895. flex: 1;
  896. border-left: 2px solid #00000010;
  897. .box {
  898. height: 810px;
  899. padding: 5px 20px;
  900. display: flex;
  901. flex-direction: column;
  902. .illustrate {
  903. padding: 20px 60px;
  904. }
  905. .tableTitle {
  906. text-align: center;
  907. margin: 10px 0;
  908. padding-right: 40px;
  909. }
  910. .header {
  911. margin-top: 20px;
  912. //margin-left: 100px;
  913. display: flex;
  914. width: 100%;
  915. height: auto;
  916. }
  917. //.title {
  918. // height: 50px;
  919. // display: flex;
  920. // align-items: center;
  921. // margin-bottom: 10px;
  922. // justify-content: space-between;
  923. // .btns {
  924. // display: flex;
  925. // align-items: center;
  926. // .btn {
  927. // height: 24px;
  928. // font-size: 14px;
  929. // margin: 0 5px;
  930. // }
  931. // }
  932. //}
  933. .info {
  934. margin-top: 20px;
  935. flex: 1;
  936. height: 300px;
  937. }
  938. }
  939. }
  940. }
  941. </style>