|
@@ -5,60 +5,60 @@
|
|
|
@Date: 2021-03-09
|
|
|
-->
|
|
|
<template>
|
|
|
- <div class="u-right__table">
|
|
|
- <!--搜索-->
|
|
|
- <el-form :model="reportPersonFrom" label-suffix=":" label-width="90px" ref="reportPersonFrom">
|
|
|
- <dg-row :gutter="20">
|
|
|
- <dg-col :span="5">
|
|
|
- <el-form-item label="应用名称" prop="appName.value">
|
|
|
- <el-input clearable v-model="reportPersonFrom.appName.value"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </dg-col>
|
|
|
- <dg-col :span="5">
|
|
|
- <el-form-item label="应用代码" prop="appCode.value">
|
|
|
- <el-input clearable v-model="reportPersonFrom.appCode.value"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </dg-col>
|
|
|
- <dg-col :span="5">
|
|
|
- <el-form-item label="服务名称" prop="serviceName.value">
|
|
|
- <el-input clearable v-model="reportPersonFrom.serviceName.value"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </dg-col>
|
|
|
- <dg-col :span="5">
|
|
|
- <el-form-item label="服务代码" prop="serviceCode.value">
|
|
|
- <el-input clearable v-model="reportPersonFrom.serviceCode.value"></el-input>
|
|
|
- </el-form-item>
|
|
|
- </dg-col>
|
|
|
- <dg-col :span="4" class="u-search__btn">
|
|
|
- <dg-button @click="handleSearch" icon="el-icon-search" type="primary">查询</dg-button>
|
|
|
- <dg-button @click="handleReset" icon="el-icon-refresh-right" type="primary">重置</dg-button>
|
|
|
- </dg-col>
|
|
|
- </dg-row>
|
|
|
- <div class="u-table-top__btn">
|
|
|
- <dg-button @click="handleAddDialog" icon="el-icon-circle-plus-outline" type="primary">新增</dg-button>
|
|
|
- </div>
|
|
|
- </el-form>
|
|
|
- <!--表格-->
|
|
|
- <Table :condition="reportPersonFrom" :headerData="titleData" :url="tableUrl" ref="table">
|
|
|
+ <div class="u-right__table">
|
|
|
+ <!--搜索-->
|
|
|
+ <el-form :model="reportPersonFrom" label-suffix=":" label-width="90px" ref="reportPersonFrom">
|
|
|
+ <dg-row :gutter="20">
|
|
|
+ <dg-col :span="5">
|
|
|
+ <el-form-item label="应用名称" prop="appName.value">
|
|
|
+ <el-input clearable v-model="reportPersonFrom.appName.value"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </dg-col>
|
|
|
+ <dg-col :span="5">
|
|
|
+ <el-form-item label="应用代码" prop="appCode.value">
|
|
|
+ <el-input clearable v-model="reportPersonFrom.appCode.value"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </dg-col>
|
|
|
+ <dg-col :span="5">
|
|
|
+ <el-form-item label="服务名称" prop="serviceName.value">
|
|
|
+ <el-input clearable v-model="reportPersonFrom.serviceName.value"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </dg-col>
|
|
|
+ <dg-col :span="5">
|
|
|
+ <el-form-item label="服务代码" prop="serviceCode.value">
|
|
|
+ <el-input clearable v-model="reportPersonFrom.serviceCode.value"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </dg-col>
|
|
|
+ <dg-col :span="4" class="u-search__btn">
|
|
|
+ <dg-button @click="handleSearch" icon="el-icon-search" type="primary">查询</dg-button>
|
|
|
+ <dg-button @click="handleReset" icon="el-icon-refresh-right" type="primary">重置</dg-button>
|
|
|
+ </dg-col>
|
|
|
+ </dg-row>
|
|
|
+ <div class="u-table-top__btn">
|
|
|
+ <dg-button @click="handleAddDialog" icon="el-icon-circle-plus-outline" type="primary">新增</dg-button>
|
|
|
+ </div>
|
|
|
+ </el-form>
|
|
|
+ <!--表格-->
|
|
|
+ <Table :condition="reportPersonFrom" :headerData="titleData" :url="tableUrl" ref="table">
|
|
|
|
|
|
- <dg-table-column align="center" fixed="right" label="操作" width="120">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div class="u-table__operation">
|
|
|
- <el-tooltip
|
|
|
- :content="item.tooltip"
|
|
|
- :key="'table' + i"
|
|
|
- effect="dark"
|
|
|
- placement="top-end"
|
|
|
- v-for="(item, i) in optList"
|
|
|
- >
|
|
|
- <i :class="item.icon" @click="item.on(scope.row)"/>
|
|
|
- </el-tooltip>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </dg-table-column>
|
|
|
+ <dg-table-column align="center" fixed="right" label="操作" width="120">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div class="u-table__operation">
|
|
|
+ <el-tooltip
|
|
|
+ :content="item.tooltip"
|
|
|
+ :key="'table' + i"
|
|
|
+ effect="dark"
|
|
|
+ placement="top-end"
|
|
|
+ v-for="(item, i) in optList"
|
|
|
+ >
|
|
|
+ <i :class="item.icon" @click="item.on(scope.row)"/>
|
|
|
+ </el-tooltip>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </dg-table-column>
|
|
|
|
|
|
- </Table>
|
|
|
- </div>
|
|
|
+ </Table>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
@@ -71,165 +71,164 @@ import * as api from "@/api/service-delegate";
|
|
|
|
|
|
// const editorArea = ["900px", "610px"];
|
|
|
export default {
|
|
|
- name: "index",
|
|
|
- // 接收父页面传过来的属性
|
|
|
- props: {},
|
|
|
- components: {
|
|
|
- Table
|
|
|
- },
|
|
|
- // 页面数据绑定
|
|
|
- data() {
|
|
|
- const that = this;
|
|
|
- return {
|
|
|
- tableUrl: api.tableUrl,
|
|
|
- titleData: [
|
|
|
- {label: "应用名称", prop: "appName"},
|
|
|
- {label: "应用代码", prop: "appCode"},
|
|
|
- {label: "服务名称", prop: "serviceName"},
|
|
|
- {label: "服务代码", prop: "serviceCode"},
|
|
|
- {label: "创建时间", prop: "createTime"}
|
|
|
- ],
|
|
|
- optList: [
|
|
|
- {icon: "el-icon-edit", tooltip: "修改", on: that.handleEditor},
|
|
|
- {icon: "el-icon-document", tooltip: "详情", on: that.handleDetail},
|
|
|
- {icon: "el-icon-delete", tooltip: "删除", on: that.handleDelete}
|
|
|
- ],
|
|
|
- reportPersonFrom: {
|
|
|
- appName: {value: "", op: "like"},
|
|
|
- serviceName: {value: "", op: "like"},
|
|
|
- appCode: {value: "", op: "like"},
|
|
|
- serviceCode: {value: "", op: "like"}
|
|
|
- },
|
|
|
- // 应用下拉数据
|
|
|
- appNameList: [],
|
|
|
- // 服务名称下拉数据
|
|
|
- serviceNameList: []
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- console.log(this.$store.getters)
|
|
|
- },
|
|
|
- // 计算属性
|
|
|
- computed: {},
|
|
|
- // 方法
|
|
|
- methods: {
|
|
|
- success(message = "操作成功!") {
|
|
|
- const that = this;
|
|
|
- that.$message.success(message);
|
|
|
+ name: "index",
|
|
|
+ // 接收父页面传过来的属性
|
|
|
+ props: {},
|
|
|
+ components: {
|
|
|
+ Table
|
|
|
},
|
|
|
- fail(message = "操作失败", error) {
|
|
|
- const that = this;
|
|
|
- console.error("[Error]", error);
|
|
|
- that.$message.error(message);
|
|
|
+ // 页面数据绑定
|
|
|
+ data() {
|
|
|
+ const that = this;
|
|
|
+ return {
|
|
|
+ tableUrl: api.tableUrl,
|
|
|
+ titleData: [
|
|
|
+ {label: "应用名称", prop: "appName"},
|
|
|
+ {label: "应用代码", prop: "appCode"},
|
|
|
+ {label: "服务名称", prop: "serviceName"},
|
|
|
+ {label: "服务代码", prop: "serviceCode"},
|
|
|
+ {label: "创建时间", prop: "createTime"}
|
|
|
+ ],
|
|
|
+ optList: [
|
|
|
+ {icon: "el-icon-edit", tooltip: "修改", on: that.handleEditor},
|
|
|
+ {icon: "el-icon-document", tooltip: "详情", on: that.handleDetail},
|
|
|
+ {icon: "el-icon-delete", tooltip: "删除", on: that.handleDelete}
|
|
|
+ ],
|
|
|
+ reportPersonFrom: {
|
|
|
+ appName: {value: "", op: "like"},
|
|
|
+ serviceName: {value: "", op: "like"},
|
|
|
+ appCode: {value: "", op: "like"},
|
|
|
+ serviceCode: {value: "", op: "like"}
|
|
|
+ },
|
|
|
+ // 应用下拉数据
|
|
|
+ appNameList: [],
|
|
|
+ // 服务名称下拉数据
|
|
|
+ serviceNameList: []
|
|
|
+ };
|
|
|
},
|
|
|
- // 查询
|
|
|
- handleSearch() {
|
|
|
- this.$refs.table.handleSearchClick();
|
|
|
+ created() {
|
|
|
+ console.log(this.$store.getters)
|
|
|
},
|
|
|
- // 重置
|
|
|
- handleReset() {
|
|
|
- const that = this;
|
|
|
- this.$refs.reportPersonFrom.resetFields();
|
|
|
- },
|
|
|
- // 刷新表格
|
|
|
- reloadTable() {
|
|
|
- const that = this;
|
|
|
- that.$refs.table.$refs.grid.reload();
|
|
|
- },
|
|
|
-
|
|
|
- // 新增
|
|
|
- handleAddDialog() {
|
|
|
- const that = this;
|
|
|
- const layer = that.$dgLayer({
|
|
|
- title: "添加",
|
|
|
- shade: [0.4, "#FFF"],
|
|
|
- content: Editor,
|
|
|
- props: {
|
|
|
- type: "create"
|
|
|
+ // 计算属性
|
|
|
+ computed: {},
|
|
|
+ // 方法
|
|
|
+ methods: {
|
|
|
+ success(message = "操作成功!") {
|
|
|
+ const that = this;
|
|
|
+ that.$message.success(message);
|
|
|
},
|
|
|
- area: ["640px", "340px"],
|
|
|
- on: {
|
|
|
- success(bool = false) {
|
|
|
- layer.close(layer.dialogIndex);
|
|
|
- if (bool) {
|
|
|
- that.reloadTable();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- },
|
|
|
- // 修改
|
|
|
- handleEditor({id}) {
|
|
|
- const that = this;
|
|
|
- api.detail(id)
|
|
|
- .then(res => {
|
|
|
- const layer = that.$dgLayer({
|
|
|
- title: "修改",
|
|
|
- shade: [0.4, "#FFF"],
|
|
|
- content: Editor,
|
|
|
- area: ["640px", "340px"],
|
|
|
- props: {
|
|
|
- id: id,
|
|
|
- type: "update",
|
|
|
- formData: res
|
|
|
- },
|
|
|
- on: {
|
|
|
- success(bool = false) {
|
|
|
- layer.close(layer.dialogIndex);
|
|
|
- if (bool) {
|
|
|
- that.reloadTable();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- that.fail("详情获取失败!", error);
|
|
|
- });
|
|
|
- },
|
|
|
- // 详情
|
|
|
- handleDetail({id}) {
|
|
|
- const that = this;
|
|
|
- api.detail(id)
|
|
|
- .then(res => {
|
|
|
+ fail(message = "操作失败", error) {
|
|
|
+ const that = this;
|
|
|
+ console.error("[Error]", error);
|
|
|
+ that.$message.error(message);
|
|
|
+ },
|
|
|
+ // 查询
|
|
|
+ handleSearch() {
|
|
|
+ this.$refs.table.handleSearchClick();
|
|
|
+ },
|
|
|
+ // 重置
|
|
|
+ handleReset() {
|
|
|
+ const that = this;
|
|
|
+ this.$refs.reportPersonFrom.resetFields();
|
|
|
+ },
|
|
|
+ // 刷新表格
|
|
|
+ reloadTable() {
|
|
|
+ const that = this;
|
|
|
+ that.$refs.table.$refs.grid.reload();
|
|
|
+ },
|
|
|
+
|
|
|
+ // 新增
|
|
|
+ handleAddDialog() {
|
|
|
+ const that = this;
|
|
|
const layer = that.$dgLayer({
|
|
|
- title: "详情",
|
|
|
- shade: [0.4, "#FFF"],
|
|
|
- content: Detail,
|
|
|
- props: {
|
|
|
- formData: res
|
|
|
- },
|
|
|
- on: {
|
|
|
- success() {
|
|
|
- layer.close(layer.dialogIndex);
|
|
|
+ title: "添加",
|
|
|
+ shade: [0.4, "#FFF"],
|
|
|
+ content: Editor,
|
|
|
+ props: {
|
|
|
+ type: "create"
|
|
|
+ },
|
|
|
+ area: ["640px", "340px"],
|
|
|
+ on: {
|
|
|
+ success(bool = false) {
|
|
|
+ layer.close(layer.dialogIndex);
|
|
|
+ if (bool) {
|
|
|
+ that.reloadTable();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- },
|
|
|
- area: ["640px", "430px"]
|
|
|
});
|
|
|
- })
|
|
|
- .catch(error => {
|
|
|
- that.fail("详情获取失败!", error);
|
|
|
- });
|
|
|
- },
|
|
|
- handleDelete({id}) {
|
|
|
- // console.log(id)
|
|
|
- const that = this;
|
|
|
- that.$confirm(`确定删除?`, "确认信息", {
|
|
|
- distinguishCancelAndClose: true,
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消"
|
|
|
- }).then(() => {
|
|
|
- api.del(id)
|
|
|
- .then(() => {
|
|
|
- that.reloadTable();
|
|
|
- that.success("删除成功!");
|
|
|
- })
|
|
|
- .catch(err => {
|
|
|
- that.fail(err, "error");
|
|
|
+ },
|
|
|
+ // 修改
|
|
|
+ handleEditor({id}) {
|
|
|
+ const that = this;
|
|
|
+ api.detail(id)
|
|
|
+ .then(res => {
|
|
|
+ const layer = that.$dgLayer({
|
|
|
+ title: "修改",
|
|
|
+ shade: [0.4, "#FFF"],
|
|
|
+ content: Editor,
|
|
|
+ area: ["640px", "340px"],
|
|
|
+ props: {
|
|
|
+ id: id,
|
|
|
+ type: "update",
|
|
|
+ formData: res
|
|
|
+ },
|
|
|
+ on: {
|
|
|
+ success(bool = false) {
|
|
|
+ layer.close(layer.dialogIndex);
|
|
|
+ if (bool) {
|
|
|
+ that.reloadTable();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ that.fail("详情获取失败!", error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 详情
|
|
|
+ handleDetail({id}) {
|
|
|
+ const that = this;
|
|
|
+ api.detail(id)
|
|
|
+ .then(res => {
|
|
|
+ const layer = that.$dgLayer({
|
|
|
+ title: "详情",
|
|
|
+ shade: [0.4, "#FFF"],
|
|
|
+ content: Detail,
|
|
|
+ props: {
|
|
|
+ formData: res
|
|
|
+ },
|
|
|
+ on: {
|
|
|
+ success() {
|
|
|
+ layer.close(layer.dialogIndex);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ area: ["640px", "430px"]
|
|
|
+ });
|
|
|
+ })
|
|
|
+ .catch(error => {
|
|
|
+ that.fail("详情获取失败!", error);
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleDelete({id}) {
|
|
|
+ const that = this;
|
|
|
+ that.$confirm(`确定删除?`, "确认信息", {
|
|
|
+ distinguishCancelAndClose: true,
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消"
|
|
|
+ }).then(() => {
|
|
|
+ api.del(id)
|
|
|
+ .then(() => {
|
|
|
+ that.reloadTable();
|
|
|
+ that.success("删除成功!");
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ that.fail(err, "error");
|
|
|
+ });
|
|
|
});
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
};
|
|
|
</script>
|
|
|
|