JiaoLM
2 years ago
1 changed files with 514 additions and 74 deletions
@ -1,115 +1,555 @@ |
|||||
<template> |
<template> |
||||
<div class="app-container"> |
<div class="app-container"> |
||||
|
<!--工具栏--> |
||||
<div class="head-container"> |
<div class="head-container"> |
||||
<Search/> |
<div v-if="crud.props.searchToggle"> |
||||
<crudOperation> |
<!-- 搜索 --> |
||||
<el-button |
<el-input |
||||
slot="left" |
v-model="query.task_code" |
||||
|
size="small" |
||||
|
clearable |
||||
|
placeholder="输入任务号" |
||||
|
style="width: 200px;" |
||||
class="filter-item" |
class="filter-item" |
||||
type="danger" |
@keyup.enter.native="crud.toQuery" |
||||
icon="el-icon-delete" |
/> |
||||
size="mini" |
<el-input |
||||
:loading="crud.delAllLoading" |
v-if="false" |
||||
@click="confirmDelAll()" |
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-option v-for="item in materialList" :key="item.id" :label="item.label" :value="item.value" /> |
||||
</el-button> |
</el-select> |
||||
</crudOperation> |
<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> |
</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> |
</div> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import Search from './search' |
import Search from '@/views/monitor/lucene/time' |
||||
import CRUD, { crud, header, presenter } from '@crud/crud' |
import crudTask from '@/views/monitor/lucene/api/lucene' |
||||
|
import CRUD, { crud, form, header, presenter } from '@crud/crud' |
||||
import crudOperation from '@crud/CRUD.operation' |
import crudOperation from '@crud/CRUD.operation' |
||||
import pagination from '@crud/Pagination' |
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 { |
export default { |
||||
name: 'LuceneLog', |
name: 'Task', |
||||
components: { Search, pagination, crudOperation }, |
components: { pagination, crudOperation, Search }, |
||||
mixins: [presenter(), header(), crud()], |
dicts: ['task_status'], |
||||
|
mixins: [presenter(), header(), form(defaultForm), crud()], |
||||
cruds() { |
cruds() { |
||||
return CRUD({ |
return CRUD({ |
||||
title: '系统参数', url: 'api/lucene', idField: 'id', sort: 'id,desc', |
title: '任务', |
||||
queryOnPresenterCreated: true, |
url: 'api/lucene//getAll', |
||||
optShow: { |
idField: 'task_id', |
||||
add: false, |
sort: 'task_id,desc', |
||||
edit: false, |
query: { is_over: '1' }, |
||||
del: false, |
crudMethod: { ...crudTask }, |
||||
download: false |
optShow: {} |
||||
}, |
|
||||
page: { |
|
||||
size: 40, |
|
||||
total: 0, |
|
||||
page: 0 |
|
||||
}, |
|
||||
query: { |
|
||||
createTime: [start.setTime(start.getTime() - 3600 * 1000 * 0.5), new Date()] |
|
||||
} |
|
||||
}) |
}) |
||||
}, |
}, |
||||
data() { |
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 { |
return { |
||||
query: { blurry: '123' }, |
deviceList: [], |
||||
|
materialList: [], |
||||
|
statusList: [], |
||||
|
routeList: [], |
||||
|
fromYList: [], |
||||
|
fromZList: [], |
||||
|
toYList: [], |
||||
|
toZList: [], |
||||
|
start_flag: false, |
||||
|
end_flag: false, |
||||
permission: { |
permission: { |
||||
add: ['admin', 'param:add'], |
add: ['admin', 'task:add'], |
||||
edit: ['admin', 'param:edit'], |
edit: ['admin', 'task:edit'], |
||||
del: ['admin', 'param:del'] |
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() { |
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: { |
methods: { |
||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
// 钩子:在获取表格数据之前执行,false 则代表不获取数据 |
||||
[CRUD.HOOK.beforeRefresh]() { |
[CRUD.HOOK.beforeRefresh]() { |
||||
return true |
return true |
||||
}, |
}, |
||||
confirmDelAll() { |
finish(index, row) { |
||||
this.$confirm(`确认清空所有操作日志吗?`, '提示', { |
crudTask.finish(row.task_id).then(res => { |
||||
confirmButtonText: '确定', |
this.crud.toQuery() |
||||
cancelButtonText: '取消', |
this.crud.notify('完成成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
||||
type: 'warning' |
}).catch(err => { |
||||
}).then(() => { |
console.log(err.response.data.message) |
||||
this.crud.delAllLoading = true |
}) |
||||
delAll('device_execute').then(res => { |
}, |
||||
this.crud.delAllLoading = false |
cancel(index, row) { |
||||
this.crud.dleChangePage(1) |
crudTask.cancel(row.task_id).then(res => { |
||||
this.crud.delSuccessNotify() |
this.crud.toQuery() |
||||
this.crud.toQuery() |
this.crud.notify('取消成功', CRUD.NOTIFICATION_TYPE.SUCCESS) |
||||
}).catch(err => { |
}).catch(err => { |
||||
this.crud.delAllLoading = false |
console.log(err.response.data.message) |
||||
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> |
</script> |
||||
|
|
||||
<style scoped> |
<style scoped> |
||||
|
.el-dropdown-link { |
||||
|
cursor: pointer; |
||||
|
color: #409EFF; |
||||
|
} |
||||
|
|
||||
|
.el-icon-arrow-down { |
||||
|
font-size: 12px; |
||||
|
} |
||||
</style> |
</style> |
||||
|
Loading…
Reference in new issue