index.vue 10 KB

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