|
|
@@ -69,13 +69,18 @@
|
|
|
currentLogIndex:"",
|
|
|
logStatuses:[],
|
|
|
contractIds:[],
|
|
|
- owners:[],
|
|
|
+ customerOwners:[],
|
|
|
files:[],
|
|
|
- ownerMap:null,
|
|
|
+ owners:[
|
|
|
+ @foreach($owners as $owner)
|
|
|
+ {id:"{{$owner->id}}",name:"{{$owner->name}}",customer_id:"{{$owner->customer_id}}"},
|
|
|
+ @endforeach
|
|
|
+ ],
|
|
|
ownerIds:[],
|
|
|
ownerNames:[],
|
|
|
},
|
|
|
mounted(){
|
|
|
+ this._formatOwner();
|
|
|
$('#container').removeClass('d-none');
|
|
|
this.rendering();
|
|
|
let data=[
|
|
|
@@ -91,32 +96,35 @@
|
|
|
}).init();
|
|
|
},
|
|
|
methods:{
|
|
|
+ _formatOwner(){
|
|
|
+ let ownerIds=[];
|
|
|
+ let ownerNames=[];
|
|
|
+ this.owners.forEach(owner=>{
|
|
|
+ if (owner.customer_id){
|
|
|
+ if (ownerIds[owner.customer_id]){
|
|
|
+ ownerIds[owner.customer_id].push(owner.id);
|
|
|
+ ownerNames[owner.customer_id].push(owner.name);
|
|
|
+ }else{
|
|
|
+ ownerIds[owner.customer_id] = [owner.id];
|
|
|
+ ownerNames[owner.customer_id] = [owner.name];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ this.ownerIds = ownerIds;
|
|
|
+ this.ownerNames = ownerNames;
|
|
|
+ },
|
|
|
relatedOwner(index){
|
|
|
this.index = index;
|
|
|
- this.customers.forEach(customer=>{
|
|
|
- if (!this.ownerIds[customer.id]){
|
|
|
- this.ownerIds[customer.id] = [];
|
|
|
- this.ownerNames[customer.id] = [];
|
|
|
+ let val = this.ownerIds[this.customers[index]['id']];
|
|
|
+ $("#ownerSelectpicker").selectpicker('val',val ? val : []);
|
|
|
+ $("#relatedOwner").modal('show');
|
|
|
+ if (val){
|
|
|
+ let options = document.getElementById("ownerSelectpicker").options;
|
|
|
+ for (let i=0;i<options.length;i++){
|
|
|
+ if (val.indexOf(options[i].value) !== -1)options[i].removeAttribute('disabled');
|
|
|
}
|
|
|
- });
|
|
|
- if (!this.ownerMap){
|
|
|
- let url = "{{url("maintenance/owner/get")}}";
|
|
|
- window.tempTip.postBasicRequest(url,{},(res)=> {
|
|
|
- this.ownerMap = res;
|
|
|
- if (res)res.forEach(owner=>{
|
|
|
- if (this.ownerIds[owner.customer_id]){
|
|
|
- this.ownerIds[owner.customer_id].push(owner.id);
|
|
|
- this.ownerNames[owner.customer_id].push(owner.name);
|
|
|
- }
|
|
|
- });
|
|
|
- console.log(this.ownerMap);
|
|
|
- this.$forceUpdate();
|
|
|
- $("#relatedOwner").modal('show');
|
|
|
- });
|
|
|
}
|
|
|
- setTimeout(function () {
|
|
|
- $("#ownerSelectpicker").selectpicker('render');
|
|
|
- },2000);
|
|
|
+ $("#ownerSelectpicker").selectpicker('refresh')
|
|
|
},
|
|
|
selectFile(){
|
|
|
$("#files").click();
|
|
|
@@ -281,11 +289,11 @@
|
|
|
addContract(index){
|
|
|
this.index = index;
|
|
|
let id = this.customers[index].id;
|
|
|
- if (!this.owners[id]){
|
|
|
+ if (!this.customerOwners[id]){
|
|
|
let url = "{{url("maintenance/owner/get")}}";
|
|
|
let params = {customer_id:id};
|
|
|
window.tempTip.postBasicRequest(url,params,(res)=> {
|
|
|
- this.owners[id] = res;
|
|
|
+ this.customerOwners[id] = res;
|
|
|
this.$forceUpdate();
|
|
|
});
|
|
|
}
|
|
|
@@ -337,7 +345,7 @@
|
|
|
window.tempTip.setDuration(3000);
|
|
|
window.tempTip.show('网络错误:'+err);
|
|
|
});
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
filters:{
|
|
|
size:function (val) {
|