<template>
|
<view class="edc-sampling-form-wrap">
|
<u--form
|
labelPosition="left"
|
:model="modelForm"
|
:rules="rules"
|
ref="uForm"
|
labelAlign="right"
|
labelWidth="20%"
|
>
|
<u-form-item
|
label="批号:"
|
prop="batchNumber"
|
borderBottom
|
ref="item1"
|
>
|
<u--input
|
v-model="modelForm.batchNumber"
|
border="none"
|
></u--input>
|
</u-form-item>
|
<u-form-item
|
label="供应商:"
|
prop="customerId"
|
borderBottom
|
ref="item1"
|
>
|
<jp-select-plus
|
:isLineFeed="false"
|
isSearch
|
color="#497bfb"
|
placeholder="请选择"
|
v-model="modelForm.customerId"
|
@toConfirm="toConfirmHandle"
|
:list="customerIdList"></jp-select-plus>
|
<!-- <u-cell-group>-->
|
<!-- <u-cell-->
|
<!-- value="请选择"-->
|
<!-- @click="handleCustomerIdClick">-->
|
<!-- <u-icon name="arrow-right"-->
|
<!-- slot="right-icon"-->
|
<!-- size="30"></u-icon></u-cell>-->
|
<!-- </u-cell-group>-->
|
<!-- <u--input-->
|
<!-- v-model="modelForm.customerId"-->
|
<!-- border="none"-->
|
<!-- -->
|
<!-- ></u--input>-->
|
</u-form-item>
|
<u-form-item
|
label="采样地点:"
|
prop="bunkerName"
|
borderBottom
|
ref="item1"
|
>
|
<u-cell-group>
|
<u-cell
|
value="请选择"
|
@click="handleBunkerIdClick">
|
<view slot="value" class="u-slot-value">
|
<u--input
|
v-model="modelForm.bunkerName"
|
border="none"
|
></u--input>
|
</view>
|
</u-cell>
|
</u-cell-group>
|
|
</u-form-item>
|
<u-form-item
|
label="采样日期:"
|
prop="samplingTime"
|
borderBottom
|
ref="item1"
|
>
|
<u--input
|
v-model="modelForm.samplingTime"
|
border="none"
|
disabled
|
></u--input>
|
</u-form-item>
|
<u-form-item
|
label="采样人:"
|
prop="name"
|
borderBottom
|
ref="item1"
|
>
|
<u--input
|
v-model="modelForm.samplingPerson"
|
border="none"
|
disabled
|
></u--input>
|
</u-form-item>
|
<div class="sumbmit-box">
|
<u-button @click="handleSubmit" type="primary" v-if="submitShow">确 定</u-button>
|
</div>
|
</u--form>
|
<view class="meicang-box">
|
<u-action-sheet
|
@select="selectBunker"
|
:show="bunkerShow"
|
:actions="bunkerList">
|
</u-action-sheet>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import { todayDate } from '@/utils/util.js';
|
import {getStatesOne} from "../../../../utils/status";
|
import { BaseUrl } from '@/api/request.js'
|
export default {
|
name: "yanGaiMei-sampling-form",
|
components: {
|
},
|
data() {
|
return {
|
submitShow:true,
|
customerIdList: [],
|
bunkerShow: false,
|
bunkerList:[],
|
modelForm: {
|
id:'',
|
batchNumber:'',
|
customerId:'', //供应商
|
customerName:'', //供应商
|
samplingTime: '', //采集日期
|
bunkerId:'',
|
bunkerName:'',
|
samplingPerson: '',
|
type: 6, //1 EDC、2 PVC、3 硫酸、4 氢氧化钠 5 液氯 6、原盐钙镁 7、原盐TOC 8、原盐全检
|
},
|
filedId:'',
|
customerIdShow: false,
|
customerFormVisable: false, //客户弹框
|
deptId:'',
|
rules: {
|
batchNumber:[{
|
type: 'string',
|
required: true,
|
message: '请填写批号',
|
trigger: ['blur', 'change']
|
}],
|
customerId:[{
|
type: 'string',
|
required: true,
|
message: '请选择供应商',
|
trigger: ['blur', 'change']
|
}],
|
bunkerName:[{
|
type: 'string',
|
required: true,
|
message: '请选择采样地点',
|
trigger: ['blur', 'change']
|
}]
|
}
|
}
|
},
|
computed: {
|
samplingPerson() {
|
return uni.getStorageSync('nameKey');
|
}
|
},
|
onReady() {
|
//如果需要兼容微信小程序,并且校验规则中含有方法等,只能通过setRules方法设置规则。
|
this.$refs.uForm.setRules(this.rules)
|
},
|
onLoad(opt) {
|
if(opt.params) { //查看
|
this.submitShow = false
|
this.$nextTick(() => {
|
this.modelForm = Object.assign({},JSON.parse(opt.params))
|
console.log(this.modelForm,'接收到上个页面传过来的参数===')
|
return
|
})
|
}
|
this.modelForm.samplingTime = todayDate(); //当前时间
|
this.modelForm.samplingPerson = uni.getStorageSync('name')
|
this.deptId = uni.getStorageSync('userInfo').deptIds
|
console.log(uni.getStorageSync('userInfo'),'userInfo==========')
|
console.log(this.deptId,'deptId==========')
|
this.getClaimCustomerList()
|
if(uni.getStorageSync('bunkerList')) { //缓存有数据拿数据
|
this.bunkerList = uni.getStorageSync('bunkerList')
|
}else { //没拿到数据调一遍接口
|
this.$store.dispatch('getBunkerList')
|
}
|
// console.log(getStatus('roleType'),'roleType-----')
|
// console.log(getStatus('customerId'),'customerId-----')
|
// console.log(getStatus('userInfo'),'userInfo-----')
|
// console.log(uni.getStorageSync('name'),'userInfo-----')
|
|
},
|
methods: {
|
getClaimCustomerList() { //供应商列表 type 类型 0/外部 1/内部(化验单的属于外部客户)
|
this.$reqGet('getClaimCustomerList',{type:'0'}).then(res => {
|
console.log(res,'供应商那个=====')
|
if(res.code == 0) {
|
this.customerIdList = res.data.map(item => {
|
return {
|
code:item.id,
|
name: item.name
|
}
|
})
|
}
|
})
|
},
|
handleBunkerIdClick() { //打开取样地点弹框
|
this.bunkerShow = true
|
},
|
selectBunker(v) { //采样地点
|
console.log(v,'v======')
|
this.modelForm.bunkerId = v.id
|
this.modelForm.bunkerName = v.name
|
this.bunkerShow = false
|
},
|
toConfirmHandle(v) { //供应商
|
console.log(v,'v====供应商==')
|
if(v) {
|
this.modelForm.customerName = v[0].name
|
this.modelForm.customerId = v[0].code
|
}
|
this.$refs.uForm.validateField('customerId')
|
},
|
handleSubmit() { //确定
|
console.log(this.modelForm,'this.modelForm===')
|
uni.showLoading({
|
title: '加载中'
|
})
|
this.$refs.uForm.validate().then(res => {
|
this.$reqPost('rawSaltsSampling',this.modelForm,'json').then(res => {
|
if(res) {
|
uni.hideLoading();
|
this.$u.toast('添加成功');
|
uni.redirectTo({
|
url: '/pages/quality-inspection-page/yanGaiMei-sampling/yanGaiMei-sampling'
|
})
|
}
|
|
})
|
}).catch(err => {
|
uni.hideLoading();
|
})
|
|
},
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@mixin commonBtn($h:62rpx){
|
background-image: linear-gradient(to right,#497bfb,#2467fd);
|
height: $h!important;
|
box-shadow: 0 0 10px rgba(43,98,239,0.5);
|
}
|
.edc-sampling-form-wrap{
|
width: 100%;
|
padding: 0 40rpx;
|
box-sizing: border-box;
|
::v-deep{
|
.pop-main{
|
height: 78vh!important;
|
transition: all 0.3s;
|
}
|
.u-action-sheet__item-wrap__item{
|
padding: 0 20rpx;
|
align-items: flex-start;
|
min-height: 160rpx;
|
max-height: 600rpx;
|
text{
|
font-size: 28rpx;
|
}
|
}
|
.u-popup__content{
|
.u-line{
|
border-bottom-width: 0px!important;
|
}
|
}
|
.u-form{
|
padding-top: 20rpx;
|
}
|
.u-form-item{
|
margin-bottom: 20rpx;
|
.u-transition{
|
min-height: 100vh;
|
max-height: 400vh;
|
height: 200rpx!important;
|
}
|
.u-line {
|
width: calc(80% - 20rpx)!important;
|
padding-left: 20rpx;
|
align-self: flex-end!important;
|
border-color: #e5e5e5!important;
|
}
|
.u-cell-group{
|
.u-line{
|
border-width: 0px!important;
|
}
|
.u-cell__body{
|
padding: 0!important;
|
align-items: flex-start;
|
}
|
.u-cell__body__content{
|
flex: initial;
|
}
|
}
|
.showData-field-line{
|
padding: 0!important;
|
}
|
.isLine::after{
|
border-width: 0px;
|
}
|
.u-form-item__body__right{
|
padding-left: 20rpx;
|
}
|
}
|
}
|
.sumbmit-box{
|
margin-top: 60rpx;
|
width: 100%;
|
display:flex;
|
justify-content:center;
|
::v-deep{
|
.u-button{
|
border-radius: 50rpx;
|
margin: 0 10rpx;
|
padding: 0 50rpx;
|
box-sizing: border-box;
|
height: 68rpx;
|
width: 80%;
|
@include commonBtn(72rpx);
|
}
|
}
|
}
|
}
|
|
.customer-form-wrap{
|
width: 100%;
|
height: 100%;
|
display: flex;
|
flex-direction: column;
|
::v-deep{
|
.u-input{
|
border: 1px solid #f5f5f5;
|
}
|
.u-transition{
|
max-height: 80%;
|
overflow-y: auto;
|
}
|
}
|
}
|
</style>
|