增加了部分备注

This commit is contained in:
zxx 2022-12-30 20:26:56 +08:00
parent 75afed7c0c
commit 0e92cfdcd1
14 changed files with 382 additions and 210 deletions

View File

@ -44,8 +44,11 @@ export default {
}, },
methods: { methods: {
//
open(options) { open(options) {
// page title callback pageMode add edit select dataId id width height pageOptions
// pageOptions {id:1,name:''} this.$options.pageOptions
// showFooter
const { page, title, callback, pageMode, dataId,width = 800,height = 600 , pageOptions = {} ,showFooter } = options || {}; const { page, title, callback, pageMode, dataId,width = 800,height = 600 , pageOptions = {} ,showFooter } = options || {};
this.width = width; this.width = width;
@ -57,21 +60,30 @@ export default {
this.app = page; this.app = page;
this.callback = callback; this.callback = callback;
this.showFooter = showFooter; this.showFooter = showFooter;
//
setTimeout(() => { setTimeout(() => {
this.visible = true; this.visible = true;
}, 10); }, 10);
}, },
//
handleCallback(e) { handleCallback(e) {
const { callback } = this; const { callback } = this;
//
if (callback) { if (callback) {
//
callback(e); callback(e);
//
this.$destroy(); this.$destroy();
} }
}, },
//
modalClose() { modalClose() {
this.$destroy(); this.$destroy();
}, },
//
confirmEvent(){ confirmEvent(){
const { callback } = this; const { callback } = this;
let data = this.$refs.appPage.getConfirmData(); let data = this.$refs.appPage.getConfirmData();

View File

@ -4,7 +4,7 @@ import promptComponent from './dialog.vue' // 加载dialog组件
export default { export default {
// 打开对话框
open: function (args) { // 打开对话框 open: function (args) { // 打开对话框
const promptConstructor = Vue.extend(promptComponent); // 创建一个子类 const promptConstructor = Vue.extend(promptComponent); // 创建一个子类
let instance = new promptConstructor().$mount(''); // 创建一个实例 let instance = new promptConstructor().$mount(''); // 创建一个实例

View File

@ -31,7 +31,7 @@
<script> <script>
import BASE_URL from '@/services/base/api.js'; import BASE_URL from '@/services/base/api.js'; //
export default { export default {
name: 'MkGridDataSelector', name: 'MkGridDataSelector',
props: { props: {
@ -39,6 +39,7 @@ export default {
}, },
data() { data() {
return { return {
//
actions: { actions: {
getList: `${BASE_URL}/api/web/listdata` getList: `${BASE_URL}/api/web/listdata`
}, },
@ -73,7 +74,9 @@ export default {
} }
}, },
created() { created() {
//
this.load() this.load()
//
this.heightInit(); this.heightInit();
}, },
methods: { methods: {

View File

@ -51,6 +51,8 @@ export default {
} }
}, },
methods: { methods: {
// label
getLabel(v) { getLabel(v) {
for (let i = 0; i < this.options.length; i++) { for (let i = 0; i < this.options.length; i++) {
let o = this.options[i]; let o = this.options[i];
@ -60,6 +62,8 @@ export default {
} }
return ""; return "";
}, },
//
load() { load() {
const { row, column } = this.params const { row, column } = this.params

View File

@ -1,5 +1,5 @@
<template> <template>
<!-- 切换公司 -->
<vxe-modal v-model="value" @confirm="confirmEvent" width="600" show-footer> <vxe-modal v-model="value" @confirm="confirmEvent" width="600" show-footer>
<template #title> <template #title>
<span>选择公司</span> <span>选择公司</span>
@ -20,11 +20,11 @@
export default { export default {
name: "switchCompany", name: "switchCompany",
props: { props: {
value : { value: {
type: Boolean, type: Boolean,
default: false default: false
}, },
data : { data: {
type: Array type: Array
} }
}, },
@ -33,9 +33,10 @@ export default {
}; };
}, },
methods: { methods: {
confirmEvent(){ //
confirmEvent() {
let row = this.$refs.xTable.getCurrentRecord(); let row = this.$refs.xTable.getCurrentRecord();
this.$emit("confirm",{row}); this.$emit("confirm", { row });
} }
} }

View File

@ -1,5 +1,5 @@
<template> <template>
<!-- 新增 设置 日志 工具条 -->
<div :class="cls"> <div :class="cls">
<a-tooltip placement="topRight" title="日志" v-if="isShowLog"> <a-tooltip placement="topRight" title="日志" v-if="isShowLog">

View File

@ -1,50 +1,55 @@
export default { export default {
uploadDefaultImg: "http://zjdaomiimgtest.oss-cn-hangzhou.aliyuncs.com/2022/16709016422295584.png", // 默认图片 uploadDefaultImg: "http://zjdaomiimgtest.oss-cn-hangzhou.aliyuncs.com/2022/16709016422295584.png", // 默认图片
defaults: { // 此处配置的是全局配置,在任何地方都可以使用 this.$mk.config.defaults 来获取配置
defaults: { // 默认配置
gridOptions: { gridOptions: { // 表格配置
// 行配置
rowConfig: { rowConfig: {
keyField: "id", keyField: "id", // 主键字段
isCurrent: true, isCurrent: true, // 是否高亮当前行
isHover: true isHover: true // 是否高亮鼠标悬浮行
}, },
// 列配置
columnConfig: { columnConfig: {
resizable: true resizable: true // 是否允许拖动列宽
}, },
// 排序配置
sortConfig: { sortConfig: {
trigger: 'cell', trigger: 'cell', // 触发排序的方式
remote: true remote: true // 是否远程排序
}, },
// 分页配置
pagerConfig: { pagerConfig: {
pageSize: 50, pageSize: 50, // 默认每页显示条数
pageSizes: [50, 100, 200, 500, 1000, 5000, 10000, 20000] pageSizes: [50, 100, 200, 500, 1000, 5000, 10000, 20000] // 每页显示条数选项
}, },
// 工具栏配置
__toolbarConfig: { __toolbarConfig: {
buttons: [ buttons: [ // 按钮
], ],
refresh: true, refresh: true, // 是否显示刷新按钮
import: false, import: false, // 是否显示导入按钮
export: false, export: false, // 是否显示导出按钮
print: false, print: false, // 是否显示打印按钮
zoom: false, zoom: false, // 是否显示缩放按钮
custom: true custom: true // 是否显示自定义按钮
}, },
// 复选框配置
checkboxConfig: { checkboxConfig: {
reserve: true, reserve: true, // 是否保留复选框
highlight: true, highlight: true, // 是否高亮复选框
trigger:'row', trigger:'row', // 触发复选框的方式
range: true range: true // 是否允许复选框范围选择
} }
}, },
formOptions: { // 表单配置
formOptions: {
} }

View File

@ -2,6 +2,7 @@ import { request } from '@/utils/request' // 加载request
import modal from './modal' // 加载modal import modal from './modal' // 加载modal
export default { export default {
// 提交post请求 ,获取数据
post : function({url, data,loading , config}){ // post请求 post : function({url, data,loading , config}){ // post请求
return new Promise((resolve, reject)=>{ // 返回一个Promise return new Promise((resolve, reject)=>{ // 返回一个Promise
@ -41,6 +42,8 @@ export default {
}, },
// 获取分页数据
getPagedData: function({url, method = 'post', data,callback, config}){ // 获取分页数据 默认post请求 getPagedData: function({url, method = 'post', data,callback, config}){ // 获取分页数据 默认post请求
return new Promise((resolve, reject)=>{ // 返回一个Promise return new Promise((resolve, reject)=>{ // 返回一个Promise

View File

@ -1,6 +1,6 @@
export default { export default {
// 格式化表单数据
formatFormData: function ({ data, rules }) { // 格式化表单数据 formatFormData: function ({ data, rules }) { // 格式化表单数据
rules.forEach(rule => { // 循环规则 rules.forEach(rule => { // 循环规则
@ -17,7 +17,7 @@ export default {
}, },
// 验证表单数据
validateForm : function ({ form }) { // 验证表单 validateForm : function ({ form }) { // 验证表单

View File

@ -58,7 +58,7 @@
import BASE_URL from '@/services/base/api.js'; import BASE_URL from '@/services/base/api.js';
import PageLayout from '@/layouts/PageLayout' import PageLayout from '@/layouts/PageLayout'
let serviceListPage = () => import("../BaseService/list"); let serviceListPage = () => import("../BaseService/list"); //
export default { export default {
@ -79,10 +79,13 @@ export default {
// //
var pageData = { var pageData = {
//
companyTypeData: ['日用陶瓷厂', '卫浴工厂', '公司企业', '贸易公司', '其他'], companyTypeData: ['日用陶瓷厂', '卫浴工厂', '公司企业', '贸易公司', '其他'],
//
config_list: [], config_list: [],
//
currentConfigName: "", currentConfigName: "",
// ID
currentBeid: 0, currentBeid: 0,
uploadDefaultImg: null, uploadDefaultImg: null,
@ -100,7 +103,9 @@ export default {
}, },
keyName: 'id', keyName: 'id',
//
isEdit: false, isEdit: false,
//
formOptions: { formOptions: {
data: { data: {
"beid": 0, "beid": 0,
@ -130,10 +135,12 @@ export default {
"staff_count": 0, "staff_count": 0,
"store_count": 0 "store_count": 0
}, },
//
titleWidth: 100, titleWidth: 100,
//
titleAlign: 'right', titleAlign: 'right',
//
rules: { rules: {
title: [ title: [
{ required: true, message: '请输入标题' } { required: true, message: '请输入标题' }
@ -157,7 +164,7 @@ export default {
{ required: true, message: '请输入登录过期截止时间' } { required: true, message: '请输入登录过期截止时间' }
], ],
}, },
//
items: [ items: [
{ field: 'title', title: '公司名', span: 12, 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: 'short_title', title: '公司简称', span: 12, itemRender: { name: '$input', props: { placeholder: '请输入公司简称' } } },
@ -171,14 +178,10 @@ export default {
{ field: 'appsecret', title: 'AppSecret', 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: 'token', title: '企业Token', span: 24, itemRender: { name: '$textarea', props: { placeholder: '不用填写' } } },
{ field: 'access_expire', dataRule: { type: "timestamp" }, title: '登录过期截止时间', span: 24, itemRender: { name: '$input', props: {type:"date", placeholder: '输入登录过期截止时间' } } }, { field: 'access_expire', dataRule: { type: "timestamp" }, title: '登录过期截止时间', span: 24, itemRender: { name: '$input', props: {type:"date", placeholder: '输入登录过期截止时间' } } },
] ]
}, },
//
addModeItems: [ addModeItems: [
{ field: 'mobile', dataRule: { type: "integer" }, title: '管理员手机', span: 12, itemRender: { name: '$input', 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: 'password', title: '管理员密码', span: 12, itemRender: { name: '$input', props: { type: "password", placeholder: '请输入管理员密码' } } },
{ field: 'name', title: '管理员名称', span: 12, itemRender: { name: '$input', props: { placeholder: '请输入管理员名称' } } }, { field: 'name', title: '管理员名称', span: 12, itemRender: { name: '$input', props: { placeholder: '请输入管理员名称' } } },
@ -187,9 +190,13 @@ export default {
// - // -
gridServiceOptions: { gridServiceOptions: {
//
height: '110%', height: '110%',
// id
id: 'datagrid_service_1', id: 'datagrid_service_1',
//
proxyConfig: { proxyConfig: {
sort: true, // query sort: true, // query
filter: true, // query filter: true, // query
@ -219,36 +226,49 @@ export default {
} }
} }
}, },
//
columns: [ columns: [
{ type: 'checkbox', width: 50 }, { type: 'checkbox', width: 50 }, //
{ type: 'seq', width: 50 }, { type: 'seq', width: 50 }, // ID
{ field: 'name', sortable: true, title: '服务名' }, { field: 'name', sortable: true, title: '服务名' },
{ field: 'title', sortable: true, title: '标题', showHeaderOverflow: true }, { field: 'title', sortable: true, title: '标题', showHeaderOverflow: true },
{ field: 'port', sortable: true, title: '端口', showHeaderOverflow: true }, { field: 'port', sortable: true, title: '端口', showHeaderOverflow: true },
{ field: 'status', sortable: true, title: '是否启用', slots: { default: 'status' } } { field: 'status', sortable: true, title: '是否启用', slots: { default: 'status' } }
] ]
} }
}; };
//
pageData.gridServiceOptions = Object.assign({}, this.$mk.config.defaults.gridOptions, pageData.gridServiceOptions); pageData.gridServiceOptions = Object.assign({}, this.$mk.config.defaults.gridOptions, pageData.gridServiceOptions);
//
pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions); pageData.formOptions = Object.assign({}, this.$mk.config.defaults.formOptions, pageData.formOptions);
return pageData; return pageData;
}, },
computed: { computed: {
desc() { desc() {
return this.$t('editPageDesc') return this.$t('editPageDesc')
} }
}, },
created() {
created() {
//
this.uploadDefaultImg = this.$mk.config.uploadDefaultImg; this.uploadDefaultImg = this.$mk.config.uploadDefaultImg;
// id
let dataId = this.getDataId(); let dataId = this.getDataId();
// id
if (dataId) { if (dataId) {
this.$mk.post({ this.$mk.post({
url: this.actions.get, url: this.actions.get,
loading: "加载中...", loading: "加载中...",
@ -269,15 +289,17 @@ export default {
this.isEdit = true; this.isEdit = true;
} else { } else {
// id
this.addModeItems.forEach(item => { this.addModeItems.forEach(item => {
this.formOptions.items.push(item); this.formOptions.items.push(item);
}) })
} }
//
this.$mk.getPagedData({ this.$mk.getPagedData({
url: this.actions.configList, data: { url: this.actions.configList, data: {
//
"page": 0, "page": 0,
"limit": 0, "limit": 0,
"start_time": 0, "start_time": 0,
@ -287,17 +309,18 @@ export default {
"order_bys": [ "order_bys": [
] ]
} }
}).then(r => { }).then(r => { //
this.config_list = r.list; this.config_list = r.list;
//
this.updateCurrentConfigName(); this.updateCurrentConfigName();
//
this.config_list.splice(0, 0, { id: 0, title: "请选择" }) this.config_list.splice(0, 0, { id: 0, title: "请选择" })
}); });
}, },
// //
methods: { methods: {
//
updateCurrentConfigName() { updateCurrentConfigName() {
this.config_list.forEach(item => { this.config_list.forEach(item => {
if (item.id == this.currentBeid) { if (item.id == this.currentBeid) {
@ -329,6 +352,8 @@ export default {
}); });
}, },
// id
getDataId() { getDataId() {
let dataId = this.dataId; let dataId = this.dataId;
@ -337,9 +362,9 @@ export default {
} }
return parseInt(dataId || 0); return parseInt(dataId || 0);
}, },
//
loadDetailData1({ params }) { loadDetailData1({ params }) {
params.start_time = 0; params.start_time = 0;
params.end_time = 0; params.end_time = 0;
params.beid = this.formOptions.data.beid; params.beid = this.formOptions.data.beid;
@ -347,123 +372,170 @@ export default {
params.company_id = this.getDataId(); params.company_id = this.getDataId();
return this.$mk.getPagedData({ url: this.actions.serviceList, data: params }); return this.$mk.getPagedData({ url: this.actions.serviceList, data: params });
}, },
//
back() { back() {
//
if (!this.isEdit) { if (!this.isEdit) {
this.$closePage({ this.$closePage({
closeRoute: "/BaseCompany/BaseCompanyAdd" closeRoute: "/BaseCompany/BaseCompanyAdd"
}); });
} else { } else {
//
this.$closePage({ this.$closePage({
closeRoute: "/BaseCompany/BaseCompanyUpdate" closeRoute: "/BaseCompany/BaseCompanyUpdate"
}); });
} }
//
this.$openPage('/BaseCompany/BaseCompanyList') this.$openPage('/BaseCompany/BaseCompanyList')
}, },
//
ok() { ok() {
let save = () => { let save = () => {
//
let action = !this.isEdit ? this.actions.create : this.actions.update; let action = !this.isEdit ? this.actions.create : this.actions.update;
// id id
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.formatFormData({ data: postdata, rules: this.formOptions.items });
//
this.$mk.post({ this.$mk.post({
url: action, url: action,
loading: "保存中...", loading: "保存中...",
data: postdata, data: postdata,
}).then(() => { }).then(() => { //
this.$mk.success("保存成功"); this.$mk.success("保存成功");
if (!this.isEdit) { if (!this.isEdit) { //
this.back(); this.back();
} }
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg); //
}); });
}; };
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => {
save();
}).catch(count => { //
this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { //
save(); //
}).catch(count => { //
this.$mk.error(`存在${count}项错误,请检查`); this.$mk.error(`存在${count}项错误,请检查`);
}); });
}, },
//
pageDel() { pageDel() {
//
let rows = this.$refs.gridService.getCheckboxRecords(); let rows = this.$refs.gridService.getCheckboxRecords();
// id
let ids = []; let ids = [];
// id ids
rows.forEach((row) => { rows.forEach((row) => {
ids.push(row[this.keyName]); ids.push(row[this.keyName]);
}); });
// ids
if (!ids.length) { if (!ids.length) {
this.$mk.error("请选择行"); this.$mk.error("请选择行");
return; return;
} }
//
this.$mk.confirm('您确定要移除服务吗?').then(type => { this.$mk.confirm('您确定要移除服务吗?').then(type => {
//
if (type == 'confirm') { if (type == 'confirm') {
//
this.$mk.post({ this.$mk.post({
url: this.actions.serviceDel, url: this.actions.serviceDel,
loading: "移除服务中...", loading: "移除服务中...",
data: { data: {
ids: ids ids: ids
} }
}).then(() => { }).then(() => { //
this.$mk.success("移除服务成功"); this.$mk.success("移除服务成功");
this.$refs.gridService.commitProxy('query') this.$refs.gridService.commitProxy('query')
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
} }
}); });
}, },
pageAdd() {
this.$mk.dialog.open({
page: serviceListPage,
title: "选择要添加的服务",
//
pageAdd() {
//
this.$mk.dialog.open({
//
page: serviceListPage,
//
title: "选择要添加的服务",
//
showFooter: true, showFooter: true,
//
pageOptions: { pageOptions: {
// id
config_id: this.currentBeid config_id: this.currentBeid
}, },
//
pageMode: "select", pageMode: "select",
//
width: 1000, width: 1000,
//
height: 870, height: 870,
//
dataId: 0, dataId: 0,
callback: ({ data }) => { callback: ({ data }) => { //
//
if (!data || !data.length) { if (!data || !data.length) {
return; return;
} }
// id
let ids = []; let ids = [];
// idids
data.forEach(item => { data.forEach(item => {
ids.push(item.id) ids.push(item.id)
}) })
//
this.$mk.post({ this.$mk.post({
url: this.actions.serviceAdd, url: this.actions.serviceAdd,
loading: "添加中...", loading: "添加中...",
data: { data: {
// idid
"company_id": this.getDataId(), "company_id": this.getDataId(),
ptyid: 0, ptyid: 0,
// idBeid
beid: this.formOptions.data.beid, beid: this.formOptions.data.beid,
// id
"services_id": ids "services_id": ids
}, },
}).then(() => { }).then(() => { //
this.$mk.success("添加成功"); this.$mk.success("添加成功");
// commitProxy query
this.$refs.gridService.commitProxy('query') this.$refs.gridService.commitProxy('query')
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
} }
}); });
}, },
//
cancel() { cancel() {
this.back(); this.back();
} }

View File

@ -30,14 +30,14 @@
<!-- 表格区 --> <!-- 表格区 -->
<div class="gridPanel"> <div class="gridPanel">
<vxe-grid ref='xGrid' v-bind="gridOptions"> <vxe-grid ref='xGrid' v-bind="gridOptions">
<template #status="{ row }"><!-- 这里是自定义列 -->
<!-- 转换 row.status 的值 如果是true显示开否则显示关-->
<a-switch :checked="row.status ? true : false" @change="onSwitch(row, 'status')" />
</template>
<template #auth_stop_date="{ row }"><!-- 这里是自定义列 --> <template #auth_stop_date="{ row }"><!-- 这里是自定义列 -->
<!-- 转换 row.auth_stop_date 的值 将时间戳转换为日期格式 --> <!-- 转换 row.auth_stop_date 的值 将时间戳转换为日期格式 -->
<span>{{ row.auth_stop_date | formatDateTime(row.auth_stop_date) }}</span> <span>{{ row.auth_stop_date | formatDateTime(row.auth_stop_date) }}</span>
</template> </template>
<template #status="{ row }"><!-- 这里是自定义列 -->
<!-- 转换 row.status 的值 如果是true显示开否则显示关-->
<a-switch :checked="row.status ? 1 : 0" @change="onSwitch(row, 'status')" />
</template>
<template #op="{ row }"> <template #op="{ row }">
<div class="oplinks"> <div class="oplinks">
<a @click.stop="pageEdit(row)" title="编辑"><a-icon type="edit" /></a> <a @click.stop="pageEdit(row)" title="编辑"><a-icon type="edit" /></a>
@ -61,7 +61,7 @@ import BASE_URL from '@/services/base/api.js';
export default { export default {
name: 'BaseConfigList', name: 'BaseConfigList',
i18n: require('./i18n'), i18n: require('./i18n'), //
props: { props: {
pageMode: { pageMode: {
type: String, type: String,
@ -70,41 +70,50 @@ export default {
}, },
data() { data() {
// //
var pageData = { var pageData = { //
keyName: 'id', keyName: 'id', //
actions: {
//
actions: { // Api
getList: `${BASE_URL.BASE_URL}/BaseCompany/v1/list`, getList: `${BASE_URL.BASE_URL}/BaseCompany/v1/list`,
delete: `${BASE_URL.BASE_URL}/BaseCompany/v1/batchDelete` delete: `${BASE_URL.BASE_URL}/BaseCompany/v1/batchDelete`,
open: `${BASE_URL.BASE_URL}/BaseCompany/v1/open`,
close: `${BASE_URL.BASE_URL}/BaseCompany/v1/close`,
}, },
start_time: 0, start_time: 0, //
end_time: 0, end_time: 0, //
// //
searchFormData: { searchFormData: {
title: '', title: '',
desc: '', desc: '',
}, },
//
searchRules: [ searchRules: [
{ key: "title", mode: "like" }, { key: "title", mode: "like" },
{ key: "desc", mode: "like" } { key: "desc", mode: "like" }
], ],
//
searchFormItems: [ searchFormItems: [
{ {
title: '左侧', title: '左侧', //
span: 20, span: 20, //
children: [ children: [ //
{ field: 'title', title: '标题', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入标题' } } }, { field: 'title', title: '标题', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入标题' } } },
{ field: 'desc', title: '描述', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入描述' } } }, { field: 'desc', title: '描述', span: 5, itemRender: { name: '$input', props: { placeholder: '请输入描述' } } },
{ span: 8, slots: { default: 'date' } }, { span: 8, slots: { default: 'date' } }, //
{ {
align: 'right', span: 4, itemRender: { align: 'right', span: 4, itemRender: { //
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, //
{ props: { type: 'reset', content: '重置' } }] { props: { type: 'reset', content: '重置' } }]
} }
} }
@ -113,13 +122,14 @@ export default {
], ],
// //
gridOptions: { gridOptions: { //
height: '100%', height: '100%', // 100%
id: 'datagrid_1', stripe: true, //
id: 'datagrid_1', //
proxyConfig: { //
proxyConfig: { //
sort: true, // query sort: true, // query
filter: true, // query filter: true, // query
props: { props: {
@ -148,53 +158,66 @@ export default {
} }
} }
}, },
//
columns: [ columns: [
{ type: 'checkbox', width: 50 }, { type: 'checkbox', width: 50 }, //
{ type: 'seq', width: 50 }, { type: 'seq', width: 30 }, //
{ slots: { default: 'logo' }, width: 120, sortable: true, title: '公司Logo', showHeaderOverflow: true }, { slots: { default: 'logo' }, width: 120, sortable: true, title: '公司Logo', showHeaderOverflow: true }, // logo
{ field: 'title', sortable: true, title: '公司名称', width: 250 }, { field: 'title', sortable: true, title: '公司名称', width: 250 }, //
// auth_stop_date // auth_stop_date
{ field: 'auth_stop_date', slots: { default: 'auth_stop_date' }, width: 120, sortable: true, title: '授权截止日期', showHeaderOverflow: true }, { field: 'auth_stop_date', slots: { default: 'auth_stop_date' }, width: 120, sortable: true, title: '授权截止日期', showHeaderOverflow: true },
{ field: 'token', width: 120, sortable: true, title: 'token', showHeaderOverflow: true }, { field: 'token', width: 120, sortable: true, title: 'token', showHeaderOverflow: true }, // token
{ field: 'is_private_cloud', width: 110, sortable: true, title: '私有云', showHeaderOverflow: true }, { field: 'is_private_cloud', width: 110, sortable: true, title: '私有云', showHeaderOverflow: true }, //
{ field: 'admin_count', width: 110, sortable: true, title: '用户数', showHeaderOverflow: true }, { field: 'admin_count', width: 110, sortable: true, title: '用户数', showHeaderOverflow: true }, //
{ field: 'status', slots: { default: 'status' }, width: 80, sortable: true, title: '状态', showHeaderOverflow: true }, //
{ field: 'create_time', width: 160, sortable: true, title: '创建时间', showHeaderOverflow: true }, //
{ title: '操作', slots: { default: 'op' }, width: 120 } { title: '操作', slots: { default: 'op' }, width: 120 }
] ]
} }
}; };
pageData.gridOptions = Object.assign({}, this.$mk.config.defaults.gridOptions, pageData.gridOptions); // pageData.gridOptions = Object.assign({}, this.$mk.config.defaults.gridOptions, pageData.gridOptions); //
return pageData; return pageData; //
}, },
//
computed: { computed: {
//
desc() { desc() {
return this.$t('pageDesc') return this.$t('pageDesc')
} }
}, },
//
created() { created() {
this.$nextTick(() => { // DOM this.$nextTick(() => { // DOM
// //
this.$refs.xGrid.connect(this.$refs.xToolbar) this.$refs.xGrid.connect(this.$refs.xToolbar) //
}); });
}, },
//
onLoad() { onLoad() {
}, },
// //
methods: { methods: {
//
onDateChange(date) { // onDateChange(date) { //
if (date && date.length) { // if (date && date.length) { //
this.start_time = parseInt(date[0]._d.getTime() / 1000); // this.start_time = parseInt(date[0]._d.getTime() / 1000); //
this.end_time = parseInt(date[1]._d.getTime() / 1000); // this.end_time = parseInt(date[1]._d.getTime() / 1000); //
} else { } else { //
this.start_time = 0; // this.start_time = 0; //
this.end_time = 0; // this.end_time = 0; //
} }
}, },
//
getSearchParms() { // getSearchParms() { //
var rules = []; // var rules = []; //
let findMode = k => { // let findMode = k => { //
@ -220,52 +243,46 @@ export default {
} }
return rules; // return rules; //
}, },
//
getSelectdRow() { // getSelectdRow() { //
let row = this.$refs.xGrid.getCurrentRecord(); // let row = this.$refs.xGrid.getCurrentRecord(); //
if (!row) { // if (!row) { //
let rows = this.$refs.xGrid.getCheckboxRecords(); // let rows = this.$refs.xGrid.getCheckboxRecords(); //
if (rows && rows.length) { row = rows[0]; } // if (rows && rows.length) { row = rows[0]; } //
} }
return row; return row; //
},
loadData({ params }) { //
params.start_time = this.start_time;
params.end_time = this.end_time;
return this.$mk.getPagedData({ url: this.actions.getList, data: params });
}, },
//add / log / setting //
toolbarClick(e) { // loadData({ params }) {
if (e.name == "add") { params.start_time = this.start_time; //
params.end_time = this.end_time; //
return this.$mk.getPagedData({ url: this.actions.getList, data: params }); //
},
this.$openPage("/BaseCompany/BaseCompanyAdd"); // add / log / setting
toolbarClick(e) {
if (e.name == "add") { //
this.$openPage("/BaseCompany/BaseCompanyAdd"); //
} }
}, },
pageEdit(row) { // //
pageEdit(row) {
if (!row) { // if (!row) { //
this.$mk.msg("请选择行"); // this.$mk.msg("请选择行"); //
return; // return; //
} }
this.$openPage("/BaseCompany/BaseCompanyUpdate/" + row[this.keyName]); // this.$openPage("/BaseCompany/BaseCompanyUpdate/" + row[this.keyName]); //
}, },
//
pageDelete(row) { // pageDelete(row) {
let rows = row ? [row] : this.$refs.xGrid.getCheckboxRecords(); // let rows = row ? [row] : this.$refs.xGrid.getCheckboxRecords(); //
let ids = []; // id
let ids = [];
rows.forEach((row) => { // rows.forEach((row) => { //
ids.push(row[this.keyName]); // ids.push(row[this.keyName]); // idid
}); });
if (!ids.length) { // if (!ids.length) { //
@ -273,28 +290,27 @@ export default {
return; return;
} }
this.$mk.confirm('您确定要删除吗?').then(type => { this.$mk.confirm('您确定要删除吗?').then(type => { //
if (type == 'confirm') { if (type == 'confirm') { //
this.$mk.post({ this.$mk.post({
url: this.actions.delete, url: this.actions.delete, //
loading: "删除中...", loading: "删除中...", //
data: { data: {
ids: ids ids: ids // id
} }
}).then(() => { }).then(() => { //
this.$mk.success("删除成功"); this.$mk.success("删除成功"); //
this.onSearch(); this.onSearch(); //
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg); //
}); });
} }
}); });
}, },
onSearch() { //
this.$refs.xGrid.commitProxy('query') //
onSearch() {
this.$refs.xGrid.commitProxy('query') //
}, },

View File

@ -11,7 +11,7 @@
</template> </template>
</vxe-form> </vxe-form>
<!-- 如果是编辑模式显示服务管理 -->
<a-tabs default-active-key="1" class="formtabs" v-if="isEdit"> <a-tabs default-active-key="1" class="formtabs" v-if="isEdit">
<a-tab-pane key="1" tab="服务管理"> <a-tab-pane key="1" tab="服务管理">
@ -70,7 +70,7 @@ export default {
// //
var pageData = { var pageData = {
//
actions: { actions: {
create: `${BASE_URL.BASE_URL}/BaseConfig/v1/create`, create: `${BASE_URL.BASE_URL}/BaseConfig/v1/create`,
update: `${BASE_URL.BASE_URL}/BaseConfig/v1/update`, update: `${BASE_URL.BASE_URL}/BaseConfig/v1/update`,
@ -81,10 +81,13 @@ export default {
serviceOpen: `${BASE_URL.BASE_URL}/BaseConfig/v1/service/open`, serviceOpen: `${BASE_URL.BASE_URL}/BaseConfig/v1/service/open`,
serviceClose: `${BASE_URL.BASE_URL}/BaseConfig/v1/service/close` serviceClose: `${BASE_URL.BASE_URL}/BaseConfig/v1/service/close`
}, },
//
uploadDefaultImg: null, uploadDefaultImg: null,
// id
keyName: 'id', keyName: 'id',
//
isEdit: false, isEdit: false,
//
formOptions: { formOptions: {
data: { data: {
"title": "", "title": "",
@ -106,8 +109,9 @@ export default {
"slogan": "", "slogan": "",
"en_slogan": "" "en_slogan": ""
}, },
//
titleWidth: 100, titleWidth: 100,
//
titleAlign: 'right', titleAlign: 'right',
rules: { rules: {
@ -204,19 +208,22 @@ export default {
} }
}, },
created() { created() {
//
this.uploadDefaultImg = this.$mk.config.uploadDefaultImg; this.uploadDefaultImg = this.$mk.config.uploadDefaultImg;
// ID
let dataId = this.getDataId(); let dataId = this.getDataId();
// ID
if (dataId) { if (dataId) {
// post
this.$mk.post({ this.$mk.post({
url: this.actions.get, url: this.actions.get,
loading: "加载中...", loading: "加载中...",
data: { data: {
id: parseInt(dataId) id: parseInt(dataId)
} }
}).then(a => { }).then(a => { //
this.formOptions.data = a.data.BaseConfig; this.formOptions.data = a.data.BaseConfig;
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
@ -226,63 +233,79 @@ export default {
}, },
// //
methods: { methods: {
//
selectFile() { selectFile() {
this.$refs.imageInput.click(); this.$refs.imageInput.click();
}, },
//
upload() { upload() {
const imgFile = this.$refs.imageInput.files[0] const imgFile = this.$refs.imageInput.files[0] //
this.$mk.uploadFile(imgFile, 'png', (url) => { this.$mk.uploadFile(imgFile, 'png', (url) => { //
this.formOptions.data.logo = url; this.formOptions.data.logo = url; //
}); });
}, },
//
onSwitch(row) { onSwitch(row) {
row.status = row.status ? 0 : 1; row.status = row.status ? 0 : 1; //
// post
this.$mk.post({ this.$mk.post({
//
url: row.status ? this.actions.serviceOpen : this.actions.serviceClose, url: row.status ? this.actions.serviceOpen : this.actions.serviceClose,
loading: "加载中...",
data: { id: row.id }, data: { id: row.id },
}).then(() => { }).then(() => { //
this.$mk.msg(row.status ? "开启服务完成" : "停止服务完成"); this.$mk.msg(row.status ? "开启服务完成" : "停止服务完成");
this.$emit("callback", { success: true }); this.$emit("callback", { success: true });
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
}, },
// ID
getDataId() { getDataId() {
let dataId = this.dataId; let dataId = this.dataId;
// ID使ID
if (this.$route.params.id) { if (this.$route.params.id) {
dataId = this.$route.params.id; dataId = this.$route.params.id;
} }
return parseInt(dataId || 0); return parseInt(dataId || 0); // ID
}, },
//
loadDetailData1({ params }) { loadDetailData1({ params }) {
params.start_time = 0; //
params.end_time = 0; //
params.start_time = 0; params.beid = this.getDataId(); // ID
params.end_time = 0; //
params.beid = this.getDataId();
return this.$mk.getPagedData({ url: this.actions.serviceList, data: params }); return this.$mk.getPagedData({ url: this.actions.serviceList, data: params });
}, },
//
back() { back() {
//
if (!this.isEdit) { if (!this.isEdit) {
this.$closePage({ this.$closePage({
closeRoute: "/BaseConfig/BaseConfigAdd" closeRoute: "/BaseConfig/BaseConfigAdd"
}); });
} else { } else {
//
this.$closePage({ this.$closePage({
closeRoute: "/BaseConfig/BaseConfigUpdate" closeRoute: "/BaseConfig/BaseConfigUpdate"
}); });
} }
//
this.$openPage('/BaseConfig/BaseConfigList') this.$openPage('/BaseConfig/BaseConfigList')
}, },
ok() {
//
ok() {
//
let save = () => { let save = () => {
// 使 使
let action = !this.isEdit ? this.actions.create : this.actions.update; let action = !this.isEdit ? this.actions.create : this.actions.update;
// ID ID BaseConfig
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);
// BaseConfig
if (this.isEdit) { if (this.isEdit) {
postdata = { BaseConfig: postdata } postdata = { BaseConfig: postdata }
} }
@ -290,18 +313,18 @@ export default {
url: action, url: action,
loading: "保存中...", loading: "保存中...",
data: postdata, data: postdata,
}).then(() => { }).then(() => { //
this.$mk.success("保存成功"); this.$mk.success("保存成功");
if (!this.isEdit) { if (!this.isEdit) {
this.back(); this.back();
} }
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
}; };
//
this.$refs.xForm.validate((a) => { this.$refs.xForm.validate((a) => {
//
if (a) { if (a) {
let count = 0; let count = 0;
for (let name in a) { for (let name in a) {
@ -310,59 +333,82 @@ export default {
} }
this.$mk.error(`存在${count}项错误,请检查`); this.$mk.error(`存在${count}项错误,请检查`);
} else { } else {
//
save(); save();
} }
}); });
}, },
//
pageDel() { pageDel() {
//
let rows = this.$refs.gridService.getCheckboxRecords(); let rows = this.$refs.gridService.getCheckboxRecords();
// ID
let ids = []; let ids = [];
//
rows.forEach((row) => { rows.forEach((row) => {
// ID
ids.push(row[this.keyName]); ids.push(row[this.keyName]);
}); });
//
if (!ids.length) { if (!ids.length) {
this.$mk.error("请选择行"); this.$mk.error("请选择行");
return; return;
} }
//
this.$mk.confirm('您确定要移除服务吗?').then(type => { this.$mk.confirm('您确定要移除服务吗?').then(type => {
//
if (type == 'confirm') { if (type == 'confirm') {
//
this.$mk.post({ this.$mk.post({
url: this.actions.serviceDel, url: this.actions.serviceDel,
loading: "移除服务中...", loading: "移除服务中...",
data: { data: {
ids: ids ids: ids
} }
}).then(() => { }).then(() => { //
this.$mk.success("移除服务成功"); this.$mk.success("移除服务成功");
//
this.$refs.gridService.commitProxy('query') this.$refs.gridService.commitProxy('query')
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
} }
}); });
}, },
//
pageAdd() { pageAdd() {
//
this.$mk.dialog.open({ this.$mk.dialog.open({
//
page: serviceListPage, page: serviceListPage,
//
title: "选择要添加的服务", title: "选择要添加的服务",
//
pageMode: "select", pageMode: "select",
//
width: 1000, width: 1000,
//
height: 870, height: 870,
// ID
dataId: 0, dataId: 0,
//
callback: ({ data }) => { callback: ({ data }) => {
//
if (!data || !data.length) { if (!data || !data.length) {
return; return;
} }
// ID
let ids = []; let ids = [];
//
data.forEach(item => { data.forEach(item => {
ids.push(item.id) ids.push(item.id)
}) })
//
this.$mk.post({ this.$mk.post({
url: this.actions.serviceAdd, url: this.actions.serviceAdd,
loading: "添加中...", loading: "添加中...",
@ -370,16 +416,18 @@ export default {
"beid": this.getDataId(), "beid": this.getDataId(),
"service_id": ids "service_id": ids
}, },
}).then(() => { }).then(() => { //
this.$mk.success("添加成功"); this.$mk.success("添加成功");
//
this.$refs.gridService.commitProxy('query') this.$refs.gridService.commitProxy('query')
}).catch((a) => { }).catch((a) => { //
this.$mk.error(a.data.msg); this.$mk.error(a.data.msg);
}); });
} }
}); });
}, },
//
cancel() { cancel() {
this.back(); this.back();
} }

View File

@ -177,7 +177,7 @@ export default {
// //
methods: { methods: {
//
onDateChange(date) { onDateChange(date) {
if (date && date.length) { if (date && date.length) {
this.start_time = parseInt(date[0]._d.getTime() / 1000); this.start_time = parseInt(date[0]._d.getTime() / 1000);
@ -188,6 +188,8 @@ export default {
} }
}, },
//
getSearchParms() { getSearchParms() {
var rules = []; var rules = [];
let findMode = k => { let findMode = k => {
@ -204,7 +206,7 @@ export default {
if (mode == "like") { if (mode == "like") {
value = "%" + value + "%"; value = "%" + value + "%";
} }
rules.push({ rules.push({ //
column: key, column: key,
mode: mode, mode: mode,
value: value value: value
@ -213,6 +215,8 @@ export default {
} }
return rules; return rules;
}, },
//
getSelectdRow() { getSelectdRow() {
let row = this.$refs.xGrid.getCurrentRecord(); let row = this.$refs.xGrid.getCurrentRecord();
if (!row) { if (!row) {
@ -221,6 +225,8 @@ export default {
} }
return row; return row;
}, },
//
loadData({ params }) { loadData({ params }) {
params.start_time = this.start_time; params.start_time = this.start_time;
@ -233,11 +239,11 @@ export default {
//add / log / setting //add / log / setting
toolbarClick(e) { toolbarClick(e) {
if (e.name == "add") { if (e.name == "add") {
this.$openPage("/BaseConfig/BaseConfigAdd"); this.$openPage("/BaseConfig/BaseConfigAdd");
} }
}, },
//
pageEdit(row) { pageEdit(row) {
if (!row) { if (!row) {
@ -249,6 +255,7 @@ export default {
}, },
//
pageDelete(row) { pageDelete(row) {

View File

@ -490,6 +490,7 @@ export default {
dataId: row.id, dataId: row.id,
callback: ({ success }) => { callback: ({ success }) => {
if (success) { if (success) {
// commitProxy query
this.$refs.gridPermission.commitProxy('query') this.$refs.gridPermission.commitProxy('query')
} }
} }