weizhiData.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <template>
  2. <div class="sample-content">
  3. <!-- 表格組件 -->
  4. <div class="selectPo" @dblclick="positionBtn">
  5. <el-input type="text" v-model="placeValue" clearable></el-input>
  6. <input type="text" v-model="value" style="opacity: 0; position: fixed" />
  7. </div>
  8. <div class="viewArea" v-if="viewShow">
  9. <h2 class="title">样品间样品存放位置可视图</h2>
  10. <div class="close" @click="positionBtn"><i class="el-icon-circle-close"></i></div>
  11. <div class="select_quyu" v-if="viewShow">
  12. <div class="test-quyu" v-if="leixingcare">
  13. <div class="test-list">
  14. <ul class="list-items">
  15. <li
  16. class="list-item quyu-item"
  17. :style="{
  18. background: quyuShow == item.qu_yu_ ? '#FF9900' : '#0099CC',
  19. }"
  20. @click="qu_yu_Event"
  21. v-for="item in quyu_arr"
  22. :key="item.qu_yu_"
  23. >
  24. {{ item.qu_yu_ }}
  25. </li>
  26. </ul>
  27. </div>
  28. </div>
  29. <div class="huojia">
  30. <div class="test-list">
  31. <ul class="list-items">
  32. <li
  33. class="list-item huojia-item"
  34. :style="{
  35. background:
  36. huojiashow ==
  37. item.huo_jia_hao_ + '号' + item.huo_jia_lei_xing_
  38. ? '#ff9900'
  39. : '#0099cc',
  40. }"
  41. @click="huo_jia_hao_Event"
  42. v-for="(item, index) in huo_jia_arr"
  43. :key="index"
  44. >
  45. {{ item.huo_jia_hao_ }}号{{ item.huo_jia_lei_xing_ }}
  46. </li>
  47. </ul>
  48. </div>
  49. </div>
  50. <div class="huojia">
  51. <div class="test-list" v-show="!leixingcare">
  52. <ul class="list-items">
  53. <li
  54. class="list-item huojia-item"
  55. :style="{
  56. background:
  57. guajiashow == item.gua_jia_hao_ + '号挂件'
  58. ? '#FF9900'
  59. : '#e5baba',
  60. }"
  61. @click="gua_jia_Event"
  62. v-for="(item, index) in gua_jia_arr"
  63. :key="index"
  64. >
  65. {{ item.gua_jia_hao_ }}号挂件
  66. </li>
  67. </ul>
  68. </div>
  69. </div>
  70. </div>
  71. <div class="body-content" v-if="viewShow" v-loading="loading">
  72. <div class="right-view">
  73. <div class="goods-items">
  74. <div
  75. class="show-demo"
  76. v-for="(item, index) in listData"
  77. :key="item"
  78. >
  79. <div @click="positionClick(listData[index])">
  80. <div class="goods-level">
  81. <div class="level-dsc">第{{ index }}层</div>
  82. <div class="goods-list">
  83. <div
  84. class="goods-dsc"
  85. v-for="(it, ind) in listData[index]"
  86. :key="ind"
  87. :style="{
  88. background:
  89. it.wei_zhi_zhuang_ta == '空余' ? '#67c23a' : '',
  90. }"
  91. >
  92. <div class="top-dsc">
  93. <div class="position">
  94. <!-- <p>位置id:{{ it.shou_yang_wei_zhi }}</p>
  95. <p>货位id:{{ it.id_ }}</p> -->
  96. <p>样品名称:{{ it.yang_pin_ming_che}}</p>
  97. <p>位置编号:{{ it.wei_zhi_bian_hao_ }}</p>
  98. <p>样品编号:{{ it.yang_pin_bian_hao }}</p>
  99. <p>位置状态:{{ it.wei_zhi_zhuang_ta }}</p>
  100. <p>
  101. 存储条件:{{
  102. it.cun_chu_tiao_jian || it.cun_chu_yao_qiu_
  103. }}
  104. </p>
  105. </div>
  106. </div>
  107. <div class="bottom-dsc" v-if="false">
  108. {{ it.yang_pin_ming_che || it.wei_zhi_zhuang_ta }}
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. <div
  117. class="goodshelf-name"
  118. style="height: 500px;font-size:20px;text-align:center"
  119. >
  120. {{ desString }}
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </template>
  127. <script>
  128. import FixHeight from "@/mixins/height";
  129. import curdPost from "@/business/platform/form/utils/custom/joinCURD.js";
  130. export default {
  131. mixins: [FixHeight],
  132. data() {
  133. return {
  134. sampleOption: [],
  135. formInline: {
  136. fang_jian_hao_value: "",
  137. qu_yu_value: "",
  138. huo_jia_value: "",
  139. gua_jia_value: "",
  140. },
  141. listData: [],
  142. warehouseOptions: [],
  143. quyu_arr: [],
  144. huo_jia_arr: [],
  145. gua_jia_arr: [],
  146. firstLoadActive: true,
  147. qu_yu_value: "",
  148. quyuShow: "",
  149. huojiashow: "",
  150. guajiashow: "",
  151. leixingcare: true,
  152. cenghao: [],
  153. warehouse: [],
  154. loading: false,
  155. // pagination: {},
  156. // secondshow: false,
  157. desString: "",
  158. viewShow: false,
  159. placeValue: "选择位置",
  160. loading: true,
  161. samplearr:[],
  162. };
  163. },
  164. props: {
  165. value: {
  166. type: [String, Number, Array, Object],
  167. default: "",
  168. },
  169. },
  170. filters: {
  171. specimenFilters: function (values) {
  172. if (values == "空余") {
  173. return "未占用";
  174. } else {
  175. return values;
  176. }
  177. },
  178. },
  179. methods: {
  180. firstLoadViewData() {
  181. var this_ = this;
  182. var sqlString = `select * from t_mjypcfwz where fang_jian_lei_xin = '样品间' and qu_yu_ ='待检区' and huo_jia_hao_ = '1' and huo_jia_lei_xing_ = '冰箱'`;
  183. this.huojiashow = "1号冰箱";
  184. this.quyuShow = "待检区";
  185. this.desString = "样品间" + "待检区1号冰箱";
  186. this.queryLoad(sqlString);
  187. this.formInline.fang_jian_hao_value = "样品间";
  188. this.formInline.qu_yu_value = "待检区";
  189. this.formInline.huo_jia_value = "1号冰箱";
  190. let sql = `select distinct huo_jia_hao_,huo_jia_lei_xing_ from t_mjypcfwz where fang_jian_lei_xin = '样品间' and qu_yu_ ='待检区' order by huo_jia_hao_ asc `;
  191. curdPost("sql", sql).then((response) => {
  192. this_.huo_jia_arr = response.variables.data;
  193. });
  194. },
  195. loadQueryData() {
  196. //查询选择数据查询
  197. var sqlString =
  198. "select distinct fang_jian_lei_xin from t_mjypcfwz WHERE fang_jian_lei_xin !=''";
  199. // var sqlString = "select * from t_mjypcfwz";
  200. var this_ = this;
  201. curdPost("sql", sqlString).then((response) => {
  202. this_.sampleOption = response.variables.data;
  203. this_.sampleOption.pop();
  204. });
  205. },
  206. onSubmits(sql) {
  207. var fang_jian_ = this.formInline.fang_jian_hao_value;
  208. var qu_yu = this.formInline.qu_yu_value;
  209. var huo_jia_hao_ = this.formInline.huo_jia_value.substr(0, 1);
  210. let huo_jia_lei_xing_ = this.formInline.huo_jia_value.substr(
  211. 2,
  212. this.formInline.huo_jia_value.length
  213. );
  214. var gua_jia_hao = this.formInline.gua_jia_value.substr(0, 1);
  215. var sql;
  216. if (qu_yu != "") {
  217. sql = `select * from t_mjypcfwz where fang_jian_lei_xin = '${fang_jian_}' and qu_yu_ = '${qu_yu}' and huo_jia_lei_xing_ = '${huo_jia_lei_xing_}' and huo_jia_hao_ = '${huo_jia_hao_}'`;
  218. } else {
  219. if (huo_jia_lei_xing_.includes("冰箱")) {
  220. sql = `select * from t_mjypcfwz where fang_jian_lei_xin = '${fang_jian_}' and huo_jia_lei_xing_ = '${huo_jia_lei_xing_}' and huo_jia_hao_ = '${huo_jia_hao_}'`;
  221. } else if (huo_jia_lei_xing_.includes("液氮罐")) {
  222. sql = `select * from t_mjypcfwz where fang_jian_lei_xin = '${fang_jian_}' and huo_jia_lei_xing_ = '${huo_jia_lei_xing_}' and huo_jia_hao_ = '${huo_jia_hao_}' and gua_jia_hao_= '${gua_jia_hao}'`;
  223. }
  224. }
  225. this.queryLoad(sql);
  226. },
  227. queryLoad(sql) {
  228. //根据样品信息货位查询相对应的样品登记表
  229. var datas = [];
  230. var labelsMap = {}; // map存储
  231. var this_ = this;
  232. this_.listData = [];
  233. curdPost("sql", sql).then((res) => {
  234. datas = res.variables.data;
  235. datas.forEach((item) => {
  236. let yangpingSql ="select * from t_mjypdjb WHERE yang_pin_bian_hao = '" +item.yang_pin_bian_hao +"'"; // 通过样品货位配置的id外键 查询样品登记表
  237. if (!labelsMap[item.ceng_hao_]) {
  238. labelsMap[item.ceng_hao_] = [];//没有就创建
  239. curdPost("sql", yangpingSql).then((res) => {
  240. if (res.variables.data.length > 0) {
  241. let data = res.variables.data;
  242. item['yang_pin_ming_che'] = data[0].yang_pin_ming_che;
  243. labelsMap[item.ceng_hao_].push(item);
  244. }else{
  245. labelsMap[item.ceng_hao_].push(item);
  246. }
  247. });
  248. } else {
  249. curdPost("sql", yangpingSql).then((res) => {
  250. if (res.variables.data.length > 0) {
  251. let data = res.variables.data;
  252. item['yang_pin_ming_che'] = data[0].yang_pin_ming_che;
  253. labelsMap[item.ceng_hao_].push(item);
  254. }else{
  255. labelsMap[item.ceng_hao_].push(item);
  256. }
  257. });
  258. }
  259. });
  260. this_.listData = labelsMap;
  261. this.$nextTick(() => {
  262. this.loading = false;
  263. });
  264. // this.loading = true;
  265. });
  266. },
  267. qu_yu_Event(e) {
  268. //区间 留样 样品间 点击事件 查询相应的货架号->冰箱 赋值 huo_jia_hao_
  269. this.huo_jia_arrEvent(e.target.innerText);
  270. this.huojiashow = "";
  271. this.guajiashow = "";
  272. let sqlString = `select distinct huo_jia_hao_,huo_jia_lei_xing_ from t_mjypcfwz where fang_jian_lei_xin = '${this.formInline.fang_jian_hao_value}' and qu_yu_ = '${e.target.innerText}' order by huo_jia_hao_ asc`;
  273. var this_ = this;
  274. this.qu_yu_value = e.target.innerText;
  275. this.quyuShow = e.target.innerText;
  276. this.formInline.qu_yu_value = e.target.innerText;
  277. curdPost("sql", sqlString).then((response) => {
  278. this_.huo_jia_arr = response.variables.data;
  279. });
  280. },
  281. huo_jia_hao_Event(e) {
  282. //货架 冰箱 液氮罐点击事件
  283. this.guajiashow = "";
  284. let selectText = e.target.innerText;
  285. this.guajiaarrEvent(selectText);
  286. this.huojiashow = selectText;
  287. let huojiaNum = selectText.substr(0, 1);
  288. this.formInline.huo_jia_value = selectText;
  289. let huojialeixing = this.formInline.huo_jia_value.substr(
  290. 2,
  291. this.formInline.huo_jia_value.length
  292. );
  293. //区分是冰箱和液氮罐的点击事件
  294. if (selectText.includes("冰箱")) {
  295. //如果是冰箱 请求样品货位配置信息 ->查询登记表
  296. var sql = `select * from t_mjypcfwz where fang_jian_lei_xin = '${this.formInline.fang_jian_hao_value}' and qu_yu_ = '${this.formInline.qu_yu_value}' and huo_jia_lei_xing_ = '${huojialeixing}' and huo_jia_hao_ = '${huojiaNum}'`;
  297. this.desString = this.formInline.fang_jian_hao_value +this.formInline.qu_yu_value + huojiaNum+huojialeixing
  298. this.queryLoad(sql);
  299. } else if (selectText.includes("液氮罐")) {
  300. //液氮罐 查询该液氮罐下所有的挂件
  301. let sqlString = `select distinct gua_jia_hao_ from t_mjypcfwz where huo_jia_lei_xing_ = '液氮罐' and huo_jia_hao_ = '${huojiaNum}' order by gua_jia_hao_ asc`;
  302. var this_ = this;
  303. curdPost("sql", sqlString).then((response) => {
  304. this_.gua_jia_arr = response.variables.data;
  305. });
  306. }
  307. this.formInline.huo_jia_value = selectText;
  308. },
  309. gua_jia_Event(e) {
  310. //液氮罐挂件号点击事件 查询该液氮罐下该挂件的货位位置信息;
  311. let selectText = e.target.innerText;
  312. this.guajiashow = selectText;
  313. let hguajiaNum = selectText.substr(0, 1);
  314. var fang_jian_hao_value = this.formInline.fang_jian_hao_value;
  315. var huo_jia_value = this.formInline.huo_jia_value;
  316. var sql = `select * from t_mjypcfwz where fang_jian_lei_xin = '${fang_jian_hao_value}' and huo_jia_lei_xing_ = '液氮罐' and huo_jia_hao_ = '${huo_jia_value.substring(
  317. 0,
  318. 1
  319. )}' and gua_jia_hao_= '${hguajiaNum}'`;
  320. this.desString = fang_jian_hao_value + huo_jia_value + selectText;
  321. this.queryLoad(sql);
  322. },
  323. huo_jia_arrEvent(quyu) {
  324. let sqlString = `select distinct huo_jia_hao_,huo_jia_lei_xing_ from t_mjypcfwz where fang_jian_lei_xin = '${this.formInline.fang_jian_hao_value}' and qu_yu_ = '${quyu}' order by huo_jia_hao_ asc`;
  325. var this_ = this;
  326. curdPost("sql", sqlString).then((response) => {
  327. this_.huo_jia_arr = response.variables.data;
  328. if (!this_.firstLoadActive) {
  329. this_.formInline.huo_jia_value = "";
  330. }
  331. this_.firstLoadActive = false;
  332. });
  333. },
  334. guajiaarrEvent(huojiaweizhi) {
  335. let huojiaNum = huojiaweizhi.substr(0, 1);
  336. let huojialeixing = huojiaweizhi.substr(2, huojiaweizhi.length);
  337. if (huojiaweizhi.includes("冰箱")) {
  338. this.gua_jia_arr = [];
  339. return;
  340. }
  341. let sqlString = `select distinct gua_jia_hao_ from t_mjypcfwz where fang_jian_lei_xin = '留样间' and huo_jia_lei_xing_ = '${huojialeixing}' and huo_jia_hao_ = '${huojiaNum}' order by gua_jia_hao_`;
  342. var this_ = this;
  343. curdPost("sql", sqlString).then((response) => {
  344. this_.gua_jia_arr = response.variables.data;
  345. });
  346. },
  347. positionBtn() {
  348. this.loadQueryData();
  349. this.firstLoadViewData();
  350. this.viewShow = !this.viewShow;
  351. console.log(this.viewShow);
  352. },
  353. positionClick(values) {
  354. this.viewShow = !this.viewShow;
  355. this.placeValue = values[0].wei_zhi_bian_hao_;
  356. let this_ = this;
  357. console.log(values[0].id_, "id");
  358. this_.$emit("input", values[0].id_); //传导
  359. },
  360. },
  361. watch: {
  362. "formInline.fang_jian_hao_value": function (newdata, olddata) {
  363. //监控房间号 input 输入框数据变化 来改变区域和货架信息(input)
  364. this.huo_jia_arr = [];
  365. let sqlString = `select distinct qu_yu_ ,huo_jia_hao_ from t_mjypcfwz where fang_jian_lei_xin = '${newdata}' `;
  366. var this_ = this;
  367. curdPost("sql", sqlString).then((response) => {
  368. this_.quyu_arr = response.variables.data.reverse();
  369. this_.quyu_arr.forEach((item) => {
  370. //待优化 事实上是一个用来判断
  371. if (item.qu_yu_ == "") {
  372. this_.leixingcare = false;
  373. this_.formInline.qu_yu_value = "";
  374. let sql = `select distinct huo_jia_hao_,huo_jia_lei_xing_ from t_mjypcfwz where fang_jian_lei_xin = '${newdata}' order by huo_jia_hao_ asc`;
  375. curdPost("sql", sql).then((res) => {
  376. this_.huo_jia_arr = res.variables.data;
  377. });
  378. return;
  379. } else {
  380. this_.leixingcare = true;
  381. }
  382. });
  383. if (!this.firstLoadActive) {
  384. this_.formInline.qu_yu_value = "";
  385. }
  386. });
  387. },
  388. placeValue: function (newdata, olddata) {
  389. if (newdata == "" || newdata == null) {
  390. this.$emit("input", "");
  391. }
  392. },
  393. },
  394. };
  395. </script>
  396. <style lang="scss" scoped>
  397. p {
  398. padding: 0;
  399. margin: 0;
  400. }
  401. .sample-content {
  402. width: 100%;
  403. // position: fixed;
  404. top: 50;
  405. position: relative;
  406. background: white;
  407. .close{
  408. position: fixed;
  409. right: 52px;
  410. top:20px;
  411. color: red;
  412. z-index: 999;
  413. font-size: 45px;
  414. }
  415. .title{
  416. width: 100%;
  417. height: 14px;
  418. line-height: 24px;
  419. font-size: 24px;
  420. text-align: center;
  421. }
  422. .selectPo {
  423. cursor: pointer;
  424. z-index: 9;
  425. }
  426. .top-content {
  427. width: 100%;
  428. .top-title {
  429. text-align: center;
  430. font-weight: bold;
  431. width: 100%;
  432. font-size: 18px;
  433. line-height: 40px;
  434. }
  435. .query-content {
  436. display: flex;
  437. margin-left: 25px;
  438. }
  439. }
  440. .viewArea {
  441. position: fixed;
  442. left: 0;
  443. top: 0;
  444. width: 100%;
  445. background: white;
  446. z-index: 99 !important;
  447. }
  448. .select_quyu {
  449. .test-quyu,
  450. .huojia {
  451. width: 100%;
  452. .list-items {
  453. display: flex;
  454. cursor: pointer;
  455. .quyu-item {
  456. background: #0099cc;
  457. }
  458. .huojia-item {
  459. background: #99ccff;
  460. }
  461. .list-item {
  462. padding: 0px 10px;
  463. background-color: rgb(206, 198, 164);
  464. text-align: center;
  465. line-height: 35px;
  466. margin-left: 20px;
  467. border-radius: 10px;
  468. }
  469. }
  470. .cangku-mingchen {
  471. width: 100%;
  472. text-align: left;
  473. margin-left: 50px;
  474. }
  475. }
  476. }
  477. .body-content {
  478. margin-bottom: 20px;
  479. display: flex;
  480. box-sizing: border-box;
  481. height: 100vh;
  482. overflow-x: hidden;
  483. overflow-y: scroll;
  484. // .left-table {
  485. // // width: 40%;
  486. // ::v-deep .el-table {
  487. // width: 40%;
  488. // }
  489. // }
  490. .right-view {
  491. z-index: 99;
  492. width: 100%;
  493. .goods-items {
  494. width: 100%;
  495. border: solid 2px rgb(202, 236, 247);
  496. display: flex;
  497. flex-direction: column-reverse;
  498. .show-demo {
  499. width: 100%;
  500. // border-bottom: 1px solid bisque;
  501. // margin: 0 auto;
  502. text-align: center;
  503. .goods-level {
  504. display: flex;
  505. position: relative;
  506. margin-bottom: 6px;
  507. }
  508. .level-dsc {
  509. margin-top: 12px;
  510. position: absolute;
  511. bottom: 0;
  512. left: 10px;
  513. }
  514. .goods-list {
  515. display: flex;
  516. // justify-content: flex-start;
  517. flex-wrap: wrap-reverse;
  518. align-content: flex-start;
  519. margin-left: 50px;
  520. margin-right: 15px;
  521. .goods-dsc {
  522. cursor: pointer;
  523. padding: 2px 6px;
  524. border-radius: 5px;
  525. background: #E6A23C;
  526. margin-left: 12px;
  527. margin-top: 6px;
  528. // box-sizing: border-box;
  529. .top-dsc {
  530. display: flex;
  531. justify-content: space-between;
  532. font-size: 12px;
  533. // height: 18px;
  534. line-height: 18px;
  535. .position {
  536. width: 160px;
  537. overflow: hidden;
  538. }
  539. .position > p {
  540. text-align: left;
  541. color: #fbe8ff;
  542. }
  543. .right-content {
  544. display: flex;
  545. align-items: center;
  546. p {
  547. height: 18px;
  548. line-height: 18px;
  549. margin-left: 5px;
  550. color: #fbe8ff;
  551. text-align: left;
  552. }
  553. }
  554. }
  555. .bottom-dsc {
  556. width: 100%;
  557. text-align: center;
  558. font-size: 18px;
  559. height: 45px;
  560. line-height: 45px;
  561. margin-top: 9px;
  562. color: #fbe8ff;
  563. }
  564. .goods-demo {
  565. display: block;
  566. width: 70px;
  567. height: 90px;
  568. border: 1px solid rgb(10, 9, 8);
  569. text-align: center;
  570. margin: 0;
  571. }
  572. .goods-code {
  573. text-align: center;
  574. width: 100%;
  575. height: 20px;
  576. line-height: 20px;
  577. }
  578. }
  579. }
  580. .goodshelf-name {
  581. margin: 15px 0px;
  582. }
  583. .shelf {
  584. width: 100%;
  585. height: 40px;
  586. line-height: 40px;
  587. text-align: center;
  588. }
  589. }
  590. }
  591. }
  592. }
  593. }
  594. </style>