|
@@ -8,13 +8,13 @@
|
|
|
<u-form-item label="检测项目" prop="detinspect" :required="true"
|
|
|
@click="showInspOption = true;hideKeyboard();">
|
|
|
<u--input v-model="formData.detinspect" disabled disabledColor="#ffffff"
|
|
|
- placeholder="请输入检测维保结果"></u--input>
|
|
|
+ placeholder="请输入检测项目"></u--input>
|
|
|
<!-- <u-input v-model="formData.detinspect" placeholder="请输入检测项目" /> -->
|
|
|
</u-form-item>
|
|
|
|
|
|
<u-form-item label="预计检测时间" prop="detdate">
|
|
|
<uni-datetime-picker :show="unitTime" v-model="formData.detdate" type="datetime"
|
|
|
- closeOnClickOverlay @confirm="ActiveUnitTime" @cancel="unitTime = false"
|
|
|
+ closeOnClickOverlay @confirm="ActiveUnitTime" @cancel="unitTime = false"
|
|
|
@change="changetime" @close="unitTime = false"></uni-datetime-picker>
|
|
|
</u-form-item>
|
|
|
<u-form-item label="检测维保结果" prop="detresult" @click="
|
|
@@ -32,7 +32,7 @@
|
|
|
</u-form-item>
|
|
|
<u-form-item label="附件">
|
|
|
<!-- 选择文件上传 -->
|
|
|
- <uni-file-picker v-model="formData.att" del-icon limit="1" auto-upload file-mediatype="all"
|
|
|
+ <uni-file-picker v-model="formData.File" del-icon limit="1" auto-upload file-mediatype="all"
|
|
|
@select="select" @delete="deleteFile">
|
|
|
<button type="primary" class="selectBtn"
|
|
|
style="background-color: rgba(76, 178, 182, 0.5);">选择附件</button>
|
|
@@ -132,7 +132,10 @@
|
|
|
formData: {
|
|
|
status: '0',
|
|
|
File: [],
|
|
|
- detresult:{id:null,name:null}
|
|
|
+ detresult: {
|
|
|
+ id: null,
|
|
|
+ name: null
|
|
|
+ }
|
|
|
},
|
|
|
// 自定义表单校验规则
|
|
|
customRules: {
|
|
@@ -148,8 +151,31 @@
|
|
|
trigger: ['blur', 'change']
|
|
|
},
|
|
|
orgName: {
|
|
|
- type: 'string',
|
|
|
- message: '请选择所属单位',
|
|
|
+ // pattern: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/,
|
|
|
+ // 自定义验证函数
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ // 上面有说,返回true表示校验通过,返回false表示不通过
|
|
|
+ // uni.$u.test.mobile()就是返回true或者false的
|
|
|
+ //是否符合正则 且不为空
|
|
|
+ if (!value) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ message: '请输入检测维保结果',
|
|
|
+ trigger: ['blur', 'change']
|
|
|
+ },
|
|
|
+ detresult: {
|
|
|
+ // pattern: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/,
|
|
|
+ // 自定义验证函数
|
|
|
+ validator: (rule, value, callback) => {
|
|
|
+ // 上面有说,返回true表示校验通过,返回false表示不通过
|
|
|
+ // uni.$u.test.mobile()就是返回true或者false的
|
|
|
+ //是否符合正则 且不为空
|
|
|
+ if (!value.id) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ message: '请输入检测维保结果',
|
|
|
trigger: ['blur', 'change']
|
|
|
}
|
|
|
}
|
|
@@ -183,7 +209,7 @@
|
|
|
pageSize: this.pageSize,
|
|
|
userId: this.$store.state.user.id
|
|
|
}).then(response => {
|
|
|
- console.log(response, 'response');
|
|
|
+ // console.log(response, 'response');
|
|
|
// 取到用户对应的单位名称与id
|
|
|
response.data.map(v => {
|
|
|
this.actions5.push({
|
|
@@ -203,7 +229,7 @@
|
|
|
this.resultOptions = [...trueArr]
|
|
|
//初始化检测项目选项
|
|
|
const trueArr1 = []
|
|
|
- console.log('detinspectOptions', this.detinspectOptions);
|
|
|
+ // console.log('detinspectOptions', this.detinspectOptions);
|
|
|
this.detinspectOptions.forEach(item => {
|
|
|
trueArr1.push({
|
|
|
id: item.value,
|
|
@@ -218,7 +244,7 @@
|
|
|
|
|
|
methods: {
|
|
|
submit(ref) {
|
|
|
- console.log(this.formData, 'alertalertalert');
|
|
|
+ // console.log(this.formData, 'alertalertalert');
|
|
|
// if (!this.formData.orgName) {
|
|
|
// return this.$modal.msgError('请选择所属单位')
|
|
|
// }
|
|
@@ -229,23 +255,23 @@
|
|
|
.validate()
|
|
|
.then(res => {
|
|
|
this.formData['status'] = 0;
|
|
|
- console.log('this.formData', this.formData);
|
|
|
+ // console.log('this.formData', this.formData);
|
|
|
if (this.formData.File.length > 0) {
|
|
|
this.formData.att = this.formData.File[0].url.toString();
|
|
|
} else {
|
|
|
this.formData.att = ''
|
|
|
}
|
|
|
//对要提交的数据进行处理 {id,name}只保存name
|
|
|
- this.$set(this.formData,'detresult',this.formData.detresult.id)
|
|
|
+ this.$set(this.formData, 'detresult', this.formData.detresult.id)
|
|
|
var jsdata = JSON.stringify(this.formData);
|
|
|
- console.log(jsdata, 'jsdatajsdatajsdata');
|
|
|
+ // console.log(jsdata, 'jsdatajsdatajsdata');
|
|
|
createFpdDetection(jsdata).then(response => {
|
|
|
- console.log('response.data.msg,', response.data);
|
|
|
+ // console.log('response.data.msg,', response.data);
|
|
|
uni.showLoading({
|
|
|
title: response.data.msg
|
|
|
});
|
|
|
setTimeout(() => {
|
|
|
- console.log('新增成功!');
|
|
|
+ // console.log('新增成功!');
|
|
|
uni.hideLoading();
|
|
|
uni.navigateBack({
|
|
|
delta: 1
|
|
@@ -284,7 +310,7 @@
|
|
|
Authorization: 'Bearer ' + getAccessToken()
|
|
|
}, //请求token
|
|
|
success: res => {
|
|
|
- console.log('uploadres', res);
|
|
|
+ // console.log('uploadres', res);
|
|
|
let data = JSON.parse(res.data);
|
|
|
// 返回的url
|
|
|
var fileLink = data.data;
|
|
@@ -305,7 +331,7 @@
|
|
|
|
|
|
},
|
|
|
fail: () => {
|
|
|
- console.log('err');
|
|
|
+ // console.log('err');
|
|
|
uni.showToast({
|
|
|
icon: 'error',
|
|
|
title: '文件上传失败!'
|
|
@@ -315,13 +341,13 @@
|
|
|
},
|
|
|
// 移出图片函数
|
|
|
async deleteFile(e) {
|
|
|
- console.log(e);
|
|
|
+ // console.log(e);
|
|
|
this.formData.attId = [];
|
|
|
- console.log('移除了:', this.formData.attId);
|
|
|
+ // console.log('移除了:', this.formData.attId);
|
|
|
},
|
|
|
//检测项目多选框选中
|
|
|
checkboxChange2(arr) { //勾选的事件
|
|
|
- console.log('arr', arr);
|
|
|
+ // console.log('arr', arr);
|
|
|
this.checkArr = [...arr]
|
|
|
|
|
|
},
|
|
@@ -332,12 +358,12 @@
|
|
|
},
|
|
|
checkboxCancel2() {
|
|
|
this.showInspOption = false
|
|
|
- if(this.formData.detinspect){
|
|
|
-
|
|
|
- const nowArr = this.formData.detinspect.split(',')
|
|
|
- this.checkArr = [...nowArr]
|
|
|
+ if (this.formData.detinspect) {
|
|
|
+
|
|
|
+ const nowArr = this.formData.detinspect.split(',')
|
|
|
+ this.checkArr = [...nowArr]
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
// 隐藏键盘
|
|
|
hideKeyboard() {
|
|
@@ -357,14 +383,17 @@
|
|
|
},
|
|
|
// 检测维保结果select事件
|
|
|
setResult(e) {
|
|
|
- console.log('e', e);
|
|
|
- this.formData.detresult = {id:e.id,name:e.name};
|
|
|
+ // console.log('e', e);
|
|
|
+ this.formData.detresult = {
|
|
|
+ id: e.id,
|
|
|
+ name: e.name
|
|
|
+ };
|
|
|
// this.formData.orgName = e.name;
|
|
|
- // console.log(this.formData.orgId);
|
|
|
+ console.log(this.formData);
|
|
|
},
|
|
|
// 检测检测项目select事件
|
|
|
setInsp(e) {
|
|
|
- console.log('e', e);
|
|
|
+ // console.log('e', e);
|
|
|
this.formData.detinspect = e.name;
|
|
|
// this.formData.orgName = e.name;
|
|
|
// console.log(this.formData.orgId);
|