Commit ff8fe6c3 by DESKTOP-7Q3CA17\86137

gsb

parent 4dabc033
var system = require("../../system")
var settings = require("../../../config/settings");
const CtlBase = require("../ctl.base");
const uuidv4 = require('uuid/v4');
const moment = require("moment");
class EcompanybusiCtl extends CtlBase {
constructor() {
super(CtlBase.getServiceName(EcompanybusiCtl));
this.regionareaSve = system.getObject("service.regionareaSve");
this.userSve = system.getObject("service.userSve");
this.epartnerSve = system.getObject("service.epartnerSve");
this.ejobSve = system.getObject("service.ejobSve")
this.ecompanyeventSve = system.getObject("service.ecompanyeventSve");
this.eintentionSve = system.getObject("service.eintentionSve");
this.etemplateSve = system.getObject("service.etemplateSve");
this.ecompanybpoSve = system.getObject("service.ecompanybpoSve");
this.esettleSve = system.getObject("service.esettleSve");
}
async mysave(queryobj, qobj, req) {
try {
var old = null;
if (qobj.id) {
old = await this.service.findById(qobj.id);
}
var rtn = null;
if (old) { //修改
rtn = await this.service.update(qobj);
} else { //新增
rtn = await this.service.create(qobj);
}
// 调用e签宝接口生成accountid
return system.getResult2(rtn, null);
} catch (e) {
console.log(e);
return {
code: -1
}
}
}
async allList(queryobj, qobj, req) {
var params = qobj.search;
try {
var page = await this.service.allList(params);
return system.getResult2(page);
} catch (e) {
console.log(e);
return system.getErrResult2("您的网络不稳, 请稍后重试");
}
}
async info(queryobj, qobj, req) {
var id = qobj.id;
try {
var info = await this.service.findById(id);
return system.getResult2(info);
} catch (e) {
console.log(e);
return system.getErrResult2("您的网络不稳, 请稍后重试");
}
}
}
module.exports = EcompanybusiCtl;
......@@ -915,6 +915,14 @@ module.exports = {
"bizConfig": null,
"path": ""
},
{
"code": "zc_ecompanybusi",
"label": "签约配置",
"isMenu": true,
"bizCode": "ecompanybusi",
"bizConfig": null,
"path": ""
},
],
},
......@@ -1550,6 +1558,7 @@ module.exports = {
"ecompany": {"title": "合同企业", "config": null, "path": "/etemplatemanager/do", "comname": "ecompanymanager"},
"econtract": {"title": "合同列表", "config": null, "path": "/econtractmanager/do", "comname": "econtractmanager"},
"econtractall": {"title": "合同列表", "config": null, "path": "/econtractall", "comname": "econtractall"},
"ecompanybusi": {"title": "合同列表", "config": null, "path": "/ecompanybusi", "comname": "ecompanybusi"},
"econtractmy": {"title": "合同列表", "config": null, "path": "/econtractmy", "comname": "econtractmy"},
"etemplate": {"title": "模板管理", "config": null, "path": "/etemplatemanager/etemplate", "comname": "etemplatemanager"},
......
module.exports={
"bizName":"ecompanybusi",
"list":{
columnMetaData:[
]
},
"form":[
],
"search":[
],
"auth":{
"add":[
],
"edit":[
],
"delete":[
// {"icon":"el-icon-remove","title":"删除","type":"default","key":"delete","isInRow":true},
],
"common":[
],
}
}
const system = require("../../system");
const settings = require("../../../config/settings");
const uiconfig = system.getUiConfig2(settings.wxconfig.appId);
const uiconfig = system.getUiConfig2(settings.wxconfig.appId);
module.exports = (db, DataTypes) => {
return db.define("ecompanybusi", {
ecompany_id: DataTypes.INTEGER,
etemplate_id: DataTypes.INTEGER,
appId: DataTypes.STRING(64),
mainId: DataTypes.STRING(64),
mchtId: DataTypes.STRING(64),
......@@ -51,4 +52,4 @@ module.exports = (db, DataTypes) => {
// }
]
});
}
\ No newline at end of file
}
const system = require("../../system");
const ServiceBase = require("../sve.base");
const moment = require("moment");
class EcompanybusiService extends ServiceBase {
constructor() {
super(ServiceBase.getDaoName(EcompanybusiService));
}
constructor() {
super(ServiceBase.getDaoName(EcompanybusiService));
}
async allList(params) {
var currentPage = Number(params.currentPage || 0);
var pageSize = Number(params.pageSize || 10);
var where = {};
if (params.appId) {
where.appId = {
[this.db.Op.eq]: params.appId
};
}
var orderby = [
["id", 'desc']
];
var page = await this.getPageList(currentPage, pageSize, where, orderby);
if (page && page.rows) {
for (var row of page.rows) {
this.handleDate(row, ["created_at"]);
}
}
return page;
}
}
module.exports = EcompanybusiService;
\ No newline at end of file
module.exports = EcompanybusiService;
<gsb-pcpage>
<style>
::el-radio-button__inner {
border-color: #D9D9D9;
}
</style>
<div style="padding:20px;">
<div style="height: auto;min-width: 1000px; max-width: 1500px;">
<el-card style="background-color: #FFFFFF;padding:10px 10px 30px 10px;margin-top: 20px;">
<div style="width:100%;line-height: 40px;">
<div style="float:left;width: 300px;">
<span style="color:2F2F2F;font-size: 14px;" >appId: </span>
<el-input v-model="search.appId" placeholder="请输入appId" maxlength="100" clearable style="max-width:200px;height: 36px;" ></el-input>
</div>
<div style="float:left;margin-top:5px;">
<el-button @click="resetSearch()" style="float:right;width:68px;height:36px;background-color: #54C4A7;color: #FFFFFF;font-size: 14px;padding-top:10px;" >重置</el-button>
<el-button @click="opSearch" style="float:right;width:68px;height:36px;background-color: #54C4A7;color: #FFFFFF;font-size: 14px;padding-top:10px;margin-right: 10px;" >搜索</el-button>
</div>
</div>
</el-card>
<el-card style="background-color: #FFFFFF;padding:10px 10px 30px 10px;margin-top: 20px;">
<div>
<div style="line-height: 36px;padding-bottom: 20px;">
<span style="float:left;color:#2F2F2F;font-size: 14px;">共{{search.total}}条记录</span>
<el-button @click="openEdit()" style="float:right;width:100px;height:36px;color: #FFFFFF;font-weight: 400;border-radius: 4px;font-size: 14px;background-color: #59C1A6;padding-top:11px">新增配置</el-button>
</div>
<div>
<el-table
stripe
fix="true"
:data="search.list"
tooltip-effect="light"
style="min-width: 1000px;max-width: 1500px;margin-top: 23px;min-height: 500px;"
empty-text="暂无需求"
header-cell-style="background-color: #F5F5F5;color: #2F2F2F;font-size: 14px;font-weight:400;"
row-style="height:50px;" >
<el-table-column prop="id" label="序号" :formatter="onColFormater" width="80" align="center" ></el-table-column>
<el-table-column prop="ecompany_id" label="企业ID" :formatter="onColFormater" align="center" ></el-table-column>
<el-table-column prop="etemplate_id" label="模板ID" :formatter="onColFormater" align="center" ></el-table-column>
<el-table-column prop="mchtId" label="mchtId" :formatter="onColFormater" align="center" ></el-table-column>
<el-table-column prop="mainId" label="mainId" :formatter="onColFormater" align="center" ></el-table-column>
<el-table-column prop="appId" label="appId" :formatter="onColFormater" align="center" ></el-table-column>
<el-table-column prop="key" label="secret" :formatter="onColFormater" align="center" ></el-table-column>
<!-- <el-table-column prop="created_at" label="创建日期" :formatter="onColFormater" align="center" ></el-table-column>-->
<el-table-column label="操作" align="center" >
<template slot-scope="scope">
<a href="javascript:;" @click="openEdit(scope.row.id)" style="text-decoration: none;color:#59C1A6;font-size: 14px;">修改</a>
</template>
</el-table-column>
</el-table>
<div style="width:100%;text-align: center;margin-top: 20px">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:current-page="search.currentPage"
:page-sizes="[10, 20, 50, 100]"
:page-size="search.pageSize"
layout="total, sizes, prev, pager, next, jumper"
:total="search.total">
</el-pagination>
</div>
</div>
</div>
</el-card>
<el-dialog width="862px" :visible.sync="showEdit">
<div slot="title">
<span style="margin-left:9px;margin-top:-3px;;width:72px; height:25px; font-size:18px; font-family:PingFangSC-Regular; font-weight:400; color:rgba(51,51,51,1); line-height:25px;">{{editTitle}}企业</span>
<div style="width: 862px; height: 1px;background-color: #E3E3E3;margin: 17px 20px 0px -20px"></div>
</div>
<el-form :model="ecompanybusi" :rules="rules" ref="ecompanybusi" label-width="100px" label="right" style="padding:0px 100px;" >
<div style="0px 10px; line-height: 15px;padding-bottom:40px;">
<div style="width:2px;height:15px;float: left;background-color: #54C4A7">
</div>
<span style="font-size:15px;color: #333333;float: left;font-weight:bold;margin-left: 7px;">配置信息</span>
</div>
<el-form-item label="企业ID:" prop="ecompany_id" >
<el-input v-model="ecompanybusi.ecompany_id" placeholder="请输入企业ID" maxlength="100" style="width:468px;" clearable ></el-input>
</el-form-item>
<el-form-item label="模板ID:" prop="etemplate_id" >
<el-input v-model="ecompanybusi.etemplate_id" placeholder="请输入模板ID" maxlength="100" style="width:468px;" clearable ></el-input>
</el-form-item>
<el-form-item label="mchtId:" prop="mchtId" >
<el-input v-model="ecompanybusi.mchtId" placeholder="请输入mchtId" maxlength="100" style="width:468px;" clearable ></el-input>
</el-form-item>
<el-form-item label="mainId:" prop="mainId" >
<el-input v-model="ecompanybusi.mainId" placeholder="请输入mainId" maxlength="100" style="width:468px;" clearable ></el-input>
</el-form-item>
<el-form-item label="appId:" prop="appId" >
<el-input v-model="ecompanybusi.appId" placeholder="请输入appId" maxlength="100" style="width:468px;" clearable ></el-input>
</el-form-item>
<el-form-item label="secret:" prop="key" >
<el-input v-model="ecompanybusi.key" placeholder="请输入密钥" maxlength="100" style="width:468px;" clearable ></el-input>
</el-form-item>
</el-form>
<div style="margin-left: 200px;">
<el-button :loading="saveLoading" @click="saveCompany" style="width:120px;height:36px; background:#54C4A7; border-radius:4px;color: #FFFFFF;font-size: 16px;padding-top: 10px;">保存</el-button>
</div>
</el-dialog>
</div>
</gsb-pcpage>
{
template: '${tmpl}',
data: function () {
var validMethod = (rule, value, callback) => {
return this.validfileds(rule, value, callback);
};
return {
ecompanybusi: {isEnabled:true},
editTitle: "新增",
showEdit: false,
saveLoading: false,
ownerList:[],
ownerMap:[],
ownerLoading:false,
owner_id: "",
search: {
list: [],
currentPage: 1,
pageSize: 20,
total : 0,
name:'',
},
rules: {
ecompany_id : [
{ required: true, message: '请输入企业ID', trigger: 'blur' },
{ validator: validMethod, trigger: 'blur' }
],
etemplate_id : [
{ required: true, message: '请输入模板ID', trigger: 'blur' },
{ validator: validMethod, trigger: 'blur' }
],
mchtId : [
{ required: true, message: '请输入mchtId', trigger: 'blur' },
{ validator: validMethod, trigger: 'blur' }
],
appId : [
{ required: true, message: '请输入appId', trigger: 'blur' },
{ validator: validMethod, trigger: 'blur' }
],
key : [
{ required: true, message: '请输入密钥', trigger: 'blur' },
{ validator: validMethod, trigger: 'blur' }
],
a : [],
},
}
},
mounted: function () {
this.resetSearch(true);
},
created: function () {},
methods: {
getEmptySearch() {
return {
list: [],
currentPage: 1,
pageSize: 20,
total : 0,
name:'',
}
},
resetSearch() {
this.search = this.getEmptySearch();
this.getList();
},
tableHeaderColor({ row, column, rowIndex, columnIndex }) {
if (rowIndex === 0) {
return 'background-color: #F5F5F5;color: #2F2F2F;font-size: 14px;font-weight:400;'
}
},
opSearch() {
this.search.currentPage = 1;
this.search.total = 0;
this.getList();
},
getList() {
var self = this;
var params = this.getParams();
this.$root.postReq("/web/ecompanybusiCtl/allList", {
search: params
}).then(function (d) {
if (d.status == 0) {
self.search.list = d.data.rows || [];
self.search.total = d.data.count || 0;
} else {
}
});
},
getParams() {
var params = {};
for(var f in this.search) {
if(f == "list") {
continue;
}
params[f] = this.search[f];
}
return params;
},
onColFormater(row, column, cellValue, index) {
return cellValue || "---";
},
getEcompany(id) {
var self = this;
self.$root.postReq("/web/ecompanybusiCtl/info", {
id: id,
}).then(function (d) {
if (d.status == 0) {
self.ecompanybusi = d.data;
} else {
self.$message.warning(d.msg || `您的网络不稳定, 请稍后重试`);
}
});
},
toDetail(id) {
},
openEdit(id) {
this.ownerLoading = false;
this.saveLoading = false;
this.owner_id = null;
if(this.$refs.ecompanybusi) {
this.$refs.ecompanybusi.resetFields();
}
if(id) {
this.getEcompany(id);
this.editTitle = "修改";
} else {
this.ownerList = [];
this.editTitle = "新增";
this.ecompanybusi = {isEnabled:true};
}
this.showEdit = true;
},
handleSizeChange(val) {
this.search.pageSize = val;
this.resetSearch();
},
handleCurrentChange(val) {
this.search.currentPage = val;
this.getList();
},
validfileds(rule, value, callback) {
var self = this;
if(rule.field == 'name') {
if(!self.ecompanybusi.name) {
return callback(new Error("请输入企业名称"));
}
self.$root.postReq("/web/ecompanyCtl/validName", self.ecompanybusi).then(function (d) {
if (d.status == 0) {
return callback();
} else {
return callback(new Error(d.msg));
}
});
} else if(rule.field == 'owner_id') {
if(!self.ecompanybusi.owner_id) {
return callback(new Error("请选择归属人员"));
} else {
return callback();
}
} else {
return callback();
}
},
ownerChange(val) {
console.log(val, );
this.ecompanybusi.owner_id = val || 0;
this.owner = this.ownerMap["id_" + val];
console.log(this.owner);
},
getOwnerList(query) {
var self = this;
self.ownerLoading = true;
self.$root.postReq("/web/userCtl/rolesSuggest", {
name: query,
roleCodes: ["zczy", "zcgl", "qdzy", "qdgl", "ptzy", "ptgl", "dkhzy", "dkhgl", "ziying", "tzgl", "tzzy"]
}).then(function (d) {
self.ownerLoading = false;
self.ownerList = d.data || [];
self.ownerMap = [];
for (var o of self.ownerList) {
self.ownerMap["id_" + o.id] = o;
}
});
setTimeout(() => {
self.ownerLoading = false;
}, 15000);
},
saveCompany() {
var self = this;
self.saveLoading = true;
self.$refs.ecompanybusi.validate((valid) => {
if (valid) {
self.$root.postReq("/web/ecompanybusiCtl/mysave", self.ecompanybusi).then(function (d) {
if (d.status == 0) {
self.$message.success(`保存成功`);
self.showEdit = false;
self.getList();
} else {
self.$alert(d.msg || '保存失败', '提示', {
confirmButtonText: '确定',
callback: action => {}
});
}
self.saveLoading = false;
});
} else {
self.saveLoading = false;
return false;
}
});
setTimeout(() => {
self.saveLoading = false;
}, 5000);
},
},
vname: "gsb-ecompanybusi"
}
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