|
@@ -1,26 +1,324 @@
|
|
|
<template>
|
|
|
- <div class="table-container"></div>
|
|
|
+ <div class="table-container">
|
|
|
+ <vab-query-form>
|
|
|
+ <vab-query-form-left-panel>
|
|
|
+ <el-form
|
|
|
+ ref="searchForm"
|
|
|
+ :model="searchForm"
|
|
|
+ :inline="true"
|
|
|
+ @submit.native.prevent
|
|
|
+ >
|
|
|
+ <el-form-item>
|
|
|
+ <el-input v-model="searchForm.stationCode" placeholder="场站标识" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button
|
|
|
+ icon="el-icon-search"
|
|
|
+ type="primary"
|
|
|
+ native-type="submit"
|
|
|
+ @click="handleQuery"
|
|
|
+ >
|
|
|
+ 查询
|
|
|
+ </el-button>
|
|
|
+ <el-button icon="el-icon-plus" type="primary" @click="handleAdd">
|
|
|
+ 添加
|
|
|
+ </el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </vab-query-form-left-panel>
|
|
|
+ </vab-query-form>
|
|
|
+
|
|
|
+ <el-table
|
|
|
+ ref="tableSort"
|
|
|
+ v-loading="listLoading"
|
|
|
+ :data="tableData"
|
|
|
+ :element-loading-text="elementLoadingText"
|
|
|
+ :height="height"
|
|
|
+ >
|
|
|
+ <el-table-column show-overflow-tooltip label="序号" width="95">
|
|
|
+ <template #default="scope">
|
|
|
+ {{ scope.$index + 1 }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column show-overflow-tooltip prop="name" label="场站名称" />
|
|
|
+ <el-table-column
|
|
|
+ show-overflow-tooltip
|
|
|
+ label="场站编码"
|
|
|
+ prop="stationCode"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ show-overflow-tooltip
|
|
|
+ label="场站标识"
|
|
|
+ prop="signCode"
|
|
|
+ />
|
|
|
+ <el-table-column
|
|
|
+ show-overflow-tooltip
|
|
|
+ label="场站类型"
|
|
|
+ prop="type"
|
|
|
+ :formatter="formatType"
|
|
|
+ />
|
|
|
+ <el-table-column show-overflow-tooltip label="用户名" prop="username" />
|
|
|
+ <el-table-column show-overflow-tooltip label="密码" prop="password" />
|
|
|
+ <el-table-column show-overflow-tooltip label="通讯秘钥" prop="comKey" />
|
|
|
+ <el-table-column
|
|
|
+ show-overflow-tooltip
|
|
|
+ label="秘钥过期时间"
|
|
|
+ prop="keyTime"
|
|
|
+ />
|
|
|
+
|
|
|
+ <el-table-column
|
|
|
+ show-overflow-tooltip
|
|
|
+ label="一体化公司"
|
|
|
+ prop="inCode"
|
|
|
+ :formatter="formatCompany"
|
|
|
+ />
|
|
|
+ <el-table-column show-overflow-tooltip label="状态" prop="state" />
|
|
|
+ <el-table-column show-overflow-tooltip label=" 推送天数" prop="days" />
|
|
|
+
|
|
|
+ <el-table-column show-overflow-tooltip label="操作" width="180px">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button type="text" @click="handleEdit(row)">编辑</el-button>
|
|
|
+ <el-button type="text" @click="handleDelete(row)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-pagination
|
|
|
+ :background="background"
|
|
|
+ :current-page="page.currentPage"
|
|
|
+ :layout="layout"
|
|
|
+ :page-size="page.pageSize"
|
|
|
+ :total="page.total"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ ></el-pagination>
|
|
|
+
|
|
|
+ <el-dialog
|
|
|
+ :title="title"
|
|
|
+ :visible.sync="dialogFormVisible"
|
|
|
+ width="500px"
|
|
|
+ @close="close"
|
|
|
+ >
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
+ <el-form-item label="场站名称" prop="name">
|
|
|
+ <el-input v-model.trim="form.name" autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="场站编码" prop="stationCode">
|
|
|
+ <el-input v-model.trim="form.stationCode" autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="场站标识" prop="signCode">
|
|
|
+ <el-input v-model.trim="form.signCode" autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="场站类型" prop="type">
|
|
|
+ <el-select clearable v-model.trim="form.type" placeholder="请选择">
|
|
|
+ <el-option
|
|
|
+ v-for="item in this.elType"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="用户名" prop="username">
|
|
|
+ <el-input v-model.trim="form.username" autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="密码" prop="password">
|
|
|
+ <el-input v-model.trim="form.password" autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="推送天速" prop="days">
|
|
|
+ <el-input v-model.trim="form.days" autocomplete="off"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="close">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="save">确 定</el-button>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
- import { test } from '@/api/test'
|
|
|
+ import { fetchList, addObj, putObj, delObj, getObj } from '@/api/station'
|
|
|
+ import { getAll } from '@/api/integrationCompany'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'ComprehensiveTable',
|
|
|
- components: {},
|
|
|
- filters: {},
|
|
|
+
|
|
|
+
|
|
|
data() {
|
|
|
- return {}
|
|
|
+ return {
|
|
|
+ dialogFormVisible: false,
|
|
|
+ title:'',
|
|
|
+ tableData: [],
|
|
|
+ companys: [],
|
|
|
+ elType: [
|
|
|
+ { label: '光电', value: 'E1' },
|
|
|
+ { label: '风电', value: 'E2' },
|
|
|
+ ],
|
|
|
+ searchForm: {
|
|
|
+ stationCode: null,
|
|
|
+ },
|
|
|
+ form:{
|
|
|
+
|
|
|
+ },
|
|
|
+ imgShow: true,
|
|
|
+ list: [],
|
|
|
+ imageList: [],
|
|
|
+ listLoading: true,
|
|
|
+ layout: 'total, sizes, prev, pager, next, jumper',
|
|
|
+ total: 0,
|
|
|
+ background: true,
|
|
|
+ selectRows: '',
|
|
|
+ elementLoadingText: '正在加载...',
|
|
|
+ page: {
|
|
|
+ total: 0, // 总页数
|
|
|
+ currentPage: 1, // 当前页数
|
|
|
+ pageSize: 20, // 每页显示多少条
|
|
|
+ },
|
|
|
+ rules: {
|
|
|
+ name: [{ required: true, trigger: 'blur', message: '请输入标题' }],
|
|
|
+ type: [{ required: true, trigger: 'blur', message: '请输入作者' }],
|
|
|
+ },
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ height() {
|
|
|
+ return this.$baseTableHeight()
|
|
|
+ },
|
|
|
},
|
|
|
- computed: {},
|
|
|
created() {
|
|
|
- this.fetchData()
|
|
|
+
|
|
|
+ this.getCompany()
|
|
|
},
|
|
|
beforeDestroy() {},
|
|
|
mounted() {},
|
|
|
methods: {
|
|
|
+ getCompany() {
|
|
|
+ getAll()
|
|
|
+ .then((response) => {
|
|
|
+ this.companys = response.data
|
|
|
+ this.fetchData()
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ handleAdd() {
|
|
|
+ this.form = {},
|
|
|
+ this.title ="新增"
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ },
|
|
|
+ handleEdit(row) {
|
|
|
+ this.form = row
|
|
|
+ this.title ="修改"
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ },
|
|
|
+ handleDelete(row) {
|
|
|
+ this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
|
|
+ const { msg } = await delObj(row.id)
|
|
|
+ this.$baseMessage(msg, 'success')
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.page.pageSize = val
|
|
|
+ this.page.currentPage = 1
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.page.currentPage = val
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
+ handleQuery() {
|
|
|
+ for (var v in this.searchForm) {
|
|
|
+ if (this.searchForm[v] == '') {
|
|
|
+ delete this.searchForm[v]
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ this.page.currentPage = 1
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
async fetchData() {
|
|
|
- const { data } = await test()
|
|
|
- alert(data)
|
|
|
+ this.listLoading = true
|
|
|
+ fetchList(
|
|
|
+ Object.assign(
|
|
|
+ {
|
|
|
+ current: this.page.currentPage,
|
|
|
+ size: this.page.pageSize,
|
|
|
+ },
|
|
|
+ this.searchForm
|
|
|
+ )
|
|
|
+ )
|
|
|
+ .then((response) => {
|
|
|
+ this.tableData = response.data.records
|
|
|
+ this.page.total = response.data.total
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ },
|
|
|
+ testMessage() {
|
|
|
+ this.$baseMessage('test1', 'success')
|
|
|
+ },
|
|
|
+ testALert() {
|
|
|
+ this.$baseAlert('11')
|
|
|
+ this.$baseAlert('11', '自定义标题', () => {
|
|
|
+ /* 可以写回调; */
|
|
|
+ })
|
|
|
+ this.$baseAlert('11', null, () => {
|
|
|
+ /* 可以写回调; */
|
|
|
+ })
|
|
|
+ },
|
|
|
+
|
|
|
+ testNotify() {
|
|
|
+ this.$baseNotify('测试消息提示', 'test', 'success', 'bottom-right')
|
|
|
+ },
|
|
|
+
|
|
|
+ formatType(row, column) {
|
|
|
+ for (let i = 0; i < this.elType.length; i++) {
|
|
|
+ if (row.type == this.elType[i].value) {
|
|
|
+ return this.elType[i].label
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+ formatCompany(row, column) {
|
|
|
+ for (let i = 0; i < this.companys.length; i++) {
|
|
|
+ if (row.inCode == this.companys[i].code) {
|
|
|
+ return this.companys[i].name
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ close() {
|
|
|
+ this.$refs['form'].resetFields()
|
|
|
+ this.form = this.$options.data().form
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.$emit('fetch-data')
|
|
|
+ },
|
|
|
+ save() {
|
|
|
+ this.$refs.form.validate((valid)=>{
|
|
|
+ if (valid){
|
|
|
+ this.listLoading = true
|
|
|
+ addObj(this.form).then(response => {
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.fetchData()
|
|
|
+ this.listLoading = false
|
|
|
+ }).catch(() => {
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ })
|
|
|
},
|
|
|
},
|
|
|
}
|