|
@@ -34,7 +34,30 @@
|
|
|
:data="tableData"
|
|
|
:element-loading-text="elementLoadingText"
|
|
|
:height="height"
|
|
|
+ :header-cell-style="{ 'text-align': 'center' }"
|
|
|
+ :cell-style="{ 'text-align': 'center' }"
|
|
|
>
|
|
|
+ >
|
|
|
+
|
|
|
+ <el-table-column type="expand">
|
|
|
+ <template slot-scope="props">
|
|
|
+ <el-form label-position="left" inline class="demo-table-expand">
|
|
|
+ <el-form-item label="用户名:">
|
|
|
+ <span>{{ props.row.username }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="密码:">
|
|
|
+ <span>{{ props.row.password }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="通讯秘钥:">
|
|
|
+ <span>{{ props.row.comKey }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="秘钥过期时间:">
|
|
|
+ <span>{{ props.row.keyTime }}</span>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+
|
|
|
<el-table-column show-overflow-tooltip label="序号" width="95">
|
|
|
<template #default="scope">
|
|
|
{{ scope.$index + 1 }}
|
|
@@ -46,26 +69,13 @@
|
|
|
label="场站编码"
|
|
|
prop="stationCode"
|
|
|
/>
|
|
|
- <el-table-column
|
|
|
- show-overflow-tooltip
|
|
|
- label="场站标识"
|
|
|
- prop="signCode"
|
|
|
- />
|
|
|
+ <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="一体化公司"
|
|
@@ -77,8 +87,12 @@
|
|
|
|
|
|
<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>
|
|
|
+ <el-button type="text" @click="handleEdit(row)">
|
|
|
+ <el-tag type="success">编辑</el-tag>
|
|
|
+ </el-button>
|
|
|
+ <el-button type="text" @click="handleDelete(row)">
|
|
|
+ <el-tag type="danger">删除</el-tag>
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -103,19 +117,22 @@
|
|
|
<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-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-select v-model.trim="form.type" clearable placeholder="请选择">
|
|
|
<el-option
|
|
|
- v-for="item in this.elType"
|
|
|
+ v-for="item in elType"
|
|
|
:key="item.value"
|
|
|
:label="item.label"
|
|
|
- :value="item.value">
|
|
|
- </el-option>
|
|
|
+ :value="item.value"
|
|
|
+ ></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
|
|
@@ -126,15 +143,18 @@
|
|
|
<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 label="推送天数" prop="days">
|
|
|
+ <el-input-number
|
|
|
+ v-model.trim="form.days"
|
|
|
+ :min="1"
|
|
|
+ :max="15"
|
|
|
+ label="推送天数"
|
|
|
+ ></el-input-number>
|
|
|
</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>
|
|
|
+ <el-button type="primary" @click="saveOrUpdate()">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
@@ -145,13 +165,28 @@
|
|
|
import { getAll } from '@/api/integrationCompany'
|
|
|
|
|
|
export default {
|
|
|
- name: 'ComprehensiveTable',
|
|
|
-
|
|
|
+ name: 'Station',
|
|
|
|
|
|
data() {
|
|
|
+ const validateStaionCode = (rule, value, callback) => {
|
|
|
+ if (!value) {
|
|
|
+ return callback(new Error('请输入场站编码'))
|
|
|
+ }
|
|
|
+ getObj(this.form.stationCode, value).then((response) => {
|
|
|
+ if (this.dialogType === 'edit') callback()
|
|
|
+ let result = response.data
|
|
|
+ if (result !== null) {
|
|
|
+ callback(new Error('场站编码已存在'))
|
|
|
+ } else {
|
|
|
+ callback()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
return {
|
|
|
dialogFormVisible: false,
|
|
|
- title:'',
|
|
|
+ dialogType: '',
|
|
|
+ title: '',
|
|
|
tableData: [],
|
|
|
companys: [],
|
|
|
elType: [
|
|
@@ -161,9 +196,7 @@
|
|
|
searchForm: {
|
|
|
stationCode: null,
|
|
|
},
|
|
|
- form:{
|
|
|
-
|
|
|
- },
|
|
|
+ form: {},
|
|
|
imgShow: true,
|
|
|
list: [],
|
|
|
imageList: [],
|
|
@@ -181,6 +214,14 @@
|
|
|
rules: {
|
|
|
name: [{ required: true, trigger: 'blur', message: '请输入标题' }],
|
|
|
type: [{ required: true, trigger: 'blur', message: '请输入作者' }],
|
|
|
+ stationCode: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ trigger: 'blur',
|
|
|
+ validator: validateStaionCode,
|
|
|
+
|
|
|
+ },
|
|
|
+ ],
|
|
|
},
|
|
|
}
|
|
|
},
|
|
@@ -190,11 +231,8 @@
|
|
|
},
|
|
|
},
|
|
|
created() {
|
|
|
-
|
|
|
this.getCompany()
|
|
|
},
|
|
|
- beforeDestroy() {},
|
|
|
- mounted() {},
|
|
|
methods: {
|
|
|
getCompany() {
|
|
|
getAll()
|
|
@@ -207,43 +245,6 @@
|
|
|
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() {
|
|
|
this.listLoading = true
|
|
|
fetchList(
|
|
@@ -264,23 +265,26 @@
|
|
|
this.listLoading = false
|
|
|
})
|
|
|
},
|
|
|
- testMessage() {
|
|
|
- this.$baseMessage('test1', 'success')
|
|
|
+
|
|
|
+ handleSizeChange(val) {
|
|
|
+ this.page.pageSize = val
|
|
|
+ this.page.currentPage = 1
|
|
|
+ this.fetchData()
|
|
|
},
|
|
|
- testALert() {
|
|
|
- this.$baseAlert('11')
|
|
|
- this.$baseAlert('11', '自定义标题', () => {
|
|
|
- /* 可以写回调; */
|
|
|
- })
|
|
|
- this.$baseAlert('11', null, () => {
|
|
|
- /* 可以写回调; */
|
|
|
- })
|
|
|
+ handleCurrentChange(val) {
|
|
|
+ this.page.currentPage = val
|
|
|
+ this.fetchData()
|
|
|
},
|
|
|
+ handleQuery() {
|
|
|
+ for (var v in this.searchForm) {
|
|
|
+ if (this.searchForm[v] == '') {
|
|
|
+ delete this.searchForm[v]
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- testNotify() {
|
|
|
- this.$baseNotify('测试消息提示', 'test', 'success', 'bottom-right')
|
|
|
+ this.page.currentPage = 1
|
|
|
+ this.fetchData()
|
|
|
},
|
|
|
-
|
|
|
formatType(row, column) {
|
|
|
for (let i = 0; i < this.elType.length; i++) {
|
|
|
if (row.type == this.elType[i].value) {
|
|
@@ -288,7 +292,6 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
formatCompany(row, column) {
|
|
|
for (let i = 0; i < this.companys.length; i++) {
|
|
|
if (row.inCode == this.companys[i].code) {
|
|
@@ -296,30 +299,89 @@
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
-
|
|
|
-
|
|
|
close() {
|
|
|
this.$refs['form'].resetFields()
|
|
|
this.form = this.$options.data().form
|
|
|
this.dialogFormVisible = false
|
|
|
this.$emit('fetch-data')
|
|
|
},
|
|
|
+ handleAdd() {
|
|
|
+ this.form = {}
|
|
|
+ this.title = '新增'
|
|
|
+ this.dialogType = 'add'
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ },
|
|
|
+ handleEdit(row) {
|
|
|
+ this.form = row
|
|
|
+ this.title = '修改'
|
|
|
+ this.dialogType = 'edit'
|
|
|
+ this.dialogFormVisible = true
|
|
|
+ },
|
|
|
+ handleDelete(row) {
|
|
|
+ this.$baseConfirm('你确定要删除当前项吗', null, async () => {
|
|
|
+ const { msg } = await delObj(row.id)
|
|
|
+ this.$baseMessage(msg, 'success')
|
|
|
+ this.fetchData()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ saveOrUpdate() {
|
|
|
+ if (this.dialogType == 'add') {
|
|
|
+ this.save()
|
|
|
+ } else {
|
|
|
+ this.update()
|
|
|
+ }
|
|
|
+ },
|
|
|
save() {
|
|
|
- this.$refs.form.validate((valid)=>{
|
|
|
- if (valid){
|
|
|
+ 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;
|
|
|
+ addObj(this.form)
|
|
|
+ .then((response) => {
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.fetchData()
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ update() {
|
|
|
+ this.$refs.form.validate((valid) => {
|
|
|
+ if (valid) {
|
|
|
+ this.listLoading = true
|
|
|
+ putObj(this.form)
|
|
|
+ .then((response) => {
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ this.fetchData()
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ this.listLoading = false
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ return false
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
},
|
|
|
}
|
|
|
</script>
|
|
|
+
|
|
|
+<style>
|
|
|
+ .demo-table-expand {
|
|
|
+ font-size: 0;
|
|
|
+ }
|
|
|
+ .demo-table-expand label {
|
|
|
+ width: 90px;
|
|
|
+ color: #99a9bf;
|
|
|
+ }
|
|
|
+ .demo-table-expand .el-form-item {
|
|
|
+ margin-right: 0;
|
|
|
+ margin-bottom: 0;
|
|
|
+ width: 50%;
|
|
|
+ }
|
|
|
+</style>
|