Commit 59bcc2bc by 蒋勇

d

parent 1ddef255
...@@ -37,6 +37,12 @@ class CompanyCtl extends CtlBase { ...@@ -37,6 +37,12 @@ class CompanyCtl extends CtlBase {
req.session.tocompany=cmpfind; req.session.tocompany=cmpfind;
return system.getResult(cmpfind.apps); return system.getResult(cmpfind.apps);
} }
async giveupApp(p,q,req){
var comid=p.compid;
var appid=p.appid;
await this.service.giveupApp(comid,appid);
return system.getResult({});
}
//设置当前用户选择的公司为当前公司 //设置当前用户选择的公司为当前公司
async settocompany(p,q,req){ async settocompany(p,q,req){
p.isCurrent=true; p.isCurrent=true;
......
...@@ -77,7 +77,10 @@ class AppDao extends Dao { ...@@ -77,7 +77,10 @@ class AppDao extends Dao {
async findAndCountAll(qobj, t) { async findAndCountAll(qobj, t) {
if(qobj.codepath.indexOf("comapps")>=0){ if(qobj.codepath.indexOf("comapps")>=0){
var rtn={}; var rtn={};
var cas=await this.db.models.companyapp.findAndCountAll({where:{company_id:qobj.tocompanyid}}); var comp=await this.db.models.company.findById(qobj.search.company_id);
var apps=await comp.getApps();
rtn.results={rows:apps,count:apps.length};
rtn.aggresult={};
return rtn; return rtn;
}else{ }else{
return super.findAndCountAll(qobj, t); return super.findAndCountAll(qobj, t);
......
...@@ -34,6 +34,13 @@ class CompanyService extends ServiceBase { ...@@ -34,6 +34,13 @@ class CompanyService extends ServiceBase {
return rtn; return rtn;
}); });
} }
async giveupApp(comid,appid){
return this.db.transaction(async function (t){
//检查当前company_id下面是否有
await this.db.models.companyapp.destroy({where:{company_id:comid,app_id:appid}});
return {};
});
}
async buyApp(p,cmid,user){ async buyApp(p,cmid,user){
var self=this; var self=this;
var appid=p.id; var appid=p.id;
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
return callback(); return callback();
}; };
return { return {
selCompanyid:'',
bizCode:'', bizCode:'',
currow:null, currow:null,
adminExist:false, adminExist:false,
...@@ -46,7 +47,9 @@ ...@@ -46,7 +47,9 @@
} }
}, },
mounted:function(){ mounted:function(){
var cmpid=this.$router.history.current.query.compid;
this.selCompanyid=cmpid;
this.$refs.cgrid.linkInInitQuery("company_id",cmpid);
}, },
created:function(){ created:function(){
if(this.codePath.indexOf("myapps")>=0){ if(this.codePath.indexOf("myapps")>=0){
...@@ -56,7 +59,8 @@ ...@@ -56,7 +59,8 @@
this.bizCode="allapps"; this.bizCode="allapps";
} }
if(this.codePath.indexOf("comapps")>=0){ if(this.codePath.indexOf("comapps")>=0){
this.bizCode="allapps"; this.bizCode="comapps";
} }
}, },
methods:{ methods:{
...@@ -153,6 +157,10 @@ ...@@ -153,6 +157,10 @@
path:"/appconfig" path:"/appconfig"
}); });
} }
if(key=="giveup"){
var d= await this.$root.postReq("/web/common/companyCtl/giveupApp", {compid: this.selCompanyid,appid:row.id});
this.$refs.cgrid.linkInInitQuery("company_id",this.selCompanyid);
}
this.currow=row; this.currow=row;
} }
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
} }
} }
if(key="comapps"){ if(key="comapps"){
this.$router.push("/comapps"); this.$router.push({path:"/comapps",query:{"compid":row.id}});
} }
}, },
onColFormater(row,column,cellvalue,index){ onColFormater(row,column,cellvalue,index){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment