Browse Source

feat(质检工单): 新增质检工单页面及接口

yusheng 5 tháng trước cách đây
mục cha
commit
c061de372f

+ 20 - 0
api/inspectionWork/index.js

@@ -0,0 +1,20 @@
+import {
+	get,
+	put,
+	putJ,
+	postJ,
+	deleteApi
+} from "@/utils/request";
+import Vue from "vue";
+
+
+// 列表
+export async function getList(data) {
+
+
+	const res = await postJ(Vue.prototype.apiUrl + '/qms/quality_work_order/page', data);
+	if (res.code == 0) {
+		return res.data;
+	}
+	return Promise.reject(new Error(res.message));
+}

+ 50 - 23
enum/dict.js

@@ -1,37 +1,64 @@
 export default {
-  单位: 'unit',
-  条码分类: 'BARCODE',
-  资产类型: 'ASSECTSTYPE',
-  物品类型: 'classify',
-  产地: 'purchase_origin',
-  物品机型: 'product_model_key',
-  物品颜色: 'product_color_key',
-  流程实例的结果: 'bpm_process_instance_result',
+	单位: 'unit',
+	条码分类: 'BARCODE',
+	资产类型: 'ASSECTSTYPE',
+	物品类型: 'classify',
+	产地: 'purchase_origin',
+	物品机型: 'product_model_key',
+	物品颜色: 'product_color_key',
+	流程实例的结果: 'bpm_process_instance_result',
+	质检计划类型: 'inspection_plan_type',
+
 }
 
 //发货审核状态
-export const reviewStatusEnum = [
-  { value: 0, label: '未提交' },
-  { value: 1, label: '审核中' },
-  { value: 2, label: '已审核' },
-  { value: 3, label: '审核未通过' },
-  { value: 7, label: '作废' },
+export const reviewStatusEnum = [{
+		value: 0,
+		label: '未提交'
+	},
+	{
+		value: 1,
+		label: '审核中'
+	},
+	{
+		value: 2,
+		label: '已审核'
+	},
+	{
+		value: 3,
+		label: '审核未通过'
+	},
+	{
+		value: 7,
+		label: '作废'
+	},
 ];
 
 //商品级别
-export const levelList = [
-  { value: '1', text: '特级' },
-  { value: '2', text: '一级' },
-  { value: '3', text: '二级' },
-  { value: '4', text: '三级' }
+export const levelList = [{
+		value: '1',
+		text: '特级'
+	},
+	{
+		value: '2',
+		text: '一级'
+	},
+	{
+		value: '3',
+		text: '二级'
+	},
+	{
+		value: '4',
+		text: '三级'
+	}
 ];
 
 //属性类型
 export const lbjtList = {
-  1: '自制件',
-  2: '采购件',
-  3: '外协件',
-  4: '受托件'
+	1: '自制件',
+	2: '采购件',
+	3: '外协件',
+	4: '受托件'
 };
 
 //需求类型

+ 1 - 1
manifest.json

@@ -2,7 +2,7 @@
     "name" : "智慧工厂",
     "appid" : "__UNI__45B3907",
     "description" : "",
-    "versionName" : "V1.0.3.38",
+    "versionName" : "V1.0.3.39",
     "versionCode" : "100",
     "transformPx" : false,
     "h5" : {

+ 3 - 1
mixins/dictMixins.js

@@ -12,5 +12,7 @@ export default {
   },
   methods: {
     ...mapActions('dict', ['requestDict'])
-  }
+	
+  },
+  
 }

+ 30 - 30
pages.json

@@ -1682,7 +1682,7 @@
 			}
 		},
 
-				{
+		{
 			"path": "pages/pda/selfBuiltPickOrder/components/addPick",
 			"style": {
 				"navigationBarTitleText": "自建领料单",
@@ -1717,7 +1717,7 @@
 			}
 		},
 
-			{
+		{
 			"path": "pages/pda/selfBuiltPickOrder/index/index",
 			"style": {
 				"navigationBarTitleText": "自建领料单",
@@ -1768,7 +1768,7 @@
 			}
 		},
 
-				{
+		{
 			"path": "pages/pda/selfBuiltPickOrder/components/choosePickList",
 			"style": {
 				"navigationBarTitleText": "搜索",
@@ -1785,7 +1785,7 @@
 			}
 		},
 
-			{
+		{
 			"path": "pages/pda/selfBuiltPickOrder/components/selfBuiltPickOrderDetail",
 			"style": {
 				"navigationStyle": "custom",
@@ -1893,9 +1893,8 @@
 			}
 		},
 		{
-			"path" : "pages/pda/outsourcing/components/outsourcingDetail",
-			"style" : 
-			{
+			"path": "pages/pda/outsourcing/components/outsourcingDetail",
+			"style": {
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
@@ -2113,7 +2112,7 @@
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
-		}, 
+		},
 		{
 			"path": "pages/purchasingManage/components/selectProduce",
 			"style": {
@@ -2121,7 +2120,7 @@
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
-		}, 
+		},
 		{
 			"path": "pages/purchasingManage/components/selectTaskName",
 			"style": {
@@ -2345,67 +2344,68 @@
 			}
 		},
 		{
-			"path" : "pages/traceability/traceabilityCode/purchase",
-			"style" : 
-			{
+			"path": "pages/traceability/traceabilityCode/purchase",
+			"style": {
 				"navigationBarTitleText": "采购溯源",
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
 		},
 		{
-			"path" : "pages/traceability/traceabilityCode/production",
-			"style" : 
-			{
+			"path": "pages/traceability/traceabilityCode/production",
+			"style": {
 				"navigationBarTitleText": "生产溯源",
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
 		},
 		{
-			"path" : "pages/traceability/traceabilityCode/quality",
-			"style" : 
-			{
+			"path": "pages/traceability/traceabilityCode/quality",
+			"style": {
 				"navigationBarTitleText": "质检溯源",
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
 		},
 		{
-			"path" : "pages/traceability/traceabilityCode/company",
-			"style" : 
-			{
+			"path": "pages/traceability/traceabilityCode/company",
+			"style": {
 				"navigationBarTitleText": "企业信息",
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
 		},
 		{
-			"path" : "pages/purchasingManage/purchaseNeedManage/index",
-			"style" : 
-			{
+			"path": "pages/purchasingManage/purchaseNeedManage/index",
+			"style": {
 				"navigationBarTitleText": "采购需求",
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
 		},
 		{
-			"path" : "pages/purchasingManage/purchaseNeedManage/components/drawer",
-			"style" : 
-			{
+			"path": "pages/purchasingManage/purchaseNeedManage/components/drawer",
+			"style": {
 				"navigationBarTitleText": "采购需求详情",
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
 		},
 		{
-			"path" : "pages/purchasingManage/purchaseNeedManage/add",
-			"style" : 
-			{
+			"path": "pages/purchasingManage/purchaseNeedManage/add",
+			"style": {
 				"navigationBarTitleText": "采购需求新增",
 				"navigationStyle": "custom",
 				"navigationBarTextStyle": "white"
 			}
+		},
+		{
+			"path": "pages/qms/inspectionWork/index",
+			"style": {
+				"navigationBarTitleText": "质检工单",
+				"navigationStyle": "custom",
+				"navigationBarTextStyle": "white"
+			}
 		}
 	],
 	"tabBar": {

+ 19 - 3
pages/index/index.vue

@@ -116,6 +116,18 @@
 				</view>
 			</view>
 		</view>
+		<view>
+			<CellTip title="质量管理" v-if="qmsList.length > 0"></CellTip>
+			<view class="nav">
+				<view class="nav-content">
+					<view class="nav-item" v-for="(item, index) in qmsList" @click="toNav(item.path)">
+						<span :class="'iconfont ' + item.icon"></span>
+						<i class="badge" v-if="item.badge">{{ item.badge }}</i>
+						<label>{{ item.name }}</label>
+					</view>
+				</view>
+			</view>
+		</view>
 		<view>
 			<CellTip title="溯源管理" v-if="traceabilityList.length > 0"></CellTip>
 			<view class="nav">
@@ -162,6 +174,7 @@
 				timer: null,
 				src1: 'https://cdn.uviewui.com/uview/album/1.jpg',
 				workOrder: {}, // 工单统计数据
+				qmsList: [],
 				//生产类
 				productionList: [],
 				// executeList: [
@@ -292,7 +305,10 @@
 							this.traceabilityList = f.children;
 						} else if (f.path == 'purchasingManage') {
 							this.purchaseManageList = f.children;
+						} else if (f.path == 'qualityManage') {
+							this.qmsList = f.children;
 						}
+
 					})
 				}
 			},
@@ -311,14 +327,14 @@
 						// 获取扫描结果中的URL
 						const scanResult = res.result
 						// 检查URL是否包含traceability
-						if(scanResult && scanResult.includes('/traceability')) {
+						if (scanResult && scanResult.includes('/traceability')) {
 							// 从扫描结果中提取id参数
 							let id = ''
-							if(scanResult.includes('id=')) {
+							if (scanResult.includes('id=')) {
 								// 分割URL获取id参数值
 								const idPart = scanResult.split('id=')[1]
 								// 如果id后面还有其他参数,只取到第一个&之前的部分
-								if(idPart.includes('&')) {
+								if (idPart.includes('&')) {
 									id = idPart.split('&')[0]
 								} else {
 									id = idPart

+ 224 - 0
pages/qms/inspectionWork/index.vue

@@ -0,0 +1,224 @@
+<template>
+	<view class="mainBox">
+		<uni-nav-bar fixed="true" statusBar="true" left-icon="back" title="质检工单" @clickLeft="back">
+		</uni-nav-bar>
+
+		<view class="top-wrapper">
+			<uni-section>
+				<uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称、批次号">
+				</uni-easyinput>
+			</uni-section>
+			<button class="search_btn" @click="doSearch">搜索</button>
+		</view>
+		<div style="height:100rpx;width: 475rpx;"></div>
+		<view class="wrapper">
+			<u-list @scrolltolower="scrolltolower" class="listContent">
+				<view v-for="(item, index) in tableList" :key="item.id" style="position: relative;" >
+					<view class="item">
+						<view class="herder_item">
+							<view class="herder_text"></view>
+							<view class="herder_view">
+								{{ getDictValue('质检计划类型', item.qualityType+'')}}/{{item.code}}/{{item.productCode}}/{{item.productName}}
+							</view>
+						</view>
+						<view class="text">检验项目:</view>
+						<view class="item_value">
+							<view v-for="(row,_index) in item.templateList" :key="index+'_'+_index" :style="{background:row.status==1?'#19be6b':row.status==2?'#ff9900':row.status==3?'#ff9900':'#909399'}">
+								  {{row.inspectionName}}
+							</view>
+						</view>
+					</view>
+				</view>
+				<view style="width:100%;height:40rpx"></view>
+				<view style='margin-top: 20vh;' v-if="tableList.length==0">
+					<u-empty iconSize='150' textSize='32' text='暂无数据'>
+					</u-empty>
+				</view>
+			</u-list>
+
+		</view>
+
+
+
+
+		<u-toast ref="uToast"></u-toast>
+
+	</view>
+</template>
+
+<script>
+	import dictMixns from '@/mixins/dictMixins'
+	import {
+		getList,
+	} from '@/api/inspectionWork/index.js'
+	export default {
+		components: {},
+		mixins: [dictMixns],
+		data() {
+			return {
+
+
+				tableList: [],
+				page: 1,
+				size: 10,
+				isEnd: false,
+				searchVal: ''
+
+			}
+		},
+		computed: {
+
+		},
+		onLoad() {
+			this.requestDict('质检计划类型')
+			this.getList()
+		},
+
+		onShow() {
+			this.isEnd = false
+			this.page = 1
+			// this.getList()
+		},
+		methods: {
+			doSearch() {
+				this.isEnd = false
+				this.page = 1
+				this.getList()
+			},
+			//获取列表信息
+			getList() {
+				if (this.isEnd) {
+					return
+				}
+				uni.showLoading({
+					title: '加载中'
+				})
+
+				let data = {
+					pageNum: this.page,
+					size: this.size,
+					partaName: this.searchVal,
+					recordingMethod:1
+				}
+				getList(data).then(res => {
+					if (this.page === 1) {
+						this.tableList = res.list
+					} else {
+						this.tableList.push(...res.list)
+					}
+					this.page += 1
+					this.isEnd = this.tableList.length >= res.count
+				}).then(() => {
+					uni.hideLoading()
+				})
+			},
+
+
+			scrolltolower() {
+				if (this.isEnd) {
+					return
+				}
+				this.getList();
+			},
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.mainBox {
+		background-color: #f3f8fb
+	}
+
+	// .wrapper{
+
+	// }
+	.top-wrapper {
+		background-color: #fff;
+		display: flex;
+		width: 750rpx;
+		height: 88rpx;
+		padding: 16rpx 32rpx;
+		align-items: center;
+		gap: 16rpx;
+		position: fixed;
+		z-index: 999;
+
+		/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;
+		}
+	}
+
+	.item {
+		width: 720rpx;
+		// height:400rpx;
+		margin: 20rpx auto 0;
+		padding: 26rpx;
+		border-radius: 30rpx;
+		.text{
+			margin-top:20rpx;
+		}
+
+		background: #fff;
+	}
+	.item_value{
+		width: 100%;
+		display:flex;
+		flex-wrap: wrap;
+		margin-left: -10rpx;
+		>view{
+			font-size: 24rpx;
+			color:#fff;
+			padding:12rpx;
+			border-radius:10rpx;
+			background:#979797;
+			margin-left: 10rpx;
+			margin-top:20rpx;
+		}
+	}
+
+	.herder_item {
+		display: flex;
+		// align-items: center;
+		font-size: 28rpx;
+		font-weight: bold;
+
+		.herder_view {
+			width: calc(100% - 20rpx);
+			word-break: break-all;
+		
+		}
+
+		.herder_text {
+			min-width: 10rpx;
+			height: 32rpx;
+			border-radius: 10rpx;
+			background: #00c0a1;
+			margin-right: 12rpx;
+			margin-top: 5rpx;
+		}
+	}
+	
+</style>

+ 44 - 21
pages/tour_tally/check/components/CheckCard.vue

@@ -31,10 +31,12 @@
 			<view class="cell-content">
 				<view class="content-status" v-if="type == 'view'">
 					<!-- {{ item.executeStatus?'正常':'异常' }} -->
-					<div v-if="item.status == 0" style="color: green">正常</div>
-					<div v-else-if="item.status == -1" style="color: red">异常</div>
+
+					<div v-if="item.status == -1" style="color: red">异常</div>
+					<div v-else style="color: green">正常</div>
 				</view>
-				<textarea v-if="type !== 'view'" placeholder="请输入" v-model="item.result" @input="inputChange($event, item)" />
+				<textarea v-if="type !== 'view'" placeholder="请输入" v-model="item.result"
+					@input="inputChange($event, item)" />
 				<view class="result-text" v-else>{{ item.result }}</view>
 				<view class="radio-wrapper">
 					<!-- <div
@@ -93,7 +95,9 @@
 <script>
 	import PreviewPhoto from '@/pages/maintenance/check/components/PreviewPhoto.vue'
 	export default {
-		components:{ PreviewPhoto },
+		components: {
+			PreviewPhoto
+		},
 		props: {
 			item: {
 				type: Object,
@@ -107,9 +111,14 @@
 		},
 		data() {
 			return {
-				statusList: [
-					{ label: '正常', status: 0 },
-					{ label: '异常', status: -1 }
+				statusList: [{
+						label: '正常',
+						status: 1
+					},
+					{
+						label: '异常',
+						status: -1
+					}
 				]
 			}
 		},
@@ -125,17 +134,17 @@
 				if (obj.target.value.length > 0) {
 					item.status = -1
 				} else {
-					item.status = 0
+					item.status = 1
 				}
 			},
 			changeStatus(item, it) {
 				item.status = it.status
 			},
-			
+
 			// *** 新增拍照功能
 			chooseImage() {
 				const _this = this
-				if(_this.photoList.length >= 9){
+				if (_this.photoList.length >= 9) {
 					_this.$refs.uToast.show({
 						type: "warning",
 						message: "最多上传9张照片",
@@ -150,7 +159,7 @@
 						uni.showLoading({
 							title: '加载中'
 						})
-			
+
 						_this.uploadFile(res.tempFilePaths).then(res => {
 							res.forEach(item => {
 								let fileNames = item.storePath.split('/')
@@ -164,14 +173,14 @@
 									_this.$set(_this.item, 'photoList', [url])
 								} else {
 									// 不能存储超过 9 张
-									if(_this.item.photoList.length < 9){
+									if (_this.item.photoList.length < 9) {
 										_this.item.photoList.push(url);
 									}
 								}
 								// _this.imgs.push(url)
 							})
 							uni.hideLoading()
-			
+
 						})
 					}
 				});
@@ -201,8 +210,8 @@
 				return Promise.all(PromiseAll)
 			},
 			// 图片删除
-			imagedelete(index){
-				this.item.photoList.splice(index,1);
+			imagedelete(index) {
+				this.item.photoList.splice(index, 1);
 			},
 		}
 	}
@@ -210,9 +219,11 @@
 
 <style lang="scss" scoped>
 	$border-color: #f2f2f2;
+
 	.kd-check-card {
 		font-size: 28rpx;
 		border: 1rpx solid $border-color;
+
 		.label {
 			display: inline-block;
 			width: 80rpx;
@@ -220,28 +231,34 @@
 			border-right: 1px solid $border-color;
 			justify-content: center;
 		}
-		.mark{
+
+		.mark {
 			width: 80rpx;
 			height: 4rpx;
 			display: inline-block;
 		}
+
 		.title {
 			line-height: 72rpx;
 			font-weight: bold;
 			background-color: #f2f2f2;
 		}
+
 		.card-cell {
 			min-height: 72rpx;
 			display: flex;
 			align-items: stretch;
 			border: 1px solid $border-color;
+
 			text {
 				display: flex;
 				align-items: center;
 			}
 		}
+
 		.cell-content {
 			flex: 1;
+
 			.content-status {
 				width: 100%;
 				height: 50rpx;
@@ -250,27 +267,33 @@
 				border-bottom: 1rpx solid #f2f2f2;
 			}
 		}
+
 		.radio-wrapper {
 			padding: 10rpx 20rpx;
 			border-bottom: 1px solid $border-color;
 			margin-left: -8rpx;
 		}
+
 		/deep/uni-textarea {
 			width: 100%;
 			box-sizing: border-box;
 		}
+
 		.result-text {
 			min-height: 100rpx;
 			padding: 10rpx;
 		}
+
 		.cell-content {
 			padding-left: 8rpx;
 		}
+
 		.radio-wrapper {
 			display: flex;
 			align-items: center;
 			justify-content: space-around;
 		}
+
 		.wrapper-box {
 			width: 45%;
 			height: 80rpx;
@@ -281,15 +304,15 @@
 			border-radius: 15rpx;
 		}
 	}
-	
+
 	.photo_info {
 		width: 100%;
 		padding: 6px 12rpx;
-		
-		.btn_box{
+
+		.btn_box {
 			width: 100%;
 		}
-	
+
 		.photo_btn {
 			background-color: #157a2c;
 			width: 140rpx;
@@ -303,4 +326,4 @@
 			display: inline-block !important;
 		}
 	}
-</style>
+</style>

+ 1 - 1
pages/tour_tally/check/index.vue

@@ -114,7 +114,7 @@
 							operationGuide: item.operationGuide,
 							result: item.result,
 							serialNum: item.serialNum,
-							status: item.status,
+							status:item.status==-1?-1:1,
 							photoList: item.photoList || []
 						}
 					})

+ 1 - 0
store/getters.js

@@ -9,6 +9,7 @@ const getters = {
     ) || {},
   // 根据字典enumName  和 dictCode 获取字典 值(名称
   getDictValue: state => (enumName, dictCode) => {
+	  console.log(state.dict,'state.dict')
     const obj = (state.dict[dictEnum[enumName]] || []).find(
       item => item.dictCode === dictCode
     )

+ 31 - 9
store/modules/dict.js

@@ -1,14 +1,21 @@
 import dictEnum from '@/enum/dict'
 import Vue from 'vue'
+// import {
+// 	get,
+// 	postJ
+// } from "@/utils/api.js";
 import {
 	get,
-	postJ
-} from "@/utils/api.js";
-const getSubListByParentId = function (id = 0){
+	put,
+	putJ,
+	postJ,
+	deleteApi
+} from "@/utils/request";
+const getSubListByParentId = function(id = 0) {
 	return get(Vue.prototype.apiUrl + `/classify/getSubListByParentId/${id}`)
 }
-const getDictListByMainCode = function (mainCode){
-	return get(Vue.prototype.apiUrl + `/enumerationKeyvalue/getListByMainCode/${mainCode}`,undefined)
+const getDictListByMainCode = function(mainCode) {
+	return get(Vue.prototype.apiUrl + `/system/dict/getByCode/${mainCode}`)
 }
 //非枚举定义
 const otherDictConfig = {
@@ -28,6 +35,7 @@ const mutations = {
 		code,
 		dict
 	}) => {
+		console.log(dict, 'dict1')
 		Vue.set(state, code, dict)
 	}
 
@@ -61,7 +69,7 @@ const actions = {
 		let res
 		if (otherDictConfig[dictEnum[enumName]]) {
 			const config = otherDictConfig[dictEnum[enumName]]
-			console.log(config)
+
 			//非枚举定义
 			res = await config.request()
 			if (res?.success) {
@@ -78,10 +86,17 @@ const actions = {
 			}
 		} else {
 			res = await getDictListByMainCode(code)
-			if (res?.success) {
+			if (res?.code == 0) {
 				commit('ADD_DICT', {
 					code,
-					dict: res.data
+					dict: res.data.map((item) => {
+					const arr = Object.entries(item)[0] || [];
+
+					return {
+						dictCode:  arr[0],
+						dictValue: arr[1]
+					};
+				})
 				})
 				return res.data
 			}
@@ -98,7 +113,14 @@ const actions = {
 		if (res?.success) {
 			commit('ADD_DICT', {
 				code,
-				dict: res.data
+				dict: res.data.map((item) => {
+					const arr = Object.entries(item)[0] || [];
+
+					return {
+						dictCode:arr[0],
+						dictValue: arr[1]
+					};
+				})
 			})
 			return res.data
 		}