index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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 tableData from "../tableData.js";
  96. export default {
  97. data() {
  98. return {
  99. type: "center",
  100. msgType: "success",
  101. messageText: "这是一条成功提示",
  102. value: "请选择",
  103. value1: "",
  104. value3: "",
  105. searchVal: "",
  106. tableData: [],
  107. IDBIndexs: "",
  108. pageSize: 10,
  109. host: "",
  110. pageCurrent: 1,
  111. total: 0,
  112. loading: true,
  113. rangeValue: "",
  114. zoneId: "",
  115. tip: 0,
  116. radiolist1: [
  117. {
  118. name: "SE车检",
  119. disabled: false,
  120. },
  121. {
  122. name: "成品区",
  123. disabled: false,
  124. },
  125. ],
  126. };
  127. },
  128. onLoad(options) {
  129. console.log("进", options);
  130. let _this = this;
  131. uni.getStorage({
  132. key: "hostappst",
  133. success(res) {
  134. console.log("获取成功", res.data);
  135. _this.host = res.data;
  136. },
  137. });
  138. this.getData(1);
  139. this.getReservoir();
  140. this.IDBIndexs = options.show;
  141. if (options.rangeValue != "") {
  142. this.rangeValue = options.rangeValue;
  143. }
  144. this.tip = options.tip;
  145. this.selectedIndexs = [];
  146. this.radiolist1 = [];
  147. },
  148. mounted() {
  149. if (this.tip == 1) {
  150. this.value = "桶装物料入库缓存区";
  151. this.dialogInputConfirm();
  152. } else if (this.tip == 2) {
  153. this.value = "桶装物料出库缓存区";
  154. this.dialogInputConfirm();
  155. } else if (this.rangeValue == "emptyPalletTargetOut") {
  156. this.value = "桶装物料入库缓存区";
  157. this.dialogInputConfirm();
  158. } else {
  159. this.inputDialogToggle();
  160. }
  161. // || this.IDBIndexs == 4
  162. if (this.IDBIndexs == 1 || this.IDBIndexs == 2) {
  163. this.inputDialogToggle();
  164. }
  165. },
  166. methods: {
  167. selectedItems() {
  168. return this.selectedIndexs.map((i) => this.tableData[i]);
  169. },
  170. selectionChange(e) {
  171. console.log(e.detail.index);
  172. this.selectedIndexs = e.detail.index;
  173. },
  174. ferterMan(val) {
  175. console.log("val", val);
  176. var pages = getCurrentPages();
  177. var prevPage = pages[pages.length - 2];
  178. let object = {
  179. id: val.id,
  180. locationNo: val.locationNo,
  181. show: this.IDBIndexs,
  182. };
  183. prevPage.$vm.otherFun(object);
  184. uni.navigateBack({
  185. delta: 1,
  186. });
  187. },
  188. delTable() {
  189. console.log(this.selectedItems());
  190. },
  191. filtechange(e) {
  192. console.log("e", e);
  193. },
  194. change(e) {
  195. this.$refs.table.clearSelection();
  196. this.selectedIndexs.length = 0;
  197. this.getData(e.current);
  198. },
  199. search() {
  200. this.getData(1, this.searchVal);
  201. },
  202. getData(pageCurrent, value = "") {
  203. this.loading = true;
  204. this.pageCurrent = pageCurrent;
  205. this.request({
  206. pageSize: this.pageSize,
  207. pageCurrent: pageCurrent,
  208. value: value,
  209. success: (res) => {},
  210. });
  211. },
  212. getReservoir() {
  213. let that = this;
  214. uni.getStorage({
  215. key: "GetPhone_Token",
  216. success: function (res) {
  217. uni.request({
  218. url: `http://${that.host}` + "/inv/asn/getZoneList",
  219. header: {
  220. Authorization: res.data,
  221. },
  222. method: "GET",
  223. success(res) {
  224. console.log("chaoShiPanDuan", res);
  225. if (res.data.code == 200) {
  226. res.data.data.forEach((item, index) => {
  227. that.radiolist1.push({
  228. name: item.zoneName,
  229. id: item.zoneId,
  230. disabled: false,
  231. });
  232. });
  233. } else {
  234. }
  235. console.log("res", res);
  236. },
  237. });
  238. },
  239. });
  240. },
  241. request(options) {
  242. const { pageSize, pageCurrent, success, value } = options;
  243. let total = tableData.length;
  244. let data = tableData.filter((item, index) => {
  245. const idx = index - (pageCurrent - 1) * pageSize;
  246. return idx < pageSize && idx >= 0;
  247. });
  248. if (value) {
  249. data = [];
  250. tableData.forEach((item) => {
  251. if (item.name.indexOf(value) !== -1) {
  252. data.push(item);
  253. }
  254. });
  255. total = data.length;
  256. }
  257. setTimeout(() => {
  258. typeof success === "function" &&
  259. success({
  260. data: data,
  261. total: total,
  262. });
  263. }, 500);
  264. },
  265. goto(data) {
  266. uni.navigateTo({
  267. url: data,
  268. });
  269. },
  270. inputDialogToggle() {
  271. // || this.IDBIndexs == 4
  272. if (this.IDBIndexs == 1 || this.IDBIndexs == 2) {
  273. this.$refs.inputDialog.open();
  274. }
  275. },
  276. radioChange(val, row) {
  277. console.log("111", val, row);
  278. this.value3 = val;
  279. this.zoneId = row.id;
  280. },
  281. dialogInputConfirm(val) {
  282. if (this.value3 != "") {
  283. this.value = this.value3;
  284. }
  285. this.tableData = [];
  286. console.log("val", this.zoneId);
  287. let that = this;
  288. let data = {
  289. zoneId: that.zoneId,
  290. locationSceneCode: "emptyPalletInvList",
  291. };
  292. let dataobj = {};
  293. let name;
  294. if (this.IDBIndexs == 3 || this.IDBIndexs == 6 || this.IDBIndexs == 7) {
  295. name = "getCacheLocationInfoCacheList";
  296. if (this.tip == 1) {
  297. dataobj = {
  298. cacheZoneSceneCode: "bucketCacheZoneIn",
  299. locationSceneCode: "bucketCacheIn",
  300. };
  301. } else {
  302. dataobj = {
  303. cacheZoneSceneCode: "bucketCacheZoneOut",
  304. locationSceneCode: "bucketCacheOut",
  305. };
  306. }
  307. } else if (this.IDBIndexs == 1 || this.IDBIndexs == 2) {
  308. name = "getBaseLocationInfoList";
  309. if (this.zoneId == 4) {
  310. dataobj = {
  311. zoneId: 4,
  312. };
  313. } else {
  314. dataobj = {
  315. zoneId: 5,
  316. };
  317. }
  318. } else {
  319. name = "getBaseLocationInfoList";
  320. if (this.zoneId == 4 || this.IDBIndexs == 4) {
  321. dataobj = {
  322. zoneId: 4,
  323. locationSceneCode: this.rangeValue,
  324. };
  325. } else {
  326. dataobj = {
  327. zoneId: 5,
  328. locationSceneCode: this.rangeValue,
  329. };
  330. }
  331. }
  332. this.loading = false;
  333. uni.getStorage({
  334. key: "GetPhone_Token",
  335. success: function (res) {
  336. // 恢复请求
  337. uni.request({
  338. url: `http://${that.host}` + "/inv/asn/" + name,
  339. header: {
  340. Authorization: res.data,
  341. },
  342. method: "GET",
  343. data: dataobj,
  344. success(res) {
  345. console.log("chaoShiPanDuan", res);
  346. if (res.data.code == 200) {
  347. res.data.data.forEach((item, index) => {
  348. res.data.data.forEach((item, index) => {
  349. if (item.stockStatus == "00") {
  350. item.stockStatus = "空闲";
  351. } else if (item.stockStatus == "10") {
  352. item.stockStatus = "占用";
  353. } else if (item.stockStatus == "20") {
  354. item.stockStatus = "完成";
  355. } else if (item.stockStatus == "90") {
  356. item.stockStatus = "合格";
  357. } else if (item.stockStatus == "99") {
  358. item.stockStatus = "不合格";
  359. } else if (item.stockStatus == "80") {
  360. item.stockStatus = "封存";
  361. }
  362. });
  363. that.tableData = [...res.data.data];
  364. that.total = res.data.total;
  365. });
  366. } else {
  367. }
  368. console.log("res", res);
  369. },
  370. });
  371. },
  372. });
  373. setTimeout(() => {
  374. uni.hideLoading();
  375. console.log(val);
  376. // 关闭窗口后,恢复默认内容
  377. this.$refs.inputDialog.close();
  378. }, 100);
  379. },
  380. },
  381. };
  382. </script>
  383. <style scoped lang="scss">
  384. .content {
  385. padding: 15px;
  386. .title {
  387. display: flex;
  388. justify-content: space-between;
  389. font-size: 17px;
  390. color: #525151;
  391. .view_icon {
  392. display: flex;
  393. align-content: center;
  394. align-items: center;
  395. }
  396. }
  397. .content_table {
  398. padding-top: 20px;
  399. }
  400. }
  401. </style>