|
@@ -4,9 +4,11 @@
|
|
|
el: "#demand-div",
|
|
el: "#demand-div",
|
|
|
data: {
|
|
data: {
|
|
|
types: [{name:'0',value:'需求'},{name:'1',value:'问题'}],
|
|
types: [{name:'0',value:'需求'},{name:'1',value:'问题'}],
|
|
|
- addDemand: {},
|
|
|
|
|
authorities: [],
|
|
authorities: [],
|
|
|
- authoritiesFilter: [],
|
|
|
|
|
|
|
+ addDemand: {
|
|
|
|
|
+ authority_id:null
|
|
|
|
|
+ },
|
|
|
|
|
+ filterAuthority: null,
|
|
|
demandErrors: {},
|
|
demandErrors: {},
|
|
|
ratio:{
|
|
ratio:{
|
|
|
unClaimCount:null,
|
|
unClaimCount:null,
|
|
@@ -14,43 +16,40 @@
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
created() {
|
|
created() {
|
|
|
- this.authoritiesFilter = JSON.parse(JSON.stringify(this.authorities));
|
|
|
|
|
this.getAuthority();
|
|
this.getAuthority();
|
|
|
this.setUnClaimDemandRatio();
|
|
this.setUnClaimDemandRatio();
|
|
|
$('#demand-div').removeClass('d-none');
|
|
$('#demand-div').removeClass('d-none');
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
},
|
|
},
|
|
|
- methods: {
|
|
|
|
|
- /** 筛选 */
|
|
|
|
|
- filterAuth($e) {
|
|
|
|
|
- let value = $($e.target).val();
|
|
|
|
|
|
|
+ computed: {
|
|
|
|
|
+ authoritiesFilter:function(){
|
|
|
let authorities = JSON.parse(JSON.stringify(this.authorities));
|
|
let authorities = JSON.parse(JSON.stringify(this.authorities));
|
|
|
- if (value === null) {
|
|
|
|
|
- this.authoritiesFilter = authorities;
|
|
|
|
|
- return;
|
|
|
|
|
|
|
+ if (!this.filterAuthority) {
|
|
|
|
|
+ this.$set(this.addDemand,'authority_id',lastAuthority);
|
|
|
|
|
+ return authorities;
|
|
|
}
|
|
}
|
|
|
- this.authoritiesFilter = authorities.filter(function (item) {
|
|
|
|
|
- return item['name'].includes(value);
|
|
|
|
|
|
|
+ let self = this;
|
|
|
|
|
+ let authoritiesFilter = authorities.filter(function(item){
|
|
|
|
|
+ return item['name'].includes(self.filterAuthority);
|
|
|
});
|
|
});
|
|
|
- if(this.authoritiesFilter.length > 0)
|
|
|
|
|
- this.addDemand.authority_id = this.authoritiesFilter[0]['id'];
|
|
|
|
|
|
|
+ if (authoritiesFilter.length >0 && authoritiesFilter.length < authorities.length){
|
|
|
|
|
+ this.addDemand.authority_id =authoritiesFilter[0]['id']
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$forceUpdate()
|
|
|
|
|
+ return authoritiesFilter;
|
|
|
},
|
|
},
|
|
|
|
|
+ },
|
|
|
|
|
+ methods: {
|
|
|
/** 创建 */
|
|
/** 创建 */
|
|
|
showAddDemand() {
|
|
showAddDemand() {
|
|
|
this.addDemand = {};
|
|
this.addDemand = {};
|
|
|
- this.authoritiesFilter = JSON.parse(JSON.stringify(this.authorities));
|
|
|
|
|
$('#add-demand-auth-filter').val('');
|
|
$('#add-demand-auth-filter').val('');
|
|
|
$('#add-demand').modal('show')
|
|
$('#add-demand').modal('show')
|
|
|
- if(this.authoritiesFilter.length === 0){
|
|
|
|
|
- if(this.authorities.length !==0)this.authoritiesFilter = JSON.parse(JSON.stringify(this.authorities));
|
|
|
|
|
- else this.getAuthority();
|
|
|
|
|
- }
|
|
|
|
|
},
|
|
},
|
|
|
/** 创建 */
|
|
/** 创建 */
|
|
|
createDemand() {
|
|
createDemand() {
|
|
|
let url = '{{url('apiLocal/demand/store')}}';
|
|
let url = '{{url('apiLocal/demand/store')}}';
|
|
|
-
|
|
|
|
|
window.tempTip.setIndex(1999);
|
|
window.tempTip.setIndex(1999);
|
|
|
window.tempTip.setDuration(3000);
|
|
window.tempTip.setDuration(3000);
|
|
|
|
|
|
|
@@ -80,7 +79,7 @@
|
|
|
window.axios.get(url).then(res=>{
|
|
window.axios.get(url).then(res=>{
|
|
|
if(res.data.success){
|
|
if(res.data.success){
|
|
|
this.authorities = res.data.data;
|
|
this.authorities = res.data.data;
|
|
|
- this.authoritiesFilter = res.data.data;
|
|
|
|
|
|
|
+ this.filterAuthority = null;
|
|
|
this.$forceUpdate();
|
|
this.$forceUpdate();
|
|
|
}
|
|
}
|
|
|
}).catch(err=>{
|
|
}).catch(err=>{
|