fwposition.vue 21 KB

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