yangan
1 天以前 a28d0135ee42809b2c5863609da37155d3ecba5b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
<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&#45;&#45;input
                  v-model="modelForm.bunkerName"
                  border="none"
              ></u&#45;&#45;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&#45;&#45;input
            v-model="modelForm.samplingPerson"
            border="none"
            disabled
        ></u&#45;&#45;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>