master
lion 2 years ago
parent f97381041a
commit b78a2b7d84

@ -19,7 +19,7 @@
</lx-header>
</div>
<xy-table :list="list" :total="total" @page_sizeChange="e => select.page_size = e" @pageChange="pageChange"
<xy-table :list="list" :total="total" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange"
:table-item="table">
<template v-slot:btns>
<el-table-column fixed="right" label="操作" width="260" header-align="center">
@ -129,6 +129,10 @@
this.select.page = e
this.getList()
},
pageSizeChange(e){
this.select.page_size = e
this.getList()
},
delRow(id) {
if (id) {
destroy({

@ -16,7 +16,7 @@
</lx-header>
</div>
<xy-table :list="list" :total="total" @page_sizeChange="e => select.page_size = e" @pageChange="pageChange"
<xy-table :list="list" :total="total" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange"
:table-item="table">
<template v-slot:btns>
<el-table-column fixed="right" label="操作" width="260" header-align="center">
@ -165,6 +165,10 @@
this.select.page = e
this.getList()
},
pageSizeChange(e){
this.select.page_size = e
this.getList()
},
delRow(id){
if(id){
destroy({

@ -15,7 +15,7 @@
</lx-header>
</div>
<xy-table :list="list" :total="total" @page_sizeChange="e => select.page_size = e" @pageChange="pageChange"
<xy-table :list="list" :total="total" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange"
:table-item="table">
<template v-slot:btns>
<el-table-column fixed="right" label="操作" width="260" header-align="center">
@ -117,6 +117,10 @@
this.select.page = e
this.getList()
},
pageSizeChange(e){
this.select.page_size = e
this.getList()
},
delRow(id){
if(id){
destroy({

@ -0,0 +1,256 @@
<template>
<div>
<xy-dialog ref="dialog" :width='70' :is-show.sync="isShow" type="form" :title="type==='add'?'新增防汛队伍':'编辑防汛队伍'"
:form="form" :rules="rules" @submit="submit">
<template v-slot:cangkumingcheng>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>仓库名称
</div>
<div class="xy-table-item-content">
<el-input style="width:300px" v-model="form.cangkumingcheng"></el-input>
</div>
</div>
</template>
<template v-slot:cangkubianma>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>仓库编码
</div>
<div class="xy-table-item-content">
<el-input style="width:300px" v-model="form.cangkubianma"></el-input>
</div>
</div>
</template>
<template v-slot:suozaiquyu>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>所在区域
</div>
<div class="xy-table-item-content">
<el-select v-model="form.suozaiquyu" style="width:300px" placeholder="请选择">
<el-option
v-for="item in areaList"
:key="item.id"
:label="item.value"
:value="item.value">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:jiansheniandai>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>建设年代
</div>
<div class="xy-table-item-content">
<el-date-picker style="width:300px" value-format="yyyy" format="yyyy" v-model="form.jiansheniandai" type="year" placeholder="选择年">
</el-date-picker>
</div>
</div>
</template>
<template v-slot:cangkumianji>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>仓库面积
</div>
<div class="xy-table-item-content">
<el-input style="width:300px" v-model="form.cangkumianji"></el-input>
</div>
</div>
</template>
<template v-slot:fuzeren>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>负责人
</div>
<div class="xy-table-item-content">
<el-input style="width:300px" v-model="form.fuzeren"></el-input>
</div>
</div>
</template>
<template v-slot:lianxidianhua>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>联系电话
</div>
<div class="xy-table-item-content">
<el-input style="width: 300px;" v-model="form.lianxidianhua"></el-input>
</div>
</div>
</template>
<template v-slot:cangkudizhi>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>仓库地址
</div>
<div class="xy-table-item-content">
<avue-input-map v-model="mapform" :params="mapparams" style="width:300px"
placeholder="请选择地图"></avue-input-map>
</div>
</div>
</template>
<template v-slot:jingdu>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>经度
</div>
<div class="xy-table-item-content">
<el-input style="width: 300px;" v-model="form.jingdu"></el-input>
</div>
</div>
</template>
<template v-slot:weidu>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>纬度
</div>
<div class="xy-table-item-content">
<el-input style="width: 300px;" v-model="form.weidu"></el-input>
</div>
</div>
</template>
<template v-slot:cangkujianjie>
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>仓库简介
</div>
<div class="xy-table-item-content">
<el-input style="width: 300px;" type="textarea" v-model="form.cangkujianjie"></el-input>
</div>
</div>
</template>
</xy-dialog>
</div>
</template>
<script>
import {
save,
show
} from "@/api/system/baseForm.js"
import {
getparameteritem
} from "@/api/system/dictionary.js"
import {
Message
} from 'element-ui'
export default {
data() {
return {
isShow: false,
type: 'add',
id: '',
tableName: 'materialstorages',
areaList:[],
mapparams: {
zoom: 11,
},
mapform: [],
form: {
cangkumingcheng: '',
cangkubianma: '',
suozaiquyu: '',
jiansheniandai: '',
cangkumianji: '',
fuzeren: '',
lianxidianhua: '',
cangkudizhi: '',
jingdu: '',
weidu: '',
cangkujianjie: ''
},
rules: {
cangkumingcheng: [{
required: true,
message: '请填写仓库名称'
}]
},
}
},
created() {
this.getArea()
},
methods: {
getArea(){
getparameteritem("area").then(res=>{
this.areaList = res.detail
})
},
async getDetail() {
const res = await show({
id: this.id,
table_name: this.tableName
})
this.$integrateData(this.form, res)
this.mapform = [res.jingdu, res.weidu, res.cangkudizhi]
},
submit() {
if (this.type === 'add') {
save({
table_name: this.tableName,
...this.form
}).then(res => {
Message({
type: 'success',
message: '新增成功'
})
this.$emit('refresh')
this.isShow = false
})
return
}
if (this.type === 'editor') {
save({
id: this.id,
table_name: this.tableName,
...this.form
}).then(res => {
Message({
type: 'success',
message: '编辑成功'
})
this.$emit('refresh')
this.isShow = false
})
}
},
},
watch: {
isShow(newVal) {
if (newVal) {
if (this.type === 'editor') {
this.getDetail()
}
} else {
this.id = ''
this.type = ''
this.mapform = []
this.$refs['dialog'].reset()
}
},
mapform(newVal, oldVal) {
console.log(newVal)
this.form.jingdu = newVal[0];
this.form.weidu = newVal[1];
this.form.cangkudizhi = newVal[2];
},
}
}
</script>
<style scoped lang="scss">
::v-deep .xy-table-item-label {
min-width: 160px !important
}
</style>

@ -0,0 +1,155 @@
<template>
<div>
<div ref="lxHeader">
<lx-header icon="md-apps" text="仓库管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<slot>
<div style="display: flex;justify-content: flex-start;flex-wrap: wrap;">
<Input v-model="select.keyword" style="width: 200px;margin-right: 10px;" placeholder="名称搜索" />
<Button type="primary" @click="getList"></Button>
<Button type="primary" style="margin-left: 10px;" @click="$refs['addStorage'].type='add',
$refs['addStorage'].isShow=true">添加</Button>
<!-- <Button icon="ios-add" type="primary" style="margin-left: 10px;"
@click="$refs['imports'].show()">导入</Button> -->
</div>
</slot>
</lx-header>
</div>
<xy-table :list="list" :total="total" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange"
:table-item="table">
<template v-slot:btns>
<el-table-column fixed="right" label="操作" width="260" header-align="center">
<template slot-scope="scope">
<div>
<Button type="primary" size="small" @click="$refs['addStorage'].type='editor',
$refs['addStorage'].id=scope.row.id,
$refs['addStorage'].isShow=true">编辑</Button>
<Poptip transfer confirm title="确认要删除吗?" @on-ok="delRow(scope.row.id)">
<Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button>
</Poptip>
</div>
</template>
</el-table-column>
</template>
</xy-table>
<addStorage ref="addStorage" @refresh="getList"></addStorage>
</div>
</template>
<script>
import {
index,
destroy
} from "@/api/system/baseForm.js"
import addStorage from './components/addStorage.vue'
export default {
components: {
addStorage,
},
data() {
return {
select: {
page: 1,
page_size: 10,
keyword: '',
table_name: 'materialstorages'
},
total: 0,
list: [],
table: [{
label: '序号',
type: 'index',
fixed: 'left',
width: 80,
}, {
label: '仓库名称',
prop: 'cangkumingcheng',
width: 240,
align: 'left',
fixed: 'left'
}, {
label: '仓库编码',
prop: 'cangkubianma',
align: 'left',
width: 240
}, {
label: '所在区域',
prop: 'suozaiquyu',
width: 120,
}, {
label: '建设年代',
prop: 'jiansheniandai',
width: 120,
}, {
label: '仓库地址',
prop: 'cangkudizhi',
width: 120,
}, {
label: '仓库面积',
prop: 'cangkumianji',
width: 120,
}, {
label: '负责人',
prop: 'fuzeren',
width: 120,
}, {
label: '联系电话',
prop: 'lianxidianhua',
width: 120,
}, {
label: '创建日期',
prop: 'created_at',
width: 120,
formatter: (cell, data, value) => {
return value ? value.substring(0, 10) : ''
}
}],
}
},
created() {
this.getList()
},
methods: {
async getList() {
const res = await index({
...this.select,
filter: [{
key:'cangkumingcheng',
op:'like',
value:this.select.keyword
}],
})
this.list = res.data
this.total = res.total
},
pageChange(e) {
this.select.page = e
this.getList()
},
pageSizeChange(e){
this.select.page_size = e
this.getList()
},
delRow(id) {
if (id) {
destroy({
id: id,
table_name: this.select.table_name,
}).then(res => {
this.$message({
type: 'success',
message: '删除成功'
})
this.getList()
})
}
},
}
}
</script>
<style>
</style>

@ -15,7 +15,7 @@
</lx-header>
</div>
<xy-table :list="list" :total="total" @page_sizeChange="e => select.page_size = e" @pageChange="pageChange"
<xy-table :list="list" :total="total" @pageSizeChange="pageSizeChange" @pageIndexChange="pageChange"
:table-item="table">
<template v-slot:btns>
<el-table-column fixed="right" label="操作" width="260" header-align="center">
@ -129,6 +129,10 @@
this.select.page = e
this.getList()
},
pageSizeChange(e){
this.select.page_size = e
this.getList()
},
delRow(id) {
if (id) {
destroy({

Loading…
Cancel
Save