Browse Source

Merge branch 'test' of http://git.elinkit.com.cn:7070/r/epmet-oper-gov into test

shibei_master
dai 4 years ago
parent
commit
ed42791662
  1. 8
      src/views/modules/base/community/buildForm.vue
  2. 2
      src/views/modules/base/community/buildTable.vue
  3. 69
      src/views/modules/base/community/communityTable.vue

8
src/views/modules/base/community/buildForm.vue

@ -61,14 +61,14 @@
:min="0" :min="0"
label="层数"></el-input-number> label="层数"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="户数" <el-form-item label="户数"
style="display: block" style="display: block"
prop="totalHouseNum" prop="totalHouseNum"
label-width="150px"> label-width="150px">
<el-input-number class="item_width_1" <el-input-number class="item_width_1"
v-model="dataForm.totalHouseNum" v-model="dataForm.totalHouseNum"
:min="0" :min="0"
label="户数"></el-input-number> label="户数"></el-input-number>
</el-form-item> </el-form-item>
<el-form-item label="位置坐标" <el-form-item label="位置坐标"
@ -143,7 +143,7 @@ export default {
// sort: 0,// // sort: 0,//
totalUnitNum: 1,// totalUnitNum: 1,//
totalFloorNum: 0,// totalFloorNum: 0,//
totalHouseNum: 0,// totalHouseNum: 0,//
type: '',// type: '',//
location: '', // location: '', //
longitude: '', // longitude: '', //
@ -324,7 +324,7 @@ export default {
// sort: 0,// // sort: 0,//
totalUnitNum: 1,// totalUnitNum: 1,//
totalFloorNum: 0,// totalFloorNum: 0,//
totalHouseNum: 0,// totalHouseNum: 0,//
type: '',// type: '',//
location: '', // location: '', //
longitude: '', // longitude: '', //

2
src/views/modules/base/community/buildTable.vue

@ -84,7 +84,7 @@
label="层数"> label="层数">
</el-table-column> </el-table-column>
<el-table-column prop="totalHouseNum" <el-table-column prop="totalHouseNum"
label="户数"> label="户数">
</el-table-column> </el-table-column>
<el-table-column label="操作" <el-table-column label="操作"

69
src/views/modules/base/community/communityTable.vue

@ -31,23 +31,42 @@
@click="handleSearch">查询</el-button> @click="handleSearch">查询</el-button>
</div> </div>
<div class="div_btn"> <div class="div_btn">
<el-button style="float:left" <el-button style=""
type="yellow" type="yellow"
size="small" size="small"
@click="handleExport">导出</el-button> @click="handleExport">导出</el-button>
<el-button style="float:left" <el-button style=""
type="green" type="green"
size="small" size="small"
@click="handleAdd">新增小区</el-button> @click="handleAdd">新增小区</el-button>
<el-button style="float:left" <el-button style=""
type="blue" type="blue"
size="small" size="small"
@click="handleExportModule">下载小区模板</el-button> @click="handleExportModule">下载小区模板</el-button>
<el-upload ref="upload" <el-upload ref="upload"
style=""
:multiple='false' :multiple='false'
:show-file-list='false' :show-file-list='false'
:before-upload="beforeUpload" :before-upload="((file)=>{beforeUpload(file, 'community')})"
action=""
accept=".xls,.xlsx"
:http-request="uploadFile">
<el-button style="margin-left:10px"
size="small"
type="red">导入小区数据</el-button>
</el-upload>
<el-button style=";margin-left:10px"
type="blue"
size="small"
@click="handleExportModule">下载楼宇模板</el-button>
<el-upload style=""
ref="upload"
:multiple='false'
:show-file-list='false'
:before-upload="((file)=>{beforeUpload(file, 'building')})"
action="" action=""
accept=".xls,.xlsx" accept=".xls,.xlsx"
:limit="1" :limit="1"
@ -55,7 +74,26 @@
:http-request="uploadFile"> :http-request="uploadFile">
<el-button style="margin-left:10px" <el-button style="margin-left:10px"
size="small" size="small"
type="red">导入小区数据</el-button> type="red">导入楼宇数据</el-button>
</el-upload>
<el-button style=";margin-left:10px"
type="blue"
size="small"
@click="handleExportModule">下载房屋模板</el-button>
<el-upload style=""
ref="upload"
:multiple='false'
:show-file-list='false'
:before-upload="((file)=>{beforeUpload(file, 'room')})"
action=""
accept=".xls,.xlsx"
:limit="1"
:on-exceed="handleExceed"
:http-request="uploadFile">
<el-button style="margin-left:10px"
size="small"
type="red">导入房屋数据</el-button>
</el-upload> </el-upload>
</div> </div>
@ -338,7 +376,7 @@ export default {
}, },
// //
download (data, fileName) { download (data, downFileName) {
if (!data) { if (!data) {
return return
} }
@ -346,7 +384,7 @@ export default {
var csvData = new Blob([data]) var csvData = new Blob([data])
if (window.navigator && window.navigator.msSaveOrOpenBlob) { if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(csvData, fileName); window.navigator.msSaveOrOpenBlob(csvData, downFileName);
} }
// for Non-IE (chrome, firefox etc.) // for Non-IE (chrome, firefox etc.)
else { else {
@ -355,7 +393,7 @@ export default {
a.style = 'display: none'; a.style = 'display: none';
var url = window.URL.createObjectURL(csvData); var url = window.URL.createObjectURL(csvData);
a.href = url; a.href = url;
a.download = fileName; a.download = downFileName;
a.click(); a.click();
a.remove(); a.remove();
window.URL.revokeObjectURL(url); window.URL.revokeObjectURL(url);
@ -384,7 +422,7 @@ export default {
}, },
// //
beforeUpload (file) { beforeUpload (file, type) {
this.files = file; this.files = file;
const isText = file.type === 'application/vnd.ms-excel' const isText = file.type === 'application/vnd.ms-excel'
@ -392,6 +430,8 @@ export default {
if (!isText && !isTextComputer) { if (!isText && !isTextComputer) {
this.$message.error('请选择正确格式的文件') this.$message.error('请选择正确格式的文件')
this.files = null
this.fileName = ''
return false return false
} else { } else {
this.fileName = file.name; this.fileName = file.name;
@ -401,16 +441,17 @@ export default {
}, },
// //
handleExceed (files, fileList) { handleExceed (files, fileList) {
this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`) this.$message.warning(`当前限制选择 1 个文件,请删除后继续上传`)
}, },
async uploadFile () { async uploadFile () {
this.loading = true
if (this.fileName == "") { if (this.fileName == "") {
this.$message.warning('请选择要上传的文件!')
return false return false
} }
this.loading = true
// //
this.$refs['upload'].clearFiles() this.$refs['upload'].clearFiles()
@ -420,6 +461,7 @@ export default {
fileFormData.append('file', this.files);//filenamefiletest.zip fileFormData.append('file', this.files);//filenamefiletest.zip
const { data, code, msg } = await requestPost(url, fileFormData) const { data, code, msg } = await requestPost(url, fileFormData)
if (code === 0) { if (code === 0) {
this.$message({ this.$message({
type: "success", type: "success",
@ -428,10 +470,10 @@ export default {
this.$emit('refreshTree') this.$emit('refreshTree')
this.loadTable() this.loadTable()
} else { } else {
this.$message.error(msg) // debugger
// this.$message.error(msg)
} }
}, },
handleSizeChange (val) { handleSizeChange (val) {
@ -516,6 +558,7 @@ export default {
} }
.div_btn { .div_btn {
display: flex;
margin-top: 20px; margin-top: 20px;
} }

Loading…
Cancel
Save