Commit dba9c0b1 by changjin

修改bug

parents f7f43e97 1c562811
...@@ -30,7 +30,14 @@ ...@@ -30,7 +30,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-if="showpage" @pageSize="currentSize" @pageNum="currentPage" :totalNum="totalNum"></pagination> <div class="block text-right mt10" v-if="showpage">
<el-pagination
@size-change="currentSize"
@current-change="currentPage"
layout="total, prev, pager, next, jumper"
:total="totalNum">
</el-pagination>
</div>
</div> </div>
</div> </div>
<el-dialog :title="title" :visible.sync="adddialogVisible" width="40%"> <el-dialog :title="title" :visible.sync="adddialogVisible" width="40%">
...@@ -84,7 +91,7 @@ ...@@ -84,7 +91,7 @@
<span style="margin: 0 5px;">--</span> <span style="margin: 0 5px;">--</span>
<el-date-picker v-model="editForm.endTime" type="date" :picker-options="EndOptions" placeholder="结束时间" style="width: 190px;" > </el-date-picker> <el-date-picker v-model="editForm.endTime" type="date" :picker-options="EndOptions" placeholder="结束时间" style="width: 190px;" > </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="上传封面" required > <el-form-item label="上传海报" required >
<div style="display: flex;flex-direction: column;"> <div style="display: flex;flex-direction: column;">
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
...@@ -110,9 +117,9 @@ ...@@ -110,9 +117,9 @@
</div> </div>
</template> </template>
<script> <script>
import pagination from '../../BasePagination.vue'; // import pagination from '../../BasePagination.vue';
export default { export default {
components: { pagination }, // components: { pagination },
data: () => ({ data: () => ({
loading: false, loading: false,
showpage: true, showpage: true,
...@@ -249,30 +256,15 @@ export default { ...@@ -249,30 +256,15 @@ export default {
addsubmit() { addsubmit() {
var that = this var that = this
if(that.addForm.title == ''){ if(that.addForm.title == ''){
that.$message({ that.showAlert('请输入活动标题~')
message: '活动标题不为空',
type: 'warning'
});
}else if(that.addForm.content == ''){ }else if(that.addForm.content == ''){
that.$message({ that.showAlert('请输入活动内容~')
message: '活动内容不为空',
type: 'warning'
});
}else if(that.addForm.startTime == ''){ }else if(that.addForm.startTime == ''){
that.$message({ that.showAlert('请选择活动开始时间~')
message: '请选择活动开始时间',
type: 'warning'
});
}else if(that.addForm.endTime == ''){ }else if(that.addForm.endTime == ''){
that.$message({ that.showAlert('请选择活动结束时间~')
message: '请选择活动内容结束时间',
type: 'warning'
});
}else if(that.addForm.imgUrl == ''){ }else if(that.addForm.imgUrl == ''){
that.$message({ that.showAlert('请上传海报~')
message: '活动内容配图',
type: 'warning'
});
}else{ }else{
that.$axios.post('/activity/addActivity', that.addForm).then((res) => { that.$axios.post('/activity/addActivity', that.addForm).then((res) => {
if (res.data.code === '0') { if (res.data.code === '0') {
...@@ -292,30 +284,15 @@ export default { ...@@ -292,30 +284,15 @@ export default {
editsubmit(data){ editsubmit(data){
var that = this var that = this
if(that.editForm.title == ''){ if(that.editForm.title == ''){
that.$message({ that.showAlert('请输入活动标题~')
message: '活动标题不为空',
type: 'warning'
});
}else if(that.editForm.content == ''){ }else if(that.editForm.content == ''){
that.$message({ that.showAlert('请输入活动内容~')
message: '活动内容不为空',
type: 'warning'
});
}else if(that.editForm.startTime == ''){ }else if(that.editForm.startTime == ''){
that.$message({ that.showAlert('请选择活动开始时间~')
message: '请选择活动开始时间',
type: 'warning'
});
}else if(that.editForm.endTime == ''){ }else if(that.editForm.endTime == ''){
that.$message({ that.showAlert('请选择活动结束时间~')
message: '请选择活动内容结束时间',
type: 'warning'
});
}else if(that.editForm.imgUrl == ''){ }else if(that.editForm.imgUrl == ''){
that.$message({ that.showAlert('请上传海报~')
message: '活动内容配图',
type: 'warning'
});
}else{ }else{
var parem = Object.assign(that.editForm,{startTime:new Date(that.editForm.startTime),endTime:new Date(that.editForm.endTime),}) var parem = Object.assign(that.editForm,{startTime:new Date(that.editForm.startTime),endTime:new Date(that.editForm.endTime),})
that.$axios.post('/activity/editActivityById', parem).then((res) => { that.$axios.post('/activity/editActivityById', parem).then((res) => {
...@@ -395,6 +372,11 @@ export default { ...@@ -395,6 +372,11 @@ export default {
this.page = val; this.page = val;
this.getList(); this.getList();
}, },
showAlert: function (cont) {
this.$alert(cont, '温馨提示', {
confirmButtonText: '确定'
})
}
} }
}; };
</script> </script>
......
...@@ -30,7 +30,14 @@ ...@@ -30,7 +30,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-if="showpage" @pageSize="currentSize" @pageNum="currentPage" :totalNum="totalNum"></pagination> <div class="block text-right mt10" v-if="showpage">
<el-pagination
@size-change="currentSize"
@current-change="currentPage"
layout="total, prev, pager, next, jumper"
:total="totalNum">
</el-pagination>
</div>
</div> </div>
</div> </div>
<el-dialog :title="title" :visible.sync="adddialogVisible" width="40%"> <el-dialog :title="title" :visible.sync="adddialogVisible" width="40%">
...@@ -45,11 +52,13 @@ ...@@ -45,11 +52,13 @@
<el-form-item label="上传视频" required style="margin-bottom: 12px !important;"> <el-form-item label="上传视频" required style="margin-bottom: 12px !important;">
<div style="display: flex;flex-direction: column;"> <div style="display: flex;flex-direction: column;">
<el-upload <el-upload
v-loading="loading"
class="avatar-uploader" class="avatar-uploader"
action="http://39.97.169.207:9200/baseInfo/uploadPhoto" action="http://39.97.169.207:9200/baseInfo/uploadPhoto"
:show-file-list="false" :show-file-list="false"
:headers="headers" :headers="headers"
:on-success="handlevideoSuccess" :on-success="handlevideoSuccess"
:on-progress="upLoadImg"
v-if="videoShow" v-if="videoShow"
> >
<video v-if="addForm.videoUrl" :src="addForm.videoUrl" controls='controls' :autoplay="autoplay" class="avatar"/> <video v-if="addForm.videoUrl" :src="addForm.videoUrl" controls='controls' :autoplay="autoplay" class="avatar"/>
...@@ -94,11 +103,13 @@ ...@@ -94,11 +103,13 @@
<el-form-item label="上传视频" required style="margin-bottom: 12px !important;"> <el-form-item label="上传视频" required style="margin-bottom: 12px !important;">
<div style="display: flex;flex-direction: column;"> <div style="display: flex;flex-direction: column;">
<el-upload <el-upload
v-loading="loading"
class="avatar-uploader" class="avatar-uploader"
action="http://39.97.169.207:9200/baseInfo/uploadPhoto" action="http://39.97.169.207:9200/baseInfo/uploadPhoto"
:show-file-list="false" :show-file-list="false"
:headers="headers" :headers="headers"
:on-success="handlevideoedit" :on-success="handlevideoedit"
:on-progress="upLoadImg"
v-if="videoShow" v-if="videoShow"
> >
<video v-if="editForm.videoUrl" :src="editForm.videoUrl" controls='controls' :autoplay="autoplay" class="avatar"/> <video v-if="editForm.videoUrl" :src="editForm.videoUrl" controls='controls' :autoplay="autoplay" class="avatar"/>
...@@ -133,9 +144,9 @@ ...@@ -133,9 +144,9 @@
</div> </div>
</template> </template>
<script> <script>
import pagination from '../../BasePagination.vue'; // import pagination from '../../BasePagination.vue';
export default { export default {
components: { pagination }, // components: { pagination },
data: () => ({ data: () => ({
loading: false, loading: false,
showpage: true, showpage: true,
...@@ -212,8 +223,12 @@ export default { ...@@ -212,8 +223,12 @@ export default {
this.imgShow = true this.imgShow = true
}) })
}, },
upLoadImg(){
this.loading = true
},
handlevideoSuccess(res, file) { handlevideoSuccess(res, file) {
this.addForm.videoUrl = res.data; this.addForm.videoUrl = res.data;
this.loading = false
this.videoShow = false this.videoShow = false
this.$nextTick(() => { this.$nextTick(() => {
this.videoShow = true this.videoShow = true
...@@ -221,6 +236,7 @@ export default { ...@@ -221,6 +236,7 @@ export default {
}, },
handlevideoedit(res, file) { handlevideoedit(res, file) {
this.editForm.videoUrl = res.data; this.editForm.videoUrl = res.data;
this.loading = false
this.videoShow = false this.videoShow = false
this.$nextTick(() => { this.$nextTick(() => {
this.videoShow = true this.videoShow = true
...@@ -274,25 +290,13 @@ export default { ...@@ -274,25 +290,13 @@ export default {
addsubmit() { addsubmit() {
var that = this var that = this
if(that.addForm.title == ''){ if(that.addForm.title == ''){
that.$message({ that.showAlert('请输入广告标题~')
message: '请输入广告标题',
type: 'warning'
});
}else if(that.addForm.content == ''){ }else if(that.addForm.content == ''){
that.$message({ that.showAlert('请输入广告内容~')
message: '请输入广告内容',
type: 'warning'
});
}else if(that.addForm.videoUrl == ''){ }else if(that.addForm.videoUrl == ''){
that.$message({ that.showAlert('请上传视频~')
message: '请输入上传视频',
type: 'warning'
});
}else if(that.addForm.imgUrl == ''){ }else if(that.addForm.imgUrl == ''){
that.$message({ that.showAlert('请上传图片~')
message: '请输入上传图片',
type: 'warning'
});
}else{ }else{
that.$axios.post('/advertisement/addAdvertisement', that.addForm).then((res) => { that.$axios.post('/advertisement/addAdvertisement', that.addForm).then((res) => {
that.adddialogVisible = false; that.adddialogVisible = false;
...@@ -311,25 +315,13 @@ export default { ...@@ -311,25 +315,13 @@ export default {
editsubmit() { editsubmit() {
var that = this var that = this
if(that.editForm.title == ''){ if(that.editForm.title == ''){
that.$message({ that.showAlert('请输入广告标题~')
message: '请输入广告标题',
type: 'warning'
});
}else if(that.editForm.content == ''){ }else if(that.editForm.content == ''){
that.$message({ that.showAlert('请输入广告内容~')
message: '请输入广告内容',
type: 'warning'
});
}else if(that.editForm.videoUrl == ''){ }else if(that.editForm.videoUrl == ''){
that.$message({ that.showAlert('请上传视频~')
message: '请输入上传视频',
type: 'warning'
});
}else if(that.editForm.imgUrl == ''){ }else if(that.editForm.imgUrl == ''){
that.$message({ that.showAlert('请上传图片~')
message: '请输入上传图片',
type: 'warning'
});
}else{ }else{
that.$axios.post('/advertisement/editAdvertisementById', that.editForm).then((res) => { that.$axios.post('/advertisement/editAdvertisementById', that.editForm).then((res) => {
that.editdialogVisible = false; that.editdialogVisible = false;
...@@ -407,9 +399,19 @@ export default { ...@@ -407,9 +399,19 @@ export default {
this.page = val; this.page = val;
this.getList(); this.getList();
}, },
showAlert: function (cont) {
this.$alert(cont, '温馨提示', {
confirmButtonText: '确定'
})
}
} }
}; };
</script> </script>
<style>
.el-loading-spinner{
width: 35% !important;
}
</style>
<style scoped lang="less"> <style scoped lang="less">
.tableCont { .tableCont {
height: calc(100vh - 20px); height: calc(100vh - 20px);
......
...@@ -297,23 +297,14 @@ export default { ...@@ -297,23 +297,14 @@ export default {
IntelData1:[], IntelData1:[],
IntelData2:[], IntelData2:[],
IntelData3:{}, IntelData3:{},
IntelData4:{}, IntelData4:{
name:'',
mobile:'',
ascription:'',
imgUrl:'',
},
SmartData:[], SmartData:[],
num: 1, num: 1,
Data1:[{
name: '监控设备',
},{
name: '应急按钮',
},{
name: '周界键盘',
}],
Data2:[{
name: '周界警报',
},{
name: '高空抛物',
},{
name: '安全预警',
}],
headers:{ headers:{
token:window.sessionStorage.getItem('token'), token:window.sessionStorage.getItem('token'),
projectId:window.sessionStorage.getItem('projectId') projectId:window.sessionStorage.getItem('projectId')
...@@ -398,20 +389,45 @@ export default { ...@@ -398,20 +389,45 @@ export default {
var that = this var that = this
// 状态 // 状态
that.$axios.post('/intelligentSecurity/findEquipmentType').then((res) => { that.$axios.post('/intelligentSecurity/findEquipmentType').then((res) => {
that.IntelData1 = res.data.data; var data = res.data.data
if(data){
that.IntelData1 = res.data.data;
}else{
}
}); });
// 预警 // 预警
that.$axios.post('/intelligentSecurity/findEquipmentWarning').then((res) => { that.$axios.post('/intelligentSecurity/findEquipmentWarning').then((res) => {
that.IntelData2 = res.data.data; var data = res.data.data
if(data){
that.IntelData2 = res.data.data;
}else{
}
}); });
// 巡更 // 巡更
that.$axios.post('/keepWatch/findTodayWatch').then((res) => { that.$axios.post('/keepWatch/findTodayWatch').then((res) => {
var val = res.data.data var val = res.data.data
that.IntelData3 = val; if(val){
that.IntelData3 = res.data.data;
}else{
}
}); });
// 社区警官 // 社区警官
that.$axios.post('/PoliceDetails/findPolice').then((res) => { that.$axios.post('/PoliceDetails/findPolice').then((res) => {
that.IntelData4 = res.data.data; var data = res.data.data
if(data){
that.IntelData4 = res.data.data;
}else{
that.IntelData4 = {
name:'',
mobile:'',
ascription:'',
imgUrl:'',
}
}
}); });
}, },
// 设备 // 设备
...@@ -621,7 +637,11 @@ export default { ...@@ -621,7 +637,11 @@ export default {
margin: 0 15px; margin: 0 15px;
} }
.left { .left {
display: flex; display: -webkit-box; /* 老版本语法: Safari, iOS, Android browser, older WebKit browsers. */
display: -moz-box; /* 老版本语法: Firefox (buggy) */
display: -ms-flexbox; /* 混合版本语法: IE 10 */
display: -webkit-flex; /* 新版本语法: Chrome 21+ */
display: flex; /* 新版本语法: Opera 12.1, Firefox 22+ */
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
...@@ -771,7 +791,7 @@ export default { ...@@ -771,7 +791,7 @@ export default {
} }
.boxDiv3 { .boxDiv3 {
width: 23%; width: 23%;
// height: 150px; height: 248px;
overflow: hidden; overflow: hidden;
background: #ffffff; background: #ffffff;
border: 1px solid #ffffff; border: 1px solid #ffffff;
......
...@@ -25,7 +25,14 @@ ...@@ -25,7 +25,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-if="showpage" @pageSize="currentSize" @pageNum="currentPage" :totalNum="totalNum"></pagination> <div class="block text-right mt10" v-if="showpage">
<el-pagination
@size-change="currentSize"
@current-change="currentPage"
layout="total, prev, pager, next, jumper"
:total="totalNum">
</el-pagination>
</div>
</div> </div>
</div> </div>
<el-dialog :title="title" :visible.sync="adddialogVisible" width="40%"> <el-dialog :title="title" :visible.sync="adddialogVisible" width="40%">
...@@ -95,9 +102,9 @@ ...@@ -95,9 +102,9 @@
</div> </div>
</template> </template>
<script> <script>
import pagination from '../../BasePagination.vue'; // import pagination from '../../BasePagination.vue';
export default { export default {
components: { pagination }, // components: { pagination },
data: () => ({ data: () => ({
loading: false, loading: false,
showpage: true, showpage: true,
...@@ -213,20 +220,11 @@ export default { ...@@ -213,20 +220,11 @@ export default {
addsubmit() { addsubmit() {
var that = this var that = this
if(that.addForm.title == ''){ if(that.addForm.title == ''){
that.$message({ that.showAlert('请输入绿植名称~')
message: '请输入绿植名称',
type: 'warning'
});
}else if(that.addForm.content == ''){ }else if(that.addForm.content == ''){
that.$message({ that.showAlert('请输入绿植介绍~')
message: '请输入绿植介绍',
type: 'warning'
});
}else if(that.addForm.imgUrl == ''){ }else if(that.addForm.imgUrl == ''){
that.$message({ that.showAlert('请上传绿植图片~')
message: '请上传绿植图片',
type: 'warning'
});
}else{ }else{
that.$axios.post('/greenPlants/addGreen', that.addForm).then((res) => { that.$axios.post('/greenPlants/addGreen', that.addForm).then((res) => {
that.adddialogVisible = false; that.adddialogVisible = false;
...@@ -246,20 +244,11 @@ export default { ...@@ -246,20 +244,11 @@ export default {
editsubmit() { editsubmit() {
var that = this var that = this
if(that.editForm.title == ''){ if(that.editForm.title == ''){
that.$message({ that.showAlert('请输入绿植名称~')
message: '请输入绿植名称',
type: 'warning'
});
}else if(that.editForm.content == ''){ }else if(that.editForm.content == ''){
that.$message({ that.showAlert('请输入绿植介绍~')
message: '请输入绿植介绍',
type: 'warning'
});
}else if(that.editForm.imgUrl == ''){ }else if(that.editForm.imgUrl == ''){
that.$message({ that.showAlert('请上传绿植图片~')
message: '请上传绿植图片',
type: 'warning'
});
}else{ }else{
that.$axios.post('/greenPlants/editGreenById', that.editForm).then((res) => { that.$axios.post('/greenPlants/editGreenById', that.editForm).then((res) => {
that.editdialogVisible = false; that.editdialogVisible = false;
...@@ -340,6 +329,11 @@ export default { ...@@ -340,6 +329,11 @@ export default {
this.page = val; this.page = val;
this.getList(); this.getList();
}, },
showAlert: function (cont) {
this.$alert(cont, '温馨提示', {
confirmButtonText: '确定'
})
}
} }
}; };
</script> </script>
......
...@@ -35,7 +35,14 @@ ...@@ -35,7 +35,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-if="showpage" @pageSize="currentSize" @pageNum="currentPage" :totalNum="totalNum"></pagination> <div class="block text-right mt10" v-if="showpage">
<el-pagination
@size-change="currentSize"
@current-change="currentPage"
layout="total, prev, pager, next, jumper"
:total="totalNum">
</el-pagination>
</div>
</div> </div>
</div> </div>
<el-dialog :title="title" :visible.sync="adddialogVisible" width="40%"> <el-dialog :title="title" :visible.sync="adddialogVisible" width="40%">
...@@ -65,9 +72,9 @@ ...@@ -65,9 +72,9 @@
</div> </div>
</template> </template>
<script> <script>
import pagination from '../../BasePagination.vue'; // import pagination from '../../BasePagination.vue';
export default { export default {
components: { pagination }, // components: { pagination },
data: () => ({ data: () => ({
loading: false, loading: false,
showpage: true, showpage: true,
...@@ -167,16 +174,9 @@ export default { ...@@ -167,16 +174,9 @@ export default {
var that = this; var that = this;
console.log(that.addForm.content) console.log(that.addForm.content)
if (that.addForm.title == '') { if (that.addForm.title == '') {
console.log('1111111111') that.showAlert('请输入公告标题~')
that.$message({
message: '公告标题不为空',
type: 'warning'
});
} else if (that.addForm.content == '') { } else if (that.addForm.content == '') {
that.$message({ that.showAlert('请输入公告内容~')
message: '公告内容不为空',
type: 'warning'
});
} else { } else {
that.$axios.post('/notice/addNotice', that.addForm).then(res => { that.$axios.post('/notice/addNotice', that.addForm).then(res => {
that.adddialogVisible = false; that.adddialogVisible = false;
...@@ -196,15 +196,9 @@ export default { ...@@ -196,15 +196,9 @@ export default {
editsubmit() { editsubmit() {
var that = this; var that = this;
if (that.editForm.title == '') { if (that.editForm.title == '') {
that.$message({ that.showAlert('请输入公告标题~')
message: '公告标题不为空',
type: 'warning'
});
} else if (that.editForm.content == '') { } else if (that.editForm.content == '') {
that.$message({ that.showAlert('请输入公告内容~')
message: '公告内容不为空',
type: 'warning'
});
} else { } else {
that.$axios.post('/notice/editNoticeById', that.editForm).then(res => { that.$axios.post('/notice/editNoticeById', that.editForm).then(res => {
that.editdialogVisible = false; that.editdialogVisible = false;
...@@ -280,6 +274,11 @@ export default { ...@@ -280,6 +274,11 @@ export default {
currentPage(val) { currentPage(val) {
this.page = val; this.page = val;
this.getList(); this.getList();
},
showAlert: function (cont) {
this.$alert(cont, '温馨提示', {
confirmButtonText: '确定'
})
} }
} }
}; };
......
...@@ -30,7 +30,14 @@ ...@@ -30,7 +30,14 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination v-if="showpage" @pageSize="currentSize" @pageNum="currentPage" :totalNum="totalNum"></pagination> <div class="block text-right mt10" v-if="showpage">
<el-pagination
@size-change="currentSize"
@current-change="currentPage"
layout="total, prev, pager, next, jumper"
:total="totalNum">
</el-pagination>
</div>
</div> </div>
</div> </div>
<el-dialog :title="title" :visible.sync="adddialogVisible" width="40%"> <el-dialog :title="title" :visible.sync="adddialogVisible" width="40%">
...@@ -100,9 +107,9 @@ ...@@ -100,9 +107,9 @@
</div> </div>
</template> </template>
<script> <script>
import pagination from '../../BasePagination.vue'; // import pagination from '../../BasePagination.vue';
export default { export default {
components: { pagination }, // components: { pagination },
data: () => ({ data: () => ({
loading: false, loading: false,
showpage: true, showpage: true,
...@@ -218,20 +225,11 @@ export default { ...@@ -218,20 +225,11 @@ export default {
addsubmit() { addsubmit() {
var that = this var that = this
if(that.addForm.title == ''){ if(that.addForm.title == ''){
that.$message({ that.showAlert('请输入商铺名称~')
message: '请输入商铺名称',
type: 'warning'
});
}else if(that.addForm.content == ''){ }else if(that.addForm.content == ''){
that.$message({ that.showAlert('请输入商铺内容~')
message: '请输入商铺内容',
type: 'warning'
});
}else if(that.addForm.imgUrl == ''){ }else if(that.addForm.imgUrl == ''){
that.$message({ that.showAlert('请上传图片~')
message: '请上传周围商铺图片',
type: 'warning'
});
}else{ }else{
that.$axios.post('/foodMenu/addFoodMenu', that.addForm).then((res) => { that.$axios.post('/foodMenu/addFoodMenu', that.addForm).then((res) => {
that.adddialogVisible = false; that.adddialogVisible = false;
...@@ -250,20 +248,11 @@ export default { ...@@ -250,20 +248,11 @@ export default {
editsubmit() { editsubmit() {
var that = this var that = this
if(that.editForm.title == ''){ if(that.editForm.title == ''){
that.$message({ that.showAlert('请输入商铺名称~')
message: '请输入商铺名称',
type: 'warning'
});
}else if(that.editForm.content == ''){ }else if(that.editForm.content == ''){
that.$message({ that.showAlert('请输入商铺内容~')
message: '请输入商铺内容',
type: 'warning'
});
}else if(that.editForm.imgUrl == ''){ }else if(that.editForm.imgUrl == ''){
that.$message({ that.showAlert('请上传图片~')
message: '请上传图片',
type: 'warning'
});
}else{ }else{
that.$axios.post('/foodMenu/editFoodMenuById', that.editForm).then((res) => { that.$axios.post('/foodMenu/editFoodMenuById', that.editForm).then((res) => {
that.editdialogVisible = false; that.editdialogVisible = false;
...@@ -341,6 +330,11 @@ export default { ...@@ -341,6 +330,11 @@ export default {
this.page = val; this.page = val;
this.getList(); this.getList();
}, },
showAlert: function (cont) {
this.$alert(cont, '温馨提示', {
confirmButtonText: '确定'
})
}
} }
}; };
</script> </script>
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</el-button> </el-button>
<el-button class="addBtn" @click="upload(1)" v-if="isDownloadBtn"><span>导入模板下载</span></el-button> <el-button class="addBtn" @click="upload(1)" v-if="isDownloadBtn"><span>导入模板下载</span></el-button>
<el-button class="addBtn" v-if="isImportBtn"> <el-button class="addBtn" v-if="isImportBtn">
<el-upload ref="upload" action="string" :before-upload="onBeforeUploadImage" :http-request="UploadImage" :show-file-list="false" style="width: 80px;"> <el-upload ref="upload" action="string" :before-upload="onBeforeUploadImage" accept="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel " :http-request="UploadImage" :show-file-list="false" style="width: 80px;">
<span>数据导入</span> <span>数据导入</span>
</el-upload> </el-upload>
</el-button> </el-button>
...@@ -172,27 +172,14 @@ export default { ...@@ -172,27 +172,14 @@ export default {
}, },
upload(data) { upload(data) {
if (data === 1) { if (data === 1) {
this.$axios({ window.open(this.fileUrl + 'static/xls/出售车位模板.xls')
method: 'post',
url: '/carParking/templateExport',
responseType:'blob',
headers: {
'Content-Type': 'application/x-www-form-urlencoded', //设置请求头请求格式为JSON
token: window.sessionStorage.getItem('token'),
projectId: window.sessionStorage.getItem('projectId')
}
}).then(res => {
let blob = new Blob([res], {type: "application/vnd.ms-excel"}); // res就是接口返回的文件流了
let objectUrl = URL.createObjectURL(blob);
window.location.href = objectUrl;
});
} else if (data === 3) { } else if (data === 3) {
this.$axios({ this.$axios({
method: 'post', method: 'post',
url: '/carParking/carExport', url: '/carParking/carExport',
responseType:'blob', data:{},
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', //设置请求头请求格式为JSON 'Content-Type': 'application/json;charset=UTF-8', //设置请求头请求格式为JSON
token: window.sessionStorage.getItem('token'), token: window.sessionStorage.getItem('token'),
projectId: window.sessionStorage.getItem('projectId') projectId: window.sessionStorage.getItem('projectId')
} }
...@@ -216,12 +203,20 @@ export default { ...@@ -216,12 +203,20 @@ export default {
url: '/carParking/carImport', url: '/carParking/carImport',
data:formData, data:formData,
headers: { headers: {
'Content-Type': 'multipart/form-data', //设置请求头请求格式为JSON 'Content-Type': 'application/json;charset=UTF-8', //设置请求头请求格式为JSON
token: window.sessionStorage.getItem('token'), token: window.sessionStorage.getItem('token'),
projectId: window.sessionStorage.getItem('projectId') projectId: window.sessionStorage.getItem('projectId')
} }
}).then(res => { }).then(res => {
if (res.data.code === '0') {
this.$message({
message: '导入成功',
type: 'success'
});
this.getList();
} else {
this.$message.error('车位出售删除');
}
}); });
}, },
// 出售 // 出售
...@@ -248,20 +243,11 @@ export default { ...@@ -248,20 +243,11 @@ export default {
addsubmit() { addsubmit() {
var that = this; var that = this;
if (that.addForm.floor == '') { if (that.addForm.floor == '') {
that.$message({ that.showAlert('请输入所在楼层~')
message: '请输入所在楼层',
type: 'warning'
});
} else if (that.addForm.region == '') { } else if (that.addForm.region == '') {
that.$message({ that.showAlert('请输入区域~')
message: '请输入区域',
type: 'warning'
});
} else if (that.addForm.carNumber == '') { } else if (that.addForm.carNumber == '') {
that.$message({ that.showAlert('请输入车位编号~')
message: '请输入车位编号',
type: 'warning'
});
} else { } else {
that.$axios.post('/carParking/addCarParking', that.addForm).then(res => { that.$axios.post('/carParking/addCarParking', that.addForm).then(res => {
that.adddialogVisible = false; that.adddialogVisible = false;
...@@ -280,20 +266,11 @@ export default { ...@@ -280,20 +266,11 @@ export default {
editsubmit() { editsubmit() {
var that = this; var that = this;
if (that.editForm.floor == '') { if (that.editForm.floor == '') {
that.$message({ that.showAlert('请输入所在楼层~')
message: '请输入所在楼层',
type: 'warning'
});
} else if (that.editForm.region == '') { } else if (that.editForm.region == '') {
that.$message({ that.showAlert('请输入区域~')
message: '请输入区域',
type: 'warning'
});
} else if (that.editForm.carNumber == '') { } else if (that.editForm.carNumber == '') {
that.$message({ that.showAlert('请输入车位编号~')
message: '请输入车位编号',
type: 'warning'
});
} else { } else {
that.$axios.post('/carParking/editCarParkingById', that.editForm).then(res => { that.$axios.post('/carParking/editCarParkingById', that.editForm).then(res => {
that.editdialogVisible = false; that.editdialogVisible = false;
...@@ -338,6 +315,11 @@ export default { ...@@ -338,6 +315,11 @@ export default {
currentPage(val) { currentPage(val) {
this.page = val; this.page = val;
this.getList(); this.getList();
},
showAlert: function (cont) {
this.$alert(cont, '温馨提示', {
confirmButtonText: '确定'
})
} }
} }
}; };
......
...@@ -12,13 +12,14 @@ import 'element-ui/lib/theme-chalk/index.css'; ...@@ -12,13 +12,14 @@ import 'element-ui/lib/theme-chalk/index.css';
import store from './vuex/store.js' import store from './vuex/store.js'
require('../static/css/index.css') require('../static/css/index.css')
Vue.use(uploader) Vue.use(uploader)
Vue.prototype.fileUrl = 'http://39.97.169.207/' Vue.prototype.fileUrl = 'http://39.97.169.207/' //测试
// Vue.prototype.baseURL = 'http://172.16.2.69:8088/' // Vue.prototype.baseURL = 'http://172.16.2.69:8088/'
Vue.prototype.baseURL = 'http://39.97.169.207:9200/' // 测试 Vue.prototype.baseURL = 'http://39.97.169.207:9200/' // 测试
// Vue.prototype.baseURL = 'https://witcase.chinajinmao.cn' // 正式 // Vue.prototype.baseURL = 'https://witcase.chinajinmao.cn' // 正式
axios.defaults.fileURL = Vue.prototype.fileURL
axios.defaults.baseURL = Vue.prototype.baseURL axios.defaults.baseURL = Vue.prototype.baseURL
axios.defaults.fileUrl = Vue.prototype.fileUrl axios.defaults.fileUrl = Vue.prototype.fileUrl
axios.defaults.withCredentials = true axios.defaults.withCredentials = true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment