JiaoLM
2 years ago
1 changed files with 514 additions and 74 deletions
@ -1,115 +1,555 @@ |
|||
<template> |
|||
<div class="app-container"> |
|||
<!--工具栏--> |
|||
<div class="head-container"> |
|||
<Search/> |
|||
<crudOperation> |
|||
<el-button |
|||
slot="left" |
|||
<div v-if="crud.props.searchToggle"> |
|||
<!-- 搜索 --> |
|||
<el-input |
|||
v-model="query.task_code" |
|||
size="small" |
|||
clearable |
|||
placeholder="输入任务号" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
type="danger" |
|||
icon="el-icon-delete" |
|||
size="mini" |
|||
:loading="crud.delAllLoading" |
|||
@click="confirmDelAll()" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
<el-input |
|||
v-if="false" |
|||
v-model="query.is_over" |
|||
value="1" |
|||
size="small" |
|||
clearable |
|||
placeholder="输入任务号" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
<el-input |
|||
v-model="query.vehicle_code" |
|||
size="small" |
|||
clearable |
|||
placeholder="输入载具号" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
<el-select |
|||
v-model="query.material_type" |
|||
clearable |
|||
filterable |
|||
size="small" |
|||
placeholder="物料类型" |
|||
class="filter-item" |
|||
style="width: 190px" |
|||
@change="crud.toQuery" |
|||
> |
|||
清空 |
|||
</el-button> |
|||
</crudOperation> |
|||
<el-option v-for="item in materialList" :key="item.id" :label="item.label" :value="item.value" /> |
|||
</el-select> |
|||
<el-select |
|||
v-model="query.status" |
|||
clearable |
|||
filterable |
|||
size="small" |
|||
placeholder="任务状态" |
|||
class="filter-item" |
|||
style="width: 190px" |
|||
@change="crud.toQuery" |
|||
> |
|||
<el-option v-for="item in dict.task_status" :key="item.id" :label="item.label" :value="item.value" /> |
|||
</el-select> |
|||
<el-input |
|||
v-model="query.point_code" |
|||
size="small" |
|||
clearable |
|||
placeholder="输入起点或终点" |
|||
style="width: 200px;" |
|||
class="filter-item" |
|||
@keyup.enter.native="crud.toQuery" |
|||
/> |
|||
<Search /> |
|||
</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 v-if="false" label="任务标识" prop="task_id"> |
|||
<el-input v-model="form.task_id" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="物料类型"> |
|||
<el-select |
|||
v-model="form.material" |
|||
style="width: 370px;" |
|||
filterable |
|||
placeholder="请选择" |
|||
> |
|||
<el-option |
|||
v-for="item in dict.material_type" |
|||
:key="item.id" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="路由方案"> |
|||
<el-select |
|||
v-model="form.route_plan_code" |
|||
style="width: 370px;" |
|||
filterable |
|||
placeholder="请选择" |
|||
default-first-option |
|||
> |
|||
<el-option |
|||
v-for="item in routeList" |
|||
:key="item.plan_code" |
|||
:label="item.plan_name" |
|||
:value="item.plan_code" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="起点" prop="start_point_code"> |
|||
<el-select |
|||
v-model="form.start_point_code" |
|||
style="width: 370px;" |
|||
filterable |
|||
placeholder="请选择" |
|||
@change="showStartStorage" |
|||
> |
|||
<el-option |
|||
v-for="item in deviceList" |
|||
:key="item.device_code" |
|||
:label="item.device_name" |
|||
:value="item.device_code" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item v-show="start_flag" label="起点-列" prop="from_y"> |
|||
<el-select |
|||
v-model="form.from_y" |
|||
style="width: 370px;" |
|||
filterable |
|||
placeholder="请选择" |
|||
> |
|||
<el-option |
|||
v-for="item in fromYList" |
|||
:key="item.id" |
|||
:label="item.value" |
|||
:value="item.id" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item v-show="start_flag" label="起点-层" prop="from_z"> |
|||
<el-select |
|||
v-model="form.from_z" |
|||
style="width: 370px;" |
|||
filterable |
|||
placeholder="请选择" |
|||
> |
|||
<el-option |
|||
v-for="item in fromZList" |
|||
:key="item.id" |
|||
:label="item.value" |
|||
:value="item.id" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="终点" prop="next_point_code"> |
|||
<el-select |
|||
v-model="form.next_point_code" |
|||
style="width: 370px;" |
|||
filterable |
|||
placeholder="请选择" |
|||
@change="showEndStorage" |
|||
> |
|||
<el-option |
|||
v-for="item in deviceList" |
|||
:key="item.device_code" |
|||
:label="item.device_name" |
|||
:value="item.device_code" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item v-show="end_flag" label="终点-列" prop="to_y"> |
|||
<el-select |
|||
v-model="form.to_y" |
|||
style="width: 370px;" |
|||
filterable |
|||
placeholder="请选择" |
|||
> |
|||
<el-option |
|||
v-for="item in toYList" |
|||
:key="item.id" |
|||
:label="item.value" |
|||
:value="item.id" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item v-show="end_flag" label="终点-层" prop="to_z"> |
|||
<el-select |
|||
v-model="form.to_z" |
|||
style="width: 370px;" |
|||
filterable |
|||
placeholder="请选择" |
|||
> |
|||
<el-option |
|||
v-for="item in toZList" |
|||
:key="item.id" |
|||
:label="item.value" |
|||
:value="item.id" |
|||
/> |
|||
</el-select> |
|||
</el-form-item> |
|||
<el-form-item label="优先级"> |
|||
<el-input v-model="form.priority" style="width: 370px;" /> |
|||
</el-form-item> |
|||
<el-form-item label="载具号"> |
|||
<el-input v-model="form.vehicle_code" 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 v-if="false" prop="task_id" label="任务标识" /> |
|||
<el-table-column prop="task_code" label="任务号" /> |
|||
<el-table-column prop="vehicle_code" label="载具号" /> |
|||
<el-table-column prop="task_status" label="任务状态"> |
|||
<template slot-scope="scope"> |
|||
<span v-if="scope.row.task_status=='0' ">就绪</span> |
|||
<span v-if="scope.row.task_status=='1' ">执行中</span> |
|||
<span v-if="scope.row.task_status=='2' ">完成</span> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column prop="priority" label="任务优先级" /> |
|||
<el-table-column prop="start_point_code" label="起点" /> |
|||
<el-table-column prop="next_point_code" label="终点" /> |
|||
<el-table-column prop="matarial" label="物料" /> |
|||
<el-table-column prop="quantity" label="数量" /> |
|||
<el-table-column prop="remark" label="备注" /> |
|||
<el-table-column prop="create_by" label="创建者" /> |
|||
<el-table-column prop="create_time" label="创建时间" width="135" /> |
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination /> |
|||
</div> |
|||
<!--表格渲染--> |
|||
<el-table |
|||
ref="table" |
|||
v-loading="crud.loading" |
|||
:data="crud.data" |
|||
style="width: 100%;" |
|||
@selection-change="crud.selectionChangeHandler" |
|||
> |
|||
<el-table-column type="selection" width="55"/> |
|||
<el-table-column v-if="false" prop="id" label="id"/> |
|||
<el-table-column prop="resource_name" label="资源号"/> |
|||
<el-table-column prop="create_datetime" label="创建时间"/> |
|||
<el-table-column prop="content" label="内容详情"/> |
|||
|
|||
</el-table> |
|||
<!--分页组件--> |
|||
<pagination/> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import Search from './search' |
|||
import CRUD, { crud, header, presenter } from '@crud/crud' |
|||
import Search from '@/views/monitor/lucene/time' |
|||
import crudTask from '@/views/monitor/lucene/api/lucene' |
|||
import CRUD, { crud, form, header, presenter } from '@crud/crud' |
|||
import crudOperation from '@crud/CRUD.operation' |
|||
import pagination from '@crud/Pagination' |
|||
import { delAll } from '@/api/acs/lucene/log' |
|||
import deviceCrud from '@/api/acs/device/device' |
|||
import routeCurd from '@/api/acs/route/routePlan' |
|||
import { getDicts } from '@/api/system/dict' |
|||
|
|||
const start = new Date() |
|||
const defaultForm = { |
|||
task_id: null, |
|||
vehicle_code: null, |
|||
vehicle_type: null, |
|||
task_type: null, |
|||
task_status: null, |
|||
priority: 0, |
|||
start_point_code: null, |
|||
start_device_code: null, |
|||
next_point_code: null, |
|||
remark: null, |
|||
material: null, |
|||
route_plan_code: 'normal', |
|||
from_x: null, |
|||
from_y: null, |
|||
from_z: null, |
|||
to_x: null, |
|||
to_y: null, |
|||
to_z: null |
|||
} |
|||
export default { |
|||
name: 'LuceneLog', |
|||
components: { Search, pagination, crudOperation }, |
|||
mixins: [presenter(), header(), crud()], |
|||
name: 'Task', |
|||
components: { pagination, crudOperation, Search }, |
|||
dicts: ['task_status'], |
|||
mixins: [presenter(), header(), form(defaultForm), crud()], |
|||
cruds() { |
|||
return CRUD({ |
|||
title: '系统参数', url: 'api/lucene', idField: 'id', sort: 'id,desc', |
|||
queryOnPresenterCreated: true, |
|||
optShow: { |
|||
add: false, |
|||
edit: false, |
|||
del: false, |
|||
download: false |
|||
}, |
|||
page: { |
|||
size: 40, |
|||
total: 0, |
|||
page: 0 |
|||
}, |
|||
query: { |
|||
createTime: [start.setTime(start.getTime() - 3600 * 1000 * 0.5), new Date()] |
|||
} |
|||
title: '任务', |
|||
url: 'api/lucene//getAll', |
|||
idField: 'task_id', |
|||
sort: 'task_id,desc', |
|||
query: { is_over: '1' }, |
|||
crudMethod: { ...crudTask }, |
|||
optShow: {} |
|||
}) |
|||
}, |
|||
data() { |
|||
const checkFromY = (rule, value, callback) => { |
|||
if (this.start_flag) { |
|||
if (!value) { |
|||
callback(new Error('请选择起点-列!')) |
|||
} else { |
|||
callback() |
|||
} |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
const checkFromZ = (rule, value, callback) => { |
|||
if (this.start_flag) { |
|||
if (!value) { |
|||
callback(new Error('请选择起点-层!')) |
|||
} else { |
|||
callback() |
|||
} |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
const checkToY = (rule, value, callback) => { |
|||
if (this.end_flag) { |
|||
if (!value) { |
|||
callback(new Error('请选择终点-列!')) |
|||
} else { |
|||
callback() |
|||
} |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
const checkToZ = (rule, value, callback) => { |
|||
if (this.end_flag) { |
|||
if (!value) { |
|||
callback(new Error('请选择终点-列!')) |
|||
} else { |
|||
callback() |
|||
} |
|||
} else { |
|||
callback() |
|||
} |
|||
} |
|||
return { |
|||
query: { blurry: '123' }, |
|||
deviceList: [], |
|||
materialList: [], |
|||
statusList: [], |
|||
routeList: [], |
|||
fromYList: [], |
|||
fromZList: [], |
|||
toYList: [], |
|||
toZList: [], |
|||
start_flag: false, |
|||
end_flag: false, |
|||
permission: { |
|||
add: ['admin', 'param:add'], |
|||
edit: ['admin', 'param:edit'], |
|||
del: ['admin', 'param:del'] |
|||
add: ['admin', 'task:add'], |
|||
edit: ['admin', 'task:edit'], |
|||
del: ['admin', 'task:del'] |
|||
}, |
|||
|
|||
rules: {} |
|||
rules: { |
|||
start_point_code: [ |
|||
{ required: true, message: '起点不能为空', trigger: 'change' } |
|||
], |
|||
next_point_code: [ |
|||
{ required: true, message: '终点不能为空', trigger: 'change' } |
|||
], |
|||
from_y: [ |
|||
{ validator: checkFromY, trigger: 'change' } |
|||
], |
|||
from_z: [ |
|||
{ validator: checkFromZ, trigger: 'change' } |
|||
], |
|||
to_y: [ |
|||
{ validator: checkToY, trigger: 'change' } |
|||
], |
|||
to_z: [ |
|||
{ validator: checkToZ, trigger: 'change' } |
|||
] |
|||
} |
|||
} |
|||
}, |
|||
watch: { |
|||
rangeDate: function(newVal, oldVal) { |
|||
if (newVal !== null) { |
|||
this.tableParams.beginDate = newVal[0] |
|||
this.tableParams.endDate = newVal[1] |
|||
} else { |
|||
this.tableParams.beginDate = null |
|||
this.tableParams.endDate = null |
|||
} |
|||
} |
|||
}, |
|||
created() { |
|||
deviceCrud.selectDeviceList().then(data => { |
|||
this.deviceList = data |
|||
}) |
|||
routeCurd.selectList().then(data => { |
|||
this.routeList = data |
|||
}) |
|||
getDicts().then(data => { |
|||
this.dicts = data |
|||
}) |
|||
this.query.a = 111 |
|||
}, |
|||
methods: { |
|||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
|||
[CRUD.HOOK.beforeRefresh]() { |
|||
return true |
|||
}, |
|||
confirmDelAll() { |
|||
this.$confirm(`确认清空所有操作日志吗?`, '提示', { |
|||
confirmButtonText: '确定', |
|||
cancelButtonText: '取消', |
|||
type: 'warning' |
|||
}).then(() => { |
|||
this.crud.delAllLoading = true |
|||
delAll('device_execute').then(res => { |
|||
this.crud.delAllLoading = false |
|||
this.crud.dleChangePage(1) |
|||
this.crud.delSuccessNotify() |
|||
this.crud.toQuery() |
|||
}).catch(err => { |
|||
this.crud.delAllLoading = false |
|||
console.log(err.response.data.message) |
|||
finish(index, row) { |
|||
crudTask.finish(row.task_id).then(res => { |
|||
this.crud.toQuery() |
|||
this.crud.notify('完成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
|||
}).catch(err => { |
|||
console.log(err.response.data.message) |
|||
}) |
|||
}, |
|||
cancel(index, row) { |
|||
crudTask.cancel(row.task_id).then(res => { |
|||
this.crud.toQuery() |
|||
this.crud.notify('取消成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
|||
}).catch(err => { |
|||
console.log(err.response.data.message) |
|||
}) |
|||
}, |
|||
|
|||
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 |
|||
} |
|||
}, |
|||
showStartStorage(val) { |
|||
let obj = {} |
|||
obj = this.deviceList.find((item) => { |
|||
return item.device_code === val |
|||
}) |
|||
if (obj.device_type === 'storage') { |
|||
this.start_flag = true |
|||
let storage_obj = {} |
|||
deviceCrud.queryStorageExtra(obj.device_code).then(data => { |
|||
storage_obj = data |
|||
const n1 = storage_obj.minY |
|||
const n2 = storage_obj.maxY |
|||
const m1 = storage_obj.minZ |
|||
const m2 = storage_obj.maxZ |
|||
const from_y = [] |
|||
const from_z = [] |
|||
for (let i = n1; i <= n2; i++) { |
|||
const y = {} |
|||
if (i < 10) { |
|||
y.id = '0' + i |
|||
} else { |
|||
y.id = i |
|||
} |
|||
y.value = i + '列' |
|||
from_y.push(y) |
|||
} |
|||
for (let i = m1; i <= m2; i++) { |
|||
const z = {} |
|||
if (i < 10) { |
|||
z.id = '0' + i |
|||
} else { |
|||
z.id = i |
|||
} |
|||
z.value = i + '层' |
|||
from_z.push(z) |
|||
} |
|||
this.fromYList = from_y |
|||
this.fromZList = from_z |
|||
this.form.from_x = storage_obj.tunnel |
|||
}) |
|||
}).catch(() => { |
|||
} else { |
|||
this.start_flag = false |
|||
this.form.from_x = '' |
|||
this.form.from_y = '' |
|||
this.form.from_z = '' |
|||
} |
|||
}, |
|||
showEndStorage(val) { |
|||
let obj = {} |
|||
obj = this.deviceList.find((item) => { |
|||
return item.device_code === val |
|||
}) |
|||
if (obj.device_type === 'storage') { |
|||
this.end_flag = true |
|||
let storage_obj = {} |
|||
deviceCrud.queryStorageExtra(obj.device_code).then(data => { |
|||
storage_obj = data |
|||
const n1 = storage_obj.minY |
|||
const n2 = storage_obj.maxY |
|||
const m1 = storage_obj.minZ |
|||
const m2 = storage_obj.maxZ |
|||
const to_y = [] |
|||
const to_z = [] |
|||
for (let i = n1; i <= n2; i++) { |
|||
const y = {} |
|||
if (i < 10) { |
|||
y.id = '0' + i |
|||
} else { |
|||
y.id = i |
|||
} |
|||
y.value = i + '列' |
|||
to_y.push(y) |
|||
} |
|||
for (let i = m1; i <= m2; i++) { |
|||
const z = {} |
|||
if (i < 10) { |
|||
z.id = '0' + i |
|||
} else { |
|||
z.id = i |
|||
} |
|||
z.value = i + '层' |
|||
to_z.push(z) |
|||
} |
|||
this.toYList = to_y |
|||
this.toZList = to_z |
|||
this.form.to_x = storage_obj.tunnel |
|||
}) |
|||
} else { |
|||
this.end_flag = false |
|||
this.form.to_x = '' |
|||
this.form.to_y = '' |
|||
this.form.to_z = '' |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style scoped> |
|||
.el-dropdown-link { |
|||
cursor: pointer; |
|||
color: #409EFF; |
|||
} |
|||
|
|||
.el-icon-arrow-down { |
|||
font-size: 12px; |
|||
} |
|||
</style> |
|||
|
Loading…
Reference in new issue