Эх сурвалжийг харах

Merge branch 'master' of http://120.46.159.163:7400/ezhizao/ezhizao_dms_app

ezhizao_zx 11 сар өмнө
parent
commit
9c04d72331

+ 8 - 0
api/sys/user.js

@@ -1,4 +1,5 @@
 import req from '@/utils/request.js'
+import ud from '@/utils/upload.js'
 
 
 export function getUserByLikeUsername(userName) {
@@ -6,4 +7,11 @@ export function getUserByLikeUsername(userName) {
 		url:'/system/user/getUserByLikeUsername?userName=' + userName,
 		method: 'GET',
 	})
+}
+export function getURL(data) {
+	return ud.upload({
+		url:'/common/upload',
+		method: 'POST',
+		data:data
+	})
 }

+ 2 - 2
pages/dashboard/index.vue

@@ -33,9 +33,9 @@
 		<view class="business-btn uni-row" v-if="showOther && !showSizing" @click="handleToProductionPlan">
 			<text class="label">报工</text>
 		</view>
-<!-- 		<view class="business-btn uni-row" v-if="showInnerTurnover" @click="handleInnerTurnover">
+		<view class="business-btn uni-row" v-if="showInnerTurnover" @click="handleInnerTurnover">
 			<text class="label">内部周转</text>
-		</view> -->
+		</view>
 		<view class="business-btn uni-row" v-if="showSizing" @click="handleToSorting">
 			<text class="label">分选报工</text>
 		</view>

+ 122 - 3
pages/outsourcedInspection/consultation.vue

@@ -14,12 +14,38 @@
 				<view class="label">产品描述</view>
 				<view class="value">{{ lot.productDescription }}</view>
 			</view>
+			<view class="info-row uni-row">
+				<view class="label">咨询部门</view>
+				<view class="value" >
+					<checkbox-group @change="checkboxChange"  style="margin-top: 16px;">
+							<view v-for="(item, index) in consulteList" :key="item.value">
+								<view class="uni-row checkbox-item" >
+									<view style="flex-grow: 1;font-size: 16px;">{{item.label}}</view>
+									<view class="checkboxHidden">
+										<checkbox :value="item.value" :checked="selected.includes(item.value)" color="#0000ff"
+											class="checkbox"  />
+									</view>
+								</view>
+								<view v-if="index!=consulteList.length -1" class='middle'>
+									<view class='segment'></view>
+									<view class='segment'></view>
+								</view>
+							</view>
+						</checkbox-group>
+			</view>
+			</view>
 			<view class="info-row uni-column">
 				<view class="label" style="margin-bottom: 16rpx;">问题描述</view>
 				<view class="value uni-row">
 					<textarea v-model="lot.question"></textarea>
 				</view>
 			</view>
+			<view class="info-row">
+				<view class="label" style="margin-bottom: 16rpx;">照片</view>
+				<view  >
+					<uni-file-picker :value="photoList.url" @select="select" file-mediatype="image" class="my-files" @delete="handleDeletedPhoto" ></uni-file-picker>
+				</view>
+			</view>
 			<view class="btn uni-row" @click.stop="handleSubmit">提交</view>
 		</view>
 	</view>
@@ -43,8 +69,24 @@
 	import {
 		getProductConsult
 	} from '@/api/business/processInspection.js'
+	import {getURL} from '@/api/sys/user.js'
 
 	const lot = ref({});
+	const selected = ref([]);
+	const selectedPhotos = ref([])
+	const urlList = JSON.parse(uni.getStorageSync('baseUrl'))
+	const webHost = ref(urlList.pdfAppURL)
+	const photoList = ref([])
+	const consulteList = ref([
+		{
+				value: 0,
+				label: "技术"
+			},
+			{
+				value: 1,
+				label: "品管"
+			},
+	])
 	// 创建一个引用来存储最后一次请求的时间戳
 	const lastRequestTimestamp = ref(0);
 
@@ -75,8 +117,45 @@
 	onLoad(() => {})
 
 	onShow(() => {})
+	function upLoadImageHandler(arg) {
+		getURL(arg).then(res =>{
+			let data = JSON.parse(res)
+						   selectedPhotos.value.push({
+							   url:data.fileName,
+							   pictureName:data.originalFilename
+						   })
+						   console.log(selectedPhotos.value)
+						   })
+	}
+	function select (e) {
+		console.log(e)
+		const {
+			tempFilePaths,
+			tempFiles
+		} = e	
+		tempFiles.forEach((item,index)=>{
+			upLoadImageHandler({ filePath: tempFilePaths[index],name:item.name})
+		})
+	}
+	function handleDeletedPhoto(e) {
+		let fileName = selectedPhotos.value.map(info => info.name)
+			let index = fileName.findIndex(name => name === e.tempFile.name);
+			selectedPhotos.value.splice(index,1)
+	}
+	//选中咨询部门数据
+	function checkboxChange(value) {
+	lot.value.departments = value.detail.value; // 添加选中项
+	}
+	
 
 	const handleSubmit = () => {
+		if (lot.value.department ===null) {
+			uni.showToast({
+				icon: 'none',
+				title: '请选择咨询部门'
+			})
+			return
+		}
 		if (lot.value.question == null || lot.value.question == '') {
 			uni.showToast({
 				icon: 'none',
@@ -99,9 +178,15 @@
 		}
 
 		store.processInspection = null;
-		uni.$emit('wasteConsultationEvent', {
-			question: lot.value.question
-		})
+		var consultList = []
+		for(let i = 0;i<lot.value.departments.length;i++) {
+			let consult = {}
+			consult.content = lot.value.question
+			consult.consultDepartment = lot.value.departments[i]
+			consult.pictures = selectedPhotos.value
+			consultList.push(consult)
+		}
+		uni.$emit('wasteConsultationEvent',consultList)
 		lot.value = {};
 		uni.navigateBack()
 	}
@@ -156,4 +241,38 @@
 			align-items: center;
 		}
 	}
+	.middle {
+			display: flex;
+			flex-direction: row;
+			align-items: center;
+			justify-content: center
+		}
+		
+		.segment {
+			width: 60%;
+			background-color: rgba(213, 213, 213, 1);
+			border: 1rpx solid rgba(213, 213, 213, 1);
+			margin:8px 0;
+		}
+	.checkbox-item {
+	  display: flex;
+	  justify-content: space-between;
+	  align-items: center;
+	  margin-bottom: 10px;
+	}
+	
+	.checkbox {
+	  margin-right: 10px;
+	}
+	// .uni-file-picker__container{
+	// }
+	.my-files {
+		display: flex;
+		justify-content: center;
+		
+		:deep(.uni-file-picker__container) {
+		flex-direction: row;
+			
+		}
+	}
 </style>

+ 6 - 5
pages/outsourcedInspection/form.vue

@@ -480,11 +480,12 @@
 		unfitInfos.value.push(info)
 	}
 	const addConsultation = (data) => {
-		const info = {
-			content: data.question,
-			status: 0
-		}
-		consultations.value.push(info)
+		console.log(data)
+		let info = data
+		info.forEach(item =>{
+			item.status = 0
+		})
+		consultations.value = info
 		isEventTriggered.value = true; // 更新标志位状态
 	}
 

+ 121 - 6
pages/processInspection/consultation.vue

@@ -14,12 +14,38 @@
 				<view class="label">产品描述</view>
 				<view class="value">{{ lot.productDescription }}</view>
 			</view>
+			<view class="info-row uni-row">
+				<view class="label">咨询部门</view>
+				<view class="value" >
+					<checkbox-group @change="checkboxChange"  style="margin-top: 16px;">
+							<view v-for="(item, index) in consulteList" :key="item.value">
+								<view class="uni-row checkbox-item" >
+									<view style="flex-grow: 1;font-size: 16px;">{{item.label}}</view>
+									<view class="checkboxHidden">
+										<checkbox :value="item.value" :checked="selected.includes(item.value)" color="#0000ff"
+											class="checkbox"  />
+									</view>
+								</view>
+								<view v-if="index!=consulteList.length -1" class='middle'>
+									<view class='segment'></view>
+									<view class='segment'></view>
+								</view>
+							</view>
+						</checkbox-group>
+			</view>
+			</view>
 			<view class="info-row uni-column">
 				<view class="label" style="margin-bottom: 16rpx;">问题描述</view>
 				<view class="value uni-row">
 					<textarea v-model="lot.question"></textarea>
 				</view>
 			</view>
+			<view class="info-row">
+				<view class="label" style="margin-bottom: 16rpx;">照片</view>
+				<view  >
+					<uni-file-picker :value="photoList.url" @select="select" file-mediatype="image" class="my-files" @delete="handleDeletedPhoto" ></uni-file-picker>
+				</view>
+			</view>
 			<view class="btn uni-row" @click.stop="handleSubmit">提交</view>
 		</view>
 	</view>
@@ -30,7 +56,6 @@
 		ref,
 		onMounted,
 		onBeforeUnmount,
-		onUnload,
 		getCurrentInstance
 	} from 'vue'
 	import {
@@ -44,8 +69,23 @@
 	import {
 		getProductConsult
 	} from '@/api/business/processInspection.js'
-
+	import {getURL} from '@/api/sys/user.js'
 	const lot = ref({});
+	const selected = ref([]);
+	const selectedPhotos = ref([])
+	const urlList = JSON.parse(uni.getStorageSync('baseUrl'))
+	const webHost = ref(urlList.pdfAppURL)
+	const photoList = ref([])
+	const consulteList = ref([
+		{
+				value: 0,
+				label: "技术"
+			},
+			{
+				value: 1,
+				label: "品管"
+			},
+	])
 	// 创建一个引用来存储最后一次请求的时间戳
 	const lastRequestTimestamp = ref(0);
 
@@ -75,9 +115,44 @@
 	onLoad(() => {
 
 	})
-
+	function upLoadImageHandler(arg) {
+		getURL(arg).then(res =>{
+			let data = JSON.parse(res)
+						   selectedPhotos.value.push({
+							   url:data.fileName,
+							   pictureName:data.originalFilename
+						   })
+						   console.log(selectedPhotos.value)
+						   })
+	}
+	function select (e) {
+		console.log(e)
+		const {
+			tempFilePaths,
+			tempFiles
+		} = e	
+		tempFiles.forEach((item,index)=>{
+			upLoadImageHandler({ filePath: tempFilePaths[index],name:item.name})
+		})
+	}
+	function handleDeletedPhoto(e) {
+		let fileName = selectedPhotos.value.map(info => info.name)
+			let index = fileName.findIndex(name => name === e.tempFile.name);
+			selectedPhotos.value.splice(index,1)
+	}
+	//选中咨询部门数据
+	function checkboxChange(value) {
+	lot.value.departments = value.detail.value; // 添加选中项
+	}
 
 	const handleSubmit = () => {
+		if (lot.value.department ===null) {
+			uni.showToast({
+				icon: 'none',
+				title: '请选择咨询部门'
+			})
+			return
+		}
 		if (lot.value.question == null || lot.value.question == '') {
 			uni.showToast({
 				icon: 'none',
@@ -99,9 +174,15 @@
 			return;
 		}
 		store.processInspection = null;
-		uni.$emit('addWasteConsultationEvent', {
-			question: lot.value.question
-		})
+		var consultList = []
+		for(let i = 0;i<lot.value.departments.length;i++) {
+			let consult = {}
+			consult.content = lot.value.question
+			consult.consultDepartment = lot.value.departments[i]
+			consult.pictures = selectedPhotos.value
+			consultList.push(consult)
+		}
+		uni.$emit('addWasteConsultationEvent',consultList)
 		lot.value = {};
 
 		uni.navigateBack();
@@ -157,4 +238,38 @@
 			align-items: center;
 		}
 	}
+	.middle {
+			display: flex;
+			flex-direction: row;
+			align-items: center;
+			justify-content: center
+		}
+		
+		.segment {
+			width: 60%;
+			background-color: rgba(213, 213, 213, 1);
+			border: 1rpx solid rgba(213, 213, 213, 1);
+			margin:8px 0;
+		}
+	.checkbox-item {
+	  display: flex;
+	  justify-content: space-between;
+	  align-items: center;
+	  margin-bottom: 10px;
+	}
+	
+	.checkbox {
+	  margin-right: 10px;
+	}
+	// .uni-file-picker__container{
+	// }
+	.my-files {
+		display: flex;
+		justify-content: center;
+		
+		:deep(.uni-file-picker__container) {
+		flex-direction: row;
+			
+		}
+	}
 </style>

+ 5 - 5
pages/processInspection/form.vue

@@ -351,11 +351,11 @@
 		unfitInfos.value.push(info)
 	}
 	const addConsultation = (data) => {
-		const info = {
-			content: data.question,
-			status: 0
-		}
-		consultations.value.push(info);
+	let info = data
+	info.forEach(item =>{
+		item.status = 0
+	})
+	consultations.value = info
 		isEventTriggered.value = true; // 更新标志位状态
 	}
 

+ 124 - 3
pages/sorting/consultation.vue

@@ -14,12 +14,38 @@
 				<view class="label">技术负责人</view>
 				<view class="value">{{ dayworkItem.technicianName }}</view>
 			</view>
+			<view class="info-row uni-row">
+				<view class="label">咨询部门</view>
+				<view class="value" >
+					<checkbox-group @change="checkboxChange"  style="margin-top: 16px;">
+							<view v-for="(item, index) in consulteList" :key="item.value">
+								<view class="uni-row checkbox-item" >
+									<view style="flex-grow: 1;font-size: 16px;">{{item.label}}</view>
+									<view class="checkboxHidden">
+										<checkbox :value="item.value" :checked="selected.includes(item.value)" color="#0000ff"
+											class="checkbox"  />
+									</view>
+								</view>
+								<view v-if="index!=consulteList.length -1" class='middle'>
+									<view class='segment'></view>
+									<view class='segment'></view>
+								</view>
+							</view>
+						</checkbox-group>
+			</view>
+			</view>
 			<view class="info-row uni-column">
 				<view class="label" style="margin-bottom: 16rpx;">问题描述</view>
 				<view class="value uni-row">
 					<textarea v-model="data.content"></textarea>
 				</view>
 			</view>
+			<view class="info-row">
+				<view class="label" style="margin-bottom: 16rpx;">照片</view>
+				<view  >
+					<uni-file-picker :value="photoList.url" @select="select" file-mediatype="image" class="my-files" @delete="handleDeletedPhoto" ></uni-file-picker>
+				</view>
+			</view>
 			<view class="btn uni-row" @click.stop="handleSubmit">提交</view>
 		</view>
 	</view>
@@ -27,7 +53,8 @@
 
 <script setup>
 	import {
-		ref
+		ref,
+		computed 
 	} from 'vue'
 	import {
 		onLoad,
@@ -40,9 +67,26 @@
 		onMounted,
 		getCurrentInstance
 	} from 'vue';
+	import {getURL} from '@/api/sys/user.js'
 	const dayworkItem = ref({})
+	const selected = ref([]);
+	const selectedPhotos = ref([])
+    const urlList = JSON.parse(uni.getStorageSync('baseUrl'))
+	const webHost = ref(urlList.pdfAppURL)
+	const photoList = ref([])
+	const consulteList = ref([
+		{
+				value: 0,
+				label: "技术"
+			},
+			{
+				value: 1,
+				label: "品管"
+			},
+	])
 	const data = ref({
-		content: ''
+		content: '',
+		departments:null
 	})
 
 	// 创建一个引用来存储最后一次请求的时间戳
@@ -66,8 +110,47 @@
 	onLoad(() => {
 
 	})
+	function upLoadImageHandler(arg) {
+		getURL(arg).then(res =>{
+			let data = JSON.parse(res)
+						   selectedPhotos.value.push({
+							   url:data.fileName,
+							   pictureName:data.originalFilename
+						   })
+						   console.log(selectedPhotos.value)
+						   })
+	}
+	function select (e) {
+		console.log(e)
+		const {
+			tempFilePaths,
+			tempFiles
+		} = e	
+		tempFiles.forEach((item,index)=>{
+			upLoadImageHandler({ filePath: tempFilePaths[index],name:item.name})
+		})
+	}
+	function handleDeletedPhoto(e) {
+		let fileName = selectedPhotos.value.map(info => info.name)
+			let index = fileName.findIndex(name => name === e.tempFile.name);
+			selectedPhotos.value.splice(index,1)
+	}
+	//选中咨询部门数据
+	function checkboxChange(value) {
+	data.value.departments = value.detail.value; // 添加选中项
+	}
 
 	const handleSubmit = () => {
+		console.log(selected.value)
+		console.log(selectedPhotos.value)
+		console.log(photoList.value)
+		if (data.value.department ===null) {
+			uni.showToast({
+				icon: 'none',
+				title: '请选择咨询部门'
+			})
+			return
+		}
 		if (data.value.content == null || data.value.content == '') {
 			uni.showToast({
 				icon: 'none',
@@ -88,7 +171,9 @@
 			return;
 		}
 		uni.$emit('addConsulttationEvent', {
-			content: data.value.content
+			content: data.value.content,
+			departments: data.value.departments,
+			pictures: selectedPhotos.value
 		})
 		uni.navigateBack()
 	}
@@ -143,4 +228,40 @@
 			align-items: center;
 		}
 	}
+	.middle {
+		display: flex;
+		flex-direction: row;
+		align-items: center;
+		justify-content: center
+	}
+	
+	.segment {
+		width: 60%;
+		background-color: rgba(213, 213, 213, 1);
+		border: 1rpx solid rgba(213, 213, 213, 1);
+		margin:8px 0;
+	}
+.checkbox-item {
+  display: flex;
+  justify-content: space-between;
+  align-items: center;
+  margin-bottom: 10px;
+}
+
+.checkbox {
+  margin-right: 10px;
+}
+// .uni-file-picker__container{
+// }
+.my-files {
+	display: flex;
+	justify-content: center;
+	
+	:deep(.uni-file-picker__container) {
+	flex-direction: row;
+		
+	}
+}
+
+
 </style>

+ 4 - 2
pages/sorting/form.vue

@@ -208,7 +208,9 @@
 			technologicalProcessDetailId: dayworkItem.value.technologicalProcessDetailId,
 			processId: dayworkItem.value.processId,
 			processAlias: dayworkItem.value.process.processAlias,
-			technicianId: dayworkItem.value.technicianId
+			technicianId: dayworkItem.value.technicianId,
+			departments : data.departments,
+			pictures : data.pictures
 		}
 		saveConsult(info).then(res => {
 			if (res.code === 200) {
@@ -222,7 +224,7 @@
 			}
 		})
 		isEventTriggered.value = true; // 更新标志位状态
-		// consultations.value.push(info)
+		consultations.value.push(info)
 	}
 
 	/***************************** 定义了一些事件 *****************************/

+ 56 - 0
utils/upload.js

@@ -0,0 +1,56 @@
+import { getToken } from '@/utils/auth'
+// import baseURL from '@/api/base/path.js'
+
+function upload({url, data, method="POST"}) {
+	let token = 'Bearer ' + getToken();
+	let header = {
+	    Authorization: token
+	}
+	console.log(data)
+	return new Promise((resolve, reject)=>{
+		const urlList = uni.getStorageSync('baseUrl')
+		uni.uploadFile({
+			url: JSON.parse(urlList).baseUrl + url,
+			method,
+			header,
+			timeout: 600000,
+			filePath:data.filePath,
+			name: 'file',
+			sslVerify: false,
+			success: (res) => {
+				if (res.statusCode === 200) {
+					//请求成功
+					resolve(res.data);
+				} else if (res.statusCode === 401) {
+					uni.showToast({
+						icon: 'none',
+						title: "未登录或登录状态已超时",
+						duration: 1500
+					});
+				} else if (res.statusCode === 405) {
+					uni.showToast({
+						icon: 'none',
+						title: "请求方法错误",
+						duration: 1500
+					});
+				} else {
+					uni.showToast({
+						icon: 'none',
+						title: "请求错误:" + res.statusCode,
+						duration: 1500
+					});
+				}
+			},
+			fail: (err) => {
+				uni.showToast({
+					icon: 'none',
+					title: err.errMsg,
+					duration: 1500
+				});
+				reject(err);
+			}
+		})
+	})
+}
+export default {upload}
+