Commit 13a4ce2e authored by zhengke's avatar zhengke

增加okr规则设置

parent ef9aec99
......@@ -22,5 +22,56 @@ export function SetOKRPeriodConfigInfo(data) {
method: 'post',
data
})
}
}
/**
* 获取规则分页列表
* @param {JSON参数} data
*/
export function GetOKRRulePageList(data) {
return request({
url: '/OKRPeriod/GetOKRRulePageList',
method: 'post',
data
})
}
/**
* 启用禁用删除规则状态
* @param {JSON参数} data
*/
export function SetOKRRuleState(data) {
return request({
url: '/OKRPeriod/SetOKRRuleState',
method: 'post',
data
})
}
/**
* 设置规则信息
* @param {JSON参数} data
*/
export function SetOKRRuleInfo(data) {
return request({
url: '/OKRPeriod/SetOKRRuleInfo',
method: 'post',
data
})
}
/**
* 获取规则枚举
* @param {JSON参数} data
*/
export function GetRuleTypeEnumList(data) {
return request({
url: '/OKRPeriod/GetRuleTypeEnumList',
method: 'post',
data
})
}
<template>
<q-dialog v-model="persistent" persistent content-class="bg-grey-1" transition-show="scale" transition-hide="scale">
<q-card style="width: 800px;max-width:800px;">
<q-card-section>
<div class="text-h6">{{(saveObj&&saveObj.Id>0)?"修改OKR规则模板":"新增OKR规则模板"}}</div>
</q-card-section>
<q-card-section class="q-pt-none scroll" style="max-height: 70vh">
<div class="row wrap">
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.RuleName" ref="RuleName"
class="col-6 q-pr-lg q-pb-lg" label="规则名称" :rules="[val => !!val || '请填写规则名称']" />
</div>
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.DataBase" ref="DataBase"
class="col-6 q-pb-lg" label="关联数据库" :rules="[val => !!val || '请填写关联数据库']" />
</div>
</div>
<div class="row wrap">
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.Table" ref="Table"
class="col-6 q-pr-lg q-pb-lg" label="关联表" :rules="[val => !!val || '请填写关联表']" />
</div>
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.Field" ref="Field"
class="col-6 q-pb-lg" label="关联字段" :rules="[val => !!val || '请填写关联字段']"/>
</div>
</div>
<div class="row wrap">
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.Identity" ref="Identity"
class="col-6 q-pr-lg q-pb-lg" label="身份字段" :rules="[val => !!val || '请填身份字段']" />
</div>
<div class="col-6">
<q-select filled stack-label option-value="Id" option-label="Name" v-model="msg.Way" ref="Way"
:options="EnumList" label="关机数据计算方式" :dense="false" :rules="[val => !!val || '请选择关机数据计算方式']" class="col-6 q-pb-lg" emit-value map-options />
</div>
</div>
<div class="row wrap">
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.Time" ref="Time"
class="col-6 q-pr-lg q-pb-lg" label="操作周期字段" :rules="[val => !!val || '请填写操作周期字段']" />
</div>
<div class="col-6">
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.State" ref="State"
class="col-6 q-pb-lg" label="状态字段" :rules="[val => !!val || '请输入状态字段']" />
</div>
</div>
<div class="row wrap">
<div class="col-12">
<q-input filled stack-label maxlength="20" :dense="false" v-model="msg.Remark" ref="Remark"
class="col-6 q-pb-lg" label="规则备注" />
</div>
</div>
<div class="row wrap">
<div class="col-6">
<q-toggle size="md" label="是否启用" color="primary" :false-value="2" :true-value="1" v-model="msg.Enable" />
</div>
</div>
</q-card-section>
<q-card-actions align="right" class="bg-white">
<q-btn label="取消" flat color="grey-10" style="font-weight:400 !important" @click="closeRuleForm" />
<q-btn label="保存" color="accent q-px-md" style="font-weight:400 !important" @click="saveRule" />
</q-card-actions>
</q-card>
</q-dialog>
</template>
<script>
import {
SetOKRRuleInfo,
GetRuleTypeEnumList
} from '../../api/okr/index'
export default {
props: {
saveObj: {
type: Object,
default: null
}
},
data() {
return {
msg: {
Id: 0,
RuleName: "", //规则名称
DataBase: '', //数据库
Table: '', //表名
Field: '', //统计字段
Way: '', //方式
State: '', //状态字段
Identity: '', //身份字段
Time: '', //操作时间
Remark: '', //备注
Enable: 1, //是否启用
},
persistent: true,
EnumList: [], //枚举数据
}
},
computed: {},
created() {},
mounted() {
if (this.saveObj && this.saveObj.Id > 0) {
this.msg.Id = this.saveObj.Id;
this.msg.RuleName = this.saveObj.RuleName;
this.msg.DataBase = this.saveObj.DataBase;
this.msg.Table = this.saveObj.Table;
this.msg.Field = this.saveObj.Field;
this.msg.Way = this.saveObj.Way;
this.msg.State = this.saveObj.State;
this.msg.Identity = this.saveObj.Identity;
this.msg.Time = this.saveObj.Time;
this.msg.Remark = this.saveObj.Remark;
this.msg.Enable = this.saveObj.Enable;
}
this.getRuleTypeEnumList();
},
methods: {
//保存信息
saveRule() {
this.$refs.RuleName.validate();
this.$refs.DataBase.validate();
this.$refs.Table.validate();
this.$refs.Field.validate();
this.$refs.State.validate();
this.$refs.Identity.validate();
this.$refs.Time.validate();
this.$refs.Way.validate();
if (!this.$refs.RuleName.hasError &&
!this.$refs.DataBase.hasError &&
!this.$refs.Table.hasError &&
!this.$refs.Field.hasError &&
!this.$refs.State.hasError &&
!this.$refs.Identity.hasError &&
!this.$refs.Time.hasError&&
!this.$refs.Way.hasError) {
SetOKRRuleInfo(this.msg).then(res => {
if (res.Code == 1) {
this.$emit('success');
this.closeRuleForm();
}
})
}
},
//获取规则方式枚举
getRuleTypeEnumList() {
GetRuleTypeEnumList({}).then(res => {
if (res.Code == 1) {
this.EnumList = res.Data;
}
})
},
//关闭窗口
closeRuleForm() {
this.$emit('close');
this.persistent = false
}
},
}
</script>
<template>
<div class="page-body">
<div class="page-search row items-center">
<div class="col row wrap q-mr-lg q-col-gutter-md">
<div class="col-3">
<q-input @change="research" clearable standout="bg-primary text-white" v-model="msg.RuleName" label="规则名称"
@clear="research" maxlength="20" />
</div>
</div>
</div>
<div class="page-content">
<q-table :pagination="msg" :loading="loading" no-data-label="暂无相关数据" flat class="sticky-column-table"
separator="none" :data="dataList" :columns="columns" row-key="name">
<template v-slot:top="props">
<div class="col-2 q-table__title">OKR规则模板</div>
<q-space />
<div class="page-option">
<q-btn color="accent" size="sm" class="q-mr-md" icon="add" @click="addModule(null)" label="新增模板" />
</div>
</template>
<template v-slot:bottom>
<q-pagination class="full-width justify-end" v-model="msg.PageIndex" color="primary" :max="pageCount"
:input="true" @input="changePage" />
</template>
<template v-slot:body-cell-optioned="props">
<q-td :props="props" style="width:200px;">
<q-btn flat size="xs" icon="edit" color="red" v-if="props.row.Enable==1" style="font-weight:400"
@click="getStart(props.row,2)" label="停用" />
<q-btn flat size="xs" icon="edit" color="secondary" v-if="props.row.Enable==2" style="font-weight:400"
@click="getStart(props.row,1)" label="启用" />
<q-btn flat size="xs" icon="edit" color="negative" style="font-weight:400" @click="delOkrModule(props.row)"
label="删除" />
<q-btn flat size="xs" icon="edit" color="accent" style="font-weight:400" @click="addModule(props.row)"
label="编辑" />
</q-btn>
</q-td>
</template>
</q-table>
<ruleseteditForm v-if="isShowsetForm" @close="closeruleset" :save-obj="ruleObj" @success="refreshRule">
</ruleseteditForm>
</div>
</div>
</template>
<script>
import {
GetOKRRulePageList,
SetOKRRuleState
} from '../../api/okr/index';
import ruleseteditForm from '../../components/okr/rulesetedit-form';
export default {
meta: {
title: "规则设置"
},
components: {
ruleseteditForm
},
data() {
return {
pageCount: 0,
msg: {
PageIndex: 1,
PageSize: 12,
rowsPerPage: 12,
RuleName: '', //规则名称
Enable: 0 //是否启用 1是 2否 0不限
},
loading: false,
isShowsetForm: false,
ruleObj: {}, //传入参数
columns: [{
name: 'RuleName',
label: '规则名称',
field: 'RuleName',
align: 'left'
},
{
name: 'DataBase',
label: '关联库',
field: 'DataBase',
align: 'left',
},
{
name: 'Table',
label: '关联表',
field: 'Table',
align: 'left',
},
{
name: 'Field',
label: '关键字段',
field: 'Field',
align: 'left'
},
{
name: 'Way',
label: '计算方式',
field: 'Way',
align: 'left'
},
{
name: 'Identity',
label: '身份字段',
field: 'Identity',
align: 'left'
},
{
name: 'Time',
label: '操作时间字段',
field: 'Time',
align: 'left'
},
{
name: 'Remark',
label: '规则备注',
field: 'Remark',
align: 'left'
},
{
name: 'optioned',
label: '操作',
field: 'QuestionId'
}
],
dataList: [],
}
},
created() {},
mounted() {
this.getList();
},
methods: {
changePage(val) {
this.msg.PageIndex = val;
this.getList();
},
//输入框改变
research() {
this.getList();
},
//获取数据
getList() {
GetOKRRulePageList(this.msg).then(res => {
if (res.Code == 1) {
this.dataList = res.Data.PageData;
this.pageCount = res.Data.PageCount;
}
})
},
//关闭弹窗
closeruleset() {
this.isShowsetForm = false;
},
//刷新列表
refreshRule() {
this.getList();
},
//1启用 2禁用 3删除
getStart(item, type) {
let msg = {
RuleId: item.Id,
Type: type
}
SetOKRRuleState(msg).then(res => {
if (res.Code == 1) {
this.getList();
}
})
},
//删除模板
delOkrModule(item) {
this.$q.dialog({
title: '提示信息',
message: '是否确定删除?',
cancel: true,
persistent: true,
ok: "确定",
cancel: "取消",
}).onOk(() => {
let msg = {
RuleId: item.Id,
Type: 3
}
SetOKRRuleState(msg).then(res => {
if (res.Code == 1) {
this.getList();
}
})
}).onCancel(() => {
});
},
//新增模板吧
addModule(obj) {
if (obj) {
this.ruleObj = obj
} else {
this.ruleObj = null
}
this.isShowsetForm = true
}
}
}
</script>
<style lang="sass">
@import url('~assets/css/table.sass')
</style>
......@@ -10,16 +10,19 @@
<q-tab :ripple="false" name="third" label="提醒设置" />
<q-tab :ripple="false" name="fourth" label="分数规则" />
</q-tabs>
<ruleset-form v-if="tabCheck=='first'"></ruleset-form>
<baseset-form v-if="tabCheck=='second'"></baseset-form>
</div>
</template>
<script>
import rulesetForm from '../../components/system/ruleset-form';
import basesetForm from '../../components/system/baseset-form';
export default {
meta: {
title: "OKR设置"
},
components: {
rulesetForm,
basesetForm
},
data() {
......
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