Commit 07e3e7b3 by yuwei

2.0.0项目初始化

parent 161c5ad1
...@@ -89,8 +89,8 @@ public class ApiCallServiceImpl implements ApiCallService { ...@@ -89,8 +89,8 @@ public class ApiCallServiceImpl implements ApiCallService {
} catch (JsonProcessingException e) { } catch (JsonProcessingException e) {
} }
// 分页参数 // 分页参数
Integer pageNum = (Integer) Optional.ofNullable(params.get("pageNum")).orElse(1); Integer pageNum = Optional.ofNullable(params).map(map -> Integer.parseInt(String.valueOf(map.get("pageNum")))).orElse(1);
Integer pageSize = (Integer) Optional.ofNullable(params.get("pageSize")).orElse(20); Integer pageSize = Optional.ofNullable(params).map(map -> Integer.parseInt(String.valueOf(map.get("pageSize")))).orElse(20);
PageUtil pageUtil = new PageUtil(pageNum, pageSize); PageUtil pageUtil = new PageUtil(pageNum, pageSize);
Integer offset = pageUtil.getOffset(); Integer offset = pageUtil.getOffset();
SqlBuilderUtil.SqlFilterResult sqlFilterResult; SqlBuilderUtil.SqlFilterResult sqlFilterResult;
......
package cn.datax.service.data.market.api.dto; package cn.datax.service.data.market.api.dto;
import cn.datax.common.validate.ValidationGroups;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
@ApiModel(value = "字段信息Model") @ApiModel(value = "字段信息Model")
...@@ -15,16 +11,63 @@ public class FieldParam implements Serializable { ...@@ -15,16 +11,63 @@ public class FieldParam implements Serializable {
private static final long serialVersionUID=1L; private static final long serialVersionUID=1L;
@ApiModelProperty(value = "字段名称") /**
@NotBlank(message = "字段名称不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class}) * 列名
private String fieldName; */
@ApiModelProperty(value = "作为请求参数") private String colName;
@NotNull(message = "作为请求参数不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
private String reqable; /**
@ApiModelProperty(value = "作为返回参数") * 数据类型
@NotNull(message = "作为返回参数不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class}) */
private String resable; private String dataType;
@ApiModelProperty(value = "字段类型")
@NotBlank(message = "字段类型不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class}) /**
private String fieldType; * 数据长度
*/
private Integer dataLength;
/**
* 数据精度
*/
private Integer dataPrecision;
/**
* 数据小数位
*/
private Integer dataScale;
/**
* 是否主键
*/
private Boolean colKey;
/**
* 是否允许为空
*/
private Boolean nullable;
/**
* 列的序号
*/
private Integer colPosition;
/**
* 列默认值
*/
private String dataDefault;
/**
* 列注释
*/
private String colComment;
/**
* 作为请求参数
*/
private Boolean reqable;
/**
* 作为返回参数
*/
private Boolean resable;
} }
...@@ -54,7 +54,6 @@ export default { ...@@ -54,7 +54,6 @@ export default {
} }
} }
}, },
mounted () { mounted () {
let mime = 'text/x-mariadb' let mime = 'text/x-mariadb'
let theme = 'blackboard'// 设置主题,不设置的会使用默认主题 let theme = 'blackboard'// 设置主题,不设置的会使用默认主题
......
...@@ -18,10 +18,12 @@ import perms from '@/directive/permission' ...@@ -18,10 +18,12 @@ import perms from '@/directive/permission'
import { getDicts } from '@/api/system/dict' import { getDicts } from '@/api/system/dict'
import { getConfigKey } from '@/api/system/config' import { getConfigKey } from '@/api/system/config'
import { selectDictLabel } from '@/utils/data-process'
// 全局方法挂载 // 全局方法挂载
Vue.prototype.getDicts = getDicts Vue.prototype.getDicts = getDicts
Vue.prototype.getConfigKey = getConfigKey Vue.prototype.getConfigKey = getConfigKey
Vue.prototype.selectDictLabel = selectDictLabel
Vue.use(ElementUI) Vue.use(ElementUI)
......
// 回显数据字典
export function selectDictLabel (datas, value) {
var actions = []
Object.keys(datas).map((key) => {
if (datas[key].itemText === ('' + value)) {
actions.push(datas[key].itemValue)
return false
}
})
return actions.join('')
}
...@@ -46,12 +46,14 @@ instance.interceptors.response.use( ...@@ -46,12 +46,14 @@ instance.interceptors.response.use(
}, },
error => { error => {
loadingInstance.close() loadingInstance.close()
console.log(error.response)
if (error.response.status) { if (error.response.status) {
switch (error.response.status) { switch (error.response.status) {
// 401: 未登录 // 401: 未登录
// 未登录则跳转登录页面,并携带当前页面的路径 // 未登录则跳转登录页面,并携带当前页面的路径
// 在登录成功后返回当前页面,这一步需要在登录页操作。 // 在登录成功后返回当前页面,这一步需要在登录页操作。
case 401: case 401:
store.dispatch('user/resetToken')
router.replace({ router.replace({
path: '/login', path: '/login',
query: { redirect: router.currentRoute.fullPath } query: { redirect: router.currentRoute.fullPath }
......
...@@ -121,6 +121,9 @@ ...@@ -121,6 +121,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -142,6 +145,8 @@ ...@@ -142,6 +145,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['factory:dataset:remove']" v-hasPerm="['factory:dataset:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -197,6 +202,8 @@ export default { ...@@ -197,6 +202,8 @@ export default {
// 默认选择中表格头 // 默认选择中表格头
checkedTableColumns: [], checkedTableColumns: [],
tableSize: 'medium', tableSize: 'medium',
// 状态数据字典
statusOptions: [],
// 数据集表格数据 // 数据集表格数据
dataSetList: [], dataSetList: [],
// 总数据条数 // 总数据条数
...@@ -210,6 +217,11 @@ export default { ...@@ -210,6 +217,11 @@ export default {
} }
}, },
created () { created () {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList() this.getList()
}, },
mounted () { mounted () {
...@@ -326,12 +338,11 @@ export default { ...@@ -326,12 +338,11 @@ export default {
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictLabel}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictLabel}</el-tag>
} }
} }
} }
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-coin" type="primary" round @click="handleCheckConnection" v-if="active == 2">连通性检测</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -59,7 +60,6 @@ ...@@ -59,7 +60,6 @@
<el-input v-model="form2.password" placeholder="请输入密码" /> <el-input v-model="form2.password" placeholder="请输入密码" />
</el-form-item> </el-form-item>
</el-form> </el-form>
<el-button size="mini" type="primary" @click="handleCheckConnection" v-if="active == 2">连通性检测</el-button>
<el-button style="margin-top: 12px;" @click="handleNextStep" v-if="active == 1">下一步</el-button> <el-button style="margin-top: 12px;" @click="handleNextStep" v-if="active == 1">下一步</el-button>
<el-button style="margin-top: 12px;" @click="handleLastStep" v-if="active == 2">上一步</el-button> <el-button style="margin-top: 12px;" @click="handleLastStep" v-if="active == 2">上一步</el-button>
</div> </div>
......
...@@ -121,6 +121,9 @@ ...@@ -121,6 +121,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -142,6 +145,8 @@ ...@@ -142,6 +145,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['factory:datasource:remove']" v-hasPerm="['factory:datasource:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -197,6 +202,8 @@ export default { ...@@ -197,6 +202,8 @@ export default {
// 默认选择中表格头 // 默认选择中表格头
checkedTableColumns: [], checkedTableColumns: [],
tableSize: 'medium', tableSize: 'medium',
// 状态数据字典
statusOptions: [],
// 数据源表格数据 // 数据源表格数据
dataSourceList: [], dataSourceList: [],
// 总数据条数 // 总数据条数
...@@ -210,6 +217,11 @@ export default { ...@@ -210,6 +217,11 @@ export default {
} }
}, },
created () { created () {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList() this.getList()
}, },
mounted () { mounted () {
...@@ -326,12 +338,11 @@ export default { ...@@ -326,12 +338,11 @@ export default {
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictLabel}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictLabel}</el-tag>
} }
} }
} }
......
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<script> <script>
import { getApiMask } from '@/api/market/apimask' import { getApiMask } from '@/api/market/apimask'
import { listDataApi } from '@/api/market/dataapi' import { listDataApi, getDataApi } from '@/api/market/dataapi'
export default { export default {
name: 'ApiMaskDetail', name: 'ApiMaskDetail',
...@@ -138,9 +138,10 @@ export default { ...@@ -138,9 +138,10 @@ export default {
this.algorithmCryptoOptions = response.data this.algorithmCryptoOptions = response.data
} }
}) })
this.getDataApiList()
}, },
mounted () { mounted () {
this.init () this.getApiMask(this.data.id)
}, },
methods: { methods: {
showCard () { showCard () {
...@@ -154,20 +155,20 @@ export default { ...@@ -154,20 +155,20 @@ export default {
}) })
}, },
/** 获取详情 */ /** 获取详情 */
getApiMask: function (id) { async getApiMask () {
getApiMask(id).then(response => { this.form = await getApiMask(this.data.id).then(response => {
if (response.success) { if (response.success) {
this.form = response.data return response.data
} }
}) }) || {}
}, if (this.form && this.form.apiId) {
/** 解决异步问题 */ let dataApi = await getDataApi(this.form.apiId).then(response => {
async init () { if (response.success) {
await this.getDataApiList() return response.data
await this.getApiMask(this.data.id) }
this.resParamList = this.apiOptions.find(function (item) { }) || {}
return item.id === this.form.apiId if (dataApi && dataApi.resParams.length > 0) {
}).resParams this.resParamList = dataApi.resParams
this.form.rules.forEach(rule => { this.form.rules.forEach(rule => {
let fieldParamIndex = this.resParamList.findIndex((param) => { let fieldParamIndex = this.resParamList.findIndex((param) => {
return param.fieldName === rule.fieldName return param.fieldName === rule.fieldName
...@@ -192,6 +193,8 @@ export default { ...@@ -192,6 +193,8 @@ export default {
}) })
} }
} }
}
}
} }
</script> </script>
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
<script> <script>
import { getApiMask, updateApiMask } from '@/api/market/apimask' import { getApiMask, updateApiMask } from '@/api/market/apimask'
import { listDataApi } from '@/api/market/dataapi' import { listDataApi, getDataApi } from '@/api/market/dataapi'
export default { export default {
name: 'ApiMaskEdit', name: 'ApiMaskEdit',
...@@ -207,9 +207,10 @@ export default { ...@@ -207,9 +207,10 @@ export default {
this.algorithmCryptoOptions = response.data this.algorithmCryptoOptions = response.data
} }
}) })
this.getDataApiList()
}, },
mounted () { mounted () {
this.init() this.getApiMask()
}, },
methods: { methods: {
showCard () { showCard () {
...@@ -223,20 +224,20 @@ export default { ...@@ -223,20 +224,20 @@ export default {
}) })
}, },
/** 获取详情 */ /** 获取详情 */
getApiMask: function (id) { async getApiMask () {
getApiMask(id).then(response => { this.form = await getApiMask(this.data.id).then(response => {
if (response.success) { if (response.success) {
this.form = response.data return response.data
} }
}) }) || {}
}, if (this.form && this.form.apiId) {
/** 解决异步问题 */ let dataApi = await getDataApi(this.form.apiId).then(response => {
async init () { if (response.success) {
await this.getDataApiList() return response.data
await this.getApiMask(this.data.id) }
this.resParamList = this.apiOptions.find(function (item) { }) || {}
return item.id === this.form.apiId if (dataApi && dataApi.resParams.length > 0) {
}).resParams this.resParamList = dataApi.resParams
this.form.rules.forEach(rule => { this.form.rules.forEach(rule => {
let fieldParamIndex = this.resParamList.findIndex((param) => { let fieldParamIndex = this.resParamList.findIndex((param) => {
return param.fieldName === rule.fieldName return param.fieldName === rule.fieldName
...@@ -259,6 +260,8 @@ export default { ...@@ -259,6 +260,8 @@ export default {
this.$set(this.resParamList, fieldParamIndex, resParam) this.$set(this.resParamList, fieldParamIndex, resParam)
} }
}) })
}
}
}, },
fieldRule (fieldName) { fieldRule (fieldName) {
this.cipher.open = true this.cipher.open = true
...@@ -282,7 +285,7 @@ export default { ...@@ -282,7 +285,7 @@ export default {
let fieldRuleIndex = this.form.rules.findIndex((item) => { let fieldRuleIndex = this.form.rules.findIndex((item) => {
return item.fieldName === this.form2.fieldName return item.fieldName === this.form2.fieldName
}) })
if (fieldRuleIndex != -1) { if (fieldRuleIndex !== -1) {
// 当返回-1时,则说明数组中没有 // 当返回-1时,则说明数组中没有
this.form.rules.splice(fieldRuleIndex, 1) this.form.rules.splice(fieldRuleIndex, 1)
} }
......
...@@ -121,6 +121,9 @@ ...@@ -121,6 +121,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -142,6 +145,8 @@ ...@@ -142,6 +145,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['market:apimask:remove']" v-hasPerm="['market:apimask:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -197,6 +202,8 @@ export default { ...@@ -197,6 +202,8 @@ export default {
// 默认选择中表格头 // 默认选择中表格头
checkedTableColumns: [], checkedTableColumns: [],
tableSize: 'medium', tableSize: 'medium',
// 状态数据字典
statusOptions: [],
// 数据集表格数据 // 数据集表格数据
apiMaskList: [], apiMaskList: [],
// 总数据条数 // 总数据条数
...@@ -210,6 +217,11 @@ export default { ...@@ -210,6 +217,11 @@ export default {
} }
}, },
created () { created () {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList() this.getList()
}, },
mounted () { mounted () {
...@@ -326,12 +338,11 @@ export default { ...@@ -326,12 +338,11 @@ export default {
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictLabel}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictLabel}</el-tag>
} }
} }
} }
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="字段列表" v-if="form2.configType === '1'"> <el-form-item label="字段列表" v-if="form2.configType === '1'">
<el-table :data="fieldParamList" stripe border <el-table :data="form2.fieldParams" stripe border
:max-height="300" :max-height="300"
style="width: 100%; margin: 15px 0;"> style="width: 100%; margin: 15px 0;">
<el-table-column prop="colPosition" label="序号" width="55" align="center" > <el-table-column prop="colPosition" label="序号" width="55" align="center" >
...@@ -141,12 +141,12 @@ ...@@ -141,12 +141,12 @@
</el-table-column> </el-table-column>
<el-table-column prop="reqable" label="是否作为请求参数" align="center" width="50" > <el-table-column prop="reqable" label="是否作为请求参数" align="center" width="50" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.reqable"></el-checkbox> <el-checkbox v-model="scope.row.reqable" @change="checked=>reqCheckChange(scope.row, checked)"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="resable" label="是否作为返回参数" align="center" width="50" > <el-table-column prop="resable" label="是否作为返回参数" align="center" width="50" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.resable"></el-checkbox> <el-checkbox v-model="scope.row.resable" @change="checked=>resCheckChange(scope.row, checked)"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -356,8 +356,6 @@ export default { ...@@ -356,8 +356,6 @@ export default {
sourceOptions: [], sourceOptions: [],
// 数据库表数据字典 // 数据库表数据字典
tableNameOptions: [], tableNameOptions: [],
// 数据库表字段列表
fieldParamList: [],
// 配置方式数据字典 // 配置方式数据字典
configTypeOptions: [], configTypeOptions: [],
// 操作符数据字典 // 操作符数据字典
...@@ -426,27 +424,6 @@ export default { ...@@ -426,27 +424,6 @@ export default {
} else if (this.active === 2) { } else if (this.active === 2) {
this.$refs['form2'].validate(valid => { this.$refs['form2'].validate(valid => {
if (valid) { if (valid) {
if (this.form2.configType && this.form2.configType === '1') {
this.form3.reqParams = this.fieldParamList.filter(item => item.reqable).map(function (item) {
let json = {}
json.paramName = item.colName
json.nullable = item.nullable || '0'
json.remark = item.colComment || undefined
json.paramType = item.paramType || undefined
json.whereType = item.whereType || undefined
json.exampleValue = item.exampleValue || undefined
json.defaultValue = item.defaultValue || undefined
return json
})
this.form3.resParams = this.fieldParamList.filter(item => item.resable).map(function (item) {
let json = {}
json.fieldName = item.colName
json.remark = item.colComment || undefined
json.dataType = item.dataType || undefined
json.exampleValue = item.exampleValue || undefined
return json
})
}
this.active++ this.active++
} }
}) })
...@@ -464,7 +441,7 @@ export default { ...@@ -464,7 +441,7 @@ export default {
getDbTables(this.form2.sourceId).then(response => { getDbTables(this.form2.sourceId).then(response => {
if (response.success) { if (response.success) {
this.tableNameOptions = response.data this.tableNameOptions = response.data
this.fieldParamList = [] this.form2.fieldParams = []
} }
}) })
} }
...@@ -474,7 +451,7 @@ export default { ...@@ -474,7 +451,7 @@ export default {
getDbTables(val).then(response => { getDbTables(val).then(response => {
if (response.success) { if (response.success) {
this.tableNameOptions = response.data this.tableNameOptions = response.data
this.fieldParamList = [] this.form2.fieldParams = []
} }
}) })
} }
...@@ -482,7 +459,9 @@ export default { ...@@ -482,7 +459,9 @@ export default {
tableNameSelectChanged (val) { tableNameSelectChanged (val) {
getDbTableColumns(this.form2.sourceId, val).then(response => { getDbTableColumns(this.form2.sourceId, val).then(response => {
if (response.success) { if (response.success) {
this.fieldParamList = response.data this.form2.fieldParams = response.data
this.form3.reqParams = []
this.form3.resParams = []
} }
}) })
}, },
...@@ -505,26 +484,40 @@ export default { ...@@ -505,26 +484,40 @@ export default {
this.form3.reqParams = reqParams.map(function (item) { this.form3.reqParams = reqParams.map(function (item) {
let json = {} let json = {}
json.paramName = item.paramName json.paramName = item.paramName
json.nullable = item.nullable || '0' json.nullable = '0'
json.remark = item.remark || undefined
json.paramType = item.paramType || undefined
json.whereType = item.whereType || undefined
json.exampleValue = item.exampleValue || undefined
json.defaultValue = item.defaultValue || undefined
return json return json
}) })
this.form3.resParams = resParams.map(function (item) { this.form3.resParams = resParams.map(function (item) {
let json = {} let json = {}
json.fieldName = item.fieldName json.fieldName = item.fieldName
json.remark = item.remark || undefined
json.dataType = item.dataType || undefined
json.exampleValue = item.exampleValue || undefined
return json return json
}) })
this.$message.success('解析成功,请进行下一步') this.$message.success('解析成功,请进行下一步')
} }
}) })
}, },
reqCheckChange (row, checked) {
if (checked) {
let json = {}
json.paramName = row.colName
json.remark = row.colComment || undefined
json.nullable = '0'
this.form3.reqParams.push(json)
} else {
this.form3.reqParams.splice(this.form3.reqParams.findIndex(item => item.paramName === row.colName), 1)
}
},
resCheckChange (row, checked) {
if (checked) {
let json = {}
json.fieldName = row.colName
json.remark = row.colComment || undefined
json.dataType = row.dataType || undefined
this.form3.resParams.push(json)
} else {
this.form3.resParams.splice(this.form3.resParams.findIndex(item => item.fieldName === row.colName), 1)
}
},
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
this.$refs['form3'].validate(valid => { this.$refs['form3'].validate(valid => {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-s-data" round @click="apiDataCall">api调用</el-button> <el-button size="mini" icon="el-icon-s-data" round @click="apiDataCall">执行</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
</el-table> </el-table>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="请求参数" name="table1"> <el-tab-pane label="请求参数" name="table1">
<el-form ref="form" :rules="rules" :model="form">
<el-table :data="form.reqParams" stripe border <el-table :data="form.reqParams" stripe border
:max-height="300" :max-height="300"
style="width: 100%; margin: 15px 0;"> style="width: 100%; margin: 15px 0;">
...@@ -84,13 +83,10 @@ ...@@ -84,13 +83,10 @@
</el-table-column> </el-table-column>
<el-table-column prop="paramValue" label="参数值" align="center" show-overflow-tooltip > <el-table-column prop="paramValue" label="参数值" align="center" show-overflow-tooltip >
<template slot-scope="scope"> <template slot-scope="scope">
<el-form-item :prop=" 'reqParams.' + scope.$index + '.paramValue' " :rules="rules.paramValue">
<el-input v-model="scope.row.paramValue" placeholder="请输入参数值" /> <el-input v-model="scope.row.paramValue" placeholder="请输入参数值" />
</el-form-item>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-form>
</el-tab-pane> </el-tab-pane>
</el-tabs> </el-tabs>
</el-col> </el-col>
...@@ -101,7 +97,7 @@ ...@@ -101,7 +97,7 @@
<el-table :data="callData.dataList" stripe border <el-table :data="callData.dataList" stripe border
:max-height="200" :max-height="200"
style="width: 100%; margin: 15px 0;"> style="width: 100%; margin: 15px 0;">
<el-table-column label="序号" width="55" align="center"> <el-table-column label="序号" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ scope.$index + 1 }}</span> <span>{{ scope.$index + 1 }}</span>
</template> </template>
...@@ -165,9 +161,6 @@ export default { ...@@ -165,9 +161,6 @@ export default {
}, },
activeTabName: 'table0', activeTabName: 'table0',
form: {}, form: {},
rules: {
paramValue: [{ required: true, message: '参数值不能为空', trigger: 'blur' }]
},
apiHeader: {}, apiHeader: {},
apiHeaderList: [], apiHeaderList: [],
// 操作符数据字典 // 操作符数据字典
...@@ -234,10 +227,8 @@ export default { ...@@ -234,10 +227,8 @@ export default {
this.apiDataCall() this.apiDataCall()
}, },
apiDataCall () { apiDataCall () {
this.$refs.form.validate(valid => {
if (valid) {
let url = this.form.apiUrl let url = this.form.apiUrl
let header = {api_key: this.apiHeader.apiKey, secret_key: this.apiHeader.secretKey} let header = { api_key: this.apiHeader.apiKey, secret_key: this.apiHeader.secretKey }
let data = {} let data = {}
data.pageNum = this.callData.pageNum data.pageNum = this.callData.pageNum
data.pageSize = this.callData.pageSize data.pageSize = this.callData.pageSize
...@@ -274,8 +265,6 @@ export default { ...@@ -274,8 +265,6 @@ export default {
}) })
} }
} }
})
}
} }
} }
</script> </script>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
<span>{{ title }}</span> <span>{{ title }}</span>
<el-button-group style="float: right;"> <el-button-group style="float: right;">
<el-button size="mini" icon="el-icon-s-data" round @click="apiCall">数据调用</el-button> <el-button size="mini" icon="el-icon-s-data" round @click="apiCall">接口调用</el-button>
<el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button> <el-button size="mini" icon="el-icon-back" round @click="showCard">返回</el-button>
</el-button-group> </el-button-group>
</div> </div>
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="字段列表" v-if="form2.configType === '1'"> <el-form-item label="字段列表" v-if="form2.configType === '1'">
<el-table :data="fieldParamList" stripe border <el-table :data="form2.fieldParams" stripe border
:max-height="300" :max-height="300"
style="width: 100%; margin: 15px 0;"> style="width: 100%; margin: 15px 0;">
<el-table-column prop="colPosition" label="序号" width="55" align="center" > <el-table-column prop="colPosition" label="序号" width="55" align="center" >
...@@ -338,8 +338,6 @@ export default { ...@@ -338,8 +338,6 @@ export default {
sourceOptions: [], sourceOptions: [],
// 数据库表数据字典 // 数据库表数据字典
tableNameOptions: [], tableNameOptions: [],
// 数据库表字段列表
fieldParamList: [],
// 配置方式数据字典 // 配置方式数据字典
configTypeOptions: [], configTypeOptions: [],
// 操作符数据字典 // 操作符数据字典
...@@ -410,50 +408,22 @@ export default { ...@@ -410,50 +408,22 @@ export default {
this.active-- this.active--
}, },
/** 获取详情 */ /** 获取详情 */
getDataApi: function (id) { async getDataApi (id) {
getDataApi(id).then(response => { this.form1 = await getDataApi(id).then(response => {
if (response.success) { if (response.success) {
this.form1 = response.data return response.data
}
}) || {}
this.form2 = this.form1.executeConfig this.form2 = this.form1.executeConfig
this.form3.reqParams = this.form1.reqParams this.form3.reqParams = this.form1.reqParams
this.form3.resParams = this.form1.resParams this.form3.resParams = this.form1.resParams
if (this.form2.configType === '1') { if (this.form2.configType === '1') {
getDbTables(this.form2.sourceId).then(response => { this.tableNameOptions = await getDbTables(this.form2.sourceId).then(response => {
if (response.success) {
this.tableNameOptions = response.data
getDbTableColumns(this.form2.sourceId, this.form2.tableName).then(response => {
if (response.success) { if (response.success) {
this.fieldParamList = response.data return response.data
this.form1.reqParams.forEach(param => {
let paramIndex = this.fieldParamList.findIndex((item) => {
return item.colName === param.paramName
})
if (paramIndex !== -1) {
let reqParam = this.fieldParamList[paramIndex]
reqParam.reqable = true
this.$set(this.fieldParamList, paramIndex, reqParam)
}
})
this.form1.resParams.forEach(field => {
let fieldIndex = this.fieldParamList.findIndex((item) => {
return item.colName === field.fieldName
})
if (fieldIndex !== -1) {
let resParam = this.fieldParamList[fieldIndex]
resParam.resable = true
this.$set(this.fieldParamList, fieldIndex, resParam)
}
})
}
})
} }
}) }) || []
} }
if (this.form2.configType === '2') {
this.$refs.sqleditor.editor.setValue(this.form2.sqlText)
}
}
})
}, },
apiCall () { apiCall () {
this.showOptions.data.id = this.data.id this.showOptions.data.id = this.data.id
......
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="字段列表" v-if="form2.configType === '1'"> <el-form-item label="字段列表" v-if="form2.configType === '1'">
<el-table :data="fieldParamList" stripe border <el-table :data="form2.fieldParams" stripe border
:max-height="300" :max-height="300"
style="width: 100%; margin: 15px 0;"> style="width: 100%; margin: 15px 0;">
<el-table-column prop="colPosition" label="序号" width="55" align="center" > <el-table-column prop="colPosition" label="序号" width="55" align="center" >
...@@ -141,12 +141,12 @@ ...@@ -141,12 +141,12 @@
</el-table-column> </el-table-column>
<el-table-column prop="reqable" label="是否作为请求参数" align="center" width="50" > <el-table-column prop="reqable" label="是否作为请求参数" align="center" width="50" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.reqable"></el-checkbox> <el-checkbox v-model="scope.row.reqable" @change="checked=>reqCheckChange(scope.row, checked)"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="resable" label="是否作为返回参数" align="center" width="50" > <el-table-column prop="resable" label="是否作为返回参数" align="center" width="50" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-checkbox v-model="scope.row.resable"></el-checkbox> <el-checkbox v-model="scope.row.resable" @change="checked=>resCheckChange(scope.row, checked)"></el-checkbox>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -356,8 +356,6 @@ export default { ...@@ -356,8 +356,6 @@ export default {
sourceOptions: [], sourceOptions: [],
// 数据库表数据字典 // 数据库表数据字典
tableNameOptions: [], tableNameOptions: [],
// 数据库表字段列表
fieldParamList: [],
// 配置方式数据字典 // 配置方式数据字典
configTypeOptions: [], configTypeOptions: [],
// 操作符数据字典 // 操作符数据字典
...@@ -424,6 +422,7 @@ export default { ...@@ -424,6 +422,7 @@ export default {
if (this.active === 1) { if (this.active === 1) {
this.$refs['form1'].validate(valid => { this.$refs['form1'].validate(valid => {
if (valid) { if (valid) {
// 计算参数
this.active++ this.active++
} }
}) })
...@@ -447,7 +446,7 @@ export default { ...@@ -447,7 +446,7 @@ export default {
getDbTables(this.form2.sourceId).then(response => { getDbTables(this.form2.sourceId).then(response => {
if (response.success) { if (response.success) {
this.tableNameOptions = response.data this.tableNameOptions = response.data
this.fieldParamList = [] this.form2.fieldParams = []
} }
}) })
} }
...@@ -457,7 +456,7 @@ export default { ...@@ -457,7 +456,7 @@ export default {
getDbTables(val).then(response => { getDbTables(val).then(response => {
if (response.success) { if (response.success) {
this.tableNameOptions = response.data this.tableNameOptions = response.data
this.fieldParamList = [] this.form2.fieldParams = []
} }
}) })
} }
...@@ -465,7 +464,9 @@ export default { ...@@ -465,7 +464,9 @@ export default {
tableNameSelectChanged (val) { tableNameSelectChanged (val) {
getDbTableColumns(this.form2.sourceId, val).then(response => { getDbTableColumns(this.form2.sourceId, val).then(response => {
if (response.success) { if (response.success) {
this.fieldParamList = response.data this.form2.fieldParams = response.data
this.form3.reqParams = []
this.form3.resParams = []
} }
}) })
}, },
...@@ -488,20 +489,12 @@ export default { ...@@ -488,20 +489,12 @@ export default {
this.form3.reqParams = reqParams.map(function (item) { this.form3.reqParams = reqParams.map(function (item) {
let json = {} let json = {}
json.paramName = item.paramName json.paramName = item.paramName
json.nullable = item.nullable || '0' json.nullable = '0'
json.remark = item.remark || undefined
json.paramType = item.paramType || undefined
json.whereType = item.whereType || undefined
json.exampleValue = item.exampleValue || undefined
json.defaultValue = item.defaultValue || undefined
return json return json
}) })
this.form3.resParams = resParams.map(function (item) { this.form3.resParams = resParams.map(function (item) {
let json = {} let json = {}
json.fieldName = item.fieldName json.fieldName = item.fieldName
json.remark = item.remark || undefined
json.dataType = item.dataType || undefined
json.exampleValue = item.exampleValue || undefined
return json return json
}) })
this.$message.success('解析成功,请进行下一步') this.$message.success('解析成功,请进行下一步')
...@@ -509,50 +502,44 @@ export default { ...@@ -509,50 +502,44 @@ export default {
}) })
}, },
/** 获取详情 */ /** 获取详情 */
getDataApi: function (id) { async getDataApi (id) {
getDataApi(id).then(response => { this.form1 = await getDataApi(id).then(response => {
if (response.success) { if (response.success) {
this.form1 = response.data return response.data
}
}) || {}
this.form2 = this.form1.executeConfig this.form2 = this.form1.executeConfig
this.form3.reqParams = this.form1.reqParams this.form3.reqParams = this.form1.reqParams
this.form3.resParams = this.form1.resParams this.form3.resParams = this.form1.resParams
if (this.form2.configType === '1') { if (this.form2.configType === '1') {
getDbTables(this.form2.sourceId).then(response => { this.tableNameOptions = await getDbTables(this.form2.sourceId).then(response => {
if (response.success) { if (response.success) {
this.tableNameOptions = response.data return response.data
getDbTableColumns(this.form2.sourceId, this.form2.tableName).then(response => {
if (response.success) {
this.fieldParamList = response.data
this.form1.reqParams.forEach(param => {
let paramIndex = this.fieldParamList.findIndex((item) => {
return item.colName === param.paramName
})
if (paramIndex !== -1) {
let reqParam = this.fieldParamList[paramIndex]
reqParam.reqable = true
this.$set(this.fieldParamList, paramIndex, reqParam)
}
})
this.form1.resParams.forEach(field => {
let fieldIndex = this.fieldParamList.findIndex((item) => {
return item.colName === field.fieldName
})
if (fieldIndex !== -1) {
let resParam = this.fieldParamList[fieldIndex]
resParam.resable = true
this.$set(this.fieldParamList, fieldIndex, resParam)
}
})
} }
}) }) || []
}
})
} }
if (this.form2.configType === '2') { },
this.$refs.sqleditor.editor.setValue(this.form2.sqlText) reqCheckChange (row, checked) {
if (checked) {
let json = {}
json.paramName = row.colName
json.remark = row.colComment || undefined
json.nullable = '0'
this.form3.reqParams.push(json)
} else {
this.form3.reqParams.splice(this.form3.reqParams.findIndex(item => item.paramName === row.colName), 1)
} }
},
resCheckChange (row, checked) {
if (checked) {
let json = {}
json.fieldName = row.colName
json.remark = row.colComment || undefined
json.dataType = row.dataType || undefined
this.form3.resParams.push(json)
} else {
this.form3.resParams.splice(this.form3.resParams.findIndex(item => item.fieldName === row.colName), 1)
} }
})
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm: function () { submitForm: function () {
......
...@@ -121,6 +121,9 @@ ...@@ -121,6 +121,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -142,6 +145,8 @@ ...@@ -142,6 +145,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['market:dataapi:remove']" v-hasPerm="['market:dataapi:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -202,6 +207,8 @@ export default { ...@@ -202,6 +207,8 @@ export default {
// 默认选择中表格头 // 默认选择中表格头
checkedTableColumns: [], checkedTableColumns: [],
tableSize: 'medium', tableSize: 'medium',
// 状态数据字典
statusOptions: [],
// 数据集表格数据 // 数据集表格数据
dataApiList: [], dataApiList: [],
// 总数据条数 // 总数据条数
...@@ -215,6 +222,11 @@ export default { ...@@ -215,6 +222,11 @@ export default {
} }
}, },
created () { created () {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList() this.getList()
}, },
mounted () { mounted () {
...@@ -334,12 +346,11 @@ export default { ...@@ -334,12 +346,11 @@ export default {
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictLabel}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictLabel}</el-tag>
} }
} }
} }
......
...@@ -106,6 +106,9 @@ ...@@ -106,6 +106,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -120,6 +123,8 @@ ...@@ -120,6 +123,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['monitor:loginlog:remove']" v-hasPerm="['monitor:loginlog:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
...@@ -121,6 +121,9 @@ ...@@ -121,6 +121,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -135,6 +138,8 @@ ...@@ -135,6 +138,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['monitor:operlog:remove']" v-hasPerm="['monitor:operlog:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
......
...@@ -145,6 +145,9 @@ ...@@ -145,6 +145,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -187,6 +190,8 @@ ...@@ -187,6 +190,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['scheduler:job:remove']" v-hasPerm="['scheduler:job:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -246,6 +251,8 @@ export default { ...@@ -246,6 +251,8 @@ export default {
// 默认选择中表格头 // 默认选择中表格头
checkedTableColumns: [], checkedTableColumns: [],
tableSize: 'medium', tableSize: 'medium',
// 状态数据字典
statusOptions: [],
// 参数表格数据 // 参数表格数据
jobList: [], jobList: [],
// 总数据条数 // 总数据条数
...@@ -259,6 +266,11 @@ export default { ...@@ -259,6 +266,11 @@ export default {
} }
}, },
created () { created () {
this.getDicts('sys_job_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList() this.getList()
}, },
mounted () { mounted () {
...@@ -417,12 +429,11 @@ export default { ...@@ -417,12 +429,11 @@ export default {
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictLabel}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictLabel}</el-tag>
} }
} }
} }
......
...@@ -113,6 +113,9 @@ ...@@ -113,6 +113,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -127,6 +130,8 @@ ...@@ -127,6 +130,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['scheduler:log:remove']" v-hasPerm="['scheduler:log:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -181,6 +186,8 @@ export default { ...@@ -181,6 +186,8 @@ export default {
// 默认选择中表格头 // 默认选择中表格头
checkedTableColumns: [], checkedTableColumns: [],
tableSize: 'medium', tableSize: 'medium',
// 状态数据字典
statusOptions: [],
// 日志表格数据 // 日志表格数据
logList: [], logList: [],
// 总数据条数 // 总数据条数
...@@ -196,6 +203,11 @@ export default { ...@@ -196,6 +203,11 @@ export default {
} }
}, },
created () { created () {
this.getDicts('sys_normal_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getJobList() this.getJobList()
this.getList() this.getList()
}, },
...@@ -300,11 +312,11 @@ export default { ...@@ -300,11 +312,11 @@ export default {
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictLabel = this.selectDictLabel(this.statusOptions, cellValue)
if (status === '0') { if (cellValue === '1') {
return <el-tag type="warning">失败</el-tag> return <el-tag type="success">{dictLabel}</el-tag>
} else { } else {
return <el-tag type="success">成功</el-tag> return <el-tag type="warning">{dictLabel}</el-tag>
} }
} }
} }
......
...@@ -128,6 +128,9 @@ ...@@ -128,6 +128,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -149,6 +152,8 @@ ...@@ -149,6 +152,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['system:config:remove']" v-hasPerm="['system:config:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -345,12 +350,11 @@ export default { ...@@ -345,12 +350,11 @@ export default {
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictText = row.status_dictText
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictText}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictText}</el-tag>
} }
} }
} }
......
...@@ -77,6 +77,9 @@ ...@@ -77,6 +77,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -105,6 +108,8 @@ ...@@ -105,6 +108,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['system:dept:remove']" v-hasPerm="['system:dept:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -147,10 +152,17 @@ export default { ...@@ -147,10 +152,17 @@ export default {
checkedTableColumns: [], checkedTableColumns: [],
tableSize: 'medium', tableSize: 'medium',
// 部门表格数据 // 部门表格数据
deptTree: [] deptTree: [],
// 状态数据字典
statusOptions: []
} }
}, },
created () { created () {
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList() this.getList()
}, },
mounted () { mounted () {
...@@ -236,11 +248,11 @@ export default { ...@@ -236,11 +248,11 @@ export default {
}) })
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
const status = row.status let dictText = this.selectDictLabel(this.statusOptions, cellValue)
if (status === '0') { if (cellValue === '1') {
return <el-tag type="warning">禁用</el-tag> return <el-tag type="success">{dictText}</el-tag>
} else { } else {
return <el-tag type="success">启用</el-tag> return <el-tag type="warning">{dictText}</el-tag>
} }
} }
} }
......
...@@ -135,6 +135,9 @@ ...@@ -135,6 +135,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -162,6 +165,8 @@ ...@@ -162,6 +165,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['system:dict:remove']" v-hasPerm="['system:dict:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -388,12 +393,11 @@ export default { ...@@ -388,12 +393,11 @@ export default {
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictText = row.status_dictText
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictText}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictText}</el-tag>
} }
} }
} }
......
...@@ -175,7 +175,7 @@ export default { ...@@ -175,7 +175,7 @@ export default {
props: { props: {
data: { data: {
type: Object, type: Object,
default: function() { default: function () {
return {} return {}
} }
} }
...@@ -367,12 +367,11 @@ export default { ...@@ -367,12 +367,11 @@ export default {
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictText = row.status_dictText
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictText}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictText}</el-tag>
} }
} }
} }
......
...@@ -76,6 +76,9 @@ ...@@ -76,6 +76,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -104,6 +107,8 @@ ...@@ -104,6 +107,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['system:menu:remove']" v-hasPerm="['system:menu:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -161,10 +166,24 @@ export default { ...@@ -161,10 +166,24 @@ export default {
checkedTableColumns: [], checkedTableColumns: [],
tableSize: 'medium', tableSize: 'medium',
// 资源表格数据 // 资源表格数据
menuTree: [] menuTree: [],
// 类型数据字典
menuTypeOptions: [],
// 状态数据字典
statusOptions: []
} }
}, },
created () { created () {
this.getDicts('sys_menu_type').then(response => {
if (response.success) {
this.menuTypeOptions = response.data
}
})
this.getDicts('sys_common_status').then(response => {
if (response.success) {
this.statusOptions = response.data
}
})
this.getList() this.getList()
}, },
mounted () { mounted () {
...@@ -250,27 +269,27 @@ export default { ...@@ -250,27 +269,27 @@ export default {
}) })
}, },
menuIconFormatter (row, column, cellValue, index) { menuIconFormatter (row, column, cellValue, index) {
const menuIcon = row.menuIcon let menuIcon = row.menuIcon
if (menuIcon) { if (menuIcon) {
return <svg-icon class-name="size-icon" icon-class={menuIcon} /> return <svg-icon icon-class={menuIcon} />
} }
}, },
menuTypeFormatter (row, column, cellValue, index) { menuTypeFormatter (row, column, cellValue, index) {
const menuType = row.menuType let dictText = this.selectDictLabel(this.menuTypeOptions, cellValue)
if (menuType === '0') { if (cellValue === '0') {
return <el-tag type="primary">目录</el-tag> return <el-tag type="primary">{dictText}</el-tag>
} else if (menuType === '1') { } else if (cellValue === '1') {
return <el-tag type="warning">菜单</el-tag> return <el-tag type="warning">{dictText}</el-tag>
} else if (menuType === '2') { } else if (cellValue === '2') {
return <el-tag type="info">按钮</el-tag> return <el-tag type="info">{dictText}</el-tag>
} }
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
const status = row.status let dictText = this.selectDictLabel(this.statusOptions, cellValue)
if (status === '0') { if (cellValue === '1') {
return <el-tag type="warning">禁用</el-tag> return <el-tag type="success">{dictText}</el-tag>
} else { } else {
return <el-tag type="success">正常</el-tag> return <el-tag type="warning">{dictText}</el-tag>
} }
} }
} }
......
...@@ -121,6 +121,9 @@ ...@@ -121,6 +121,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -142,6 +145,8 @@ ...@@ -142,6 +145,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['system:post:remove']" v-hasPerm="['system:post:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -326,12 +331,11 @@ export default { ...@@ -326,12 +331,11 @@ export default {
this.getList() this.getList()
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictText = row.status_dictText
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictText}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictText}</el-tag>
} }
} }
} }
......
...@@ -121,6 +121,9 @@ ...@@ -121,6 +121,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -142,6 +145,8 @@ ...@@ -142,6 +145,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['system:role:remove']" v-hasPerm="['system:role:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -338,12 +343,11 @@ export default { ...@@ -338,12 +343,11 @@ export default {
return dataScope_dictText return dataScope_dictText
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictText = row.status_dictText
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictText}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictText}</el-tag>
} }
} }
} }
......
...@@ -155,6 +155,9 @@ ...@@ -155,6 +155,9 @@
</template> </template>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-popover
placement="left"
trigger="click">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
...@@ -176,6 +179,8 @@ ...@@ -176,6 +179,8 @@
@click="handleDelete(scope.row)" @click="handleDelete(scope.row)"
v-hasPerm="['system:user:remove']" v-hasPerm="['system:user:remove']"
>删除</el-button> >删除</el-button>
<el-button slot="reference">操作</el-button>
</el-popover>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
...@@ -426,12 +431,11 @@ export default { ...@@ -426,12 +431,11 @@ export default {
return row.posts.map(item => item.postName).join(',') return row.posts.map(item => item.postName).join(',')
}, },
statusFormatter (row, column, cellValue, index) { statusFormatter (row, column, cellValue, index) {
let status = row.status let dictText = row.status_dictText
let status_dictText = row.status_dictText if (cellValue === '1') {
if (status === '0') { return <el-tag type="success">{dictText}</el-tag>
return <el-tag type="warning">{status_dictText}</el-tag>
} else { } else {
return <el-tag type="success">{status_dictText}</el-tag> return <el-tag type="warning">{dictText}</el-tag>
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment