index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <view class="content">
  3. <view class="title">
  4. <view class="">
  5. <text>库区筛选</text>
  6. </view>
  7. <view class="view_icon" @click="inputDialogToggle">
  8. <text>{{ value }}</text>
  9. <u-icon name="arrow-right" color="#000000" size="20"></u-icon>
  10. </view>
  11. </view>
  12. <view class="content_table">
  13. <view class="uni-container">
  14. <uni-table
  15. ref="table"
  16. :loading="loading"
  17. stripe
  18. emptyText="暂无更多数据"
  19. @selection-change="selectionChange">
  20. <uni-tr>
  21. <uni-th width="50" align="center">库位</uni-th>
  22. <uni-th width="50" align="center"></uni-th>
  23. <uni-th width="50" align="center">库位状态</uni-th>
  24. <uni-th width="50" align="center">库存状态</uni-th>
  25. </uni-tr>
  26. <uni-tr
  27. @filter-change="filtechange"
  28. v-for="(item, index) in tableData"
  29. :key="index">
  30. <uni-td>
  31. <view class="name" @click.prevent="ferterMan(item)">
  32. {{ item.locationNo }}
  33. </view>
  34. </uni-td>
  35. <uni-td>
  36. <view class="name" @click.prevent="ferterMan(item)">
  37. {{ item.name }}
  38. </view>
  39. </uni-td>
  40. <uni-td align="center">
  41. <view class="name" @click.prevent="ferterMan(item)">
  42. {{ item.stockStatus }}
  43. </view>
  44. </uni-td>
  45. <uni-td align="center">
  46. <view
  47. class="name"
  48. @click.prevent="ferterMan(item)"
  49. v-if="item.isEmpty == 'Y'">
  50. </view>
  51. <view
  52. class="name"
  53. @click.prevent="ferterMan(item)"
  54. v-if="item.isEmpty == 'N'">
  55. 非空
  56. </view>
  57. </uni-td>
  58. </uni-tr>
  59. </uni-table>
  60. <view class="uni-pagination-box">
  61. <uni-pagination
  62. show-icon
  63. :page-size="pageSize"
  64. :current="pageCurrent"
  65. :total="total"
  66. @change="change" />
  67. </view>
  68. </view>
  69. </view>
  70. <uni-popup ref="inputDialog" type="dialog">
  71. <uni-popup-dialog
  72. ref="inputClose"
  73. title="选择库区"
  74. value="对话框预置提示内容!"
  75. placeholder="请输入内容"
  76. @confirm="dialogInputConfirm">
  77. <u-radio-group
  78. placement="column"
  79. :borderBottom="true"
  80. v-model="value"
  81. iconPlacement="right">
  82. <u-radio
  83. :customStyle="{ marginBottom: '8px' }"
  84. v-for="(item, index) in radiolist1"
  85. :key="index"
  86. :label="item.name"
  87. :name="item.name"
  88. @change="radioChange($event, item)"></u-radio>
  89. </u-radio-group>
  90. </uni-popup-dialog>
  91. </uni-popup>
  92. </view>
  93. </template>
  94. <script>
  95. import { queryDict, getqueryDict } from "@/libs/http/index.js";
  96. import tableData from "../tableData.js";
  97. export default {
  98. data() {
  99. return {
  100. type: "center",
  101. msgType: "success",
  102. messageText: "这是一条成功提示",
  103. value: "请选择",
  104. value1: "",
  105. searchValue: "",
  106. searchVal: "",
  107. tableData: [],
  108. IDBIndexs: "",
  109. pageSize: 10,
  110. host: "",
  111. pageCurrent: 1,
  112. total: 0,
  113. loading: true,
  114. rangeValue: "",
  115. zoneId: "",
  116. tip: 0,
  117. radiolist1: [
  118. {
  119. name: "SE车检",
  120. disabled: false,
  121. },
  122. {
  123. name: "成品区",
  124. disabled: false,
  125. },
  126. ],
  127. };
  128. },
  129. onLoad(options) {
  130. console.log("进", options);
  131. let _this = this;
  132. uni.getStorage({
  133. key: "hostappst",
  134. success(res) {
  135. console.log("获取成功", res.data);
  136. _this.host = res.data;
  137. },
  138. });
  139. this.getData(1);
  140. this.getReservoir();
  141. this.IDBIndexs = options.show;
  142. if (options.rangeValue != "") {
  143. this.rangeValue = options.rangeValue;
  144. }
  145. this.tip = options.tip;
  146. this.selectedIndexs = [];
  147. this.radiolist1 = [];
  148. },
  149. mounted() {
  150. if (this.IDBIndexs == 1 || this.IDBIndexs == 2) {
  151. this.inputDialogToggle();
  152. }
  153. },
  154. methods: {
  155. selectedItems() {
  156. return this.selectedIndexs.map((i) => this.tableData[i]);
  157. },
  158. selectionChange(e) {
  159. console.log(e.detail.index);
  160. this.selectedIndexs = e.detail.index;
  161. },
  162. ferterMan(val) {
  163. console.log("val", val);
  164. var pages = getCurrentPages();
  165. var prevPage = pages[pages.length - 2];
  166. let object = {
  167. id: val.id,
  168. locationNo: val.locationNo,
  169. show: this.IDBIndexs,
  170. };
  171. prevPage.$vm.otherFun(object);
  172. uni.navigateBack({
  173. delta: 1,
  174. });
  175. },
  176. delTable() {
  177. console.log(this.selectedItems());
  178. },
  179. filtechange(e) {
  180. console.log("e", e);
  181. },
  182. change(e) {
  183. this.$refs.table.clearSelection();
  184. this.selectedIndexs.length = 0;
  185. this.getData(e.current);
  186. },
  187. search() {
  188. this.getData(1, this.searchVal);
  189. },
  190. getData(pageCurrent, value = "") {
  191. this.loading = true;
  192. this.pageCurrent = pageCurrent;
  193. this.request({
  194. pageSize: this.pageSize,
  195. pageCurrent: pageCurrent,
  196. value: value,
  197. success: (res) => {},
  198. });
  199. },
  200. getReservoir() {
  201. let that = this;
  202. uni.getStorage({
  203. key: "GetPhone_Token",
  204. success: function (res) {
  205. uni.request({
  206. url: `http://${that.host}` + "/base/locationZone/queryDict",
  207. header: {
  208. Authorization: res.data,
  209. },
  210. method: "GET",
  211. success(res) {
  212. if (res.data.code == 200) {
  213. res.data.data.forEach((item, index) => {
  214. that.radiolist1.push({
  215. name: item.zoneName,
  216. id: item.zoneId,
  217. disabled: false,
  218. });
  219. });
  220. } else {
  221. uni.showToast({
  222. title: res.data.msg,
  223. icon: "none",
  224. });
  225. }
  226. console.log("res", res);
  227. },
  228. });
  229. },
  230. });
  231. },
  232. request(options) {
  233. const { pageSize, pageCurrent, success, value } = options;
  234. let total = tableData.length;
  235. let data = tableData.filter((item, index) => {
  236. const idx = index - (pageCurrent - 1) * pageSize;
  237. return idx < pageSize && idx >= 0;
  238. });
  239. if (value) {
  240. data = [];
  241. tableData.forEach((item) => {
  242. if (item.name.indexOf(value) !== -1) {
  243. data.push(item);
  244. }
  245. });
  246. total = data.length;
  247. }
  248. setTimeout(() => {
  249. typeof success === "function" &&
  250. success({
  251. data: data,
  252. total: total,
  253. });
  254. }, 500);
  255. },
  256. goto(data) {
  257. uni.navigateTo({
  258. url: data,
  259. });
  260. },
  261. inputDialogToggle() {
  262. // || this.IDBIndexs == 4
  263. if (this.IDBIndexs == 1 || this.IDBIndexs == 2) {
  264. this.$refs.inputDialog.open();
  265. }
  266. },
  267. radioChange(val, row) {
  268. console.log("111", val, row);
  269. this.searchValue = val;
  270. this.zoneId = row.id;
  271. },
  272. async dialogInputConfirm(val) {
  273. console.log("val", this.zoneId);
  274. let that = this;
  275. this.loading = false;
  276. // let res = await getqueryDict(this.zoneId);
  277. uni.getStorage({
  278. key: "GetPhone_Token",
  279. success: function (res) {
  280. uni.request({
  281. url:
  282. `http://${that.host}` +
  283. "/base/locationInfo/queryDict/" +
  284. that.zoneId,
  285. header: {
  286. Authorization: res.data,
  287. },
  288. method: "GET",
  289. success(res) {
  290. if (res.data.code == 200) {
  291. res.data.data.forEach((item, index) => {
  292. res.data.data.forEach((item, index) => {
  293. if (item.stockStatus == "00") {
  294. item.stockStatus = "空闲";
  295. } else if (item.stockStatus == "10") {
  296. item.stockStatus = "占用";
  297. } else if (item.stockStatus == "20") {
  298. item.stockStatus = "完成";
  299. } else if (item.stockStatus == "90") {
  300. item.stockStatus = "合格";
  301. } else if (item.stockStatus == "99") {
  302. item.stockStatus = "不合格";
  303. } else if (item.stockStatus == "80") {
  304. item.stockStatus = "封存";
  305. }
  306. });
  307. that.tableData = [...res.data.data];
  308. that.total = res.data.total;
  309. });
  310. } else {
  311. uni.showToast({
  312. title: res.data.msg,
  313. icon: "none",
  314. });
  315. }
  316. setTimeout(() => {
  317. uni.hideLoading();
  318. console.log(val);
  319. // 关闭窗口后,恢复默认内容
  320. this.$refs.inputDialog.close();
  321. }, 100);
  322. },
  323. });
  324. },
  325. });
  326. },
  327. dialogInputConfirms(val) {
  328. if (this.searchValue != "") {
  329. this.value = this.searchValue;
  330. }
  331. this.tableData = [];
  332. console.log("val", this.zoneId);
  333. let that = this;
  334. let data = {
  335. zoneId: that.zoneId,
  336. locationSceneCode: "emptyPalletInvList",
  337. };
  338. let dataobj = {};
  339. let name;
  340. if (this.IDBIndexs == 3 || this.IDBIndexs == 6 || this.IDBIndexs == 7) {
  341. name = "getCacheLocationInfoCacheList";
  342. if (this.tip == 1) {
  343. dataobj = {
  344. cacheZoneSceneCode: "bucketCacheZoneIn",
  345. locationSceneCode: "bucketCacheIn",
  346. };
  347. } else {
  348. dataobj = {
  349. cacheZoneSceneCode: "bucketCacheZoneOut",
  350. locationSceneCode: "bucketCacheOut",
  351. };
  352. }
  353. } else if (this.IDBIndexs == 1 || this.IDBIndexs == 2) {
  354. name = "getBaseLocationInfoList";
  355. if (this.zoneId == 4) {
  356. dataobj = {
  357. zoneId: 4,
  358. };
  359. } else {
  360. dataobj = {
  361. zoneId: 5,
  362. };
  363. }
  364. } else {
  365. name = "getBaseLocationInfoList";
  366. if (this.zoneId == 4 || this.IDBIndexs == 4) {
  367. dataobj = {
  368. zoneId: 4,
  369. locationSceneCode: this.rangeValue,
  370. };
  371. } else {
  372. dataobj = {
  373. zoneId: 5,
  374. locationSceneCode: this.rangeValue,
  375. };
  376. }
  377. }
  378. this.loading = false;
  379. uni.getStorage({
  380. key: "GetPhone_Token",
  381. success: function (res) {
  382. // 恢复请求
  383. uni.request({
  384. url: `http://${that.host}` + "/inv/asn/" + name,
  385. header: {
  386. Authorization: res.data,
  387. },
  388. method: "GET",
  389. data: dataobj,
  390. success(res) {
  391. console.log("chaoShiPanDuan", res);
  392. if (res.data.code == 200) {
  393. res.data.data.forEach((item, index) => {
  394. res.data.data.forEach((item, index) => {
  395. if (item.stockStatus == "00") {
  396. item.stockStatus = "空闲";
  397. } else if (item.stockStatus == "10") {
  398. item.stockStatus = "占用";
  399. } else if (item.stockStatus == "20") {
  400. item.stockStatus = "完成";
  401. } else if (item.stockStatus == "90") {
  402. item.stockStatus = "合格";
  403. } else if (item.stockStatus == "99") {
  404. item.stockStatus = "不合格";
  405. } else if (item.stockStatus == "80") {
  406. item.stockStatus = "封存";
  407. }
  408. });
  409. that.tableData = [...res.data.data];
  410. that.total = res.data.total;
  411. });
  412. } else {
  413. }
  414. console.log("res", res);
  415. },
  416. });
  417. },
  418. });
  419. setTimeout(() => {
  420. uni.hideLoading();
  421. console.log(val);
  422. // 关闭窗口后,恢复默认内容
  423. this.$refs.inputDialog.close();
  424. }, 100);
  425. },
  426. },
  427. };
  428. </script>
  429. <style scoped lang="scss">
  430. .content {
  431. padding: 15px;
  432. .title {
  433. display: flex;
  434. justify-content: space-between;
  435. font-size: 17px;
  436. color: #525151;
  437. .view_icon {
  438. display: flex;
  439. align-content: center;
  440. align-items: center;
  441. }
  442. }
  443. .content_table {
  444. padding-top: 20px;
  445. }
  446. }
  447. </style>