浏览代码

工单样式,查询的修改

wsx 10 月之前
父节点
当前提交
3dd008cd66

+ 5 - 6
api/myTicket/index.js

@@ -146,13 +146,12 @@ export async function deviceListQrCode(params) {
 	return Promise.reject(new Error(data.message))
 }
 
-// 维修工单获取数据不对,用pc端的接口
-export async function getRepairList(params) {
-	const data = await get(Vue.prototype.apiUrl + `/eam/workorder/getWorkOrderList`, params)
+// 获取规则名称下拉
+export async function getRuleList(params) {
+	const data = await get(Vue.prototype.apiUrl + `/main/ruleinfo/page`, params)
 	console.log(data)
 	if (data.code == 0) {
-		return data.data
+		return data.data.list
 	}
 	return Promise.reject(new Error(data.message))
-}
-
+}

+ 21 - 34
pages/home/components/KdCard/config.js

@@ -10,13 +10,16 @@ const urgent = {
 // 状态(点巡检·保养)
 const status = {
 	0: '待接收',
+	1: '已接收',
 	2: '执行中',
-	3: '完成'
+	3: '待验收',
+	4: '已验收'
 }
 
 // 状态(维修)
 const repairStatus = {
 	0: '待接收',
+	1: '已接收',
 	2: '执行中',
 	3: '待验收',
 	4: '已验收'
@@ -24,8 +27,7 @@ const repairStatus = {
 
 export default {
 	// 维修工单
-	repair: [
-		{
+	repair: [{
 			label: '紧急程度',
 			key: 'urgent',
 			formatter: formatter(urgent)
@@ -45,8 +47,7 @@ export default {
 		}
 	],
 	// 计划性维修工单
-	planWx: [
-		{
+	planWx: [{
 			label: '报修人',
 			key: 'createUserName2'
 		},
@@ -57,8 +58,7 @@ export default {
 	],
 
 	// 保养
-	maintenance: [
-		{
+	maintenance: [{
 			label: '名称',
 			key: 'planName'
 		},
@@ -81,8 +81,7 @@ export default {
 		}
 	],
 	// 巡点检
-	patrol: [
-		{
+	patrol: [{
 			label: '名称',
 			key: 'planName'
 		},
@@ -105,8 +104,7 @@ export default {
 		}
 	],
 	// 量具送检
-	quantity: [
-		{
+	quantity: [{
 			label: '名称',
 			key: 'planName'
 		},
@@ -129,8 +127,7 @@ export default {
 		}
 	],
 	// 盘点
-	check: [
-		{
+	check: [{
 			label: '盘点名称',
 			key: 'planName'
 		},
@@ -152,8 +149,7 @@ export default {
 		}
 	],
 	// 维修报工 待办
-	backlog_repair: [
-		{
+	backlog_repair: [{
 			label: '维修工单号',
 			key: 'workOrderCode'
 		},
@@ -175,8 +171,7 @@ export default {
 		}
 	],
 	// 维修计划审批 待办
-	backlog_repairPlan: [
-		{
+	backlog_repairPlan: [{
 			label: '计划单号',
 			key: 'workOrderCode'
 		},
@@ -202,8 +197,7 @@ export default {
 	// 	{label: "申请人", key: ""},
 	// ],
 	// 保养计划审批 待办
-	backlog_maintenancePlan: [
-		{
+	backlog_maintenancePlan: [{
 			label: '计划单号',
 			key: 'workOrderCode'
 		},
@@ -234,8 +228,7 @@ export default {
 	// 	{label: "申请人", key: ""},
 	// ],
 	// 巡点检计划审批 待办
-	backlog_patrolPlan: [
-		{
+	backlog_patrolPlan: [{
 			label: '计划单号',
 			key: 'workOrderCode'
 		},
@@ -258,8 +251,7 @@ export default {
 		}
 	],
 	// 盘点工单验收
-	backlog_check: [
-		{
+	backlog_check: [{
 			label: '盘点单号',
 			key: 'workOrderCode'
 		},
@@ -283,8 +275,7 @@ export default {
 		}
 	],
 	// 盘点计划审批
-	backlog_checkPlan: [
-		{
+	backlog_checkPlan: [{
 			label: '计划单号',
 			key: 'workOrderCode'
 		},
@@ -303,8 +294,7 @@ export default {
 		}
 	],
 	// 出库审批
-	backlog_OUT_WAREPlan: [
-		{
+	backlog_OUT_WAREPlan: [{
 			label: '出库单号',
 			key: 'workOrderCode'
 		},
@@ -326,8 +316,7 @@ export default {
 		}
 	],
 	// 入库申请
-	backlog_IN_WAREPlan: [
-		{
+	backlog_IN_WAREPlan: [{
 			label: '入库单号',
 			key: 'workOrderCode'
 		},
@@ -349,8 +338,7 @@ export default {
 		}
 	],
 	// 库存调拨
-	backlog_TRANSFERPlan: [
-		{
+	backlog_TRANSFERPlan: [{
 			label: '调拨单号',
 			key: 'workOrderCode'
 		},
@@ -388,8 +376,7 @@ export default {
 		}
 	],
 	// 报损报溢 工单审批
-	backlog_REPORT_LOSS_OVERFLOW: [
-		{
+	backlog_REPORT_LOSS_OVERFLOW: [{
 			label: '报损报溢单号',
 			key: 'workOrderCode'
 		},
@@ -410,4 +397,4 @@ export default {
 			key: 'applicantName'
 		}
 	]
-}
+}

+ 1 - 1
pages/home/components/KdCard/index.vue

@@ -167,7 +167,7 @@
 
 				.label {
 					// text-align: right;
-					width: 28%;
+					width: 30%;
 					font-size: 28rpx;
 					font-style: normal;
 					font-weight: 400;

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

@@ -70,6 +70,11 @@
 </template>
 
 <script>
+	
+	import {
+		getByCode
+	} from '@/api/pda/common.js'
+	
 	import SearchPopup from '@/pages/pda/components/searchPopup.vue'
 	import {
 		getWorkOrderList,
@@ -303,7 +308,8 @@
 				codeData: [],
 			}
 		},
-		onLoad(e) {
+		async onLoad(e) {
+			
 			this.$nextTick(() => {
 				console.log(this)
 				this.isInstall = false

+ 175 - 58
pages/maintenance/order/order.vue

@@ -1,49 +1,66 @@
 <template>
 	<view>
 		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="保养工单" @clickLeft="back"></uni-nav-bar>
-		<!-- <template>
-			<view class="tab-title">
-				<view v-for="(item, index) in tabList" :key="index" class="tab-item" :class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)">
-					{{ item.label }}
-					<text v-if="item.number > 0" class="title-red">{{ item.number }}</text>
-				</view>
-			</view>
-			<view class="tab-title__placeholder"></view>
-		</template> -->
-		<view class="top-wrapper">
-			<view class="tab_box rx-sc">
-				<view class="tab_item" v-for="(item,index) in tabList" :key="index"
-					:class="{active: pickTabIndex == index}">
-					<view @click="changeChartsTab(index)">
-						{{item.label}}
-						<!-- <text v-if="item.number > 0" class="title-red">{{ item.number }}</text> -->
+
+		<view class="search-box">
+			<uni-section>
+				<uni-easyinput @clear="clearSearch" prefixIcon="search" style="width: 460rpx" v-model="searchForm.code"
+					placeholder="工单编号">
+				</uni-easyinput>
+			</uni-section>
+			<button class="search_btn" @click="doSearch">搜索</button>
+			<!-- <image class="menu_icon" @click="showSearch" src="~@/static/pda/menu.svg"></image> -->
+		</view>
+
+
+		<view v-show="showTab">
+			<view class="top-wrapper">
+				<view class="tab_box rx-sc">
+					<view class="tab_item" v-for="(item,index) in tabList" :key="index"
+						:class="{active: pickTabIndex == index}">
+						<view @click="changeChartsTab(index)" class="badge-c">
+							{{item.label}}
+							<u-badge max="99" :value="item.number" absolute></u-badge>
+							<!-- <text v-if="item.number > 0" class="title-red">{{ item.number }}</text> -->
+						</view>
 					</view>
 				</view>
 			</view>
 		</view>
 
-
 		<OrderTask v-for="(item, index) in tabList" :key="index" v-show="index === pickTabIndex" :list="item.list"
 			:type="tabList.value"></OrderTask>
+
+		<u-toast ref="uToast"></u-toast>
+
+		<MySearch :show.sync="searchShow" :formItems="formItems" @search="confirmSearch" ref="mySearchRef"></MySearch>
 	</view>
 </template>
 
 <script>
 	import {
-		getWorkOrderList
+		isObjectEmpty
+	} from '@/utils/utils.js'
+	import {
+		getWorkOrderList,
+		getRuleList
 	} from '@/api/myTicket'
 	import OrderTask from './OrderTask.vue'
 	import {
 		post,
 		postJ
 	} from '@/utils/api.js'
-	let [page, size, isEnd] = [1, 10, true]
+
 	export default {
 		components: {
 			OrderTask
 		},
 		data() {
 			return {
+				showTab: true,
+				page: 1,
+				size: 10,
+				isEnd: false,
 				tabList: [{
 						value: 0,
 						label: '待接收',
@@ -65,22 +82,41 @@
 				],
 				pickTabIndex: 0,
 				qrContent: null,
-				barType: 0
+				barType: 0,
+				searchShow: false,
+				searchForm: {
+					code: ''
+				},
+				formItems: [{
+						label: '规则名称:',
+						prop: 'ruleId',
+						component: 'MySelect',
+						props: {
+							localdata: [],
+							dataKey: 'name',
+							dataValue: 'id'
+						}
+					},
+					{
+						label: '时间:',
+						prop: 'startEndTime',
+						component: 'MyDateRange',
+						props: {
+							type: 'daterange',
+						}
+					}
+				]
 			}
 		},
+		onLoad() {
+			this.getRuleList()
+		},
 		onShow() {
 			this.getFirstList()
 			this.getStatus()
 		},
-		onReachBottom: function() {
-			if (isEnd) {
-				return
-			}
-			// 显示加载图标
-			uni.showLoading({
-				title: '数据加载中'
-			})
-			this.getMoreLists()
+		onReachBottom() {
+			this.getList()
 		},
 		methods: {
 			getStatus() {
@@ -100,22 +136,7 @@
 				}).then(res => {
 					this.tabList[1].number = res.count
 				})
-				getWorkOrderList({
-					orderStatus: [3],
-					type: 2,
-					pageNum: 1,
-					size: 1
-				}).then(res => {
-					this.tabList[2].number = res.count
-				})
-				getWorkOrderList({
-					orderStatus: [4],
-					type: 2,
-					pageNum: 1,
-					size: 1
-				}).then(res => {
-					this.tabList[3].number = res.count
-				})
+
 			},
 			getCount() {
 				statistics().then(data => {
@@ -152,29 +173,41 @@
 				})
 			},
 			getFirstList: function() {
-				page = 1
-				isEnd = true
-				this.getList()
-			},
-			getMoreLists: function() {
-				//获取更多数据
-				page++
+				this.page = 1
+				this.isEnd = false
 				this.getList()
 			},
+
 			getList() {
+				if (this.isEnd) {
+					this.$refs.uToast.show({
+						message: "暂无更多数据",
+						duration: 1000
+					})
+					return
+				}
 				uni.showLoading({
-					title: '数据加载中'
+					title: '加载中'
 				})
 				let params = {
 					orderStatus: [this.tabList[this.pickTabIndex].value],
 					type: 2,
-					pageNum: page,
-					size
+					pageNum: this.page,
+					size: this.size,
+					...this.searchForm
+				}
+				if (!this.showTab) {
+					delete params.orderStatus
 				}
 				getWorkOrderList(params)
 					.then(res => {
-						this.tabList[this.pickTabIndex].list = res.list
-						isEnd = this.tabList[this.pickTabIndex].list >= res.count
+						if (this.page == 1) {
+							this.tabList[this.pickTabIndex].list = res.list
+						} else {
+							this.tabList[this.pickTabIndex].list.push(...res.list);
+						}
+						this.page += 1
+						this.isEnd = this.tabList[this.pickTabIndex].list.length >= res.count
 						uni.hideLoading()
 					})
 					.catch(() => {
@@ -184,7 +217,42 @@
 			changeChartsTab(index) {
 				this.pickTabIndex = index
 				this.getFirstList()
-			}
+			},
+			async getRuleList() {
+				let params = {
+					status: 1,
+					type: 1,
+					pageNum: 1,
+					size: -1
+				}
+				const res = await getRuleList(params)
+				this.formItems.find(item => item.prop === 'ruleId').props.localdata = res
+			},
+			clearSearch() {
+				this.searchForm.code = ''
+				this.doSearch()
+			},
+			doSearch() {
+				this.isEnd = false;
+				this.page = 1;
+				this.showTab = isObjectEmpty(this.searchForm)
+				this.getList();
+			},
+			showSearch() {
+				this.searchShow = true
+			},
+			confirmSearch(e) {
+				console.log(e);
+				let data = JSON.parse(JSON.stringify(e))
+				this.searchForm = {
+					...this.searchForm,
+					...data
+				}
+				console.log(this.searchForm);
+				this.doSearch()
+			},
+
+
 		}
 	}
 </script>
@@ -220,6 +288,17 @@
 		}
 	}
 
+	.badge-c {
+		position: relative;
+	}
+
+	/deep/.u-badge {
+		top: 0;
+		right: 0;
+		transform: translate(90%, 20%);
+	}
+
+
 	// .tab-title {
 	// 	position: fixed;
 	// 	z-index: 99;
@@ -289,4 +368,42 @@
 	// 	top: 10rpx;
 	// 	min-width: 18rpx;
 	// }
+
+	.search-box {
+		background-color: #fff;
+		display: flex;
+		width: 750rpx;
+		height: 88rpx;
+		padding: 16rpx 32rpx;
+		align-items: center;
+		gap: 16rpx;
+		justify-content: space-between;
+
+		/deep/.uni-section {
+			margin-top: 0px;
+		}
+
+		/deep/.uni-section-header {
+			padding: 0px;
+
+		}
+
+		.search_btn {
+			width: 120rpx;
+			height: 70rpx;
+			line-height: 70rpx;
+			padding: 0 24rpx;
+			background: $theme-color;
+			font-size: 32rpx;
+			color: #fff;
+			margin: 0;
+			margin-left: 26rpx;
+		}
+
+		.menu_icon {
+			width: 44rpx;
+			height: 44rpx;
+			margin-left: 14rpx;
+		}
+	}
 </style>

+ 185 - 72
pages/maintenanceWorkorder/order/order.vue

@@ -1,49 +1,67 @@
 <template>
 	<view>
 		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="维修工单" @clickLeft="back"></uni-nav-bar>
-		<!-- <template>
-			<view class="tab-title">
-				<view v-for="(item, index) in tabList" :key="index" class="tab-item" :class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)">
-					{{ item.label }}
-					<text v-if="item.number > 0" class="title-red">{{ item.number }}</text>
-				</view>
-			</view>
-			<view class="tab-title__placeholder"></view>
-		</template> -->
-		<view class="top-wrapper">
-			<view class="tab_box rx-sc">
-				<view class="tab_item" v-for="(item,index) in tabList" :key="index"
-					:class="{active: pickTabIndex == index}">
-					<view @click="changeChartsTab(index)" class="badge-c">
-						{{item.label}}
-						<u-badge max="99" :value="item.number" absolute ></u-badge>
-						<!-- <text v-if="item.number > 0" class="title-red">{{ item.number }}</text> -->
+
+
+		<view class="search-box">
+			<uni-section>
+				<uni-easyinput @clear="clearSearch" prefixIcon="search" style="width: 460rpx" v-model="searchForm.code"
+					placeholder="工单编号">
+				</uni-easyinput>
+			</uni-section>
+			<button class="search_btn" @click="doSearch">搜索</button>
+			<!-- <image class="menu_icon" @click="showSearch" src="~@/static/pda/menu.svg"></image> -->
+		</view>
+
+
+		<view v-show="showTab">
+			<view class="top-wrapper">
+				<view class="tab_box rx-sc">
+					<view class="tab_item" v-for="(item,index) in tabList" :key="index"
+						:class="{active: pickTabIndex == index}">
+						<view @click="changeChartsTab(index)" class="badge-c">
+							{{item.label}}
+							<u-badge max="99" :value="item.number" absolute></u-badge>
+							<!-- <text v-if="item.number > 0" class="title-red">{{ item.number }}</text> -->
+						</view>
 					</view>
 				</view>
 			</view>
 		</view>
+
 		<OrderTask v-for="(item, index) in tabList" :key="index" v-show="index === pickTabIndex" :list="item.list"
 			:type="tabList.value" :ParentIndex="pickTabIndex"></OrderTask>
+		<u-toast ref="uToast"></u-toast>
+
+		<MySearch :show.sync="searchShow" :formItems="formItems" @search="confirmSearch" ref="mySearchRef"></MySearch>
 	</view>
 </template>
 
 <script>
+	import {
+		isObjectEmpty
+	} from '@/utils/utils.js'
 	import {
 		getWorkOrderList,
-		getAssistList
+		getAssistList,
+		getRuleList
 	} from '@/api/myTicket'
 	import OrderTask from './OrderTask.vue'
 	import {
 		post,
 		postJ
 	} from '@/utils/api.js'
-	let [page, size, isEnd] = [1, 10, false]
+
 	export default {
 		components: {
 			OrderTask
 		},
 		data() {
 			return {
+				showTab: true,
+				page: 1,
+				size: 10,
+				isEnd: false,
 				tabList: [{
 						value: 0,
 						label: '待接收',
@@ -77,23 +95,48 @@
 				],
 				pickTabIndex: 0,
 				qrContent: null,
-				barType: 0
+				barType: 0,
+				searchShow: false,
+				searchForm: {
+					code: ''
+				},
+				formItems: [{
+						label: '规则名称:',
+						prop: 'ruleId',
+						component: 'MySelect',
+						props: {
+							localdata: [],
+							dataKey: 'name',
+							dataValue: 'id'
+						}
+					},
+					{
+						label: '时间:',
+						prop: 'startEndTime',
+						component: 'MyDateRange',
+						props: {
+							type: 'daterange',
+						}
+					}
+				]
+
+
 			}
 		},
+		onLoad() {
+			this.getRuleList()
+		},
 		onShow() {
 			this.changeChartsTab(this.pickTabIndex)
-			// this.getFirstList()
 			this.getStatus()
 		},
-		onReachBottom: function() {
-			if (isEnd) {
+		onReachBottom() {
+			if (this.pickTabIndex === 4) {
+				this.getAList()
 				return
 			}
-			// 显示加载图标
-			uni.showLoading({
-				title: '数据加载中'
-			})
-			this.getMoreLists()
+
+			this.getList()
 		},
 		methods: {
 			getStatus() {
@@ -115,23 +158,7 @@
 				}).then(res => {
 					this.tabList[1].number = res.count
 				})
-				// getWorkOrderList({
-				// 	orderStatus: [3],
-				// 	type: 3,
-				// 	pageNum: 1,
-				// 	size: 1
-				// }).then(res => {
-				// 	// this.tabList[2].number = res.count
-				// })
-				// getWorkOrderList({
-				// 	orderStatus: [4],
-				// 	type: 3,
-				// 	pageNum: 1,
-				// 	size: 1
-				// }).then(res => {
-				// 	// this.tabList[3].number = res.count
-				// })
-				// /eam/PdaWorkOrder/assistList
+
 			},
 			getCount() {
 				statistics().then(data => {
@@ -168,37 +195,43 @@
 				})
 			},
 			getFirstList: function() {
-				page = 1
-				isEnd = false
-				this.getList()
-			},
-			getMoreLists: function() {
-				//获取更多数据
-				// page++
+				this.page = 1
+				this.isEnd = false
 				this.getList()
 			},
+
 			getList() {
+				if (this.isEnd) {
+					this.$refs.uToast.show({
+						message: "暂无更多数据",
+						duration: 1000
+					})
+					return
+				}
 				uni.showLoading({
-					title: '数据加载中'
+					title: '加载中'
 				})
+
 				let params = {
 					orderStatus: [this.tabList[this.pickTabIndex].value],
 					type: 3,
-					pageNum: page,
-					size
+					pageNum: this.page,
+					size: this.size,
+					...this.searchForm
+				}
+
+				if (!this.showTab) {
+					delete params.orderStatus
 				}
 				getWorkOrderList(params)
 					.then(res => {
-						// this.tabList[this.pickTabIndex].list = res.list
-						// this.tabList[this.pickTabIndex].list.push(res.list);
-						// isEnd = this.tabList[this.pickTabIndex].list >= res.count
-						if (page === 1) {
+						if (this.page === 1) {
 							this.tabList[this.pickTabIndex].list = res.list
 						} else {
 							this.tabList[this.pickTabIndex].list.push(...res.list)
 						}
-						page += 1
-						isEnd = this.tabList[this.pickTabIndex].list.length >= res.count;
+						this.page += 1
+						this.isEnd = this.tabList[this.pickTabIndex].list.length >= res.count;
 						uni.hideLoading()
 					})
 					.catch(() => {
@@ -207,8 +240,8 @@
 			},
 			changeChartsTab(index) {
 				this.pickTabIndex = index;
-				page = 1;
-				isEnd = false;
+				this.page = 1;
+				this.isEnd = false;
 				if (index == 4) {
 					this.getAList();
 				} else {
@@ -216,29 +249,71 @@
 				}
 			},
 			async getAList() {
+				if (this.isEnd) {
+					this.$refs.uToast.show({
+						message: "暂无更多数据",
+						duration: 1000
+					})
+					return
+				}
 				uni.showLoading({
-					title: '数据加载中'
+					title: '加载中'
 				})
 				getAssistList({
 						type: 3,
-						pageNum: page,
-						size
+						pageNum: this.page,
+						size: this.size,
+						...this.searchForm
 					}).then(res => {
 						// this.tabList[this.pickTabIndex].list = res.list
 						// isEnd = this.tabList[this.pickTabIndex].list >= res.count
-						if (page === 1) {
+						if (this.page === 1) {
 							this.tabList[this.pickTabIndex].list = res.list
 						} else {
 							this.tabList[this.pickTabIndex].list.push(...res.list)
 						}
-						page += 1
-						isEnd = this.tabList[this.pickTabIndex].list.length >= res.count;
+						this.page += 1
+						this.isEnd = this.tabList[this.pickTabIndex].list.length >= res.count;
 						uni.hideLoading()
 					})
 					.catch(() => {
 						uni.hideLoading()
 					})
-			}
+			},
+			async getRuleList() {
+				let params = {
+					status: 1,
+					type: 1,
+					pageNum: 1,
+					size: -1
+				}
+				const res = await getRuleList(params)
+				this.formItems.find(item => item.prop === 'ruleId').props.localdata = res
+			},
+			clearSearch() {
+				this.searchForm.code = ''
+				this.doSearch()
+			},
+			doSearch() {
+				this.isEnd = false;
+				this.page = 1;
+				this.showTab = isObjectEmpty(this.searchForm)
+				this.getList();
+			},
+			showSearch() {
+				this.searchShow = true
+			},
+			confirmSearch(e) {
+				console.log(e);
+				let data = JSON.parse(JSON.stringify(e))
+				this.searchForm = {
+					...this.searchForm,
+					...data
+				}
+				console.log(this.searchForm);
+				this.doSearch()
+			},
+
 		}
 	}
 </script>
@@ -273,17 +348,55 @@
 
 		}
 	}
-	
+
 	.badge-c {
 		position: relative;
 	}
-	
+
 	/deep/.u-badge {
 		top: 0;
 		right: 0;
 		transform: translate(90%, 20%);
 	}
 
+	.search-box {
+		background-color: #fff;
+		display: flex;
+		width: 750rpx;
+		height: 88rpx;
+		padding: 16rpx 32rpx;
+		align-items: center;
+		gap: 16rpx;
+		justify-content: space-between;
+
+		/deep/.uni-section {
+			margin-top: 0px;
+		}
+
+		/deep/.uni-section-header {
+			padding: 0px;
+
+		}
+
+		.search_btn {
+			width: 120rpx;
+			height: 70rpx;
+			line-height: 70rpx;
+			padding: 0 24rpx;
+			background: $theme-color;
+			font-size: 32rpx;
+			color: #fff;
+			margin: 0;
+			margin-left: 26rpx;
+		}
+
+		.menu_icon {
+			width: 44rpx;
+			height: 44rpx;
+			margin-left: 14rpx;
+		}
+	}
+
 	// .tab-title {
 	// 	position: fixed;
 	// 	z-index: 99;

+ 179 - 59
pages/tour_tally/order/order.vue

@@ -1,46 +1,67 @@
 <template>
 	<view>
 		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="巡点检工单" @clickLeft="back"></uni-nav-bar>
-		<!-- <template>
-			<view class="tab-title">
-				<view v-for="(item, index) in tabList" :key="index" class="tab-item" :class="index === pickTabIndex ? 'active' : ''" @click="changeChartsTab(index)">
-					{{ item.label }}
-					<text v-if="item.number > 0" class="title-red">{{ item.number }}</text>
-				</view>
-			</view>
-			<view class="tab-title__placeholder"></view>
-		</template> -->
-		<view class="top-wrapper">
-			<view class="tab_box rx-sc">
-				<view class="tab_item" v-for="(item,index) in tabList" :key="index"
-					:class="{active: pickTabIndex == index}">
-					<view @click="changeChartsTab(index)">
-						{{item.label}}
+
+		<view class="search-box">
+			<uni-section>
+				<uni-easyinput @clear="clearSearch" prefixIcon="search" style="width: 460rpx" v-model="searchForm.code"
+					placeholder="工单编号">
+				</uni-easyinput>
+			</uni-section>
+			<button class="search_btn" @click="doSearch">搜索</button>
+			<!-- <image class="menu_icon" @click="showSearch" src="~@/static/pda/menu.svg"></image> -->
+		</view>
+
+
+		<view v-show="showTab">
+			<view class="top-wrapper">
+				<view class="tab_box rx-sc">
+					<view class="tab_item" v-for="(item,index) in tabList" :key="index"
+						:class="{active: pickTabIndex == index}">
+						<view @click="changeChartsTab(index)" class="badge-c">
+							{{item.label}}
+							<u-badge max="99" :value="item.number" absolute></u-badge>
+						</view>
 					</view>
 				</view>
 			</view>
 		</view>
+
+
+
 		<OrderTask v-for="(item, index) in tabList" :key="index" v-show="index === pickTabIndex" :list="item.list"
 			:type="tabList.value"></OrderTask>
+
+		<u-toast ref="uToast"></u-toast>
+
+		<MySearch :show.sync="searchShow" :formItems="formItems" @search="confirmSearch" ref="mySearchRef"></MySearch>
 	</view>
 </template>
 
 <script>
 	import {
-		getWorkOrderList
+		isObjectEmpty
+	} from '@/utils/utils.js'
+	import {
+		getWorkOrderList,
+		getRuleList
 	} from '@/api/myTicket'
 	import OrderTask from './OrderTask.vue'
 	import {
 		post,
 		postJ
 	} from '@/utils/api.js'
-	let [page, size, isEnd] = [1, 10, false]
+
 	export default {
 		components: {
 			OrderTask
 		},
 		data() {
 			return {
+				showTab: true,
+				page: 1,
+				size: 10,
+				isEnd: false,
 				tabList: [{
 						value: 0,
 						label: '待接收',
@@ -62,22 +83,41 @@
 				],
 				pickTabIndex: 0,
 				qrContent: null,
-				barType: 0
+				barType: 0,
+				searchShow: false,
+				searchForm: {
+					code: ''
+				},
+				formItems: [{
+						label: '规则名称:',
+						prop: 'ruleId',
+						component: 'MySelect',
+						props: {
+							localdata: [],
+							dataKey: 'name',
+							dataValue: 'id'
+						}
+					},
+					{
+						label: '时间:',
+						prop: 'startEndTime',
+						component: 'MyDateRange',
+						props: {
+							type: 'daterange',
+						}
+					}
+				]
 			}
 		},
+		onLoad() {
+			this.getRuleList()
+		},
 		onShow() {
 			this.getFirstList()
 			this.getStatus()
 		},
-		onReachBottom: function() {
-			if (isEnd) {
-				return
-			}
-			// 显示加载图标
-			uni.showLoading({
-				title: '数据加载中'
-			})
-			this.getMoreLists()
+		onReachBottom() {
+			this.getList()
 		},
 		methods: {
 			getStatus() {
@@ -87,7 +127,7 @@
 					pageNum: 1,
 					size: 1
 				}).then(res => {
-					console.log(res,'res ===')
+					console.log(res, 'res ===')
 					this.tabList[0].number = res.count
 				})
 				getWorkOrderList({
@@ -98,22 +138,7 @@
 				}).then(res => {
 					this.tabList[1].number = res.count
 				})
-				getWorkOrderList({
-					orderStatus: [3],
-					type: 1,
-					pageNum: 1,
-					size: 1
-				}).then(res => {
-					this.tabList[2].number = res.count
-				})
-				getWorkOrderList({
-					orderStatus: [4],
-					type: 1,
-					pageNum: 1,
-					size: 1
-				}).then(res => {
-					this.tabList[3].number = res.count
-				})
+
 			},
 			getCount() {
 				statistics().then(data => {
@@ -150,36 +175,49 @@
 				})
 			},
 			getFirstList: function() {
-				page = 1
-				// isEnd = true
-				isEnd = false
-				this.getList()
-			},
-			getMoreLists: function() {
-				//获取更多数据
-				page++
+				this.page = 1
+				this.isEnd = false
 				this.getList()
 			},
 			getList() {
+				if (this.isEnd) {
+					this.$refs.uToast.show({
+						message: "暂无更多数据",
+						duration: 1000
+					})
+					return
+				}
 				uni.showLoading({
-					title: '数据加载中'
+					title: '加载中'
 				})
+
 				let params = {
 					orderStatus: [this.tabList[this.pickTabIndex].value],
 					type: 1,
-					pageNum: page,
-					size
+					pageNum: this.page,
+					size: this.size,
+					...this.searchForm
 				}
+
+				console.log(this.showTab);
+
+				if (!this.showTab) {
+					delete params.orderStatus
+				}
+
+
+				// return
 				getWorkOrderList(params)
 					.then(res => {
 						// this.tabList[this.pickTabIndex].list = res.list
 						// isEnd = this.tabList[this.pickTabIndex].list >= res.count
-						if(page == 1){
+						if (this.page == 1) {
 							this.tabList[this.pickTabIndex].list = res.list;
-						}else{
+						} else {
 							this.tabList[this.pickTabIndex].list.push(...res.list);
 						}
-						isEnd = this.tabList[this.pickTabIndex].list.length >= res.count;
+						this.page += 1
+						this.isEnd = this.tabList[this.pickTabIndex].list.length >= res.count;
 						uni.hideLoading();
 					})
 					.catch(() => {
@@ -189,7 +227,41 @@
 			changeChartsTab(index) {
 				this.pickTabIndex = index;
 				this.getFirstList();
-			}
+			},
+
+			async getRuleList() {
+				let params = {
+					status: 1,
+					type: 1,
+					pageNum: 1,
+					size: -1
+				}
+				const res = await getRuleList(params)
+				this.formItems.find(item => item.prop === 'ruleId').props.localdata = res
+			},
+			clearSearch() {
+				this.searchForm.code = ''
+				this.doSearch()
+			},
+			doSearch() {
+				this.isEnd = false;
+				this.page = 1;
+				this.showTab = isObjectEmpty(this.searchForm)
+				this.getList();
+			},
+			showSearch() {
+				this.searchShow = true
+			},
+			confirmSearch(e) {
+				console.log(e);
+				let data = JSON.parse(JSON.stringify(e))
+				this.searchForm = {
+					...this.searchForm,
+					...data
+				}
+				console.log(this.searchForm);
+				this.doSearch()
+			},
 		}
 	}
 </script>
@@ -292,4 +364,52 @@
 			min-width: 18rpx;
 		}
 	}
+
+	.badge-c {
+		position: relative;
+	}
+
+	/deep/.u-badge {
+		top: 0;
+		right: 0;
+		transform: translate(90%, 20%);
+	}
+
+	.search-box {
+		background-color: #fff;
+		display: flex;
+		width: 750rpx;
+		height: 88rpx;
+		padding: 16rpx 32rpx;
+		align-items: center;
+		gap: 16rpx;
+		justify-content: space-between;
+
+		/deep/.uni-section {
+			margin-top: 0px;
+		}
+
+		/deep/.uni-section-header {
+			padding: 0px;
+
+		}
+
+		.search_btn {
+			width: 120rpx;
+			height: 70rpx;
+			line-height: 70rpx;
+			padding: 0 24rpx;
+			background: $theme-color;
+			font-size: 32rpx;
+			color: #fff;
+			margin: 0;
+			margin-left: 26rpx;
+		}
+
+		.menu_icon {
+			width: 44rpx;
+			height: 44rpx;
+			margin-left: 14rpx;
+		}
+	}
 </style>

+ 26 - 1
utils/utils.js

@@ -216,4 +216,29 @@ export function toTreeData(option) {
 		}
 	});
 	return result;
-}
+}
+
+
+//判断搜索条件是否为空的函数
+export function isObjectEmpty(obj) {
+	for (const key in obj) {
+		if (obj.hasOwnProperty(key)) {
+			const value = obj[key];
+			if (typeof value === 'object' && value !== null) {
+				if (Array.isArray(value)) {
+					if (value.length > 0) {
+						return false;
+					}
+				} else {
+					if (!isObjectEmpty(value)) {
+						return false;
+					}
+				}
+			} else if (value !== null && value !== undefined && value !== '' && value !== 0 && value !== false) {
+				return false;
+			}
+		}
+	}
+	return true;
+}
+