公司编辑页面优化
This commit is contained in:
parent
6691ce8f71
commit
1eb2c5afff
|
|
@ -1,5 +1,6 @@
|
||||||
import modal from './libs/function/modal'
|
import modal from './libs/function/modal'
|
||||||
import apis from './libs/function/apis'
|
import apis from './libs/function/apis'
|
||||||
|
import form from './libs/function/form'
|
||||||
import config from './config'
|
import config from './config'
|
||||||
import dialog from './components/dialog'
|
import dialog from './components/dialog'
|
||||||
|
|
||||||
|
|
@ -10,6 +11,8 @@ var mk = {
|
||||||
|
|
||||||
...apis,
|
...apis,
|
||||||
|
|
||||||
|
...form,
|
||||||
|
|
||||||
config: config,
|
config: config,
|
||||||
|
|
||||||
dialog: dialog,
|
dialog: dialog,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,44 @@
|
||||||
|
|
||||||
|
export default {
|
||||||
|
|
||||||
|
formatFormData: function ({ data, rules }) {
|
||||||
|
|
||||||
|
rules.forEach(rule => {
|
||||||
|
if (rule.field in data) {
|
||||||
|
let value = data[rule.field];
|
||||||
|
if (rule.dataRule && rule.dataRule.type == "integer") {
|
||||||
|
data[rule.field] = parseInt(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
validateForm : function ({ form }) {
|
||||||
|
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
form.validate(a => {
|
||||||
|
let count = 0;
|
||||||
|
if (a) {
|
||||||
|
for (let name in a) {
|
||||||
|
a[name];
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count > 0) {
|
||||||
|
reject(count);
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -14,26 +14,26 @@
|
||||||
</template>
|
</template>
|
||||||
<template #beid="{ data }">
|
<template #beid="{ data }">
|
||||||
<a-select v-model="data.beid" style="width: 100%">
|
<a-select v-model="data.beid" style="width: 100%">
|
||||||
<a-select-option v-for=" item in config_list" :key="item.id" :value="item.id">
|
<a-select-option v-for=" item in config_list" :key="item.id" :value="item.id">
|
||||||
{{ item.title }}
|
{{ item.title }}
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</a-select>
|
</a-select>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</vxe-form>
|
</vxe-form>
|
||||||
|
|
||||||
<div class="mk-toolbar" v-if="isEdit">
|
<div class="mk-toolbar" v-if="isEdit">
|
||||||
<a-button type="primary" @click="pageAdd">增加服务</a-button>
|
<a-button type="primary" @click="pageAdd">增加服务</a-button>
|
||||||
<a-button @click="pageDel">删除服务</a-button>
|
<a-button @click="pageDel">删除服务</a-button>
|
||||||
</div>
|
</div>
|
||||||
<div class="gridPanel" v-if="isEdit">
|
<div class="gridPanel" v-if="isEdit">
|
||||||
<vxe-grid ref='gridService' v-bind="gridServiceOptions">
|
<vxe-grid ref='gridService' v-bind="gridServiceOptions">
|
||||||
<template #status="{ row }">
|
<template #status="{ row }">
|
||||||
<a-switch :checked="row.status ? true : false" @change="onSwitch(row, 'status')" />
|
<a-switch :checked="row.status ? true : false" @change="onSwitch(row, 'status')" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
</vxe-grid>
|
</vxe-grid>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="footerbar">
|
<div class="footerbar">
|
||||||
|
|
@ -74,7 +74,7 @@ export default {
|
||||||
|
|
||||||
companyTypeData: ['日用陶瓷厂', '卫浴工厂', '公司企业', '贸易公司', '其他'],
|
companyTypeData: ['日用陶瓷厂', '卫浴工厂', '公司企业', '贸易公司', '其他'],
|
||||||
config_list: [],
|
config_list: [],
|
||||||
currentBeid : 0,
|
currentBeid: 0,
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
create: `${BASE_URL.BASE_URL}/BaseCompany/v1/create`,
|
create: `${BASE_URL.BASE_URL}/BaseCompany/v1/create`,
|
||||||
|
|
@ -91,33 +91,33 @@ export default {
|
||||||
keyName: 'id',
|
keyName: 'id',
|
||||||
isEdit: false,
|
isEdit: false,
|
||||||
formOptions: {
|
formOptions: {
|
||||||
data: {
|
data: {
|
||||||
"beid": 0,
|
"beid": 0,
|
||||||
"ptyid": 0,
|
"ptyid": 0,
|
||||||
"title": "",
|
"title": "",
|
||||||
"agentid": 0,
|
"agentid": 0,
|
||||||
"logo": "",
|
"logo": "",
|
||||||
"desc": "",
|
"desc": "",
|
||||||
"domain": "",
|
"domain": "",
|
||||||
"devdomain": "",
|
"devdomain": "",
|
||||||
"company_type": "日用陶瓷厂",
|
"company_type": "日用陶瓷厂",
|
||||||
"address": "",
|
"address": "",
|
||||||
"longitude": "",
|
"longitude": "",
|
||||||
"latitude": "",
|
"latitude": "",
|
||||||
"appid": "",
|
"appid": "",
|
||||||
"appsecret": "",
|
"appsecret": "",
|
||||||
"is_private_cloud": 0,
|
"is_private_cloud": 0,
|
||||||
"auth_stop_date": 0,
|
"auth_stop_date": 0,
|
||||||
"status": 1,
|
"status": 1,
|
||||||
"short_title": "",
|
"short_title": "",
|
||||||
"token": "",
|
"token": "",
|
||||||
"name": "",
|
"name": "",
|
||||||
"mobile": "",
|
"mobile": "",
|
||||||
"password": "",
|
"password": "",
|
||||||
"email": "",
|
"email": "",
|
||||||
"admin_count": 0,
|
"admin_count": 0,
|
||||||
"staff_count": 0,
|
"staff_count": 0,
|
||||||
"store_count": 0
|
"store_count": 0
|
||||||
},
|
},
|
||||||
|
|
||||||
titleWidth: 100,
|
titleWidth: 100,
|
||||||
|
|
@ -145,26 +145,21 @@ export default {
|
||||||
},
|
},
|
||||||
|
|
||||||
items: [
|
items: [
|
||||||
{
|
{ field: 'title', title: '公司名', span: 12, itemRender: { name: '$input', props: { placeholder: '请输入公司名' } } },
|
||||||
title: '左侧',
|
{ field: 'short_title', title: '公司简称', span: 12, itemRender: { name: '$input', props: { placeholder: '请输入公司简称' } } },
|
||||||
children: [
|
{ field: 'desc', title: '描述', span: 24, itemRender: { name: '$textarea', props: { placeholder: '请输入描述' } } },
|
||||||
{ field: 'title', title: '公司名', span: 12, itemRender: { name: '$input', props: { placeholder: '请输入公司名' } } },
|
{ field: 'logo', title: 'Logo', span: 24, itemRender: { name: '$input', props: { placeholder: '请输入LOGO' } } },
|
||||||
{ field: 'short_title', title: '公司简称', span: 8, itemRender: { name: '$input', props: { placeholder: '请输入公司简称' } } },
|
{ field: 'domain', title: '域名', span: 12, itemRender: { name: '$input' } },
|
||||||
{ field: 'desc', title: '描述', span: 16, itemRender: { name: '$textarea', props: { placeholder: '请输入描述' } } },
|
{ field: 'devdomain', title: '测试域名', span: 12, itemRender: { name: '$input' } },
|
||||||
{ field: 'logo', title: 'Logo', span: 16, itemRender: { name: '$input', props: { placeholder: '请输入LOGO' } } },
|
{ field: 'beid', title: '归属项目', span: 12, slots: { default: 'beid' } },
|
||||||
{ field: 'domain', title: '域名', span: 10, itemRender: { name: '$input' } },
|
{ field: 'company_type', title: '公司类型', span: 12, slots: { default: 'company_type' } },
|
||||||
{ field: 'devdomain', title: '测试域名', span: 10, itemRender: { name: '$input' } },
|
{ field: 'appid', title: 'AppID', span: 24, itemRender: { name: '$input' } },
|
||||||
{ field: 'beid',title: '归属项目', span: 6, slots: { default: 'beid' } },
|
{ field: 'appsecret', title: 'AppSecret', span: 24, itemRender: { name: '$input' } },
|
||||||
{ field: 'company_type',title: '公司类型', span: 6, slots: { default: 'company_type' } },
|
{ field: 'token', title: '企业Token', span: 24, itemRender: { name: '$textarea', props: { placeholder: '不用填写' } } },
|
||||||
{ field: 'appid', title: 'AppID', span: 20, itemRender: { name: '$input' } },
|
{ field: 'mobile', dataRule: { type: "integer" }, title: '管理员手机', span: 12, itemRender: { name: '$input', props: { placeholder: '请输入管理员手机号' } } },
|
||||||
{ field: 'appsecret', title: 'AppSecret', span: 20, itemRender: { name: '$input' } },
|
{ field: 'password', title: '管理员密码', span: 12, itemRender: { name: '$input', props: {type:"password", placeholder: '请输入管理员密码' } } },
|
||||||
{ field: 'token', title: '企业Token', span: 20, itemRender: { name: '$textarea' , props: { placeholder: '不用填写' }} },
|
{ field: 'name', title: '管理员名称', span: 12, itemRender: { name: '$input', props: { placeholder: '请输入管理员名称' } } },
|
||||||
{ field: 'mobile', title: '管理员手机', span: 10, itemRender: { name: '$input', props: { placeholder: '请输入管理员手机号' } } },
|
{ field: 'email', title: '管理员邮箱', span: 12, itemRender: { name: '$input', props: { placeholder: '请输入管理员邮箱' } } }
|
||||||
{ field: 'password', title: '管理员密码', span: 10, itemRender: { name: '$input' , props: { placeholder: '请输入管理员密码' }} },
|
|
||||||
{ field: 'name', title: '管理员名称', span: 10, itemRender: { name: '$input', props: { placeholder: '请输入管理员名称' } } },
|
|
||||||
{ field: 'email', title: '管理员邮箱', span: 10, itemRender: { name: '$input' , props: { placeholder: '请输入管理员邮箱' }} }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -260,7 +255,7 @@ export default {
|
||||||
}).then(r => {
|
}).then(r => {
|
||||||
this.config_list = r.list;
|
this.config_list = r.list;
|
||||||
|
|
||||||
this.config_list.splice(0,0,{id:0,title:"请选择"})
|
this.config_list.splice(0, 0, { id: 0, title: "请选择" })
|
||||||
});
|
});
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
@ -316,8 +311,11 @@ export default {
|
||||||
let action = !this.isEdit ? this.actions.create : this.actions.update;
|
let action = !this.isEdit ? this.actions.create : this.actions.update;
|
||||||
let postdata = !this.isEdit ? Object.assign({ id: this.dataId }, this.formOptions.data) : Object.assign({}, this.formOptions.data);
|
let postdata = !this.isEdit ? Object.assign({ id: this.dataId }, this.formOptions.data) : Object.assign({}, this.formOptions.data);
|
||||||
if (this.isEdit) {
|
if (this.isEdit) {
|
||||||
// postdata = { BaseCompany: postdata }
|
// postdata = { BaseCompany: postdata }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.$mk.formatFormData({ data: postdata, rules: this.formOptions.items });
|
||||||
|
|
||||||
this.$mk.post({
|
this.$mk.post({
|
||||||
url: action,
|
url: action,
|
||||||
loading: "保存中...",
|
loading: "保存中...",
|
||||||
|
|
@ -332,18 +330,11 @@ export default {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
this.$refs.xForm.validate((a) => {
|
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => {
|
||||||
|
|
||||||
if (a) {
|
save();
|
||||||
let count = 0;
|
}).catch(count => {
|
||||||
for (let name in a) {
|
this.$mk.error(`存在${count}项错误,请检查`);
|
||||||
a[name];
|
|
||||||
count++;
|
|
||||||
}
|
|
||||||
this.$mk.error(`存在${count}项错误,请检查`);
|
|
||||||
} else {
|
|
||||||
save();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -384,8 +375,8 @@ export default {
|
||||||
page: serviceListPage,
|
page: serviceListPage,
|
||||||
title: "选择要添加的服务",
|
title: "选择要添加的服务",
|
||||||
pageMode: "select",
|
pageMode: "select",
|
||||||
pageOptions:{
|
pageOptions: {
|
||||||
config_id : this.currentBeid
|
config_id: this.currentBeid
|
||||||
},
|
},
|
||||||
width: 1000,
|
width: 1000,
|
||||||
height: 870,
|
height: 870,
|
||||||
|
|
@ -422,8 +413,8 @@ export default {
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
.page-body {
|
.page-body {
|
||||||
padding: 30px ;
|
padding: 30px;
|
||||||
background: @base-bg-color;
|
background: @base-bg-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.formtabs .ant-tabs-tabpane {
|
.formtabs .ant-tabs-tabpane {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue