更新
This commit is contained in:
28
acs/nladmin-ui/src/api/acs/history/udwData.js
Normal file
28
acs/nladmin-ui/src/api/acs/history/udwData.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function add(data) {
|
||||
return request({
|
||||
url: 'api/task',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function del(ids) {
|
||||
return request({
|
||||
url: 'api/task/',
|
||||
method: 'delete',
|
||||
data: ids
|
||||
})
|
||||
}
|
||||
|
||||
export function edit(data) {
|
||||
return request({
|
||||
url: 'api/task',
|
||||
method: 'put',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export default { edit, del }
|
||||
|
||||
191
acs/nladmin-ui/src/views/acs/history/udwData/index.vue
Normal file
191
acs/nladmin-ui/src/views/acs/history/udwData/index.vue
Normal file
@@ -0,0 +1,191 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<!--工具栏-->
|
||||
<div class="head-container">
|
||||
<div v-if="crud.props.searchToggle">
|
||||
<!-- 搜索 -->
|
||||
<el-select
|
||||
v-model="form.unified_key"
|
||||
placeholder="unified_key"
|
||||
class="filter-item"
|
||||
@change="crud.toQuery"
|
||||
clearable
|
||||
filterable
|
||||
size="small">
|
||||
<el-option v-for="(item,index) in unified_key" :key="index" :label="item.label" :value="item.value">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-input
|
||||
v-model="query.code"
|
||||
size="small"
|
||||
clearable
|
||||
placeholder="编号"
|
||||
style="width: 200px;"
|
||||
class="filter-item"
|
||||
@keyup.enter.native="crud.toQuery"
|
||||
/>
|
||||
</div>
|
||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||
<crudOperation :permission="permission" />
|
||||
<!--表单组件-->
|
||||
<el-dialog
|
||||
:close-on-click-modal="false"
|
||||
:before-close="crud.cancelCU"
|
||||
:visible.sync="crud.status.cu > 0"
|
||||
:title="crud.status.title"
|
||||
width="500px"
|
||||
>
|
||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||
<el-form-item label="unified_key">
|
||||
<el-input v-model="form.unified_key" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="编号">
|
||||
<el-input v-model="form.key" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<el-form-item label="值">
|
||||
<el-input v-model="form.value" style="width: 370px;" />
|
||||
</el-form-item>
|
||||
<!-- <el-form-item label="操作" prop="description">-->
|
||||
<!-- <el-input v-model="form.remark" style="width: 380px;" rows="5" type="textarea" />-->
|
||||
<!-- </el-form-item>-->
|
||||
</el-form>
|
||||
<div 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>
|
||||
<!--表格渲染-->
|
||||
<el-table
|
||||
ref="table"
|
||||
v-loading="crud.loading"
|
||||
:data="crud.data"
|
||||
size="small"
|
||||
style="width: 100%;"
|
||||
@selection-change="crud.selectionChangeHandler"
|
||||
>
|
||||
<el-table-column prop="unified_key" label="unified_key" />
|
||||
<el-table-column prop="key" label="编号" />
|
||||
<el-table-column prop="value" label="值" />
|
||||
<el-table-column
|
||||
v-permission="['admin','instruction:edit','instruction:del']"
|
||||
fixed="left"
|
||||
label="操作"
|
||||
width="150px"
|
||||
align="center"
|
||||
>
|
||||
<template slot-scope="scope">
|
||||
<el-dropdown trigger="click" @command="handleCommand">
|
||||
<span class="el-dropdown-link">
|
||||
<i class="el-icon-menu" />
|
||||
</span>
|
||||
<el-dropdown-menu slot="dropdown">
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'a')">完成</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'b')">取消</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'c')">强制取消</el-dropdown-item>
|
||||
<el-dropdown-item :command="beforeHandleCommand(scope.$index, scope.row,'d')">初始化</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</el-dropdown>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<!--分页组件-->
|
||||
<pagination />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pagination from '@crud/Pagination'
|
||||
import crudUdwData from '@/api/acs/history/udwData'
|
||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
||||
import crudOperation from '@crud/CRUD.operation'
|
||||
import { getDicts } from '@/api/system/dict'
|
||||
|
||||
const defaultForm = {
|
||||
unified_key: 'opc_value',
|
||||
key: null,
|
||||
value: null,
|
||||
last_modify_date: null
|
||||
}
|
||||
export default {
|
||||
dicts: [],
|
||||
name: 'UdwData',
|
||||
components: { pagination, crudOperation },
|
||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
||||
cruds() {
|
||||
return CRUD({
|
||||
title: '数据源',
|
||||
url: 'api/udw/',
|
||||
idField: 'key',
|
||||
sort: 'key',
|
||||
query: {},
|
||||
crudMethod: { ...crudUdwData },
|
||||
optShow: {
|
||||
}
|
||||
})
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
unified_key: [
|
||||
{
|
||||
value: '1',
|
||||
label: 'opc_value'
|
||||
},
|
||||
{
|
||||
value: '2',
|
||||
label: 'cached'
|
||||
},
|
||||
{
|
||||
value: '3',
|
||||
label: 'socket'
|
||||
}
|
||||
],
|
||||
permission: {
|
||||
},
|
||||
rules: {
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
getDicts().then(data => {
|
||||
this.dicts = data
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||
[CRUD.HOOK.beforeRefresh]() {
|
||||
return true
|
||||
},
|
||||
// https://www.cnblogs.com/jdWu-d/p/11898666.html
|
||||
beforeHandleCommand(index, row, command) {
|
||||
return {
|
||||
'index': index,
|
||||
'row': row,
|
||||
'command': command
|
||||
}
|
||||
},
|
||||
handleCommand(command) {
|
||||
switch (command.command) {
|
||||
case 'a':// 完成
|
||||
this.finish(command.index, command.row)
|
||||
break
|
||||
case 'b':// 取消
|
||||
this.cancel(command.index, command.row)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.el-dropdown-link {
|
||||
cursor: pointer;
|
||||
color: #409EFF;
|
||||
}
|
||||
|
||||
.el-icon-arrow-down {
|
||||
font-size: 12px;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user