<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"
|
isLoading
|
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--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="tonnage"
|
borderBottom
|
ref="item1"
|
>
|
<u--input
|
@change="inputVal"
|
v-model="modelForm.tonnage"
|
border="none"
|
></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>
|
<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>
|
<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
|
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'
|
import { mapGetters } from 'vuex';
|
const dayjs = require('dayjs')
|
export default {
|
name: "yanGaiMei-sampling-form",
|
components: {
|
},
|
data() {
|
return {
|
submitShow:true,
|
customerIdList: [],
|
bunkerShow: false,
|
bunkerList:[],
|
samplingPersonShow: false,
|
modelForm: {
|
id:'',
|
batchNumber:'',
|
customerId:'', //供应商
|
customerName:'', //供应商
|
samplingTime: '', //采集日期
|
tonnage:null,
|
bunkerName:'',
|
samplingPerson: '',
|
type: 8, //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']
|
}],
|
customerId:[{
|
type: 'string',
|
required: true,
|
message: '请选择供应商',
|
trigger: ['blur', 'change']
|
}],
|
bunkerName:[{
|
type: 'string',
|
required: true,
|
message: '请选择采样地点',
|
trigger: ['blur']
|
}],
|
tonnage:[{
|
type: 'number',
|
required: true,
|
message: '请输入吨数',
|
trigger: ['blur', 'change']
|
}]
|
}
|
}
|
},
|
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))
|
console.log(this.modelForm,'接收到上个页面传过来的参数===')
|
if(this.modelForm.samplingTime) {
|
this.modelForm.samplingTime = dayjs(this.modelForm.samplingTime).format('YYYY-MM-DD HH:mm')
|
}
|
return
|
})
|
}
|
this.modelForm.samplingTime = todayDate('ymd hm'); //当前时间
|
this.deptId = uni.getStorageSync('userInfo').deptIds
|
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/内部(化验单的属于外部客户) personnelType 0/客户 1/供应商
|
this.$reqGet('getClaimCustomerPageList',{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
|
},
|
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.modelForm.samplingTime = dayjs(this.modelForm.samplingTime).format("YYYY-MM-DD HH:mm:ss") //传参时间要带分 否则报错
|
this.$reqPost('rawSaltsSampling',this.modelForm,'json').then(res => {
|
if(res) {
|
uni.hideLoading();
|
this.$u.toast('添加成功');
|
uni.redirectTo({
|
url: '/pages/quality-inspection-page/salt-total-sampling/salt-total-sampling'
|
})
|
}
|
|
})
|
}).catch(err => {
|
uni.hideLoading();
|
})
|
|
},
|
inputVal(val) {
|
console.log(val,'val----')
|
if(val) {
|
let temp = val.toString().replace(/[^0-9.]+/g,'')
|
this.$nextTick(() => {
|
this.modelForm.tonnage = Number(temp)
|
})
|
}
|
|
}
|
},
|
}
|
</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);
|
}
|
.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{
|
//align-items: flex-start;
|
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>
|