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