代码更新

This commit is contained in:
2022-09-19 14:39:18 +08:00
parent e8063dfb4f
commit 87fdb2f2be
8 changed files with 683 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import request from '@/utils/request'
export function add(data) {
return request({
url: 'api/structrelavehicletype',
method: 'post',
data
})
}
export function del(ids) {
return request({
url: 'api/structrelavehicletype/',
method: 'delete',
data: ids
})
}
export function edit(data) {
return request({
url: 'api/structrelavehicletype',
method: 'put',
data
})
}
export function getStruct() {
return request({
url: 'api/structrelavehicletype/getStruct',
method: 'get'
})
}
export default { add, edit, del, getStruct }

View File

@@ -0,0 +1,165 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<label class="el-form-item-label">模糊搜索</label>
<el-input v-model="query.search" clearable placeholder="输入仓位编码或名称" style="width: 185px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
<rrOperation :crud="crud" />
</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="mini" label-width="130px">
<el-form-item label="仓位名称" prop="struct_id">
<label slot="label">仓位名称</label>
<el-select v-model="form.struct_id" filterable clearable style="width: 280px;" placeholder="请选择仓位">
<el-option
v-for="item in structList"
:key="item.struct_id"
:label="item.struct_name"
:value="item.struct_id"
/>
</el-select>
</el-form-item>
<el-form-item label="载具类型">
<el-select
v-model="form.vehicle_type"
multiple
style="width: 280px"
placeholder="载具类型"
class="filter-item"
clearable
>
<el-option
v-for="item in dict.storagevehicle_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</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" :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}" :data="crud.data" size="mini" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" />
<el-table-column prop="struct_code" label="仓位编码" />
<el-table-column prop="struct_name" label="仓位名称" width="120" />
<el-table-column prop="vehicle_type" label="载具类型" width="270" show-overflow-tooltip>
<template slot-scope="scope">
<span v-if="scope.row.is_edit=='0'">{{ scope.row.vehicle_type_name }}</span>
<el-select
v-else
v-model="scope.row.vehicle_type"
multiple
style="width: 255px"
class="filter-item"
clearable
>
<el-option
v-for="item in dict.storagevehicle_type"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</template>
</el-table-column>
<el-table-column prop="create_name" label="创建人" />
<el-table-column prop="create_time" label="创建时间" width="150" />
<el-table-column prop="update_optname" label="修改人" />
<el-table-column prop="update_time" label="修改时间" width="150" />
<el-table-column v-permission="[]" label="操作" width="100px" align="center" fixed="right">
<template slot-scope="scope">
<el-button v-if="scope.row.is_edit=='0'" type="primary" icon="el-icon-edit" @click="edit(scope.row,scope.$index)" />
<el-button v-if="scope.row.is_edit=='1'" type="success" icon="el-icon-check" @click="save(scope.row,scope.$index)" />
<el-button v-if="scope.row.is_edit=='1'" type="danger" icon="el-icon-close" @click="cancel(scope.row,scope.$index)" />
</template>
</el-table-column>
</el-table>
<!--分页组件-->
<pagination />
</div>
</div>
</template>
<script>
import crudStructrelavehicletype from '@/api/wms/basedata/st/structrelavehicletype'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import pagination from '@crud/Pagination'
const defaultForm = { relation_id: null, struct_id: null, vehicle_type: null, create_id: null, create_name: null, create_time: null, update_optid: null, update_optname: null, update_time: null, is_delete: null }
export default {
name: 'Structrelavehicletype',
components: { pagination, crudOperation, rrOperation },
mixins: [presenter(), header(), form(defaultForm), crud()],
dicts: ['storagevehicle_type'],
cruds() {
return CRUD({ title: '仓位载具关联', url: 'api/structrelavehicletype', idField: 'struct_id', sort: 'relation_id,desc', optShow: { add: false, edit: false, del: false, download: false, reset: true }, crudMethod: { ...crudStructrelavehicletype }})
},
data() {
return {
permission: {
},
btEdit: true,
btSave: false,
vehicle_type_name: true,
vehicle_type: false,
structList: [],
rules: {
},
queryTypeOptions: [
{ key: 'struct_id', display_name: '仓位' }
]
}
},
created() {
this.getStruct()
},
methods: {
// 钩子在获取表格数据之前执行false 则代表不获取数据
[CRUD.HOOK.beforeRefresh]() {
return true
},
[CRUD.HOOK.afterRefresh]() {
// console.log(this.crud.data)
// return true
},
[CRUD.HOOK.beforeToAdd]() {
this.getStruct()
},
getStruct() {
crudStructrelavehicletype.getStruct().then(res => {
this.structList = res
})
},
edit(row, index) {
this.crud.data[index].is_edit = '1'
},
save(row, index) {
this.crud.data[index].is_edit = '0'
crudStructrelavehicletype.edit(row).then(res => {
this.crud.notify('修改成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.crud.toQuery()
this.getStruct()
})
},
cancel(row, index) {
this.crud.data[index].is_edit = '0'
}
}
}
</script>
<style scoped>
</style>