fix: 读空指针异常解决阻塞问题

This commit is contained in:
2024-07-24 09:01:30 +08:00
parent 4a6c1c7af4
commit fd9eef0191
27 changed files with 867 additions and 738 deletions

View File

@@ -7,7 +7,7 @@
<div class="crud-opts2" style="margin-bottom: 5px;">
<span class="crud-opts-right2">
<!--左侧插槽-->
<slot name="left" />
<slot name="left"/>
<el-button
slot="left"
class="filter-item"
@@ -23,7 +23,7 @@
</div>
<div class="app-container">
<el-table :data="modeform.plans" border fit highlight-current-row style="width: 100%;" class="tb-edit">
<el-table-column label="任务类型" prop="type" width="180">
<el-table-column label="任务类型" prop="type" width="250">
<template scope="scope">
<el-select
v-model="scope.row.type"
@@ -40,7 +40,7 @@
</el-select>
</template>
</el-table-column>
<el-table-column label="指令起点" prop="from" width="180">
<el-table-column label="指令起点" prop="from" width="250">
<template scope="scope">
<el-select
v-model="scope.row.from"
@@ -57,7 +57,7 @@
</el-select>
</template>
</el-table-column>
<el-table-column label="指令终点" prop="to" width="180">
<el-table-column label="指令终点" prop="to" width="250">
<template scope="scope">
<el-select
v-model="scope.row.to"
@@ -74,15 +74,29 @@
</el-select>
</template>
</el-table-column>
<el-table-column label="数量" prop="quantity" width="180">
<el-table-column label="数量" prop="quantity" width="250">
<template scope="scope">
<el-input-number v-model="scope.row.quantity" value="0" :min="0" size="mini" />
<el-input-number v-model="scope.row.quantity" value="0" :min="0" size="mini"/>
<span v-show="scope.row.edit">{{ scope.row.quantity }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="170">
<el-table-column align="center" label="顺序" width="300" fixed="right">
<template scope="scope">
<el-button
type="primary"
icon="el-icon-top"
@click="moveUp(scope.$index)"
>
上移
</el-button>
<el-button
type="primary"
icon="el-icon-top"
@click="moveDown(scope.$index)"
>
下移
</el-button>
<el-button
type="danger"
class="filter-item"
@@ -97,7 +111,7 @@
</el-card>
<el-card class="box-card" shadow="never">
<div slot="header" class="clearfix">
<span class="role-span" />
<span class="role-span"/>
<el-button
:loading="false"
icon="el-icon-check"
@@ -129,9 +143,16 @@ import crud from '@/mixins/crud'
import deviceCrud from '@/api/acs/device/device'
import crudCustomPolicy from '@/api/acs/device/customPolicy'
import CRUD from '@crud/crud'
import * as constants from 'constants'
import index from '@/views/system/build/tinymce/example/Index.vue'
export default {
name: 'CustomPolicyType',
computed: {
index() {
return index
}
},
mixins: [crud],
props: {
parentForm: {
@@ -140,11 +161,20 @@ export default {
}
},
cruds() {
return CRUD({ title: '自定义策略', url: 'api/customPolicy', idField: 'id', sort: 'id,desc', crudMethod: { ...crudCustomPolicy }})
return CRUD({
title: '自定义策略',
url: 'api/customPolicy',
idField: 'id',
sort: 'id,desc',
crudMethod: { ...crudCustomPolicy }
})
},
data() {
return {
requestMethodList: [{ code: 1, name: '上架' }, { code: 2, name: '下架' }, { code: 3, name: '摆渡' }],
requestMethodList: [{ code: 1, name: '出库(起点货架终点输送线)' }, {
code: 2,
name: '入库(起点输送线终点货位)'
}, { code: 3, name: '移库(起点终点为货位)' }],
key_code: this.$route.query.key_code,
id: this.$route.query.id,
deviceList: [],
@@ -174,6 +204,26 @@ export default {
})
},
methods: {
moveUp(index) {
if (index > 0) {
const upDate = this.modeform.plans[index - 1]
this.modeform.plans.splice(index - 1, 1)
this.modeform.plans.splice(index, 0, upDate)
} else {
this.$message.error('已经是第一条,不可上移')
}
},
moveDown(index) {
if ((index + 1) === this.modeform.plans.length) {
this.$message.error('已经是最后一条,不可下移')
} else {
console.log(index)
const downDate = this.modeform.plans[index + 1]
this.modeform.plans.splice(index + 1, 1)
this.modeform.plans.splice(index, 0, downDate)
}
},
insertdtl() {
this.modeform.plans.push({ quantity: '', type: '' })
},