hi-ucs/back/src/views/modules/ability/bsabilityservice-add-or-upd...

1074 lines
32 KiB
Vue
Raw Normal View History

2022-06-14 09:32:49 +08:00
<template>
<div>
<el-dialog
:visible.sync="visible"
:title="disabled ? '能力展示' : '挂接'"
@close="guanbi"
:close-on-click-modal="false"
:close-on-press-escape="false"
>
<!-- 挂载和修改-->
<div key="1" v-if="!disabled">
<!-- 挂载-->
2022-06-22 14:09:52 +08:00
<div
style="
text-align: center;
font-weight: 600;
font-size: 18px;
margin-bottom: 10px;
"
>
填写字段
</div>
<el-checkbox-group
v-model="checkList"
@change="showListChagne"
style="margin-bottom: 20px"
>
<el-checkbox-button
v-for="item in dataForm.showListAll"
:label="item.name"
:key="item.id"
>{{ item.name }}</el-checkbox-button
>
2022-06-14 09:32:49 +08:00
</el-checkbox-group>
<el-form
v-if="!UpdateState"
:model="dataForm"
:rules="rules"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : 'auto'"
>
2022-06-22 14:09:52 +08:00
<div v-show="checkList.indexOf('必填信息') > -1">
<div
style="
text-align: center;
font-weight: 600;
font-size: 18px;
margin-bottom: 10px;
"
>
必填信息
</div>
2022-06-14 09:32:49 +08:00
<el-form-item label="应用名称" prop="name">
2022-06-22 14:09:52 +08:00
<el-input
v-model="dataForm.name"
placeholder="请输入组件名称"
></el-input>
2022-06-14 09:32:49 +08:00
</el-form-item>
<el-form-item label="应用描述" prop="description">
2022-06-22 14:09:52 +08:00
<el-input
v-model="dataForm.description"
placeholder="请输入组件描述"
></el-input>
2022-06-14 09:32:49 +08:00
</el-form-item>
<el-form-item label="部门联系人" prop="deptContacts">
2022-06-22 14:09:52 +08:00
<el-input
v-model="dataForm.deptContacts"
placeholder="请输入部门联系人"
></el-input>
2022-06-14 09:32:49 +08:00
</el-form-item>
<el-form-item label="部门联系人电话" prop="deptPhone">
2022-06-22 14:09:52 +08:00
<el-input
v-model="dataForm.deptPhone"
placeholder="请输入部门联系人电话"
></el-input>
2022-06-14 09:32:49 +08:00
</el-form-item>
<el-form-item label="共享条件" prop="shareCondition">
<el-select
v-model="dataForm.shareCondition"
placeholder="请选择共享条件"
>
<el-option
v-for="val in typeOptions"
:key="val.value"
:label="val.label"
:value="val.value"
>
</el-option>
</el-select>
</el-form-item>
2022-06-22 14:09:52 +08:00
<el-form-item label="共享类型" prop="shareType"
><el-select
2022-06-14 09:32:49 +08:00
v-model="dataForm.shareType"
placeholder="请选择共享类型"
>
<el-option
v-for="val in conditionOptions"
:key="val.value"
:label="val.label"
:value="val.value"
>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="共享方式" prop="shareMode">
2022-06-22 14:09:52 +08:00
<el-input
v-model="dataForm.shareMode"
placeholder="请输入共享方式"
></el-input>
2022-06-14 09:32:49 +08:00
</el-form-item>
</div>
2022-06-22 14:09:52 +08:00
<div
v-for="item in dataForm.showList"
:key="item.id"
v-show="item.name !== '必填信息'"
>
<div
style="
text-align: center;
font-weight: 600;
font-size: 18px;
margin-bottom: 10px;
"
>
{{ item.name }}
</div>
<el-form-item
:label="child.name"
v-for="child in item.children"
:key="child.id"
v-show="item.children"
>
<el-input
v-model="child.note1"
:placeholder="'请输入' + child.name"
v-if="child.type == 'input'"
></el-input>
<el-input
v-model="child.note1"
:placeholder="'请输入' + child.name"
type="textarea"
:rows="2"
v-if="child.type == 'textArea'"
></el-input>
2022-06-14 09:32:49 +08:00
<el-select
2022-06-22 14:09:52 +08:00
v-else-if="child.type == 'select'"
2022-06-14 09:32:49 +08:00
v-model="child.note1"
:placeholder="'请选择' + child.name"
>
<el-option
v-for="val in child.options"
:key="val"
:label="val"
:value="val"
>
</el-option>
</el-select>
2022-06-22 14:09:52 +08:00
<upload
v-else-if="child.type == 'images'"
:child="child"
limit="5"
accept=".jpg,.png"
></upload>
<upload
v-else-if="child.type == 'image'"
:child="child"
limit="1"
accept=".jpg,.png"
></upload>
<upload
v-else-if="child.type == 'video'"
:child="child"
limit="1"
accept=".mp4"
></upload>
2022-06-14 09:32:49 +08:00
</el-form-item>
</div>
</el-form>
<!-- 修改-->
<el-form
v-else
:model="dataFormUpdate"
ref="dataForm"
@keyup.enter.native="dataFormSubmitHandle()"
:label-width="$i18n.locale === 'en-US' ? '120px' : 'auto'"
>
<el-form-item label="应用名称">
<el-input
v-model="dataFormUpdate.name"
placeholder="应用名称"
></el-input>
</el-form-item>
<el-form-item label="应用描述">
<el-input
v-model="dataFormUpdate.description"
placeholder="应用描述"
></el-input>
</el-form-item>
<el-form-item label="访问地址">
<el-input
v-model="dataFormUpdate.link"
placeholder="访问地址"
></el-input>
</el-form-item>
<el-form-item label="部门联系人">
<el-input
v-model="dataFormUpdate.deptContacts"
placeholder="部门联系人"
></el-input>
</el-form-item>
<el-form-item label="部门联系人电话">
<el-input
v-model="dataFormUpdate.deptPhone"
placeholder="部门联系人电话"
></el-input>
</el-form-item>
<el-form-item label="共享类型">
<el-select v-model="dataFormUpdate.shareType" placeholder="请选择">
<el-option
v-for="item in typeOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<!-- <el-input v-model="dataFormUpdate.shareType" placeholder="共享类型"></el-input> -->
</el-form-item>
<el-form-item label="共享条件">
<el-select
v-model="dataFormUpdate.shareCondition"
placeholder="请选择"
>
<el-option
v-for="item in conditionOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<!-- <el-input v-model="dataFormUpdate.shareCondition" placeholder="共享条件"></el-input> -->
</el-form-item>
<el-form-item label="共享方式">
<el-input
v-model="dataFormUpdate.shareMode"
placeholder="共享方式"
></el-input>
</el-form-item>
<el-form-item label="服务接口">
<el-input
v-model="dataFormUpdate.apiUrl"
placeholder="服务接口"
></el-input>
</el-form-item>
<el-form-item label="服务接口请求方式">
<el-input
v-model="dataFormUpdate.apiMethodType"
placeholder="服务接口请求方式"
></el-input>
</el-form-item>
<el-form-item
v-for="item in dataFormUpdate.infoList"
:key="item.index"
:label="item.attrType"
>
<el-input
v-model="item.attrValue"
:placeholder="item.attrType"
v-if="
item.attrType != '应用领域' &&
2022-06-22 14:09:52 +08:00
item.attrType != '应用类型' &&
item.attrType != '发布端' &&
item.attrType != '应用状态'
2022-06-14 09:32:49 +08:00
"
></el-input>
<el-select
v-else
v-model="item.attrValue"
:placeholder="item.attrType"
>
<el-option
:value="item2.dictLabel"
v-for="item2 in item.children"
:key="item2.id"
:label="item2.dictLabel"
></el-option>
</el-select>
<!-- <el-upload
v-if="item.attrType == '应用图片'"
ref="addUpload"
class="upload-demo"
:action="fileUploadUrl"
:on-success="handleAvatarSuccess"
:before-upload="beforeAvatarUpload"
:on-remove="addUploadRemoveFile"
:on-preview="showView"
list-type="picture"
>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">
只能上传jpg/png文件且不超过200M
</div>
</el-upload> -->
</el-form-item>
</el-form>
</div>
<!-- 展示 -->
<el-form
key="2"
class="detial-form"
v-else
:label-width="$i18n.locale === 'en-US' ? '120px' : 'auto'"
>
<el-form-item label="应用名称" prop="name">
{{ dataFormShowDetails.name || "--" }}
</el-form-item>
<el-form-item label="应用描述">
{{ dataFormShowDetails.description || "--" }}
</el-form-item>
<el-form-item label="访问地址">
{{ dataFormShowDetails.link || "--" }}
</el-form-item>
<el-form-item label="部门联系人">
{{ dataFormShowDetails.deptContacts || "--" }}
</el-form-item>
<el-form-item label="部门联系人电话">
{{ dataFormShowDetails.deptPhone || "--" }}
</el-form-item>
<el-form-item label="共享类型">
{{ dataFormShowDetails.shareType || "--" }}
</el-form-item>
<el-form-item label="共享条件">
{{ dataFormShowDetails.shareCondition || "--" }}
</el-form-item>
<el-form-item label="共享方式">
{{ dataFormShowDetails.shareMode || "--" }}
</el-form-item>
<el-form-item label="服务接口">
{{ dataFormShowDetails.apiUrl || "--" }}
</el-form-item>
<el-form-item label="服务接口请求方式">
{{ dataFormShowDetails.apiMethodType || "--" }}
</el-form-item>
<el-form-item
v-for="item in dataFormShowDetails.infoList"
:key="item.index"
:label="item.attrType"
:prop="item.attrValue"
>
{{ item.attrValue || "--" }}
</el-form-item>
</el-form>
<template slot="footer" v-if="!disabled">
<el-button @click="visible = false">{{ $t("cancel") }}</el-button>
<el-button type="primary" @click="dataFormSubmitHandle()">{{
$t("confirm")
}}</el-button>
</template>
</el-dialog>
<div>
<el-dialog :visible.sync="dialogVisibleImg">
<img width="100%" :src="previewImg" />
</el-dialog>
</div>
</div>
</template>
<script>
2022-06-22 14:09:52 +08:00
import debounce from "lodash/debounce";
import dictionaries from "@/utils/dictionaries";
import { mapState } from "vuex";
import { getIconList } from "@/utils";
import Cookies from "js-cookie";
import upload from "./upload.vue";
import bus from "@/views/bus.js";
import qs from "qs";
import Vue from "vue";
2022-06-14 09:32:49 +08:00
export default {
components: {
2022-06-22 14:09:52 +08:00
upload,
2022-06-14 09:32:49 +08:00
},
2022-06-22 14:09:52 +08:00
data() {
2022-06-14 09:32:49 +08:00
return {
checkList: [],
dialogVisibleImg: false,
2022-06-22 14:09:52 +08:00
previewImg: "", // 预览图片
2022-06-14 09:32:49 +08:00
dialogVisible: false,
2022-06-22 14:09:52 +08:00
fileUploadUrl: window.SITE_CONFIG.apiURL + "/upload",
2022-06-14 09:32:49 +08:00
uploadUrl:
window.SITE_CONFIG.apiURL +
2022-06-22 14:09:52 +08:00
"/sys/oss/upload?token=" +
Cookies.get("ucsToken"),
2022-06-14 09:32:49 +08:00
companyArr: dictionaries.companyArr,
visible: false,
sceneArr: dictionaries.sceneArr,
fieldArr: dictionaries.fieldArr,
shareFormArr: dictionaries.shareFormArr,
shareTypeArr: dictionaries.shareTypeArr,
iconList: [],
iconListVisible: false,
menuListVisible: false,
UpdateState: false,
dataForm: {
2022-06-22 14:09:52 +08:00
id: "",
deptId: "",
deptContacts: "",
deptPhone: "",
dataVolume: "",
shareCondition: "",
shareType: "",
shareMode: "",
2022-06-14 09:32:49 +08:00
delFlag: 0,
2022-06-22 14:09:52 +08:00
description: "",
2022-06-14 09:32:49 +08:00
downloads: 0,
2022-06-22 14:09:52 +08:00
image: "",
2022-06-14 09:32:49 +08:00
showList: [],
infoList: [],
2022-06-22 14:09:52 +08:00
link: "",
name: "",
note1: "",
note2: "",
note3: "",
note4: "",
note5: "",
score: "",
type: "应用资源",
apiMethodType: "",
apiUrl: "",
visits: 0,
2022-06-14 09:32:49 +08:00
},
2022-06-22 14:09:52 +08:00
deptId: "",
fangwendizhi: "",
mingzi: "",
2022-06-14 09:32:49 +08:00
dataFormUpdate: {},
dataFormShowDetails: {},
infoList2: [],
infoList3: [],
typeOptions: [
2022-06-22 14:09:52 +08:00
{ value: "有条件共享", label: "有条件共享" },
{ value: "无条件共享", label: "无条件共享" },
2022-06-14 09:32:49 +08:00
],
conditionOptions: [
2022-06-22 14:09:52 +08:00
{ value: "申请", label: "申请" },
{ value: "免批申请", label: "免批申请" },
2022-06-14 09:32:49 +08:00
],
rules: {
name: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: "请输入应用名称",
trigger: "change",
},
2022-06-14 09:32:49 +08:00
],
description: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: "请输入应用描述",
trigger: "change",
},
2022-06-14 09:32:49 +08:00
],
deptContacts: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: "请输入部门联系人",
trigger: "change",
},
2022-06-14 09:32:49 +08:00
],
deptPhone: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: "请输入部门联系人电话",
trigger: "change",
},
2022-06-14 09:32:49 +08:00
],
shareCondition: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: "请选择共享条件",
trigger: "change",
},
2022-06-14 09:32:49 +08:00
],
shareType: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: "请选择请输入共享类型",
trigger: "change",
},
2022-06-14 09:32:49 +08:00
],
shareMode: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: "请输入共享方式",
trigger: "change",
},
],
},
};
2022-06-14 09:32:49 +08:00
},
props: {
disabled: {
type: Boolean,
2022-06-22 14:09:52 +08:00
default: false,
},
2022-06-14 09:32:49 +08:00
},
computed: {
2022-06-22 14:09:52 +08:00
...mapState(["catalogueTree"]),
...mapState(["departmentSelects"]),
dataRule() {
2022-06-14 09:32:49 +08:00
return {
name: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
version: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
visitUrl: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
type: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
shareType: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
shareForm: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
field: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
scene: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
deptId: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
content: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
rank: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
useInfo: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
remarks: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
2022-06-14 09:32:49 +08:00
],
isUp: [
{
required: true,
2022-06-22 14:09:52 +08:00
message: this.$t("validate.required"),
trigger: "blur",
},
],
};
},
2022-06-14 09:32:49 +08:00
},
methods: {
// 上传图片
2022-06-22 14:09:52 +08:00
handleAvatarSuccess(res, file) {
2022-06-14 09:32:49 +08:00
if (res.code !== 0) {
2022-06-22 14:09:52 +08:00
return this.$message.error("上传图片失败");
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
debugger;
2022-06-14 09:32:49 +08:00
this.dataForm.infoList.map((item, index) => {
2022-06-22 14:09:52 +08:00
if (item.attrType == "应用图片") {
2022-06-14 09:32:49 +08:00
if (!this.dataForm.infoList[index].attrValue) {
2022-06-22 14:09:52 +08:00
this.dataForm.infoList[index].attrValue = res.data;
2022-06-14 09:32:49 +08:00
} else {
2022-06-22 14:09:52 +08:00
this.dataForm.infoList[index].attrValue += ";" + res.data;
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
console.log("上传图片", this.dataForm.infoList[index]);
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
});
2022-06-14 09:32:49 +08:00
// this.imageUrl = URL.createObjectURL(file.raw);
},
2022-06-22 14:09:52 +08:00
handleAvatarSuccessone(res, file) {
2022-06-14 09:32:49 +08:00
if (res.code !== 0) {
2022-06-22 14:09:52 +08:00
return this.$message.error("上传图片失败");
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
debugger;
2022-06-14 09:32:49 +08:00
this.dataForm.infoList.map((item, index) => {
2022-06-22 14:09:52 +08:00
if (item.attrType == "子系统一图片") {
2022-06-14 09:32:49 +08:00
if (!this.dataForm.infoList[index].attrValue) {
2022-06-22 14:09:52 +08:00
this.dataForm.infoList[index].attrValue = res.data;
2022-06-14 09:32:49 +08:00
} else {
2022-06-22 14:09:52 +08:00
this.dataForm.infoList[index].attrValue = "";
this.dataForm.infoList[index].attrValue = res.data;
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
console.log("上传图片", this.dataForm.infoList[index]);
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
});
2022-06-14 09:32:49 +08:00
// this.imageUrl = URL.createObjectURL(file.raw);
},
2022-06-22 14:09:52 +08:00
handleAvatarSuccesstwo(res, file) {
2022-06-14 09:32:49 +08:00
if (res.code !== 0) {
2022-06-22 14:09:52 +08:00
return this.$message.error("上传图片失败");
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
debugger;
2022-06-14 09:32:49 +08:00
this.dataForm.infoList.map((item, index) => {
2022-06-22 14:09:52 +08:00
if (item.attrType == "子系统二图片") {
2022-06-14 09:32:49 +08:00
if (!this.dataForm.infoList[index].attrValue) {
2022-06-22 14:09:52 +08:00
this.dataForm.infoList[index].attrValue = res.data;
2022-06-14 09:32:49 +08:00
} else {
2022-06-22 14:09:52 +08:00
this.dataForm.infoList[index].attrValue = "";
this.dataForm.infoList[index].attrValue = res.data;
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
console.log("上传图片", this.dataForm.infoList[index]);
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
});
2022-06-14 09:32:49 +08:00
// this.imageUrl = URL.createObjectURL(file.raw);
},
2022-06-22 14:09:52 +08:00
handleAvatarSuccessthree(res, file) {
2022-06-14 09:32:49 +08:00
if (res.code !== 0) {
2022-06-22 14:09:52 +08:00
return this.$message.error("上传图片失败");
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
debugger;
2022-06-14 09:32:49 +08:00
this.dataForm.infoList.map((item, index) => {
2022-06-22 14:09:52 +08:00
if (item.attrType == "子系统三图片") {
2022-06-14 09:32:49 +08:00
if (!this.dataForm.infoList[index].attrValue) {
2022-06-22 14:09:52 +08:00
this.dataForm.infoList[index].attrValue = res.data;
2022-06-14 09:32:49 +08:00
} else {
2022-06-22 14:09:52 +08:00
this.dataForm.infoList[index].attrValue = "";
this.dataForm.infoList[index].attrValue = res.data;
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
console.log("上传图片", this.dataForm.infoList[index]);
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
});
2022-06-14 09:32:49 +08:00
// this.imageUrl = URL.createObjectURL(file.raw);
},
2022-06-22 14:09:52 +08:00
beforeAvatarUpload(file) {
2022-06-14 09:32:49 +08:00
const isImage =
2022-06-22 14:09:52 +08:00
file.type === "image/jpeg" ||
file.type === "image/jpg" ||
file.type === "image/png";
const isLt2M = file.size / 1024 / 1024 < 9999;
2022-06-14 09:32:49 +08:00
if (!isImage) {
2022-06-22 14:09:52 +08:00
this.$message.error("上传头像图片只能是 JPG 格式!");
2022-06-14 09:32:49 +08:00
}
if (!isLt2M) {
2022-06-22 14:09:52 +08:00
this.$message.error("上传头像图片大小不能超过 2MB!");
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
return isImage && isLt2M;
2022-06-14 09:32:49 +08:00
},
2022-06-22 14:09:52 +08:00
addUploadRemoveFile(file, fileList) {
this.$refs.addUpload.clearFiles();
this.addDataFrom.imageUrl = "";
2022-06-14 09:32:49 +08:00
},
2022-06-22 14:09:52 +08:00
showView(file) {
this.previewImg = file.url;
this.dialogVisibleImg = true;
2022-06-14 09:32:49 +08:00
},
// 获取当前管理员信息
2022-06-22 14:09:52 +08:00
getUserInfo() {
this.$http.get("/sys/user/info").then(({ data: res }) => {
this.dataForm.deptId = res.data.deptId;
this.deptId = res.data.deptId;
console.log("depid", this.dataForm);
});
2022-06-14 09:32:49 +08:00
},
2022-06-22 14:09:52 +08:00
guanbi() {
2022-06-14 09:32:49 +08:00
this.dataForm = {
2022-06-22 14:09:52 +08:00
id: "",
deptId: "",
deptContacts: "",
deptPhone: "",
dataVolume: "",
shareCondition: "",
shareType: "",
shareMode: "",
2022-06-14 09:32:49 +08:00
delFlag: 0,
2022-06-22 14:09:52 +08:00
description: "",
2022-06-14 09:32:49 +08:00
downloads: 0,
2022-06-22 14:09:52 +08:00
image: "",
2022-06-14 09:32:49 +08:00
showList: [],
infoList: [],
2022-06-22 14:09:52 +08:00
link: "",
name: "",
note1: "",
note2: "",
note3: "",
note4: "",
note5: "",
score: "",
type: "应用资源",
apiMethodType: "",
apiUrl: "",
visits: 0,
};
2022-06-14 09:32:49 +08:00
},
2022-06-22 14:09:52 +08:00
handleRemove(file, fileList) {
console.log(file, fileList);
2022-06-14 09:32:49 +08:00
},
2022-06-22 14:09:52 +08:00
handlePictureCardPreview(file) {
this.dialogImageUrl = file.url;
this.dialogVisible = true;
2022-06-14 09:32:49 +08:00
},
// 上传图片之前
2022-06-22 14:09:52 +08:00
uploadBeforeUploadHandle(file) {
2022-06-14 09:32:49 +08:00
if (
2022-06-22 14:09:52 +08:00
file.type !== "image/jpg" &&
file.type !== "image/jpeg" &&
file.type !== "image/png" &&
file.type !== "image/gif"
2022-06-14 09:32:49 +08:00
) {
2022-06-22 14:09:52 +08:00
this.$message.error("只支持jpg、png、gif格式的图片");
return false;
2022-06-14 09:32:49 +08:00
}
},
2022-06-22 14:09:52 +08:00
imgUploadSuccess(res, file, fileList) {
console.log("zzzzzzz", res, file, fileList);
2022-06-14 09:32:49 +08:00
if (res.code !== 0) {
2022-06-22 14:09:52 +08:00
return this.$message.error(res.msg);
2022-06-14 09:32:49 +08:00
}
},
2022-06-22 14:09:52 +08:00
init() {
this.getInfoList();
this.visible = true;
2022-06-14 09:32:49 +08:00
this.$nextTick(() => {
2022-06-22 14:09:52 +08:00
this.$refs.dataForm && this.$refs.dataForm.resetFields();
this.iconList = getIconList();
2022-06-14 09:32:49 +08:00
if (this.dataForm.id) {
2022-06-22 14:09:52 +08:00
this.getInfo();
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
});
2022-06-14 09:32:49 +08:00
},
// 获取属性信息
2022-06-22 14:09:52 +08:00
getInfoList() {
2022-06-14 09:32:49 +08:00
const parms = {
2022-06-22 14:09:52 +08:00
topCategoryName: "应用资源",
};
this.infoList2 = [];
2022-06-14 09:32:49 +08:00
this.$http
2022-06-22 14:09:52 +08:00
.get("/category/getAllFiledByTopCategory" + "?" + qs.stringify(parms))
2022-06-14 09:32:49 +08:00
.then(({ data: res }) => {
if (res.code !== 0) {
2022-06-22 14:09:52 +08:00
return this.$message.error(res.msg);
2022-06-14 09:32:49 +08:00
}
res.data.map((item, index) => {
if (
2022-06-22 14:09:52 +08:00
item.name.search("应用名称") == -1 &&
item.name.search("地址") == -1 &&
2022-06-14 09:32:49 +08:00
// item.name.search("描述") == -1 &&
2022-06-22 14:09:52 +08:00
item.name !== "组件描述" &&
item.name !== "组件名称" &&
item.name !== "服务接口" &&
item.name !== "共享类型" &&
item.name !== "共享条件" &&
item.name !== "共享方式" &&
item.name !== "部门联系人电话" &&
item.name !== "部门统一社会代码" &&
item.name !== "部门联系人" &&
item.name !== "服务商统一社会信用代码" &&
item.name !== "服务接口请求方式" &&
item.name !== "部门名称"
2022-06-14 09:32:49 +08:00
) {
const duixiang = {
attrType: item.name,
2022-06-22 14:09:52 +08:00
attrValue: "",
delFlag: 0,
};
this.infoList2.push(item);
if (item.isLinkToDic != "false") {
2022-06-14 09:32:49 +08:00
const xinxi = {
page: 1,
limit: 99,
dictTypeId: item.linkValue,
2022-06-22 14:09:52 +08:00
dictLabel: "",
dictValue: "",
};
2022-06-14 09:32:49 +08:00
this.$http
2022-06-22 14:09:52 +08:00
.get("/sys/dict/data/page" + "?" + qs.stringify(xinxi))
2022-06-14 09:32:49 +08:00
.then(({ data: res2 }) => {
// this.infoList2[index - 1].children = res2.data.list
this.infoList2.map((item3, index3) => {
if (item3.name == item.name) {
Vue.set(
this.infoList2[index3],
2022-06-22 14:09:52 +08:00
"children",
2022-06-14 09:32:49 +08:00
res2.data.list
2022-06-22 14:09:52 +08:00
);
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
});
2022-06-14 09:32:49 +08:00
this.dataFormUpdate.infoList.map((item3, index3) => {
if (item3.attrType == item.name) {
Vue.set(
this.dataFormUpdate.infoList[index3],
2022-06-22 14:09:52 +08:00
"children",
2022-06-14 09:32:49 +08:00
res2.data.list
2022-06-22 14:09:52 +08:00
);
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
});
2022-06-14 09:32:49 +08:00
console.log(
2022-06-22 14:09:52 +08:00
"11111111111111111111111111110",
2022-06-14 09:32:49 +08:00
this.dataFormUpdate
2022-06-22 14:09:52 +08:00
);
});
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
this.dataForm.infoList.push(duixiang);
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
});
console.log("this.infoList", this.dataFormUpdate);
2022-06-14 09:32:49 +08:00
})
2022-06-22 14:09:52 +08:00
.catch(() => {});
2022-06-14 09:32:49 +08:00
this.$http
2022-06-22 14:09:52 +08:00
.get("/sys/dict/data/page" + "?" + qs.stringify(parms))
2022-06-14 09:32:49 +08:00
.then(({ data: res }) => {
if (res.code !== 0) {
2022-06-22 14:09:52 +08:00
return this.$message.error(res.msg);
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
console.log("this.infoList", this.dataForm);
2022-06-14 09:32:49 +08:00
})
2022-06-22 14:09:52 +08:00
.catch(() => {});
2022-06-14 09:32:49 +08:00
},
// 图标, 选中
2022-06-22 14:09:52 +08:00
iconListCurrentChangeHandle(icon) {
this.dataForm.imgurl = icon;
this.iconListVisible = false;
2022-06-14 09:32:49 +08:00
},
// 上级菜单树, 选中
2022-06-22 14:09:52 +08:00
menuListTreeCurrentChangeHandle(data) {
this.dataForm.pid = data.id;
this.dataForm.type = data.name;
this.menuListVisible = false;
2022-06-14 09:32:49 +08:00
},
// 上级菜单树, 设置默认值
2022-06-22 14:09:52 +08:00
deptListTreeSetDefaultHandle() {
this.dataForm.pid = "0";
this.dataForm.type = "目录级别";
2022-06-14 09:32:49 +08:00
},
// 获取信息
2022-06-22 14:09:52 +08:00
getInfo() {
2022-06-14 09:32:49 +08:00
this.$http
2022-06-22 14:09:52 +08:00
.get("/ability/bsabilityai/" + this.dataForm.id)
2022-06-14 09:32:49 +08:00
.then(({ data: res }) => {
if (res.code !== 0) {
2022-06-22 14:09:52 +08:00
return this.$message.error(res.msg);
2022-06-14 09:32:49 +08:00
}
this.dataForm = {
...this.dataForm,
2022-06-22 14:09:52 +08:00
...res.data,
};
2022-06-14 09:32:49 +08:00
})
2022-06-22 14:09:52 +08:00
.catch(() => {});
2022-06-14 09:32:49 +08:00
},
// 表单提交
dataFormSubmitHandle: debounce(
function () {
this.$refs.dataForm.validate((valid) => {
2022-06-22 14:09:52 +08:00
this.getUserInfo();
this.dataForm.deptId = this.deptId;
2022-06-14 09:32:49 +08:00
if (!valid) {
2022-06-22 14:09:52 +08:00
this.$message.error("请检查表单是否填写完整");
return false;
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
console.log("表单数据=======================》", this.dataForm);
2022-06-14 09:32:49 +08:00
if (!this.UpdateState) {
2022-06-22 14:09:52 +08:00
this.dataForm.infoList = [];
this.dataForm.showListAll.forEach((val) => {
if (val.name !== "必填信息") {
if (val.name === "服务接口信息") {
val.children.forEach((item) => {
if (item.name === "服务接口") {
this.dataForm.apiUrl = item.note1;
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
if (item.name === "接口请求方式") {
this.dataForm.apiMethodType = item.note1;
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
if (item.name === "访问地址") {
this.dataForm.link = item.note1;
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
});
2022-06-14 09:32:49 +08:00
} else {
2022-06-22 14:09:52 +08:00
val.children.forEach((item) => {
2022-06-14 09:32:49 +08:00
this.dataForm.infoList.push({
attrType: item.name,
attrValue: item.note1,
2022-06-22 14:09:52 +08:00
delFlag: 0,
});
});
2022-06-14 09:32:49 +08:00
}
}
2022-06-22 14:09:52 +08:00
});
2022-06-14 09:32:49 +08:00
this.$http
2022-06-22 14:09:52 +08:00
.post("/resource/insert?source= b", this.dataForm)
2022-06-14 09:32:49 +08:00
.then(({ data: res }) => {
if (res.code !== 0) {
2022-06-22 14:09:52 +08:00
return this.$message.error(res.msg);
2022-06-14 09:32:49 +08:00
}
this.$message({
2022-06-22 14:09:52 +08:00
message: this.$t("prompt.success"),
type: "success",
2022-06-14 09:32:49 +08:00
duration: 500,
onClose: () => {
2022-06-22 14:09:52 +08:00
this.visible = false;
this.$emit("refreshDataList");
},
});
2022-06-14 09:32:49 +08:00
})
2022-06-22 14:09:52 +08:00
.catch(() => {});
2022-06-14 09:32:49 +08:00
} else {
this.$http
2022-06-22 14:09:52 +08:00
.put("/resource/update", this.dataFormUpdate)
2022-06-14 09:32:49 +08:00
.then(({ data: res }) => {
if (res.code !== 0) {
2022-06-22 14:09:52 +08:00
return this.$message.error(res.msg);
2022-06-14 09:32:49 +08:00
}
this.$message({
2022-06-22 14:09:52 +08:00
message: this.$t("prompt.success"),
type: "success",
2022-06-14 09:32:49 +08:00
duration: 500,
onClose: () => {
2022-06-22 14:09:52 +08:00
this.visible = false;
this.$emit("refreshDataList");
},
});
2022-06-14 09:32:49 +08:00
})
2022-06-22 14:09:52 +08:00
.catch(() => {});
2022-06-14 09:32:49 +08:00
}
2022-06-22 14:09:52 +08:00
});
2022-06-14 09:32:49 +08:00
},
1000,
{ leading: true, trailing: false }
),
2022-06-22 14:09:52 +08:00
showListChagne() {
this.dataForm.showList = this.dataForm.showListAll.filter(
(item) => this.checkList.indexOf(item.name) > -1
);
console.log(
"属性变更===================>",
this.checkList,
this.dataForm.showList,
this.dataForm.showListAll
);
},
2022-06-14 09:32:49 +08:00
},
2022-06-22 14:09:52 +08:00
mounted() {
this.getUserInfo();
2022-06-14 09:32:49 +08:00
},
2022-06-22 14:09:52 +08:00
beforeDestroy() {
console.log("销毁~~~~~~~~~~~~~~~~~~~~");
},
};
2022-06-14 09:32:49 +08:00
</script>
<style lang="scss" scoped>
::v-deep .el-dialog__body {
height: 580px;
overflow: auto;
}
.icon-input ::v-deep .el-input__inner {
cursor: pointer;
}
.detial-form ::v-deep {
.el-form-item {
margin-bottom: 0px;
line-height: 32px;
}
.el-form-item__label {
line-height: 32px;
}
.el-form-item__content {
line-height: 32px;
}
}
::v-deep .el-checkbox-button__inner {
width: 130px;
margin: 0 10px 5px;
border-left: unset !important;
border-radius: unset !important;
border: 1px solid #dcdfe6 !important;
}
</style>
<style lang="scss">
.mod-sys__menu {
.menu-list,
.icon-list {
.el-input__inner,
.el-input__suffix {
cursor: pointer;
}
}
&-icon-popover {
width: 458px;
overflow: hidden;
}
&-icon-inner {
width: 478px;
max-height: 258px;
overflow-x: hidden;
overflow-y: auto;
}
&-icon-list {
width: 458px;
padding: 0;
margin: -8px 0 0 -8px;
> .el-button {
padding: 8px;
margin: 8px 0 0 8px;
> span {
display: inline-block;
vertical-align: middle;
width: 18px;
height: 18px;
font-size: 18px;
}
}
}
}
.previewImg {
position: fixed;
z-index: 9999;
}
</style>