公司编辑页面优化
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();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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: '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: '请输入管理员邮箱' } } }
|
||||
]
|
||||
},
|
||||
|
||||
|
|
@ -318,6 +313,9 @@ export default {
|
|||
if (this.isEdit) {
|
||||
// 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();
|
||||
}
|
||||
}).catch(count => {
|
||||
this.$mk.error(`存在${count}项错误,请检查`);
|
||||
});
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue