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