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/plannedDistribution/plannedDistribution.vue | 401 +++++++++++++++------------------------------------------
1 files changed, 107 insertions(+), 294 deletions(-)
diff --git a/minipro_standard/pages/plannedDistribution/plannedDistribution.vue b/minipro_standard/pages/plannedDistribution/plannedDistribution.vue
index de67bb9..b78ec83 100644
--- a/minipro_standard/pages/plannedDistribution/plannedDistribution.vue
+++ b/minipro_standard/pages/plannedDistribution/plannedDistribution.vue
@@ -1,14 +1,21 @@
<template>
<view class="content">
<view class="content_search">
- <Search @searchInput="searchInput" @submit="submit" @reset="reset" placeholder="鎼滅储鐗╂枡鍚嶇О/缂栫爜"></Search>
- <view class="content_search_x"></view>
+ <Search @searchInput="searchInput" placeholder="鎼滅储鐗╂枡鍚嶇О/缂栫爜"></Search>
+ <view class="content_search_x" v-if="tagList.length > 0"></view>
<LabelSelection :TagList="tagList" :isShow="true" @change="clickTag" />
</view>
- <view class="content_total" :style="{top: top}">鍏眥{listData.total}}鏉℃暟鎹�</view>
+ <view class="content_total" :style="{top: top}">鍏眥{search.total}}鏉℃暟鎹�</view>
<view class="content_list">
- <scroll-view @scrolltolower="getLists" scroll-y :style="{height: height}">
- <view class="fp_list_item" v-for="(item, i) in lists" :key="item.id" @click="clickItem(i)">
+ <scroll-view
+ :refresher-enabled="true"
+ :refresher-triggered="isLoading"
+ @refresherrefresh="onRefresh"
+ refresher-background="#fff"
+ @scrolltolower="getLists"
+ scroll-y
+ :style="{height: height}">
+ <view class="fp_list_item" v-for="(item, i) in list" :key="item.id" @click="clickItem(i)">
<view class="fp_list_item_header">
<u-checkbox :checked="item.isActive"></u-checkbox>
<text v-if="item.mmodel">{{item.mmodel.name}}</text>
@@ -44,7 +51,7 @@
</view>
<view class="fp_zw"></view>
<view class="fp_footer">
- <view class="fp_footer_button" @click="submit">鍒嗛厤(1)</view>
+ <view class="fp_footer_button" @click="submit">鍒嗛厤</view>
</view>
</view>
</template>
@@ -52,158 +59,27 @@
<script>
import Search from '@/components/Search.vue'
import LabelSelection from '@/components/LabelSelection.vue'
+ import { getList, getSelfList } from '@/util/api/PlanningAPI'
export default {
components: { Search, LabelSelection },
data() {
return {
height: '',
top: '',
- listData: {
+ isLoading: false,
+ search: {
+ gxId: '',
capacity: 10,
page: 0,
total: 0,
- startDate: '',
- endDate: '',
- procedureIds: [],
- departIds: '',
mixParam: '',
- cateIds: []
+ first: true // 鐢ㄤ簬鍒ゆ柇鏄惁鏄涓�娆¤繘鍏ラ〉闈�
},
- tagList: [
- {
- id: '',
- name: '娉ㄥ皠',
- num: '0'
- },
- {
- id: '0',
- name: '鐑х粨',
- num: '0'
- },
- {
- id: '1,4',
- name: '鐒婃帴',
- num: '0'
- }
- ],
- data: [], // 宸ュ簭鏁版嵁
- factoryList: [],
- finished: true,
+ tagList: [],
+ finished: false,
loading: false,
refreshing: false,
- timeShow: false,
- lists: [
- {
- id: 1,
- status: 0,
- urgent: 1,
- num: 100,
- isActive: false,
- batch: '11111',
- planDate: '2023-08-29',
- mmodel: {
- name: '宸ュ簭璁″垝',
- code: 'fbdseasafghb'
- },
- usermodel: {
- realname: '璁″垝浜哄憳'
- },
- pmodel: {
- name: '宸ュ簭璁″垝'
- },
- fmodel: {
- name: '宸ュ巶'
- }
- },
- {
- id: 2,
- status: 0,
- urgent: 1,
- num: 100,
- isActive: false,
- batch: '11111',
- planDate: '2023-08-29',
- mmodel: {
- name: '宸ュ簭璁″垝',
- code: 'fbdseasafghb'
- },
- usermodel: {
- realname: '璁″垝浜哄憳'
- },
- pmodel: {
- name: '宸ュ簭璁″垝'
- },
- fmodel: {
- name: '宸ュ巶'
- }
- },
- {
- id: 3,
- status: 0,
- urgent: 1,
- num: 100,
- batch: '11111',
- isActive: false,
- planDate: '2023-08-29',
- mmodel: {
- name: '宸ュ簭璁″垝',
- code: 'fbdseasafghb'
- },
- usermodel: {
- realname: '璁″垝浜哄憳'
- },
- pmodel: {
- name: '宸ュ簭璁″垝'
- },
- fmodel: {
- name: '宸ュ巶'
- }
- },
- {
- id: 4,
- status: 0,
- urgent: 1,
- num: 100,
- isActive: false,
- batch: '11111',
- planDate: '2023-08-29',
- mmodel: {
- name: '宸ュ簭璁″垝',
- code: 'fbdseasafghb'
- },
- usermodel: {
- realname: '璁″垝浜哄憳'
- },
- pmodel: {
- name: '宸ュ簭璁″垝'
- },
- fmodel: {
- name: '宸ュ巶'
- }
- },
- {
- id: 5,
- status: 0,
- urgent: 1,
- num: 100,
- isActive: false,
- batch: '11111',
- planDate: '2023-08-29',
- mmodel: {
- name: '宸ュ簭璁″垝',
- code: 'fbdseasafghb'
- },
- usermodel: {
- realname: '璁″垝浜哄憳'
- },
- pmodel: {
- name: '宸ュ簭璁″垝'
- },
- fmodel: {
- name: '宸ュ巶'
- }
- }
- ]
+ list: []
};
},
onReady() {
@@ -215,192 +91,129 @@
}).exec()
})
},
+ onLoad() {
+ this.getLists()
+ },
methods: {
+ // 涓嬫媺鍒锋柊
+ onRefresh() {
+ if (this.isLoading) return
+ this.isLoading = true
+ this.search.page = 0
+ this.list = []
+ this.finished = false
+ this.getLists()
+ },
// 鐐瑰嚮褰撳墠椤�
clickItem(i) {
- this.lists.forEach((item, index) => {
+ this.list.forEach((item, index) => {
item.isActive = i === index;
})
},
- // 璺宠浆
- jump(item) {
- uni.navigateTo({
- url: `/pages/planDetails/planDetails?id=${item.id}`
- })
- },
- // 鑾峰彇澶撮儴缁勪欢楂樺害
- 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
- }
- })
- },
- // 鎵撳紑鏃ユ湡鎻掍欢
- openDate() {
- this.timeShow = true
- },
// 鎼滅储
- searchInput(val) {
- this.listData.mixParam = val
- this.listData.page = 0
+ searchInput(e) {
+ this.search.mixParam = e
+ this.search.page = 0
+ this.list = []
this.finished = false
- this.lists = []
this.getLists()
},
- // 鐐瑰嚮鏍囩鎼滅储
- clickTag(ids) {
- this.listData.cateIds = ids
- this.listData.page = 0
+ // 鐐瑰嚮
+ clickTag(id) {
+ this.search.gxId = id
+ this.list = []
+ this.search.page = 0
this.finished = false
- this.lists = []
- // this.getLists()
+ 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 data;
- this.lists.forEach(item => {
+ this.list.forEach((item) => {
if (item.isActive) {
data = item
}
})
if (!data) {
- uni.showToast({ title: '鑷冲皯閫夋嫨涓�椤硅鍒掞紒', duration: 2000 });
+ uni.showToast({ title: '鑷冲皯閫夋嫨涓�椤硅鍒掞紒', icon: 'none', duration: 2000 });
return
}
uni.navigateTo({
url: `/pages/allocation/allocation?gxid=${data.procedureId}&jhid=${data.id}&num=${data.workorderDistributNum ? data.num - data.workorderDistributNum : data.num}`
- })
+ });
+ },
+ // 鑾峰彇褰撳墠鐢ㄦ埛鎵�鍒嗛厤鐨勫伐搴�
+ async getWorkingProcedures() {
+ let res = await getSelfList({})
+ if (res.code === 200 && res.data.length > 0) {
+ let arr = []
+ res.data.forEach((item) => {
+ arr.push({ name: item.name, id: item.id })
+ })
+ this.search.gxId = arr[0].id
+ this.tagList = arr
+ return true
+ }
+ return false
},
// 鑾峰彇璁″垝鍒楄〃鏁版嵁
- getLists() {
- console.log('getLists')
+ async 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'
+ this.search.page = this.search.page += 1
+ if (this.search.first) { // 濡傛灉鏄涓�娆★紝鍏堣姹傚伐搴�
+ await this.getWorkingProcedures()
+ let res = await getList({
+ capacity: this.search.capacity,
+ page: this.search.page,
+ model: {
+ mixParam: this.search.mixParam,
+ procedureId: this.search.gxId,
+ statusList: [1, 4]
}
- ]
- }).then(res => {
+ })
+ this.isLoading = false
this.loading = false
- this.listData.total = res.data.total
if (this.refreshing) {
- this.lists = []
+ this.list = []
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)
- }
+ this.search.total = res.data.total
+ res.data.records.forEach((item) => {
+ item.isActive = false
+ })
+ this.list.push(...res.data.records)
} else {
- this.finished = true
+ this.finished = true;
}
- }).catch(err => {
- this.loading = false
- this.finished = true
+ this.search.first = false
+ } else {
+ let res = await getList({
+ capacity: this.search.capacity,
+ page: this.search.page,
+ model: {
+ mixParam: this.search.mixParam,
+ procedureId: this.search.gxId,
+ statusList: [1, 4]
+ }
+ })
+ this.isLoading = false
if (this.refreshing) {
- this.lists = []
+ this.list = []
this.refreshing = false;
}
- })
+ this.loading = false
+ if (res.code === 200 && res.data.records.length !== 0) {
+ res.data.records.forEach((item) => {
+ item.isActive = false
+ })
+ this.list.push(...res.data.records)
+ this.search.total = res.data.total
+ } else {
+ this.finished = true;
+ }
+ }
}
}
}
@@ -583,7 +396,7 @@
z-index: 99;
}
.fp_zw {
- height: 150px;
+ height: calc(98rpx + env(safe-area-inset-bottom));
}
.fp_footer {
width: 100%;
--
Gitblit v1.9.3