增加了部分备注

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: {
//
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 || {};
this.width = width;
@ -57,21 +60,30 @@ export default {
this.app = page;
this.callback = callback;
this.showFooter = showFooter;
//
setTimeout(() => {
this.visible = true;
}, 10);
},
//
handleCallback(e) {
const { callback } = this;
//
if (callback) {
//
callback(e);
//
this.$destroy();
}
},
//
modalClose() {
this.$destroy();
},
//
confirmEvent(){
const { callback } = this;
let data = this.$refs.appPage.getConfirmData();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,14 +30,14 @@
<!-- 表格区 -->
<div class="gridPanel">
<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 }"><!-- 这里是自定义列 -->
<!-- 转换 row.auth_stop_date 的值 将时间戳转换为日期格式 -->
<span>{{ row.auth_stop_date | formatDateTime(row.auth_stop_date) }}</span>
</template>
<template #status="{ row }"><!-- 这里是自定义列 -->
<!-- 转换 row.status 的值 如果是true显示开否则显示关-->
<a-switch :checked="row.status ? 1 : 0" @change="onSwitch(row, 'status')" />
</template>
<template #op="{ row }">
<div class="oplinks">
<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 {
name: 'BaseConfigList',
i18n: require('./i18n'),
i18n: require('./i18n'), //
props: {
pageMode: {
type: String,
@ -70,41 +70,50 @@ export default {
},
data() {
//
var pageData = {
//
var pageData = { //
keyName: 'id',
actions: {
keyName: 'id', //
//
actions: { // Api
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,
end_time: 0,
start_time: 0, //
end_time: 0, //
//
searchFormData: {
title: '',
desc: '',
},
//
searchRules: [
{ key: "title", mode: "like" },
{ key: "desc", mode: "like" }
],
//
searchFormItems: [
{
title: '左侧',
span: 20,
children: [
title: '左侧', //
span: 20, //
children: [ //
{ field: 'title', 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: {
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } },
align: 'right', span: 4, itemRender: { //
name: '$buttons', children: [{ props: { type: 'submit', content: '搜索', status: 'primary' } }, //
{ props: { type: 'reset', content: '重置' } }]
}
}
@ -113,13 +122,14 @@ export default {
],
//
gridOptions: {
height: '100%',
id: 'datagrid_1',
gridOptions: { //
height: '100%', // 100%
stripe: true, //
id: 'datagrid_1', //
proxyConfig: {
//
proxyConfig: { //
sort: true, // query
filter: true, // query
props: {
@ -148,53 +158,66 @@ export default {
}
}
},
//
columns: [
{ type: 'checkbox', width: 50 },
{ type: 'seq', width: 50 },
{ slots: { default: 'logo' }, width: 120, sortable: true, title: '公司Logo', showHeaderOverflow: true },
{ field: 'title', sortable: true, title: '公司名称', width: 250 },
{ type: 'checkbox', width: 50 }, //
{ type: 'seq', width: 30 }, //
{ slots: { default: 'logo' }, width: 120, sortable: true, title: '公司Logo', showHeaderOverflow: true }, // logo
{ field: 'title', sortable: true, title: '公司名称', width: 250 }, //
// auth_stop_date
{ 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: 'is_private_cloud', width: 110, sortable: true, title: '私有云', showHeaderOverflow: true },
{ field: 'admin_count', width: 110, sortable: true, title: '用户数', 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: '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 }
]
}
};
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: {
//
desc() {
return this.$t('pageDesc')
}
},
//
created() {
this.$nextTick(() => { // DOM
//
this.$refs.xGrid.connect(this.$refs.xToolbar)
this.$refs.xGrid.connect(this.$refs.xToolbar) //
});
},
//
onLoad() {
},
//
//
methods: {
//
onDateChange(date) { //
if (date && date.length) { //
this.start_time = parseInt(date[0]._d.getTime() / 1000); //
this.end_time = parseInt(date[1]._d.getTime() / 1000); //
} else {
} else { //
this.start_time = 0; //
this.end_time = 0; //
}
},
//
getSearchParms() { //
var rules = []; //
let findMode = k => { //
@ -220,52 +243,46 @@ export default {
}
return rules; //
},
//
getSelectdRow() { //
let row = this.$refs.xGrid.getCurrentRecord(); //
if (!row) { //
let rows = this.$refs.xGrid.getCheckboxRecords(); //
if (rows && rows.length) { row = rows[0]; } //
}
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 });
return row; //
},
//add / log / setting
toolbarClick(e) { //
if (e.name == "add") {
//
loadData({ params }) {
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) { //
this.$mk.msg("请选择行"); //
return; //
}
this.$openPage("/BaseCompany/BaseCompanyUpdate/" + row[this.keyName]); //
},
pageDelete(row) { //
//
pageDelete(row) {
let rows = row ? [row] : this.$refs.xGrid.getCheckboxRecords(); //
let ids = [];
let ids = []; // id
rows.forEach((row) => { //
ids.push(row[this.keyName]); //
ids.push(row[this.keyName]); // idid
});
if (!ids.length) { //
@ -273,28 +290,27 @@ export default {
return;
}
this.$mk.confirm('您确定要删除吗?').then(type => {
if (type == 'confirm') {
this.$mk.confirm('您确定要删除吗?').then(type => { //
if (type == 'confirm') { //
this.$mk.post({
url: this.actions.delete,
loading: "删除中...",
url: this.actions.delete, //
loading: "删除中...", //
data: {
ids: ids
ids: ids // id
}
}).then(() => {
this.$mk.success("删除成功");
this.onSearch();
}).catch((a) => {
this.$mk.error(a.data.msg);
}).then(() => { //
this.$mk.success("删除成功"); //
this.onSearch(); //
}).catch((a) => { //
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>
</vxe-form>
<!-- 如果是编辑模式显示服务管理 -->
<a-tabs default-active-key="1" class="formtabs" v-if="isEdit">
<a-tab-pane key="1" tab="服务管理">
@ -70,7 +70,7 @@ export default {
//
var pageData = {
//
actions: {
create: `${BASE_URL.BASE_URL}/BaseConfig/v1/create`,
update: `${BASE_URL.BASE_URL}/BaseConfig/v1/update`,
@ -81,10 +81,13 @@ export default {
serviceOpen: `${BASE_URL.BASE_URL}/BaseConfig/v1/service/open`,
serviceClose: `${BASE_URL.BASE_URL}/BaseConfig/v1/service/close`
},
//
uploadDefaultImg: null,
// id
keyName: 'id',
//
isEdit: false,
//
formOptions: {
data: {
"title": "",
@ -106,8 +109,9 @@ export default {
"slogan": "",
"en_slogan": ""
},
//
titleWidth: 100,
//
titleAlign: 'right',
rules: {
@ -204,19 +208,22 @@ export default {
}
},
created() {
//
this.uploadDefaultImg = this.$mk.config.uploadDefaultImg;
// ID
let dataId = this.getDataId();
// ID
if (dataId) {
// post
this.$mk.post({
url: this.actions.get,
loading: "加载中...",
data: {
id: parseInt(dataId)
}
}).then(a => {
}).then(a => { //
this.formOptions.data = a.data.BaseConfig;
}).catch((a) => {
}).catch((a) => { //
this.$mk.error(a.data.msg);
});
@ -226,63 +233,79 @@ export default {
},
//
methods: {
//
selectFile() {
this.$refs.imageInput.click();
},
//
upload() {
const imgFile = this.$refs.imageInput.files[0]
this.$mk.uploadFile(imgFile, 'png', (url) => {
this.formOptions.data.logo = url;
const imgFile = this.$refs.imageInput.files[0] //
this.$mk.uploadFile(imgFile, 'png', (url) => { //
this.formOptions.data.logo = url; //
});
},
//
onSwitch(row) {
row.status = row.status ? 0 : 1;
row.status = row.status ? 0 : 1; //
// post
this.$mk.post({
//
url: row.status ? this.actions.serviceOpen : this.actions.serviceClose,
loading: "加载中...",
data: { id: row.id },
}).then(() => {
}).then(() => { //
this.$mk.msg(row.status ? "开启服务完成" : "停止服务完成");
this.$emit("callback", { success: true });
}).catch((a) => {
}).catch((a) => { //
this.$mk.error(a.data.msg);
});
},
// ID
getDataId() {
let dataId = this.dataId;
// ID使ID
if (this.$route.params.id) {
dataId = this.$route.params.id;
}
return parseInt(dataId || 0);
return parseInt(dataId || 0); // ID
},
//
loadDetailData1({ params }) {
params.start_time = 0;
params.end_time = 0;
params.beid = this.getDataId();
params.start_time = 0; //
params.end_time = 0; //
params.beid = this.getDataId(); // ID
//
return this.$mk.getPagedData({ url: this.actions.serviceList, data: params });
},
//
back() {
//
if (!this.isEdit) {
this.$closePage({
closeRoute: "/BaseConfig/BaseConfigAdd"
});
} else {
//
this.$closePage({
closeRoute: "/BaseConfig/BaseConfigUpdate"
});
}
//
this.$openPage('/BaseConfig/BaseConfigList')
},
ok() {
//
ok() {
//
let save = () => {
// 使 使
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);
// BaseConfig
if (this.isEdit) {
postdata = { BaseConfig: postdata }
}
@ -290,18 +313,18 @@ export default {
url: action,
loading: "保存中...",
data: postdata,
}).then(() => {
}).then(() => { //
this.$mk.success("保存成功");
if (!this.isEdit) {
this.back();
}
}).catch((a) => {
}).catch((a) => { //
this.$mk.error(a.data.msg);
});
};
//
this.$refs.xForm.validate((a) => {
//
if (a) {
let count = 0;
for (let name in a) {
@ -310,59 +333,82 @@ export default {
}
this.$mk.error(`存在${count}项错误,请检查`);
} else {
//
save();
}
});
},
//
pageDel() {
//
let rows = this.$refs.gridService.getCheckboxRecords();
// ID
let ids = [];
//
rows.forEach((row) => {
// ID
ids.push(row[this.keyName]);
});
//
if (!ids.length) {
this.$mk.error("请选择行");
return;
}
//
this.$mk.confirm('您确定要移除服务吗?').then(type => {
//
if (type == 'confirm') {
//
this.$mk.post({
url: this.actions.serviceDel,
loading: "移除服务中...",
data: {
ids: ids
}
}).then(() => {
}).then(() => { //
this.$mk.success("移除服务成功");
//
this.$refs.gridService.commitProxy('query')
}).catch((a) => {
}).catch((a) => { //
this.$mk.error(a.data.msg);
});
}
});
},
//
pageAdd() {
//
this.$mk.dialog.open({
//
page: serviceListPage,
//
title: "选择要添加的服务",
//
pageMode: "select",
//
width: 1000,
//
height: 870,
// ID
dataId: 0,
//
callback: ({ data }) => {
//
if (!data || !data.length) {
return;
}
// ID
let ids = [];
//
data.forEach(item => {
ids.push(item.id)
})
//
this.$mk.post({
url: this.actions.serviceAdd,
loading: "添加中...",
@ -370,16 +416,18 @@ export default {
"beid": this.getDataId(),
"service_id": ids
},
}).then(() => {
}).then(() => { //
this.$mk.success("添加成功");
//
this.$refs.gridService.commitProxy('query')
}).catch((a) => {
}).catch((a) => { //
this.$mk.error(a.data.msg);
});
}
});
},
//
cancel() {
this.back();
}

View File

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

View File

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