|
@@ -61,6 +61,15 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-collapse-transition>
|
|
|
+ <el-upload
|
|
|
+ class=""
|
|
|
+ action="#"
|
|
|
+ :http-request="uploadExl"
|
|
|
+ :show-file-list="false"
|
|
|
+ >
|
|
|
+ <el-button style="width: 45px;text-align: center;padding: 7px 5px;" size="mini" >上传</el-button>
|
|
|
+ </el-upload>
|
|
|
+ <el-button style="width: 45px;text-align: center;padding: 7px 5px;" size="mini" @click="downloadExl">下载</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -78,6 +87,7 @@ import floorMap from '@/components/floorMap/index.vue'
|
|
|
import eqDialog from './eqDialog'
|
|
|
import { system } from '@/utils/plugins/components.js'
|
|
|
import { queryPic, getPvUv } from '@/api/public.js'
|
|
|
+import { uploadExcel, downloadExcel } from "@/api/equipmentList.js";
|
|
|
import { mapGetters } from 'vuex'
|
|
|
import store from '../../store'
|
|
|
export default {
|
|
@@ -118,6 +128,55 @@ export default {
|
|
|
} */
|
|
|
},
|
|
|
methods: {
|
|
|
+ /**
|
|
|
+ * excel文件上传
|
|
|
+ */
|
|
|
+ uploadExl(resData) {
|
|
|
+ const { file } = resData
|
|
|
+ // 创建FormData对象
|
|
|
+ const isLt30M = file.size / 1024 / 1024 < 30
|
|
|
+ if (!['xls','xlsx'].includes(file.name.split('.')[1])) {
|
|
|
+ this.$message.warning('上传文件只能是 xls、xlsx格式!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!isLt30M) {
|
|
|
+ this.$message.warning('上传excel模板大小不能超过 30MB!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const formData = new FormData()
|
|
|
+ // 将得到的文件流添加到FormData对象
|
|
|
+ formData.append('file', file, file.name)
|
|
|
+ const getParams ={
|
|
|
+ plazaId: this.plazaId,
|
|
|
+ smsxt: this.smsxt,
|
|
|
+ floor: this.floorInfo.gname, //楼层 必填
|
|
|
+ }
|
|
|
+ const data = formData
|
|
|
+ uploadExcel({ getParams,data }).then(res=>{
|
|
|
+ if(res?.result === 'success'){
|
|
|
+ this.$message({
|
|
|
+ message: '上传成功',
|
|
|
+ type: 'success',
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.$message({
|
|
|
+ message: '上传失败',
|
|
|
+ type: 'error',
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 下载excel
|
|
|
+ */
|
|
|
+ downloadExl() {
|
|
|
+ const getParams={
|
|
|
+ plazaId: this.plazaId,
|
|
|
+ smsxt: this.smsxt,
|
|
|
+ floor: this.floorInfo.gname,
|
|
|
+ }
|
|
|
+ downloadExcel({ getParams })
|
|
|
+ },
|
|
|
// 查询tab页
|
|
|
tabSyatem(item) {
|
|
|
this.systemId = item.id
|