From 3878c57a2bd710295931303ea85439a596838dfd Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期二, 05 九月 2023 16:01:31 +0800
Subject: [PATCH] 小程序
---
minipro_standard/pages_adjust/pages/InventoryQuery/InventoryQuery.vue | 267 +++++++++++++++++++----------------------------------
1 files changed, 95 insertions(+), 172 deletions(-)
diff --git a/minipro_standard/pages_adjust/pages/InventoryQuery/InventoryQuery.vue b/minipro_standard/pages_adjust/pages/InventoryQuery/InventoryQuery.vue
index 83ffa40..692c60e 100644
--- a/minipro_standard/pages_adjust/pages/InventoryQuery/InventoryQuery.vue
+++ b/minipro_standard/pages_adjust/pages/InventoryQuery/InventoryQuery.vue
@@ -25,7 +25,14 @@
</view>
<view class="content_total" :style="{top: top}">鍏眥{controlData.total}}鏉℃暟鎹�</view>
<view class="content_list">
- <scroll-view @scrolltolower="getLists" scroll-y :style="{height: height}">
+ <scroll-view
+ :refresher-enabled="true"
+ :refresher-triggered="isLoading"
+ @refresherrefresh="onRefresh"
+ refresher-background="#fff"
+ @scrolltolower="getLists"
+ scroll-y
+ :style="{height: height}">
<view class="content_list_item" v-for="(item, i) in list" :key="i">
<view class="content_list_item_top">
<view class="content_list_item_top_left">
@@ -36,11 +43,11 @@
</view>
</view>
<view class="content_list_item_sx">
- <text v-if="item.qualityType == 0" class="green">鍚堟牸 | </text>
- <text v-if="item.qualityType == 1" class="yellow">涓嶈壇 | </text>
- <text v-if="item.qualityType == 2" class="red">鎶ュ簾 | </text>
- <text>{{ item.procedureName ? item.procedureName : '-' }} | </text>
- <text>{{ item.batch ? item.batch : '-' }}</text>
+ <text v-if="item.qualityType == 0" class="green">鍚堟牸 | </text>
+ <text v-if="item.qualityType == 1" class="yellow">涓嶈壇 | </text>
+ <text v-if="item.qualityType == 2" class="red">鎶ュ簾 | </text>
+ <text> {{ item.procedureName ? item.procedureName : '-' }} |</text>
+ <text> {{ item.batch ? item.batch : '-' }}</text>
</view>
<!-- item涓婚淇℃伅閮ㄥ垎 -->
<view class="content_list_item_content">
@@ -71,7 +78,8 @@
<script>
import Search from '@/components/Search.vue'
- import { orderTyepToStr } from '@/util/constData.js'
+ import { getwStockExtList } from "@/util/api/materialStorage"
+
export default {
components: {
Search
@@ -80,6 +88,7 @@
return {
height: '',
top: '',
+ isLoading: false,
controlData: {
finished: false,
loading: false,
@@ -96,7 +105,8 @@
materialName: '',
groupType: '3'
},
- list: []
+ list: [],
+ refreshing: false
};
},
onReady() {
@@ -108,20 +118,28 @@
}).exec()
})
},
+ onLoad() {
+ this.getLists()
+ },
methods: {
+ onRefresh() {
+ this.isLoading = true
+ this.controlData.page = 0;
+ this.controlData.finished = false;
+ this.list = [];
+ this.getLists()
+ },
changeGroup(i) {
this.groupTypes[i].isActive = !this.groupTypes[i].isActive;
this.data.groupType = this.groupTypes[i].id
for (const index in this.groupTypes) {
if (index != i) {
- // console.log(index, i)
const item = this.groupTypes[index]
item.isActive = false
}
}
},
tyepToStr(type) {
- // <!-- 1銆佽溅闂撮鏂欙紱2銆佽溅闂村鏂欙紱3銆佸叾浠栵紱4銆佸畬宸ュ叆搴� -->
for (const item of this.orderType) {
if (item.id == type) {
return item.name
@@ -135,182 +153,87 @@
url: `/pages/planDetails/planDetails?id=${item.id}`
})
},
+ // 鑾峰彇璁″垝鍒楄〃鏁版嵁
+ getLists() {
+ if (!this.controlData.finished) {
+ this.controlData.loading = true;
+ this.controlData.page = this.controlData.page += 1;
+ getwStockExtList({
+ capacity: this.controlData.capacity,
+ model: {
+ materialOrBatch: this.data.materialName,
+ groupType: this.data.groupType,
+ greaterZero: 1
+ },
+ page: this.controlData.page,
+ sorts: [
+ {
+ direction: "ASC",
+ property: "publishDate",
+ }
+ ]
+ }).then((res) => {
+ this.isLoading = false
+ if (this.refreshing) {
+ this.list = []
+ this.refreshing = false;
+ }
+ this.controlData.loading = false;
+ this.controlData.total = res.data.total;
+ if (res.code === 200) {
+ if (res.data.records.length < this.controlData.capacity) {
+ this.controlData.finished = true;
+ }
+ if (this.controlData.page === 1) {
+ this.list = res.data.records;
+ } else {
+ this.list.push(...res.data.records)
+ }
+ }
+ })
+ .catch((err) => {
+ this.isLoading = false
+ this.controlData.loading = false;
+ this.controlData.finished = true;
+ if (this.refreshing) {
+ this.list = []
+ this.refreshing = false;
+ }
+ })
+ } else {
+ this.isLoading = false
+ }
+ },
// 鑾峰彇澶撮儴缁勪欢楂樺害
getHeight(height) {
this.height = height
},
// 閲嶇疆
reset() {
- this.listData.page = 0
- this.finished = false
- this.lists = []
- this.listData.mixParam = ''
- this.listData.startDate = ''
- this.listData.endDate = ''
- this.listData.procedureIds = []
- if (this.factoryList.length > 0) {
- this.listData.departIds = this.factoryList[0].id
- }
- if (this.data.length > 0) {
- this.data.forEach(item => {
- item.isActive = false
- })
- }
- // this.getLists()
- // this.pageCounts()
- },
- // 鏃ユ湡纭畾
- timeConfirm(val) {
- this.listData.startDate = val[0]
- this.listData.endDate = val[val.length - 1]
- this.timeShow = false
- },
- // 鍒囨崲宸ュ巶
- changeTags(i, id) {
- this.listData.departIds = id
- this.getWorkingProcedures(id)
- this.factoryList.forEach((item, index) => {
- if (index === i) {
- item.isActive = true
- } else {
- item.isActive = false
- }
+ this.controlData.page = 0;
+ this.data.groupType = '3'
+ this.controlData.finished = false;
+ this.groupTypes.forEach((item, index) => {
+ item.isActive = index === 0;
})
- },
- // 鎵撳紑鏃ユ湡鎻掍欢
- openDate() {
- this.timeShow = true
+ this.data.materialName = ''
+ this.list = [];
+ this.getLists();
},
// 鎼滅储
searchInput(val) {
- this.listData.mixParam = val
- this.listData.page = 0
- this.finished = false
- this.lists = []
+ this.data.materialName = val;
+ this.controlData.page = 0;
+ this.controlData.finished = false;
+ this.list = [];
this.getLists()
- },
- // 鐐瑰嚮鏍囩鎼滅储
- clickTag(ids) {
- this.listData.cateIds = ids
- this.listData.page = 0
- this.finished = false
- this.lists = []
- // this.getLists()
- },
- // 鑾峰彇鍒楄〃缁熻
- pageCounts() {
- pageCount({
- factoryId: this.listData.departIds,
- procedureIdList: this.listData.procedureIds ? this.listData.procedureIds : [],
- startDate: this.listData.startDate,
- endDate: this.listData.endDate,
- statusList: this.listData.cateIds
- }).then(res => {
- if (res.code === 200 && res.data) {
- this.tagList[0].num = res.data.allNum.toString()
- this.tagList[1].num = res.data.startNum.toString()
- this.tagList[2].num = res.data.ingNum.toString()
- this.tagList[3].num = res.data.endNum.toString()
- }
- })
- },
- // 鑾峰彇宸ュ巶鏁版嵁
- getOrganizations() {
- getOrganization({
- type: 1
- }).then(res => {
- if (res.code === 200 && res.data && res.data.length !== 0) {
- res.data.forEach((item, i) => {
- item.isActive = i === 0;
- })
- if (res.data.length > 0) {
- this.factoryList = res.data
- this.listData.departIds = this.factoryList[0].id
- this.listData.procedureIds = ''
- this.finished = false
- this.getWorkingProcedures(this.factoryList[0].id)
- this.getLists()
- this.pageCounts()
- }
- }
- })
- },
- // 鑾峰彇宸ュ簭鏁版嵁
- getWorkingProcedures(orgId) {
- this.data = []
- getWorkingProcedure({
- orgId
- })
- .then(res => {
- if (res.code === 200 && res.data && res.data.length !== 0) {
- res.data.forEach((item, i) => {
- item.isActive = false;
- })
- this.data = res.data
- }
- })
},
// 鎼滅储寮规鎻愪氦
submit() {
- let pmodelOrgId = []
- this.data.forEach((item) => {
- if (item.isActive) {
- pmodelOrgId.push(item.id)
- }
- })
- this.listData.procedureIds = pmodelOrgId
- this.listData.page = 0
- this.finished = false
- this.lists = []
- // this.getLists()
- // this.pageCounts()
- },
- // 鑾峰彇璁″垝鍒楄〃鏁版嵁
- getLists() {
- console.log('getLists')
- if (!this.finished) {
- this.loading = true
- this.listData.page = this.listData.page++
- getList({
- capacity: this.listData.capacity,
- model: {
- mixParam: this.listData.mixParam,
- startDate: this.listData.startDate,
- endDate: this.listData.endDate,
- procedureIdList: this.listData.procedureIds ? this.listData.procedureIds : [],
- factoryId: this.listData.departIds,
- statusList: this.listData.cateIds
- },
- page: this.listData.page,
- sorts: [{
- direction: 'ASC',
- property: 'publishDate'
- }]
- }).then(res => {
- this.loading = false
- this.listData.total = res.data.total
- if (this.refreshing) {
- this.lists = []
- this.refreshing = false;
- }
- if (res.code === 200 && res.data.records.length !== 0) {
- if (this.lists.length === 0) {
- this.lists = res.data.records
- } else {
- this.lists.push(...res.data.records)
- }
- } else {
- this.finished = true
- }
- }).catch(err => {
- this.loading = false
- this.finished = true
- if (this.refreshing) {
- this.lists = []
- this.refreshing = false;
- }
- })
- }
+ this.controlData.page = 0;
+ this.controlData.finished = false;
+ this.list = [];
+ this.getLists();
}
}
}
--
Gitblit v1.9.3