taskStockMove.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view class="app-container">
  3. <uni-nav-bar dark :fixed="true" shadow background-color="#007AFF" status-bar left-icon="left" left-text="返回"
  4. title="移位任务" @clickLeft="handleBack" />
  5. <view class="scan-header">
  6. <uni-forms-item name="stockCode" label="单号" labelAlign="right"
  7. style="margin-bottom: 0px; padding: 0px 15px 0px 15px;" >
  8. <uni-easyinput type="text" :inputBorder="true" v-model="stockCode"
  9. :clearable="false" ></uni-easyinput>
  10. </uni-forms-item>
  11. <uni-forms-item name="dateRange" label="日期" labelAlign="right"
  12. style="margin-bottom: 0px; padding: 0px 15px 0px 15px;" >
  13. <uni-datetime-picker v-model="dateRange" type="daterange"/>
  14. </uni-forms-item>
  15. <view class="button-group">
  16. <button type="default" size="mini" @click="setDateRange(-1, -1)">昨日</button>
  17. <button type="default" size="mini" @click="setDateRange(0, 0)">今日</button>
  18. <button type="default" size="mini" @click="setDateRange(1, 1)">明日</button>
  19. <button type="warn" size="mini" @click="openStockMove">进入</button>
  20. <button type="primary" size="mini" @click="getList">查询</button>
  21. </view>
  22. </view>
  23. <scroll-view class="mxpop_scroll" scroll-y="true">
  24. <!-- <uni-section class="mb-10" :title="sectionTitle" type="line"> -->
  25. <view class="uni-list" style="margin-bottom: 60px;">
  26. <slot v-for="(item, index) in listData">
  27. <view class="uni-list-cell"
  28. hover-class="uni-list-cell-hover"
  29. :class="{ 'selected': rkid === item.id }"
  30. :key="index" @click="goProDetail(item, index, $event)"
  31. >
  32. <view style="display: flex;">
  33. <view class="detailList">{{ item.taskCode }}&emsp;|&emsp;{{ item.taskDate }}&emsp;|&emsp;{{ item.billType.billTypeName }}
  34. </view>
  35. </view>
  36. <view style="display: flex;">
  37. <view class="detailList">调出仓:{{ item.warehouseNameOut }}&emsp;调入仓:{{ item.warehouseNameIn }}</view>
  38. </view>
  39. <view style="display: flex;" v-if="item.customerNameIn">
  40. <view class="detailList">移入客户:{{item.customerNameIn}}</view>
  41. </view>
  42. <view style="display: flex;" v-if="item.extendCode01 || item.extendCode02">
  43. <view class="detailList">看板号:{{item.extendCode01}}&emsp;交货时间:{{ item.extendCode02 }}</view>
  44. </view>
  45. </view>
  46. <view class="s-line" />
  47. </slot>
  48. </view>
  49. <!-- </uni-section> -->
  50. </scroll-view>
  51. </view>
  52. </template>
  53. <script>
  54. import { listHeadTaskMove,queryBillTypeCache } from '@/api/wms/stockMove.js'
  55. import storage from '@/utils/storage'
  56. export default {
  57. async onLoad(option) {
  58. try {
  59. //查询移位单单据类型
  60. const res = await queryBillTypeCache({billCode: "stockMove"});
  61. let tmpData = res.rows;
  62. this.billTypeOption = tmpData.filter(item => item.isEnableApp == 0 && item.status == 0)
  63. .map(item => ({
  64. billTypeCode: item.billTypeCode,
  65. billTypeName: item.billTypeName,
  66. value: item.billTypeCode,
  67. text: item.billTypeName,
  68. taskValue: item.taskBillTypeCode ? "'" + item.taskBillTypeCode.replace(/,/g, "','") + "'" : '',
  69. isControlTask: item.isControlTask,
  70. }));
  71. console.log(this.billTypeOption)
  72. } catch (error) {
  73. }
  74. },
  75. onUnload(){},
  76. data() {
  77. return {
  78. // 筛选
  79. stockCode: "",
  80. dateRange: ['', ''],
  81. listData: "", // 数据list
  82. rkid: "", // 当前选中数据
  83. rkindex: "", // 选中数据下标
  84. isNavigating: false, // 用来检查是否正在导航
  85. billTypeOption: [], // 业务类型字典选择框数据
  86. }
  87. },
  88. created(){
  89. this.setDateRange(-30, 0)
  90. },
  91. methods: {
  92. getList() {
  93. let that = this;
  94. let queryParams = {
  95. taskCode: that.stockCode,
  96. params: { "beginTime": this.dateRange[0],"endTime": this.dateRange[1] },
  97. }
  98. listHeadTaskMove(queryParams).then(res => {
  99. if(res.code === 200){
  100. const newData = res.rows.map((item) => {
  101. // 在每个对象中插入新变量
  102. item['selected'] = false;
  103. // 查询任务对应单据类型
  104. item['billType'] = item.billTypeCode ? that.billTypeOption.find(item => item.taskValue.includes("'"+ item.billTypeCode +"'")) : {};
  105. // 返回修改后的对象
  106. return item;
  107. });
  108. this.listData = newData;
  109. }
  110. });
  111. //清空选中
  112. this.rkid = "";
  113. this.rkindex = "";
  114. },
  115. openStockMove(){
  116. if(this.rkid && this.rkindex>=0){
  117. let billTypeCode = this.listData[this.rkindex].billType.billTypeCode
  118. billTypeCode = billTypeCode==undefined || billTypeCode=='' ? '' : billTypeCode
  119. let path='/pages/menu/stockMove/index?ywlx=' + billTypeCode + '&taskCode=' + this.listData[this.rkindex].taskCode
  120. this.navClick(path);
  121. }
  122. },
  123. navClick(path) {
  124. if (this.isNavigating) {
  125. // 如果正在导航,则不执行任何操作
  126. return;
  127. }
  128. this.isNavigating = true; // 设置正在导航状态
  129. uni.navigateTo({
  130. url: path,
  131. success: () => {
  132. // 导航成功,可以在这里做一些操作,比如发送全局事件等
  133. this.isNavigating = false; // 重置导航状态
  134. },
  135. fail: () => {
  136. // 导航失败,同样重置导航状态
  137. this.isNavigating = false;
  138. }
  139. });
  140. },
  141. goProDetail(item, index, event){ //选中行
  142. try{
  143. if( this.rkid == item.id ){
  144. this.rkid = "";
  145. this.rkindex = "";
  146. }else{
  147. this.rkid = item.id;
  148. this.rkindex = index;
  149. }
  150. }catch{
  151. this.rkid = "";
  152. this.rkindex = "";
  153. }
  154. },
  155. setDateRange(start, end){ // 赋值日期期间
  156. let date1 = this.getYesterdayDate(start);
  157. let date2 = this.getYesterdayDate(end);
  158. this.dateRange = [date1, date2];
  159. this.getList();
  160. },
  161. getYesterdayDate(num) {// 获取当前日期
  162. let today = new Date();
  163. // 计算日期
  164. let yesterday = new Date(today);
  165. yesterday.setDate(yesterday.getDate() + parseInt(num));
  166. // 将日期格式化为YYYY-MM-DD格式的字符串
  167. let formattedDate = `${yesterday.getFullYear()}-${('0' + (yesterday.getMonth() + 1)).slice(-2)}-${('0' + yesterday.getDate()).slice(-2)}`;
  168. return formattedDate;
  169. },
  170. handleBack(){
  171. uni.showModal({
  172. title: '提示',
  173. content: '确认返回?',
  174. success: function (res) {
  175. if (res.confirm) {
  176. //用户点击确定;
  177. uni.navigateBack();
  178. } else if (res.cancel) {
  179. //用户点击取消;
  180. }
  181. }
  182. });
  183. },
  184. }
  185. }
  186. </script>
  187. <style>
  188. page{
  189. height: 100%;
  190. }
  191. .app-container{
  192. height: 100vh;
  193. display: flex;
  194. flex-direction: column;
  195. overflow: hidden;
  196. background: white;
  197. }
  198. .scan-header{
  199. position: fixed;
  200. /* #ifndef APP-PLUS */
  201. top: 45px;
  202. /* #endif */
  203. /* #ifdef APP-PLUS */
  204. top: 80px;
  205. /* #endif */
  206. width: 100%;
  207. background-color: white;
  208. z-index: 999;
  209. }
  210. .scroll-Y {
  211. /* height: 100%; */
  212. /* #ifndef APP-PLUS */
  213. margin-top: 44px;
  214. height: calc(100vh - 135px);
  215. /* #endif */
  216. /* #ifdef APP-PLUS */
  217. margin-top: 54px;
  218. height: calc(100vh - 175px);
  219. /* #endif */
  220. }
  221. ::v-deep .uni-forms-item{
  222. margin-bottom: 5px !important;
  223. }
  224. .detailList {
  225. margin-left: 4px;
  226. color: #333333;
  227. font-size: 13px;
  228. height: auto;
  229. line-height: 26px;
  230. width: 100vw;
  231. }
  232. .s-line{
  233. top: 0;
  234. right: 0;
  235. left: 0;
  236. height: 1px;
  237. margin-top: 5px;
  238. -webkit-transform: scaleY(0.5);
  239. transform: scaleY(0.5);
  240. background-color: #e5e5e5;
  241. z-index: 1;
  242. }
  243. .selected {
  244. background-color: #f8edb8;
  245. }
  246. .uni-list-cell {
  247. flex-direction: column;
  248. // margin-top: 10px;
  249. // background-color: white;
  250. padding: 8px 12px;
  251. }
  252. .mxpop_scroll{
  253. height: calc(100vh - 125px);
  254. margin-top: 130px;
  255. }
  256. /* 按钮行 */
  257. .button-group {
  258. margin-top: 5px;
  259. display: flex;
  260. justify-content: space-around;
  261. }
  262. </style>