168 lines
4.7 KiB
Vue
168 lines
4.7 KiB
Vue
<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.sect_code"
|
||
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 prop="sect_code" label="库区名称" />
|
||
<el-table-column prop="strategy_type" label="策略类型">
|
||
<template slot-scope="scope">
|
||
{{ scope.row.strategy_type == '1'?'入库策略':'出库策略' }}
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="strategy" label="策略列表" width="460">
|
||
<template slot-scope="scope">
|
||
<el-select
|
||
v-model="scope.row.strategy"
|
||
disabled
|
||
style="width: 400px"
|
||
multiple
|
||
placeholder=""
|
||
>
|
||
<el-option
|
||
v-for="item in tableEnum.st_strategy_config"
|
||
:key="item.id"
|
||
:label="item.label"
|
||
:value="item.value"
|
||
/>
|
||
</el-select>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column prop="description" label="描述" />
|
||
<el-table-column prop="update_name" label="操作人" />
|
||
<el-table-column prop="update_time" label="操作时间" />
|
||
<el-table-column
|
||
v-permission="[]"
|
||
label="操作"
|
||
width="120"
|
||
align="center"
|
||
fixed="right"
|
||
>
|
||
<template slot-scope="scope">
|
||
<udOperation
|
||
:disabled-dle="scope.row.ban"
|
||
:disabled-edit="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: 'SectStrategy',
|
||
tableEnums: ['st_strategy_config#strategy_name#strategy_code'],
|
||
components: { pagination, crudOperation, rrOperation, udOperation, AddDialog },
|
||
mixins: [presenter(), header(), crud()],
|
||
cruds() {
|
||
return CRUD({
|
||
title: '策略管理',
|
||
url: 'api/sectStrategy',
|
||
idField: 'id',
|
||
sort: 'id,desc',
|
||
crudMethod: { ...crudStrategy },
|
||
optShow: {
|
||
add: true,
|
||
edit: false,
|
||
del: false,
|
||
download: false,
|
||
reset: true
|
||
}
|
||
})
|
||
},
|
||
data() {
|
||
return {
|
||
strategyTypeList: [
|
||
{ 'label': '入库', 'value': '1' },
|
||
{ 'label': '出库', 'value': '2' }
|
||
],
|
||
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>
|