238 lines
6.6 KiB
Vue
Raw Normal View History

2025-04-09 18:55:14 +08:00
<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>{{ t('index.scdd') }}</view>
2025-04-09 18:55:14 +08:00
<view class="zongjian"></view>
<view>{{ state.FBillNo }}</view>
</view>
<view class="timebox">
<view>{{ t('index.ksscsj') }}</view>
<view class="zongjian"></view>
<view>{{ state.FStartProTimes }}</view>
2025-04-09 18:55:14 +08:00
</view>
<view class="timebox">
<view>{{ t('index.kscssj') }}</view>
<view class="zongjian"></view>
<view>{{ state.FProTestTimes }}</view>
2025-04-09 18:55:14 +08:00
</view>
<view class="timebox">
<view>{{ t('index.kshbsj') }}</view>
<!-- <uni-datetime-picker hasInput :show="state.FProReportTimeShow" v-model="state.FProReportTimes"
:visibleItemCount="3" disabled mode="datetime"></uni-datetime-picker> -->
<view class="zongjian"></view>
<view>{{ state.FProReportTimes }}</view>
2025-04-09 18:55:14 +08:00
</view>
<view class="timebox">
<view>{{ t('index.scsl') }}</view>
<up-input :placeholder="t('index.scsl')" clearable inputmode="numeric" v-model="state.qty"
:disabled="state.type !== '2'"></up-input>
</view>
2025-04-09 18:55:14 +08:00
</view>
<view class="btnList">
<up-button v-show="state.type === '1'" class="btnItem" type="primary" shape="circle"
@click="PRD_MOPushIntoProFun()" :text="t('public.confirm')"></up-button>
2025-04-09 18:55:14 +08:00
<up-button v-show="state.type !== '1'" class="btnItem" type="primary" shape="circle"
@click="PRD_MORPTSaveFun()" :text="t('public.confirm')"></up-button>
2025-04-09 18:55:14 +08:00
</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';
import { useI18n } from 'vue-i18n'
const getI18n = useI18n()
const { t, locale } = getI18n
2025-04-09 18:55:14 +08:00
const pageDataInfoCom = pageDataInfo()
const state = reactive({
id: '',
FBillNo: '',
FStartProTimeShow: false,
FProTestTimeShow: false,
FProReportTimeShow: false,
FStartProTimes: '', //开始生产时间
FProTestTimes: '', //开始测试时间
FProReportTimes: '',//开始汇报时间
EnterIntoProData: {},
type: '',
qty: ''
2025-04-09 18:55:14 +08:00
})
onShow(() => {
let pageData = pageDataInfoCom.userInfos
console.log(pageData);
2025-04-09 18:55:14 +08:00
state.EnterIntoProData = pageData
state.id = pageData.Entry[0].Id
2025-04-09 18:55:14 +08:00
state.FBillNo = pageData.FBillNo
state.type = pageData.type
if (state.type === '1') state.qty = pageData.Entry[0].Qty
if (state.type === '3') state.qty = pageData.Entry[0].TestQty
if (state.type === '2') state.qty = pageData.Entry[0].ReportQty
2025-04-09 18:55:14 +08:00
if (state.type === '1' && state.FStartProTimes == '') {
state.FStartProTimes = timeFormat(pageData.time, 'yyyy-mm-dd hh:MM:ss')
}
if (pageData.FStartProTimes !== '') {
state.FStartProTimes = pageData.FStartProTimes.replace("T", " ")
2025-04-09 18:55:14 +08:00
}
if (state.type === '2' && state.FProReportTimes == '') {
state.FProReportTimes = timeFormat(pageData.time, 'yyyy-mm-dd hh:MM:ss')
}
if (pageData.FProReportTimes !== '') {
state.FProReportTimes = pageData.FProReportTimes.replace("T", " ")
2025-04-09 18:55:14 +08:00
}
if (state.type === '3' && state.FProTestTimes == '') {
state.FProTestTimes = timeFormat(pageData.time, 'yyyy-mm-dd hh:MM:ss')
}
if (pageData.FProTestTimes !== '') {
state.FProTestTimes = pageData.FProTestTimes.replace("T", " ")
2025-04-09 18:55:14 +08:00
}
})
const titleText = () => {
if (state.type === '1') return t('index.kssc')
if (state.type === '3') return t('index.kscs')
if (state.type === '2') return t('index.kshb')
2025-04-09 18:55:14 +08:00
}
const PRD_MORPTSaveFun = () => {
PRD_MOViewIntoPro({
Number: state.FBillNo
}).then((res : any) => {
if (res.code === 200) {
if (res.data.FRPFID !== '') {
let obj1 = {
Model: JSON.stringify({
FID: res.data.FRPFID,
FStartProTimes: state.FStartProTimes,
FProTestTimes: state.FProTestTimes,
})
}
let obj2 = {
Model: JSON.stringify({
FID: res.data.FRPFID,
FStartProTimes: state.FStartProTimes,
FProTestTimes: state.FProTestTimes,
FProReportTimes: state.FProReportTimes,
FEntity: [{ FEntryID: res.data.Entry[0].FRPFENTRYID, FQuaQty: Number(state.qty) }]
2025-04-09 18:55:14 +08:00
})
}
PRD_MORPTSave(state.type === '3' ? obj1 : obj2).then((resItem : any) => {
if (resItem.code === 200) {
// uni.$u.toast(t('public.cg'))
if(state.type === '2'){
toPages('/pages/putInProd/print',state.EnterIntoProData)
}
2025-04-09 18:55:14 +08:00
}
})
} else {
uni.$u.toast(t('index.qxjxsc'))
2025-04-09 18:55:14 +08:00
}
}
})
}
const PRD_MOPushIntoProFun = () => {
if (state.qty === '' || Number(state.qty) === 0) {
uni.$u.toast(t('index.slbnwk'))
return
}
2025-04-09 18:55:14 +08:00
PRD_MOPushIntoPro({
EntryIds: state.id,
2025-04-09 18:55:14 +08:00
TargetFormId: "PRD_MORPT",
IsEnableDefaultRule: "true",
CustomParams: {
ScanEntry: [
{
FStartProTimes: state.FStartProTimes,
FENTRYID: state.id,
Qty: Number(state.qty)
2025-04-09 18:55:14 +08:00
}
]
}
}).then((res : any) => {
if (res.code === 200) {
uni.$u.toast(t('public.cg'))
2025-04-09 18:55:14 +08:00
}
})
}
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;
}
const toPages = (url : string, data : any = {}) => {
uni.$u.route({
url: url,
params: data
})
}
2025-04-09 18:55:14 +08:00
</script>
<style lang="scss" scoped>
:deep(.uni-date__x-input) {
color: black !important;
2025-04-09 18:55:14 +08:00
}
2025-04-09 18:55:14 +08:00
.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;
2025-04-09 18:55:14 +08:00
.zongjian {
height: 1px;
flex: 1;
background-color: #f0f0f0;
margin: 0 16rpx;
}
}
}
}
}
</style>