优化代码

This commit is contained in:
java110 2021-04-22 17:57:11 +08:00
parent 9e4f4971b3
commit 38f2d01d8f
2 changed files with 40 additions and 11 deletions

View File

@ -79,7 +79,11 @@
<div class="form-group row">
<label class="col-sm-3 col-form-label padding-lr-sm text-right">甲方</label>
<div class="col-sm-9 padding-lr-xs">
<input v-model="addContractInfo.partyA" type="text" placeholder="必填,请填写甲方" class="form-control">
<select class="custom-select" v-model="addContractInfo.partyA" @change="_changeContractPartyA()">
<option selected disabled value="">必填,请选择甲方</option>
<option v-for="(item,index) in addContractInfo.contractPartyAs" :key="index"
:value="item.partyA">{{item.partyA}}</option>
</select>
</div>
</div>
</div>

View File

@ -36,11 +36,13 @@
objPersonId: '',
rooms: [],
contractFilePo: [],
tempfile: ''
tempfile: '',
contractPartyAs: []
}
},
_initMethod: function () {
$that._loadAddContractType();
$that._loadAddContractParkA();
if (vc.getParam("contractId")) {
$that.addContractInfo.contractParentId = vc.getParam("contractId");
@ -261,12 +263,6 @@
return;
}
vc.component.addContractInfo.communityId = vc.getCurrentCommunity().communityId;
//不提交数据将数据 回调给侦听处理
if (vc.notNull($props.callBackListener)) {
vc.emit($props.callBackListener, $props.callBackFunction, vc.component.addContractInfo);
$('#addContractModel').modal('hide');
return;
}
vc.http.apiPost(
'/contract/saveContract',
@ -329,6 +325,7 @@
objPersonName: '',
objPersonId: '',
rooms: [],
contractPartyAs: [],
objType: '1111'
};
@ -351,6 +348,24 @@
}
);
},
_loadAddContractParkA: function () {
let param = {
params: {
page: 1,
row: 100
}
}
//发送get请求
vc.http.apiGet('/contractPartya/queryContractPartya',
param,
function (json, res) {
var _contractTypeManageInfo = JSON.parse(json);
vc.component.addContractInfo.contractPartyAs = _contractTypeManageInfo.data;
}, function (errInfo, error) {
console.log('请求失败处理');
}
);
},
_changeContractType: function () {
let param = {
params: {
@ -391,7 +406,7 @@
_tmpRooms.push(item);
}
});
$that.addContractInfo.rooms = _tmpRooms;
$that.addContractInfo.rooms = _tmpRooms;
},
addFileStep: function () {
let _file = {
@ -411,7 +426,7 @@
}
}
},
getFile: function (e,index) {
getFile: function (e, index) {
vc.component.addContractInfo.tempfile = e.target.files[0];
$that.addContractInfo.contractFilePo[index].fileRealName = vc.component.addContractInfo.tempfile.name;
this._importData(index);
@ -451,13 +466,23 @@
});
},
checkFileType: function (fileType) {
const acceptTypes = ['png','pdf','jpg'];
const acceptTypes = ['png', 'pdf', 'jpg'];
for (var i = 0; i < acceptTypes.length; i++) {
if (fileType === acceptTypes[i]) {
return true;
}
}
return false;
},
_changeContractPartyA:function(){
let _partyA = $that.addContractInfo.partyA;
$that.addContractInfo.contractPartyAs.forEach(item=>{
if(_partyA == item.partyA){
$that.addContractInfo.aLink = item.aLink;
$that.addContractInfo.aContacts = item.aContacts;
}
})
}
}
});