| | |
| | | <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" :disabled="subdisabled"> |
| | | <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" :disabled="subdisabled"> |
| | | <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="value1"> |
| | | <u-checkbox-group> |
| | | <u-checkbox |
| | | :name="item.name" |
| | | v-for="(item, index) in checkboxList" |
| | | :key="index" |
| | | v-model="item.value1" |
| | | @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.netWeight }} |
| | | </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" |
| | | :operationTaskList="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: '', // 工作站id |
| | | 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: { |
| | | workstationId: "", |
| | | 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) { |
| | | uni.showLoading({ |
| | | mask: true, |
| | | title: "加载中", |
| | | }); |
| | | // 处理提交逻辑 |
| | | this.$u.api.workReporting |
| | | .operationTask({ |
| | | id: this.form.id, |
| | | }) |
| | | .then((res) => { |
| | | this.$refs.saveForm.open(res); |
| | | uni.hideLoading(); |
| | | }); |
| | | } else { |
| | | // 可以获取具体的错误信息 |
| | | const errors = this.$refs.uForm.getError(); |
| | | } |
| | | }); |
| | | }, |
| | | onReady() { |
| | | this.$refs.uForm.setRules(this.rules); |
| | | }, |
| | | onShow() { |
| | | let that = this; |
| | | uni.$off("scan"); // 每次进来先 移除全局自定义事件监听器 |
| | | uni.$on("scan", function (data) { |
| | | //扫码成功后的回调,你可以写自己的逻辑代码在这里 |
| | | if (data.code) { |
| | | let codeInfo = JSON.parse(data.code); |
| | | if (codeInfo.moOn) { |
| | | // 扫描报工单二维码 |
| | | that.saveForm(codeInfo); |
| | | that.$u.api.workReporting |
| | | .getProductMainV1({ |
| | | current: 1, |
| | | size: -1, |
| | | id: codeInfo.id, |
| | | }) |
| | | .then((res) => { |
| | | that.InventoryReceiptList = res.data.productOutputList; |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | watch: { |
| | | "form.taskNo": function (newVal, oldVal) { |
| | | this.subdisabled = false; |
| | | }, |
| | | }, |
| | | methods: { |
| | | // 多选处理 |
| | | 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() {}, |
| | | // 选择订单号 |
| | | 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) { |
| | | this.form = { |
| | | id: val.id, |
| | | workstationId: val.workstationId, |
| | | 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> |