|
@@ -4,8 +4,9 @@ import { message, Divider, Popconfirm } from 'antd'
|
|
import { FilterTable } from 'wptpc-design'
|
|
import { FilterTable } from 'wptpc-design'
|
|
import s from './index.less'
|
|
import s from './index.less'
|
|
import Edit from './components/Edit'
|
|
import Edit from './components/Edit'
|
|
|
|
+import { dc } from '@/conf/config'
|
|
// const apiUrl = 'http://localhost:9090/dc/web/get-rule-list'
|
|
// const apiUrl = 'http://localhost:9090/dc/web/get-rule-list'
|
|
-const apiUrl = 'http://localhost:8080/dc/web/get-rule-list'
|
|
|
|
|
|
+const apiUrl = `${dc}/dc/web/get-rule-list`
|
|
|
|
|
|
@connect(({ loading }) => ({
|
|
@connect(({ loading }) => ({
|
|
// 添加或者编辑接口触发的loading属性,可以用于控制接口请求阶段让对话框的”确定“按钮不可点击
|
|
// 添加或者编辑接口触发的loading属性,可以用于控制接口请求阶段让对话框的”确定“按钮不可点击
|
|
@@ -49,7 +50,9 @@ class Index extends React.PureComponent {
|
|
{ title: '序号', dataIndex: 'id' },
|
|
{ title: '序号', dataIndex: 'id' },
|
|
{ title: '规则名', dataIndex: 'rule' },
|
|
{ title: '规则名', dataIndex: 'rule' },
|
|
{ title: '接口', dataIndex: 'url' },
|
|
{ title: '接口', dataIndex: 'url' },
|
|
- { title: '是否可以运行', dataIndex: 'status' },
|
|
|
|
|
|
+ { title: '是否可以运行', dataIndex: 'status',
|
|
|
|
+ render: (text) => text === 1 ? '可以运行':'禁止运行'
|
|
|
|
+ },
|
|
{ title: '描述', dataIndex: 'desc' },
|
|
{ title: '描述', dataIndex: 'desc' },
|
|
// { title: '创建时间', dataIndex: 'createTime' },
|
|
// { title: '创建时间', dataIndex: 'createTime' },
|
|
// { title: '更新时间', dataIndex: 'modifyTime' },
|
|
// { title: '更新时间', dataIndex: 'modifyTime' },
|
|
@@ -61,6 +64,10 @@ class Index extends React.PureComponent {
|
|
title="确定删除"
|
|
title="确定删除"
|
|
onConfirm={() => this.delItem(record)}>
|
|
onConfirm={() => this.delItem(record)}>
|
|
<a>删除</a>
|
|
<a>删除</a>
|
|
|
|
+ </Popconfirm><Divider type="vertical" /><Popconfirm
|
|
|
|
+ title="确定执行"
|
|
|
|
+ onConfirm={() => this.execItem(record)}>
|
|
|
|
+ <a>执行</a>
|
|
</Popconfirm></span>
|
|
</Popconfirm></span>
|
|
}
|
|
}
|
|
],
|
|
],
|
|
@@ -88,13 +95,27 @@ class Index extends React.PureComponent {
|
|
const { code } = res || {}
|
|
const { code } = res || {}
|
|
if (code === 0) {
|
|
if (code === 0) {
|
|
message.success('删除成功')
|
|
message.success('删除成功')
|
|
- this.setState({ showModal: false })
|
|
|
|
this.refresh()
|
|
this.refresh()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ execItem ({ id }) {
|
|
|
|
+ this.props.dispatch({
|
|
|
|
+ type: 'template/_execItem',
|
|
|
|
+ payload: { id },
|
|
|
|
+ callback: res => {
|
|
|
|
+ const { code } = res || {}
|
|
|
|
+ if (code === 0) {
|
|
|
|
+ message.success('执行成功')
|
|
|
|
+ this.refresh()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
// 点击新建、编辑对话框的取消按钮的事件处理函数
|
|
// 点击新建、编辑对话框的取消按钮的事件处理函数
|
|
onModalCancel = () => {
|
|
onModalCancel = () => {
|
|
this.setState({ showModal: false })
|
|
this.setState({ showModal: false })
|
|
@@ -113,8 +134,11 @@ class Index extends React.PureComponent {
|
|
t[key] = {
|
|
t[key] = {
|
|
desc, column
|
|
desc, column
|
|
}
|
|
}
|
|
|
|
+ return t;
|
|
}, {})
|
|
}, {})
|
|
|
|
+ console.log(fieldsJson,1)
|
|
params.fieldsJson = JSON.stringify(fieldsJson)
|
|
params.fieldsJson = JSON.stringify(fieldsJson)
|
|
|
|
+ console.log(params,2)
|
|
const type = !params.id ? 'template/_addItem' : 'template/_editItem'
|
|
const type = !params.id ? 'template/_addItem' : 'template/_editItem'
|
|
this.props.dispatch({
|
|
this.props.dispatch({
|
|
type,
|
|
type,
|
|
@@ -122,7 +146,7 @@ class Index extends React.PureComponent {
|
|
callback: res => {
|
|
callback: res => {
|
|
const { code } = res || {}
|
|
const { code } = res || {}
|
|
if (code === 0) {
|
|
if (code === 0) {
|
|
- const msg = params.id ? '编辑用户成功' : '添加用户成功'
|
|
|
|
|
|
+ const msg = params.id ? '编辑成功' : '添加成功'
|
|
message.success(msg)
|
|
message.success(msg)
|
|
this.setState({ showModal: false })
|
|
this.setState({ showModal: false })
|
|
this.refresh()
|
|
this.refresh()
|