From ecced75681242ea0ff23f0c4805a20fbdc87cf14 Mon Sep 17 00:00:00 2001
From: yyb <995253665@qq.com>
Date: 星期四, 12 六月 2025 17:11:20 +0800
Subject: [PATCH] 报工页面联调

---
 pages/product/report/index.vue |  849 ++++++++++++++++++++++++--------------------------------
 1 files changed, 369 insertions(+), 480 deletions(-)

diff --git a/pages/product/report/index.vue b/pages/product/report/index.vue
index e12c3ec..4ade1cb 100644
--- a/pages/product/report/index.vue
+++ b/pages/product/report/index.vue
@@ -1,489 +1,378 @@
 <template>
-	<view class="body">
-		<view class="top_code">
-			<u-icon class="product-number-icon"></u-icon>缂栧彿锛�
-			<text selectable>{{ dutyNo }}</text>
-			<view class="top_code_edit">
-				<u-icon class="product-edit-icon" @click="edit" v-show="true"></u-icon>
-			</view>
-		</view>
-		<view class="main_view">
-			<h3 class="main_top_title">宸ヤ綔鍙�</h3>
-			<view class="main_item" @click="goPage(0)">
-				<span style="color:#4F4F4F">宸ヤ綔绔�</span>
-				<view>
-					<span style="color:#333333;margin-right: 20rpx;">{{ query.workstationName }}</span>
-					<u-icon v-if="isShowButton" name="arrow-right" color="#687792" size="28"></u-icon>
-				</view>
-			</view>
-			<view class="main_item" @click="goPage(1)">
-				<span style="color:#4F4F4F">宸ュ簭</span>
-				<view>
-					<span style="color:#333333;margin-right: 20rpx;">{{ query.operationName }}</span>
-					<u-icon v-if="isShowButton" name="arrow-right" color="#687792" size="28"></u-icon>
-				</view>
-			</view>
-			<view class="main_item" @click="goPage(2)">
-				<span style="color:#4F4F4F">鏃ユ湡</span>
-				<view>
-					<span style="color:#333333;margin-right: 20rpx;">{{ query.updateTime }}</span>
-					<u-icon v-if="isShowButton" name="arrow-right" color="#687792" size="28"></u-icon>
-				</view>
-			</view>
-			<view class="main_item" @click="goPage(3)">
-				<span style="color:#4F4F4F">鐝</span>
-				<view>
-					<span style="color:#333333;margin-right: 20rpx;">{{ query.clazzType }}</span>
-					<u-icon v-if="isShowButton" name="arrow-right" color="#687792" size="28"></u-icon>
-				</view>
-			</view>
-			<view class="main_item" @click="goPage(4)">
-				<span style="color:#4F4F4F;width: 118rpx;">鐢熶骇浜哄憳</span>
-				<view class="value2">
-					<span style="color:#333333;margin-right: 20rpx;">{{ staffNameJoin }}</span>
-				</view>
-				<u-icon v-if="isShowButton" name="arrow-right" color="#687792" size="28"></u-icon>
-			</view>
-			<view class="main_item">
-				<span style="color:#4F4F4F">鍒涘缓浜�</span>
-				<view>
-					<span style="color:#333333;">{{ query.createUser }}</span>
-				</view>
-			</view>
-			<view class="btns">
-				<u-button :custom-style="customStyle" @click="goPage(9)">鏉傚伐</u-button>
-				<u-button :custom-style="customStyle" style="width: 150rpx;" @click="goPage(6)">
-					<u-icon class="icon_history" size="26rpx" />
-					<span style="line-height: 40rpx;">鍘嗗彶</span>
-				</u-button>
-				<u-button v-if="isShowButton" @click="submit" :custom-style="customStyle"
-					style="background: #30AFFF;color: #fff;border: 0;width: 150rpx;">
-					<u-icon class="icon_save" size="26rpx" />
-					<span style="line-height: 40rpx;">淇濆瓨</span>
-				</u-button>
-				<u-button :custom-style="customStyle" style="background: #214DED;color: #fff;border: 0;width: 150rpx;"
-					@click="goPage(8)">
-					<u-icon class="icon_right" size="26rpx" />
-					<span style="line-height: 40rpx;">鎶ュ伐</span></u-button>
-			</view>
-		</view>
-		<u-calendar v-model="calendarShow" :mode="mode" @change="changeCalendar"></u-calendar>
-		<!--宸ュ簭涓嬫媺妗�-->
-		<u-select :default-value="[operationIndex]" v-model="selectShowOperation" :list="operationList"
-			@confirm="confirmOperation"></u-select>
-		<u-select v-model="selectShowClazzType" :list="clazzTypeList" @confirm="confirmClazzType"></u-select>
-		<u-toast ref="uToast" />
-	</view>
+  <!-- 鎶ュ伐 -->
+  <div class="page">
+    <u-form
+      :model="form"
+      ref="uForm"
+      :label-width="200"
+      :rules="rules"
+      :error-type="['toast']"
+    >
+      <u-form-item label="杞﹂棿" :border-bottom="false" prop="work">
+        <u-radio-group v-model="form.work" :disabled="subdisabled">
+          <u-radio name="dt">瀵间綋</u-radio>
+          <u-radio name="tg">閾滄潌</u-radio>
+        </u-radio-group>
+      </u-form-item>
+      <u-form-item label="鎶ュ伐鍗曞彿" :border-bottom="false" prop="taskNo">
+        <u-input
+          v-model="form.taskNo"
+          type="select"
+          placeholder="璇锋壂鎻忔姤宸ュ崟鍙�"
+          @click="open"
+        />
+      </u-form-item>
+      <u-form-item label="宸ュ簭" :border-bottom="false" prop="name">
+        <u-input
+          v-model="form.name"
+          type="select"
+          placeholder="璇锋壂鎻忔姤宸ュ崟鍙�"
+        />
+      </u-form-item>
+      <u-form-item label="璁㈠崟鍙�" :border-bottom="false" prop="moOn">
+        <u-input
+          v-model="form.moOn"
+          type="select"
+          placeholder="鐐瑰嚮閫夋嫨"
+          @click="openList"
+        />
+      </u-form-item>
+      <u-form-item label="闆朵欢鍙�" :border-bottom="false" prop="partNo">
+        <u-input v-model="form.partNo" placeholder="" disabled />
+      </u-form-item>
+      <u-form-item label="闆朵欢鎻忚堪" :border-bottom="false" prop="partName">
+        <u-input v-model="form.partName" placeholder="" disabled />
+      </u-form-item>
+      <u-form-item label="鎵归噺澶у皬" :border-bottom="false" prop="qtyrequired">
+        <u-input v-model="form.qtyrequired" placeholder="" disabled />
+      </u-form-item>
+      <u-form-item
+        label="鍓╀綑鏁伴噺"
+        :border-bottom="false"
+        prop="Jianqtyfinished"
+      >
+        <u-input v-model="form.Jianqtyfinished" placeholder="" disabled />
+      </u-form-item>
+      <u-form-item label="搴撲綅" :border-bottom="false" prop="proposedLocation">
+        <u-input v-model="form.proposedLocation" placeholder="" disabled />
+      </u-form-item>
+      <u-form-item label="鎶ュ伐绫诲瀷" prop="productType">
+        <u-radio-group v-model="form.productType">
+          <u-radio name="dep">涓嬫満鎶ュ伐</u-radio>
+          <u-radio name="ndep">鏈笅鏈烘姤宸�</u-radio>
+        </u-radio-group>
+      </u-form-item>
+      <u-form-item label="鎺ユ敹闆朵欢" prop="receive">
+        <u-radio-group v-model="form.receive">
+          <u-radio name="mo">杞﹂棿璁㈠崟</u-radio>
+          <u-radio name="part">鏇夸唬闆朵欢</u-radio>
+        </u-radio-group>
+      </u-form-item>
+      <u-form-item label="鐗╂枡" prop="materialcost">
+        <u-radio-group v-model="form.materialcost" :disabled="true">
+          <u-radio name="鍊掑啿">鍊掑啿</u-radio>
+          <u-radio name="鎶曟枡">鎶曟枡</u-radio>
+        </u-radio-group>
+      </u-form-item>
+      <u-form-item label="宸ュ簭" prop="value11">
+        <u-checkbox-group>
+          <u-checkbox
+            :name="item.name"
+            v-for="(item, index) in checkboxList"
+            :key="index"
+            v-model="item.value11"
+            @change="changeCheckbox"
+            :disabled="subdisabled || item.disabled"
+          >
+            {{ item.name }}
+          </u-checkbox>
+        </u-checkbox-group>
+      </u-form-item>
+      <u-form-item label="浜у嚭鍒楄〃" :border-bottom="false"></u-form-item>
+    </u-form>
+    <view class="wrap">
+      <scroll-view class="packing-registration-scroll-list" scroll-y="true">
+        <u-cell-group
+          class="packing-registration-scroll-list-group"
+          :border="false"
+        >
+          <view
+            class="content"
+            v-for="(item, index) in InventoryReceiptList"
+            :key="index"
+            :index="index"
+          >
+            <view class="content-header">
+              <view class="content-header-title">{{ index + 1 }}</view>
+            </view>
+            <view class="content-body">
+              <view class="row-list">
+                <view class="_label">
+                  <view class="_label-name">鎵瑰彿锛�</view>
+                </view>
+                <view class="_content">
+                  {{ item.productNo }}
+                </view>
+              </view>
+              <view class="row-list">
+                <view class="_label">
+                  <view class="_label-name">鏁伴噺锛�</view>
+                </view>
+                <view class="_content">
+                  {{ item.value1 }}
+                </view>
+              </view>
+              <view class="row-list">
+                <view class="_label">
+                  <view class="_label-name">搴撲綅锛�</view>
+                </view>
+                <view class="_content">
+                  {{ item.proposedLocation }}
+                </view>
+              </view>
+            </view>
+          </view>
+        </u-cell-group>
+      </scroll-view>
+    </view>
+    <!-- 濉啓鎶ュ伐鍗� -->
+    <modalBg ref="modalBg" :confirm="confirm">
+      <u-field
+        v-model="form.taskNo"
+        label="鎶ュ伐鍗曞彿"
+        placeholder="璇疯緭鍏�"
+        :border-bottom="false"
+      >
+      </u-field>
+    </modalBg>
+    <saveForm
+      ref="saveForm"
+      :operationTaskId="this.form"
+      @update="handleUpdate"
+    />
+    <scan></scan>
+  </div>
 </template>
 
 <script>
-import {
-	dateFormat
-} from "@/utils/date.js";
-import UIcon from "../../../uview-ui/components/u-icon/u-icon.vue";
+import modalBg from "@/components/modal/modal-bg.vue";
+import saveForm from "./components/saveForm.vue";
+import scan from "@/components/scan/scan.vue";
 export default {
-	components: {
-		UIcon
-	},
-	data() {
-		return {
-			customStyle: {
-				'background': '#FFFFFF',
-				'border-radius': '8rpx',
-				'border': '1px solid #D2D2D2',
-				'width': '121rpx',
-				'height': '65rpx',
-				'font-weight': 500,
-				'font-size': '28rpx',
-				'color': '#333333',
-				'pading': '0 30rpx'
-			},
-			calendarShow: false,
-			selectShowOperation: false,
-			selectShowClazzType: false,
-			mode: 'date',
-			id: '',
-			dutyNo: '', // 缂栧彿
-			query: {
-				updateTime: dateFormat(
-					new Date(), 'yyyy-MM-dd'),
-				workstationName: '', // 宸ヤ綔绔欏悕绉�
-				workstationId: '', // 宸ヤ綔绔檌d
-				clazzType: '', // 鐝
-				productionUser: '',
-				operationId: '', // 宸ュ簭id
-				operationName: '', // 宸ュ簭鍚嶇О
-				userList: [],
-				createUser: ''
-			},
-			toId: '',
-			operationList: [],
-			clazzTypeList: [{
-				label: '鐧界彮'
-			},
-			{
-				label: '鏅氱彮'
-			},
-			],
-			workstation: '',
-			staffNameJoin: '',
-			operationIndex: '',
-			isEdit: false, // 鏄惁淇敼
-			isShowButton: false,
-			workCenter: '',
-			addOrEdit: '',
-			info: {},
-			firstOperationId: null,
-			lastOperationId: null,
-		}
-	},
-	onShow() {
-		// this.getLastDutyRecordFun()
-	},
-	onLoad() {
-		uni.$on('dailyListInfo', (info) => {
-			this.dutyNo = info.dutyNo
-			this.id = info.id
-			this.query.createUser = this.vuex_username
-			this.query.clazzType = info.clazzType
-			this.query.workstationId = info.workstationId
-			this.query.workstationName = info.workstationName
-			this.query.productionUser = info.productionUser.split(',').reverse()
-			this.query.userList = info.productionUserList.split(',')
-			this.query.operationId = info.operationId
-			this.getOperation()
-		})
-
-		uni.$on('returnData', (data) => {
-			// 涓存椂瀛樺偍宸ヤ綔绔欑殑鏁版嵁
-			this.workstation = data
-			// 缁欓〉闈㈠伐浣滅珯璧嬪��
-			this.query.workstationName = '(' + data.workCenter + ')' + data.name
-			this.query.workstationId = data.id
-			// 娓呯┖宸ュ簭閫夐」
-			this.query.operationName = ''
-			this.query.operationId = ''
-			this.operationIndex = 0
-			this.getOperationTaskFun(data.workCenter)
-		})
-		uni.$on('checkedList', (data) => {
-			let staffNameList = []
-			let staffNoList = []
-			data.forEach(i => {
-				staffNameList.push(i.staffName)
-				staffNoList.push(i.staffNo)
-			})
-			this.query.productionUser = staffNameList
-			this.query.userList = staffNoList
-		});
-	},
-	onReady() {
-		// 棣栨杩涘叆椤甸潰鑾峰彇褰撳墠鐧诲綍浜烘渶鍚庝竴娆℃彁浜ょ殑鏃ユ姤
-		this.getLastDutyRecordFun()
-	},
-	methods: {
-		isNotOperationName(workCenter, operationName, workCenterTwo) {
-			// 鍒ゆ柇鏄惁涓鸿宸ヤ綔绔�
-			if (workCenter.includes(workCenterTwo)) {
-				// 鍒ゆ柇鏄惁鍖呭惈宸ュ簭鍚嶇О
-				if (!operationName.includes(this.query.operationName)) {
-					return true
-				} else {
-					return false
-				}
-			} else {
-				return false
-			}
-		},
-		// 鍒ゆ柇宸ュ崟鏄惁绛変簬,鍚屾椂鍒ゆ柇鏄惁涓虹涓�閬撳伐搴�
-		isFirstOperationId(workCenter, workCenterTwo) {
-			if (workCenter.includes(workCenterTwo)) {
-				// 鍒ゆ柇鏄惁涓嶄负绗竴閬撳伐搴�
-				if (this.query.operationId !== this.firstOperationId) {
-					return true
-				} else {
-					return false
-				}
-			} else {
-				return false
-			}
-		},
-		// 棣栨杩涘叆椤甸潰鑾峰彇褰撳墠鐧诲綍浜烘渶鍚庝竴娆℃彁浜ょ殑鏃ユ姤
-		getLastDutyRecordFun() {
-			this.$u.api.dailyPaper.getLastDutyRecord().then(res => {
-				if (res.code === 0) {
-					this.dutyNo = res.data.dutyNo
-					this.id = res.data.id
-					this.query.createUser = this.vuex_username
-					this.query.clazzType = res.data.clazzType
-					this.query.workstationId = res.data.workstationId
-					this.query.workstationName = res.data.workstationName
-					this.query.productionUser = res.data.productionUser.split(',').reverse()
-					this.query.userList = res.data.productionUserList.split(',')
-					this.query.operationId = res.data.operationId
-					this.getOperation()
-				} else {
-					this.$u.toast(res.msg)
-				}
-			})
-		},
-		// 娓呯┖閫昏緫
-		onNavigationBarButtonTap(e) {
-			this.isEdit = true
-			this.isShowButton = true
-			this.addOrEdit = 'add'
-			this.query.productionUser = ''
-			this.query.productionUserList = []
-			this.staffNameJoin = ''
-			this.query.updateTime = ''
-		},
-		edit() {
-			this.isEdit = !this.isEdit
-			this.isShowButton = this.isEdit
-			this.addOrEdit = 'edit'
-		},
-		goPage(index) {
-			switch (index) {
-				// 璺宠浆鍒板巻鍙查〉闈�
-				case 6:
-					uni.navigateTo({
-						url: '/pages/daily/daily/daily-list'
-					})
-					break;
-				// 璺宠浆鍒版姤宸ラ〉闈�
-				case 8:
-					if (this.isEdit) {
-						this.$refs.uToast.show({
-							title: '璇峰厛淇濆瓨淇敼',
-							type: 'warning '
-						})
-						return
-					}
-
-					let workCenter = this.query.workstationName.split(')')[0].substring(1)
-					let operation = this.query.workstationName.split(')')[1]
-					console.log(workCenter, operation, this.firstOperationId, this.query.operationId, this.query)
-					if (workCenter == "TM-01" || workCenter == "JG-01" || workCenter == "YB-04" || this.isFirstOperationId('DY-01,GY-01,YB-01,YB-02', workCenter) || this.isNotOperationName('ZZ-02', '浜岃,娉ㄦ补', workCenter)) {
-						let item = {
-							workstationId: this.query.workstationId,
-							clazzType: this.query.clazzType,
-							dutyNo: this.dutyNo,
-							userStaffNo: this.query.userList,
-							workstationName: this.query.workstationName,
-							staffNameJoin: this.staffNameJoin,
-							workCenter: workCenter,
-							operationId: this.query.operationId,
-							firstOperationId: this.firstOperationId,
-							lastOperationId: this.lastOperationId
-						}
-						uni.navigateTo({
-							url: '/pages/daily/common/work-reporting?info=' + encodeURIComponent(JSON
-								.stringify(item))
-						})
-					} else if (this.query.workstationName.includes("TX-02") && !this.query.operationName.includes("鍙犺")) {
-						let item = {
-							workstationId: this.query.workstationId,
-							clazzType: this.query.clazzType,
-							dutyNo: this.dutyNo,
-							userStaffNo: this.query.userList,
-							workstationName: this.query.workstationName,
-							staffNameJoin: this.staffNameJoin,
-							workCenter: "TX-02",
-							operationId: this.query.operationId,
-							firstOperationId: this.firstOperationId,
-							lastOperationId: this.lastOperationId
-						}
-						uni.navigateTo({
-							url: '/pages/daily/common/work-reporting?info=' + encodeURIComponent(JSON
-								.stringify(item))
-						})
-					} else {
-						uni.navigateTo({
-							url: `/pages/daily/common/work-order-list?workstationId=${this.query.workstationId}&toId=${this.toId}&clazzType=${this.query.clazzType}&dutyNo=${this.dutyNo}&userStaffNo=${this.query.userList}&workstationName=${this.query.workstationName}&staffNameJoin=${this.staffNameJoin}`
-						})
-					}
-					break;
-				// 璺宠浆鍒版潅宸ラ〉闈�
-				case 9:
-					if (this.isEdit) {
-						this.$refs.uToast.show({
-							title: '璇峰厛淇濆瓨淇敼',
-							type: 'warning '
-						})
-						return
-					}
-					uni.navigateTo({
-						url: `/pages/daily/handyman/handyman?dutyNo=${this.query.dutyNo}&updateTime=${this.query.updateTime}&userList=${this.query.productionUser}&staffList=${this.query.userList}`
-					})
-					break;
-			}
-			if (!this.isEdit) {
-				return
-			} else {
-				switch (index) {
-					case 0:
-						uni.navigateTo({
-							url: '/pages/daily/workstation/index'
-						})
-						break;
-					case 1:
-						if (!this.query.workstationName) {
-							this.$refs.uToast.show({
-								title: '璇峰厛閫夋嫨宸ヤ綔绔�',
-								type: 'warning '
-							})
-						} else {
-							this.selectShowOperation = true;
-						}
-						break;
-					case 2:
-						this.calendarShow = true;
-						break;
-					case 3:
-						this.selectShowClazzType = true;
-						break;
-					case 4:
-						let staffList = this.query.productionUser
-						let staffNoList = this.query.userList
-						const list = []
-						for (const i in staffList) {
-							const obj = {
-								staffName: staffList[i],
-								staffNo: staffNoList[i]
-							}
-							list.push(obj)
-						}
-						uni.navigateTo({
-							url: '/pages/daily/production-person/production-person?list=' + encodeURIComponent(
-								JSON.stringify(list))
-						})
-						break;
-				}
-			}
-		},
-		// 鎻愪氦鏃ユ姤淇敼
-		submit() {
-			if (!this.query.workstationId) {
-				this.$u.toast('璇烽�夋嫨宸ヤ綔绔�')
-				return
-			} else if (!this.query.operationId) {
-				this.$u.toast('璇烽�夋嫨宸ュ簭')
-				return
-			} else if (!this.query.clazzType) {
-				this.$u.toast('璇烽�夋嫨鐝')
-				return
-			} else if (!this.query.productionUser) {
-				this.$u.toast('璇烽�夋嫨鐢熶骇浜哄憳')
-				return
-			} else if (!this.query.updateTime) {
-				this.$u.toast('璇烽�夋嫨鏃堕棿')
-				return
-			}
-
-			let params = JSON.parse(JSON.stringify(this.query))
-			this.$delete(params, 'productionUser')
-			this.$delete(params, 'productionUserList')
-			params.updateTime = params.updateTime + ' 00:00:00'
-			params.id = null
-			if (this.addOrEdit === 'add') {
-				this.$u.api.dailyPaper.addDailyPaper(params).then(res => {
-					if (res.code === 0) {
-						// this.getLastDutyRecordFun()
-						this.query.createUser = this.vuex_username
-						this.$u.toast('淇濆瓨鎴愬姛')
-						this.isShowButton = false
-						this.getLastDutyRecordFun()
-					}
-				})
-			} else {
-				params.id = this.id
-				this.$u.api.dailyPaper.editDailyPaper(params).then(res => {
-					if (res.code === 0) {
-						// this.getLastDutyRecordFun()
-						this.$u.toast('淇敼鎴愬姛')
-						this.isShowButton = false
-					}
-				})
-			}
-			this.isEdit = false
-		},
-		changeCalendar(e) {
-			this.query.updateTime = e.result;
-		},
-		confirmOperation(e) {
-			this.query.operationName = e[0].label
-			this.query.operationId = e[0].value
-			const index = this.operationList.findIndex(item => item.value === this.query.operationId)
-			if (index > -1) {
-				this.operationIndex = index
-				this.toId = this.operationList[index].value
-			}
-		},
-		confirmClazzType(e) {
-			this.query.clazzType = e[0].label
-		},
-		// 鏌ヨ宸ヤ綔绔�
-		getOperation() {
-			this.$u.api.dailyPaper.getWorkstation().then(res => {
-				if (res.code === 0) {
-					const index = res.data.findIndex(item => item.name === this.query.workstationName)
-					if (index > -1) {
-						this.workCenter = res.data[index].workCenter
-					}
-					this.query.workstationName = '(' + this.workCenter + ')' + this.query.workstationName
-					this.getOperationTaskFun(this.workCenter, this.query.operationId)
-				}
-			})
-		},
-		getOperationTaskFun(id, operationId) {
-			this.operationList = []
-			const params = {
-				workCenter: id,
-				current: 1,
-				size: -1
-			}
-			// 鏌ヨ宸ュ簭鍒楄〃
-			this.$u.api.dailyPaper.getOperation(params).then(res => {
-				if (res.code === 0) {
-					if (res.data.records.length > 0) {
-						res.data.records.forEach(i => {
-							const obj = Object.assign({
-								label: i.name,
-								value: i.id,
-							})
-							this.operationList.push(obj)
-						})
-						if (operationId) {
-							const index = this.operationList.findIndex(item => item.value === operationId)
-							if (index > -1) {
-								this.operationIndex = index
-								this.query.operationName = this.operationList[index].label
-								this.toId = this.operationList[index].value
-							}
-						}
-						this.firstOperationId = this.operationList[0].value
-						this.lastOperationId = this.operationList[this.operationList.length - 1].value
-					}
-				}
-			})
-		}
-	},
-	watch: {
-		'query.productionUser': {
-			handler(newName, oldName) {
-				if (this.query.productionUser.length > 0) {
-					this.staffNameJoin = this.query.productionUser.join()
-				} else {
-					this.staffNameJoin = ''
-				}
-			},
-			immediate: true,
-			deep: true
-		}
-	}
-}
+  components: {
+    modalBg,
+    saveForm,
+    scan,
+  },
+  data() {
+    return {
+      checkboxList: [
+        {
+          name: "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�",
+          value: false,
+          disabled: false,
+        },
+        {
+          name: "绠�鍖栫墿鏂欐鏌�",
+          value: false,
+          disabled: false,
+        },
+      ],
+      InventoryReceiptList: [],
+      form: {
+        work: "",
+        taskNo: "",
+        name: "",
+        moOn: "",
+        partNo: "",
+        partName: "",
+        qtyrequired: "",
+        Jianqtyfinished: "",
+        proposedLocation: "",
+        productType: "dep",
+        receive: "mo", // 澶嶉�夋缁勭殑鍊�
+        materialcost: "",
+        autoReport: false,
+        simplifyMaterials: false,
+      },
+      rules: {
+        work: [
+          {
+            required: true,
+            message: "璇烽�夋嫨杞﹂棿",
+            trigger: ["change"],
+          },
+        ],
+        taskNo: [
+          {
+            required: true,
+            message: "璇烽�夋嫨鎶ュ伐鍗曞彿",
+            trigger: ["change", "blur"],
+          },
+        ],
+        name: [
+          {
+            required: true,
+            message: "璇烽�夋嫨宸ュ簭",
+            trigger: ["change", "blur"],
+          },
+        ],
+        moOn: [
+          {
+            required: true,
+            message: "璇烽�夋嫨璁㈠崟鍙�",
+            trigger: ["change", "blur"],
+          },
+        ],
+        productType: [
+          {
+            required: true,
+            message: "璇烽�夋嫨鎶ュ伐绫诲瀷",
+            trigger: ["change"],
+          },
+        ],
+        receive: [
+          {
+            required: true,
+            message: "璇烽�夋嫨鎺ユ敹闆朵欢绫诲瀷",
+            trigger: ["change"],
+          },
+        ],
+      },
+      showSave: false,
+      operationTaskId: "",
+      subdisabled: false,
+    };
+  },
+  // 鐐瑰嚮鎻愪氦鎸夐挳鐨勪簨浠跺鐞嗗嚱鏁�
+  onNavigationBarButtonTap() {
+    this.$refs.uForm.validate((valid) => {
+      if (valid) {
+        console.log("楠岃瘉閫氳繃");
+        // 澶勭悊鎻愪氦閫昏緫
+        this.$u.api.workReporting
+          .operationTask({
+            id: this.form.id,
+          })
+          .then((res) => {
+            console.log("res", res);
+            this.$refs.saveForm.open(res);
+          });
+      } else {
+        console.log("楠岃瘉澶辫触");
+        // 鍙互鑾峰彇鍏蜂綋鐨勯敊璇俊鎭�
+        const errors = this.$refs.uForm.getError();
+        console.log("閿欒淇℃伅:", errors);
+      }
+    });
+  },
+  onReady() {
+    this.$refs.uForm.setRules(this.rules);
+  },
+  onShow() {
+    let that = this;
+    console.log("1111111111111");
+    uni.$off("scan"); // 姣忔杩涙潵鍏� 绉婚櫎鍏ㄥ眬鑷畾涔変簨浠剁洃鍚櫒
+    uni.$on("scan", function (data) {
+      console.log("onscan");
+      //鎵爜鎴愬姛鍚庣殑鍥炶皟锛屼綘鍙互鍐欒嚜宸辩殑閫昏緫浠g爜鍦ㄨ繖閲�
+      console.log("椤甸潰鎵爜缁撴灉锛�", data.code);
+      if (data.code) {
+        let codeInfo = JSON.parse(data.code);
+        if (codeInfo.moOn) {
+          // 鎵弿鎶ュ伐鍗曚簩缁寸爜
+          that.saveForm(codeInfo);
+          that.$u.api.workReporting
+            .getProductMainV1({
+              current: 1,
+              size: -1,
+              operationTaskId: codeInfo.id,
+            })
+            .then((res) => {
+              console.log("res", res);
+              let InventoryReceiptList = JSON.parse(res.data.records);
+              that.saveInventory(InventoryReceiptList);
+            });
+          console.log("this.InventoryReceiptList", that.InventoryReceiptList);
+        }
+      }
+    });
+  },
+  watch: {
+    "form.taskNo": function (newVal, oldVal) {
+      console.log("taskNo changed:", newVal, oldVal);
+      this.subdisabled = false;
+    },
+  },
+  methods: {
+    saveInventory(val) {
+      this.InventoryReceiptList = val;
+    },
+    // 澶氶�夊鐞�
+    changeCheckbox(val) {
+      if (val.name === "宸ュ簭鐨勮嚜鍔ㄦ姤鍛�") {
+        this.form.autoReport = val.value;
+      }
+      if (val.name === "绠�鍖栫墿鏂欐鏌�") {
+        this.form.simplifyMaterials = val.value;
+      }
+    },
+    handleUpdate() {
+      this.subdisabled = true;
+    },
+    // 鎵撳紑寮规--鍚庨潰杩橀渶瑕佺洃鍚壂鐮佹灙鎵爜缁撴灉锛岃祴鍊肩粰鎶ュ伐鍗曞彿瀛楁锛岀劧鍚庢墦寮�寮规閫夋嫨璁㈠崟鍙风瓑鎿嶄綔
+    open() {
+      this.$refs.modalBg.open();
+    },
+    // 寮规淇濆瓨
+    confirm() {
+      console.log("淇濆瓨", this.form.taskNo);
+    },
+    // 閫夋嫨璁㈠崟鍙�
+    openList() {
+      if (this.form.taskNo === "") {
+        uni.showToast({
+          title: "璇峰厛鎵弿鎴栬緭鍏ユ姤宸ュ崟鍙�",
+          icon: "none",
+        });
+        return;
+      }
+      uni.navigateTo({
+        url: "/pages/product/report/orderList",
+      });
+    },
+    // 瀛樿鍗曞彿
+    setNo(val) {
+      this.form.moOn = val.moNo;
+    },
+    // 鍥炴樉鎵爜鐨勪俊鎭�-鎶ュ伐鍗�
+    saveForm(val) {
+      console.log("鍥炴樉鐨勬暟鎹�", val);
+      this.form = {
+        id: val.id,
+        work: val.work,
+        taskNo: val.taskNo,
+        name: val.name,
+        moOn: val.moOn,
+        partNo: val.partNo,
+        partName: val.partName,
+        qtyrequired: val.qtyrequired,
+        Jianqtyfinished: val.qtyrequired - val.qtyfinished,
+        proposedLocation: val.proposedLocation,
+        productType: "dep",
+        receive: "mo", // 澶嶉�夋缁勭殑鍊�
+        materialcost: val.materialcost,
+        autoReport: false,
+        simplifyMaterials: false,
+      };
+      if (this.form.materialcost == "鍊掑啿") {
+        this.checkboxList[1].disabled = true;
+      }
+    },
+  },
+};
 </script>
 
 <style lang="scss">
-@import 'index.scss';
+@import "index.scss";
 </style>
\ No newline at end of file

--
Gitblit v1.9.3