<template>
|
<view class="tag-add">
|
<u-form :model="form" ref="uForm" :error-type="['toast']">
|
<u-form-item label="类型" prop="type" required v-if="info.workCenter === 'ZZ-03'">
|
<u-input v-model="form.type" type="select" input-align="right" placeholder="请选择"/>
|
<u-icon name="arrow-right" @click="show = true"></u-icon>
|
</u-form-item>
|
<u-form-item label="数量" :border-bottom="false" style="width: calc(100% - 40rpx);" prop="num" required>
|
<u-input v-model="form.num" input-align="right" placeholder="请输入"/>
|
</u-form-item>
|
</u-form>
|
<u-button type="primary" style="margin: 30rpx;" :loading="loading" @click="submit" :custom-style="{
|
backgroundColor: '#214DED',
|
height:'80rpx'}" class="btn">提交</u-button>
|
<u-select :list="actionSheetList" v-model="show" @confirm="actionSheetCallback"></u-select>
|
</view>
|
</template>
|
|
<script>
|
import UIcon from "../../../uview-ui/components/u-icon/u-icon.vue";
|
|
export default {
|
components: {UIcon},
|
data(){
|
return{
|
form:{
|
type: '',
|
num: '',
|
value: '',
|
reportType: ''
|
},
|
show:false,
|
actionSheetList:[],
|
rules: {
|
type: [
|
{
|
required: true,
|
message: '请选择类型',
|
trigger: ['change'],
|
}
|
],
|
num: [
|
{
|
required: true,
|
message: '请输入数量',
|
trigger: ['change','blur'],
|
},
|
// 正则判断只能为数字
|
{
|
validator: (rule, value, callback) => {
|
return this.$u.test.digits(value);
|
},
|
message: '只能为数字',
|
trigger: ['change','blur'],
|
},
|
]
|
},
|
loading:false,
|
info: {}
|
}
|
},
|
onLoad(options) {
|
this.info = JSON.parse(decodeURIComponent(options.info))
|
},
|
methods:{
|
actionSheetCallback(item){
|
this.form.type = item[0].label
|
this.form.value = item[0].value
|
},
|
submit(){
|
this.$refs.uForm.validate(valid => {
|
if (valid) {
|
this.form.operationTaskId = this.info.id
|
this.form.workstationId = this.info.workstationId
|
this.form.reportType = this.info.workCenter === 'ZZ-03' ? 'CHENGTAO_PRODUCT_REPORT' : 'WAIKE_PRODUCT_REPORT'
|
let type =""
|
|
if(this.form.type ==="高压柜" ){
|
type ="GY"
|
}else if(this.form.type ==="低压柜"){
|
type ="DY"
|
}else{
|
type ="XT"
|
}
|
|
let param ={
|
type: type,
|
num: this.form.num,
|
value: this.form.value,
|
reportType: this.form.reportType,
|
operationTaskId:this.form.operationTaskId,
|
workstationId:this.form.workstationId,
|
reportType:this.form.reportType
|
}
|
this.$u.api.dailyPaper.generateLabel(param).then(res => {
|
console.log(res)
|
if (res.code === 0) {
|
this.$u.toast('操作成功')
|
this.loading = true;
|
uni.navigateBack({
|
//关闭当前页面,返回上一页面或多级页面。
|
delta:1
|
});
|
this.loading = false;
|
}
|
})
|
} else {
|
console.log('验证失败');
|
}
|
});
|
},
|
getCabinetType () {
|
this.$u.api.dictData({dictType: 'cabinet_type'}).then(res => {
|
if (res.code === 0 && res.data.length > 0) {
|
res.data.forEach(i => {
|
const obj = Object.assign({
|
label: i.label,
|
value: i.value,
|
})
|
this.actionSheetList.push(obj)
|
})
|
}
|
})
|
}
|
},
|
onReady() {
|
this.$refs.uForm.setRules(this.rules);
|
this.actionSheetList = []
|
// 进入页面查询类型列表
|
this.getCabinetType()
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
.tag-add{
|
height: calc(100vh - 88rpx);
|
background: linear-gradient(to bottom, #E5F0FF, #FFF);
|
box-sizing: border-box;
|
padding-top: 32rpx;
|
.u-form{
|
margin: 0 30rpx;
|
background: #FFFFFF;
|
border-radius: 10rpx;
|
padding: 20rpx 26rpx;
|
}
|
.btn{
|
position: fixed;
|
bottom: 40rpx;
|
width: calc(100% - 60rpx);
|
}
|
}
|
::v-deep.uicon-arrow-down-fill:before {
|
display: none;
|
}
|
::v-deep.u-form-item--left__content__label {
|
width: 100rpx;
|
padding-left: 26rpx;
|
font-weight: 500;
|
font-size: 30rpx;
|
color: #4F4F4F;
|
line-height: 80rpx;
|
}
|
::v-deep.u-form-item--left__content--required {
|
left: 8rpx;
|
top: 0;
|
}
|
</style>
|