Browse Source

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

695593266@qq.com 1 year ago
parent
commit
1fd88c93bb
31 changed files with 1281 additions and 346 deletions
  1. 32 2
      api/home/index.js
  2. 12 1
      api/myTicket/index.js
  3. 30 6
      api/salesServiceManagement/accessory/index.js
  4. 9 0
      api/salesServiceManagement/demandList/index.js
  5. 27 0
      api/salesServiceManagement/workOrder/index.js
  6. 15 0
      api/wt/index.js
  7. 5 7
      components/ServerSetting/index.vue
  8. 1 0
      main.js
  9. 8 0
      pages.json
  10. 4 19
      pages/home/components/navigation.vue
  11. 171 37
      pages/home/home.vue
  12. 1 0
      pages/home/myTicket/myTicket.vue
  13. 50 18
      pages/home/wt/message/message.vue
  14. 1 1
      pages/maintenance/detail/detail.vue
  15. 11 0
      pages/saleManage/businessOpportunity/add.vue
  16. 21 12
      pages/saleManage/components/myCard.vue
  17. 4 9
      pages/saleManage/components/selectUser.vue
  18. 1 1
      pages/saleManage/contact/add.vue
  19. 3 3
      pages/saleManage/contact/adminIndex.vue
  20. 17 1
      pages/saleManage/contact/contactList.vue
  21. 33 14
      pages/salesServiceManagement/accessory/accessoryAdd.vue
  22. 3 9
      pages/salesServiceManagement/accessory/components/searchSelect.vue
  23. 51 9
      pages/salesServiceManagement/accessory/index.vue
  24. 59 35
      pages/salesServiceManagement/demandList/index.vue
  25. 101 0
      pages/salesServiceManagement/demandList/screen.vue
  26. 83 6
      pages/salesServiceManagement/recycle/index.vue
  27. 325 0
      pages/salesServiceManagement/recycle/recycleAdd.vue
  28. 17 5
      pages/salesServiceManagement/workOrder/components/accessoryList.vue
  29. 16 3
      pages/salesServiceManagement/workOrder/index.vue
  30. 2 2
      pages/warehouse/inventory/batch/components/outboundDelivery.vue
  31. 168 146
      utils/utils.js

+ 32 - 2
api/home/index.js

@@ -5,9 +5,10 @@ import {
 } from '@/utils/request'
 import Vue from 'vue'
 
+
 // 成品总量和物流总量
 export async function getCount(params) {
-	const data = await get(Vue.prototype.apiUrl + `wms/index/query`, params)
+	const data = await get(Vue.prototype.apiUrl + `/wms/index/query`, params)
 	if (data.code == 0) {
 		return data.data
 	}
@@ -48,4 +49,33 @@ export async function getGoodsPage(params) {
 		return data.data
 	}
 	return Promise.reject(new Error(data.message))
-}
+}
+
+// 获取年度生产总量
+export async function getProduceAmount(params) {
+	const data = await get(Vue.prototype.apiUrl + `/mes/index/completionCount`, params)
+	// console.log(data);
+	if (data.code == 0) {
+		return data.data
+	}
+	return Promise.reject(new Error(data.message))
+}
+
+// 获取待生产总量
+export async function getPendingAmount(params) {
+	const data = await get(Vue.prototype.apiUrl + `/mes/index/count`, params)
+	if (data.code == 0) {
+		return data.data
+	}
+	return Promise.reject(new Error(data.message))
+}
+
+// 热销榜单
+export async function getHotProduct(params) {
+	const data = await get(Vue.prototype.apiUrl + `/eom/saleorder/getHotProductList`, params)
+	if (data.code == 0) {
+		return data.data
+	}
+	return Promise.reject(new Error(data.message))
+}
+

+ 12 - 1
api/myTicket/index.js

@@ -143,4 +143,15 @@ export async function deviceListQrCode(params) {
 		return data.data
 	}
 	return Promise.reject(new Error(data.message))
-}
+}
+
+// 维修工单获取数据不对,用pc端的接口
+export async function getRepairList(params) {
+	const data = await get(Vue.prototype.apiUrl + `/eam/workorder/getWorkOrderList`, params)
+	console.log(data)
+	if (data.code == 0) {
+		return data.data
+	}
+	return Promise.reject(new Error(data.message))
+}
+

+ 30 - 6
api/salesServiceManagement/accessory/index.js

@@ -1,5 +1,6 @@
 import {
 	get,
+	getJ,
 	put,
 	putJ,
 	postJ,
@@ -9,9 +10,7 @@ import Vue from "vue";
 
 // 配件申请记录 表格
 export async function accessoryPage(data) {
-	const res = await get(Vue.prototype.apiUrl + `/eom/sparePartsApply/page`, {
-		params: data
-	});
+	const res = await get(Vue.prototype.apiUrl + `/eom/sparePartsApply/page`, data);
 	if (res.code == 0) {
 		return res.data;
 	}
@@ -20,9 +19,7 @@ export async function accessoryPage(data) {
 
 // 配件回收记录 表格
 export async function recyclePage(data) {
-	const res = await get(Vue.prototype.apiUrl + `/eom/afterSalesAccessoryApply/page`, {
-		params: data
-	});
+	const res = await get(Vue.prototype.apiUrl + `/eom/afterSalesAccessoryApply/page`, data);
 	if (res.code == 0) {
 		return res.data;
 	}
@@ -46,3 +43,30 @@ export async function accessoryUpdate(data) {
 	}
 	return Promise.reject(new Error(res.message));
 }
+
+// 配件申请记录 表格 详情
+export async function accessoryInfo(id) {
+	const res = await get(Vue.prototype.apiUrl + `/eom/sparePartsApply/getById/${id}`);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+// 配件申请记录 表格 删除
+export async function accessoryDelete(data) {
+	const res = await deleteApi(Vue.prototype.apiUrl + '/eom/sparePartsApply/delete', data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+// 配件回收记录 表格 删除
+export async function recycleDelete(data) {
+	const res = await deleteApi(Vue.prototype.apiUrl + '/eom/afterSalesAccessoryApply/delete', data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}

+ 9 - 0
api/salesServiceManagement/demandList/index.js

@@ -77,3 +77,12 @@ export async function getSalesDemandById(id) {
 	}
 	return Promise.reject(data.message);
 }
+
+// 删除需求 
+export async function deleteSalesDemand(data) {
+	const res = await deleteApi(Vue.prototype.apiUrl + '/eom/afterSalesDemand/delete', data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}

+ 27 - 0
api/salesServiceManagement/workOrder/index.js

@@ -135,3 +135,30 @@ export async function receiveSalesWorkOrder(data) {
 	}
 	return Promise.reject(new Error(res.message));
 }
+
+// 配件回收记录 表格 新增
+export async function recycleSave(data) {
+	const res = await postJ(Vue.prototype.apiUrl + `/eom/afterSalesAccessoryApply/save`, data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+// 配件回收记录 表格 修改
+export async function recycleUpdate(data) {
+	const res = await putJ(Vue.prototype.apiUrl + `/eom/afterSalesAccessoryApply/update`, data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+// 配件回收记录 表格 详情
+export async function recycleDetails(id) {
+	const res = await get(Vue.prototype.apiUrl + `/eom/afterSalesAccessoryApply/getById/${id}`);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}

+ 15 - 0
api/wt/index.js

@@ -49,6 +49,21 @@ export async function getTodoTaskPage(query, loding = true) {
 	}
 	return Promise.reject(new Error(res.message));
 }
+
+export async function getTodoList(query, loding = true) {
+	const res = await postJ(
+		Vue.prototype.apiUrl + `/bpm/task/todo-page`, query, loding
+	);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}
+
+
+
+
+
 //获取已办事项列表
 export async function getDoneTaskPage(query) {
 	const res = await get(

+ 5 - 7
components/ServerSetting/index.vue

@@ -79,11 +79,12 @@
 			},
 
 			serverCheck() {
-				
+
 			},
 			handleTest() {
 				this.setServerStatus = false
 				this.$refs.formRef.validate().then(res => {
+					console.log(res);
 					uni.showLoading({
 						mask: true
 					})
@@ -93,6 +94,7 @@
 						url: `${this.formData.protocal}${this.formData.hostname}:${this.formData.port}/api/main/connection/getConnectionTest`,
 						method: 'get',
 						success: res => {
+							console.log(res);
 							this.url = res.data.code
 							if (res.data.code == 0) {
 								uni.$u.toast('连接成功!')
@@ -101,15 +103,11 @@
 								uni.$u.toast('连接失败!')
 							}
 						},
-						finally: f => {
+						fail: f => {
+							uni.$u.toast('连接失败!')
 							uni.hideLoading()
 						}
 					})
-
-
-
-
-
 				})
 			},
 			handleCheck() {

+ 1 - 0
main.js

@@ -8,6 +8,7 @@ Vue.prototype.$isAuthorities = (authorities)=>{
 	try {
 		let authoritiesLiat=uni.getStorageSync('authorities') //按钮
 		let authoritiesCode=JSON.parse(authoritiesLiat).map(item=>item.permissionCode)
+		console.log(authoritiesCode,'authoritiesCode')
 		return authoritiesCode.includes(authorities)
 	} catch (error) {
 		//TODO handle the exception

+ 8 - 0
pages.json

@@ -2204,6 +2204,14 @@
 						"navigationStyle": "custom",
 						"navigationBarTextStyle": "white"
 					}
+				},
+				{
+					"path": "pages/salesServiceManagement/recycle/recycleAdd", 
+					"style": {
+						"navigationBarTitleText": "配件回收新增",
+						"navigationStyle": "custom",
+						"navigationBarTextStyle": "white"
+					}
 				}
 	],
 	"tabBar": {

+ 4 - 19
pages/home/components/navigation.vue

@@ -10,7 +10,7 @@
 
 <script>
 	import {
-		getTodoTaskPage,
+		getTodoList,
 		getUnreadNotifyMessageCountAPI
 	} from '@/api/wt/index.js'
 	export default {
@@ -84,25 +84,10 @@
 			},
 
 			async getCount() {
-				// Promise.all(
-				//   [
-				//     '/myMessage/getMyMessageMenuCount',
-				//     '/myHandle/getMyHandleMenuCount',
-				//     '/workOrder/getMyWorkOrderMenuCount'
-				//   ].map(url => postJ(this.apiUrl + url, null, null, false))
-				// ).then(result => {
-				//   if (result) {
-				//     this.workList[0].badge = result[2].data.menuCount
-				//     this.workList[1].badge = result[0].data.menuCount
-				//     this.workList[2].badge = result[1].data.waitHandleCount
-				//     // this.workList[3].badge = result[1].data.doneCount
-				//   }
-				// })
-
-				const res = await getTodoTaskPage({}, false)
-				this.workList[2].badge = res.count
+				// const res = await getTodoList({}, false)
+				// this.workList[0].badge = res.count
 				const messageCount = await getUnreadNotifyMessageCountAPI()
-				this.workList[1].badge = Number(messageCount)
+				this.workList[2].badge = Number(messageCount)
 			}
 		}
 	}

+ 171 - 37
pages/home/home.vue

@@ -1,5 +1,5 @@
 <template>
-	<view>
+	<view class="ss">
 		<!-- 头 -->
 		<uni-nav-bar fixed="true" statusBar="true" right-icon="scan" title="首页" @clickLeft="back"
 			@clickRight="HandlScanCode"></uni-nav-bar>
@@ -82,18 +82,35 @@
 				</view>
 
 
-				<uni-table class="table" ref="table" emptyText="暂无更多数据">
+				<!-- <uni-table class="table" ref="table" emptyText="暂无更多数据">
 					<uni-tr class="table-title">
-						<uni-th align="center">产品编码</uni-th>
+						<uni-th align="center" width="100">产品编码</uni-th>
 						<uni-th align="center">名称</uni-th>
-						<uni-th align="center">销量</uni-th>
+						<uni-th align="center" width="100">销量</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 v-for="(item, index) in tableData" :key="index">
+						<uni-td>{{index+1}}.{{item.productCode}}</uni-td>
+						<uni-td>{{item.productName}}</uni-td>
+						<uni-td align="center">{{item.totalSaleCount}}</uni-td>
 					</uni-tr>
-				</uni-table>
+				</uni-table> -->
+
+				<view class="table-title" style="text-align: center;">
+					<view class="code">产品编码</view>
+					<view class="name">名称</view>
+					<view class="total">销量</view>
+				</view>
+				<view class="table-content" v-for="(item,index) in tableData">
+					<view class="code">
+						<view class="index">{{index+1}}.</view>
+						<view class="value">{{item.productCode}}</view>
+
+					</view>
+					<view class="name">{{item.productName}}</view>
+					<view class="total">{{item.totalSaleCount}}</view>
+				</view>
+
+
 
 			</view>
 
@@ -104,7 +121,7 @@
 			<view class="data-bottom">
 				<view class="cell">
 					<view class="num">
-						28
+						{{this.homeData.yearProduceAmount}}
 					</view>
 					<view class="label">
 						年度生产总量
@@ -113,7 +130,7 @@
 
 				<view class="cell">
 					<view class="num">
-						28
+						{{this.homeData.monthProduceAmount}}
 					</view>
 					<view class="label">
 						月生产总量
@@ -122,18 +139,13 @@
 
 				<view class="cell">
 					<view class="num">
-						28
+						{{homeData.pendingAmount}}
 					</view>
 					<view class="label">
 						待生产总量
 					</view>
 				</view>
 
-
-
-
-
-
 			</view>
 
 
@@ -155,6 +167,10 @@
 	import mould from './pages/mould/mould.vue'
 	import sparePart from './pages/sparePart/sparePart.vue'
 	import ScanCode from '@/components/ScanCode.vue'
+
+	import {
+		getDateNew
+	} from '@/utils/utils.js'
 	import {
 		postJ,
 		post,
@@ -168,7 +184,10 @@
 		getYearAmount,
 		getPayableAmount,
 		getReceivableAmount,
-		getGoodsPage
+		getGoodsPage,
+		getProduceAmount,
+		// getPendingAmount,
+		getHotProduct
 	}
 	from '@/api/home'
 	export default {
@@ -233,8 +252,13 @@
 					goodsCount: '',
 					yearAmount: '',
 					receivableAmount: '',
-					payableAmount: ''
-				}
+					payableAmount: '',
+					yearProduceAmount: '',
+					monthProduceAmount: '',
+					pendingAmount: ''
+				},
+				hotProductList: [],
+
 			}
 		},
 		created() {
@@ -343,43 +367,95 @@
 			// 切换排行版tab
 			handleTabChange(item) {
 				this.activeIndex = item.index
+				this.tableData
 				// console.log(item);
 			},
 			async getHomeData() {
+				uni.showLoading({
+					title: '加载中'
+				})
+
+				let params = {
+					startDate: '',
+					endDate: '',
+					factoriesId: 0
+				}
+				let nowYear = getDateNew('year') + '-01-01'
+				let nowMonth = getDateNew('month') + '-01'
+				let now = getDateNew()
+				console.log(now, nowYear, nowMonth);
+				params.endDate = now
+
+
+
+
+
 				const res1 = await getCount()
 				const res2 = await getGoodsPage()
 				const res3 = await getYearAmount()
 				const res4 = await getReceivableAmount()
 				const res5 = await getPayableAmount()
-				
-				console.log(res3);
+				const res6 = await getProduceAmount({
+					...params,
+					startDate: nowYear
+				})
+				const res7 = await getProduceAmount({
+					...params,
+					startDate: nowMonth
+				})
 
 
-				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
+				const res9 = await getHotProduct()
 
 
+				this.homeData.totalFinishedProducts = res1?.totalFinishedProducts ?? 0
+				this.homeData.totalRawMaterials = res1?.totalRawMaterials ?? 0
+				this.homeData.goodsCount = res2?.count ?? 0
+				this.homeData.yearAmount = (res3 / 10000).toFixed(2)
+				this.homeData.receivableAmount = res4 ?? 0
+				this.homeData.payableAmount = res5 ?? 0
+				this.homeData.yearProduceAmount = res6?.reduce((pre, cur) => {
+					return pre + cur?.formedNum
+				}, 0) ?? 0
+
+				this.homeData.monthProduceAmount = res7?.reduce((pre, cur) => {
+					return pre + cur?.formedNum
+				}, 0) ?? 0
+				this.homeData.pendingAmount = res6?.reduce((pre, cur) => {
+					return pre + cur?.pendingProductionCount
+				}, 0) ?? 0
+				this.hotProductList = res9
+				this.tableData = this.hotProductList.slice(0, 4)
+				uni.hideLoading()
+
 			}
 
 		}
 	}
 </script>
 
+<style>
+	page {
+		background-color: #f0f0f0;
+	}
+</style>
+
 <style lang="scss" scoped>
+	// /deep/.uni-page-wrapper{
+	// 	background-color: pink;
+	// }
+
 	/deep/.uni-table {
 		min-width: auto !important;
 		border-radius: 0;
 	}
 
 	page {
-		background-color: $page-bg;
+		background-color: #f0f0f0;
 	}
 
 	.container {
+		background-color: $page-bg;
 		padding: 20rpx;
 
 		.data-middle {
@@ -404,7 +480,6 @@
 				}
 
 				.label {
-
 					font-size: 20rpx;
 				}
 			}
@@ -420,6 +495,7 @@
 
 			.tab-top {
 				display: flex;
+				margin-bottom: 20rpx;
 
 				.tab-item {
 					margin-right: 20rpx;
@@ -430,20 +506,78 @@
 				}
 			}
 
-			.table {
-				.table-title {
-					/deep/ .uni-table-th {
-						font-size: 26rpx;
-						font-weight: 400;
-						color: #000;
-					}
 
+			.table-title {
+				width: 100%;
+				display: flex;
+				color: #333;
+				flex-wrap: nowrap;
+				justify-content: space-between;
+
+				.code {
+					width: 40%;
+					word-break: normal
+				}
+
+				.name {
+					width: 40%;
+					word-break: normal
 				}
+
+				.total {
+					width: 15%;
+					word-break: normal
+				}
+
 			}
 
+			.table-content {
+				display: flex;
+				padding: 10rpx 0;
+				width: 100%;
+				color: #333;
+				flex-wrap: nowrap;
+				justify-content: space-between;
+				border-bottom: 1px solid #eee;
+
+
+				.code {
+					display: flex;
+					width: 40%;
+
+					.index {
+						width: 20rpx;
+						margin-right: 20rpx;
+					}
+
+					.value {
+						word-break: break-all;
+						flex: 1;
+					}
+				}
+
+				.name {
+					width: 40%;
+					white-space: nowarp;
+					over-flow: hidden;
+					text-overflow: ellipsip;
+				}
+
+				.total {
+					text-align: center;
+					width: 15%;
+					white-space: nowarp;
+					over-flow: hidden;
+					text-overflow: ellipsip;
+					word-break: break-all;
+				}
+			}
 
 		}
 
+		.data-rank .table-content:last-child {
+			border-bottom: none;
+		}
 
 		.data-bottom {
 			display: flex;

+ 1 - 0
pages/home/myTicket/myTicket.vue

@@ -522,6 +522,7 @@
 				}
 
 				isEnd = false
+				console.log(params);
 				getWorkOrderList(params)
 					.then(res => {
 						if (res.list?.length > 0 && params.type === this.tabList[this.activeIndex].workOrderType) {

+ 50 - 18
pages/home/wt/message/message.vue

@@ -67,6 +67,7 @@
 			</uni-list>
 
 		</view>
+		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
@@ -76,7 +77,7 @@
 		updateNotifyMessageReadByIdAPI
 	} from '@/api/wt/index.js'
 
-	let [page, isEnd] = [1, false]
+	// let [page, isEnd] = [1, false]
 	export default {
 
 		data() {
@@ -92,23 +93,38 @@
 				messageStatus: {
 					0: '已读',
 					1: '未读'
-				}
+				},
+				page: 1,
+				size: 10,
+				isEnd: false,
+				userInfo: ''
 			}
 		},
 		onReachBottom() {
-			if (isEnd) return
-			page++
+			console.log(this.isEnd, this.page);
 			this.getList()
 		},
 		onShow() {
-			page = 1
-			this.getList()
+			this.doSearch();
+		},
+		onLoad() {
+			this.userInfo = uni.getStorageSync("userInfo")
+			console.log(this.userInfo);
 		},
 		methods: {
+			doSearch() {
+				this.isEnd = false;
+				this.page = 1;
+				this.list = []
+				this.getList();
+			},
 			//已读操作
 			async handleRead(item) {
-				await updateNotifyMessageReadByIdAPI([item.id]);
-				this.getList()
+				const res = await updateNotifyMessageReadByIdAPI([item.id]);
+				if (res.code == 0) {
+					this.list.find(data => item.id === data.id).readStatus = 1
+				}
+				// this.getList()
 			},
 			toggleChecked() {
 				this.checkShow = !this.checkShow
@@ -124,23 +140,39 @@
 					this.list.filter(i => i.messageStatus == 1).map(i => i.id),
 					0
 				)
-				page = 1
+				this.page = 1
 				this.getList()
 			},
 			//获取我的消息列表数据
 			async getList() {
-				let userInfo = wx.getStorageSync("userInfo");
-				const params = {
-					pageNum: page,
-					size: 8,
-					userId: userInfo.userId
+
+				if (this.isEnd) {
+					this.$refs.uToast.show({
+						message: "暂无更多数据",
+						duration: 1000
+					})
+					return
+				}
+
+				uni.showLoading({
+					title: '加载中'
+				})
+
+				let params = {
+					pageNum: this.page,
+					size: this.size,
+					userId: this.userInfo.userId
 				}
+				console.log(params);
 				let res = await notifyMessagePageAPI(params)
-				if (params.page === 1) {
-					this.list = []
+				if (params.pageNum === 1) {
+					this.list = res.list
+				} else {
+					this.list.push(...res.list)
 				}
-				this.list.push(...res.list)
-				isEnd = this.list.length >= res.count
+				this.page += 1
+				this.isEnd = this.list.length >= res.count;
+
 			},
 			handleTo(e) {
 				console.log(e)

+ 1 - 1
pages/maintenance/detail/detail.vue

@@ -11,7 +11,7 @@
 						<text class="kd-content">{{ worksheetInfo.code }}</text>
 					</view>
 					<view class="kd-cell">
-						<text class="kd-label">计划名称</text>
+						<text class="kd-label">保养名称</text>
 						<text class="kd-content">{{ worksheetInfo.planName }}</text>
 					</view>
 					<view class="kd-cell">

+ 11 - 0
pages/saleManage/businessOpportunity/add.vue

@@ -308,4 +308,15 @@
 	/deep/.u-subsection__item__text {
 		font-size: 28rpx !important;
 	}
+	/deep/.uni-input-placeholder {
+		font-size: 28rpx !important;
+	}
+	/deep/.selected-item {
+		font-size: 28rpx !important;
+	}
+	/deep/.uni-input-input {
+		font-size: 28rpx !important;
+	}
+
+	
 </style>

+ 21 - 12
pages/saleManage/components/myCard.vue

@@ -3,31 +3,29 @@
 	<view class="card_box">
 
 
-		<view class="item_box rx-bc" v-for="(_item,i) in columns" :key="i" >
+		<view class="item_box rx-bc" v-for="(_item,i) in columns" :key="i">
 			<view class="perce50" :class="val.className" :style="val.style" v-for="(val) in _item" :key="val.prop">
 				<view class="item_box rx-sc" v-if="val.type=='title'">
 					<view class="round" v-if='index'>{{index}}</view>
 					<view class="orderId" :style="{marginLeft: index?'16rpx':''}">{{item[val.prop]||''}} </view>
 				</view>
+
 				<view class="item_one rx-sc" v-else-if="val.type=='action'">
 					<view class="lable">{{val.label}}</view>
 					<view class="text">
-						
 						<template v-for="(btn,bI) in btnList">
-							
 							<u-button :plain="true" :hairline="true" size='mini' :type="btn.btnType" v-if="judge(btn)"
-								:text="btn.name" @click="action(btn)"  :key="bI"></u-button>
+								:text="btn.name" @click="action(btn)" :key="bI"></u-button>
 						</template>
-						
+
 					</view>
 
 				</view>
-				<view class="item_one rx-sc" v-else>
+				<view class="item_one rx-sc kk" v-else>
 					<view class="lable">{{val.label}}</view>
 					<view class="text" v-if="val.formatter">{{val.formatter(item)||''}}</view>
 					<view class="text" v-else-if="val.slot">
 						<slot :name="val.slot"> </slot>
-
 					</view>
 					<view class="text" v-else>{{item[val.prop]||''}}</view>
 				</view>
@@ -69,10 +67,10 @@
 							value,
 							authorities
 						}) => {
-							if(authorities){
-								is=this.$isAuthorities(authorities)
+							if (authorities) {
+								is = this.$isAuthorities(authorities)
 							}
-							if (value&&!value.includes(this.item[key])) {
+							if (value && !value.includes(this.item[key])) {
 								is = false
 							}
 						})
@@ -93,7 +91,7 @@
 			action(item) {
 				if (item.type == 1) {
 					uni.navigateTo({
-						url: item.pageUrl + '?id=' + this.item.id+(item.query||'')
+						url: item.pageUrl + '?id=' + this.item.id + (item.query || '')
 					})
 				} else {
 					this.$emit(item.apiName)
@@ -116,7 +114,8 @@
 		.rx-bc {
 			align-items: start;
 			flex-flow: row wrap;
-			>view{
+
+			>view {
 				margin-top: 8rpx;
 			}
 		}
@@ -157,6 +156,16 @@
 				}
 			}
 
+
+			.kk .text {
+				overflow: hidden;
+				text-overflow: ellipsis;
+				display: -webkit-box;
+				-webkit-box-orient: vertical;
+				-webkit-line-clamp: 2;
+				word-break: break-word;
+			}
+
 			.round {
 				width: 40rpx;
 				height: 40rpx;

+ 4 - 9
pages/saleManage/components/selectUser.vue

@@ -28,17 +28,12 @@
 									<view class="listBox-name">
 										{{ item.name }}
 									</view>
-									<view class="listBox-code">
-										{{ item.code }}
-									</view>
+							
 								</view>
 								<view class="listBox-bottom">
-									<view>牌号:{{ item.brandNum }}</view>
-									<view>型号:{{ item.modelType }}</view>
-									<view>规格:{{ item.specification }}</view>
-									<view>计量单位:{{ item.measuringUnit }}</view>
-									<view>包装单位:{{ item.packingUnit }}</view>
-									<view>重量单位:{{ item.weightUnit }}</view>
+									<view>工号:{{ item.jobNumber }}</view>
+									<view>账号:{{ item.loginName }}</view>
+					
 								</view>
 							</view>
 						</view>

+ 1 - 1
pages/saleManage/contact/add.vue

@@ -8,7 +8,7 @@
 			<u-cell title="客户分类" arrow-direction="down">
 				<u--input slot="value" placeholder="请选择" border="surround" v-model="form.categoryName"
 					@click.native="showPicker"></u--input>
-			</u-cell>1
+			</u-cell>
 			<u-cell title="客户名称" arrow-direction="down">
 				<u--input slot="value" placeholder="请输入" border="surround" v-model="form.name"></u--input>
 			</u-cell>

+ 3 - 3
pages/saleManage/contact/adminIndex.vue

@@ -71,7 +71,7 @@
 					type: '2',
 					pageUrl: '',
 					judge: [{
-						authorities: 'eom:contact:free',
+						// authorities: 'eom:contact:free',
 					},{
 						key: 'assignStatus',
 						value: [1]
@@ -83,7 +83,7 @@
 					type: '2',
 					pageUrl: '',
 					judge: [{
-						authorities: 'eom:contact:assign',
+						// authorities: 'eom:contact:assign',
 					},{
 						key: 'assignStatus',
 						value: [0]
@@ -95,7 +95,7 @@
 					type: '2',
 					pageUrl: '',
 					judge: [{
-						authorities: 'eom:contact:delete',
+						// authorities: 'eom:contact:delete',
 					},{
 						key: 'assignStatus',
 						value: [0]

+ 17 - 1
pages/saleManage/contact/contactList.vue

@@ -12,7 +12,7 @@
 		</view>
 		<u-modal :show="modalShow" @cancel="modalShow=false" :showCancelButton="true" :closeOnClickOverlay="true"
 			@confirm="assign" :title="'指派'">
-			<view>
+			<view style="width: 680rpx;">
 				<view>
 					<u--input placeholder="分管部门" @click.native="showPicker" v-model="addForm.fgDeptName"></u--input>
 
@@ -278,5 +278,21 @@
 </script>
 
 <style lang="scss" scoped>
+	/deep/.u-subsection__item__text {
+		font-size: 28rpx !important;
+	}
+	/deep/.uni-input-placeholder {
+		font-size: 28rpx !important;
+	}
+	/deep/.selected-item {
+		font-size: 28rpx !important;
+	}
+	/deep/.uni-input-input {
+		font-size: 28rpx !important;
+	}
+	/deep/.placeholder {
+		font-size: 28rpx !important;
+	}
+	
 
 </style>

+ 33 - 14
pages/salesServiceManagement/accessory/accessoryAdd.vue

@@ -50,12 +50,12 @@
 			</u-cell>
 			<u-cell title="用途" arrow-direction="down">
 				<view slot="value" style="display: flex;align-items: center;width: 100%;">
-					<u--textarea style="flex:1" border="surround" placeholder="请输入内容"
+					<u--textarea style="flex:1; min-height: 160rpx;" border="surround" placeholder="请输入内容"
 						v-model="form.purpose"></u--textarea>
 				</view>
 			</u-cell>
 		</u-cell-group>
-		<accessoryList ref="accessoryRef" v-show="current == 1" />
+		<accessoryList :itemList="itemList" ref="accessoryRef" :type="type" v-show="current == 1" />
 		<view class="footerButton" v-if="isDisable">
 			<u-button type="default" text="返回" @click="back"></u-button>
 			<u-button type="primary" @click="save" text="保存"></u-button>
@@ -83,7 +83,8 @@
 	} from '@/utils/utils.js';
 	import {
 		accessorySave,
-		accessoryUpdate
+		accessoryUpdate,
+		accessoryInfo
 	} from '@/api/salesServiceManagement/accessory/index.js'
 	export default {
 		components: {
@@ -119,12 +120,19 @@
 				selectedData: [], // 使用部门绑定值
 				classificationList: [], // 使用部门数据
 				executorList: [], // 选择人数据
+				itemList:[], // 配件信息
 			}
 		},
 		onLoad(params) {
 			this.title = params.type == 'view' ? '配件申请详情' : params.type == 'edit' ? '配件申请修改' : '配件申请新增';
 			this.type = params.type;
-			this.getData();
+			console.log(params, 'params 参数');
+			if (params.id) {
+				console.log(typeof params.id);
+				this.getDetails(params.id);
+			} else {
+				this.getData();
+			}
 		},
 		created() {
 			uni.$off('updateWorkData')
@@ -139,6 +147,16 @@
 			sectionChange(index) {
 				this.current = index;
 			},
+			async getDetails(id) {
+				const res = await accessoryInfo(id);
+				for (let key in this.form) {
+					this.form[key] = res[key];
+				}
+				this.form.id = res.id;
+				this.form.code = res.code;
+				this.itemList = res.details;
+				this.getTreeList();
+			},
 			getData() {
 				let userInfo = uni.getStorageSync('userInfo');
 				this.form.receivingDeptName = userInfo.groupName;
@@ -165,7 +183,11 @@
 			confirm(id, name) {
 				this.form.useDeptName = name;
 				this.form.useDeptId = id[0];
-				this.getUserList(id[0])
+				this.form.userId = '';
+				this.form.userName = '';
+				this.executorList = [];
+				this.getUserList(id[0]);
+				this.$refs.selector.clearSearchText();
 			},
 			// 打开使用人弹窗
 			openSelector() {
@@ -188,20 +210,14 @@
 					})
 					this.executorList = list;
 				} catch (error) {
-
+					this.executorList = [];
 				}
 			},
 			// 使用人选择
 			onClose(item) {
 				this.form.userName = item.text;
-				console.log(item, 'item')
-				console.log(this.form, 'form')
 			},
 			save() {
-				uni.redirectTo({
-					url: '/pages/salesServiceManagement/accessory/index'
-				});
-				return
 				if (!this.form.name) {
 					this.$refs.uToast.show({
 						type: "warning",
@@ -242,15 +258,14 @@
 						type: "success",
 						message: "操作成功",
 					})
+					this.back();
 				}).catch((err) => {
-					console.log(err, 'err --')
 				})
 			},
 			selectWorkOrder() {
 				uni.navigateTo({
 					url: `/pages/salesServiceManagement/accessory/components/selectWork`
 				})
-				console.log('打开工单数据');
 			}
 		}
 	}
@@ -284,6 +299,10 @@
 		}
 	}
 
+	/deep/ .u-textarea__field {
+		height: 160rpx !important;
+	}
+
 	.selected-value {
 		height: 80rpx;
 		line-height: 80rpx;

+ 3 - 9
pages/salesServiceManagement/accessory/components/searchSelect.vue

@@ -63,8 +63,6 @@
 				filteredData: [],
 				// 内部选中的值(用于临时存储,确定后更新)
 				innerValue: this.value,
-				// 当前选中的对象
-				// selectedItem: null
 			}
 		},
 		watch: {
@@ -83,18 +81,14 @@
 			// 打开弹窗
 			open() {
 				this.$refs.popup.open();
-				// 打开时重置搜索状态
-				// this.searchText = '';
-				// this.filteredData = [...this.dataList];
-				// 同步当前值到innerValue(因为可能外部修改了value)
 				this.innerValue = this.value;
-				// this.selectedItem = null;
 			},
-
+			clearSearchText(){
+				this.searchText = ''
+			},
 			// 关闭弹窗
 			close() {
 				this.$refs.popup.close();
-				// this.$emit('close', this.selectedItem);
 			},
 
 			// 过滤数据

+ 51 - 9
pages/salesServiceManagement/accessory/index.vue

@@ -5,7 +5,8 @@
 		</uni-nav-bar>
 		<view class="top-wrapper">
 			<uni-section>
-				<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
+				<uni-easyinput @clear="clearSearch" prefixIcon="search" style="width: 460rpx" v-model="searchVal"
+					placeholder="名称">
 				</uni-easyinput>
 			</uni-section>
 			<button class="search_btn" @click="doSearch">搜索</button>
@@ -15,7 +16,7 @@
 			<u-list @scrolltolower="scrolltolower" class="listContent" style="height: auto;">
 				<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
 					<myCard :columns="columns" :btnList="btnList" :item="item" @details="add(item,'view')"
-						@edit="add(item,'edit')">
+						@edit="add(item,'edit')" @delete="deleteRow(item)">
 					</myCard>
 				</view>
 			</u-list>
@@ -23,12 +24,14 @@
 		<view class="add" @click="add('','add')">
 			<u-icon name="plus" color="#fff"></u-icon>
 		</view>
+		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
 <script>
 	import {
 		accessoryPage,
+		accessoryDelete
 	} from '@/api/salesServiceManagement/accessory/index.js';
 	import myCard from '@/pages/saleManage/components/myCard.vue';
 	export default {
@@ -136,6 +139,18 @@
 					btnType: 'primary',
 					type: '2',
 					pageUrl: '',
+					judge: [{
+						authorities: '',
+					}, {
+						key: 'source',
+						value: [0],
+					}],
+				}, {
+					name: '删除',
+					apiName: 'delete',
+					btnType: 'primary',
+					type: '2',
+					pageUrl: '',
 					judge: [{
 						authorities: '',
 					}, {
@@ -150,13 +165,13 @@
 				tableList: [],
 				searchVal: ''
 			}
-		},
-		created() {
-			
 		},
 		onShow() {
 			this.doSearch();
 		},
+		onReachBottom() {
+			this.getList()
+		},
 		methods: {
 			doSearch() {
 				this.isEnd = false;
@@ -166,7 +181,11 @@
 			//获取列表信息
 			getList() {
 				if (this.isEnd) {
-					return;
+					this.$refs.uToast.show({
+						message: "暂无更多数据",
+						duration:1000
+					})
+					return
 				}
 				uni.showLoading({
 					title: '加载中'
@@ -174,6 +193,7 @@
 				let data = {
 					pageNum: this.page,
 					size: this.size,
+					keyWord: this.searchVal
 				}
 				accessoryPage(data).then(res => {
 					if (this.page === 1) {
@@ -195,12 +215,34 @@
 				this.getList();
 			},
 			add(item, type) {
-				console.log(item, 'item ---')
 				uni.navigateTo({
-					url: `/pages/salesServiceManagement/accessory/accessoryAdd?type=${type}&id=${item.id}`
+					url: `/pages/salesServiceManagement/accessory/accessoryAdd?type=${type}&id=${item?item.id:''}`
 				})
 			},
-			
+			async deleteRow(row) {
+				const res = await uni.showModal({
+					title: '确认删除',
+					content: '确定要删除该条数据吗?',
+					confirmText: '删除',
+					confirmColor: '#FF4D4F',
+				});
+				if (res[1].confirm) {
+					const data = await accessoryDelete([row.id]);
+					if (!data) return
+					this.$refs.uToast.show({
+						type: "success",
+						message: "操作成功",
+					})
+					this.doSearch();
+				} else if (res.cancel) {
+					console.log('用户取消');
+				}
+			},
+			clearSearch() {
+				console.log('清空');
+				this.searchVal = ''
+				this.doSearch()
+			}
 		}
 	}
 </script>

+ 59 - 35
pages/salesServiceManagement/demandList/index.vue

@@ -5,11 +5,12 @@
 		</uni-nav-bar>
 		<view class="top-wrapper">
 			<uni-section>
-				<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
+				<uni-easyinput @clear="clearSearch" prefixIcon="search" style="width: 460rpx" v-model="searchVal"
+					placeholder="关键字">
 				</uni-easyinput>
 			</uni-section>
 			<button class="search_btn" @click="doSearch">搜索</button>
-			<image class="menu_icon" src="~@/static/pda/menu.svg"></image>
+			<image class="menu_icon" @click="handleSearch" src="~@/static/pda/menu.svg"></image>
 		</view>
 		<view class="wrapper">
 			<u-list @scrolltolower="scrolltolower" class="listContent">
@@ -55,23 +56,24 @@
 				</form>
 			</view>
 		</uni-popup>
+		<!-- <Screen ref="screen" @succeed="doSearch" /> -->
 		<u-toast ref="uToast"></u-toast>
 
 	</view>
 </template>
 
 <script>
-	import {
-		deleteInformation
-	} from '@/api/saleManage/businessOpportunity/index.js'
 	import {
 		getTableList,
-		revokeSalesDemand
+		revokeSalesDemand,
+		deleteSalesDemand
 	} from '@/api/salesServiceManagement/demandList/index.js'
 	import myCard from '@/pages/saleManage/components/myCard.vue'
+	import Screen from './screen.vue'
 	export default {
 		components: {
 			myCard,
+			Screen
 		},
 
 		data() {
@@ -166,7 +168,13 @@
 						prop: 'contactName'
 					}, {
 						label: '故障等级:',
-						prop: 'faultLevel'
+						prop: 'faultLevel',
+						formatter(row) {
+							let cellValue = row.faultLevel;
+							return cellValue == 1 ?
+								'紧急' : cellValue == 2 ? '一般' : ''
+
+						}
 					}],
 					[{
 						label: '创建人:',
@@ -175,25 +183,25 @@
 						label: '创建时间:',
 						prop: 'createTime',
 					}],
-					[{
-						label: '审核人:',
-						prop: 'approvalUserName'
-					}, {
-						label: '状态:',
-						prop: 'demandStatus',
-						formatter: (row) => {
-							let cellValue = row.demandStatus;
-							return cellValue == 0 ?
-								'待审核' :
-								cellValue == 2 ?
-								'已拒绝' :
-								cellValue == 1 ?
-								'已通过' :
-								cellValue == 3 ?
-								'已撤回' :
-								'';
-						}
-					}],
+					// [{
+					// 	label: '审核人:',
+					// 	prop: 'approvalUserName'
+					// }, {
+					// 	label: '状态:',
+					// 	prop: 'demandStatus',
+					// 	formatter: (row) => {
+					// 		let cellValue = row.demandStatus;
+					// 		return cellValue == 0 ?
+					// 			'待审核' :
+					// 			cellValue == 2 ?
+					// 			'已拒绝' :
+					// 			cellValue == 1 ?
+					// 			'已通过' :
+					// 			cellValue == 3 ?
+					// 			'已撤回' :
+					// 			'';
+					// 	}
+					// }],
 					[{
 						label: '操作:',
 						prop: 'action',
@@ -208,13 +216,19 @@
 
 		},
 
-		onShow() {
-			this.isEnd = false
-			this.page = 1
+		onReachBottom() {
+			console.log('123');
 			this.getList()
 		},
 
+		onShow() {
+			this.doSearch();
+		},
+
 		methods: {
+			handleSearch() {
+				this.$refs.screen.open();
+			},
 			doSearch() {
 				this.isEnd = false
 				this.page = 1
@@ -223,6 +237,10 @@
 			//获取列表信息
 			getList() {
 				if (this.isEnd) {
+					this.$refs.uToast.show({
+						message: "暂无更多数据",
+						duration: 1000
+					})
 					return
 				}
 				uni.showLoading({
@@ -232,6 +250,7 @@
 					pageNum: this.page,
 					size: this.size,
 					type: 1,
+					keyWord: this.searchVal
 				}
 				getTableList(data).then(res => {
 					if (this.page === 1) {
@@ -288,8 +307,7 @@
 				}
 				this.getList();
 			},
-			async del(item) {
-				console.log(item, 'item ---')
+			async del(row) {
 				const res = await uni.showModal({
 					title: '确认删除',
 					content: '确定要删除该条数据吗?',
@@ -297,7 +315,7 @@
 					confirmColor: '#FF4D4F',
 				});
 				if (res[1].confirm) {
-					const data = await deleteInformation([row.id])
+					const data = await deleteSalesDemand([row.id])
 					if (!data) return
 					this.$refs.uToast.show({
 						type: "success",
@@ -318,12 +336,16 @@
 				// })
 			},
 
-			handleAudit(item) { 
-				console.log(item,'iitem --')
-				uni.navigateTo({ 
+			handleAudit(item) {
+				console.log(item, 'iitem --')
+				uni.navigateTo({
 					url: `/pages/salesServiceManagement/demandList/components/submission?id=${item.id}`
 				})
 			},
+			clearSearch() {
+				this.searchVal = ''
+				this.doSearch()
+			}
 		}
 	}
 </script>
@@ -342,6 +364,8 @@
 		justify-content: center;
 	}
 
+	.wrapper {}
+
 	.top-wrapper {
 		background-color: #fff;
 		display: flex;

+ 101 - 0
pages/salesServiceManagement/demandList/screen.vue

@@ -0,0 +1,101 @@
+<template>
+	<view>
+		<u-popup :show="show" closeOnClickOverlay mode="top" @close="closePopup">
+			<view class="search_list">
+				<u-form labelPosition="left" :model="form" labelWidth="140" labelAlign="left" class="baseForm">
+					<u-form-item label="仓库名称:" class="item-form" borderBottom prop="assetType">
+						<uni-data-select v-model="form.warehouseId" :clear="false" :localdata="warehouseList">
+						</uni-data-select>
+					</u-form-item>
+					<u-form-item label="物品编码:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.categoryCode"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+					<u-form-item label="物品名称:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.categoryName"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+					<u-form-item label="批次号:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.batchNo"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+					<u-form-item label="刻码:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.engrave"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+					<u-form-item label="发货码:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.barcodes"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+					<u-form-item label="牌号:" class="item-form" borderBottom prop="assetType">
+						<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="form.brandNum"
+							placeholder="请输入">
+						</uni-easyinput>
+					</u-form-item>
+				</u-form>
+			</view>
+			<view class="operate_box rx-bc">
+				<u-button size="small" class="u-reset-button" @click="show = false">
+					取消
+				</u-button>
+				<u-button size="small" class="u-reset-button" @click="reset">
+					重置
+				</u-button>
+				<u-button type="success" size="small" class="u-reset-button" @click="submit">
+					确定
+				</u-button>
+			</view>
+		</u-popup>
+	</view>
+</template>
+
+<script>
+	export default{
+		data(){
+			return {
+				form: {
+					warehouseId: "",
+					categoryCode: "",
+					categoryName: "",
+					batchNo: '',
+					engrave: '',
+					barcodes: '',
+					brandNum: ''
+				},
+			}
+		},
+		methods:{
+			open() {
+				this.show = true;
+			},
+			reset(){
+				
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.search_list {
+		padding: 0 20rpx;
+	}
+
+	.operate_box {
+		padding: 10rpx 32rpx;
+
+		/deep/ .u-button {
+			width: 30%;
+		}
+	}
+
+	.item-form {
+		/deep/ .u-form-item__body__left__content__label {
+			font-size: 28rpx;
+		}
+	}
+</style>

+ 83 - 6
pages/salesServiceManagement/recycle/index.vue

@@ -5,7 +5,7 @@
 		</uni-nav-bar>
 		<view class="top-wrapper">
 			<uni-section>
-				<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
+				<uni-easyinput  @clear="clearSearch" prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
 				</uni-easyinput>
 			</uni-section>
 			<button class="search_btn" @click="doSearch">搜索</button>
@@ -14,17 +14,23 @@
 		<view class="wrapper">
 			<u-list @scrolltolower="scrolltolower" class="listContent" style="height: auto;">
 				<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
-					<myCard :columns="columns" :btnList="btnList" :item="item">
+					<myCard :columns="columns" :btnList="btnList" @details="add(item,'view')" @edit="add(item,'edit')"
+						@delete="deleteRow(item)" :item="item">
 					</myCard>
 				</view>
 			</u-list>
 		</view>
+		<view class="add" @click="add('','add')">
+			<u-icon name="plus" color="#fff"></u-icon>
+		</view>
+		<u-toast ref="uToast"></u-toast>
 	</view>
 </template>
 
 <script>
 	import {
 		recyclePage,
+		recycleDelete
 	} from '@/api/salesServiceManagement/accessory/index.js';
 	import myCard from '@/pages/saleManage/components/myCard.vue';
 	export default {
@@ -117,8 +123,21 @@
 					judge: [{
 						authorities: '',
 					}, {
-						key: 'orderStatus',
-						value: [1, 6],
+						key: 'source',
+						value: [0],
+
+					}],
+				}, {
+					name: '删除',
+					apiName: 'delete',
+					btnType: 'primary',
+					type: '2',
+					pageUrl: '',
+					judge: [{
+						authorities: '',
+					}, {
+						key: 'source',
+						value: [0],
 
 					}],
 				}],
@@ -130,8 +149,15 @@
 			}
 		},
 		created() {
+			
+		},
+		onShow(){
 			this.doSearch();
 		},
+		onReachBottom() {
+			this.getList()
+		},
+		
 		methods: {
 			doSearch() {
 				this.isEnd = false;
@@ -141,6 +167,10 @@
 			//获取列表信息
 			getList() {
 				if (this.isEnd) {
+					this.$refs.uToast.show({
+						message: "暂无更多数据",
+						duration:1000
+					})
 					return;
 				}
 				uni.showLoading({
@@ -149,6 +179,7 @@
 				let data = {
 					pageNum: this.page,
 					size: this.size,
+					keyWord: this.searchVal
 				}
 				recyclePage(data).then(res => {
 					if (this.page === 1) {
@@ -156,9 +187,10 @@
 					} else {
 						this.tableList.push(...res.list);
 					}
-					console.log(this.tableList, 'res ____')
-					this.page += 1
+					this.page += 1;
 					this.isEnd = this.tableList.length >= res.count;
+					const height=uni.getSystemInfoSync()
+					console.log(height);
 					uni.hideLoading();
 				}).catch((e) => {
 					uni.hideLoading();
@@ -170,6 +202,36 @@
 				}
 				this.getList();
 			},
+			add(item, type) {
+				uni.navigateTo({
+					url: `/pages/salesServiceManagement/recycle/recycleAdd?type=${type}&id=${item?item.id:''}`
+				})
+			},
+			async deleteRow(row) {
+				const res = await uni.showModal({
+					title: '确认删除',
+					content: '确定要删除该条数据吗?',
+					confirmText: '删除',
+					confirmColor: '#FF4D4F',
+				});
+				if (res[1].confirm) {
+					const data = await recycleDelete([row.id]);
+					if (!data) return;
+					this.$refs.uToast.show({
+						type: "success",
+						message: "操作成功",
+					})
+					this.doSearch();
+				} else if (res.cancel) {
+					console.log('用户取消');
+				}
+			},
+			clearSearch() {
+				this.searchVal = ''
+				this.doSearch()
+			}
+			
+			
 		}
 	}
 </script>
@@ -211,4 +273,19 @@
 			margin-left: 14rpx;
 		}
 	}
+
+	.add {
+		width: 96rpx;
+		height: 96rpx;
+		border-radius: 48rpx;
+		background: #3c9cff;
+		position: fixed;
+		bottom: 100rpx;
+		right: 24rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+	}
+	
+	
 </style>

+ 325 - 0
pages/salesServiceManagement/recycle/recycleAdd.vue

@@ -0,0 +1,325 @@
+<template>
+	<view class="mainBox">
+		<uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back"
+			:title="title" @clickLeft="back">
+		</uni-nav-bar>
+		<u-subsection :list="list" :current="current" @change="sectionChange"></u-subsection>
+		<u-cell-group v-show="current == 0">
+			<u-cell title="编码" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.code">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="回收部门" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.recycleDeptName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="回收人" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.recycleName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="工单名称" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input placeholder="请选择" :disabled="!isDisable" @click.native="selectWorkOrder" style="flex:1"
+						border="surround" v-model="form.orderWorkName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="工单编码" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.orderWorkCode">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="客户名称" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.contactName">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="客户编码" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.contactCode">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="设备名称" arrow-direction="down">
+				<uni-data-picker ellipsis :readonly="!isDisable" v-model="form.demandDetailId" slot="value"
+					placeholder="请选择" :localdata="deviceList" @change="sourceCodeOnchange">
+				</uni-data-picker>
+			</u-cell>
+			<u-cell title="设备编码" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 90%;">
+					<u--input disabled style="flex:1" border="surround" v-model="form.categoryCode">
+					</u--input>
+				</view>
+			</u-cell>
+			<u-cell title="回收时间" arrow-direction="down">
+				<uni-datetime-picker :disabled="!isDisable" type="date" slot="value" v-model="form.usageTime">
+				</uni-datetime-picker>
+			</u-cell>
+			<u-cell title="原因" arrow-direction="down">
+				<view slot="value" style="display: flex;align-items: center;width: 100%;">
+					<u--textarea style="flex:1; min-height: 160rpx;" border="surround" placeholder="请输入内容"
+						v-model="form.reason"></u--textarea>
+				</view>
+			</u-cell>
+		</u-cell-group>
+		<accessoryList :itemList="itemList" ref="accessoryRef" :type="type" v-show="current == 1" />
+		<view class="footerButton" v-if="isDisable">
+			<u-button type="default" text="返回" @click="back"></u-button>
+			<u-button type="primary" @click="save" text="保存"></u-button>
+		</view>
+		<u-toast ref="uToast"></u-toast>
+	</view>
+</template>
+
+<script>
+	import accessoryList from '@/pages/salesServiceManagement/workOrder/components/accessoryList.vue';
+	import {
+		recycleDetails,
+		recycleSave,
+		recycleUpdate,
+		getSalesWorkOrderById
+	} from '@/api/salesServiceManagement/workOrder/index.js'
+	export default {
+		components: {
+			accessoryList
+		},
+		computed: {
+			isDisable() {
+				let flag = this.type != 'view'
+				return flag;
+			}
+		},
+		data() {
+			return {
+				current: 0,
+				list: ['基本信息', '配件信息'],
+				title: '',
+				type: '',
+				form: {
+					repairId: '', // 工单Id
+					orderWorkName: '', // 工单名称
+					recycleName: '', // 回收人名称
+					recycleId: '', // 回收人id
+					receivingDeptId: '', // 回收人部门Id
+					recycleDeptName: '', // 回收人部门名称
+					usageTime: '', // 使用时间
+					reason: '' ,// 原因
+					demandDetailId:'', // 设备id
+					categoryCode:'' ,// 设备编码
+					categoryName:'', // 设备名称
+				},
+				selectedData: [], // 使用部门绑定值
+				classificationList: [], // 使用部门数据
+				itemList: [], // 配件信息
+				deviceList: [], // 设备信息
+			}
+		},
+		onLoad(params) {
+			this.title = params.type == 'view' ? '配件回收详情' : params.type == 'edit' ? '配件回收修改' : '配件回收新增';
+			this.type = params.type;
+			if (params.id) {
+				this.getDetails(params.id);
+			} else {
+				this.getData();
+			}
+		},
+		created() {
+			uni.$off('updateWorkData')
+			uni.$on('updateWorkData', ({
+				data
+			}) => {
+				this.changeSelect(data, '')
+			})
+		},
+		methods: {
+			sectionChange(index) {
+				this.current = index;
+			},
+			async getDetails(id) {
+				const res = await recycleDetails(id);
+				for (let key in this.form) {
+					this.form[key] = res[key];
+				}
+				this.form.id = res.id;
+				this.form.code = res.code;
+				this.itemList = res.detailList;
+				this.changeSelect({
+						id: res.repairId,
+						name: res.orderWorkName,
+						code: res.orderWorkCode
+					},
+					1
+				);
+			},
+			getData() {
+				let userInfo = uni.getStorageSync('userInfo');
+				this.form.recycleDeptName = userInfo.groupName;
+				this.form.recycleDeptId = userInfo.groupId;
+				this.form.recycleName = userInfo.name;
+				this.form.recycleId = userInfo.roleId[0];
+			},
+			sourceCodeOnchange(e) {
+				const value = e.detail.value;
+				if (value.length === 0) {
+					return this.deviceSelect({
+						text: '',
+						categoryCode: '',
+						value: ''
+					});
+				}
+				let id = value[0].value;
+				let item = this.deviceList.find(item => item.value == id);
+				this.deviceSelect(item);
+			},
+			// 设备名称选择
+			deviceSelect(item) {
+				this.form.categoryName = item.text;
+				this.form.categoryCode = item.categoryCode;
+				this.form.demandDetailId = item.value;
+			},
+			// 确认选择工单
+			async changeSelect(row, type) {
+				this.$set(this.form, 'orderWorkName', row.name);
+				this.$set(this.form, 'orderWorkCode', row.code);
+				this.form.repairId = row.id; // 工单id
+				const res = await getSalesWorkOrderById(row.id);
+				this.$set(this.form, 'contactName', res.afterSalesDemandVO.contactName);
+				this.$set(this.form, 'contactCode', res.afterSalesDemandVO.contactCode);
+				let list = res.afterSalesDemandVO.productDetail.map((el) => {
+					return {
+						text: el.categoryName,
+						categoryCode: el.categoryCode,
+						value: el.id,
+
+					};
+				});
+				this.deviceList = list;
+				//  type 判断是不是修改/详情进来 是的话不需要初始赋值
+				if (!type) {
+					this.$set(this.form, 'categoryName', list[0].text);
+					this.$set(this.form, 'categoryCode', list[0].categoryCode);
+					this.$set(this.form, 'demandDetailId', list[0].value);
+				}
+			},
+			// 使用人选择
+			onClose(item) {
+				this.form.userName = item.text;
+			},
+			save() {
+				if (!this.form.orderWorkName) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择工单",
+					})
+				};
+				if (!this.form.demandDetailId) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请选择设备",
+					})
+				};
+				console.log(this.form, 'this.form 123456')
+				let detailList = this.$refs.accessoryRef.getTabData() || [];
+				if (detailList.length == 0) {
+					this.$refs.uToast.show({
+						type: "warning",
+						message: "请添加一条配件信息",
+					})
+					this.current = 1;
+					return
+				}
+				let data = {
+					...this.form,
+					detailList
+				};
+				if (data.usageTime) {
+					data.usageTime = data.usageTime + ' 00:00:00'
+				}
+				let api = this.type == 'edit' ? recycleUpdate : recycleSave;
+				api(data).then((res) => {
+					this.$refs.uToast.show({
+						type: "success",
+						message: "操作成功",
+					})
+					this.back();
+				}).catch((err) => {})
+			},
+			selectWorkOrder() {
+				uni.navigateTo({
+					url: `/pages/salesServiceManagement/accessory/components/selectWork`
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	/deep/.u-subsection__item__text {
+		font-size: 28rpx !important;
+	}
+
+	/deep/.u-cell__body__content {
+		flex: none;
+		margin-right: 16rpx;
+	}
+
+	.footerButton {
+		width: 100%;
+		height: 84rpx;
+		display: flex;
+		position: fixed;
+		bottom: 0;
+		z-index: 10;
+
+		/deep/.u-button {
+			height: 100%;
+		}
+
+		>view {
+			flex: 1;
+
+		}
+	}
+
+	/deep/ .u-textarea__field {
+		height: 160rpx !important;
+	}
+
+	.selected-value {
+		height: 80rpx;
+		line-height: 80rpx;
+		padding: 0 20rpx;
+		border: 1rpx solid #e5e5e5;
+		border-radius: 8rpx;
+		font-size: 28rpx;
+		color: #333;
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		background-color: #fff;
+	}
+
+	// .mainBox {
+	/deep/.uni-data-tree {
+		width: calc(100% - 150rpx);
+
+		.selected-list {
+			white-space: nowrap;
+			/* 禁止文本换行 */
+			overflow: hidden;
+			/* 超出部分隐藏 */
+			text-overflow: ellipsis;
+			/* 显示省略号 */
+		}
+	}
+
+	// }
+</style>

+ 17 - 5
pages/salesServiceManagement/workOrder/components/accessoryList.vue

@@ -3,11 +3,12 @@
 		<u-list class="listContent">
 			<view v-for="(item, index) in tableList" :key="index" style="position: relative;">
 				<myCard :item="item" @del="del(index)" @edit="add('edit',item,index)" :index="index+1"
-					:columns="columns" :btnList="btnList">
-					<u--input placeholder="请输入" type="number" @input="(val) =>inputChange(val,'totalCount',index)"
-						slot="totalCount" v-model="item.totalCount">
+					:columns="columns" :btnList="btnData">
+					<u--input :disabled="isDisable" placeholder="请输入" type="number"
+						@input="(val) =>inputChange(val,'totalCount',index)" slot="totalCount"
+						v-model="item.totalCount">
 					</u--input>
-					<u--input placeholder="请输入" type="number" @input="(val) =>inputChange(val,'singlePrice',index)"
+					<u--input  :disabled="isDisable"  placeholder="请输入" type="number" @input="(val) =>inputChange(val,'singlePrice',index)"
 						slot="singlePrice" v-model="item.singlePrice">
 					</u--input>
 				</myCard>
@@ -116,7 +117,18 @@
 				tableList: []
 			}
 		},
-		computed: {},
+		computed: {
+			// 按钮
+			btnData() {
+				if (this.type == 'view') {
+					return []
+				}
+				return this.btnList;
+			},
+			isDisable() {
+				return this.type === 'view'
+			}
+		},
 		created() {
 			uni.$off('updateAddessory');
 			uni.$on('updateAddessory', (data) => {

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

@@ -5,7 +5,8 @@
 		</uni-nav-bar>
 		<view class="top-wrapper">
 			<uni-section>
-				<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
+				<uni-easyinput @clear="clearSearch" prefixIcon="search" style="width: 460rpx" v-model="searchVal"
+					placeholder="名称">
 				</uni-easyinput>
 			</uni-section>
 			<button class="search_btn" @click="doSearch">搜索</button>
@@ -299,13 +300,16 @@
 		},
 		computed: {},
 		onLoad() {
-			
+
 		},
 		onShow() {
 			this.doSearch();
 		},
 		created() {
-			
+
+		},
+		onReachBottom() {
+			this.getList()
 		},
 		methods: {
 			changeChartsTab(value) {
@@ -320,6 +324,10 @@
 			//获取列表信息
 			getList() {
 				if (this.isEnd) {
+					this.$refs.uToast.show({
+						message: "暂无更多数据",
+						duration: 1000
+					})
 					return
 				}
 				uni.showLoading({
@@ -328,6 +336,7 @@
 				let data = {
 					pageNum: this.page,
 					size: this.size,
+					keyWord: this.searchVal
 				}
 				if (this.pickTabIndex != 'all') {
 					data.orderStatus = this.pickTabIndex;
@@ -395,6 +404,10 @@
 					})
 					this.doSearch();
 				}
+			},
+			clearSearch() {
+				this.searchVal = ''
+				this.doSearch()
 			}
 		}
 	}

+ 2 - 2
pages/warehouse/inventory/batch/components/outboundDelivery.vue

@@ -22,10 +22,10 @@
 									<text class="t1">包装数量</text>
 									<text class="t2">{{ item.packingQuantity }}{{ item.packingUnit }}</text>
 								</view>
-								<view class="row-item">
+						<!-- 		<view class="row-item">
 									<text class="t1">操作人</text>
 									<text class="t2"></text>
-								</view>
+								</view> -->
 								<view class="row-item">
 									<text class="t1">审核人</text>
 									<text class="t2">{{ item.verifyName }}</text>

+ 168 - 146
utils/utils.js

@@ -13,169 +13,191 @@ export function getDate(type) {
 	return `${year}-${month}-${day}`;
 }
 
-export function stopScroll(){
-	  var box=function(e)
-	  {passive: false ;};
-	  document.body.style.overflow='hidden';
-	  document.addEventListener("touchmove",box,false);
+export function getDateNew(type = 'day') {
+	const date = new Date();
+	let year = date.getFullYear();
+	let month = date.getMonth() + 1;
+	let day = date.getDate();
+
+	if (type === 'end') {
+		day = day + 1;
+	}
+	month = month > 9 ? month : '0' + month;
+	day = day > 9 ? day : '0' + day;
+	if (type === 'year') return `${year}`
+	if (type === 'month') return `${year}-${month}`
+
+	return `${year}-${month}-${day}`;
 }
 
-export function startScroll(){
-	 var box=function(e){passive: false };
- 	 document.body.style.overflow='';//出现滚动条
-	 document.removeEventListener("touchmove",box,false);
+export function stopScroll() {
+	var box = function(e) {
+		passive: false;
+	};
+	document.body.style.overflow = 'hidden';
+	document.addEventListener("touchmove", box, false);
+}
+
+export function startScroll() {
+	var box = function(e) {
+		passive: false
+	};
+	document.body.style.overflow = ''; //出现滚动条
+	document.removeEventListener("touchmove", box, false);
 }
 // 生成随机数
 export const getRuleNo = (suffix = 'R') => {
 	const randomNum = Math.floor(Math.random() * 1000000)
-  
+
 	return `${suffix}${parseTime(new Date(), '{y}{m}{d}')}${randomNum}`
-  }
-export function parseTime (time, cFormat) {
+}
+export function parseTime(time, cFormat) {
 	if (arguments.length === 0 || !time) {
-	  return null
+		return null
 	}
 	const format = cFormat || '{y}-{m}-{d} {h}:{i}:{s}'
 	let date
 	if (typeof time === 'object') {
-	  date = time
+		date = time
 	} else {
-	  if (typeof time === 'string') {
-		if (/^[0-9]+$/.test(time)) {
-		  // support "1548221490638"
-		  time = parseInt(time)
-		} else {
-		  // support safari
-		  // https://stackoverflow.com/questions/4310953/invalid-date-in-safari
-		  time = time.replace(new RegExp(/-/gm), '/')
+		if (typeof time === 'string') {
+			if (/^[0-9]+$/.test(time)) {
+				// support "1548221490638"
+				time = parseInt(time)
+			} else {
+				// support safari
+				// https://stackoverflow.com/questions/4310953/invalid-date-in-safari
+				time = time.replace(new RegExp(/-/gm), '/')
+			}
 		}
-	  }
-  
-	  if (typeof time === 'number' && time.toString().length === 10) {
-		time = time * 1000
-	  }
-	  date = new Date(time)
+
+		if (typeof time === 'number' && time.toString().length === 10) {
+			time = time * 1000
+		}
+		date = new Date(time)
 	}
 	const formatObj = {
-	  y: date.getFullYear(),
-	  m: date.getMonth() + 1,
-	  d: date.getDate(),
-	  h: date.getHours(),
-	  i: date.getMinutes(),
-	  s: date.getSeconds(),
-	  a: date.getDay()
+		y: date.getFullYear(),
+		m: date.getMonth() + 1,
+		d: date.getDate(),
+		h: date.getHours(),
+		i: date.getMinutes(),
+		s: date.getSeconds(),
+		a: date.getDay()
 	}
 	const time_str = format.replace(/{([ymdhisa])+}/g, (result, key) => {
-	  const value = formatObj[key]
-	  // Note: getDay() returns 0 on Sunday
-	  if (key === 'a') {
-		return ['日', '一', '二', '三', '四', '五', '六'][value]
-	  }
-	  return value.toString().padStart(2, '0')
+		const value = formatObj[key]
+		// Note: getDay() returns 0 on Sunday
+		if (key === 'a') {
+			return ['日', '一', '二', '三', '四', '五', '六'][value]
+		}
+		return value.toString().padStart(2, '0')
 	})
 	return time_str
-  }
-  
-  /**
-   * 将毫秒,转换成时间字符串。例如说,xx 分钟
-   *
-   * @param ms 毫秒
-   * @returns {string} 字符串
-   */
-  export function getDates(ms) {
-    const day = Math.floor(ms / (24 * 60 * 60 * 1000));
-    const hour =  Math.floor((ms / (60 * 60 * 1000) - day * 24));
-    const minute =  Math.floor(((ms / (60 * 1000)) - day * 24 * 60 - hour * 60));
-    const second =  Math.floor((ms / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60));
-    if (day > 0) {
-      return day + "天" + hour + "小时" + minute + "分钟";
-    }
-    if (hour > 0) {
-      return hour + "小时" + minute + "分钟";
-    }
-    if (minute > 0) {
-      return minute + "分钟";
-    }
-    if (second > 0) {
-      return second + "秒";
-    } else {
-      return 0 + "秒";
-    }
-  }
-  //机构一维数组转树形结构
-  export function toTreeData(option) {
-    var _a, _b;
-    if (Array.isArray(option)) {
-      option = {
-        data: arguments[0],
-        idField: arguments[1],
-        parentIdField: arguments[2],
-        childrenField: arguments[3],
-        parentId: arguments[4],
-        addParentIds: arguments[5],
-        parentIdsField: arguments[6],
-        parentIds: arguments[7]
-      };
-    }
-    const data = option.data;
-    const idField = option.idField || option.idKey || "id";
-    const parentIdField = option.parentIdField || option.pidKey || "parentId";
-    const childrenField = option.childrenField || option.childKey || "children";
-    const parentIdIsNull = typeof option.parentId === "undefined" && typeof option.pid === "undefined";
-    const parentId = parentIdIsNull ? [] : (_a = option.parentId) != null ? _a : option.pid;
-    const addParentIds = (_b = option.addParentIds) != null ? _b : option.addPIds;
-    const parentIdsField = option.parentIdsField || option.parentsKey || "parentIds";
-    const parentIds = option.parentIds;
-    if (parentIdIsNull) {
-      data.forEach((d) => {
-        let flag = true;
-        for (let i = 0; i < data.length; i++) {
-          if (d[parentIdField] == data[i][idField]) {
-            flag = false;
-            break;
-          }
-        }
-        if (flag) {
-          parentId.push(d[parentIdField]);
-        }
-      });
-    }
-    const result = [];
-    data.forEach((d) => {
-      if (d[idField] == d[parentIdField]) {
-        throw new Error(
-          [
-            "data error: {",
-            idField + ": ",
-            JSON.stringify(d[idField]),
-            parentIdField + ": ",
-            JSON.stringify(d[parentIdField]),
-            "}"
-          ].join("")
-        );
-      }
-      const isArr = Array.isArray(parentId);
-      const isParent = isArr ? parentId.includes(d[parentIdField]) : d[parentIdField] == parentId;
-      if (isParent) {
-        const r = { ...d };
-        const children = toTreeData({
-          data,
-          idField,
-          parentIdField,
-          childrenField,
-          parentId: d[idField],
-          addParentIds,
-          parentIdsField,
-          parentIds: (parentIds != null ? parentIds : []).concat([d[idField]])
-        });
-        if (children.length > 0) {
-          r[childrenField] = children;
-        }
-        if (addParentIds) {
-          r[parentIdsField] = parentIds != null ? parentIds : [];
-        }
-        result.push(r);
-      }
-    });
-    return result;
-  }
+}
+
+/**
+ * 将毫秒,转换成时间字符串。例如说,xx 分钟
+ *
+ * @param ms 毫秒
+ * @returns {string} 字符串
+ */
+export function getDates(ms) {
+	const day = Math.floor(ms / (24 * 60 * 60 * 1000));
+	const hour = Math.floor((ms / (60 * 60 * 1000) - day * 24));
+	const minute = Math.floor(((ms / (60 * 1000)) - day * 24 * 60 - hour * 60));
+	const second = Math.floor((ms / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - minute * 60));
+	if (day > 0) {
+		return day + "天" + hour + "小时" + minute + "分钟";
+	}
+	if (hour > 0) {
+		return hour + "小时" + minute + "分钟";
+	}
+	if (minute > 0) {
+		return minute + "分钟";
+	}
+	if (second > 0) {
+		return second + "秒";
+	} else {
+		return 0 + "秒";
+	}
+}
+//机构一维数组转树形结构
+export function toTreeData(option) {
+	var _a, _b;
+	if (Array.isArray(option)) {
+		option = {
+			data: arguments[0],
+			idField: arguments[1],
+			parentIdField: arguments[2],
+			childrenField: arguments[3],
+			parentId: arguments[4],
+			addParentIds: arguments[5],
+			parentIdsField: arguments[6],
+			parentIds: arguments[7]
+		};
+	}
+	const data = option.data;
+	const idField = option.idField || option.idKey || "id";
+	const parentIdField = option.parentIdField || option.pidKey || "parentId";
+	const childrenField = option.childrenField || option.childKey || "children";
+	const parentIdIsNull = typeof option.parentId === "undefined" && typeof option.pid === "undefined";
+	const parentId = parentIdIsNull ? [] : (_a = option.parentId) != null ? _a : option.pid;
+	const addParentIds = (_b = option.addParentIds) != null ? _b : option.addPIds;
+	const parentIdsField = option.parentIdsField || option.parentsKey || "parentIds";
+	const parentIds = option.parentIds;
+	if (parentIdIsNull) {
+		data.forEach((d) => {
+			let flag = true;
+			for (let i = 0; i < data.length; i++) {
+				if (d[parentIdField] == data[i][idField]) {
+					flag = false;
+					break;
+				}
+			}
+			if (flag) {
+				parentId.push(d[parentIdField]);
+			}
+		});
+	}
+	const result = [];
+	data.forEach((d) => {
+		if (d[idField] == d[parentIdField]) {
+			throw new Error(
+				[
+					"data error: {",
+					idField + ": ",
+					JSON.stringify(d[idField]),
+					parentIdField + ": ",
+					JSON.stringify(d[parentIdField]),
+					"}"
+				].join("")
+			);
+		}
+		const isArr = Array.isArray(parentId);
+		const isParent = isArr ? parentId.includes(d[parentIdField]) : d[parentIdField] == parentId;
+		if (isParent) {
+			const r = {
+				...d
+			};
+			const children = toTreeData({
+				data,
+				idField,
+				parentIdField,
+				childrenField,
+				parentId: d[idField],
+				addParentIds,
+				parentIdsField,
+				parentIds: (parentIds != null ? parentIds : []).concat([d[idField]])
+			});
+			if (children.length > 0) {
+				r[childrenField] = children;
+			}
+			if (addParentIds) {
+				r[parentIdsField] = parentIds != null ? parentIds : [];
+			}
+			result.push(r);
+		}
+	});
+	return result;
+}