更新任务
This commit is contained in:
@@ -58,6 +58,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
<crudOperation :permission="permission">
|
<crudOperation :permission="permission">
|
||||||
|
<el-button
|
||||||
|
slot="left"
|
||||||
|
class="filter-item"
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-plus"
|
||||||
|
@click="formDia=true"
|
||||||
|
>
|
||||||
|
新增
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
slot="right"
|
slot="right"
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
@@ -70,7 +80,7 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<!--表单组件-->
|
<!--表单组件-->
|
||||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="500px">
|
<el-dialog :close-on-click-modal="false" :visible.sync="formDia" :title="crud.status.title" width="500px">
|
||||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
|
||||||
<el-form-item v-if="false" label="任务标识" prop="task_id">
|
<el-form-item v-if="false" label="任务标识" prop="task_id">
|
||||||
<el-input v-model="form.task_id" style="width: 370px;" />
|
<el-input v-model="form.task_id" style="width: 370px;" />
|
||||||
@@ -81,6 +91,7 @@
|
|||||||
style="width: 370px;"
|
style="width: 370px;"
|
||||||
filterable
|
filterable
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
|
@change="isDisabled=false"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dict.material_type"
|
v-for="item in dict.material_type"
|
||||||
@@ -96,6 +107,7 @@
|
|||||||
style="width: 370px;"
|
style="width: 370px;"
|
||||||
filterable
|
filterable
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
|
@change="isDisabled=false"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in dict.task_type"
|
v-for="item in dict.task_type"
|
||||||
@@ -112,6 +124,7 @@
|
|||||||
filterable
|
filterable
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
default-first-option
|
default-first-option
|
||||||
|
@change="isDisabled=false"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in routeList"
|
v-for="item in routeList"
|
||||||
@@ -143,6 +156,7 @@
|
|||||||
style="width: 370px;"
|
style="width: 370px;"
|
||||||
filterable
|
filterable
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
|
@change="isDisabled=false"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in fromYList"
|
v-for="item in fromYList"
|
||||||
@@ -158,6 +172,7 @@
|
|||||||
style="width: 370px;"
|
style="width: 370px;"
|
||||||
filterable
|
filterable
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
|
@change="isDisabled=false"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in fromZList"
|
v-for="item in fromZList"
|
||||||
@@ -189,6 +204,7 @@
|
|||||||
style="width: 370px;"
|
style="width: 370px;"
|
||||||
filterable
|
filterable
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
|
@change="isDisabled=false"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in toYList"
|
v-for="item in toYList"
|
||||||
@@ -204,28 +220,30 @@
|
|||||||
style="width: 370px;"
|
style="width: 370px;"
|
||||||
filterable
|
filterable
|
||||||
placeholder="请选择"
|
placeholder="请选择"
|
||||||
|
@change="isDisabled=false"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in toZList"
|
v-for="item in toZList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
:label="item.value"
|
:label="item.value"
|
||||||
:value="item.id"
|
:value="item.id"
|
||||||
|
@change="isDisabled=false"
|
||||||
/>
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="优先级">
|
<el-form-item label="优先级">
|
||||||
<el-input v-model="form.priority" style="width: 370px;" />
|
<el-input v-model="form.priority" style="width: 370px;" @change="isDisabled=false" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="载具号">
|
<el-form-item label="载具号">
|
||||||
<el-input v-model="form.vehicle_code" style="width: 370px;" />
|
<el-input v-model="form.vehicle_code" style="width: 370px;" @change="isDisabled=false" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="描述信息" prop="description">
|
<el-form-item label="描述信息" prop="description">
|
||||||
<el-input v-model="form.remark" style="width: 380px;" rows="5" type="textarea" />
|
<el-input v-model="form.remark" style="width: 380px;" rows="5" type="textarea" @change="isDisabled=false" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
<el-button type="text" @click="formDia=false">取消</el-button>
|
||||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
<el-button :loading="crud.cu === 2" :disabled="isDisabled" type="primary" @click="saveBtn">确认</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
<!--表格渲染-->
|
<!--表格渲染-->
|
||||||
@@ -286,40 +304,28 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import crudTask from '@/api/acs/task/task'
|
import crudTask from '@/api/acs/task/task'
|
||||||
import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
import CRUD, { crud, 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 deviceCrud from '@/api/acs/device/device'
|
import deviceCrud from '@/api/acs/device/device'
|
||||||
import routeCurd from '@/api/acs/route/routePlan'
|
import routeCurd from '@/api/acs/route/routePlan'
|
||||||
import { getDicts } from '@/api/system/dict'
|
import { getDicts } from '@/api/system/dict'
|
||||||
|
|
||||||
const defaultForm = {
|
|
||||||
task_id: null,
|
|
||||||
vehicle_code: null,
|
|
||||||
vehicle_type: null,
|
|
||||||
task_type: '1',
|
|
||||||
task_status: null,
|
|
||||||
priority: 1,
|
|
||||||
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: 'Task',
|
name: 'Task',
|
||||||
components: { pagination, crudOperation },
|
components: { pagination, crudOperation },
|
||||||
dicts: ['task_status', 'task_type'],
|
dicts: ['task_status', 'task_type'],
|
||||||
mixins: [presenter(), header(), form(defaultForm), crud()],
|
mixins: [presenter(), header(), crud()],
|
||||||
cruds() {
|
cruds() {
|
||||||
return CRUD({ title: '任务', url: 'api/task', idField: 'task_id', sort: 'task_id,desc', crudMethod: { ...crudTask }})
|
return CRUD({ title: '任务', url: 'api/task', idField: 'task_id', sort: 'task_id,desc',
|
||||||
|
optShow: {
|
||||||
|
add: false,
|
||||||
|
edit: true,
|
||||||
|
del: true,
|
||||||
|
reset: false,
|
||||||
|
download: true
|
||||||
|
},
|
||||||
|
crudMethod: { ...crudTask }})
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const checkFromY = (rule, value, callback) => {
|
const checkFromY = (rule, value, callback) => {
|
||||||
@@ -367,6 +373,8 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
|
formDia: false,
|
||||||
|
isDisabled: false,
|
||||||
deviceList: [],
|
deviceList: [],
|
||||||
materialList: [],
|
materialList: [],
|
||||||
statusList: [],
|
statusList: [],
|
||||||
@@ -383,6 +391,26 @@ export default {
|
|||||||
edit: ['admin', 'task:edit'],
|
edit: ['admin', 'task:edit'],
|
||||||
del: ['admin', 'task:del']
|
del: ['admin', 'task:del']
|
||||||
},
|
},
|
||||||
|
form: {
|
||||||
|
task_id: null,
|
||||||
|
vehicle_code: null,
|
||||||
|
vehicle_type: null,
|
||||||
|
task_type: '1',
|
||||||
|
task_status: null,
|
||||||
|
priority: 1,
|
||||||
|
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
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
start_point_code: [
|
start_point_code: [
|
||||||
{ required: true, message: '起点不能为空', trigger: 'change' }
|
{ required: true, message: '起点不能为空', trigger: 'change' }
|
||||||
@@ -417,6 +445,13 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
saveBtn() {
|
||||||
|
crudTask.add(this.form).then(res => {
|
||||||
|
this.crud.toQuery()
|
||||||
|
this.formDia = false
|
||||||
|
this.isDisabled = true
|
||||||
|
})
|
||||||
|
},
|
||||||
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
// 钩子:在获取表格数据之前执行,false 则代表不获取数据
|
||||||
[CRUD.HOOK.beforeRefresh]() {
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
return true
|
return true
|
||||||
@@ -519,6 +554,7 @@ export default {
|
|||||||
this.form.from_y = ''
|
this.form.from_y = ''
|
||||||
this.form.from_z = ''
|
this.form.from_z = ''
|
||||||
}
|
}
|
||||||
|
this.isDisabled = false
|
||||||
},
|
},
|
||||||
showEndStorage(val) {
|
showEndStorage(val) {
|
||||||
let obj = {}
|
let obj = {}
|
||||||
@@ -566,6 +602,7 @@ export default {
|
|||||||
this.form.to_y = ''
|
this.form.to_y = ''
|
||||||
this.form.to_z = ''
|
this.form.to_z = ''
|
||||||
}
|
}
|
||||||
|
this.isDisabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user