|
@@ -35,7 +35,7 @@
|
|
|
style="width: 100%;"
|
|
|
@sort-change="sortChange"
|
|
|
>
|
|
|
- <el-table-column label="ID" prop="id" sortable="custom" align="center" width="80">
|
|
|
+ <el-table-column label="ID" prop="id" sortable="custom" align="center" width="60">
|
|
|
<template slot-scope="scope">
|
|
|
<span>{{ scope.row.id }}</span>
|
|
|
</template>
|
|
@@ -89,7 +89,7 @@
|
|
|
<span style="color:red;">{{ scope.row.remark }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" align="center" width="230" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column label="操作" align="center" width="320px" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="{row}">
|
|
|
<el-button type="primary" size="mini" @click="handleUpdate(row)">
|
|
|
编辑
|
|
@@ -97,6 +97,12 @@
|
|
|
<el-button type="primary" size="mini" @click="handleCopy(row)">
|
|
|
复制
|
|
|
</el-button>
|
|
|
+ <el-button v-if="row.methodStatus!=1" size="mini" type="success" @click="handleModifyStatus(row, 1)">
|
|
|
+ 开启
|
|
|
+ </el-button>
|
|
|
+ <el-button v-if="row.methodStatus!=0" size="mini" type="danger" @click="handleModifyStatus(row, 0)">
|
|
|
+ 关闭
|
|
|
+ </el-button>
|
|
|
<el-button type="primary" size="mini" @click="redirectTo(row.id, row.methodName)">
|
|
|
规则 >>
|
|
|
</el-button>
|
|
@@ -186,7 +192,7 @@
|
|
|
</style>
|
|
|
|
|
|
<script>
|
|
|
-import { fetchEnvInfo, fetchServiceById, fetchServiceList, fetchConsumerList, createService, updateService } from '@/api/article'
|
|
|
+import { fetchEnvInfo, fetchServiceById, fetchServiceList, fetchConsumerList, createService, updateService, changeStatus } from '@/api/interface'
|
|
|
import waves from '@/directive/waves' // waves directive
|
|
|
import { parseTime } from '@/utils'
|
|
|
import Pagination from '@/components/Pagination' // secondary package based on el-pagination
|
|
@@ -212,7 +218,6 @@ const protocols = [
|
|
|
]
|
|
|
|
|
|
// var envTypeID = 1;
|
|
|
-
|
|
|
// arr to obj, such as { CN : "China", US : "USA" }
|
|
|
const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
|
|
|
acc[cur.key] = cur.display_name
|
|
@@ -243,6 +248,7 @@ export default {
|
|
|
total: 0,
|
|
|
listLoading: true,
|
|
|
statusMappings: new Map([[1, '已开启'], [0, '未开启']]),
|
|
|
+ statusOperateMap: new Map([[1, '开启'], [0, '关闭']]),
|
|
|
listQuery: {
|
|
|
curIndex: 1,
|
|
|
pageSize: 20,
|
|
@@ -326,7 +332,7 @@ export default {
|
|
|
getList() {
|
|
|
this.listLoading = true
|
|
|
fetchServiceList(this.listQuery).then(response => {
|
|
|
- console.log(this.listQuery)
|
|
|
+ // console.log(this.listQuery)
|
|
|
this.list = response.data.mockMethodList
|
|
|
this.total = response.data.total
|
|
|
// Just to simulate the time of the request
|
|
@@ -337,7 +343,7 @@ export default {
|
|
|
})
|
|
|
},
|
|
|
updateEnvChannel(v) {
|
|
|
- console.log(v)
|
|
|
+ // console.log(v)
|
|
|
this.serviceData.envChannel = v
|
|
|
this.envSelections = []
|
|
|
fetchEnvInfo(v).then(response => {
|
|
@@ -358,6 +364,14 @@ export default {
|
|
|
consumerSel.display_name = sel.customizeName
|
|
|
this.consumerSelections.push(consumerSel)
|
|
|
}
|
|
|
+ // console.log(this.serviceData.consumerIds)
|
|
|
+ // for (var op of this.consumerSelections) {
|
|
|
+ // if (op.key in this.serviceData.consumerIds) {
|
|
|
+ // this.consumerSelected.push(op)
|
|
|
+ // // this.consumerSelected = op.display_name
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // console.log(this.consumerSelected)
|
|
|
})
|
|
|
},
|
|
|
dialogOpenInit() {
|
|
@@ -368,13 +382,28 @@ export default {
|
|
|
// this.listQuery.page = 1
|
|
|
this.getList()
|
|
|
},
|
|
|
- // handleModifyStatus(row, status) {
|
|
|
- // this.$message({
|
|
|
- // message: '操作Success',
|
|
|
- // type: 'success'
|
|
|
- // })
|
|
|
- // row.status = status
|
|
|
- // },
|
|
|
+ handleModifyStatus(row, status) {
|
|
|
+ var statusData = {
|
|
|
+ id: row.id,
|
|
|
+ methodStatus: status
|
|
|
+ }
|
|
|
+ // console.log(statusData)
|
|
|
+ changeStatus(statusData).then(response => {
|
|
|
+ // console.log(response)
|
|
|
+ if (response.code === 200) {
|
|
|
+ row.methodStatus = status
|
|
|
+ this.$message({
|
|
|
+ message: row.id.toString() + ' ' + this.statusOperateMap.get(status) + '成功!',
|
|
|
+ type: 'success'
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ message: row.id.toString() + ' ' + this.statusOperateMap.get(status) + '失败!',
|
|
|
+ type: 'danger'
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
sortChange(data) {
|
|
|
const { prop, order } = data
|
|
|
if (prop === 'id') {
|
|
@@ -422,24 +451,41 @@ export default {
|
|
|
// this.serviceData.id = parseInt(Math.random() * 100) + 1024 // mock a id
|
|
|
// this.temp.author = 'vue-element-admin'
|
|
|
delete this.serviceData.id
|
|
|
- this.serviceData.consumerIds = '[' + this.serviceData.consumerIds.toString() + ']'
|
|
|
+ delete this.serviceData.bizLine
|
|
|
+ delete this.serviceData.bizModuleId
|
|
|
+ delete this.serviceData.bizName
|
|
|
+ delete this.serviceData.consumerCustomizeName
|
|
|
+ delete this.serviceData.consumerNames
|
|
|
+ delete this.serviceData.createTime
|
|
|
+ delete this.serviceData.createTimeStr
|
|
|
+ delete this.serviceData.envName
|
|
|
+ delete this.serviceData.updateTime
|
|
|
+ delete this.serviceData.updateTimeStr
|
|
|
+ delete this.serviceData.zkAddress
|
|
|
+ if (typeof this.serviceData.consumerIds === 'object') {
|
|
|
+ this.serviceData.consumerIds = '[' + this.serviceData.consumerIds.toString() + ']'
|
|
|
+ }
|
|
|
+ // console.log('#######################')
|
|
|
+ // console.log(this.serviceData)
|
|
|
+ // console.log('#######################')
|
|
|
createService(this.serviceData).then(response => {
|
|
|
// this.list.unshift(this.serviceData)
|
|
|
+ // console.log(response)
|
|
|
if (response.code === 200) {
|
|
|
this.dialogFormVisible = false
|
|
|
this.getList()
|
|
|
this.$notify({
|
|
|
title: 'Success',
|
|
|
- message: 'Created Successfully',
|
|
|
+ message: response.msg,
|
|
|
type: 'success',
|
|
|
- duration: 2000
|
|
|
+ duration: 10000
|
|
|
})
|
|
|
} else {
|
|
|
this.$notify({
|
|
|
title: 'Failed',
|
|
|
- message: 'Created Failed',
|
|
|
- type: 'danger',
|
|
|
- duration: 2000
|
|
|
+ message: response.msg,
|
|
|
+ type: 'error',
|
|
|
+ duration: 10000
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -449,7 +495,7 @@ export default {
|
|
|
handleUpdate(row) {
|
|
|
var queryData = { id: row.id }
|
|
|
fetchServiceById(queryData).then(response => {
|
|
|
- console.log(response)
|
|
|
+ // console.log(response)
|
|
|
var rowData = response.data.mockMethodList
|
|
|
// this.serviceData.timestamp = new Date(this.temp.timestamp)
|
|
|
// console.log(this.serviceData)
|
|
@@ -458,7 +504,12 @@ export default {
|
|
|
this.serviceDataExt.id = row.id
|
|
|
this.serviceDataExt.bizLine = row.bizLine
|
|
|
this.serviceDataExt.bizModuleId = row.bizModuleId
|
|
|
- this.serviceData.consumerIds = this.serviceData.consumerIds.split('[')[1].split(']')[0].split(',')
|
|
|
+ // console.log(this.serviceData.consumerIds.split('[')[1].split(']')[0].split(','))
|
|
|
+ if (this.serviceData.consumerIds === '[]') {
|
|
|
+ this.serviceData.consumerIds = []
|
|
|
+ } else {
|
|
|
+ this.serviceData.consumerIds = this.serviceData.consumerIds.split('[')[1].split(']')[0].split(',').map(value => { return parseInt(value) })
|
|
|
+ }
|
|
|
// console.log(this.serviceData)
|
|
|
// this.serviceData.timestamp = new Date(this.temp.timestamp)
|
|
|
this.dialogStatus = 'update'
|
|
@@ -499,21 +550,22 @@ export default {
|
|
|
remark: this.serviceData.remark,
|
|
|
updator: ''
|
|
|
}
|
|
|
+ // console.log(tempData)
|
|
|
updateService(tempData).then(response => {
|
|
|
if (response.code === 200) {
|
|
|
this.dialogFormVisible = false
|
|
|
this.getList()
|
|
|
this.$notify({
|
|
|
title: 'Success',
|
|
|
- message: 'Update Successfully',
|
|
|
+ message: response.msg,
|
|
|
type: 'success',
|
|
|
duration: 2000
|
|
|
})
|
|
|
} else {
|
|
|
this.$notify({
|
|
|
title: 'Failed',
|
|
|
- message: 'Update Failed',
|
|
|
- type: 'danger',
|
|
|
+ message: response.msg,
|
|
|
+ type: 'error',
|
|
|
duration: 2000
|
|
|
})
|
|
|
}
|