|
@@ -25,6 +25,9 @@
|
|
|
<el-button icon="el-icon-delete" type="danger" @click="handleDelete">
|
|
|
删除
|
|
|
</el-button>
|
|
|
+ <UploadExcel style="margin-left: 10px;" @getResult="getMyExcelData"></UploadExcel>
|
|
|
+ <ExportExcel :exportList="exportExcel" :useType="'export'" partsName="场站"></ExportExcel>
|
|
|
+ <ExportExcel :exportList="templateExcel" :useType="'template'" partsName="场站模板"></ExportExcel>
|
|
|
</div>
|
|
|
</div>
|
|
|
<el-table ref="tableSort" v-loading="listLoading" :data="list" :element-loading-text="elementLoadingText"
|
|
@@ -80,10 +83,14 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+import UploadExcel from '@/components/UploadExcel/index'
|
|
|
+import ExportExcel from '@/components/ExportExcel/index'
|
|
|
import api from '@/api/station'
|
|
|
import TableEdit from './components/TableEdit'
|
|
|
export default {
|
|
|
components: {
|
|
|
+ UploadExcel,
|
|
|
+ ExportExcel,
|
|
|
TableEdit,
|
|
|
},
|
|
|
data() {
|
|
@@ -93,6 +100,7 @@ export default {
|
|
|
list: [],
|
|
|
options: [],
|
|
|
exportExcel: [],
|
|
|
+ templateExcel: [],
|
|
|
elementLoadingText: '正在加载...',
|
|
|
selectRows: '',
|
|
|
layout: 'total, sizes, prev, pager, next, jumper',
|
|
@@ -117,6 +125,19 @@ export default {
|
|
|
this.fetchData()
|
|
|
},
|
|
|
methods: {
|
|
|
+ getMyExcelData(val) {
|
|
|
+ val.forEach(item => {
|
|
|
+ api.addWindpowerstation(item).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.$message({
|
|
|
+ type: 'success',
|
|
|
+ message: '添加成功!'
|
|
|
+ });
|
|
|
+ this.fetchData()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
getStation() {
|
|
|
api.companys({
|
|
|
id: '',
|
|
@@ -142,6 +163,54 @@ export default {
|
|
|
this.listLoading = false
|
|
|
this.total = res.data.total
|
|
|
this.list = res.data.records
|
|
|
+ this.templateExcel = [
|
|
|
+ {
|
|
|
+ id: '',
|
|
|
+ name: '',
|
|
|
+ aname: '',
|
|
|
+ code: '',
|
|
|
+ address: '',
|
|
|
+ telephone: '',
|
|
|
+ capacity: '',
|
|
|
+ capacityunit: '',
|
|
|
+ quantity: '',
|
|
|
+ longitude: '',
|
|
|
+ latitude: '',
|
|
|
+ photo: '',
|
|
|
+ companyid: '',
|
|
|
+ systemmanufact: '',
|
|
|
+ headfarm: '',
|
|
|
+ headfarmphone: '',
|
|
|
+ model: '',
|
|
|
+ ordernum: '',
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ // 导出
|
|
|
+ let exportExcel = []
|
|
|
+ res.data.records.forEach(item => {
|
|
|
+ exportExcel.push({
|
|
|
+ id: item.id,
|
|
|
+ name: item.name,
|
|
|
+ aname: item.aname,
|
|
|
+ code: item.code,
|
|
|
+ address: item.address,
|
|
|
+ telephone: item.telephone,
|
|
|
+ capacity: item.capacity,
|
|
|
+ capacityunit: item.capacityunit,
|
|
|
+ quantity: item.quantity,
|
|
|
+ longitude: item.longitude,
|
|
|
+ latitude: item.latitude,
|
|
|
+ photo: item.photo,
|
|
|
+ companyid: item.companyid,
|
|
|
+ systemmanufact: item.systemmanufact,
|
|
|
+ headfarm: item.headfarm,
|
|
|
+ headfarmphone: item.headfarmphone,
|
|
|
+ model: item.model,
|
|
|
+ ordernum: item.ordernum,
|
|
|
+ height: item.height,
|
|
|
+ })
|
|
|
+ })
|
|
|
+ this.exportExcel = exportExcel
|
|
|
}
|
|
|
})
|
|
|
},
|