Commit 03e64d05 authored by 李苏's avatar 李苏 💬

风险设置

parent c505bc8e
...@@ -37,3 +37,31 @@ export function doQueryDetail(query) { ...@@ -37,3 +37,31 @@ export function doQueryDetail(query) {
data: query||{} data: query||{}
}) })
} }
/* 启动 */
export function start(query) {
return request({
url: `aqgl/fxyk/fxsz/start/${query}`,
method: 'post',
data: {}
})
}
/* 停止 */
export function stop(query) {
return request({
url: `aqgl/fxyk/fxsz/stop/${query}`,
method: 'post',
data:{}
})
}
/* 立即执行 */
export function excute(query) {
return request({
url: `aqgl/fxyk/fxsz/execute/${query}`,
method: 'post',
data:{}
})
}
<template> <template>
<RelDialog :type='type' :editApp='editApp' :app='app' :buttonApp='buttonApp'> <RelDialog :type='type' :editApp='editApp' :app='app' :buttonApp='buttonApp'>
<!-- 填写表单内容,slot=form必写--> <!-- 填写表单内容,slot=form必写-->
<el-form style="height: 60vh;overflow: auto;overflow-x:hidden;padding-right: 10px;" slot="form" ref="form" :model="form" label-width="100px" :rules="rules"> <el-form style="height: 60vh;overflow: auto;overflow-x:hidden;padding-right: 30px;" slot="form" ref="form" :model="form" label-width="100px" :rules="rules">
<Selecter v-if="showDialog" :app='this' ></Selecter> <Selecter v-if="showDialog" :app='this' ></Selecter>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="24"> <el-col :span="24">
...@@ -47,12 +47,15 @@ ...@@ -47,12 +47,15 @@
<el-date-picker :readonly="readonly" style="width: 100%;" value-format='timestamp' type="datetime" v-model="form.begintime" ></el-date-picker> <el-date-picker :readonly="readonly" style="width: 100%;" value-format='timestamp' type="datetime" v-model="form.begintime" ></el-date-picker>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-show="form.jldw&&form.jldw=='year'" :span="12"> <!-- 重写-->
<!-- -->
<!-- <el-col v-show="form.jldw&&form.jldw=='year'" :span="4">
<el-form-item label="每几年" ref="year" prop="year"> <el-form-item label="每几年" ref="year" prop="year">
<el-input v-model="form.year" type="number"></el-input> <el-input v-model="form.year" type="number"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year')" :span="12"> <el-col v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year')" :span="4">
<el-form-item label="月份" ref="month" prop="month"> <el-form-item label="月份" ref="month" prop="month">
<el-select style="width: 100%;" v-model="form.month" placeholder="请选择"> <el-select style="width: 100%;" v-model="form.month" placeholder="请选择">
<el-option <el-option
...@@ -69,7 +72,7 @@ ...@@ -69,7 +72,7 @@
<el-input v-model="form.week" type="number"></el-input> <el-input v-model="form.week" type="number"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12" v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='day')" > <el-col :span="4" v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='day')" >
<el-form-item label="日" ref="day" prop="day"> <el-form-item label="日" ref="day" prop="day">
<el-select :readonly="readonly" style="width: 100%;" v-model="form.day" placeholder="请选择"> <el-select :readonly="readonly" style="width: 100%;" v-model="form.day" placeholder="请选择">
<el-option <el-option
...@@ -79,28 +82,56 @@ ...@@ -79,28 +82,56 @@
:value="item"> :value="item">
</el-option> </el-option>
</el-select> </el-select>
<!-- <el-input v-model="form.day" type="number"></el-input> -->
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='hour'||form.jldw=='day')" :span="12"> <el-col v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='hour'||form.jldw=='day')" :span="4">
<el-form-item label="时" ref="hour" prop="hour"> <el-form-item label="时" ref="hour" prop="hour">
<el-input v-model="form.hour" type="number"></el-input> <el-input v-model="form.hour" type="number"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='minute'||form.jldw=='day')" :span="12"> <el-col v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='minute'||form.jldw=='day')" :span="4">
<el-form-item label="分" ref="minute" prop="minute"> <el-form-item label="分" ref="minute" prop="minute">
<el-input v-model="form.minute" type="number"></el-input> <el-input v-model="form.minute" type="number"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='second'||form.jldw=='day')" :span="12"> <el-col v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='second'||form.jldw=='day')" :span="4">
<el-form-item label="秒" ref="second" prop="second"> <el-form-item label="秒" ref="second" prop="second">
<el-input v-model="form.second" type="number"></el-input> <el-input v-model="form.second" type="number"></el-input>
</el-form-item> </el-form-item>
</el-col> </el-col> -->
</el-row>
<el-row :gutter="20" style="height: 60px;padding-left: 100px;" >
<el-col :span="24" style="display: flex;line-height: 30px;"><span v-show="form.jldw&&form.jldw!='once'" ></span>
<div style="width: 80px;display: flex;" v-show="form.jldw&&form.jldw=='year'" ><el-input v-model="form.year" type="number"></el-input><span></span> </div>
<div style="width: 100px;display: flex;" v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year')" >
<el-select style="width: 100%;" v-model="form.month" placeholder="请选择">
<el-option
v-for="item in 12"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select><span></span></div>
<div style="width: 80px;display: flex;" v-show="form.jldw&&form.jldw=='week'" ><el-input v-model="form.week" type="number"></el-input><span></span></div>
<div style="width:100px;display: flex;" v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='day')" ><el-select :readonly="readonly" style="width: 100%;" v-model="form.day" placeholder="请选择">
<el-option
v-for="item in days"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select><span></span></div>
<div style="width: 80px;display: flex;" v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='hour'||form.jldw=='day')" > <el-input @input="numberChange(arguments[0],24,'hour')"
@change="numberChange(arguments[0],24,'hour')" v-model="form.hour" type="number"></el-input><span></span></div>
<div style="width: 80px;display: flex;" v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='minute'||form.jldw=='day')" ><el-input @input="numberChange(arguments[0],59,'minute')"
@change="numberChange(arguments[0],59,'minute')" v-model="form.minute" type="number"></el-input><span></span></div>
<div style="width: 80px;display: flex;" v-show="form.jldw&&(form.jldw=='month'||form.jldw=='year'||form.jldw=='week'||form.jldw=='second'||form.jldw=='day')" ><el-input @input="numberChange(arguments[0],59,'second')"
@change="numberChange(arguments[0],59,'second')"v-model="form.second" type="number"></el-input><span></span></div>
</el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-form-item label="" ref="year" prop="year" > <el-form-item label="" ref="year" prop="year" >
<div style="height: 200px;"> <div style="height: 300px;border: 1px solid #eee;border-top: 0px;">
<div style="display: flex;transform: translateY(-10px);"> <div style="display: flex;transform: translateY(-10px);">
<el-button @click.native='showDialog=true' size='mini' type="primary">添加指标</el-button> <el-button @click.native='showDialog=true' size='mini' type="primary">添加指标</el-button>
</div> </div>
...@@ -227,6 +258,22 @@ ...@@ -227,6 +258,22 @@
} }
}, },
methods: { methods: {
numberChange (val,maxNum,str) {
//转换数字类型
this.form[str] = Number(val)
//重新渲染
this.$nextTick(()=>{
//比较输入的值和最大值,返回小的
let num = Math.min(Number(val),maxNum)
//输入负值的情况下, = 0(可根据实际需求更该)
if(num<0) {
this.form[str] = 0
}else {
//反之
this.form[str] = num
}
})
},
jcrSelected(row){ jcrSelected(row){
console.log(row) console.log(row)
this.form.jcrid=row.id this.form.jcrid=row.id
...@@ -237,5 +284,8 @@ ...@@ -237,5 +284,8 @@
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
span{
padding-left: 5px;padding-right: 5px;font-size: 12px;
}
</style> </style>
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
<AttachFileButton :app='app'></AttachFileButton> <AttachFileButton :app='app'></AttachFileButton>
<!-- <FieldButton :app='app'></FieldButton> <!-- <FieldButton :app='app'></FieldButton>
<ExcelButton :app='app'></ExcelButton> --> <ExcelButton :app='app'></ExcelButton> -->
<el-button @click="doStart" size='mini'type="primary">启动</el-button>
<el-button @click="doStop" size='mini' type="primary">停止</el-button>
<el-button @click="doExcute" size='mini' type="primary">立即执行</el-button>
<!-- 额外按钮--> <!-- 额外按钮-->
</el-row> </el-row>
<!-- 表格--> <!-- 表格-->
...@@ -42,7 +45,10 @@ ...@@ -42,7 +45,10 @@
doAdd, doAdd,
doUpdate, doUpdate,
doDelete, doDelete,
doQueryDetail doQueryDetail,
start,
stop,
excute
} from '@/api/riskPrecontrol/riskSet'; } from '@/api/riskPrecontrol/riskSet';
/* edit页面*/ /* edit页面*/
import Edit from './edit' import Edit from './edit'
...@@ -90,7 +96,39 @@ ...@@ -90,7 +96,39 @@
} }
}, },
methods: { methods: {
doStart(){
if (this.app.selectOne || this.app.clickOne) {
this.singleItem.id&&start(this.singleItem.id).then(e=>{
if(e.success){
this.$success('操作成功')
}
})
} else {
this.$warning('请选中一行操作');
}
},
doStop(){
if (this.app.selectOne || this.app.clickOne) {
this.singleItem.id&&stop(this.singleItem.id).then(e=>{
if(e.success){
this.$success('操作成功')
}
})
} else {
this.$warning('请选中一行操作');
}
},
doExcute(){
if (this.app.selectOne || this.app.clickOne) {
this.singleItem.id&&excute(this.singleItem.id).then(e=>{
if(e.success){
this.$success('操作成功')
}
})
} else {
this.$warning('请选中一行操作');
}
},
query: doQuery, query: doQuery,
/* 基础增*/ /* 基础增*/
......
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