fwposition.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662
  1. <template>
  2. <div class="sample-content">
  3. <div @click="clickBtn" style="cursor: pointer">
  4. <!-- <div>点击视图选择位置</div> -->
  5. <el-input
  6. placeholder="请输入内容"
  7. :value="showValue"
  8. id="valueDom"
  9. ></el-input>
  10. </div>
  11. <!-- 表格組件 -->
  12. <div class="selectArea" v-if="ifshow">
  13. <div @click="close" class="close-content">
  14. <i class="el-icon-close"></i
  15. ><el-button class="closeBtn">关闭视图</el-button>
  16. </div>
  17. <div class="top-content">
  18. <div class="top-title">仓库可视化</div>
  19. <div class="query-content">
  20. <el-form :inline="true" :model="formInline" class="demo-form-inline">
  21. <el-form-item label="仓库名称:">
  22. <el-select
  23. v-model="formInline.cang_ku_ming_chen_value"
  24. placeholder="请选择样品"
  25. >
  26. <el-option
  27. v-for="(item, index) in cangkuOption"
  28. :key="index"
  29. placeholder="区域"
  30. :label="item.cang_ku_ming_chen"
  31. :value="item.cang_ku_ming_chen"
  32. ></el-option>
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item style="margin-left: 50px" label="区域名称:">
  36. <el-select
  37. v-model="formInline.qu_yu_value"
  38. placeholder="请选择区域名称"
  39. >
  40. <el-option
  41. v-for="(item, index) in quyu_arr"
  42. :key="index"
  43. placeholder="区域"
  44. :label="item.qu_yu_"
  45. :value="item.qu_yu_"
  46. ></el-option>
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item>
  50. <button
  51. type="button"
  52. class="el-button el-button--primary el-button--mini"
  53. @click="onSubmits"
  54. >
  55. <i class="ibps-icon-search"></i><span>查询</span>
  56. </button>
  57. </el-form-item>
  58. </el-form>
  59. </div>
  60. </div>
  61. <div class="test-quyu">
  62. <div class="test-list">
  63. <ul class="list-items">
  64. <li
  65. class="list-item quyu-item"
  66. :style="{
  67. background: quyuShow == item.qu_yu_ ? '#FF9900' : '#e5baba',
  68. }"
  69. @click="qu_yu_Event"
  70. v-for="item in quyu_arr"
  71. :key="item.qu_yu_"
  72. >
  73. <div v-if="item.qu_yu_.includes('冰箱')">
  74. {{ item.qu_yu_ | freezerFilters }}({{ item.cun_chu_tiao_jian }})
  75. </div>
  76. <div v-if="!item.qu_yu_.includes('冰箱')">
  77. {{ item.qu_yu_ | freezerFilters }}
  78. </div>
  79. </li>
  80. </ul>
  81. </div>
  82. </div>
  83. <div class="body-content">
  84. <div class="right-view">
  85. <div class="goods-items">
  86. <div
  87. class="show-demo"
  88. v-for="(item, index) in listData"
  89. :key="index"
  90. >
  91. <div>
  92. <div class="goods-level">
  93. <div class="level-dsc">
  94. 第{{ index | indexfilter(listData) }}层
  95. </div>
  96. <div class="goods-list">
  97. <div
  98. v-for="(it, index) in listData[index]"
  99. :key="index"
  100. class="goods-dsc"
  101. :style="{
  102. background: !it.wu_liao_bian_ma_ ? '#67c23a' : '',
  103. }"
  104. @click="closeView(it)"
  105. >
  106. <div class="top-dsc">
  107. <div class="position">
  108. <p>名称:{{ it.wu_pin_ming_chen }}</p>
  109. <p>编码:{{ it.wu_liao_bian_ma_ || "空" }}</p>
  110. <p>位置:{{ it.cun_fang_wei_zhi_ || "空" }}</p>
  111. <p>货号:{{ it.huo_hao_ || "空" }}</p>
  112. </div>
  113. <div class="right-content">
  114. <p>入库批号:{{ it.ru_ku_pi_hao_ || "空" }}</p>
  115. <p>存储条件:{{ it.cun_chu_yao_qiu_ || "空" }}</p>
  116. <p>有效期:{{ it.you_xiao_qi_ || "空" }}</p>
  117. <p>库存量:{{ it.ku_cun_liang_ || "空" }}</p>
  118. </div>
  119. <!-- <div class="condition">{{ it.cun_chu_tiao_jian }}</div> -->
  120. </div>
  121. <div class="bottom-dsc">
  122. <!-- {{ it.wu_pin_ming_cheng | specimenFilters }} -->
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </div>
  128. <!-- <div class="goodshelf-name" v-if="index == 1">
  129. {{ desString }}
  130. </div> -->
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. </template>
  138. <script>
  139. import curdPost from "@/business/platform/form/utils/custom/joinCURD.js";
  140. export default {
  141. data() {
  142. return {
  143. ifshow: false,
  144. showValue: "点击选择位置",
  145. cangkuOption: [],
  146. formInline: {
  147. cang_ku_ming_chen_value: " 次级仓库",
  148. qu_yu_value: "6号冰箱",
  149. huo_jia_value: "",
  150. },
  151. huojiaInfo: {
  152. empty: "",
  153. al: "",
  154. },
  155. listData: [],
  156. desString: "",
  157. warehouseOptions: [],
  158. quyu_arr: [],
  159. huo_jia_arr: [],
  160. // qu_yu_value: "",
  161. desShow: true,
  162. quyuShow: "",
  163. huojiashow: "",
  164. firstLoadActive: "false",
  165. selectActive: "",
  166. cenghao: [],
  167. warehouse: [],
  168. loading: false,
  169. pagination: {},
  170. secondshow: false,
  171. };
  172. },
  173. filters: {
  174. indexfilter: function (value, data) {
  175. if (data[0]) {
  176. return value + 1;
  177. } else {
  178. return value;
  179. }
  180. },
  181. laySlice: function (value) {
  182. return value.split("-")[2];
  183. },
  184. freezerFilters: function (value) {
  185. if (value.includes("冷藏柜")) {
  186. return value.replace("冷藏柜", "冰箱");
  187. } else if (value.includes("冷冻柜")) {
  188. return value.replace("冷冻柜", "冰箱");
  189. } else {
  190. return value;
  191. }
  192. },
  193. specimenFilters: function (value) {
  194. if (value == "" || value == undefined) {
  195. return "未占用";
  196. } else {
  197. return value;
  198. }
  199. },
  200. bian_hao_Filters: function (value) {
  201. if (!value || value == undefined || value == "") {
  202. return "无";
  203. } else {
  204. return value;
  205. }
  206. },
  207. },
  208. mounted() {
  209. this.loadQueryData();
  210. this.firstLoadViewData();
  211. this.firstLoadQuyu("次级仓库");
  212. // let dom = document.getElementsByClassName("el-tooltip__popper");
  213. // console.log(dom, dom[0].innerHTML, "dom");
  214. // dom[0].remove();
  215. },
  216. methods: {
  217. close() {
  218. this.ifshow = !this.ifshow;
  219. },
  220. clickBtn() {
  221. this.ifshow = !this.ifshow;
  222. // let dom = document.getElementsByClassName("el-tooltip__popper");
  223. // if (dom[0]) {
  224. // dom[0].innerHTML = "";
  225. // dom[0].style.background = "white";
  226. // }
  227. },
  228. closeView(value) {
  229. const name = "cunFangWeiZhi"; //其他字段属性
  230. this.$emit("change-data", name, value.cun_fang_wei_zhi_);
  231. const name2 = "cangKuMingCheng"; //其他字段属性
  232. const value2 = this.formInline.cang_ku_ming_chen_value; //字段的值
  233. // this.showValue = value2;
  234. this.$emit("change-data", name2, value2);
  235. this.ifshow = !this.ifshow;
  236. },
  237. firstLoadQuyu(cang_ku) {
  238. let sqlString = `select DISTINCT subStr(wei_zhi_,1,4) as wei_zhi_,cun_chu_tiao_jian,qu_yu_ from t_ck where cang_ku_ming_chen = '${cang_ku}' order by wei_zhi_ asc`;
  239. var this_ = this;
  240. curdPost("sql", sqlString).then((response) => {
  241. this_.quyu_arr = response.variables.data;
  242. this_.quyu_arr.forEach((it) => {
  243. it.wei_zhi_.includes("-")
  244. ? ""
  245. : (it.qu_yu_ = it.qu_yu_ + it.wei_zhi_.slice(3, 4));
  246. });
  247. if (!this.firstLoadActive) {
  248. this_.formInline.qu_yu_value = "";
  249. }
  250. });
  251. },
  252. firstLoadViewData() {
  253. //首次加载视图数据 默认中心仓库 耗材区
  254. this.formInline.cang_ku_ming_chen_value = "次级仓库";
  255. this.formInline.qu_yu_value = "6号冰箱";
  256. this.selectActive = 1;
  257. this.firstLoadActive = true;
  258. this.quyuShow = "6号冰箱";
  259. var sqlString =
  260. "select * from t_mjwlgl where cun_fang_wei_zhi_ like" +
  261. "'%" +
  262. "BX6" +
  263. "%'";
  264. this.queryLoad(sqlString, "BX6");
  265. },
  266. sqlSlice(value, num) {
  267. if (value.includes("冰箱")) {
  268. if (
  269. value.includes("T") ||
  270. value.includes("B") ||
  271. value.includes("L") ||
  272. value.includes("R")
  273. ) {
  274. return "BX" + num + value.slice(4, 5);
  275. } else {
  276. return "BX" + num;
  277. }
  278. } else if (value.includes("货架")) {
  279. return "HJ" + num;
  280. } else if (value.includes("试剂柜")) {
  281. return "SJG" + num;
  282. }
  283. },
  284. loadQueryData() {
  285. //查询选择仓库数据查询
  286. var sqlString = "select distinct cang_ku_ming_chen from t_ck ";
  287. var this_ = this;
  288. curdPost("sql", sqlString).then((response) => {
  289. this_.cangkuOption = response.variables.data;
  290. this_.cangkuOption.forEach((item, index) => {
  291. if (!item) {
  292. this_.cangkuOption.splice(index, 1);
  293. }
  294. });
  295. });
  296. },
  297. onSubmits() {
  298. //头部按钮查询事
  299. this.desShow = false;
  300. let value = this.formInline.qu_yu_value;
  301. let num = value.split("号")[0];
  302. let type = this.sqlSlice(value, num);
  303. var sqlString =
  304. `select * from t_mjwlgl where cun_fang_wei_zhi_ like ` +
  305. "'%" +
  306. type +
  307. "%'";
  308. this.queryLoad(sqlString, type);
  309. this.formInline.qu_yu_value = value;
  310. this.quyuShow = value;
  311. },
  312. queryLoad(sql, py) {
  313. var datas = [];
  314. this.cenghao = [];
  315. const labelsMap = {}; // map存储
  316. let typeData = [];
  317. var sqltype =
  318. `select DISTINCT SUBSTR(wei_zhi_,1,6) as wei_zhi_ from t_ck where wei_zhi_ like ` +
  319. "'%" +
  320. py +
  321. "%'" +
  322. "ORDER BY wei_zhi_ ASC "; //
  323. curdPost("sql", sqltype).then((res) => {
  324. typeData = res.variables.data; //查询该位置具有多少层
  325. curdPost("sql", sql).then((res) => {
  326. //sql 查询该位置在物料管理库存信息的物料
  327. datas = res.variables.data; // 该位置的库存信息
  328. typeData.forEach((item) => {
  329. //组件以货架分层的数据: {1:[],2:[],3:[],4:[],5:[],6}
  330. let num = item.wei_zhi_.split("-")[1];
  331. labelsMap[num] = [];
  332. });
  333. if (datas.length == 0) {
  334. //没有物料存在该位置
  335. for (var prop in labelsMap) {
  336. typeData.forEach((item) => {
  337. //组件以货架分层的数据: {1:[],2:[],3:[],4:[],5:[],6}
  338. let num = item.wei_zhi_.split("-")[1];
  339. if (num == prop) {
  340. labelsMap[prop].push({ cun_fang_wei_zhi_: item.wei_zhi_ });
  341. }
  342. });
  343. }
  344. this.listData = labelsMap;
  345. return;
  346. }
  347. datas.forEach((item) => {
  348. //有物料存在该区域
  349. let props1 = item.cun_fang_wei_zhi_.split("-")[1];
  350. for (var prop in labelsMap) {
  351. if (labelsMap.hasOwnProperty(prop)) {
  352. if (prop == props1) {
  353. labelsMap[prop].push(item);
  354. }
  355. if (prop != props1 && labelsMap[prop].length == 0) {
  356. typeData.forEach((item) => {
  357. //组件以货架分层的数据: {1:[],2:[],3:[],4:[],5:[],6}
  358. let num = item.wei_zhi_.split("-")[1];
  359. if (num == prop) {
  360. labelsMap[prop].push({
  361. cun_fang_wei_zhi_: item.wei_zhi_,
  362. });
  363. labelsMap[prop].push({ zhuangtai: "空" });
  364. }
  365. });
  366. // labelsMap[prop].push({ cun_fang_wei_zhi_: "空" });
  367. }
  368. }
  369. }
  370. });
  371. let newarr = [];
  372. for (var prop in labelsMap) {
  373. if (labelsMap.hasOwnProperty(prop)) {
  374. if (labelsMap[prop].length > 1) {
  375. var item = labelsMap[prop].slice(1);
  376. newarr.push(item);
  377. } else {
  378. newarr.push(labelsMap[prop]);
  379. }
  380. }
  381. }
  382. this.listData = newarr;
  383. });
  384. });
  385. },
  386. qu_yu_Event(e) {
  387. //点击区域事件,加载可视化视图
  388. let value = e.target.innerText;
  389. let num = value.split("号")[0];
  390. let type = this.sqlSlice(value, num);
  391. var sqlString =
  392. `select * from t_mjwlgl where cun_fang_wei_zhi_ like ` +
  393. "'%" +
  394. type +
  395. "%'";
  396. this.queryLoad(sqlString, type);
  397. this.formInline.qu_yu_value = value;
  398. this.quyuShow = value;
  399. },
  400. blackEvent() {
  401. this.desShow = true;
  402. },
  403. },
  404. watch: {
  405. //监控仓库名称变化 触发第一次加载数据
  406. "formInline.cang_ku_ming_chen_value": async function (newdata) {
  407. this.firstLoadQuyu(newdata);
  408. },
  409. "formInline.qu_yu_value": function (newdata) {
  410. this.qu_yu_value = newdata;
  411. this.quyuShow = newdata;
  412. this.firstLoadActive = false;
  413. },
  414. },
  415. };
  416. </script>
  417. <style lang="scss" scoped>
  418. ul {
  419. margin: 0;
  420. }
  421. p {
  422. padding: 0;
  423. margin: 0;
  424. }
  425. .selectArea {
  426. width: 100%;
  427. height: 100%;
  428. overflow: scroll;
  429. position: fixed;
  430. top: 0px;
  431. left: 0px;
  432. bottom: 0px;
  433. right: 0px;
  434. background: white;
  435. z-index: 2147483647 !important;
  436. }
  437. .close-content {
  438. position: absolute;
  439. right: 100px;
  440. top: 50px;
  441. //
  442. background: #f56c6c;
  443. font-size: 16px;
  444. padding: 0px 4px;
  445. border-radius: 5px;
  446. color: #ffffff;
  447. .closeBtn {
  448. background: #f56c6c;
  449. border: none;
  450. padding: 2px;
  451. color: #ffffff;
  452. }
  453. }
  454. .sample-content {
  455. width: 100%;
  456. .top-content {
  457. width: 100%;
  458. .top-title {
  459. text-align: center;
  460. font-weight: bold;
  461. width: 100%;
  462. font-size: 18px;
  463. line-height: 40px;
  464. }
  465. .query-content {
  466. display: flex;
  467. margin-left: 25px;
  468. }
  469. }
  470. .test-quyu,
  471. .huojia {
  472. width: 100%;
  473. .list-items {
  474. display: flex;
  475. cursor: pointer;
  476. .wDTianjian::after {
  477. content: "2-6";
  478. }
  479. .quyu-item {
  480. border: 1px solid #a172ab;
  481. background: #0099cc;
  482. }
  483. .huojia-item {
  484. background: #99ccff;
  485. }
  486. .list-item {
  487. padding: 4px 14px;
  488. height: 30px;
  489. background-color: #cec6a4;
  490. text-align: center;
  491. line-height: 30px;
  492. margin-left: 20px;
  493. margin-bottom: 6px;
  494. /* margin-top: 6px; */
  495. border-radius: 10px;
  496. position: relative;
  497. .tiaojian {
  498. // position: absolute;
  499. // right: 0px;
  500. // top: 0px;
  501. // background-color: #f56c6c;
  502. // border-radius: 10px;
  503. // color: #fff;
  504. // display: inline-block;
  505. // font-size: 12px;
  506. // height: 18px;
  507. // line-height: 18px;
  508. // padding: 0 6px;
  509. // text-align: center;
  510. // white-space: nowrap;
  511. // border: 1px solid #fff;
  512. font-size: 12px;
  513. }
  514. }
  515. }
  516. .cangku-mingchen {
  517. width: 100%;
  518. text-align: left;
  519. margin-left: 50px;
  520. }
  521. }
  522. .body-content {
  523. margin-bottom: 70px;
  524. display: flex;
  525. box-sizing: border-box;
  526. height:50vh;
  527. // overflow-x: hidden;
  528. // overflow-y: scroll;
  529. .black {
  530. position: fixed;
  531. top: 300px;
  532. right: 100px;
  533. width: 100px;
  534. height: 40px;
  535. line-height: 40px;
  536. text-align: center;
  537. background-color: #e6a23c;
  538. z-index: 99;
  539. }
  540. .left-table {
  541. // width: 40%;
  542. ::v-deep .el-table {
  543. width: 40%;
  544. }
  545. }
  546. .right-view {
  547. z-index: 99;
  548. width: 100%;
  549. .goods-items {
  550. width: 100%;
  551. overflow-x: hidden;
  552. border: solid 2px rgb(202, 236, 247);
  553. display: flex;
  554. flex-direction: column-reverse;
  555. .show-demo {
  556. width: 100%;
  557. border-bottom: 1px solid bisque;
  558. margin: 0 auto;
  559. text-align: center;
  560. // overflow-y: scroll;
  561. .goods-level {
  562. display: flex;
  563. position: relative;
  564. margin-bottom: 6px;
  565. }
  566. .level-dsc {
  567. margin-top: 12px;
  568. position: absolute;
  569. bottom: 0;
  570. left: 10px;
  571. }
  572. .goods-list {
  573. display: flex;
  574. // justify-content: flex-start;
  575. flex-wrap: wrap-reverse;
  576. align-content: flex-start;
  577. margin-left: 50px;
  578. margin-right: 15px;
  579. .goods-dsc {
  580. cursor: pointer;
  581. // width: 170px;
  582. // height: 80px;
  583. padding: 6px 12px;
  584. border-radius: 5px;
  585. background: #e6a23c;
  586. margin-left: 12px;
  587. margin-top: 6px;
  588. // background-color: aliceblue;
  589. box-sizing: border-box;
  590. .top-dsc {
  591. display: flex;
  592. justify-content: space-between;
  593. font-size: 12px;
  594. height: 18px;
  595. line-height: 18px;
  596. .position > p {
  597. text-align: left;
  598. // color: #fbe8ff;
  599. }
  600. .right-content > p {
  601. margin-left: 15px;
  602. // color: #fbe8ff;
  603. text-align: left;
  604. }
  605. // .condition {
  606. // // color: #fbe8ff;
  607. // }
  608. }
  609. .bottom-dsc {
  610. width: 100%;
  611. font-size: 18px;
  612. height: 42px;
  613. line-height: 60px;
  614. margin-top: 20px;
  615. // color: #fbe8ff;
  616. }
  617. .goods-demo {
  618. display: block;
  619. width: 70px;
  620. height: 90px;
  621. border: 1px solid rgb(10, 9, 8);
  622. text-align: center;
  623. margin: 0;
  624. }
  625. .goods-code {
  626. text-align: center;
  627. width: 100%;
  628. height: 20px;
  629. line-height: 20px;
  630. }
  631. }
  632. }
  633. .goodshelf-name {
  634. margin-bottom: 49px;
  635. }
  636. .shelf {
  637. width: 100%;
  638. height: 40px;
  639. line-height: 40px;
  640. text-align: center;
  641. }
  642. }
  643. }
  644. }
  645. }
  646. .body-content::-webkit-scrollbar {
  647. display: none; /*隐藏滚动条*/
  648. }
  649. }
  650. ::v-deep .el-tooltip__popper {
  651. display: none;
  652. }
  653. </style>