2025-04-09 18:55:14 +08:00

199 lines
5.4 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="app status-bar-gap">
<view class="page">
<l-header :title="titleText()" sticky></l-header>
<view class="data-item" :style="[{'background-color':'#ffffff'}]">
<view class="dataText">
<view class="itemBox">
<view>生产订单</view>
<view class="zongjian"></view>
<view>{{ state.FBillNo }}</view>
</view>
<view class="timebox">
<view>开始生产时间</view>
<uni-datetime-picker hasInput :show="state.FStartProTimeShow" v-model="state.FStartProTimes" :visibleItemCount="3" disabled
mode="datetime"></uni-datetime-picker>
</view>
<view class="timebox">
<view>开始测试时间</view>
<uni-datetime-picker hasInput :show="state.FProTestTimeShow" v-model="state.FProTestTimes" :visibleItemCount="3" disabled
mode="datetime"></uni-datetime-picker>
</view>
<view class="timebox">
<view>开始汇报时间</view>
<uni-datetime-picker hasInput :show="state.FProReportTimeShow" v-model="state.FProReportTimes" :visibleItemCount="3" disabled
mode="datetime"></uni-datetime-picker>
</view>
</view>
<view class="btnList">
<up-button v-show="state.type === '1'" class="btnItem" type="primary" shape="circle"
@click="PRD_MOPushIntoProFun"
text="开始生产"></up-button>
<up-button v-show="state.type !== '1'" class="btnItem" type="primary" shape="circle"
@click="PRD_MORPTSaveFun"
text="生产测试"></up-button>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { reactive, nextTick, onMounted, ref, computed, watch } from 'vue';
import { onLoad, onShow, onReachBottom, } from '@dcloudio/uni-app'
import { PRD_MOEnterIntoPro, PRD_MOPushIntoPro, PRD_MORPTSave, PRD_MOViewIntoPro } from '../../common/request/api/api';
import { timeFormat } from '@/uni_modules/uview-plus';
import { pageDataInfo } from '../../stores/info.js';
const pageDataInfoCom = pageDataInfo()
const state = reactive({
id: '',
FBillNo: '',
FStartProTimeShow: false,
FProTestTimeShow: false,
FProReportTimeShow: false,
FStartProTimes: '', //开始生产时间
FProTestTimes: '', //开始测试时间
FProReportTimes: '',//开始汇报时间
EnterIntoProData: {},
type: '',
})
onShow(() => {
console.log(pageDataInfoCom.userInfos);
let pageData = pageDataInfoCom.userInfos
state.EnterIntoProData = pageData
state.id = pageData.FID
state.FBillNo = pageData.FBillNo
state.type = pageData.type
if (state.type === '1' && state.FStartProTimes == '') {
state.FStartProTimes = timeFormat(pageData.time, 'yyyy-mm-dd hh:MM:ss')
}
if(pageData.FStartProTimes !== ''){
state.FStartProTimes = pageData.FStartProTimes
}
if (state.type === '2' && state.FProReportTimes == '') {
state.FProReportTimes = timeFormat(pageData.time, 'yyyy-mm-dd hh:MM:ss')
}
if(pageData.FProReportTimes !== ''){
state.FProReportTimes = pageData.FProReportTimes
}
if (state.type === '3' && state.FProTestTimes == '') {
state.FProTestTimes = timeFormat(pageData.time, 'yyyy-mm-dd hh:MM:ss')
}
if(pageData.FProTestTimes !== ''){
state.FProTestTimes = pageData.FProTestTimes
}
})
const titleText = () => {
if(state.type === '1') return '开始生产'
if(state.type === '2') return '开始汇报'
if(state.type === '3') return '开始测试'
}
const PRD_MORPTSaveFun = () => {
PRD_MOViewIntoPro({
Number:state.FBillNo
}).then((res:any) => {
if(res.code === 200){
if(res.data.FRPFID !== ''){
PRD_MORPTSave({
Model:JSON.stringify({
FID:res.data.FRPFID,
FStartProTimes:state.FStartProTimes,
FProTestTimes:state.FProTestTimes,
FProReportTimes:state.FProReportTimes,
})
}).then((resItem:any) => {
if(resItem.code === 200){
uni.$u.toast('操作成功')
}
})
} else {
uni.$u.toast('请先进行生产')
}
}
})
}
const PRD_MOPushIntoProFun = () => {
PRD_MOPushIntoPro({
Ids: state.id + '',
TargetFormId: "PRD_MORPT",
IsEnableDefaultRule: "true",
CustomParams: {
ScanEntry: [
{
FStartProTimes: state.FStartProTimes
}
]
}
}).then((res : any) => {
if(res.code === 200){
uni.$u.toast('操作成功')
}
})
}
const formatLangTextValue = (val : any) => {
let lang_Id = uni.getStorageSync('locale')
let item = val.find(p => p.Key == (lang_Id == 'cn' ? 2052 : 1033));
if (item != null) {
return item.Value;
}
return val[0].Value;
}
</script>
<style lang="scss" scoped>
:deep(.uni-date__x-input){
color: black !important;
}
.app {
background-color: #F5F5F5;
.page {
padding: 18px 32rpx;
display: flex;
flex-direction: column;
height: 100%;
flex: 1;
.data-item {
border: 1px solid #efeaea;
border-radius: 20rpx;
padding: 20rpx 22rpx;
background-color: #ffffff;
flex: 1;
display: flex;
flex-direction: column;
justify-content: space-between;
.btnList {
display: flex;
margin-bottom: 32rpx;
.btnItem {
width: 40%;
}
}
.timebox {
display: flex;
align-items: center;
margin-top: 32rpx;
}
.itemBox {
line-height: 50rpx;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 32rpx;
.zongjian {
height: 1px;
flex: 1;
background-color: #f0f0f0;
margin: 0 16rpx;
}
}
}
}
}
</style>