<template>
|
<TableLayout :permissions="['business:category:query']">
|
<el-form ref="searchForm" slot="search-form" :model="searchForm" label-width="100px" inline>
|
<el-form-item label="物品等级" prop="name">
|
<el-input v-model="searchForm.name" clearable placeholder="请输入物品等级" @keypress.enter.native="search"></el-input>
|
</el-form-item>
|
<el-form-item label="状态" prop="status">
|
<el-select v-model="searchForm.status" clearable placeholder="请选择状态" @change="search">
|
<el-option label="正常" :value="0"></el-option>
|
<el-option label="停用" :value="1"></el-option>
|
</el-select>
|
</el-form-item>
|
<section>
|
<el-button type="primary" @click="search">搜索</el-button>
|
<el-button @click="reset">重置</el-button>
|
</section>
|
</el-form>
|
<template v-slot:table-wrap>
|
<ul class="toolbar">
|
<li><el-button type="primary" @click="$refs.operaGoodsCategoryEditWindow.open('新建物品等级', null, 3)" icon="el-icon-plus">新建</el-button></li>
|
</ul>
|
<el-table
|
:height="tableHeightNew"
|
v-loading="isWorking.search"
|
:data="tableData.list"
|
stripe
|
>
|
<el-table-column prop="id" label="ID" min-width="80px"></el-table-column>
|
<el-table-column prop="name" label="物品等级" min-width="120px"></el-table-column>
|
<el-table-column prop="detail" label="所需司机等级" min-width="120px">
|
<template slot-scope="{row}">
|
<span class="value" v-if="row.detail ==5">S</span>
|
<span class="value" v-else-if="row.detail ==4">A</span>
|
<span class="value" v-else-if="row.detail ==3">B</span>
|
<span class="value" v-else-if="row.detail ==2">C</span>
|
<span class="value" v-else-if="row.detail ==1">D</span>
|
<span class="value" v-else>-</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="otherField" label="是否贵重物品" min-width="120px">
|
<template slot-scope="{row}">
|
<span class="value" v-if="row.otherField ==1">是</span>
|
<span class="value" v-else>否</span>
|
</template>
|
</el-table-column>
|
<el-table-column prop="sortnum" label="排序" min-width="100px"></el-table-column>
|
<el-table-column prop="createTime" label="提交时间" min-width="100px"></el-table-column>
|
<el-table-column label="状态" min-width="80px">
|
<template slot-scope="{row}">
|
<el-switch
|
@change="handleStatusChange($event, row)"
|
v-model="row.status"
|
active-color="#13ce66"
|
inactive-color="#ff4949"
|
:active-value="0"
|
:inactive-value="1"
|
></el-switch>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" min-width="150" fixed="right">
|
<template slot-scope="{row}">
|
<el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
<el-button type="text" style="color: red;" @click="deleteById(row)">删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination
|
@size-change="handleSizeChange"
|
@current-change="handlePageChange"
|
:pagination="tableData.pagination"
|
></pagination>
|
</template>
|
<OperaGoodsCategoryEditWindow ref="operaGoodsCategoryEditWindow" @success="search" />
|
</TableLayout>
|
</template>
|
|
<script>
|
import BaseTable from '@/components/base/BaseTable'
|
import TableLayout from '@/layouts/TableLayout'
|
import Pagination from '@/components/common/Pagination'
|
import OperaGoodsCategoryEditWindow from '@/components/business/OperaGoodsCategoryEditWindow'
|
import { updateStatus } from '@/api/business/goodsCategory'
|
|
export default {
|
name: 'ItemLevelList',
|
extends: BaseTable,
|
components: { TableLayout, Pagination, OperaGoodsCategoryEditWindow },
|
data () {
|
return {
|
searchForm: {
|
name: '',
|
status:'',
|
type: 3
|
}
|
}
|
},
|
created () {
|
this.config({
|
api: '/business/goodsCategory',
|
'field.id': 'id'
|
})
|
this.search()
|
},
|
methods: {
|
handleEdit (row) {
|
this.$refs.operaGoodsCategoryEditWindow.open('编辑物品等级', row, 3)
|
},
|
handleStatusChange (val, row) {
|
updateStatus({ id: row.id, status: val }).then(res => {
|
this.$tip.apiSuccess(res || '修改成功')
|
}).catch(e => {
|
row.status = val === 1 ? 0 : 1
|
this.$tip.apiFailed(e)
|
})
|
}
|
}
|
}
|
</script>
|