hi-ucs/back/src/views/modules/ability/bsabilityservice.vue

446 lines
13 KiB
Vue
Raw Normal View History

2022-06-14 09:32:49 +08:00
<template>
<el-card shadow="never" class="aui-card--fill">
<div class="mod-ability__bsabilityai">
2022-06-22 18:47:28 +08:00
<el-form :inline="true" :model="dataForm">
2022-06-14 09:32:49 +08:00
<el-form-item>
<el-input
v-model="dataForm.name"
placeholder="名称"
clearable
></el-input>
</el-form-item>
<el-form-item>
2022-06-22 18:47:28 +08:00
<el-button @click="getDataList2(dataForm.name)">{{
$t("query")
}}</el-button>
2022-06-14 09:32:49 +08:00
</el-form-item>
<el-form-item>
<el-button type="info" @click="exportHandle()">{{
$t("export")
}}</el-button>
</el-form-item>
<el-form-item>
<el-button
v-if="$hasPermission('ability:bsabilityai:save')"
type="primary"
@click="addOrUpdateHandleServe()"
>挂接</el-button
>
</el-form-item>
<el-form-item>
<el-button
v-if="$hasPermission('ability:bsabilityai:delete')"
type="danger"
@click="deleteHandle2()"
>{{ $t("deleteBatch") }}</el-button
>
</el-form-item>
2022-06-22 18:47:28 +08:00
<el-form-item>
2022-06-14 09:32:49 +08:00
<el-button @click="reset">重置</el-button>
</el-form-item>
</el-form>
<el-table
v-loading="dataListLoading"
:data="dataList"
border
@selection-change="dataListSelectionChangeHandle"
2022-06-22 18:47:28 +08:00
style="width: 100%"
2022-06-14 09:32:49 +08:00
:height="qp ? '810px' : '650px'"
>
<el-table-column
type="selection"
header-align="center"
align="center"
width="50"
></el-table-column>
<el-table-column
prop="name"
label="应用名称"
header-align="center"
align="center"
></el-table-column>
<el-table-column
v-for="(item, index) in dataList[0].infoList"
:key="index"
:label="item.attrType"
header-align="center"
align="center"
show-overflow-tooltip="true"
>
<template slot-scope="scope">
2022-06-22 18:47:28 +08:00
{{ findValue(scope.row.infoList, item.attrType) }}
2022-06-14 09:32:49 +08:00
</template>
</el-table-column>
<el-table-column
:label="$t('handle')"
fixed="right"
header-align="center"
align="center"
width="94"
right="0"
>
<template slot-scope="scope">
<el-button
v-if="$hasPermission('ability:bsabilityai:update')"
type="text"
size="small"
@click="UpdateHandle(scope.row)"
>{{ $t("update") }}</el-button
>
<el-button
v-if="$hasPermission('ability:bsabilityai:delete')"
type="text"
size="small"
@click="deleteHandle2(scope.row.id)"
>{{ $t("delete") }}</el-button
>
<el-button type="text" size="small" @click="showDetail(scope.row)"
>展示</el-button
>
2022-06-22 18:47:28 +08:00
<el-button type="text" size="small" @click="showDocument(scope.row)"
>开发文档</el-button
>
<el-button
type="text"
size="small"
@click="applyAndAssembly(scope.row)"
>应用与组件</el-button
>
<el-button
type="text"
size="small"
@click="applyAndDataResource(scope.row)"
>应用与数据资源</el-button
>
<el-button
type="text"
size="small"
@click="applyAndProject(scope.row)"
>应用与项目</el-button
>
<el-button
type="text"
size="small"
@click="applyAndInfrastructure(scope.row)"
>应用与基础设施</el-button
>
2022-06-14 09:32:49 +08:00
</template>
</el-table-column>
</el-table>
<el-pagination
:current-page="page"
:page-sizes="[10, 20, 50, 100]"
:page-size="limit"
:total="Number(total)"
layout="total, sizes, prev, pager, next, jumper"
@size-change="pageSizeChangeHandle"
@current-change="pageCurrentChangeHandle"
>
</el-pagination>
<!-- 弹窗, 新增 / 修改 -->
<add-or-update
:disabled="disabled"
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList"
></add-or-update>
2022-06-22 18:47:28 +08:00
<relate-application
v-if="relateApplicationResourceVisible"
ref="relateApplication"
:relateInfo="relationData"
@isShowRelatePopup="handleIsShowRelatePopupApply"
></relate-application>
2022-06-14 09:32:49 +08:00
</div>
</el-card>
</template>
<script>
2022-06-22 18:47:28 +08:00
import mixinViewModule from "@/mixins/view-module";
import AddOrUpdate from "./bsabilityservice-add-or-update";
import dictionaries from "@/utils/dictionaries";
import RelateApplication from "./bsabilityai-relate-application.vue";
import qs from "qs";
import { type } from "os";
2022-06-14 09:32:49 +08:00
export default {
mixins: [mixinViewModule],
2022-06-22 18:47:28 +08:00
data() {
2022-06-14 09:32:49 +08:00
return {
mixinViewModuleOptions: {
2022-06-22 18:47:28 +08:00
getDataListURL: "/resource/page",
2022-06-14 09:32:49 +08:00
getDataListIsPage: true,
2022-06-22 18:47:28 +08:00
exportURL: "/ability/bsabilityai/export",
deleteURL: "/resource/delete",
deleteIsBatch: true,
2022-06-14 09:32:49 +08:00
},
disabled: false,
sceneArr: dictionaries.sceneArr,
fieldArr: dictionaries.fieldArr,
shareFormArr: dictionaries.shareFormArr,
dataForm: {
2022-06-22 18:47:28 +08:00
name: "",
creator: "",
2022-06-14 09:32:49 +08:00
selectType: 0,
delFlag: 0,
2022-06-22 18:47:28 +08:00
type: "应用资源",
2022-06-14 09:32:49 +08:00
},
2022-06-22 18:47:28 +08:00
qp: false,
relateApplicationResourceVisible: false,
relationData: {}, //打开穿梭框时传递的参数
};
2022-06-14 09:32:49 +08:00
},
watch: {},
components: {
2022-06-22 18:47:28 +08:00
AddOrUpdate,
RelateApplication,
2022-06-14 09:32:49 +08:00
},
2022-06-22 18:47:28 +08:00
created() {
this.dataForm.name = "";
this.dataForm.type = "应用资源";
2022-06-14 09:32:49 +08:00
},
2022-06-22 18:47:28 +08:00
mounted() {
window.addEventListener("resize", this.a);
this.fullScreen();
2022-06-14 09:32:49 +08:00
},
methods: {
2022-06-22 18:47:28 +08:00
reset() {
this.$http
.get(
this.mixinViewModuleOptions.getDataListURL +
"?" +
qs.stringify({
// order: this.order,
// orderField: this.orderField,
// type: '组件服务',
page: 1,
selectType: 0,
limit: 10,
delFlag: 0,
creator: "",
type: "应用资源",
name: "",
})
)
.then(({ data: res }) => {
this.dataForm.name = "";
if (res.code !== 0) {
this.dataList = [];
this.total = 0;
return this.$message.error(res.msg);
}
this.dataList = this.mixinViewModuleOptions.getDataListIsPage
? res.data.list
: res.data;
this.total = this.mixinViewModuleOptions.getDataListIsPage
? res.data.total
: 0;
if (this.mixinViewModuleOptions.requestCallback) {
this.mixinViewModuleOptions.requestCallback(res.data);
}
this.dataListLoading = false;
2022-06-14 09:32:49 +08:00
})
2022-06-22 18:47:28 +08:00
.catch(() => {
this.dataListLoading = false;
});
2022-06-14 09:32:49 +08:00
},
2022-06-22 18:47:28 +08:00
showDetail(val) {
this.addOrUpdateVisible = true;
this.disabled = false;
2022-06-14 09:32:49 +08:00
this.$nextTick(() => {
2022-06-22 18:47:28 +08:00
this.$refs.addOrUpdate.UpdateState = false;
this.$refs.addOrUpdate.dataFormShowDetails = val;
this.$refs.addOrUpdate.init();
});
this.disabled = true;
2022-06-14 09:32:49 +08:00
},
2022-06-22 18:47:28 +08:00
showDocument(val) {
console.log(val);
window.open(
window.SITE_CONFIG.frontUrl + "?id=" + val.id + "&&type=" + val.type,
"_blank"
);
2022-06-14 09:32:49 +08:00
},
2022-06-22 18:47:28 +08:00
findValue(list, type) {
const found = list.find((item) => item.attrType === type);
2022-06-14 09:32:49 +08:00
if (found) {
2022-06-22 18:47:28 +08:00
return found.attrValue;
2022-06-14 09:32:49 +08:00
} else {
2022-06-22 18:47:28 +08:00
return "暂无数据";
2022-06-14 09:32:49 +08:00
}
},
2022-06-22 18:47:28 +08:00
getDataList2(names) {
2022-06-14 09:32:49 +08:00
if (names != null) {
2022-06-22 18:47:28 +08:00
this.$http
.get(
this.mixinViewModuleOptions.getDataListURL +
"?" +
qs.stringify({
// order: this.order,
// orderField: this.orderField,
// type: '组件服务',
pageNum: 1,
pageSize: this.limit,
type: "应用资源",
creator: "",
selectType: 0,
delFlag: 0,
name: names,
})
)
2022-06-14 09:32:49 +08:00
.then(({ data: res }) => {
if (res.code !== 0) {
2022-06-22 18:47:28 +08:00
this.dataList = [];
this.total = 0;
return this.$message.error(res.msg);
2022-06-14 09:32:49 +08:00
}
if (res.data.list.length !== 0) {
2022-06-22 18:47:28 +08:00
this.dataList = res.data.list;
this.total = this.mixinViewModuleOptions.getDataListIsPage
? res.data.total
: 0;
2022-06-14 09:32:49 +08:00
if (this.mixinViewModuleOptions.requestCallback) {
2022-06-22 18:47:28 +08:00
this.mixinViewModuleOptions.requestCallback(res.data);
2022-06-14 09:32:49 +08:00
}
2022-06-22 18:47:28 +08:00
this.dataListLoading = false;
2022-06-14 09:32:49 +08:00
} else {
2022-06-22 18:47:28 +08:00
this.$message.error("未查询到相关信息");
this.reset();
2022-06-14 09:32:49 +08:00
}
})
2022-06-22 18:47:28 +08:00
.catch(() => {
this.dataListLoading = false;
});
2022-06-14 09:32:49 +08:00
} else {
2022-06-22 18:47:28 +08:00
this.$message.error("查询不能输入为空");
2022-06-14 09:32:49 +08:00
}
},
2022-06-22 18:47:28 +08:00
fullScreen() {
2022-06-14 09:32:49 +08:00
if (window.outerHeight === screen.availHeight) {
if (window.outerWidth === screen.availWidth) {
console.log(
2022-06-22 18:47:28 +08:00
"全屏1",
2022-06-14 09:32:49 +08:00
window.outerHeight,
screen.availHeight,
window.outerWidth,
screen.availWidth
2022-06-22 18:47:28 +08:00
);
this.qp = false;
2022-06-14 09:32:49 +08:00
} else {
console.log(
2022-06-22 18:47:28 +08:00
"不是全屏2",
2022-06-14 09:32:49 +08:00
window.outerHeight,
screen.availHeight,
window.outerWidth,
screen.availWidth
2022-06-22 18:47:28 +08:00
);
this.qp = true;
2022-06-14 09:32:49 +08:00
}
} else {
console.log(
2022-06-22 18:47:28 +08:00
"不是全屏3",
2022-06-14 09:32:49 +08:00
window.outerHeight,
screen.availHeight,
window.outerWidth,
screen.availWidth
2022-06-22 18:47:28 +08:00
);
this.qp = true;
2022-06-14 09:32:49 +08:00
}
2022-06-22 18:47:28 +08:00
},
//应用与组件
applyAndAssembly(val) {
console.log("vvvv", val);
//根据id和类型查询已关联的组件将id,type和查出来的数据传递给组件
let type = "组件服务";
let id = val.id;
this.$http
.get(`/dataResourceRel/queryResourceRelByKeyId`, {
params: {
keyId: id,
type: type,
referenceName: "",
},
})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
console.log("rrrrressssz", res.data);
this.relateApplicationResourceVisible = true;
this.relationData = {
id: id,
linkType: "1",
responseData: res.data,
};
console.log(" this.relationData", this.relationData);
//将数据传递给引入的组件
});
},
//应用与数据资源
applyAndDataResource(val) {
console.log("数据资源");
},
//应用与项目
applyAndProject(val) {
let type = "项目";
let id = val.id;
this.$http
.get(`/dataResourceRel/queryResourceRelByKeyId`, {
params: {
keyId: id,
type: type,
referenceName: "",
},
})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
console.log("rrrrressssx", res.data);
this.relateApplicationResourceVisible = true;
this.relationData = {
id: id,
linkType: "1",
responseData: res.data,
};
//将数据传递给引入的组件
});
},
//应用与基础设施
applyAndInfrastructure(val) {
let type = "基础设施";
let id = val.id;
this.$http
.get(`/dataResourceRel/queryResourceRelByKeyId`, {
params: {
keyId: id,
type: type,
referenceName: "",
},
})
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
console.log("rrrrressssj", res.data);
this.relateApplicationResourceVisible = true;
this.relationData = {
id: id,
linkType: "1",
responseData: res.data,
};
//将数据传递给引入的组件
});
},
// 是否展示关联应用弹窗
handleIsShowRelatePopupApply(type) {
this.relateApplicationResourceVisible = type;
},
},
};
2022-06-14 09:32:49 +08:00
</script>
<style lang="scss" scoped>
.el-tooltip__popper {
max-width: 50%;
}
</style>