Commit 255baf57 authored by 骆瑛's avatar 骆瑛

init-cache

parent 50175133
This diff is collapsed.
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12"
><FormItem :label="l('code')" prop="code">
<Input v-model="entity.code"> </Input> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('name')" prop="name">
<Input v-model="entity.name"> </Input> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('duration')" prop="duration">
<InputNumber v-model="entity.duration"></InputNumber> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('strategy')" prop="strategy">
<Dictionary
code="mes.cache_config.Strategy"
v-model="entity.strategy"
></Dictionary> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('type')" prop="type">
<Dictionary
code="mes.cache_config.Type"
v-model="entity.type"
></Dictionary> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('state')" prop="state">
<Dictionary
code="mes.cache_config.State"
v-model="entity.state"
></Dictionary> </FormItem
></Col>
<Col :span="24"
><FormItem :label="l('describe')" prop="describe">
<Input
v-model="entity.describe"
type="textarea"
:rows="5"
></Input> </FormItem
></Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled"
>保存</Button
>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
disabled: false,
entity: {
code: "",
name: "",
describe: "",
duration: null,
strategy: 0,
type: 0,
state: 0,
},
rules: {
code: [{ required: true, message: "必填", trigger: "blur" }],
name: [{ required: true, message: "必填", trigger: "blur" }],
duration: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: {
v: Object,
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.create(this.entity)
.then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.entity.id = 0;
});
},
l(key) {
key = "cache_config" + "." + key;
return this.$t(key);
},
},
watch: {
v() {
this.entity = this.$u.clone(this.v);
},
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
};
</script>
\ No newline at end of file
import Api from '@/plugins/request'
export default {
index: `${systemUrl}/cacheconfig/paged`,
paged(params) {
return Api.post(`${systemUrl}/cacheconfig/paged`, params);
},
get(params) {
return Api.get(`${systemUrl}/cacheconfig/get`, params);
},
create(params) {
return Api.post(`${systemUrl}/cacheconfig/create`, params);
},
update(params) {
return Api.post(`${systemUrl}/cacheconfig/update`, params);
},
delete(id) {
return Api.delete(`${systemUrl}/cacheconfig/delete`, { params: { id: id } });
},
deletes(params) {
return Api.post(`${systemUrl}/cacheconfig/batchdelete`, params);
},
clears(id) {
return Api.post(`${systemUrl}/cacheconfig/clear`, { "id": id });
},
allClears(params) {
return Api.post(`${systemUrl}/cacheconfig/batchclearcache`, params);
}
}
\ No newline at end of file
<template>
<div class="detail">
<Row>
<!-- <Filed :span="12" :name="l('creationTime')">{{
entity.creationTime
}}</Filed>
<Filed :span="12" :name="l('creatorUserId')">{{
entity.creatorUserId
}}</Filed>
<Filed :span="12" :name="l('lastModificationTime')">{{
entity.lastModificationTime
}}</Filed>
<Filed :span="12" :name="l('lastModifierUserId')">{{
entity.lastModifierUserId
}}</Filed>
<Filed :span="12" :name="l('isDeleted')">{{ entity.isDeleted }}</Filed>
<Filed :span="12" :name="l('deletionTime')">{{
entity.deletionTime
}}</Filed>
<Filed :span="12" :name="l('deleterUserId')">{{
entity.deleterUserId
}}</Filed> -->
<Filed :span="12" :name="l('code')">{{ entity.code }}</Filed>
<Filed :span="12" :name="l('name')">{{ entity.name }}</Filed>
<Filed :span="12" :name="l('duration')">{{ entity.duration }}</Filed>
<Filed :span="12" :name="l('strategy')">
<State code="mes.cache_config.Strategy" :value="entity.strategy" />
</Filed>
<Filed :span="12" :name="l('type')">
<State code="mes.cache_config.Type" :value="entity.type" />
</Filed>
<Filed :span="12" :name="l('state')">
<State code="mes.cache_config.State" :value="entity.state" />
</Filed>
<Filed :span="24" :name="l('size')">
{{ entity.size }}
<Button type="primary" v-if="entity.size > 0">清理缓存</Button>
</Filed>
<Filed :span="24" :name="l('describe')">{{ entity.describe }}</Filed>
</Row>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: {
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "cache_config" + "." + key;
return this.$t(key);
},
},
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
};
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12"
><FormItem :label="l('code')" prop="code">
<Input v-model="entity.code"> </Input> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('name')" prop="name">
<Input v-model="entity.name"> </Input> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('duration')" prop="duration">
<InputNumber v-model="entity.duration"></InputNumber> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('strategy')" prop="strategy">
<Dictionary
code="mes.cache_config.Strategy"
v-model="entity.strategy"
></Dictionary> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('type')" prop="type">
<Dictionary
code="mes.cache_config.Type"
v-model="entity.type"
></Dictionary> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('state')" prop="state">
<Dictionary
code="mes.cache_config.State"
v-model="entity.state"
></Dictionary> </FormItem
></Col>
<Col :span="24"
><FormItem :label="l('describe')" prop="describe">
<Input
v-model="entity.describe"
type="textarea"
:rows="5"
></Input> </FormItem
></Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled"
>保存</Button
>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Edit",
data() {
return {
disabled: false,
entity: {},
rules: {
code: [{ required: true, message: "必填", trigger: "blur" }],
name: [{ required: true, message: "必填", trigger: "blur" }],
duration: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: {
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
});
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.update(this.entity)
.then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "cache_config" + "." + key;
return this.$t(key);
},
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
},
},
};
</script>
\ No newline at end of file
<template>
<div>
<DataGrid
:columns="columns"
ref="grid"
:action="action"
@on-selection-change="selectInfo"
><template slot="easySearch"
><Form ref="formInline" :model="easySearch" inline
><FormItem prop="keys"
><Input
placeholder="请输入关键字名称"
v-model="easySearch.keys.value"
/>
</FormItem>
<FormItem
><Button type="primary" @click="search">查询</Button></FormItem
>
</Form></template
>
<template slot="searchForm">
<Search />
</template>
<template slot="batch">
<Button type="primary" @click="allClear">批量清理</Button>
</template>
<template slot="batch">
<Button type="primary" @click="inSure">确定</Button>
</template>
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal>
</div>
</template>
<script>
import Api from "./api";
import Search from "./search";
export default {
name: "list",
components: {
Search,
},
head: {
title: "",
author: "henq",
description: "cache_config 10/9/2020 2:37:46 PM",
},
data() {
return {
results: [],
selectList: [],
action: Api.index,
easySearch: {
keys: { op: "name", value: null },
},
modal: false,
title: "新增",
detail: null,
curId: 0,
columns: [
{
key: "id",
title: this.$t("id"),
hide: true,
align: "left",
high: true,
},
{
key: "selection",
width: 60,
align: "center",
type: "selection",
},
{
key: "name",
title: this.l("name"),
align: "left",
easy: true,
high: true,
render: (h, params) => {
return h("div", {
class: "action"
}, [
h(
"op", {
attrs: {
oprate: "detail"
},
on: {
click: () => this.view(params.row.id)
},
},
params.row.name
),
]);
},
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true,
},
// {
// key: "lastModificationTime",
// title: this.l("lastModificationTime"),
// align: "left",
// high: true,
// },
// {
// key: "lastModifierUserId",
// title: this.l("lastModifierUserId"),
// align: "left",
// high: true,
// },
// {
// key: "isDeleted",
// title: this.l("isDeleted"),
// align: "left",
// high: true,
// },
// {
// key: "deletionTime",
// title: this.l("deletionTime"),
// align: "left",
// high: true,
// },
// {
// key: "deleterUserId",
// title: this.l("deleterUserId"),
// align: "left",
// high: true,
// },
{ key: "code", title: this.l("code"), align: "left", high: true },
{
key: "duration",
title: this.l("duration"),
align: "left",
high: true,
},
{
key: "strategy",
title: this.l("strategy"),
align: "left",
high: true,
code: "mes.cache_config.Strategy",
},
{
key: "type",
title: this.l("type"),
align: "left",
high: true,
code: "mes.cache_config.Type",
},
{
key: "state",
title: this.l("state"),
align: "left",
high: true,
code: "mes.cache_config.State",
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "left",
high: true,
},
{
title: "操作",
key: "action",
width: 170,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.view(params.row.id) },
},
"查看"
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) },
},
"编辑"
),
h(
"op",
{
attrs: { oprate: "clears" },
on: { click: () => this.clears(params.row.id) },
},
"清理"
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) },
},
"删除"
),
]);
},
},
],
};
},
mounted() {
console.log(this);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = 0;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
},
// copy(id) {
// this.curId = id;
// this.title = "克隆";
// this.detail = () => import("./add");
// this.modal = true;
// },
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
clears(id) {
Api.clears(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("缓存已清除");
}
});
},
cancel() {
this.curId = 0;
this.modal = false;
},
l(key) {
/*
cache_config:{
creationTime:'创建时间',
creatorUserId:'创建人',
lastModificationTime:'更新时间',
lastModifierUserId:'更新人',
isDeleted:'删除人',
deletionTime:'删除时间',
deleterUserId:'删除人',
key:'键',
name:'名称',
describe:'描述',
duration:'缓存时长',
strategy:'策略',
type:'类型',
state:'状态',
}
*/
let vkey = "cache_config" + "." + key;
return this.$t(vkey) || key;
},
selectInfo(value) {
this.selectList = [];
this.selectList = value;
let statueArry = [];
value.forEach((data) => {
var that = this;
statueArry.push(data.id);
});
this.results = [];
this.results = statueArry;
},
inSure() {
Api.deletes(this.results).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$refs.grid.selectAll(false);
this.$Message.success("删除成功");
}
});
},
allClear() {
Api.allClears(this.results).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$refs.grid.selectAll(false);
this.$Message.success("缓存已清除");
}
});
},
},
};
</script>
<style lang="less">
</style>
\ No newline at end of file
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<Col :span="12" :v-if="condition.id.show"
><FormItem :label="$t('id')" prop="id">
<Input v-model="condition.id.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.creationTime.show"
><FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker
type="daterange"
v-model="condition.creationTime.value"
></DatePicker> </FormItem
></Col>
<Col :span="12" :v-if="condition.creatorUserId.show"
><FormItem :label="l('creatorUserId')" prop="creatorUserId">
<Input v-model="condition.creatorUserId.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.lastModificationTime.show"
><FormItem
:label="l('lastModificationTime')"
prop="lastModificationTime"
>
<DatePicker
type="daterange"
v-model="condition.lastModificationTime.value"
></DatePicker> </FormItem
></Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show"
><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<Input v-model="condition.lastModifierUserId.value">
</Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.deletionTime.show"
><FormItem :label="l('deletionTime')" prop="deletionTime">
<DatePicker
type="daterange"
v-model="condition.deletionTime.value"
></DatePicker> </FormItem
></Col>
<Col :span="12" :v-if="condition.key.show"
><FormItem :label="l('code')" prop="code">
<Input v-model="condition.code.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.name.show"
><FormItem :label="l('name')" prop="name">
<Input v-model="condition.name.value"> </Input> </FormItem
></Col>
<Col :span="24" :v-if="condition.describe.show"
><FormItem :label="l('describe')" prop="describe">
<Input v-model="condition.describe.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.duration.show"
><FormItem :label="l('duration')" prop="duration">
<Input v-model="condition.duration.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.strategy.show"
><FormItem :label="l('strategy')" prop="strategy">
<Dictionary
code="mes.cache_config.Strategy"
v-model="condition.strategy.value"
></Dictionary> </FormItem
></Col>
<Col :span="12" :v-if="condition.type.show"
><FormItem :label="l('type')" prop="type">
<Dictionary
code="mes.cache_config.Type"
v-model="condition.type.value"
></Dictionary> </FormItem
></Col>
<Col :span="12" :v-if="condition.state.show"
><FormItem :label="l('state')" prop="state">
<Dictionary
code="mes.cache_config.State"
v-model="condition.state.value"
></Dictionary> </FormItem
></Col>
</Row>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
condition: {
id: { op: "Equal", value: null, show: true },
creationTime: { op: "Range", value: null, show: true },
creatorUserId: { op: "Equal", value: null, show: true },
lastModificationTime: { op: "Range", value: null, show: true },
lastModifierUserId: { op: "Equal", value: null, show: true },
deletionTime: { op: "Range", value: null, show: true },
code: { op: "Equal", value: null, show: true },
name: { op: "Equal", value: null, show: true },
describe: { op: "Equal", value: null, show: true },
duration: { op: "Equal", value: null, show: true },
strategy: { op: "Equal", value: null, show: true },
type: { op: "Equal", value: null, show: true },
state: { op: "Equal", value: null, show: true },
},
};
},
methods: {
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "cache_config" + "." + key;
return this.$t(key);
},
},
};
</script>
\ No newline at end of file
...@@ -11,11 +11,11 @@ ...@@ -11,11 +11,11 @@
<Input v-model="entity.shiftName"></Input> <Input v-model="entity.shiftName"></Input>
</FormItem> </FormItem>
</Col> </Col>
<!-- <Col :span="24"> <Col :span="24">
<FormItem :label="l('shiftStartEnd')" prop="shiftStartEnd"> <FormItem :label="l('shiftStartEnd')" prop="shiftStartEnd">
<TimePicker format="HH:mm" v-model="entity.shiftStartEnd" type="timerange" placeholder="选择时间段" style="width: 130px"></TimePicker> <TimePicker format="HH:mm" v-model="entity.shiftStartEnd" type="timerange" placeholder="选择时间段" style="width: 130px"></TimePicker>
</FormItem> </FormItem>
</Col> --> </Col>
<Col :span="24"> <Col :span="24">
<FormItem :label="l('shiftStart')" prop="shiftStart"> <FormItem :label="l('shiftStart')" prop="shiftStart">
<TimePicker format="HH:mm" v-model="entity.shiftStart" placeholder="选择时间段" style="width: 130px"></TimePicker> <TimePicker format="HH:mm" v-model="entity.shiftStart" placeholder="选择时间段" style="width: 130px"></TimePicker>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment