add:添加仓库策略
This commit is contained in:
@@ -0,0 +1,166 @@
|
||||
<template>
|
||||
<el-dialog
|
||||
:title="crud.status.title"
|
||||
append-to-body
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0 || crud.status.view > 0"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="mini" label-width="110px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="策略名称:" prop="strategy_name">
|
||||
<el-input v-model="form.strategy_name" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="策略类型:" prop="strategy_type">
|
||||
<el-select
|
||||
v-model="form.strategy_type"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in strategyTypeList"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="类处理类型:" prop="class_type">
|
||||
<el-select
|
||||
v-model="form.class_type"
|
||||
placeholder=""
|
||||
style="width: 200px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in classTypeList"
|
||||
:key="item.id"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="参数:" prop="param">
|
||||
<el-input v-model="form.param" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="策略编码:" prop="param">
|
||||
<el-input v-model="form.strategy_code" style="width: 200px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="描述:" prop="remark">
|
||||
<el-input v-model="form.remark" :rows="3" type="textarea" style="width: 560px;" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div v-show="crud.status.cu > 0" slot="footer" class="dialog-footer">
|
||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const defaultForm = {
|
||||
id: null,
|
||||
strategy_code: null,
|
||||
strategy_name: null,
|
||||
strategy_type: null,
|
||||
class_type: null,
|
||||
param: null,
|
||||
remark: null,
|
||||
is_used: null,
|
||||
ban: null,
|
||||
update_name: null,
|
||||
update_time: null,
|
||||
is_delete: null
|
||||
}
|
||||
import CRUD, { form, crud } from '@crud/crud'
|
||||
|
||||
export default {
|
||||
name: 'AddDialog',
|
||||
mixins: [form(defaultForm), crud()],
|
||||
props: {
|
||||
dialogShow: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
openParam: {
|
||||
type: Object
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
dialogShow: {
|
||||
handler(newValue, oldValue) {
|
||||
this.dialogVisible = newValue
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
strategyTypeList: [
|
||||
{ 'label': '入库', 'value': '1' },
|
||||
{ 'label': '出库', 'value': '2' },
|
||||
{ 'label': '通用', 'value': '3' }
|
||||
],
|
||||
classTypeList: [
|
||||
{ 'label': '实现类', 'value': '1' },
|
||||
{ 'label': '表达式', 'value': '2' },
|
||||
{ 'label': '脚本', 'value': '3' }
|
||||
],
|
||||
rules: {
|
||||
strategy_name: [
|
||||
{ required: true, message: '策略名称不能为空', trigger: 'blur' }
|
||||
],
|
||||
strategy_type: [
|
||||
{ required: true, message: '策略类型不能为空', trigger: 'blur' }
|
||||
],
|
||||
strategy_code: [
|
||||
{ required: true, message: '策略编码不能为空', trigger: 'blur' }
|
||||
],
|
||||
param: [
|
||||
{ required: true, message: '参数不能为空', trigger: 'blur' }
|
||||
],
|
||||
class_type: [
|
||||
{ required: true, message: '类处理类型不能为空', trigger: 'blur' }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleClose(done) {
|
||||
this.$confirm('确认关闭?')
|
||||
.then(_ => {
|
||||
done()
|
||||
})
|
||||
.catch(_ => {
|
||||
})
|
||||
},
|
||||
close() {
|
||||
this.form = []
|
||||
this.$emit('update:dialogShow', false)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
160
nladmin-ui/src/views/wms/decision_manage/sectStrategy/index.vue
Normal file
160
nladmin-ui/src/views/wms/decision_manage/sectStrategy/index.vue
Normal file
@@ -0,0 +1,160 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-form
|
||||
:inline="true"
|
||||
class="demo-form-inline"
|
||||
label-position="right"
|
||||
label-width="80px"
|
||||
label-suffix=":"
|
||||
>
|
||||
<el-form-item label="策略名称">
|
||||
<el-input
|
||||
v-model="query.strategy_name"
|
||||
clearable
|
||||
size="mini"
|
||||
placeholder="策略名称"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</el-form-item>
|
||||
<rrOperation />
|
||||
</el-form>
|
||||
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission"/>
|
||||
<!--表单组件-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="mini"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column label="策略类型" >
|
||||
<template slot-scope="scope">
|
||||
{{scope.row.ban?"系统策略":"自定义策略"}}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="strategy_name" label="策略名称" />
|
||||
<el-table-column prop="strategy_code" label="策略编码" />
|
||||
<el-table-column prop="strategy_type" label="决策类型" />
|
||||
<el-table-column prop="class_type" label="策略执行器" />
|
||||
<el-table-column prop="param" show-overflow-tooltip label="参数" />
|
||||
<el-table-column prop="remark" show-overflow-tooltip label="描述" />
|
||||
<el-table-column label="是否启用" align="center" prop="is_used">
|
||||
<template slot-scope="scope">
|
||||
<el-switch
|
||||
:value="scope.row.is_used"
|
||||
active-color="#409EFF"
|
||||
inactive-color="#F56C6C"
|
||||
@change="changeEnabled(scope.row, scope.row.is_used)"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="update_name" label="操作人" />
|
||||
<el-table-column min-width="160" prop="update_time" label="操作时间" />
|
||||
<el-table-column
|
||||
v-permission="[]"
|
||||
label="操作"
|
||||
width="120"
|
||||
align="center"
|
||||
fixed="right"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<udOperation
|
||||
:disabledDle="scope.row.ban"
|
||||
:disabledEdit="scope.row.ban"
|
||||
:data="scope.row"
|
||||
:permission="permission"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<pagination />
|
||||
</div>
|
||||
<AddDialog />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import crudStrategy from './strategy'
|
||||
import AddDialog from './AddDialog'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import rrOperation from '@crud/RR.operation'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import udOperation from '@crud/UD.operation'
|
||||
import pagination from '@crud/Pagination'
|
||||
|
||||
export default {
|
||||
name: 'Strategy',
|
||||
dicts: [],
|
||||
components: { pagination, crudOperation, rrOperation, udOperation, AddDialog },
|
||||
mixins: [presenter(), header(), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '策略管理',
|
||||
url: 'api/strategy',
|
||||
idField: 'id',
|
||||
sort: 'id,desc',
|
||||
crudMethod: { ...crudStrategy },
|
||||
optShow: {
|
||||
add: true,
|
||||
edit: false,
|
||||
del: false,
|
||||
download: false,
|
||||
reset: true
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
dialogVisible: false,
|
||||
permission: {},
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
format_is_used(is_used) {
|
||||
return is_used==true
|
||||
},
|
||||
changeEnabled(data, val) {
|
||||
let msg = '此操作将停用,是否继续!'
|
||||
if (val !== '1') {
|
||||
msg = '此操作将启用,是否继续!'
|
||||
}
|
||||
this.$confirm(msg, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
crudStrategy.changeActive(data).then(res => {
|
||||
this.crud.toQuery()
|
||||
this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
||||
}).catch(() => {
|
||||
data.is_used = !data.is_used
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.is-scrolling-none + .el-table__fixed-right {
|
||||
height: 100% !important;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,35 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/strategy',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/strategy/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/strategy',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function changeActive(data) {
|
||||
return request({
|
||||
url: 'api/strategy/changeActive',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { add, edit, del, changeActive }
|
||||
Reference in New Issue
Block a user