|
@@ -2,7 +2,7 @@
|
|
|
<view class=" uni-container">
|
|
|
<view class="example container" :style="'height: ' + (screenHeight - wheight - 75) + 'px'">
|
|
|
<!-- 自定义表单校验 1-->
|
|
|
- <u-form ref="customForm" :rules='customRules' :model="formData" labelPosition="left" labelWidth="150"
|
|
|
+ <u-form ref="editDeteForm" :rules='customRules' :model="formData" labelPosition="left" labelWidth="150"
|
|
|
labelAlign="left">
|
|
|
<view class=" flex flex-direction width100">
|
|
|
<u-form-item label="检测项目" prop="detinspect" :required="true"
|
|
@@ -20,7 +20,7 @@
|
|
|
<u-form-item label="检测维保结果" prop="detresult" @click="
|
|
|
showreOption = true;
|
|
|
hideKeyboard();" :required="true">
|
|
|
- <u--input v-model="formData.detresult" disabled disabledColor="#ffffff"
|
|
|
+ <u--input v-model="formData.detresult.name" disabled disabledColor="#ffffff"
|
|
|
placeholder="请输入检测维保结果"></u--input>
|
|
|
<!-- <u-input v-model="formData.detresult" placeholder="请输入检测维保结果" /> -->
|
|
|
</u-form-item>
|
|
@@ -32,15 +32,8 @@
|
|
|
</u-form-item>
|
|
|
<u-form-item label="附件">
|
|
|
<!-- 选择文件上传 -->
|
|
|
- <uni-file-picker
|
|
|
- v-model="formData.File"
|
|
|
- del-icon
|
|
|
- limit="1"
|
|
|
- auto-upload
|
|
|
- file-mediatype="all"
|
|
|
- @select="select"
|
|
|
- @delete="deleteFile"
|
|
|
- >
|
|
|
+ <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">选择附件</button>
|
|
|
<!-- 加载中 -->
|
|
|
<isLodingModel v-if="loading"></isLodingModel>
|
|
@@ -84,7 +77,7 @@
|
|
|
<!-- ----隐患 -->
|
|
|
</view>
|
|
|
<uni-row class="heigthButton">
|
|
|
- <u-button @click="submit('customForm')" type="primary" shape="circle" size="large" color="#4CB2B6"
|
|
|
+ <u-button @click="submit('editDeteForm')" type="primary" shape="circle" size="large" color="#4CB2B6"
|
|
|
text="确认修改"></u-button>
|
|
|
</uni-row>
|
|
|
</view>
|
|
@@ -143,7 +136,7 @@
|
|
|
formData: {
|
|
|
status: '0',
|
|
|
File: [],
|
|
|
- drillDate: ''
|
|
|
+ detresult: {id:null,name:null}
|
|
|
},
|
|
|
// 自定义表单校验规则
|
|
|
customRules: {
|
|
@@ -189,24 +182,62 @@
|
|
|
i.id = i.value;
|
|
|
});
|
|
|
//获取当前表单数据
|
|
|
- // getFpdDetection(option.id).then(res => {
|
|
|
- // console.log('thisform', res);
|
|
|
- // this.formData = res.data
|
|
|
- // })
|
|
|
- const navData = JSON.parse(option.navData)
|
|
|
- console.log('navdata', navData);
|
|
|
- this.formData = navData;
|
|
|
- var File = this.formData.File = []
|
|
|
- if (this.formData.att != '') {
|
|
|
- File.push({
|
|
|
- url: this.formData.att,
|
|
|
- name: this.formData.att
|
|
|
+ getFpdDetection(option.id).then(res => {
|
|
|
+ console.log('thisform', res);
|
|
|
+ //对检测结果进行初始化
|
|
|
+ const reArr = getDictDatas(DICT_TYPE.BACKEND_DET_RESULT)
|
|
|
+ // console.log('reArr',reArr);
|
|
|
+
|
|
|
+ const thisItem = reArr.find(par => par.value === res.data.detresult)
|
|
|
+ // console.log('thisItem',thisItem);
|
|
|
+ if (thisItem) {
|
|
|
+ res.data.detresult = {
|
|
|
+ id: thisItem.value,
|
|
|
+ name: thisItem.label
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ this.formData = res.data
|
|
|
+ var File = this.formData.File = []
|
|
|
+ if (this.formData.att != '') {
|
|
|
+ File.push({
|
|
|
+ url: this.formData.att,
|
|
|
+ name: this.formData.att
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ File = null
|
|
|
+ }
|
|
|
+ // 获取单位id
|
|
|
+ getOrgId({
|
|
|
+ pageNo: this.pageNo,
|
|
|
+ pageSize: this.pageSize,
|
|
|
+ userId: this.$store.state.user.id
|
|
|
+ }).then(response => {
|
|
|
+ console.log(response, 'response');
|
|
|
+ // 取到用户对应的单位名称与id
|
|
|
+ response.data.forEach(v => {
|
|
|
+ if (this.formData.orgId === v.dwid) {
|
|
|
+ this.$set(this.formData, 'orgName', v.orgName)
|
|
|
+ }
|
|
|
+ });
|
|
|
});
|
|
|
- } else {
|
|
|
- File = null
|
|
|
- }
|
|
|
- console.log('edit页面的val的值', this.formData);
|
|
|
-
|
|
|
+ console.log('edit页面的val的值', this.formData);
|
|
|
+ })
|
|
|
+ // const navData = JSON.parse(option.navData)
|
|
|
+ // console.log('navdata', navData);
|
|
|
+ // this.formData = navData;
|
|
|
+ // var File = this.formData.File = []
|
|
|
+ // if (this.formData.att != '') {
|
|
|
+ // File.push({
|
|
|
+ // url: this.formData.att,
|
|
|
+ // name: this.formData.att
|
|
|
+ // });
|
|
|
+ // } else {
|
|
|
+ // File = null
|
|
|
+ // }
|
|
|
+ // console.log('edit页面的val的值', this.formData);
|
|
|
+
|
|
|
// 获取单位id
|
|
|
getOrgId({
|
|
|
pageNo: this.pageNo,
|
|
@@ -226,7 +257,7 @@
|
|
|
const trueArr = []
|
|
|
this.resultOptions.forEach(item => {
|
|
|
trueArr.push({
|
|
|
- id: item.label,
|
|
|
+ id: item.value,
|
|
|
name: item.label
|
|
|
})
|
|
|
})
|
|
@@ -243,7 +274,7 @@
|
|
|
this.detinspectOptions = [...trueArr1]
|
|
|
},
|
|
|
onReady() {
|
|
|
- this.$refs.customForm.setRules(this.customRules);
|
|
|
+ this.$refs.editDeteForm.setRules(this.customRules);
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
@@ -252,9 +283,9 @@
|
|
|
// if (!this.formData.orgName) {
|
|
|
// return this.$modal.msgError('请选择所属单位')
|
|
|
// }
|
|
|
- if (this.formData.drillDate && this.formData.drillDate.indexOf(":") === -1) {
|
|
|
- this.formData.drillDate = this.formData.drillDate + ' 00:00:00'
|
|
|
- }
|
|
|
+ // if (this.formData.drillDate && this.formData.drillDate.indexOf(":") === -1) {
|
|
|
+ // this.formData.drillDate = this.formData.drillDate + ' 00:00:00'
|
|
|
+ // }
|
|
|
this.$refs[ref]
|
|
|
.validate()
|
|
|
.then(res => {
|
|
@@ -265,6 +296,8 @@
|
|
|
// } else {
|
|
|
// this.formData.attId = ''
|
|
|
// }
|
|
|
+ //对提交的数据进行处理
|
|
|
+ this.$set(this.formData, 'detresult', this.formData.detresult.id)
|
|
|
var jsdata = JSON.stringify(this.formData);
|
|
|
console.log(jsdata, 'jsdatajsdatajsdata');
|
|
|
updateFpdDetection(jsdata).then(response => {
|
|
@@ -278,6 +311,9 @@
|
|
|
uni.navigateBack({
|
|
|
delta: 1
|
|
|
})
|
|
|
+ // uni.navigateTo({
|
|
|
+ // url: '/pagesA/fire/fpd_detection/detection_details/detection_details?id='+this.formData.id
|
|
|
+ // })
|
|
|
}, 0);
|
|
|
}).catch(err => {});
|
|
|
})
|
|
@@ -373,21 +409,6 @@
|
|
|
|
|
|
uni.hideKeyboard();
|
|
|
},
|
|
|
- // 记录类型
|
|
|
- sexSelect2(e) {
|
|
|
- this.formData.drillType = e.value;
|
|
|
- this.formData.drillTypeName = e.label;
|
|
|
- console.log(this.formData.drillType);
|
|
|
-
|
|
|
- },
|
|
|
-
|
|
|
- // 单位成立时间
|
|
|
- ActiveUnitTime(e) {
|
|
|
- // this.unitTime = false;
|
|
|
- // console.log(e.value, e.mode);
|
|
|
- // let value = new Date(e.value);
|
|
|
- // // this.formData.drillDate = uni.$u.timeFormat(e.value, 'yyyy-mm-dd hh:MM');
|
|
|
- },
|
|
|
|
|
|
changetime(e) {
|
|
|
console.log('change', e);
|
|
@@ -401,7 +422,12 @@
|
|
|
// 检测维保结果select事件
|
|
|
setResult(e) {
|
|
|
console.log('e', e);
|
|
|
- this.formData.detresult = e.id;
|
|
|
+ // this.formData.detresult.id = e.id;
|
|
|
+ // this.formData.detresult.name = e.name;
|
|
|
+ this.$set(this.formData, 'detresult', {
|
|
|
+ id: e.id,
|
|
|
+ name: e.name
|
|
|
+ })
|
|
|
// this.formData.orgName = e.name;
|
|
|
// console.log(this.formData.orgId);
|
|
|
},
|