主数据修改、数据源、显示字段

This commit is contained in:
hyt 2024-06-13 14:48:19 +08:00
parent e99bb385b6
commit a549dedf45
8 changed files with 1921 additions and 1379 deletions

View File

@ -12,34 +12,6 @@ const addForm = [
} }
] ]
}, },
{
elCol: [
{
type: 'select',
title: '主数据类型',
id: 'mdmType',
row: 24,
disabled: false,
required: true,
options: [],
fontSize: 16
}
]
},
// {
// elCol: [
// {
// type: "input",
// title: "服务名",
// id: "mdmCode",
// row: 24,
// disabled: true,
// required: false,
// fontSize: 16,
// placeholder: "编辑时自动带出"
// },
// ],
// },
{ {
elCol: [ elCol: [
{ {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -5,7 +5,8 @@
<div class="search"> <div class="search">
<div class="chunk"> <div class="chunk">
<el-input placeholder="主数据名称" v-model="searchForm.mdmName" <el-input placeholder="主数据名称" v-model="searchForm.mdmName"
@change="submitsearchForm"> @change="submitsearchForm"
>
<i slot="suffix" class="el-input__icon el-icon-search" @click="submitsearchForm"></i> <i slot="suffix" class="el-input__icon el-icon-search" @click="submitsearchForm"></i>
</el-input> </el-input>
</div> </div>
@ -18,127 +19,189 @@
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<el-button type="primary" icon="el-icon-plus" @click="addApp">新增</el-button> <!-- <el-button type="primary" icon="el-icon-plus" @click="addApp">新增</el-button>-->
<el-button type="primary" icon="el-icon-plus" @click="tableButtonHandle({},{type:'new'})">新增</el-button>
</div> </div>
</header> </header>
<main> <main>
<BaseTable ref="mainTable" :tableData="tableData" :tableColumn="tableColumn" :funData="funData" <div class="tableData">
:funWidth="funWidth" :showIndex="true" :tabLoading="mainTabLoading" @onFunc="tableButtonHandle" <div class="tableChunk" v-for="(row,index) in tableData" :key="index">
:tableHeight="'70vh'" :border="false"> <div class="topInfo">
<template v-slot:mdmName="{ row }"> <div class="left">
<div class="nameCard"> <div class="icon">
<div class="image" v-loading="row.imgLoading"> <template v-if="row.imgUrl">
<template v-if="row.imgUrl"> <img :src="row.imgUrl" alt="">
<img :src="row.imgUrl" alt=""/> </template>
</template> <template v-else>
<template v-else> <img src="./images/icon.png" alt="">
<img src="./images/icon.png"> </template>
</template> </div>
<div class="vision"></div>
</div> </div>
<div class="nameInfo"> <div class="tableInfo">
<div class="name">{{ row.mdmName }}</div> <div class="tableName">
<div class="name">{{ row.mdmName }}</div>
</div>
<div class="tableType">档案</div>
<div class="tableContent">
{{ row.remark }}
</div>
</div>
<!-- 遮罩层显示两按钮-->
</div>
<div class="shade">
<div class="btnList">
<div class="setting" @click="tableButtonHandle(row,{type:'setting'})">
<div class="icon">
<img src="./images/设置.png" alt="">
</div>
<div class="name">设置</div>
</div>
<div class="dele" @click="deleteHandle(row)">
<div class="icon">
<img src="./images/删除.png" alt="">
</div>
<div class="name">删除</div>
</div>
</div> </div>
</div> </div>
</template> </div>
<template v-slot:accessMode="{ row }"> </div>
<div class="taskClasses"> <!-- <BaseTable ref="mainTable" :tableData="tableData" :tableColumn="tableColumn" :funData="funData"-->
<span :class="`state${item}`" v-for="(item,index) in JSON.parse(row.accessMode)" <!-- :funWidth="funWidth" :showIndex="true" :tabLoading="mainTabLoading" @onFunc="tableButtonHandle"-->
:key="index">{{ methods_dist[item] }}</span> <!-- :tableHeight="'70vh'" :border="false">-->
</div> <!-- <template v-slot:mdmName="{ row }">-->
</template> <!-- <div class="nameCard">-->
<template v-slot:interfaceStatus="{ row }"> <!-- <div class="image" v-loading="row.imgLoading">-->
<el-switch active-value="1" inactive-value="2" active-color="#60c958" v-model="row.interfaceStatus" <!-- <template v-if="row.imgUrl">-->
disabled></el-switch> <!-- <img :src="row.imgUrl" alt=""/>-->
</template> <!-- </template>-->
<template v-slot:dbStatus="{ row }"> <!-- <template v-else>-->
<el-switch active-value="1" inactive-value="2" active-color="#60c958" v-model="row.dbStatus" <!-- <img src="./images/icon.png">-->
disabled></el-switch> <!-- </template>-->
</template> <!-- </div>-->
<template v-slot:appStatus="{ row }"> <!-- <div class="nameInfo">-->
<el-switch active-value="1" inactive-value="2" active-color="#60c958" v-model="row.appStatus" <!-- <div class="name">{{ row.mdmName }}</div>-->
@change="(val)=>appStatusChange(val,row)"></el-switch> <!-- </div>-->
</template> <!-- </div>-->
</BaseTable> <!-- </template>-->
<!-- <template v-slot:accessMode="{ row }">-->
<!-- <div class="taskClasses">-->
<!-- <span :class="`state${item}`" v-for="(item,index) in JSON.parse(row.accessMode)"-->
<!-- :key="index">{{ methods_dist[item] }}</span>-->
<!-- </div>-->
<!-- </template>-->
<!-- <template v-slot:interfaceStatus="{ row }">-->
<!-- <el-switch active-value="1" inactive-value="2" active-color="#60c958" v-model="row.interfaceStatus"-->
<!-- disabled></el-switch>-->
<!-- </template>-->
<!-- <template v-slot:dbStatus="{ row }">-->
<!-- <el-switch active-value="1" inactive-value="2" active-color="#60c958" v-model="row.dbStatus"-->
<!-- disabled></el-switch>-->
<!-- </template>-->
<!-- <template v-slot:appStatus="{ row }">-->
<!-- <el-switch active-value="1" inactive-value="2" active-color="#60c958" v-model="row.appStatus"-->
<!-- @change="(val)=>appStatusChange(val,row)"></el-switch>-->
<!-- </template>-->
<!-- </BaseTable>-->
</main> </main>
<footer> <footer>
<basePage :pageModel="pageModel" @update:pageModel="currentChangeHandle"></basePage> <!-- <basePage :pageModel="pageModel" @update:pageModel="currentChangeHandle"></basePage>-->
</footer> </footer>
</div> </div>
</template> </template>
<script> <script>
import configData from "./configData.js"; import configData from './configData.js'
import dayjs from "dayjs"; import dayjs from 'dayjs'
import BaseTable from "@/views/intergrationTask/compoments/baseTable.vue"; import BaseTable from '@/views/intergrationTask/compoments/baseTable.vue'
import basePage from "@/views/intergrationTask/compoments/basePage.vue"; import basePage from '@/views/intergrationTask/compoments/basePage.vue'
import {getApiModuleApi} from "@/api/apiChunks/index.js"; import { getApiModuleApi } from '@/api/apiChunks/index.js'
import {downloadLogo} from "@/api/apis/logo.js"; import { downloadLogo } from '@/api/apis/logo.js'
import request from "@/utils/request"; import request from '@/utils/request'
import { authApi } from '@/api/apis/auth'
export default { export default {
name: "listOfApps", name: 'listOfApps',
data() { data() {
return { return {
refreshLoading: false, refreshLoading: false,
searchForm: { searchForm: {
task_name: "", task_name: ''
}, },
imgLoading:false, imgLoading: false,
mainTabLoading: false, mainTabLoading: false,
funData: [ funData: [
{ {
type: "setting", type: 'setting',
text: "设置", text: '设置',
color: "#5a9cf8", color: '#5a9cf8'
}, }
], ],
tableColumn: configData.tableColumn, tableColumn: configData.tableColumn,
tableData: [], tableData: [],
imgUrl: "", imgUrl: '',
pageModel: { pageModel: {
pageIndex: 1, pageIndex: 1,
total: 10, total: 10,
limit: 10, limit: 10
}, },
classOptions: [], classOptions: [],
stateOptions: [ stateOptions: [
{ {
label: "启用", label: '启用',
value: "1", value: '1'
}, },
{ {
label: "停用", label: '停用',
value: "2", value: '2'
}, }
], ],
methods_dist: { methods_dist: {
1: "接口", 1: '接口',
2: "H5", 2: 'H5',
3: "PC网页", 3: 'PC网页',
4: "PC应用程序", 4: 'PC应用程序'
}, }
}; }
}, },
methods: { methods: {
//
deleteHandle(row) {
this.$confirm('是否删除此行?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async() => {
this.openLoading('del')
const res = await authApi('mdmModuleService', '', 'deleteMdm', '', {
id: row.id
})
this.$vmNews('删除成功!', 'success')
this.initMainTableData()
})
},
// //
async appStatusChange(val, row) { async appStatusChange(val, row) {
const res = await getApiModuleApi({ const res = await getApiModuleApi({
tl: "sysApplicationService", tl: 'sysApplicationService',
as: "application", as: 'application',
dj: "enableOrDisableApp" dj: 'enableOrDisableApp'
}, {id: row.id, appStatus: val}) }, { id: row.id, appStatus: val })
this.$vmNews(res.msg, 'success') this.$vmNews(res.msg, 'success')
}, },
async initSelectOptions() { async initSelectOptions() {
let params = { let params = {
tab_name: "mdm", tab_name: 'mdm',
column_name: "mdm_type", column_name: 'mdm_type'
}; }
const res = await getApiModuleApi({ const res = await getApiModuleApi({
tl: "generalServiceImpl", tl: 'generalServiceImpl',
as: "dictionaryshop", as: 'dictionaryshop',
dj: "selectDictionaryshop" dj: 'selectDictionaryshop'
}, params) }, params)
this.classOptions = []; this.classOptions = []
res.attribute.forEach((item) => { res.attribute.forEach((item) => {
this.classOptions.push({ this.classOptions.push({
label: item.column_content, label: item.column_content,
@ -149,52 +212,51 @@ export default {
// //
addApp() { addApp() {
this.$router.push({ this.$router.push({
path: "/integrationOption/masterDataAdd", path: '/integrationOption/masterDataAdd',
query: {flag: "add"}, query: { flag: 'add' }
}); })
}, },
// //
getTimeHandler(time) { getTimeHandler(time) {
var days = parseInt(time / (1000 * 60 * 60 * 24)); var days = parseInt(time / (1000 * 60 * 60 * 24))
var hours = parseInt((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); var hours = parseInt((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
var minutes = parseInt((time % (1000 * 60 * 60)) / (1000 * 60)); var minutes = parseInt((time % (1000 * 60 * 60)) / (1000 * 60))
var seconds = (time % (1000 * 60)) / 1000; var seconds = (time % (1000 * 60)) / 1000
return days + "天" + hours + "小时" + minutes + "分钟" + seconds + "秒"; return days + '天' + hours + '小时' + minutes + '分钟' + seconds + '秒'
}, },
// //
async initMainTableData(obj = {}) { async initMainTableData(obj = {}) {
this.refreshLoading = true; this.refreshLoading = true
const res = await getApiModuleApi( const res = await getApiModuleApi(
{ {
tl: "mdmService", tl: 'mdmModuleService',
as: "mdmService", as: '',
dj: "queryMdmPage", dj: 'queryMdm'
}, },
{ {
pageNum: this.pageModel.pageIndex, ...obj
pageSize: this.pageModel.limit,
...obj,
} }
); )
this.refreshLoading = false; this.refreshLoading = false
if (res.status == 200) { if (res.status == 200) {
this.pageModel.total = res.attribute.total; // this.pageModel.total = res.attribute.total
this.imgLoading = true this.imgLoading = true
res.attribute.list.map(el => { res.attribute.map(el => {
this.$set(el,'imgLoading',true) this.$set(el, 'imgLoading', true)
return request({ return request({
url: "/kangarooDataCenterV3/entranceController/fileDownloadNew?id=" + el.mdmLogo, url: '/kangarooDataCenterV3/entranceController/fileDownloadNew?id=' + el.mdmLogo,
method: "get", method: 'get',
responseType: 'arraybuffer' responseType: 'arraybuffer'
}).then((res) => { }).then((res) => {
el.imgLoading = false el.imgLoading = false
if(!res.byteLength) return if (!res.byteLength) return
let tempImgUrl = let tempImgUrl =
"data:image/png/jpg;base64," + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), "")); 'data:image/png/jpg;base64,' + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), ''))
this.$set(el, 'imgUrl', tempImgUrl) this.$set(el, 'imgUrl', tempImgUrl)
}) })
}) })
this.tableData = res.attribute.list; console.log(res,'res')
this.tableData = res.attribute
} }
}, },
// //
@ -207,63 +269,69 @@ export default {
}, },
// //
submitsearchForm() { submitsearchForm() {
this.initMainTableData(this.searchForm); this.initMainTableData(this.searchForm)
}, },
// //
tableButtonHandle(val, item) { tableButtonHandle(val, item) {
if (item.type === "setting") { if (item.type === 'setting') {
this.$router.push({ this.$router.push({
path: "/integrationOption/settingMenu/masterDataEdit", path: '/integrationOption/settingMenu/masterDataEdit',
query: {flag: "setting", id: val.id, name: val.name, appLogo: val.appLogo}, query: { flag: 'setting', id: val.id, name: val.name, appLogo: val.appLogo }
}); })
} else if (item.type === "copy") { } else if (item.type === 'copy') {
this.$router.push({ this.$router.push({
path: "/applicationList/applicationAdd/masterDataEdit", path: '/applicationList/applicationAdd/masterDataEdit',
query: {flag: "copy", id: val.id, appLogo: val.appLogo}, query: { flag: 'copy', id: val.id, appLogo: val.appLogo }
}); })
} else if (item.type === 'new') {
this.$router.push({
path: '/integrationOption/settingMenu/masterDataEdit',
query: { flag: 'new' }
})
} }
}, },
// //
currentChangeHandle(pageModel) { currentChangeHandle(pageModel) {
this.pageModel = pageModel; this.pageModel = pageModel
this.$nextTick(() => { this.$nextTick(() => {
this.initMainTableData(this.searchForm); this.initMainTableData(this.searchForm)
}); })
}, }
}, },
computed: { computed: {
// //
funWidth() { funWidth() {
return this.funData.length * 70; return this.funData.length * 70
}, }
}, },
components: { components: {
BaseTable, BaseTable,
basePage, basePage
}, },
created() { created() {
// this.initMainTableData(); // this.initMainTableData();
this.initSelectOptions() this.initSelectOptions()
}, },
activated() { activated() {
this.initMainTableData(this.searchForm); this.initMainTableData(this.searchForm)
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
if (!to.path.includes("applicationList") if (!to.path.includes('applicationList')
) { ) {
next(); next()
this.$destroy("listOfApps"); this.$destroy('listOfApps')
} else { } else {
next(); next()
} }
}, }
}; }
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss">
::v-deep .el-button { ::v-deep .el-button {
border-radius: 16px; border-radius: 16px;
} }
.monitoring { .monitoring {
position: relative; position: relative;
width: 100%; width: 100%;
@ -295,9 +363,180 @@ export default {
main { main {
margin-top: 10px; margin-top: 10px;
padding: 20px 20px 5px; padding: 20px 20px 5px;
height: 75vh; height: 80vh;
border-radius: 20px; border-radius: 20px;
background-color: #fff; background-color: #fff;
overflow: auto;
.tableData {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
.tableChunk {
width: 30%;
margin-bottom: 30px;
margin-left: 2.5%;
border-radius: 24px;
border: 2px solid #E5E5E5;
padding-bottom: 20px;
position: relative;
overflow: hidden;
.topInfo {
display: flex;
margin: 20px 0 0 26px;
.left {
.icon {
width: 88px;
height: 88px;
border-radius: 16px;
border: 1px solid #F0F0F2;
padding: 14px;
> img {
width: 60px;
height: 60px;
}
}
//.vision{
// margin-top: 10px;
// margin-left: 30px;
// width: 29px;
// height: 16px;
// border-radius: 2px;
// border: 1px solid #FF8B0F;
//}
}
.tableInfo {
margin-left: 15px;
.tableName {
display: flex;
align-items: center;
> .name {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 24px;
color: #333333;
line-height: 33px;
text-align: left;
font-style: normal;
}
}
.tableType {
margin-top: 11px;
width: 38px;
height: 24px;
background: #1478F6;
border-radius: 5px;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 12px;
color: #FFFFFF;
text-align: center;
line-height: 24px;
font-style: normal;
}
.tableContent {
margin-top: 5px;
width: 95%;
height: 60px;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 14px;
color: #999999;
line-height: 20px;
text-align: left;
font-style: normal;
display: -webkit-box; /*作为弹性伸缩盒子模型显示。*/
-webkit-box-orient: vertical; /*作为弹性伸缩盒子模型显示。*/
-webkit-line-clamp: 3; //**/
overflow: hidden; /*溢出隐藏*/
/* 对于连字情况或者纯字母,可以解决 */
word-break: break-all;
}
}
}
.shade {
display: none;
position: absolute;
z-index: 10;
width: 100%;
height: 100%;
top: 0;
background-color: rgba(0, 0, 0, .7);
.btnList {
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
.setting {
cursor: pointer;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.icon {
img {
width: 44px;
height: 44px;
}
}
.name {
margin-top: 10px;
color: #fff;
font-weight: 700;
}
}
.dele {
cursor: pointer;
margin-left: 50px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.icon {
img {
width: 44px;
height: 44px;
}
}
.name {
margin-top: 10px;
color: red;
font-weight: 700;
}
}
}
}
&:hover {
.shade {
display: block !important;
}
}
}
}
} }
footer { footer {
@ -309,6 +548,7 @@ export default {
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
width: 100%; width: 100%;
.image { .image {
width: 29px; width: 29px;
height: 29px; height: 29px;

View File

@ -2,76 +2,106 @@
<template> <template>
<div class="wrap"> <div class="wrap">
<div class="btn"> <div class="btn">
<div class="chunk"> <div class="title">主数据信息</div>
<el-button icon="el-icon-back" @click=" <div class="chunkList">
<div class="chunk">
<el-button icon="el-icon-back" @click="
$router.replace({ path: '/integrationOption/masterDataOptions' }) $router.replace({ path: '/integrationOption/masterDataOptions' })
">返回 "
</el-button> >返回
</div> </el-button>
<div class="chunk"> </div>
<el-button icon="el-icon-first-aid-kit" type="primary" @click="saveHandle" :loading="saveLoading">保存 <div class="chunk">
</el-button> <el-button v-if="showForm" icon="el-icon-first-aid-kit" type="primary" @click="saveHandle"
</div> :loading="saveLoading"
</div> >保存
<div class="main"> </el-button>
<div class="upload"> <el-button v-else icon="el-icon-first-aid-kit" type="primary" @click="showForm=true">编辑
<div class="title">主数据基本信息</div> </el-button>
<div class="uploadMain">
<div class="left">
<div class="title">主数据logo</div>
<el-upload class="avatar-uploader" ref="upload" action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview" :on-progress="handleProgress" :before-upload="beforeUpload"
list-type="picture" :limit="1" :disabled="lookFlag" :on-success="handleAvatarSuccess"
:show-file-list="false">
<div class="line">
<div class="left" v-loading="imgLoading">
<img v-if="imgUrl" :src="imgUrl" class="avatar">
<img v-else src="./images/icon.png" alt="">
</div>
<div class="right" v-if="!lookFlag">
<el-button size="small" type="primary" :loading="loading">点击上传</el-button>
</div>
</div>
<div slot="tip" class="el-upload__tip" v-if="!lookFlag">
只能上传jpg/png文件且不超过2MB
</div>
</el-upload>
</div>
<div class="right">
</div>
</div> </div>
</div> </div>
<div class="form">
<baseNewForm ref="mainForm" :spanNumber="24" :isFunBtn="false" :lookFlag="lookFlag" :formRule="!lookFlag" </div>
:formRow="formRow" :ruleForm="ruleForm" @onSubmit="onSubmit"></baseNewForm> <div class="main">
</div> <!-- 展示页-->
<template v-if="!showForm">
<div class="planInfo">
<div class="img">
<img v-if="imgUrl" :src="imgUrl" class="avatar">
<img v-else src="./images/icon.png" alt="">
</div>
<div class="info">
<div class="name">{{ this.ruleForm.mdmName }}</div>
<div class="remark">{{ this.ruleForm.remark }}</div>
</div>
</div>
</template>
<template v-if="showForm">
<!-- 编辑页-->
<div class="upload">
<div class="uploadMain">
<div class="left">
<div class="title">主数据logo</div>
<el-upload class="avatar-uploader" ref="upload" action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview" :on-progress="handleProgress" :before-upload="beforeUpload"
list-type="picture" :limit="1" :disabled="lookFlag" :on-success="handleAvatarSuccess"
:show-file-list="false"
>
<div class="line">
<div class="left" v-loading="imgLoading">
<img v-if="imgUrl" :src="imgUrl" class="avatar">
<img v-else src="./images/icon.png" alt="">
</div>
<div class="right" v-if="!lookFlag">
<el-button size="small" type="primary" :loading="loading">点击上传</el-button>
</div>
</div>
<div slot="tip" class="el-upload__tip" v-if="!lookFlag">
只能上传jpg/png文件且不超过2MB
</div>
</el-upload>
</div>
<div class="right">
</div>
</div>
</div>
<div class="form">
<baseNewForm ref="mainForm" :spanNumber="24" :isFunBtn="false" :lookFlag="lookFlag" :formRule="!lookFlag"
:formRow="formRow" :ruleForm="ruleForm" @onSubmit="onSubmit"
></baseNewForm>
</div>
</template>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import {getApiModuleApi} from "@/api/apiChunks/index.js"; import { getApiModuleApi } from '@/api/apiChunks/index.js'
import configData from "./configData"; import configData from './configData'
import baseNewForm from "@/views/intergrationTask/compoments/baseNewForm"; import baseNewForm from '@/views/intergrationTask/compoments/baseNewForm'
import request from "@/utils/request"; import request from '@/utils/request'
import { authApi } from '@/api/apis/auth'
export default { export default {
data() { data() {
return { return {
fileList: [], fileList: [],
iconBase64: "", iconBase64: '',
imgUrl: "", imgUrl: '',
loading: false, loading: false,
appLogo: "", appLogo: '',
ruleForm: { ruleForm: {
accessMode: [], accessMode: []
}, },
lookFlag: false, lookFlag: false,
formRow: configData.addForm, formRow: configData.addForm,
imgLoading: false, imgLoading: false,
saveLoading: false, saveLoading: false,
}; showForm: false,
billid: ''
}
}, },
methods: { methods: {
// //
@ -85,21 +115,21 @@ export default {
}, },
async handleAvatarSuccess(res, file) { async handleAvatarSuccess(res, file) {
this.loading = true this.loading = true
this.$refs.upload.clearFiles();// this.$refs.upload.clearFiles()//
this.imgUrl = URL.createObjectURL(file.raw); this.imgUrl = URL.createObjectURL(file.raw)
let formData = new FormData(); let formData = new FormData()
formData.append("file", file.raw); formData.append('file', file.raw)
formData.append("fileFlag", true); formData.append('fileFlag', true)
formData.append("businessType", "application"); formData.append('businessType', 'application')
return request({ return request({
url: "/kangarooDataCenterV3/entranceController/fileUpload", url: '/kangarooDataCenterV3/entranceController/fileUpload',
method: "post", method: 'post',
data: formData, data: formData
}).then((res) => { }).then((res) => {
if (res.status === '200') { if (res.status === '200') {
console.log(res) console.log(res)
this.$vmNews("上传成功", "success") this.$vmNews('上传成功', 'success')
this.appLogo = res.attribute.id this.appLogo = res.attribute.id
} }
}) })
@ -107,70 +137,65 @@ export default {
}, },
async beforeUpload(file) { async beforeUpload(file) {
if ( if (
file.type.split("/")[1] != "jpeg" && file.type.split('/')[1] != 'jpeg' &&
file.type.split("/")[1] != "png" file.type.split('/')[1] != 'png'
) { ) {
this.$message({ this.$message({
type: "warning", type: 'warning',
message: "只能上传jpg/png文件", message: '只能上传jpg/png文件'
}); })
return return
} else { } else {
if (file.size >= 2000000) { if (file.size >= 2000000) {
this.$message({ this.$message({
type: "warning", type: 'warning',
message: "文件大小不超过2MB", message: '文件大小不超过2MB'
}); })
return return
} }
} }
}, },
// //
saveHandle() { saveHandle() {
this.$refs.mainForm.submitForm(); this.$refs.mainForm.submitForm()
}, },
// //
async onSubmit() { async onSubmit() {
this.saveLoading = true this.saveLoading = true
if (this.$route.query.flag === "add") { if (!this.billid) {
const res = await getApiModuleApi({ this.openLoading('submit')
tl: "mdmService", const res = await authApi('mdmModuleService', '', 'saveMdm', '', {
as: "mdmService", updateType: 1, ...this.ruleForm, mdmLogo: this.appLogo, mdmType: 1
dj: "doSaveMdmModule" })
}, {...this.ruleForm, mdmLogo: this.appLogo}) this.$vmNews('保存成功', 'success')
if (res.status === '200') { this.saveLoading = false
this.$vmNews("保存成功", "success") this.$emit('saveSuccessInit', res, this.initEditFormData)
this.saveLoading = false this.showForm = false
this.$router.replace({path: '/integrationOption/masterDataOptions'}) } else {
} this.openLoading('submit')
} else if (this.$route.query.flag === "setting") { const res = await authApi('mdmModuleService', '', 'updateMdm', '', {
const res = await getApiModuleApi({ ...this.ruleForm,
tl: "mdmService", mdmLogo: this.appLogo,
as: "mdmService", mdmType: 1
dj: "doSaveMdmModule" })
}, {updateType: 1, ...this.ruleForm, mdmLogo: this.appLogo}) this.$vmNews('保存成功', 'success')
if (res.status === '200') { this.saveLoading = false
this.$vmNews("保存成功", "success") this.showForm = false
this.initEditFormData() this.$emit('saveSuccess')
this.getLogoUrl()
this.saveLoading = false
this.$emit("saveSuccess")
}
} }
}, },
// // (
async initSelectOptions() { async initSelectOptions() {
let params = { let params = {
tab_name: "mdm", tab_name: 'mdm',
column_name: "mdm_type", column_name: 'mdm_type'
}; }
const res = await getApiModuleApi({ const res = await getApiModuleApi({
tl: "generalServiceImpl", tl: 'generalServiceImpl',
as: "dictionaryshop", as: 'dictionaryshop',
dj: "selectDictionaryshop" dj: 'selectDictionaryshop'
}, params) }, params)
this.formRow[1].elCol[0].options = [] this.formRow[1].elCol[0].options = []
res.attribute.forEach((item) => { res.attribute.forEach((item) => {
@ -184,19 +209,20 @@ export default {
// - // -
async initCopyFormData() { async initCopyFormData() {
const res = await getApiModuleApi({ const res = await getApiModuleApi({
tl: "sysApplicationService", tl: 'sysApplicationService',
as: "application", as: 'application',
dj: "getCopyApp" dj: 'getCopyApp'
}, {id: this.$route.query.id}) }, { id: this.$route.query.id })
this.ruleForm = res.attribute this.ruleForm = res.attribute
this.ruleForm.accessMode = JSON.parse(res.attribute.accessMode) this.ruleForm.accessMode = JSON.parse(res.attribute.accessMode)
}, },
async initEditFormData() { async initEditFormData() {
this.openLoading('detail')
const res = await getApiModuleApi({ const res = await getApiModuleApi({
tl: "mdmService", tl: 'mdmModuleService',
as: "mdmService", as: '',
dj: "queryMdmModule" dj: 'getMdm'
}, {id: this.$route.query.id}) }, { id: this.billid })
this.ruleForm = res.attribute this.ruleForm = res.attribute
if (res.attribute.mdmLogo) { if (res.attribute.mdmLogo) {
this.appLogo = res.attribute.mdmLogo this.appLogo = res.attribute.mdmLogo
@ -210,8 +236,8 @@ export default {
this.imgLoading = true this.imgLoading = true
let id = this.appLogo ? this.appLogo : this.$route.query.appLogo let id = this.appLogo ? this.appLogo : this.$route.query.appLogo
return request({ return request({
url: "/kangarooDataCenterV3/entranceController/fileDownloadNew?id=" + id, url: '/kangarooDataCenterV3/entranceController/fileDownloadNew?id=' + id,
method: "get", method: 'get',
responseType: 'arraybuffer' responseType: 'arraybuffer'
}).then((res) => { }).then((res) => {
this.imgLoading = false this.imgLoading = false
@ -220,85 +246,24 @@ export default {
return return
} }
this.imgUrl = this.imgUrl =
"data:image/png/jpg;base64," + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), "")); 'data:image/png/jpg;base64,' + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), ''))
}) })
} }
}, },
components: { components: {
baseNewForm, baseNewForm
}, },
created() { created() {
// options // options
this.initSelectOptions() // this.initSelectOptions()
// //
if (this.$route.query.flag === "setting") { if (this.$route.query.id) {
this.formRow = [ this.billid = this.$route.query.id
{
elCol: [
{
type: "input",
title: "主数据名称",
id: "mdmName",
row: 24,
disabled: false,
required: true,
fontSize: 16
},
],
},
{
elCol: [
{
type: "select",
title: "主数据类型",
id: "mdmType",
row: 24,
disabled: false,
required: true,
options: [],
fontSize: 16,
},
],
},
{
elCol: [
{
type: "input",
title: "服务名",
id: "mdmCode",
row: 24,
disabled: true,
required: false,
fontSize: 16,
placeholder: "编辑时自动带出"
},
],
},
{
elCol: [
{
type: "textrea",
title: "备注",
id: "remark",
row: 24,
disabled: false,
fontSize: 16
},
],
},
]
} else {
}
if (this.$route.query.flag === "copy") {
this.initCopyFormData()
} else if (this.$route.query.flag === "setting") {
this.initEditFormData() this.initEditFormData()
} }
}, }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
@ -311,22 +276,85 @@ export default {
} }
.wrap { .wrap {
background-color: #fbfbfb; background-color: #fff;
width: 100%; width: 100%;
overflow: auto; overflow: auto;
border-radius: 8px;
margin-left: 10px;
> .btn { > .btn {
display: flex; display: flex;
justify-content: flex-end; justify-content: space-between;
align-items: center;
> .chunk { .title {
margin-left: 10px; margin-left: 32px;
font-family: PingFangSC, PingFang SC;
font-weight: 600;
font-size: 18px;
color: #333333;
line-height: 25px;
text-align: left;
font-style: normal;
} }
.chunkList {
display: flex;
> .chunk {
margin-left: 10px;
}
}
} }
> .main { > .main {
margin-top: 10px; margin-top: 10px;
> .planInfo {
margin-top: 17px;
padding-bottom: 20px;
display: flex;
align-items: center;
> .img {
margin-left: 24px;
width: 64px;
height: 64px;
img {
width: 100%;
height: 100%;
}
}
.info {
margin-left: 11px;
.name {
margin-bottom: 14px;
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 18px;
color: #333333;
line-height: 25px;
text-align: left;
font-style: normal;
}
.remark {
font-family: PingFangSC, PingFang SC;
font-weight: 400;
font-size: 16px;
color: #999999;
line-height: 25px;
text-align: left;
font-style: normal;
}
}
}
> .upload { > .upload {
background-color: #fff; background-color: #fff;
border-radius: 16px; border-radius: 16px;
@ -338,7 +366,6 @@ export default {
} }
> .uploadMain { > .uploadMain {
margin-top: 20px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;

View File

@ -22,17 +22,19 @@
</div> </div>
</div> </div>
<div class="content"> <div class="content">
<router-view @saveSuccess="saveSuccess" @flashActive="flashActive"></router-view> <router-view ref="routerChunk" :build="billid" @saveSuccess="saveSuccess" @saveSuccessInit="saveSuccessInit"
@flashActive="flashActive"
></router-view>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import {getApiModuleApi} from "@/api/apiChunks/index.js"; import { getApiModuleApi } from '@/api/apiChunks/index.js'
import configData from "./configData"; import configData from './configData'
// //
import masterDataAdd from "./masterDataAdd.vue"; import masterDataAdd from './masterDataAdd.vue'
import request from "@/utils/request"; import request from '@/utils/request'
export default { export default {
@ -41,29 +43,38 @@ export default {
menuActived: 0, menuActived: 0,
settingMunu: configData.settingMenu, settingMunu: configData.settingMenu,
query: this.$route.query, query: this.$route.query,
name: "", name: '',
imgUrl: "", imgUrl: '',
versionNumber: "", versionNumber: '',
imgLoading: false, imgLoading: false,
}; billid: ''
}
}, },
methods: { methods: {
//
saveSuccessInit(res, fun) {
console.log(res, 'res')
this.billid = res.attribute.id
this.$refs.routerChunk.billid = this.billid
this.initEditFormData()
fun()
},
flashActive(val) { flashActive(val) {
this.menuActived = val this.menuActived = val
}, },
async initEditFormData() { async initEditFormData() {
const res = await getApiModuleApi({ const res = await getApiModuleApi({
tl: "mdmService", tl: 'mdmModuleService',
as: "mdmService", as: '',
dj: "queryMdmModule" dj: 'getMdm'
}, {id: this.$route.query.id}) }, { id: this.billid })
if (res.status === '200') { if (res.status === '200') {
this.name = res.attribute.mdmName this.name = res.attribute.mdmName
//logo //logo
this.imgLoading = true this.imgLoading = true
return request({ return request({
url: "/kangarooDataCenterV3/entranceController/fileDownloadNew?id=" + res.attribute.mdmLogo, url: '/kangarooDataCenterV3/entranceController/fileDownloadNew?id=' + res.attribute.mdmLogo,
method: "get", method: 'get',
responseType: 'arraybuffer' responseType: 'arraybuffer'
}).then((res) => { }).then((res) => {
this.imgLoading = false this.imgLoading = false
@ -72,7 +83,7 @@ export default {
return return
} }
this.imgUrl = this.imgUrl =
"data:image/png/jpg;base64," + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), "")); 'data:image/png/jpg;base64,' + btoa(new Uint8Array(res).reduce((data, byte) => data + String.fromCharCode(byte), ''))
}) })
} }
}, },
@ -81,25 +92,34 @@ export default {
this.initEditFormData() this.initEditFormData()
}, },
menuClick(index, item) { menuClick(index, item) {
console.log(index, item)
if (index !== 0 && !this.billid) {
this.$vmNews('当前为新增请先新增后再跳转该模块')
return
}
if (item.path && !this.$route.path.includes(item.path)) { if (item.path && !this.$route.path.includes(item.path)) {
this.menuActived = index; this.menuActived = index
this.$set(this.query, 'id', this.billid)
this.$router.replace({ this.$router.replace({
name: item.path, name: item.path,
query: this.query query: this.query
}); })
} }
}, }
}, },
components: { components: {
masterDataAdd, masterDataAdd
}, },
created() { mounted() {
this.initEditFormData() if (this.$route.query.flag !== 'new') {
this.billid = this.$route.query.id
this.initEditFormData()
}
} }
}; }
</script> </script>
<style scoped lang='scss'> <style scoped lang="scss">
.settingMenu { .settingMenu {
width: 100%; width: 100%;
display: flex; display: flex;