巷道管理删除接口联调

merge-requests/1/head
张鑫 5 years ago
parent 8e016af8ab
commit 27743f1faf

@ -1,4 +1,4 @@
export default { export default {
getStreetList: { getStreetList: {
method: "POST", method: "POST",
url: "/street/page", url: "/street/page",
@ -14,6 +14,11 @@ export default {
url: "/street", url: "/street",
name: "编辑巷道" name: "编辑巷道"
}, },
// deleteStreet: {
// method: "DELETE",
// url: "/street",
// name: "删除巷道"
// },
queryList: { queryList: {
url: '/order/list', url: '/order/list',
name: '查询', name: '查询',

@ -98,7 +98,7 @@ export default {
.table{ .table{
background: #ffffff; background: #ffffff;
margin: 8px 20px; margin: 8px 20px;
height: 900px; height: calc(100vh - 190px);
padding:20px; padding:20px;
} }
} }

@ -10,6 +10,8 @@ import api from './plugins/axios/index'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.prototype.$utils = utils Vue.prototype.$utils = utils
Vue.prototype.$api = api Vue.prototype.$api = api
// import axios from 'axios'
// Vue.prototype.$axios = axios
new Vue({ new Vue({
router, router,
store, store,

@ -111,5 +111,8 @@ export default {
.collapsedClose{ .collapsedClose{
margin-left: 80px; margin-left: 80px;
} }
.ant-table td {
white-space: nowrap;
}
} }
</style> </style>

@ -48,7 +48,7 @@
<script> <script>
import Model from "./model.vue"; import Model from "./model.vue"
const columns = [ const columns = [
{ {
title: '巷道名称', title: '巷道名称',
@ -88,7 +88,14 @@ export default {
pageNum:1, pageNum:1,
pageSize:10, pageSize:10,
data: [], data: [],
pagination: {}, pagination:{
total:0,
defaultPageSize:10, //
showTotal: total => `${total} 条数据`, //
showSizeChanger:true, //
pageSizeOptions: ['10', '20', '30'],
onShowSizeChange:(current, pageSize)=>this.pageSize = pageSize //
},
loading: false, loading: false,
columns, columns,
visible:false, visible:false,
@ -100,14 +107,27 @@ export default {
this.handleGetStreetList() this.handleGetStreetList()
}, },
methods: { methods: {
handleGetStreetList(){ handleGetStreetList(pagination) {
console.log(pagination)
if(pagination){
this.pagination.current = pagination.current;
this.pagination.pageSize = pagination.pageSize;
this.pageNum = pagination.current;
this.pageSize = pagination.pageSize;
}
this.request();
},
request(){
this.$api.httpApi.getStreetList({ this.$api.httpApi.getStreetList({
data: { data: {
pageNum:this.pageNum, pageNum:this.pageNum,
pageSize:this.pageSize, pageSize:this.pageSize,
} }
}).then(res => { }).then(res => {
const pagination = { ...this.pagination };
pagination.total = res.data.total;
this.data = res.data.list; this.data = res.data.list;
this.pagination = pagination;
}); });
}, },
showModel(type,data){ showModel(type,data){
@ -128,6 +148,18 @@ export default {
this.visible = visible this.visible = visible
this.modelData=data this.modelData=data
}, },
delDosage(data){
console.log(data.id)
var id=data.id
this.$axios.delete('/street/'+id, {
data: {}
}).then(res => {
if(res.code==200){
this.$message.success('删除巷道成功');
this.handleGetStreetList()
}
})
}
}, },
components:{ components:{
Model Model

@ -146,10 +146,10 @@
placeholder="选择球机" placeholder="选择球机"
> >
<a-select-option value="0"> <a-select-option value="0">
单伸 球机1
</a-select-option> </a-select-option>
<a-select-option value="1"> <a-select-option value="1">
双伸 球机2
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
@ -161,10 +161,10 @@
placeholder="选择球机" placeholder="选择球机"
> >
<a-select-option value="0"> <a-select-option value="0">
单伸 球机3
</a-select-option> </a-select-option>
<a-select-option value="1"> <a-select-option value="1">
双伸 球机4
</a-select-option> </a-select-option>
</a-select> </a-select>
</a-form-item> </a-form-item>
@ -198,6 +198,7 @@ export default {
this.mdata=newVal this.mdata=newVal
this.leftType=newVal.leftType this.leftType=newVal.leftType
this.rightType=newVal.rightType this.rightType=newVal.rightType
this.id = newVal.id
// console.log('watch') // console.log('watch')
this.$nextTick(()=>{ //this.$nextTick this.$nextTick(()=>{ //this.$nextTick
this.form.setFieldsValue({ //setFieldsValue form this.form.setFieldsValue({ //setFieldsValue form
@ -234,6 +235,7 @@ export default {
form: this.$form.createForm(this, { name: 'dynamic_rule' }), form: this.$form.createForm(this, { name: 'dynamic_rule' }),
leftType:'', leftType:'',
rightType:'', rightType:'',
id:'',
mdata:[] mdata:[]
}; };
}, },
@ -250,9 +252,7 @@ export default {
console.log(this.title) console.log(this.title)
if(this.title=='新增巷道'){ if(this.title=='新增巷道'){
this.$api.httpApi.addStreet({ this.$api.httpApi.addStreet({
data: { data:values
values
}
}).then(res => { }).then(res => {
if(res.code==200){ if(res.code==200){
this.$emit('sure',false) this.$emit('sure',false)
@ -260,10 +260,25 @@ export default {
} }
}); });
}else if(this.title=='编辑巷道'){ }else if(this.title=='编辑巷道'){
this.$api.httpApi.addStreet({ values.id = this.id
data: { switch (values.leftType) {
values case '单伸':
} values.leftType='0'
break;
case '双伸':
values.leftType='1'
break;
}
switch (values.rightType) {
case '单伸':
values.rightType='0'
break;
case '双伸':
values.rightType='1'
break;
}
this.$api.httpApi.editStreet({
data:values
}).then(res => { }).then(res => {
if(res.code==200){ if(res.code==200){
this.$emit('sure',false) this.$emit('sure',false)

Loading…
Cancel
Save