<template>
|
<view class="symbNa-sampling-form">
|
<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="bunkerName"
|
borderBottom
|
ref="item1"
|
>
|
<u--input
|
v-model="modelForm.bunkerName"
|
border="none"
|
></u--input>
|
<!-- <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="exterior"
|
borderBottom
|
ref="item1"
|
>
|
<u--input
|
v-model="modelForm.exterior"
|
border="none"
|
></u--input>
|
</u-form-item>
|
<u-form-item
|
label="采用标准:"
|
prop="executionStandards"
|
borderBottom
|
ref="item1"
|
>
|
<u--input
|
v-model="modelForm.executionStandards"
|
border="none"
|
></u--input>
|
</u-form-item>
|
<u-form-item
|
label="采样人:"
|
prop="samplingPerson"
|
borderBottom
|
ref="item1"
|
>
|
<u-cell-group>
|
<u-cell
|
value="请选择"
|
@click.native="handleBunkerIdClick">
|
<view slot="value" class="u-slot-value">
|
<u--input
|
v-model="modelForm.samplingPerson"
|
border="none"
|
></u--input>
|
</view>
|
</u-cell>
|
</u-cell-group>
|
<!-- <u--input
|
v-model="modelForm.samplingPerson"
|
border="none"
|
disabled
|
></u--input>-->
|
</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>
|
<div class="sumbmit-box">
|
<u-button @click="handleSubmit" v-if="submitShow" type="primary">确 定</u-button>
|
</div>
|
</u--form>
|
<view class="meicang-box">
|
<u-action-sheet
|
title="选择采样员"
|
:closeOnClickOverlay="true"
|
:closeOnClickAction="true"
|
@select="selectsamplingPerson"
|
:show="samplingPersonShow"
|
@close="samplingPersonShow = false"
|
:actions="samplingPersonList">
|
</u-action-sheet>
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import { todayDate } from '@/utils/util.js';
|
import {getStatesOne} from "../../../../utils/status";
|
import { BaseUrl } from '@/api/request.js'
|
const dayjs = require('dayjs')
|
import { mapGetters } from 'vuex';
|
export default {
|
name: "yanGaiMei-sampling-form",
|
components: {
|
},
|
data() {
|
return {
|
submitShow:true,
|
customerIdList: [],
|
bunkerShow: false,
|
bunkerList:[],
|
samplingPersonShow: false,
|
modelForm: {
|
id:'',
|
batchNumber:'',
|
samplingTime: '', //采集日期
|
bunkerName:'',
|
samplingPerson: '',
|
exterior:'无色透明粘稠液体', //外观
|
executionStandards:'GB/T209-2018',
|
type: 4, //1 EDC、2 聚氯乙烯树脂、3 硫酸、4 氢氧化钠 5 液氯 6、原盐钙镁 7、原盐TOC 8、原盐全检
|
},
|
filedId:'',
|
customerIdShow: false,
|
customerFormVisable: false, //客户弹框
|
deptId:'',
|
rules: {
|
batchNumber:[{
|
type: 'string',
|
required: true,
|
message: '请填写批号',
|
trigger: ['blur', 'change']
|
}],
|
bunkerName:[{
|
type: 'string',
|
required: true,
|
message: '请选择采样地点',
|
trigger: ['blur']
|
}]
|
}
|
}
|
},
|
computed: {
|
...mapGetters(['samplingPersonList'])
|
},
|
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))
|
this.modelForm.samplingTime = dayjs(this.modelForm.samplingTime).format('YYYY-MM-DD') || ''
|
console.log(this.modelForm,'接收到上个页面传过来的参数===氢氧化钠')
|
return
|
})
|
}
|
this.modelForm.samplingTime = todayDate('ymd hm'); //当前时间
|
this.deptId = uni.getStorageSync('userInfo').deptIds
|
console.log(this.deptId,'deptId==========')
|
this.getClaimCustomerList()
|
this.$store.dispatch('getSamplingPerson')
|
// 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',{personnelType:1,type:0,deptId:this.deptId}).then(res => {
|
console.log(res,'供应商那个=====')
|
if(res.code == 0) {
|
this.customerIdList = res.data.map(item => {
|
return {
|
code:item.id,
|
name: item.name
|
}
|
})
|
}
|
})
|
},
|
handleBunkerIdClick() { //打开取样地点弹框
|
this.samplingPersonShow = true
|
},
|
selectsamplingPerson(v) { //采样地点
|
console.log(v,'v======')
|
this.modelForm.samplingPerson = v.name
|
this.modelForm.samplingSignAddress = v.imgPath
|
this.samplingPersonShow = false
|
},
|
handleSubmit() { //确定
|
console.log(this.modelForm,'this.modelForm===')
|
uni.showLoading({
|
title: '加载中'
|
})
|
this.$refs.uForm.validate().then(res => {
|
this.modelForm.samplingTime = dayjs(this.modelForm.samplingTime).format("YYYY-MM-DD HH:mm:ss")
|
this.$reqPost('zjqualitycheck',this.modelForm,'json').then(res => {
|
if(res) {
|
uni.hideLoading();
|
this.$u.toast('添加成功');
|
uni.redirectTo({
|
url: '/pages/quality-inspection-page/symbNa-sampling/symbNa-sampling'
|
})
|
}
|
|
})
|
}).catch(err => {
|
uni.hideLoading();
|
})
|
|
},
|
},
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
::v-deep{
|
.u-transition{
|
min-height: 10vh;
|
max-height: 85vh;
|
overflow-y: auto;
|
}
|
.u-icon__icon{
|
font-size: 34rpx!important;
|
top: 12rpx;
|
}
|
.inputs{
|
width: 100%;
|
}
|
}
|
@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);
|
}
|
.symbNa-sampling-form{
|
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{
|
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: 10vh;
|
max-height: 71vh;
|
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>
|