238 lines
6.6 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>{{ t('index.scdd') }}</view>
<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>
</view>
<view class="timebox">
<view>{{ t('index.kscssj') }}</view>
<view class="zongjian"></view>
<view>{{ state.FProTestTimes }}</view>
</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>
</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>
</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>
<up-button v-show="state.type !== '1'" class="btnItem" type="primary" shape="circle"
@click="PRD_MORPTSaveFun()" :text="t('public.confirm')"></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';
import { useI18n } from 'vue-i18n'
const getI18n = useI18n()
const { t, locale } = getI18n
const pageDataInfoCom = pageDataInfo()
const state = reactive({
id: '',
FBillNo: '',
FStartProTimeShow: false,
FProTestTimeShow: false,
FProReportTimeShow: false,
FStartProTimes: '', //开始生产时间
FProTestTimes: '', //开始测试时间
FProReportTimes: '',//开始汇报时间
EnterIntoProData: {},
type: '',
qty: ''
})
onShow(() => {
let pageData = pageDataInfoCom.userInfos
console.log(pageData);
state.EnterIntoProData = pageData
state.id = pageData.Entry[0].Id
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
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", " ")
}
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", " ")
}
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", " ")
}
})
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')
}
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) }]
})
}
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)
}
}
})
} else {
uni.$u.toast(t('index.qxjxsc'))
}
}
})
}
const PRD_MOPushIntoProFun = () => {
if (state.qty === '' || Number(state.qty) === 0) {
uni.$u.toast(t('index.slbnwk'))
return
}
PRD_MOPushIntoPro({
EntryIds: state.id,
TargetFormId: "PRD_MORPT",
IsEnableDefaultRule: "true",
CustomParams: {
ScanEntry: [
{
FStartProTimes: state.FStartProTimes,
FENTRYID: state.id,
Qty: Number(state.qty)
}
]
}
}).then((res : any) => {
if (res.code === 200) {
uni.$u.toast(t('public.cg'))
}
})
}
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
})
}
</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>