|
@@ -16,9 +16,9 @@ class AddminiFans extends Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
this.state = {
|
|
|
- type : '1',
|
|
|
+ type : '0',
|
|
|
mode : '',
|
|
|
- editType : '1',
|
|
|
+ editType : '0', //编辑框默认的窗口索引
|
|
|
//编辑模态框
|
|
|
editVisiable: false,
|
|
|
editConfirmLoading: false,
|
|
@@ -82,38 +82,45 @@ class AddminiFans extends Component {
|
|
|
|
|
|
|
|
|
let form ;
|
|
|
+
|
|
|
+
|
|
|
if('0' == this.state.mode ){
|
|
|
//新增
|
|
|
- if(add_type == '1'){
|
|
|
+ if(add_type == '0'){//公众号
|
|
|
form =this.refs.autoForm1
|
|
|
- }else if(add_type == '2'){
|
|
|
+ }else if(add_type == '2'){ //小程序
|
|
|
form =this.refs.autoForm2
|
|
|
- }else if(add_type == '3'){
|
|
|
+ }else if(add_type == '1'){ // 企业微信
|
|
|
form =this.refs.autoForm3
|
|
|
}
|
|
|
- if(add_type == '1'){ // 公众号新增配置增加默认添加方式为 0:参数配置
|
|
|
- dto['addWay'] = '0';
|
|
|
- }
|
|
|
+
|
|
|
}else if('1' == this.state.mode){
|
|
|
//编辑
|
|
|
- if(edit_type == '1'){
|
|
|
+ if(edit_type == '0'){
|
|
|
form =this.refs.autoForm4
|
|
|
}else if(edit_type == '2'){
|
|
|
form =this.refs.autoForm5
|
|
|
- }else if(edit_type == '3'){
|
|
|
+ }else if(edit_type == '1'){
|
|
|
form =this.refs.autoForm6
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
-
|
|
|
if (!form.validate()) return;
|
|
|
|
|
|
let dto = form.state.initValue;
|
|
|
+
|
|
|
if('0' == this.state.mode ){
|
|
|
dto['type'] = add_type; //根据当前所处页面添加公众号...
|
|
|
+ if(add_type == '0'){ // 公众号新增配置增加默认添加方式为 0:参数配置
|
|
|
+ dto['addWay'] = '0';
|
|
|
+ }
|
|
|
}else if('1' == this.state.mode){
|
|
|
dto['type'] = edit_type; //根据当前所处页面添加公众号...
|
|
|
+ if(edit_type == '0'){ // 公众号新增配置增加默认添加方式为 0:参数配置
|
|
|
+ dto['addWay'] = '0';
|
|
|
+ }
|
|
|
}
|
|
|
- console.log(form.state.extraParams)
|
|
|
+
|
|
|
let extraParams = form.state.extraParams;
|
|
|
for (let extra of extraParams) {
|
|
|
dto[extra.field] = extra.value;
|
|
@@ -123,7 +130,8 @@ class AddminiFans extends Component {
|
|
|
method: "post",
|
|
|
data: dto
|
|
|
}).then(function(result) {
|
|
|
- if (result.success) {
|
|
|
+ console.log(result)
|
|
|
+ if (result.success === 1) {
|
|
|
message.success("保存成功");
|
|
|
} else {
|
|
|
if (result.message) {
|
|
@@ -135,10 +143,13 @@ class AddminiFans extends Component {
|
|
|
if (callback) callback(result);
|
|
|
self.setState({
|
|
|
formVisiable: false,
|
|
|
- formConfirmLoading: false
|
|
|
+ formConfirmLoading: false,
|
|
|
+ editVisiable: false,
|
|
|
+ editConfirmLoading: false
|
|
|
});
|
|
|
//self.refs.tg.getGrid().reload();
|
|
|
- //self.refs.gridOptionResource.reload;
|
|
|
+ //self.refs.gridOptionResource.reload();
|
|
|
+ self.refs.gridResource.reload();
|
|
|
});
|
|
|
}
|
|
|
render() {
|
|
@@ -213,8 +224,8 @@ class AddminiFans extends Component {
|
|
|
name: '编辑',
|
|
|
onClick: (data) => {
|
|
|
this.changeEdit(data)
|
|
|
-
|
|
|
- const fields = [{ title: "端口名称", data: "portName" ,type: "text", editor: { tips: "填写一个方便记忆的名称,以免公众号/企业微信等同名" },query: true},
|
|
|
+ console.log(data)
|
|
|
+ const fields = [{ title: "端口名称", data: "portName", key:"portName" ,type: "text", editor: { tips: "填写一个方便记忆的名称,以免公众号/企业微信等同名" },query: true},
|
|
|
{ title: "公众号图标",data: "headImg", type: "img", editor: { tips: "请上传1:1尺寸的图标" }, query: true },
|
|
|
{ title: "公众号名称",data: "name", type: "text", editor: { tips: "微信公众号名称"}, query: true},
|
|
|
{ title: "AppID", data: "appId", type: "text", editor: { tips: "微信公众号AppID" }, query: true },
|
|
@@ -231,15 +242,17 @@ class AddminiFans extends Component {
|
|
|
{ title: "通讯录同步",data: "text9",type: "text", editor: {tips: "企业微信后台,“管理工具-通讯录同步”中获取"},query: true},
|
|
|
{ title: "客户信息查询",data: "text10",type: "text",editor: { tips: "企业微信后台,“应用管理-自建-客户信息查询”中获取" }, query: true }
|
|
|
];
|
|
|
- let formOption4 = { model: "update",title: "添加端口", fields: fields, value: data, extraParams: [] };
|
|
|
+ let formOption4 = { model: "update",title: "添加端口", fields: fields, value: data, extraParams: [], sourceData:data };
|
|
|
let formOption5 = { model: "update", title: "基础设置", fields: fields2, value: {}, extraParams: [] };
|
|
|
let formOption6 = { model: "update", title: "基础设置", fields: fields3, value: {}, extraParams: [] };
|
|
|
+
|
|
|
self.setState({
|
|
|
editVisiable: true,
|
|
|
formOption4: formOption4,
|
|
|
formOption5: formOption5,
|
|
|
formOption6: formOption6,
|
|
|
- mode: '1'
|
|
|
+ mode: '1',
|
|
|
+ editType : data.type
|
|
|
});
|
|
|
|
|
|
// 查询请求
|
|
@@ -294,18 +307,20 @@ class AddminiFans extends Component {
|
|
|
onCancel={() => this.cancelClick()}
|
|
|
confirmLoading={this.state.formConfirmLoading}
|
|
|
>
|
|
|
- <Tabs ActiveKey="1" activeKey={self.state.type} onChange={(key)=>{
|
|
|
+ <Tabs ActiveKey="0" activeKey={self.state.type} onChange={(key)=>{
|
|
|
this.setState({ type: key });
|
|
|
}}>
|
|
|
- <TabPane tab="公众号" key="1">
|
|
|
+
|
|
|
+ <TabPane tab="公众号" key="0">
|
|
|
<AutoForm formOption={this.state.formOption} ref="autoForm1" />
|
|
|
</TabPane>
|
|
|
- <TabPane tab="小程序" key="2">
|
|
|
+ {/* <TabPane tab="小程序" key="2">
|
|
|
<AutoForm formOption={this.state.formOption2} ref="autoForm2" />
|
|
|
</TabPane>
|
|
|
- <TabPane tab="企业微信" key="3">
|
|
|
+ <TabPane tab="企业微信" key="1">
|
|
|
<AutoForm formOption={this.state.formOption3} ref="autoForm3" />
|
|
|
</TabPane>
|
|
|
+ */}
|
|
|
</Tabs>
|
|
|
</Modal>
|
|
|
<Modal
|
|
@@ -315,18 +330,20 @@ class AddminiFans extends Component {
|
|
|
onOk={() => this.saveClick()}
|
|
|
onCancel={() => this.editCancelClick()}
|
|
|
>
|
|
|
- <Tabs ActiveKey="1" activeKey={self.state.type} onChange={(key)=>{
|
|
|
- this.setState({ type: key });
|
|
|
+ <Tabs activeKey={self.state.editType} onChange={(key)=>{
|
|
|
+ this.setState({ editType: key });
|
|
|
}}>
|
|
|
- <TabPane tab="公众号" key="1">
|
|
|
+ <TabPane tab="公众号" key="0">
|
|
|
<AutoForm formOption={this.state.formOption4} ref="autoForm4" />
|
|
|
</TabPane>
|
|
|
+ {/*
|
|
|
<TabPane tab="小程序" key="2">
|
|
|
<AutoForm formOption={this.state.formOption5} ref="autoForm5" />
|
|
|
</TabPane>
|
|
|
- <TabPane tab="企业微信" key="3">
|
|
|
+ <TabPane tab="企业微信" key="1">
|
|
|
<AutoForm formOption={this.state.formOption6} ref="autoForm6" />
|
|
|
</TabPane>
|
|
|
+ */}
|
|
|
</Tabs>
|
|
|
</Modal>
|
|
|
</div>
|