zhuposition.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656
  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: "1号冰箱",
  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. console.log(value, data);
  176. if (data[0]) {
  177. return value + 1;
  178. } else {
  179. return value;
  180. }
  181. },
  182. laySlice: function (value) {
  183. return value.split("-")[2];
  184. },
  185. freezerFilters: function (value) {
  186. if (value.includes("冷藏柜")) {
  187. return value.replace("冷藏柜", "冰箱");
  188. } else if (value.includes("冷冻柜")) {
  189. return value.replace("冷冻柜", "冰箱");
  190. } else {
  191. return value;
  192. }
  193. },
  194. specimenFilters: function (value) {
  195. if (value == "" || value == undefined) {
  196. return "未占用";
  197. } else {
  198. return value;
  199. }
  200. },
  201. bian_hao_Filters: function (value) {
  202. if (!value || value == undefined || value == "") {
  203. return "无";
  204. } else {
  205. return value;
  206. }
  207. },
  208. },
  209. mounted() {
  210. this.loadQueryData();
  211. this.firstLoadViewData();
  212. this.firstLoadQuyu("主仓库");
  213. },
  214. methods: {
  215. close() {
  216. this.ifshow = !this.ifshow;
  217. },
  218. clickBtn() {
  219. this.ifshow = !this.ifshow;
  220. },
  221. closeView(value) {
  222. let dom = document.getElementById("el-tooltip-2390");
  223. console.log(dom,"dom")
  224. const name = "cunFangWeiZhi"; //其他字段属性
  225. this.$emit("change-data", name, value.cun_fang_wei_zhi_);
  226. const name2 = "cangKuMingCheng"; //其他字段属性
  227. const value2 = this.formInline.cang_ku_ming_chen_value; //字段的值
  228. // this.showValue = value2;
  229. this.$emit("change-data", name2, value2);
  230. this.ifshow = !this.ifshow;
  231. },
  232. firstLoadQuyu(cang_ku) {
  233. 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`;
  234. var this_ = this;
  235. curdPost("sql", sqlString).then((response) => {
  236. this_.quyu_arr = response.variables.data;
  237. console.log(this_.quyu_arr, "sqlqrr");
  238. this_.quyu_arr.forEach((it) => {
  239. it.wei_zhi_.includes("-")
  240. ? ""
  241. : (it.qu_yu_ = it.qu_yu_ + it.wei_zhi_.slice(3, 4));
  242. });
  243. if (!this.firstLoadActive) {
  244. this_.formInline.qu_yu_value = "";
  245. }
  246. });
  247. },
  248. firstLoadViewData() {
  249. //首次加载视图数据 默认中心仓库 耗材区
  250. this.formInline.cang_ku_ming_chen_value = "主仓库";
  251. this.formInline.qu_yu_value = "1号冰箱";
  252. this.selectActive = 1;
  253. this.firstLoadActive = true;
  254. this.quyuShow = "1号冰箱";
  255. var sqlString =
  256. "select * from t_mjwlgl where cun_fang_wei_zhi_ like" +
  257. "'%" +
  258. "BX1T" +
  259. "%'";
  260. this.queryLoad(sqlString, "BX1T");
  261. },
  262. sqlSlice(value, num) {
  263. if (value.includes("冰箱")) {
  264. if (
  265. value.includes("T") ||
  266. value.includes("B") ||
  267. value.includes("L") ||
  268. value.includes("R")
  269. ) {
  270. return "BX" + num + value.slice(4, 5);
  271. } else {
  272. return "BX" + num;
  273. }
  274. } else if (value.includes("货架")) {
  275. return "HJ" + num;
  276. } else if (value.includes("试剂柜")) {
  277. return "SJG" + num;
  278. }
  279. },
  280. loadQueryData() {
  281. //查询选择仓库数据查询
  282. var sqlString = "select distinct cang_ku_ming_chen from t_ck ";
  283. var this_ = this;
  284. curdPost("sql", sqlString).then((response) => {
  285. this_.cangkuOption = response.variables.data;
  286. this_.cangkuOption.forEach((item, index) => {
  287. if (!item) {
  288. this_.cangkuOption.splice(index, 1);
  289. }
  290. });
  291. });
  292. },
  293. onSubmits() {
  294. //头部按钮查询事
  295. this.desShow = false;
  296. let value = this.formInline.qu_yu_value;
  297. let num = value.split("号")[0];
  298. let type = this.sqlSlice(value, num);
  299. console.log(type);
  300. var sqlString =
  301. `select * from t_mjwlgl where cun_fang_wei_zhi_ like ` +
  302. "'%" +
  303. type +
  304. "%'";
  305. console.log(sqlString);
  306. this.queryLoad(sqlString, type);
  307. this.formInline.qu_yu_value = value;
  308. this.quyuShow = value;
  309. },
  310. queryLoad(sql, py) {
  311. var datas = [];
  312. this.cenghao = [];
  313. const labelsMap = {}; // map存储
  314. let typeData = [];
  315. var sqltype =
  316. `select DISTINCT SUBSTR(wei_zhi_,1,6) as wei_zhi_ from t_ck where wei_zhi_ like ` +
  317. "'%" +
  318. py +
  319. "%'" +
  320. "ORDER BY wei_zhi_ ASC "; //
  321. console.log(sqltype, sql, "传进来参数");
  322. curdPost("sql", sqltype).then((res) => {
  323. typeData = res.variables.data; //查询该位置具有多少层
  324. curdPost("sql", sql).then((res) => {
  325. //sql 查询该位置在物料管理库存信息的物料
  326. datas = res.variables.data; // 该位置的库存信息
  327. typeData.forEach((item) => {
  328. //组件以货架分层的数据: {1:[],2:[],3:[],4:[],5:[],6}
  329. let num = item.wei_zhi_.split("-")[1];
  330. labelsMap[num] = [];
  331. });
  332. if (datas.length == 0) {
  333. //没有物料存在该位置
  334. for (var prop in labelsMap) {
  335. typeData.forEach((item) => {
  336. //组件以货架分层的数据: {1:[],2:[],3:[],4:[],5:[],6}
  337. let num = item.wei_zhi_.split("-")[1];
  338. if (num == prop) {
  339. labelsMap[prop].push({ cun_fang_wei_zhi_: item.wei_zhi_ });
  340. }
  341. });
  342. }
  343. this.listData = labelsMap;
  344. return;
  345. }
  346. datas.forEach((item) => {
  347. //有物料存在该区域
  348. let props1 = item.cun_fang_wei_zhi_.split("-")[1];
  349. for (var prop in labelsMap) {
  350. if (labelsMap.hasOwnProperty(prop)) {
  351. if (prop == props1) {
  352. labelsMap[prop].push(item);
  353. }
  354. if (prop != props1 && labelsMap[prop].length == 0) {
  355. typeData.forEach((item) => {
  356. //组件以货架分层的数据: {1:[],2:[],3:[],4:[],5:[],6}
  357. let num = item.wei_zhi_.split("-")[1];
  358. if (num == prop) {
  359. labelsMap[prop].push({
  360. cun_fang_wei_zhi_: item.wei_zhi_,
  361. });
  362. labelsMap[prop].push({ zhuangtai: "空" });
  363. }
  364. });
  365. }
  366. }
  367. }
  368. });
  369. let newarr = [];
  370. for (var prop in labelsMap) {
  371. if (labelsMap.hasOwnProperty(prop)) {
  372. if (labelsMap[prop].length > 1) {
  373. var item =[];
  374. item.push(labelsMap[prop][0]);
  375. newarr.push(item);
  376. } else {
  377. newarr.push(labelsMap[prop]);
  378. }
  379. }
  380. }
  381. this.listData = newarr;
  382. console.log(this.listData, "listData");
  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. console.log(type);
  392. var sqlString =
  393. `select * from t_mjwlgl where cun_fang_wei_zhi_ like ` +
  394. "'%" +
  395. type +
  396. "%'";
  397. console.log(sqlString);
  398. this.queryLoad(sqlString, type);
  399. this.formInline.qu_yu_value = value;
  400. this.quyuShow = value;
  401. },
  402. blackEvent() {
  403. this.desShow = true;
  404. },
  405. },
  406. watch: {
  407. //监控仓库名称变化 触发第一次加载数据
  408. "formInline.cang_ku_ming_chen_value": async function (newdata) {
  409. this.firstLoadQuyu(newdata);
  410. },
  411. "formInline.qu_yu_value": function (newdata) {
  412. this.qu_yu_value = newdata;
  413. this.quyuShow = newdata;
  414. this.firstLoadActive = false;
  415. },
  416. },
  417. };
  418. </script>
  419. <style lang="scss" scoped>
  420. ul {
  421. margin: 0;
  422. }
  423. p {
  424. padding: 0;
  425. margin: 0;
  426. }
  427. .selectArea {
  428. width: 100%;
  429. height: 100%;
  430. overflow: scroll;
  431. position: fixed;
  432. top: 0px;
  433. left: 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: calc(100vh - 240px);
  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. </style>