Quellcode durchsuchen

Merge branch 'master' of http://110.41.163.243:9980/kd-aiot/aiot-app into dengfei

695593266@qq.com vor 11 Monaten
Ursprung
Commit
66eb596608

+ 51 - 0
api/home/index.js

@@ -0,0 +1,51 @@
+import {
+	postJ,
+	post,
+	get
+} from '@/utils/request'
+import Vue from 'vue'
+
+// 成品总量和物流总量
+export async function getCount(params) {
+	const data = await get(Vue.prototype.apiUrl + `wms/index/query`, params)
+	if (data.code == 0) {
+		return data.data
+	}
+	return Promise.reject(new Error(data.message))
+}
+
+// 获取年度合同总金额
+export async function getYearAmount(params) {
+	const data = await get(Vue.prototype.apiUrl + `/eom/contract/getYearAmount`, params)
+	if (data.code == 0) {
+		return data.data
+	}
+	return Promise.reject(new Error(data.message))
+}
+
+// 获取应付金额
+export async function getPayableAmount(params) {
+	const data = await get(Vue.prototype.apiUrl + `/eom/finpayable/getPayableAmount`, params)
+	if (data.code == 0) {
+		return data.data
+	}
+	return Promise.reject(new Error(data.message))
+}
+
+// 获取应收金额
+export async function getReceivableAmount(params) {
+	const data = await get(Vue.prototype.apiUrl + `/eom/finreceivable/getReceivableAmount`, params)
+	if (data.code == 0) {
+		return data.data
+	}
+	return Promise.reject(new Error(data.message))
+}
+
+// 获取商品分页
+export async function getGoodsPage(params) {
+	const data = await get(Vue.prototype.apiUrl + `/eom/goods/page`, params)
+	if (data.code == 0) {
+		return data.data
+	}
+	return Promise.reject(new Error(data.message))
+}

+ 14 - 11
pages/home/components/navigation.vue

@@ -9,7 +9,10 @@
 </template>
 
 <script>
-	import { getTodoTaskPage,getUnreadNotifyMessageCountAPI } from '@/api/wt/index.js'
+	import {
+		getTodoTaskPage,
+		getUnreadNotifyMessageCountAPI
+	} from '@/api/wt/index.js'
 	export default {
 		props: {
 			workOrder: {
@@ -18,8 +21,7 @@
 		},
 		data() {
 			return {
-				workList: [
-					{
+				workList: [{
 						class: 'iconfont icon-bianji',
 						title: '工单待办',
 						link_url: '/pages/home/myTicket/myTicket?orderType=1',
@@ -96,7 +98,7 @@
 				//     // this.workList[3].badge = result[1].data.doneCount
 				//   }
 				// })
-				
+
 				const res = await getTodoTaskPage({}, false)
 				this.workList[2].badge = res.count
 				const messageCount = await getUnreadNotifyMessageCountAPI()
@@ -109,16 +111,16 @@
 <style lang="scss" scoped>
 	// 选项卡
 	.nav {
-		width: 94%;
-		margin: 25rpx auto;
-		padding: 30rpx 0;
 		display: flex;
+		width: 100%;
+		padding: 32rpx 0;
+		margin-bottom: 24rpx;
 		align-items: center;
 		justify-content: space-around;
 		background-color: #fff;
-		font-size: $uni-font-size-base;
-		color: $uni-text-regular-color;
-		border-radius: 10rpx;
+		font-size: $uni-font-size-sm;
+		color: $uni-text-color;
+		border-radius: 16rpx;
 
 		.nav-item {
 			position: relative;
@@ -164,8 +166,9 @@
 		.nav-item:nth-child(4) span {
 			background-color: $uni-color-error;
 		}
+
 		.nav-item:nth-child(5) span {
 			background-color: $uni-color-success;
 		}
 	}
-</style>
+</style>

+ 304 - 18
pages/home/home.vue

@@ -1,17 +1,149 @@
 <template>
 	<view>
-		<uni-nav-bar fixed="true" statusBar="true" right-icon="scan" title="工作台" @clickLeft="back"
+		<!-- 头 -->
+		<uni-nav-bar fixed="true" statusBar="true" right-icon="scan" title="首页" @clickLeft="back"
 			@clickRight="HandlScanCode"></uni-nav-bar>
 		<!-- <uni-nav-bar fixed="true" statusBar="true" title="工作台"></uni-nav-bar> -->
-		<navigation :workOrder="workOrder" ref="navigationRef"></navigation>
-		<!-- 设备主管 -->
-		<equipment v-if="roleId == 102" ref="equipmentRef"></equipment>
-		<!-- 运维 -->
-		<Mocha v-if="roleId == 157" ref="mochaRef"></Mocha>
-		<!-- 模具舟皿 -->
-		<mould v-if="roleId == 155" ref="mouldRef"></mould>
-		<!-- 备品备件 -->
-		<sparePart v-if="roleId == 150" ref="sparePartRef"></sparePart>
+
+		<view class="container">
+			<navigation :workOrder="workOrder" ref="navigationRef"></navigation>
+			<!-- 设备主管 -->
+			<equipment v-if="roleId == 102" ref="equipmentRef"></equipment>
+			<!-- 运维 -->
+			<Mocha v-if="roleId == 157" ref="mochaRef"></Mocha>
+			<!-- 模具舟皿 -->
+			<mould v-if="roleId == 155" ref="mouldRef"></mould>
+			<!-- 备品备件 -->
+			<sparePart v-if="roleId == 150" ref="sparePartRef"></sparePart>
+
+			<view class="data-middle">
+				<view class="cell">
+					<view class="num">
+						{{homeData.totalFinishedProducts}}
+					</view>
+					<view class="label">
+						成品库存总量
+					</view>
+				</view>
+
+				<view class="cell">
+					<view class="num">
+						{{homeData.totalRawMaterials}}
+					</view>
+					<view class="label">
+						物料库存总量
+					</view>
+				</view>
+
+				<view class="cell">
+					<view class="num">
+						{{homeData.goodsCount}}
+					</view>
+					<view class="label">
+						商品列表
+					</view>
+				</view>
+
+				<view class="cell">
+					<view class="num">
+						{{homeData.yearAmount}}
+					</view>
+					<view class="label">
+						年度合同金额(万元)
+					</view>
+				</view>
+
+				<view class="cell">
+					<view class="num">
+						{{homeData.receivableAmount}}
+					</view>
+					<view class="label">
+						应收金额(万元)
+					</view>
+				</view>
+
+				<view class="cell">
+					<view class="num">
+						{{homeData.payableAmount}}
+					</view>
+					<view class="label">
+						应付金额(万元)
+					</view>
+				</view>
+			</view>
+
+			<view class="data-rank">
+				<view class="tab-top">
+					<view class="tab-item" v-for="(item,index) in tabList" :key="index">
+						<view :class="{active: activeIndex == item.index}" @click="handleTabChange(item)">
+							{{item.name}}
+						</view>
+					</view>
+				</view>
+
+
+				<uni-table class="table" ref="table" emptyText="暂无更多数据">
+					<uni-tr class="table-title">
+						<uni-th align="center">产品编码</uni-th>
+						<uni-th align="center">名称</uni-th>
+						<uni-th align="center">销量</uni-th>
+					</uni-tr>
+					<uni-tr v-for="(item, index) in 4" :key="index">
+						<uni-td>1.cp1001</uni-td>
+						<uni-td>产品名称</uni-td>
+						<uni-td align="center">5000(pcs)</uni-td>
+					</uni-tr>
+				</uni-table>
+
+			</view>
+
+
+
+
+
+			<view class="data-bottom">
+				<view class="cell">
+					<view class="num">
+						28
+					</view>
+					<view class="label">
+						年度生产总量
+					</view>
+				</view>
+
+				<view class="cell">
+					<view class="num">
+						28
+					</view>
+					<view class="label">
+						月生产总量
+					</view>
+				</view>
+
+				<view class="cell">
+					<view class="num">
+						28
+					</view>
+					<view class="label">
+						待生产总量
+					</view>
+				</view>
+
+
+
+
+
+
+			</view>
+
+
+
+		</view>
+
+
+
+
+
 		<!-- <ScanCode ref="ScanCode" :model="'uni'"></ScanCode> -->
 	</view>
 </template>
@@ -31,6 +163,14 @@
 	import {
 		statistics
 	} from '@/api/myTicket'
+	import {
+		getCount,
+		getYearAmount,
+		getPayableAmount,
+		getReceivableAmount,
+		getGoodsPage
+	}
+	from '@/api/home'
 	export default {
 		components: {
 			navigation,
@@ -52,6 +192,7 @@
 			// this.Scancodedate()
 		},
 		onLoad() {
+			this.getHomeData()
 			this.getStatistics()
 		},
 		onUnload() {
@@ -77,22 +218,35 @@
 					repairsNum: 0,
 					total: 0
 				}, // 工单统计数据
+				activeIndex: 0,
+				tabList: [{
+					name: '热销品排行榜',
+					index: 0,
+				}, {
+					name: '滞销品排行榜',
+					index: 1,
+				}],
+				tableData: [],
+				homeData: {
+					totalFinishedProducts: '',
+					totalRawMaterials: '',
+					goodsCount: '',
+					yearAmount: '',
+					receivableAmount: '',
+					payableAmount: ''
+				}
 			}
 		},
 		created() {
 			uni.getStorage({
 				key: 'userInfo',
 				success: res => {
-					this.roleId = res.data.role.id
+					console.log(res);
+					this.roleId = res.data.roleId[0]
 				}
 			})
 		},
 		methods: {
-			getStatistics() { // 获取工单统计数
-				statistics().then(res => {
-					this.workOrder = res
-				})
-			},
 			init() {
 				this.$refs.navigationRef && this.$refs.navigationRef.getCount()
 				this.$refs.equipmentRef && this.$refs.equipmentRef.getData()
@@ -105,9 +259,15 @@
 					this.init()
 				}, 12000)
 			},
+			// 获取工单统计数
+			getStatistics() {
+				statistics().then(res => {
+					this.workOrder = res
+				})
+			},
+
 			// 相机扫码
 			HandlScanCode() {
-				
 				uni.scanCode({
 					success: (res) => {
 						this.Scancodedate(res.result)
@@ -179,13 +339,139 @@
 					}
 				}
 				return result
+			},
+			// 切换排行版tab
+			handleTabChange(item) {
+				this.activeIndex = item.index
+				// console.log(item);
+			},
+			async getHomeData() {
+				const res1 = await getCount()
+				const res2 = await getGoodsPage()
+				const res3 = await getYearAmount()
+				const res4 = await getReceivableAmount()
+				const res5 = await getPayableAmount()
+				
+				console.log(res3);
+
+
+				this.homeData.totalFinishedProducts = res1.totalFinishedProducts
+				this.homeData.totalRawMaterials = res1.totalRawMaterials
+				this.homeData.goodsCount = res2.count
+				this.homeData.yearAmount =  (res3/10000).toFixed(2)
+				this.homeData.receivableAmount = res4
+				this.homeData.payableAmount = res5
+
+
 			}
+
 		}
 	}
 </script>
 
 <style lang="scss" scoped>
+	/deep/.uni-table {
+		min-width: auto !important;
+		border-radius: 0;
+	}
+
 	page {
 		background-color: $page-bg;
 	}
-</style>
+
+	.container {
+		padding: 20rpx;
+
+		.data-middle {
+			display: flex;
+			flex-wrap: wrap;
+			justify-content: space-between;
+
+			.cell {
+				display: flex;
+				width: 30%;
+				padding: 20rpx 0;
+				margin-bottom: 20rpx;
+				flex-direction: column;
+				background-color: rgb(22, 146, 50);
+				justify-content: center;
+				align-items: center;
+				border-radius: 10rpx;
+				color: #fff;
+
+				.num {
+					font-size: 48rpx;
+				}
+
+				.label {
+
+					font-size: 20rpx;
+				}
+			}
+
+		}
+
+		.data-rank {
+			width: 100%;
+			padding: 10rpx 20rpx 0 20rpx;
+			margin-bottom: 20rpx;
+			background-color: #fff;
+			border-radius: 20rpx 20rpx 0 0rpx;
+
+			.tab-top {
+				display: flex;
+
+				.tab-item {
+					margin-right: 20rpx;
+
+					.active {
+						border-bottom: 2px solid rgb(22, 146, 50);
+					}
+				}
+			}
+
+			.table {
+				.table-title {
+					/deep/ .uni-table-th {
+						font-size: 26rpx;
+						font-weight: 400;
+						color: #000;
+					}
+
+				}
+			}
+
+
+		}
+
+
+		.data-bottom {
+			display: flex;
+			flex-wrap: wrap;
+			justify-content: space-between;
+
+			.cell {
+				display: flex;
+				width: 30%;
+				padding: 20rpx 0;
+				margin-bottom: 20rpx;
+				flex-direction: column;
+				background-color: #fff;
+				justify-content: center;
+				align-items: center;
+				border-radius: 10rpx;
+				color: #000;
+
+				.num {
+					font-size: 48rpx;
+				}
+
+				.label {
+
+					font-size: 20rpx;
+				}
+			}
+		}
+
+	}
+</style>

+ 4 - 36
pages/index/index.vue

@@ -422,41 +422,7 @@
 				treeList: [],
 				saleManageList: [],
 				// 售后服务
-				serviceList: [{
-						name: '售后需求',
-						url: `/pages/salesServiceManagement/demandList/index`,
-						path: '/pages/salesServiceManagement/demandList/index',
-						icon: 'icon-gongdanguanli',
-						badge: 0
-					},
-					{
-						name: '售后工单',
-						url: `/pages/salesServiceManagement/workOrder/index`,
-						path: '/pages/salesServiceManagement/workOrder/index',
-						icon: 'icon-gongdanguanli',
-						badge: 0
-					},
-					{
-						name: '配件申请记录',
-						url: `/pages/salesServiceManagement/accessory/index`,
-						path: '/pages/salesServiceManagement/accessory/index',
-						icon: 'icon-gongdanguanli',
-						badge: 0
-					},
-					{
-						name: '配件回收记录',
-						url: `/pages/salesServiceManagement/recycle/index`,
-						path: '/pages/salesServiceManagement/recycle/index',
-						icon: 'icon-gongdanguanli',
-						badge: 0
-					},
-					// {
-					// 	name: '发货确认单',
-					// 	url: `/pages/invoiceConfirm/index`,
-					// 	icon: 'icon-gongdanguanli',
-					// 	badge: 0
-					// }
-				]
+				serviceList: []
 			}
 		},
 		created() {
@@ -488,6 +454,7 @@
 				console.log('-----------list--------------')
 				console.log(list)
 				if (list[0] && list[0].children.length > 0) {
+					console.log(list[0].children, 'list[0].children ----')
 					list[0].children.forEach(f => {
 						if (f.path == 'productionManage') {
 							this.productionList = f.children
@@ -515,8 +482,9 @@
 							console.log(f, 'f')
 							this.internalManagementList = f.children
 
+						} else if (f.path == 'serviceList') {
+							this.serviceList = f.children;
 						}
-
 					})
 				}
 			},

+ 4 - 3
pages/salesServiceManagement/accessory/accessoryAdd.vue

@@ -198,6 +198,10 @@
 				console.log(this.form, 'form')
 			},
 			save() {
+				uni.redirectTo({
+					url: '/pages/salesServiceManagement/accessory/index'
+				});
+				return
 				if (!this.form.name) {
 					this.$refs.uToast.show({
 						type: "warning",
@@ -238,9 +242,6 @@
 						type: "success",
 						message: "操作成功",
 					})
-					uni.redirectTo({
-						url: '/pages/login/login'
-					});
 				}).catch((err) => {
 					console.log(err, 'err --')
 				})

+ 3 - 0
pages/salesServiceManagement/accessory/index.vue

@@ -152,6 +152,9 @@
 			}
 		},
 		created() {
+			
+		},
+		onShow() {
 			this.doSearch();
 		},
 		methods: {

+ 5 - 4
pages/salesServiceManagement/workOrder/components/editPlan.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="">
 		<uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back"
-			:title="title" @clickLeft="backAdd">
+			:title="title" @clickLeft="back">
 		</uni-nav-bar>
 		<view class="scrollable-tabs" ref="tabsContainer">
 			<u-subsection :list="tabs" :current="currentIndex" @change="(e)=>sectionChange(e)"></u-subsection>
@@ -22,7 +22,7 @@
 		<!-- 报工信息 -->
 		<ReportInfo ref="reportInfoRef" :form="reportForm" v-show="currentValue == 1" />
 		<view :class=" type == 'report' ? 'footerButton footer_button':'footerButton'" v-if="isDisable">
-			<u-button type="default" text="返回" @click="backAdd"></u-button>
+			<u-button type="default" text="返回" @click="back"></u-button>
 			<u-button type="primary" text="报工" v-if="type == 'report'" @click="save('report')"></u-button>
 			<u-button type="primary" @click="save" text="保存"></u-button>
 		</view>
@@ -333,14 +333,15 @@
 						message: "操作成功",
 					})
 					uni.hideLoading();
-					this.backAdd();
+					this.back();
 				}).catch(e => {
 					uni.hideLoading();
 				})
 			},
 			//返回添加页
 			backAdd() {
-				uni.navigateBack();
+				this.back();
+				// uni.navigateBack();
 			},
 			// confirm(data, name) {
 			// 	this.form.executeGroupName = name

+ 3 - 0
pages/salesServiceManagement/workOrder/index.vue

@@ -299,6 +299,9 @@
 		},
 		computed: {},
 		onLoad() {
+			
+		},
+		onShow() {
 			this.doSearch();
 		},
 		created() {

+ 6 - 0
static/common.scss

@@ -1,3 +1,9 @@
+*{
+	padding: 0;
+	margin: 0;
+	box-sizing: border-box;
+}
+
 .flex-space-between{
 	display: flex;
 	justify-content: space-between;

+ 127 - 128
utils/request.js

@@ -1,156 +1,155 @@
 const http = ({
-  url = "",
-  content_type = "",
-  param = {},
-  showLoading,
-  ...other
+	url = "",
+	content_type = "",
+	param = {},
+	showLoading,
+	...other
 } = {}) => {
-  if (showLoading) {
-    uni.showLoading({
-      title: "正在加载中",
-    });
-  }
-  return new Promise((resolve, reject) => {
-    // let userId = wx.getStorageSync('userId')
-    // let Authorization = wx.getStorageSync('token')
-    let header = {};
-    const value = uni.getStorageSync("token"); //取存本地的token
-    //登录接口不传token
-    if (value && !url.includes("/user/login")) {
-      header = {
-        "content-type": content_type,
-        "zoomwin-token": value,
-        Authorization: value,
-        "zoomwin-sid": uni.getStorageSync("userInfo").sessionId,
-		
-      };
-    } else {
-      header = {
-        "content-type": content_type,
-        platform: "wxapp",
-      };
-    }
-    uni.request({
-      url: url,
-      data: param,
-      header: header,
-	  timeout: 600000,
-      ...other,
-      complete: (res) => {
-    
-        if (showLoading) {
-          uni.hideLoading();
-        }
+	if (showLoading) {
+		uni.showLoading({
+			title: "正在加载中",
+		});
+	}
+	return new Promise((resolve, reject) => {
+		// let userId = wx.getStorageSync('userId')
+		// let Authorization = wx.getStorageSync('token')
+		let header = {};
+		const value = uni.getStorageSync("token"); //取存本地的token
+		//登录接口不传token
+		if (value && !url.includes("/user/login")) {
+			header = {
+				"content-type": content_type,
+				"zoomwin-token": value,
+				Authorization: value,
+				"zoomwin-sid": uni.getStorageSync("userInfo").sessionId,
 
-        if (res.data.code == "B00103") {
-          uni.navigateTo({
-            url: "/pages/login/login",
-          });
-        } else if (res.data.code == "B00101") {
-          //刷新token
-          uni.showToast({
-            title: "身份验证已过期,请重新登录",
-            icon: "none",
-            mask: true,
-            duration: 1500,
-          });
-          console.log('身份验证已过期,请重新登录------');
-          uni.removeStorageSync("token");
-          uni.removeStorageSync("userInfo");
-		  uni.removeStorageSync('treeList')
-          setTimeout(() => {
-            wx.navigateTo({
-              url: "/pages/login/login",
-            });
-          }, 1500);
-        } else if (res.data.code == -1) {
-          wx.showToast({
-            title: res.data.message,
-            icon: "none",
-          });
-        } else {
-          resolve(res.data);
-        }
-      },
-    });
-  });
+			};
+		} else {
+			header = {
+				"content-type": content_type,
+				platform: "wxapp",
+			};
+		}
+		uni.request({
+			url: url,
+			data: param,
+			header: header,
+			timeout: 600000,
+			...other,
+			complete: (res) => {
+				if (showLoading) {
+					uni.hideLoading();
+				}
+				if (res.data.code == "B00103") {
+					uni.navigateTo({
+						url: "/pages/login/login",
+					});
+				} else if (res.data.code == "B00101") {
+					//刷新token
+					uni.showToast({
+						title: "身份验证已过期,请重新登录",
+						icon: "none",
+						mask: true,
+						duration: 1500,
+					});
+					console.log('身份验证已过期,请重新登录------');
+					uni.removeStorageSync("token");
+					uni.removeStorageSync("userInfo");
+					uni.removeStorageSync('treeList')
+					setTimeout(() => {
+						wx.navigateTo({
+							url: "/pages/login/login",
+						});
+					}, 1500);
+				} else if (res.data.code == -1) {
+					wx.showToast({
+						title: res.data.message,
+						icon: "none",
+					});
+				} else {
+					resolve(res.data);
+				}
+			},
+		});
+	});
 };
 
 // get方法
 const get = (url, param = {}, showLoading) => {
-  return http({
-    url,
-    param,
-    showLoading,
-    content_type: "application/x-www-form-urlencoded",
-  });
+	return http({
+		url,
+		param,
+		showLoading,
+		content_type: "application/x-www-form-urlencoded",
+	});
 };
 // get方法
 const getJ = (url, param = {}, showLoading) => {
-  return http({
-    url,
-    param,
-    showLoading,
-    content_type: "application/json",
-  });
+	return http({
+		url,
+		param,
+		showLoading,
+		content_type: "application/json",
+	});
 };
 
 // post方法
 const post = (url, param = {}, showLoading) => {
-  return http({
-    url,
-    param,
-    showLoading,
-    method: "POST",
-    content_type: "application/x-www-form-urlencoded",
-  });
+	return http({
+		url,
+		param,
+		showLoading,
+		method: "POST",
+		content_type: "application/x-www-form-urlencoded",
+	});
 };
 // post方法
 const postJ = (url, param = {}, showLoading) => {
-  return http({
-    url,
-    param,
-    showLoading,
-    method: "post",
-    content_type: "application/json",
-  });
+	return http({
+		url,
+		param,
+		showLoading,
+		method: "post",
+		content_type: "application/json",
+	});
 };
 
 // put方法
 const put = (url, param = {}, showLoading) => {
-  return http({
-    url,
-    data:param,
-    showLoading,
-    method: "PUT",
-    content_type: "application/x-www-form-urlencoded",
-  });
+	return http({
+		url,
+		data: param,
+		showLoading,
+		method: "PUT",
+		content_type: "application/x-www-form-urlencoded",
+	});
 };
 const putJ = (url, param = {}, showLoading) => {
-  return http({
-    url,
-    data:param,
-    showLoading,
-    method: "PUT",
-    content_type: "application/json",
-	
-  });
+	return http({
+		url,
+		data: param,
+		showLoading,
+		method: "PUT",
+		content_type: "application/json",
+
+	});
 };
 //删除
 const deleteApi = (url, data = {}, showLoading) => {
-  return http({
-    url,
-    data,
-    showLoading,
-    method: "DELETE",
-	content_type: "application/json",
-  });
+	return http({
+		url,
+		data,
+		showLoading,
+		method: "DELETE",
+		content_type: "application/json",
+	});
 };
 module.exports = {
-  get,
-  getJ,
-  post,
-  postJ,
-  put,
-  putJ,deleteApi
-};
+	get,
+	getJ,
+	post,
+	postJ,
+	put,
+	putJ,
+	deleteApi
+};