<template>
|
<view>
|
<page-nav title="异常录入"></page-nav>
|
<view class="mainContent" :style="{maxHeight:'1260rpx',overflow: 'scroll'}">
|
|
|
<u-gap height="5" bgColor="#eff0f1"></u-gap>
|
|
|
<view class="head marginLeft10 marginRight10" style="padding: 20rpx; 0">
|
|
<view class="flex_column">
|
|
<view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
|
<view style="display: flex;" class="titleFont">
|
<view style="color: red;margin-right: 6rpx;">*</view> 车间名称:
|
</view>
|
<view @click='workshopSheetShow = true' class="custominputClass">
|
<view v-show='workshopSheetValue===""' style="color: rgb(192, 196, 204);">请选择</view>
|
<view v-show='workshopSheetValue!==""' class="ellipsis" style="width: 390rpx;">
|
{{workshopSheetValue}}
|
</view>
|
<u-icon :name="!workshopSheetShow?'arrow-down-fill':'arrow-up-fill'"></u-icon>
|
</view>
|
</view>
|
|
<view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
|
<view style="display: flex;" class="titleFont">
|
<view style="color: red;margin-right: 6rpx;">*</view>
|
订单编号:
|
</view>
|
<view @click='orderSheetShow = true' class="custominputClass">
|
<view v-show='orderSheetValue===""' style="color: rgb(192, 196, 204);">请选择</view>
|
<view v-show='orderSheetValue!==""' class="ellipsis" style="width: 390rpx;">
|
{{orderSheetValue}}
|
</view>
|
<u-icon :name="!orderSheetShow?'arrow-down-fill':'arrow-up-fill'"></u-icon>
|
</view>
|
</view>
|
|
<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: transparent;margin-right: 6rpx;">*</view> 销售订单:
|
<view class='inputClass'>
|
<u--input placeholder="请输入" :adjustPosition='false' border="surround" type='number' disabled
|
v-model="saleOrder">
|
</u--input>
|
</view>
|
</view>
|
|
|
<view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
|
<view style="display: flex;" class="titleFont">
|
<view style="color: red;margin-right: 6rpx;">*</view>
|
产品名称:
|
</view>
|
<view @click='partnameSheetShow = true' class="custominputClass">
|
<view v-show='partnameSheetValue===""' style="color: rgb(192, 196, 204);">请选择</view>
|
<view v-show='partnameSheetValue!==""' class="ellipsis" style="width: 390rpx;">
|
{{partnameSheetValue}}
|
</view>
|
<u-icon :name="!partnameSheetShow?'arrow-down-fill':'arrow-up-fill'"></u-icon>
|
</view>
|
</view>
|
|
<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: transparent;margin-right: 6rpx;">*</view> 规格型号:
|
<view class='inputClass'>
|
<u--input placeholder="请输入" :adjustPosition='false' border="surround" type='number' disabled
|
v-model="partdesc">
|
</u--input>
|
</view>
|
</view>
|
|
|
<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: red;margin-right: 6rpx;">*</view> 订单数量:
|
<view class='inputClass'>
|
<u--input placeholder="请输入" :adjustPosition='false' border="surround" type='number' disabled
|
v-model="order_qty">
|
</u--input>
|
</view>
|
</view>
|
|
<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: red;margin-right: 6rpx;">*</view> 计划数量:
|
<view class='inputClass'>
|
<u--input placeholder="请输入" :adjustPosition='false' border="surround" type='number'
|
v-model="plan_qty">
|
</u--input>
|
</view>
|
</view>
|
|
|
<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: red;margin-right: 6rpx;">*</view> 完成数量:
|
<view class='inputClass'>
|
<u--input placeholder="请输入" :adjustPosition='false' border="surround" type='number'
|
v-model="comp_qty">
|
</u--input>
|
</view>
|
</view>
|
|
|
<view class="flex_center" style="margin: 0rpx 20rpx 10rpx;line-height: 76rpx;">
|
<view style="display: flex;" class="titleFont">
|
<view style="color: red;margin-right: 6rpx;">*</view> 异常等级:
|
</view>
|
<u-radio-group v-model="exceleve">
|
<u-radio shape="circle" label="普通" name="R" labelSize="16"></u-radio>
|
<u-radio shape="circle" label="严重" style="margin-left: 20rpx;" name="S" labelSize="16">
|
</u-radio>
|
</u-radio-group>
|
</view>
|
|
<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: red;margin-right: 6rpx;">*</view> 异常人数:
|
<view class='inputClass'>
|
<u--input placeholder="请输入" :adjustPosition='false' border="surround" type='number'
|
v-model="excepeople">
|
</u--input>
|
</view>
|
</view>
|
|
<!-- <view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: red;margin-right: 6rpx;">*</view> 异常时间:
|
<view class='inputClass'>
|
<u--input placeholder="请输入" :adjustPosition='false' border="surround" type='number'
|
v-model="excedate">
|
</u--input>
|
</view>
|
</view> -->
|
|
<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: red;margin-right: 6rpx;">*</view> 合计时间:
|
<view class='inputClass'>
|
<u--input placeholder="请输入" :adjustPosition='false' border="surround" type='number'
|
v-model="totaltime">
|
</u--input>
|
</view>
|
</view>
|
|
<view class="flex_center titleFont" style="margin: 0rpx 20rpx 10rpx;line-height: 56rpx;">
|
<view style="color: transparent;margin-right: 6rpx;">*</view> 异常原因:
|
<view class='inputClass'>
|
<u--textarea placeholder="请输入" :adjustPosition='false' border="surround" v-model="excedesc">
|
</u--textarea>
|
</view>
|
</view>
|
|
<view style="display: flex;">
|
<view v-for="(pic,index) in fileList" :key="pic.name">
|
<view style="margin: 20rpx 0rpx 20rpx 20rpx;position: relative;">
|
<u-icon name="close" color="#fff" size="16"
|
style="position: absolute;z-index: 10;right: 0;background-color: black;border-radius:50%;"
|
@click="deletePic(pic)"></u-icon>
|
|
<image :src="pic.uri" @click="imgPreview(pic)" class="upLoadImg"></image>
|
</view>
|
</view>
|
<image v-if="fileList.length<3" src="../../static/img/uploadImg.png" style="width: 100rpx;height: 100rpx;border: 1rpx solid #eff0f1;border-radius: 20rpx;
|
margin: 20rpx;padding: 30rpx;" @click="selectPics">
|
</view>
|
|
|
|
|
|
|
|
|
</view>
|
</view>
|
|
</view>
|
|
<!-- :disabled="" -->
|
<view class="footer">
|
<u-button size="large" :loading="isDisabledSubmitButton" loadingText="正在提交,请稍等..." type="primary"
|
@click="submit" text="确认提交">
|
</u-button>
|
</view>
|
|
|
|
<!-- 车间名称 -->
|
<u-picker :show="workshopSheetShow" :columns="workshopColumns" :itemHeight='55' :closeOnClickOverlay='true'
|
@close='workshopSheetShow=false' @confirm='workshopPickerConfirm' @cancel='workshopSheetShow=false'>
|
</u-picker>
|
|
<!-- 订单编号 -->
|
<u-picker :show="orderSheetShow" :columns="orderColumns" :itemHeight='55' :closeOnClickOverlay='true'
|
@close='orderSheetShow=false' @confirm='orderPickerConfirm' @cancel='orderSheetShow=false'>
|
</u-picker>
|
|
<!-- 产品名称 -->
|
<u-picker :show="partnameSheetShow" :columns="partnameColumns" :itemHeight='55' :closeOnClickOverlay='true'
|
@close='partnameSheetShow=false' @confirm='partnamePickerConfirm' @cancel='partnameSheetShow=false'>
|
</u-picker>
|
|
|
|
</view>
|
</template>
|
|
<script>
|
import {
|
PrentOrganizationNoCompany,
|
WkspWrkOrderDataSelect,
|
WrkOrderPartDataSelect
|
} from '../../config/api.js';
|
|
export default {
|
data() {
|
return {
|
workshopSheetShow: false, //上拉列表是否展开
|
workshopColumns: [], //
|
workshopList: [],
|
workshopSheetValue: '',
|
|
orderSheetShow: false, //上拉列表是否展开
|
orderColumns: [], //
|
orderList: [],
|
orderSheetValue: '',
|
|
saleOrder: '', //销售订单
|
|
partnameSheetShow: false, //上拉列表是否展开
|
partnameColumns: [], //
|
partnameList: [],
|
partnameSheetValue: '',
|
|
|
partdesc: '', //规格型号
|
order_qty: '', //订单数量
|
plan_qty: '', //计划数量
|
comp_qty: '', //完成数量
|
exceleve: 'R', //异常等级
|
excepeople: '', //异常人数
|
excedate: '', //异常日期
|
totaltime: '', //合计时间
|
excedesc: '', //异常原因
|
|
|
imgPreviewSrcs: [], //图片预览src
|
fileList: [
|
|
],
|
isDisabledSubmitButton: false
|
}
|
},
|
|
created() {
|
|
},
|
mounted() {
|
|
|
this.getPrentOrganizationNoCompany()
|
},
|
methods: {
|
async getPrentOrganizationNoCompany() {
|
const res = await PrentOrganizationNoCompany()
|
if (res.code === '200') {
|
this.workshopList = res.data.map(({
|
torg_code,
|
torg_name
|
}) => ({
|
code: torg_code,
|
name: torg_name
|
}))
|
this.workshopColumns = [this.workshopList.map(i => i.name)]
|
}
|
|
},
|
workshopPickerConfirm(val) {
|
console.log(val, 11)
|
|
this.getWkspWrkOrderDataSelect(this.workshopList.find(i => i.name === val.value[0]).code)
|
this.workshopSheetValue = val.value[0]
|
this.workshopSheetShow = false
|
|
|
this.orderColumns = []
|
this.orderSheetValue = ''
|
|
this.partnameColumns = []
|
this.partnameSheetValue = ''
|
},
|
|
async getWkspWrkOrderDataSelect(wkshopcode) {
|
const res = await WkspWrkOrderDataSelect({
|
wkshopcode
|
})
|
|
if (res.code === '200') {
|
this.orderList = res.data
|
this.orderColumns = [this.orderList.map(i => i.wo)]
|
}
|
},
|
orderPickerConfirm(val) {
|
this.getWrkOrderPartDataSelect(val.value[0])
|
this.saleOrder = this.orderList.find(i => i.wo === val.value[0]).saleOrderCode
|
this.orderSheetValue = val.value[0]
|
this.orderSheetShow = false
|
|
this.partnameColumns = []
|
this.partnameSheetValue = ''
|
},
|
async getWrkOrderPartDataSelect(ordercode) {
|
const res = await WrkOrderPartDataSelect({
|
ordercode
|
})
|
this.partnameList = res.data
|
this.partnameColumns = [this.partnameList.map(i => i.partname)]
|
},
|
partnamePickerConfirm(val) {
|
this.partnameSheetValue = val.value[0]
|
this.partnameSheetShow = false
|
|
this.partdesc = this.partnameList.find(i => i.partname === val.value[0]).partspec
|
this.order_qty = this.partnameList.find(i => i.partname === val.value[0]).qty
|
},
|
|
// 选择图片
|
selectPics() {
|
var that = this;
|
uni.chooseImage({
|
count: 3,
|
success: (res) => {
|
const files = res.tempFiles;
|
for (let i = 0; i < files.length; i++) {
|
let obj = new Object();
|
obj.name = 'photo' + i + new Date().getTime();
|
obj.uri = files[i].path;
|
that.fileList.push(obj);
|
if (obj.src == null || obj.src == '' || obj.src == undefined) {
|
that.imgPreviewSrcs.push(obj.uri)
|
} else {
|
that.imgPreviewSrcs.push(obj.src)
|
}
|
|
}
|
}
|
})
|
},
|
|
// 预览图片
|
imgPreview(img) {
|
uni.previewImage({
|
current: this.fileList.findIndex(i => i.name === img.name),
|
indicator: "number",
|
loop: true,
|
urls: this.imgPreviewSrcs
|
|
})
|
},
|
|
submit() {
|
|
if (this.workshopSheetValue === '') {
|
return uni.$u.toast('车间不能为空')
|
}
|
if (this.orderSheetValue === '') {
|
return uni.$u.toast('订单不能为空')
|
}
|
if (this.partnameSheetValue === '') {
|
return uni.$u.toast('产品不能为空')
|
}
|
if (this.order_qty === '') {
|
return uni.$u.toast('订单数量不能为空')
|
}
|
if (this.plan_qty === '') {
|
return uni.$u.toast('计划数量不能为空')
|
}
|
if (this.comp_qty === '') {
|
return uni.$u.toast('完成数量不能为空')
|
}
|
if (this.excepeople === '') {
|
return uni.$u.toast('异常人数不能为空')
|
}
|
if (this.totaltime === '') {
|
return uni.$u.toast('合计时间不能为空')
|
}
|
|
|
|
|
|
let formData = {
|
opertype: 'Add',
|
id: '',
|
wkshop_code: this.workshopList.find(i => i.name === this.workshopSheetValue).code,
|
order_code: this.orderSheetValue,
|
saleorder_code: this.saleOrder,
|
partcode: this.partnameList.find(i => i.partname === this.partnameSheetValue).partcode,
|
order_qty: this.order_qty,
|
plan_qty: this.plan_qty,
|
comp_qty: this.comp_qty,
|
exceleve: this.exceleve,
|
excedesc: this.excedesc,
|
excepeople: this.excepeople,
|
totaltime: this.totaltime,
|
excedate: this.global.handleDatetime2(new Date())
|
}
|
|
console.log(JSON.stringify(formData))
|
const header = {
|
// 'Content-Type': 'multipart/form-data',
|
'Content-Type': 'application/x-www-form-urlencoded',
|
// 'Content-Type': 'application/json',
|
'Token': uni.getStorageSync('Token')
|
}
|
|
this.isDisabledSubmitButton = true
|
uni.uploadFile({
|
url: this.$baseUrl + '/ExceptionManagement/AddUpdateExceptionManagement',
|
files: this.fileList.length === 0 ? [{
|
uri: '/'
|
}] : this.fileList,
|
header: header,
|
formData: formData,
|
success: (res) => {
|
console.log(JSON.stringify(res))
|
let result = JSON.parse(res.data)
|
if (res.statusCode == 200 && result.code == '200') {
|
uni.$u.toast('提交成功!')
|
this.fileList = []
|
this.imgPreviewSrcs = []
|
|
|
this.workshopSheetValue = ''
|
this.orderSheetValue = ''
|
this.saleOrder = ''
|
this.partnameSheetValue = ''
|
|
this.partdesc = ''
|
this.order_qty = ''
|
this.plan_qty = ''
|
this.comp_qty = ''
|
this.exceleve = 'R'
|
this.excepeople = ''
|
this.excedate = ''
|
this.totaltime = ''
|
this.excedesc = ''
|
|
this.orderColumns = []
|
this.partnameColumns = []
|
|
|
|
} else {
|
uni.$u.toast(result.Message)
|
}
|
this.isDisabledSubmitButton = false
|
},
|
fail(res) {
|
console.log(res)
|
uni.$u.toast('提交失败!')
|
this.isDisabledSubmitButton = false
|
},
|
})
|
|
// #ifdef APP-PLUS ||MP
|
|
// #endif
|
}
|
|
|
}
|
|
|
}
|
</script>
|
|
|
<style lang="scss" scoped>
|
@import url('@/style/global.css');
|
|
::v-deep .uicon-arrow-left>span {
|
display: block;
|
}
|
|
.custominputClass {
|
width: 412rpx;
|
display: flex;
|
justify-content: space-between;
|
border: 3rpx #eff0f1 solid;
|
border-radius: 10rpx;
|
padding: 0 16rpx;
|
|
}
|
|
.ellipsis {
|
text-overflow: ellipsis;
|
overflow: hidden;
|
white-space: nowrap;
|
}
|
|
.scanImg2 {
|
width: 70px;
|
height: 70px;
|
border-radius: 50%;
|
margin: auto;
|
background: url('@/static/img/scan.png') no-repeat;
|
box-shadow: #436df5 0px 0px 20px;
|
background-size: 100% 100%;
|
}
|
|
::v-deep .addClass .uicon-plus-circle {
|
font-size: 50rpx !important;
|
margin-right: 20rpx !important;
|
}
|
|
::v-deep .addClass .u-button__text {
|
font-size: 46rpx !important;
|
}
|
|
|
::v-deep .u-modal__content {
|
padding-bottom: 260rpx;
|
margin-bottom: 100rpx;
|
}
|
|
::v-deep .u-action-sheet {
|
max-height: 600rpx !important;
|
overflow: auto !important;
|
}
|
|
::v-deep .u-checkbox-label--right {
|
padding: 30rpx;
|
border-bottom: 1rpx solid #eee;
|
}
|
|
|
|
.badSheetClass {
|
position: relative;
|
}
|
|
.badNumber {
|
position: absolute;
|
top: 20rpx;
|
left: 20rpx;
|
font-size: 26rpx;
|
color: rgb(0, 102, 255)
|
}
|
|
.trash {
|
position: absolute;
|
top: 20rpx;
|
right: 30rpx;
|
font-size: 26rpx;
|
}
|
|
.uploader {
|
/deep/.u-add-tips {
|
display: none;
|
}
|
}
|
|
::v-deep .uni-progress-bar {
|
background-color: transparent !important;
|
}
|
|
.upLoadImg {
|
width: 160rpx;
|
height: 160rpx;
|
border-radius: 20rpx;
|
}
|
</style>
|