From 03627defbc56d0498e7778523da255eb972db6a4 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期四, 04 十二月 2025 10:25:03 +0800
Subject: [PATCH] 删除 安装包
---
qrcodeScaner/pages/reportingWork/reportingWork.vue | 686 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 686 insertions(+), 0 deletions(-)
diff --git a/qrcodeScaner/pages/reportingWork/reportingWork.vue b/qrcodeScaner/pages/reportingWork/reportingWork.vue
new file mode 100644
index 0000000..32f53db
--- /dev/null
+++ b/qrcodeScaner/pages/reportingWork/reportingWork.vue
@@ -0,0 +1,686 @@
+<template>
+ <view class='main'>
+
+ <view class="flex-item title_main">
+ <uni-section class='title_section' title="" >
+ <template v-slot:right>
+ <button @click="scannerCode" class='scanner_code' size='mini'>鍐嶆鎵爜</button>
+ <button @click="saveReportForWork" v-if="reportworkList.length>0" class="reporting_work" size='mini'>瀹℃牳鎶ュ伐</button>
+ </template>
+ </uni-section>
+
+
+
+ </view>
+ <view class="flex-item table_main">
+ <template v-for="(items,index1) in reportworkList">
+ <uni-section :title="'娴佺▼鍗″彿:'+items.processTitle.processId" type="line" >
+ <template v-slot:right>
+ <button @click="deleteProcess(index1)" v-if="reportworkList.length>1" size='mini'>绉婚櫎</button>
+ </template>
+ </uni-section>
+ <uni-table border stripe style='width:100%;overflow-y: auto;margin-bottom: 1rem;'>
+ <uni-tr>
+ <uni-th width='48' align="center">搴忓彿</uni-th>
+ <uni-th width='48' align="center">灏忕墖</uni-th>
+ <uni-th width='50' align="center">瀹�</uni-th>
+ <uni-th width='50' align="center">楂�</uni-th>
+ <uni-th width='50' align="center">鎬绘暟</uni-th>
+ <uni-th
+ @click="cleanAllFinish(index1)"
+ width='50'
+ align="center"
+ style="background-color: #409eff;color: black;"
+ >瀹屽伐</uni-th>
+ <uni-th width='50' align="center">娆$牬</uni-th>
+ </uni-tr>
+
+ <uni-tr v-for="(item,index) in items.processList">
+ <uni-td>{{item.order_number}}</uni-td>
+ <uni-td>{{item.technology_number}}</uni-td>
+ <uni-td>{{item.child_width}}</uni-td>
+ <uni-td>{{item.child_height}}</uni-td>
+ <uni-td>{{item.quantity}}</uni-td>
+ <uni-td>
+ <!-- @keyboardheightchange @blur-->
+ <input type="number" v-model='item.completedQuantity'
+ @confirm="changeFinishNum(item)"
+ @blur="changeFinishNum(item)"
+ />
+ </uni-td>
+ <uni-td>
+ <input type="number" v-model='item.breakageQuantity'
+ @confirm='changeBreakNum(item,index,index1)'
+ @blur="changeBreakNum(item,index,index1)"
+ />
+ </uni-td>
+ </uni-tr>
+ </uni-table>
+ </template>
+ </view>
+ <!-- <view class="flex-item uni-bg-blue">C</view> -->
+
+ </view>
+
+ <!-- 娆$牬寮瑰嚭灞� -->
+ <uni-popup class='breakInfo' ref="popup" :mask-click="false" >
+ <view class="flex-item foot_main">
+ <uni-row>
+ <uni-col class='break_col' :span='24' >绗瑊{damageShowRow}}琛�</uni-col>
+ </uni-row>
+ <uni-row>
+ <uni-col class='break_col' :span='8' >娆$牬绫诲瀷:</uni-col>
+ <uni-col class='break_col' :span='16'>
+ <uni-data-select
+ v-model="damageDetail.breakageType"
+ :localdata="breakageType"
+ />
+ </uni-col>
+ </uni-row>
+ <uni-row>
+ <uni-col class='break_col' :span='8' >娆$牬鍘熷洜:</uni-col>
+ <uni-col class='break_col' :span='16' >
+ <uni-data-select
+ v-model="damageDetail.breakageReason"
+ :localdata="breakageReason"
+ />
+ </uni-col>
+ </uni-row>
+ <uni-row>
+ <uni-col class='break_col' :span='8' >璐d换宸ュ簭:</uni-col>
+ <uni-col class='break_col' :span='16'>
+ <uni-data-select
+ v-model="damageDetail.responsibleProcess"
+ :localdata="responsibleProcess"
+ @change='changeResponsibleProcess'
+ />
+ </uni-col>
+ </uni-row>
+ <uni-row>
+ <uni-col class='break_col' :span='8' >璐d换璁惧:</uni-col>
+ <uni-col class='break_col' :span='16'>
+ <uni-data-select
+ v-model="damageDetail.responsibleEquipment"
+ :localdata="responsibleEquipment"
+ />
+ </uni-col>
+ </uni-row>
+ <uni-row>
+ <uni-col class='break_col' :span='8' >璐d换鐝粍:</uni-col>
+ <uni-col class='break_col' :span='16'>
+ <uni-data-select
+ v-model="damageDetail.responsibleTeam"
+ :localdata="responsibleTeam"
+ />
+ </uni-col>
+ </uni-row>
+ <uni-row>
+ <uni-col class='break_col' :span='8' >鍙埄鐢�:</uni-col>
+ <uni-col class='break_col' :span='16'>
+ <checkbox-group @change='changeAvailable($event)'>
+ <checkbox :value="1" />
+ </checkbox-group>
+ </uni-col>
+ </uni-row>
+ <uni-row>
+ <uni-col class='break_col' :span='8' >杩斿洖宸ュ簭:</uni-col>
+ <uni-col class='break_col' :span='16'>
+ <uni-data-select
+ v-model="damageDetail.returnProcess"
+ :localdata="backProcess"
+ />
+ </uni-col>
+ </uni-row>
+ <uni-row>
+ <uni-col class='break_col' :span='8' >璐d换淇℃伅:</uni-col>
+ <uni-col class='break_col' :span='16'>
+ <input v-model="damageDetail.responsiblePersonnel" />
+ </uni-col>
+ </uni-row>
+ </view>
+ <view>
+
+ <uni-row>
+ <uni-col :span='12'>
+ <button @click="close(0)">鍙栨秷</button>
+ </uni-col>
+ <uni-col :span='12'>
+ <button type="primary" @click="close(1)">纭畾</button>
+ </uni-col>
+ </uni-row>
+ </view>
+ </uni-popup>
+
+ <!-- 鎻愮ず寮圭獥 -->
+ <view>
+ <!-- 鎻愮ず绐楃ず渚� -->
+ <uni-popup ref="alertDialog" type="dialog">
+ <uni-popup-dialog type="warn"
+ cancelText="鍐嶆鎶ュ伐"
+ confirmText="纭瀹屾垚"
+ title="閫氱煡"
+ content="娴佺▼鍗℃暟閲忚繕鏈叏閮ㄦ姤瀹�!"
+ @confirm="dialogConfirm"
+ @close="dialogClose" />
+ </uni-popup>
+ </view>
+ <view>
+ <!-- 鎻愮ず淇℃伅寮圭獥 -->
+ <uni-popup ref="message" type="message">
+ <uni-popup-message :type="msgType" :message="messageText" :duration="3000"></uni-popup-message>
+ </uni-popup>
+ </view>
+</template>
+
+<script setup>
+import { computed, onMounted,ref, watch } from 'vue'
+import { onLoad } from '@dcloudio/uni-app'
+import userInfo from '@/stores/userInfo'
+import request from '@/utils/request'
+import mpaasScan from '@/utils/scanner.js'
+ const store=userInfo()
+ let processId = ref(null)
+ let process = ref(null)
+ let damageShowFlag = ref(false)
+ let damageShowProcessIndex = ref(-1)
+ let damageShowRow = ref(0)
+ let processTitle = ref(null)
+ let processList = ref([])
+ let buttonLoading = ref(true)
+ const alertDialog = ref(null)
+ const message = ref(null)
+ const popup = ref(null)
+ const type=ref('center')
+ const msgType=ref('success')
+ const messageText=ref('')
+
+ const reportworkList = ref([])
+
+ //瀹氫箟鎺ユ敹鍔犺浇琛ㄥご涓嬫媺鏁版嵁
+ const titleSelectJson = ref({
+ historyDevice:[],
+ historyTeams:[],
+ historyProcess:[],
+ breakageType:[],
+ breakageReason:[]
+ })
+
+ //瀹氫箟鐮存崯鏄庣粏
+ const damageDetail = ref({
+ breakageQuantity: null,//鐮存崯鏁伴噺
+ available: null,//鍙埄鐢�
+ returnProcess: null,//杩斿洖宸ュ簭
+ breakageType: null,//鐮存崯绫诲瀷
+ breakageReason: null,//鍘熷洜
+ responsibleProcess: null,//璐d换宸ュ簭
+ responsibleEquipment: null,//璐d换璁惧
+ responsibleTeam: null,//璐d换鐝粍
+ responsiblePersonnel: null//璐d换淇℃伅
+ })
+
+ const messageToggle = (type,msg) => {
+ msgType.value = type
+ messageText.value = msg
+ message.value.open()
+ }
+
+
+ onLoad(async (option)=>{
+
+ processId.value = option.processId
+ process.value = option.process
+ await getProcessCardList(option.processId,option.process)
+ buttonLoading.value = false
+
+
+ })
+ //鏌ヨ娴佺▼鍗�
+ const getProcessCardList = (processId1,process1) => {
+
+ if(processId1.indexOf('/')!==14){
+ uni.showModal({
+ title: '鎻愮ず',
+ content: "璇疯緭鍏ユ纭牸寮忕殑娴佺▼鍗�",
+ showCancel:false
+ });
+ return
+ }
+ const processIdList = processId1.split('/')
+ if(processIdList[1].length>1){
+ uni.showModal({
+ title: '鎻愮ず',
+ content: "app涓嶆敮鎸佸灞傚悎骞朵簩缁寸爜",
+ showCancel:false
+ });
+ return
+ }
+
+ const reportType = 2//鎶ュ伐鏄惁鏌ヨ鏍峰搧璁㈠崟2鏌ヨ锛�1涓嶆煡璇�
+ request.post(`/reportingWork/addSelectLastWork/${processIdList[0]}/${processIdList[1]}/${process1}/${reportType}`)
+ .then((res) => {
+ if (res.code == 200) {
+ const reportData = {}
+ reportData.processList = res.data.Detail
+ res.data.data.processId = processId1
+ reportData.processTitle = res.data.data
+ reportworkList.value.push(reportData)
+ const index = reportworkList.value.length-1
+
+ //鍘嗗彶鐝粍
+ res.data.historyTeams.unshift(
+ {
+ basic_name:store.user.userName,
+ process:process.value
+ }
+ )
+ titleSelectJson.value.historyTeams= res.data.historyTeams
+
+ //鍘嗗彶璁惧
+ titleSelectJson.value.historyDevice = res.data.historyDevice
+ //鍘嗗彶宸ュ簭
+ titleSelectJson.value.historyProcess = res.data.historyProcess
+ //娆$牬绫诲瀷
+ titleSelectJson.value.breakageType = res.data.breakageType
+ //娆$牬鍘熷洜
+ titleSelectJson.value.breakageReason = res.data.breakageReason
+ }
+ }).catch(err => {
+ uni.showModal({
+ title: '鎻愮ず',
+ content: err,
+ showCancel:false
+ });
+ })
+ }
+ //鎶ュ伐淇濆瓨
+ const saveReportForWork = () => {
+ for (let item of reportworkList.value) {
+ const finishNumVal = finishNum(item.processList)
+ if(finishNumVal===0){
+ messageToggle('error',`${item.processTitle.processId}瀹屽伐鏁伴噺鎴栨鐮存暟閲忚嚦灏戝ぇ浜�0`)
+ return
+ }
+
+ let notSame = null
+
+ for(let i in item.processList){
+ if(item.processList[i].breakageQuantity!== undefined && item.processList[i].breakageQuantity!==null && item.processList[i].breakageQuantity!==''){
+ if(item.processList[i].damageDetails === undefined){
+ messageToggle('error',`搴忓彿'${item.processList[i].order_number}'鏈娴嬪埌娆$牬鏁版嵁`)
+ return
+ }else{
+ if(item.processList[i].damageDetails[0].breakageQuantity*1!==item.processList[i].breakageQuantity*1){
+ messageToggle('error',`搴忓彿'${item.processList[i].order_number}'娆$牬鏁伴噺涓嶅尮閰峘)
+ return
+ }
+ }
+ }else{
+ delete item.processList[i].breakageQuantity
+ }
+
+
+ }
+
+
+ const hasConflict = item.processList.some((item1, index) => {
+ // 妫�鏌ュ綋鍓嶅厓绱犱箣鍚庢槸鍚︽湁鐩稿悓 id 浣嗕笉鍚� num 鐨勫璞�
+ return item.processList.slice(index + 1).some(other => {
+ if(other.order_number === item1.order_number
+ && other.completedQuantity !== item1.completedQuantity
+ || other.quantity<other.completedQuantity){
+
+ notSame = other
+ return true
+ }
+ }
+ )
+ })
+ if(hasConflict){
+ messageToggle('error',`娴佺▼鍗�${item.processTitle.processId} 搴忓彿'${notSame.order_number}'鍚屽簭鍙峰畬宸ヤ笉鐩稿悓鎴栨暟閲忚秴杩囨�绘暟`)
+ return
+ }
+
+
+
+ item.processTitle.teamsGroupsName = store.user.userName
+ item.processTitle.deviceName =store.choiceDevice.text ||'phone'
+ item.processTitle.deviceId =store.choiceDevice.value ||''
+ item.processTitle.creatorId = store.user.userId
+ item.processTitle.creator = store.user.userName
+ item.processTitle.classes = store.user.class
+
+ }
+ buttonLoading.value = true
+ const requestData = {
+ reportingWorks:reportworkList.value,
+ type:0,//瀹℃牳鐘舵��
+ userId:store.user.userId,
+ userName:store.user.userName,
+ qualityInsStatus:2//璺ㄥ伐搴忚川妫�瀹℃牳锛�1涓嶉渶瑕侊紝2闇�瑕�
+ }
+ request.post(`/app/addWorkInProgress`,requestData).then(res =>{
+ if(res.code == 200){
+ if(allQuantity(reportworkList.value[0].processList)>finishNum(reportworkList.value[0].processList) && reportworkList.value.length===1){
+ alertDialog.value.open()
+ }else{
+ uni.reLaunch({
+ url: `/pages/mainView/mainView?state=success`
+ })
+ }
+
+ }else{
+ const errorObj = JSON.parse(res.msg)
+ const msg = t('reportingWorks.pleaseNumber1')+"锛�"+errorObj.orderNumber+'\n'
+ +t('reportingWorks.pleaseNumber2')+'锛�'+errorObj.technologyNumber+'\n'
+ +t('reportingWorks.pleaseNumber3')+'锛�'+errorObj.processNum+'<'+
+ +t('reportingWorks.pleaseNumber4')+'锛�'+errorObj.sumNum+'\n'
+ +t('reportingWorks.pleaseNumber5')
+ messageToggle('error',msg)
+ }
+ }).catch(err => {
+ uni.showModal({
+ title: '鎻愮ず',
+ content: err,
+ showCancel:false
+ });
+ }).finally(() => {
+ buttonLoading.value = false
+ })
+ }
+
+ //寮瑰嚭妗嗙‘璁�
+ const dialogConfirm = () => {
+ uni.reLaunch({
+ url: `/pages/mainView/mainView?state=success`
+ })
+ }
+ const dialogClose = () => {
+ uni.redirectTo({
+ url: `/pages/reportingWork/reportingWork?processId=${processId.value}`
+ });
+ }
+
+ //涓嬪伐搴忓鏍�
+ const reviewReportForWork = () => {
+ const reportWork = {
+ process: processTitle.value.previousProcess,
+ processId:processId.value,
+ thisProcess:processTitle.value.thisProcess,
+ technologyStr:processId.value.split('/')[1],
+ userName:store.user.userName
+ }
+ request.post("/reportingWork/reviewReportingWork",reportWork).then((res) =>{
+ if(res.code === '200'){
+ uni.redirectTo({
+ url: `/pages/reportingWork/reportingWork?processId=${processId.value}`
+ })
+ }
+ }).catch(err => {
+ uni.showModal({
+ title: '鎻愮ず',
+ content: err,
+ showCancel:false
+ });
+ })
+ }
+ //姝ゆ祦绋嬪崱鐩墠鎬绘暟閲�
+ const allQuantity = (processList) =>{
+ let sum = 0
+ processList.forEach( item => {
+ let quantity = item.quantity*1 || 0
+ sum += quantity
+ })
+ return sum
+ }
+ // 瀹屽伐娆$牬鎬绘暟閲�
+ const finishNum = (processList) => {
+ let sum = 0
+ processList.forEach( item => {
+ let finish = item.completedQuantity*1 || 0
+ let breakNum = item.breakageQuantity*1 || 0
+ sum += finish
+ sum += breakNum
+ })
+ return sum
+ }
+ //鎵撳紑鎻愮ず妗�
+
+ //鍒ゆ柇鍙埄鐢�
+ const backProcess = ref([])
+ const changeAvailable = (e) => {
+ backProcess.value = []
+ if(e.detail.value.length){
+ damageDetail.value.available = 1
+ titleSelectJson.value.historyProcess.forEach( item => {
+ backProcess.value.push({
+ value:item.basic_category,
+ text:item.basic_category
+ })
+ })
+ }else{
+ damageDetail.value.available = null
+ damageDetail.value.returnProcess = null
+ }
+ }
+ //璐d换宸ュ簭
+ const responsibleProcess = computed(()=>{
+ let list = []
+ titleSelectJson.value.historyProcess.forEach( item => {
+ list.push({
+ value:item.basic_category,
+ text:item.basic_category
+ })
+ })
+ return list
+ })
+ //璁$畻灞炴�� 娆$牬绫诲瀷
+ const breakageType = computed(()=>{
+ let list = []
+ titleSelectJson.value.breakageType.forEach( item => {
+ list.push({
+ value:item.basic_name,
+ text:item.basic_name
+ })
+ })
+ return list
+ })
+
+ //璁$畻灞炴�� 娆$牬鍘熷洜
+ const breakageReason = computed(()=>{
+ let list = []
+ titleSelectJson.value.breakageReason.forEach( item => {
+ list.push({
+ value:item.basic_name,
+ text:item.basic_name
+ })
+ })
+ return list
+ })
+
+ //璐d换璁惧 responsibleEquipment
+ const responsibleEquipment = ref([])
+ const responsibleTeam = ref([])
+ const changeResponsibleProcess = () =>{
+ responsibleEquipment.value = []
+ responsibleTeam.value = []
+ damageDetail.value.responsibleEquipment = null
+ damageDetail.value.responsibleTeam = null
+ titleSelectJson.value.historyDevice.forEach( item => {
+ if(item.basic_category===damageDetail.value.responsibleProcess){
+ responsibleEquipment.value.push({
+ value:item.basic_name,
+ text:item.basic_name
+ })
+ }
+ })
+ titleSelectJson.value.historyTeams.forEach( item => {
+ if(item.process===damageDetail.value.responsibleProcess){
+ responsibleTeam.value.push({
+ value:item.basic_name,
+ text:item.basic_name
+ })
+ }
+ })
+ }
+
+
+
+ // 瀹屽伐鏀瑰彉
+ const changeFinishNum = (row) => {
+ damageShowFlag.value = false
+ const finishNum = row.completedQuantity*1 || 0
+ const breakNum = row.breakageQuantity*1 || 0
+ if((row.quantity-finishNum-breakNum)<0){
+ row.completedQuantity = null
+ return
+ }
+ reportworkList.value.forEach(items => {
+ items.processList.forEach(item => {
+ if(item.order_number == row.order_number && finishNum<=item.quantity){
+ item.completedQuantity = finishNum
+ }
+ })
+ })
+
+ }
+ const changeBreakNum = (row,index,index1) => {
+ const finishNum = row.completedQuantity*1 || 0
+ const breakNum = row.breakageQuantity*1 || 0
+ if((row.quantity-breakNum)<0){
+ row.breakageQuantity = null
+ return
+ }
+ row.completedQuantity = row.quantity-breakNum
+ if(reportworkList.value[index1].processList[index].damageDetails){
+ damageDetail.value = reportworkList.value[index1].processList[index].damageDetails[0]
+ }else{
+ for(let index in damageDetail.value){
+ damageDetail.value[index] = null
+ }
+ }
+
+ if(breakNum*1>0){
+ damageDetail.value.breakageQuantity = breakNum*1
+ damageShowRow.value = index+1
+ damageShowProcessIndex = index1
+ popup.value.open()
+ }else{
+ delete reportworkList.value[index1].processList[index].damageDetails
+ for(let index in damageDetail.value){
+ damageDetail.value[index] = null
+ }
+ }
+
+ }
+
+ const rules = {
+ breakageType: '璇烽�夋嫨娆$牬绫诲瀷',
+ breakageReason:'璇烽�夋嫨娆$牬鍘熷洜',
+ responsibleProcess:'璇烽�夋嫨璐d换宸ュ簭',
+ responsibleEquipment:'璇烽�夋嫨璐d换璁惧',
+ responsibleTeam:'璇烽�夋嫨璐d换鐝粍',
+ returnProcess:'鍙埄鐢ㄥ凡鍕鹃�夛紝璇烽�夋嫨杩斿洖宸ュ簭'
+ }
+
+ const close = (type) => {
+ //鍒ゆ柇鏄惁鏄‘瀹�
+ if(type===1){
+ for(let item in rules){
+ //鍒ゆ柇閫変腑鍙埄鐢ㄥ拰涓嬫媺妗嗘槸鍚︿负绌�
+ if(!damageDetail.value[item] && item!=='returnProcess'){
+ messageToggle('error',rules[item])
+ return
+ }else if(item==='returnProcess' && !damageDetail.value[item] && damageDetail.value['available']){
+ messageToggle('error',rules[item])
+ return
+ }
+ }
+ //姣忚鐮存崯璧嬪��
+ reportworkList.value[damageShowProcessIndex].processList[damageShowRow.value-1].damageDetails = [
+ JSON.parse(JSON.stringify(damageDetail.value))
+ ]
+ }else{
+ delete reportworkList.value[damageShowProcessIndex].processList[damageShowRow.value-1].breakageQuantity
+ delete reportworkList.value[damageShowProcessIndex].processList[damageShowRow.value-1].damageDetails
+ }
+ popup.value.close()
+ }
+
+ const cleanAllFinish = (index) => {
+ try{
+ reportworkList.value[index].processList.forEach(item => {
+ item.completedQuantity = 0
+ })
+ }catch(e){
+
+ }
+
+ }
+
+ const scannerCode = () => {
+ if(reportworkList.length>6){
+ messageToggle('error','鏈�澶氭敮鎸�6涓祦绋嬪崱鍚屾椂鎶ュ伐')
+ }
+ mpaasScan().then(val => {
+ for (let items of reportworkList.value) {
+ for(let item of items.processList){
+ const prcoessCard = items.processTitle.flowCard.processId+"/"+item.technology_number
+ if(prcoessCard === val){
+ messageToggle('error','姝ゆ祦绋嬪崱宸插瓨鍦ㄥ垪琛ㄥ綋涓�')
+ return
+ }
+ }
+ }
+
+ getProcessCardList(val,process.value)
+ })
+ }
+
+ //绉婚櫎娴佺▼鍗�
+ const deleteProcess = (indexVal) => {
+ reportworkList.value.splice(indexVal, 1)
+ }
+
+</script>
+
+<style>
+ .main{
+ width: 100vw;
+ height: 93.5vh
+ }
+ .flex-item{
+ /* flex-direction: column;
+ background-color: aliceblue; */
+ }
+ .title_main{
+ width: 100vw;
+ height: 12vh;
+ }
+ .table_main{
+ width: 100vw;
+ height: 80vh;
+ margin: 0 auto;
+ }
+ .foot_main{
+ width: 96vw;
+ margin: 0 auto;
+ background-color: white;
+ }
+
+ .uni-row{
+ text-align: center;
+ }
+ .break_col{
+ height: 35px;
+ border:1px solid black;
+ }
+ .breakInfo{
+ width: 96vw;
+ }
+ .title_section .uni-section-header__slot-right{
+ width: 100%;
+ }
+ .reporting_work{
+ float: right;
+ }
+</style>
--
Gitblit v1.8.0