主数据v3本地化更新,动态按钮权限更新,集成任务日志明细字段更新。

This commit is contained in:
hyt 2024-05-16 16:21:27 +08:00
parent 9c6e772276
commit 1eb2f79229
14 changed files with 649 additions and 481 deletions

View File

@ -545,7 +545,7 @@ export default {
}, },
refresh() { refresh() {
this.ruleForm = Object.assign({}, ""); this.ruleForm = Object.assign({}, "");
this.$emit("onQuery", this.mergeParam(true)); this.$emit("onQuery", this.mergeParam(true),this.ruleForm);
}, },
testEnter() { testEnter() {
if (this.enterClickType) { if (this.enterClickType) {

View File

@ -4,7 +4,7 @@ import dialogDrag from './dialog/drag'
import dialogDragWidth from './dialog/dragWidth' import dialogDragWidth from './dialog/dragWidth'
import dialogDragHeight from './dialog/dragHeight' import dialogDragHeight from './dialog/dragHeight'
import clipboard from './module/clipboard' import clipboard from './module/clipboard'
import btnPermission from "@/directive/permission/btnPermission";
const install = function(Vue) { const install = function(Vue) {
Vue.directive('hasRole', hasRole) Vue.directive('hasRole', hasRole)
Vue.directive('hasPermi', hasPermi) Vue.directive('hasPermi', hasPermi)
@ -12,6 +12,7 @@ const install = function(Vue) {
Vue.directive('dialogDrag', dialogDrag) Vue.directive('dialogDrag', dialogDrag)
Vue.directive('dialogDragWidth', dialogDragWidth) Vue.directive('dialogDragWidth', dialogDragWidth)
Vue.directive('dialogDragHeight', dialogDragHeight) Vue.directive('dialogDragHeight', dialogDragHeight)
Vue.directive("btnPermission", btnPermission);
} }
if (window.Vue) { if (window.Vue) {

View File

@ -0,0 +1,17 @@
import store from "@/store";
export default {
inserted(el, bindling) {
let perVal = bindling.value.btnID;
let routeId = bindling.value.routeId;
if (perVal && routeId) {
let perObj = store.getters.getButtonPre;
if (Object.keys(perObj).length) {
let hasPer = perObj[routeId] && perObj[routeId].includes(perVal);
if (!hasPer) {
el.parentNode.removeChild(el);
}
}
}
},
};

View File

@ -0,0 +1,11 @@
import btnPermission from "@/directive/permission/btnPermission";
const directives = {
btnPermission,
};
export default {
install(Vue) {
Object.keys(directives).forEach((key) => {
Vue.directive(key, directives[key]);
});
},
};

View File

@ -66,6 +66,8 @@ Vue.directive('enterNumber', {
}) })
} }
}) })
import Directives from "@/directive/permission/index";
Vue.use(Directives);
import { download } from '@/utils/request' import { download } from '@/utils/request'
import { openLoading, closeLoading } from '@/utils/loading' import { openLoading, closeLoading } from '@/utils/loading'

View File

@ -1,77 +1,129 @@
import router from "./router"; import router from './router'
import store from "./store"; import store from './store'
import { Message } from "element-ui"; import { Message } from 'element-ui'
import NProgress from "nprogress"; import NProgress from 'nprogress'
import "nprogress/nprogress.css"; import 'nprogress/nprogress.css'
import { getToken, getCompanyId } from "@/utils/auth"; import { getToken, getCompanyId } from '@/utils/auth'
import { isRelogin, getButtonLish } from "@/utils/request"; import { isRelogin, getButtonLish } from '@/utils/request'
import { authApi } from '@/api/apis/auth'
import { getInfo } from '@/utils/auth'
NProgress.configure({ NProgress.configure({
showSpinner: false, showSpinner: false
}); })
const whiteList = [ const whiteList = [
"/login", '/login',
"/test", '/test',
"/auth-redirect", '/auth-redirect',
"/bind", '/bind',
"/contractAssistant", '/contractAssistant',
"/register", '/register',
"/systemInit", '/systemInit',
"/databaseLogin", '/databaseLogin',
"/apiLogs", '/apiLogs'
]; ]
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start(); NProgress.start()
if (getToken()) { if (getToken()) {
to.meta.title && store.dispatch("settings/setTitle", to.meta.title); to.meta.title && store.dispatch('settings/setTitle', to.meta.title)
/* has token*/ /* has token*/
if (to.path === "/login") { if (to.path === '/login') {
next({ next({
path: "/", path: '/'
}); })
NProgress.done(); NProgress.done()
} else { } else {
let routeList = localStorage.getItem("routeList") let routeList = localStorage.getItem('routeList')
? localStorage.getItem("routeList") ? localStorage.getItem('routeList')
: null; : null
// store.dispatch("GenerateRoutes").then((accessRoutes) => { // store.dispatch("GenerateRoutes").then((accessRoutes) => {
// next() // next()
// }) // })
if (store.getters.permission_routes.length == 0) { if (store.getters.permission_routes.length == 0) {
store.dispatch("GenerateRoutes").then((accessRoutes) => { store.dispatch('GenerateRoutes').then((accessRoutes) => {
// 根据roles权限生成可访问的路由表 // 根据roles权限生成可访问的路由表
// for (let i = 0, length = accessRoutes.length; i < length; i += 1) { // for (let i = 0, length = accessRoutes.length; i < length; i += 1) {
// const element = accessRoutes[i]; // const element = accessRoutes[i];
// // router.addRoutes(accessRoutes); // 动态添加可访问路由表 // // router.addRoutes(accessRoutes); // 动态添加可访问路由表
// } // }
router.addRoutes(accessRoutes); // 动态添加可访问路由表 router.addRoutes(accessRoutes) // 动态添加可访问路由表
// router.addRoutes(accessRoutes) // 动态添加可访问路由表 // router.addRoutes(accessRoutes) // 动态添加可访问路由表
localStorage.setItem("routeList", JSON.stringify(accessRoutes)); localStorage.setItem('routeList', JSON.stringify(accessRoutes))
next({ //获取当前已获取的权限按钮
...to, let perObj = store.getters.getButtonPre
replace: true, //获取当前权限按钮
}); // hack方法 确保addRoutes已完成 if (to.meta.id && !perObj[to.meta.id]) {
}); let userId = JSON.parse(getInfo()).id
authApi('sysButtonConfigService', '', 'getUserButton', '', {
menuId: to.meta.id,
userId: userId
}).then((res) => {
// 处理接口 格式为:{路由id:[按钮id,按钮id],....}
let tempObj = {}
let tempArr = []
res.attribute.forEach((item) => {
tempArr.push(item.nameEn)
})
tempObj.id = to.meta.id
tempObj.value = tempArr
store.commit('perButton/SET_BUTTONOBJ', tempObj)
next({
...to,
replace: true
})
})
} else {
next({
...to,
replace: true
})
}
// next({
// ...to,
// replace: true
// }) // hack方法 确保addRoutes已完成
})
} else { } else {
next(); //获取当前已获取的权限按钮
let perObj = store.getters.getButtonPre
if (to.meta.id && !perObj[to.meta.id]) {
let userId = JSON.parse(getInfo()).id
authApi('sysButtonConfigService', '', 'getUserButton', '', {
menuId: to.meta.id,
userId: userId
}).then((res) => {
// 处理接口 格式为:{路由id:[按钮id,按钮id],....}
let tempObj = {}
let tempArr = []
res.attribute.forEach((item) => {
tempArr.push(item.nameEn)
})
tempObj.id = to.meta.id
tempObj.value = tempArr
store.commit('perButton/SET_BUTTONOBJ', tempObj)
next()
})
} else {
next()
}
} }
} }
} else { } else {
// 没有token // 没有token
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
// 在免登录白名单,直接进入 // 在免登录白名单,直接进入
next(); next()
} else { } else {
next(`/login?redirect=${to.fullPath}`); // 否则全部重定向到登录页 next(`/login?redirect=${to.fullPath}`) // 否则全部重定向到登录页
NProgress.done(); NProgress.done()
} }
} }
}); })
router.afterEach(() => { router.afterEach(() => {
NProgress.done(); NProgress.done()
}); })

View File

@ -36,5 +36,6 @@ const getters = {
copyerConfig: state => state.flowPath.copyerConfig, copyerConfig: state => state.flowPath.copyerConfig,
conditionDrawer: state => state.flowPath.conditionDrawer, conditionDrawer: state => state.flowPath.conditionDrawer,
conditionsConfig: state => state.flowPath.conditionsConfig, conditionsConfig: state => state.flowPath.conditionsConfig,
getButtonPre: (state) => state.perButton.buttonObj,
} }
export default getters export default getters

View File

@ -9,6 +9,7 @@ import settings from './modules/settings'
import getters from './getters' import getters from './getters'
import approval from './modules/approval' import approval from './modules/approval'
import flowPath from "./modules/flowPath" import flowPath from "./modules/flowPath"
import perButton from "@/store/modules/perButton";
Vue.use(Vuex) Vue.use(Vuex)
@ -21,7 +22,8 @@ const store = new Vuex.Store({
permission, permission,
settings, settings,
approval, approval,
flowPath flowPath,
perButton
}, },
getters getters
}) })

View File

@ -0,0 +1,23 @@
const state = {
buttonObj: {},
};
const mutations = {
//保存按钮
SET_BUTTONOBJ(state, data) {
if (!data.id) return;
state.buttonObj[data.id] = data.value;
},
//清空按钮
CLEAN_BUTTONOBJ(state, data) {
state.buttonObj = {};
},
};
const actions = {};
export default {
namespaced: true,
state,
mutations,
actions,
};

View File

@ -176,8 +176,10 @@
class="btnText" class="btnText"
:style="{ background: item.color ? item.color : '#5a9cf8' }" :style="{ background: item.color ? item.color : '#5a9cf8' }"
style="padding: 3px 10px; border-radius: 20px" style="padding: 3px 10px; border-radius: 20px"
v-btnPermission="{ btnID: item.type, routeId: $route.meta.id }"
> >
<span <span
style="color: #fff; font-weight: 700" style="color: #fff; font-weight: 700"
v-if="!item.ifField && !item.hiddenField" v-if="!item.ifField && !item.hiddenField"
>{{ item.text }}</span >{{ item.text }}</span

View File

@ -2,37 +2,38 @@
<div class="wrap"> <div class="wrap">
<div class="tree" v-if="$route.query.viewType === '1'" style="flex:0.2"> <div class="tree" v-if="$route.query.viewType === '1'" style="flex:0.2">
<BaseMenuTree <BaseMenuTree
:menuData="treeData" :menuData="treeData"
:filterShow="false" :filterShow="false"
:Allshow="false" :Allshow="false"
:treeButton="false" :treeButton="false"
:filterButtonShow="false" :filterButtonShow="false"
style="height: 100%" style="height: 100%"
:treeProps="treeProps" :treeProps="treeProps"
@handleNodeClick="homeHandleNodeClick" @handleNodeClick="homeHandleNodeClick"
ref="menuTree" ref="menuTree"
></BaseMenuTree> ></BaseMenuTree>
</div> </div>
<div class="main" :style="{flex:$route.query.viewType === '1'?0.8:1}" v-loading="mainLoading"> <div class="main" :style="{flex:$route.query.viewType === '1'?0.8:1}" v-loading="mainLoading">
<div class="top"> <div class="top">
<div class="search"> <div class="search">
<BaseNewForm <BaseNewForm
v-loading="searchLoading" v-loading="searchLoading"
refName="searchForm" refName="searchForm"
:formRow="searchFormRow" :formRow="searchFormRow"
:formRule="false" :formRule="false"
:ruleForm="searchForm" :ruleForm="searchForm"
:newFlag="true" :newFlag="true"
:treeSelectInfo="treeSelectInfo" :treeSelectInfo="treeSelectInfo"
:isFunBtn="false" :isFunBtn="false"
></BaseNewForm> ></BaseNewForm>
</div> </div>
<div class="btnList"> <div class="btnList">
<div class="btnItem" v-for="item in searchButton" :key="item.buttonType"> <div class="btnItem" v-for="item in searchButton" :key="item.buttonType">
<el-button <el-button
type="primary" type="primary"
size="mini" size="mini"
@click="buttonHandle(item)" @click="buttonHandle(item)"
v-btnPermission="{ btnID: item.buttonType, routeId: $route.meta.id }"
>{{ item.buttonName }} >{{ item.buttonName }}
</el-button> </el-button>
</div> </div>
@ -40,24 +41,24 @@
</div> </div>
<div class="table"> <div class="table">
<BaseTable <BaseTable
ref="mainTable" ref="mainTable"
:treeSelectInfo="treeSelectInfo" :treeSelectInfo="treeSelectInfo"
:tableData="tableData" :tableData="tableData"
:tableColumn="tableColumn" :tableColumn="tableColumn"
:funData="mainFunData" :funData="mainFunData"
:funWidth="funWidth" :funWidth="funWidth"
:showIndex="true" :showIndex="true"
:tabLoading="mainTabLoading" :tabLoading="mainTabLoading"
@onFunc="tableButtonHandle" @onFunc="tableButtonHandle"
@selectValueGeT="selectValueGeTHandle" @selectValueGeT="selectValueGeTHandle"
:tableHeight="'67vh'" :tableHeight="'67vh'"
:border="false" :border="false"
> >
</BaseTable> </BaseTable>
<div class="nextPage"> <div class="nextPage">
<BasePage <BasePage
:pageModel="pageModel" :pageModel="pageModel"
@update:pageModel="currentChangeHandle" @update:pageModel="currentChangeHandle"
></BasePage> ></BasePage>
</div> </div>
</div> </div>
@ -68,15 +69,15 @@
</h1> </h1>
<div class="dialogForm" v-if="dialogShow" style="padding: 0 20px"> <div class="dialogForm" v-if="dialogShow" style="padding: 0 20px">
<BaseNewForm <BaseNewForm
:treeSelectInfo="treeSelectInfo" :treeSelectInfo="treeSelectInfo"
:loading="dialogCommitLoading" :loading="dialogCommitLoading"
:formRow="formRow" :formRow="formRow"
:ruleForm="ruleForm" :ruleForm="ruleForm"
:lookFlag="lookFlag" :lookFlag="lookFlag"
:newFlag="newFlag" :newFlag="newFlag"
@onSubmit="onSubmitHandele" @onSubmit="onSubmitHandele"
:isFunBtn="false" :isFunBtn="false"
ref="dialogForm" ref="dialogForm"
></BaseNewForm> ></BaseNewForm>
</div v-> </div v->
<template v-for="(item, index) in dialogTabaleInfo"> <template v-for="(item, index) in dialogTabaleInfo">
@ -85,16 +86,16 @@
{{ item.title }} {{ item.title }}
</h1> </h1>
<BaseTableForm <BaseTableForm
:lookflag="lookFlag" :lookflag="lookFlag"
:showIndex="true" :showIndex="true"
:treeSelectInfo="treeSelectInfo" :treeSelectInfo="treeSelectInfo"
:indexOperate="true" :indexOperate="true"
:tableInfo="item" :tableInfo="item"
@newRow="dialogTableAddHandle" @newRow="dialogTableAddHandle"
@onFunc="dialogTableDeleHandle" @onFunc="dialogTableDeleHandle"
:funData="dialogfunData" :funData="dialogfunData"
:border="false" :border="false"
table-height="30vh" table-height="30vh"
></BaseTableForm> ></BaseTableForm>
</div> </div>
@ -103,8 +104,9 @@
<!-- 分发任务dialog--> <!-- 分发任务dialog-->
<baseDialog v-model="sendShow" :footerShow="false"> <baseDialog v-model="sendShow" :footerShow="false">
<baseTable <baseTable
:tableData="sendTableData" :tableData="sendTableData"
:tableColumn="sendTableColumn"> :tableColumn="sendTableColumn"
>
<template v-slot:status="{row}"> <template v-slot:status="{row}">
{{ sendDist[row.status] }} {{ sendDist[row.status] }}
</template> </template>
@ -119,45 +121,45 @@
</div> </div>
</template> </template>
<script> <script>
import {deepClone} from "@/utils/index.js"; import { deepClone } from '@/utils/index.js'
import {getUserModuleApi} from "@/api/integrationOption/integrationOption.js"; import { getUserModuleApi } from '@/api/integrationOption/integrationOption.js'
import BaseNewForm from "./compoments/baseNewForm"; import BaseNewForm from './compoments/baseNewForm'
import BaseTable from "./compoments/baseTable"; import BaseTable from './compoments/baseTable'
import BasePage from "./compoments/basePage.vue"; import BasePage from './compoments/basePage.vue'
import baseDialog from "@/views/integrationOption/compoments/baseDialog"; import baseDialog from '@/views/integrationOption/compoments/baseDialog'
import BaseTableForm from "./compoments/baseTableForm_v2.vue"; import BaseTableForm from './compoments/baseTableForm_v2.vue'
import BaseMenuTree from "@/views/intergrationTask/compoments/baseMenuTree.vue"; import BaseMenuTree from '@/views/intergrationTask/compoments/baseMenuTree.vue'
export default { export default {
data() { data() {
return { return {
treeObj: { treeObj: {
label: "", label: '',
upId: "" upId: ''
}, },
sendDist: { sendDist: {
"1": "发送成功", '1': '发送成功',
"2": "发送中", '2': '发送中',
"3": "发送失败", '3': '发送失败',
"4": "未发送" '4': '未发送'
}, },
sendShow: false,//dialog sendShow: false,//dialog
sendTableColumn: [ sendTableColumn: [
{ {
id: 'name', id: 'name',
title: "应用" title: '应用'
}, },
{ {
id: 'status', id: 'status',
title: "状态" title: '状态'
}, },
{ {
id: 'msg', id: 'msg',
title: "信息" title: '信息'
}, },
{ {
id: "fun", id: 'fun',
title: "操作" title: '操作'
} }
], ],
@ -167,11 +169,41 @@ export default {
searchForm: {}, searchForm: {},
searchLoading: false, searchLoading: false,
// //
searchButton: [], searchButton: [
mainTableName: "", {
'buttonType': 'new',
'buttonName': '新建'
},
{
'buttonType': 'resize',
'buttonName': '重置'
},
{
'buttonType': 'search',
'buttonName': '查询'
}
],
mainTableName: '',
// //
mainLoading: false, mainLoading: false,
mainFunData: [], mainFunData: [
{
'text': '修改',
'type': 'edit'
},
{
'text': '删除',
'type': 'dele'
},
{
'text': '查看',
'type': 'view'
},
{
'text': '下发',
'type': 'send'
}
],
mainActiveRow: {}, mainActiveRow: {},
mainTabLoading: false, mainTabLoading: false,
tableData: [], tableData: [],
@ -180,7 +212,7 @@ export default {
pageModel: { pageModel: {
total: 0, total: 0,
pageIndex: 1, pageIndex: 1,
limit: 10, limit: 10
}, },
//dialog //dialog
dialogShow: false, dialogShow: false,
@ -190,27 +222,27 @@ export default {
lookFlag: false, lookFlag: false,
newFlag: false, newFlag: false,
dialogTabaleInfo: [], dialogTabaleInfo: [],
dialogfunData: [{text: "删除", type: "dele", color: 'red'}], dialogfunData: [{ text: '删除', type: 'dele', color: 'red' }],
dialogTableLoading: false, dialogTableLoading: false,
dialogFormName: "", dialogFormName: '',
// //
treeProps: { treeProps: {
children: "children", children: 'children',
label: "label", label: 'label'
}, },
treeData: [], treeData: [],
treeActiveRow: {}, treeActiveRow: {},
treeSelectInfo: {}, treeSelectInfo: {}
} }
}, },
methods: { methods: {
async init() { async init() {
this.mainLoading = true this.mainLoading = true
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmShow", dj: 'queryMdmShow'
}, {mdmCode: this.$route.meta.mdmCode}) }, { mdmCode: this.$route.meta.mdmCode })
// //
if (this.$route.query.viewType === '1') { if (this.$route.query.viewType === '1') {
this.treeObj.label = res.attribute.mdmModuleViewEntity.viewFiled this.treeObj.label = res.attribute.mdmModuleViewEntity.viewFiled
@ -225,26 +257,33 @@ export default {
}) })
}) })
this.searchFormRow = [] this.searchFormRow = []
res.attribute.queryList.forEach((item) => {
item.id = item.dbName + '.' + item.id
})
this.baseFormRowDispose(res.attribute.queryList, this.searchFormRow) this.baseFormRowDispose(res.attribute.queryList, this.searchFormRow)
console.log(res.attribute.queryList, 'this.searchFormRow')
// //
let funDataBtn = { let funDataBtn = {
edit: true, edit: true,
view: true, view: true,
dele: true, dele: true,
send: true, send: true
} }
this.searchButton = [] // v3
this.mainFunData = [] // this.searchButton = []
res.attribute.buttonList.forEach(item => { // this.mainFunData = []
if (funDataBtn[item.buttonType]) { // res.attribute.buttonList.forEach(item => {
this.mainFunData.push({ // if (funDataBtn[item.buttonType]) {
text: item.buttonName, // this.mainFunData.push({
type: item.buttonType // text: item.buttonName,
}) // type: item.buttonType
} else { // })
this.searchButton.push(item) // console.log(this.mainFunData, 'this.mainFunData')
} // } else {
}) // this.searchButton.push(item)
// console.log(this.searchButton, 'this.searchButton')
// }
// })
// //
res.attribute.listList.forEach(item => { res.attribute.listList.forEach(item => {
this.mainTableName = item.dbName this.mainTableName = item.dbName
@ -260,9 +299,9 @@ export default {
async initTree(label, upId, obj = {}) { async initTree(label, upId, obj = {}) {
if (this.$route.query.viewType !== '1') return if (this.$route.query.viewType !== '1') return
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmShowTreeData", dj: 'queryMdmShowTreeData'
}, { }, {
mdmCode: this.$route.meta.mdmCode, mdmCode: this.$route.meta.mdmCode,
label, label,
@ -276,9 +315,9 @@ export default {
async initTableData(name, obj = {}) { async initTableData(name, obj = {}) {
this.mainTabLoading = true this.mainTabLoading = true
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmShowData", dj: 'queryMdmShowData'
}, { }, {
pageNum: this.pageModel.pageIndex, pageNum: this.pageModel.pageIndex,
pageSize: this.pageModel.limit, pageSize: this.pageModel.limit,
@ -292,21 +331,21 @@ export default {
// row // row
baseFormRowDispose(arr, resultArr) { baseFormRowDispose(arr, resultArr) {
let searchSpan = 0 let searchSpan = 0
let tempArr = []; let tempArr = []
arr.forEach(item => { arr.forEach(item => {
let spanNum = item.row * 1 || 12; let spanNum = item.row * 1 || 12
searchSpan += spanNum; searchSpan += spanNum
if (searchSpan > 24) { if (searchSpan > 24) {
resultArr.push({elCol: tempArr}); resultArr.push({ elCol: tempArr })
searchSpan = spanNum; searchSpan = spanNum
tempArr = []; tempArr = []
tempArr.push(item); tempArr.push(item)
} else { } else {
tempArr.push(item); tempArr.push(item)
} }
}) })
if (tempArr.length) { if (tempArr.length) {
resultArr.push({elCol: tempArr}); resultArr.push({ elCol: tempArr })
} }
}, },
// //
@ -324,8 +363,8 @@ export default {
// //
// //
selectValueGeTHandle(item, row, data) { selectValueGeTHandle(item, row, data) {
this.$set(this.tableData[row.index], item.id, data); this.$set(this.tableData[row.index], item.id, data)
this.$set(this.tableData[row.index], "selectflag", true); this.$set(this.tableData[row.index], 'selectflag', true)
}, },
// //
async tableButtonHandle(row, item) { async tableButtonHandle(row, item) {
@ -334,27 +373,27 @@ export default {
} else if (item.type === 'view') { } else if (item.type === 'view') {
this.viewDIalogHandle(row.id) this.viewDIalogHandle(row.id)
} else if (item.type === 'dele') { } else if (item.type === 'dele') {
this.$confirm("是否删除此行?", "提示", { this.$confirm('是否删除此行?', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning'
}) })
.then(() => { .then(() => {
this.deleRowHanlde(row.id) this.deleRowHanlde(row.id)
}) })
.catch((error) => { .catch((error) => {
}); })
} else if (item.type === 'send') { } else if (item.type === 'send') {
this.sendHandle(row.id) this.sendHandle(row.id)
} }
}, },
// //
currentChangeHandle(pageModel) { currentChangeHandle(pageModel) {
this.pageModel = pageModel; this.pageModel = pageModel
this.$nextTick(() => { this.$nextTick(() => {
this.searchHandle() this.searchHandle()
}); })
}, },
//dialog //dialog
async onSubmitHandele() { async onSubmitHandele() {
@ -369,13 +408,13 @@ export default {
params.data[item.name] = item.tableData.slice(0, -1) params.data[item.name] = item.tableData.slice(0, -1)
}) })
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "saveMdmShowDetailsData", dj: 'saveMdmShowDetailsData'
}, params) }, params)
if (res.status === '200') { if (res.status === '200') {
this.initTree(this.treeObj.label, this.treeObj.upId) this.initTree(this.treeObj.label, this.treeObj.upId)
this.$vmNews("新建成功", "success") this.$vmNews('新建成功', 'success')
this.searchHandle() this.searchHandle()
this.dialogShow = false this.dialogShow = false
} }
@ -390,13 +429,13 @@ export default {
params.data[item.name] = item.tableData.slice(0, -1) params.data[item.name] = item.tableData.slice(0, -1)
}) })
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "updateMdmShowDetailsData", dj: 'updateMdmShowDetailsData'
}, params) }, params)
if (res.status === '200') { if (res.status === '200') {
this.initTree(this.treeObj.label, this.treeObj.upId) this.initTree(this.treeObj.label, this.treeObj.upId)
this.$vmNews("修改成功", "success") this.$vmNews('修改成功', 'success')
this.searchHandle() this.searchHandle()
this.dialogShow = false this.dialogShow = false
} }
@ -404,24 +443,24 @@ export default {
}, },
dialogTableAddHandle(info, index) { dialogTableAddHandle(info, index) {
this.dialogTabaleInfo[index].tableData.push({}); this.dialogTabaleInfo[index].tableData.push({})
}, },
dialogTableDeleHandle(row, item, tableInfo, index) { dialogTableDeleHandle(row, item, tableInfo, index) {
if (item.type === "dele") { if (item.type === 'dele') {
this.$confirm("是否删除此行?", "提示", { this.$confirm('是否删除此行?', '提示', {
confirmButtonText: "确定", confirmButtonText: '确定',
cancelButtonText: "取消", cancelButtonText: '取消',
type: "warning", type: 'warning'
}) })
.then(() => { .then(() => {
this.dialogTabaleInfo[index].tableData.splice(row.index, 1); this.dialogTabaleInfo[index].tableData.splice(row.index, 1)
this.$message({ this.$message({
type: "success", type: 'success',
message: "删除成功!", message: '删除成功!'
}); })
}) })
.catch((error) => { .catch((error) => {
}); })
} }
}, },
//dialog //dialog
@ -434,17 +473,17 @@ export default {
this.newFlag = true this.newFlag = true
this.lookFlag = false this.lookFlag = false
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmShowDetails" dj: 'queryMdmShowDetails'
}, { }, {
mdmCode: this.$route.meta.mdmCode, mdmCode: this.$route.meta.mdmCode,
showType: "3" showType: '3'
}) })
// //
res.attribute.mainMdmModuleDb.sublistMdmModuleDbFileds.forEach(item => { res.attribute.mainMdmModuleDb.sublistMdmModuleDbFileds.forEach(item => {
item.mdmModuleDbFiledsRules.forEach(ele => { item.mdmModuleDbFiledsRules.forEach(ele => {
if (ele.ruleCode === "required" || ele.ruleCode === "disabled") { if (ele.ruleCode === 'required' || ele.ruleCode === 'disabled') {
if (!ele.ruleValue) { if (!ele.ruleValue) {
item[ele.ruleCode] = false item[ele.ruleCode] = false
} else { } else {
@ -464,7 +503,7 @@ export default {
res.attribute.sublistMdmModuleDb.forEach(table => { res.attribute.sublistMdmModuleDb.forEach(table => {
table.sublistMdmModuleDbFileds.forEach(item => { table.sublistMdmModuleDbFileds.forEach(item => {
item.mdmModuleDbFiledsRules.forEach(ele => { item.mdmModuleDbFiledsRules.forEach(ele => {
if (ele.ruleCode === "required" || ele.ruleCode === "disabled") { if (ele.ruleCode === 'required' || ele.ruleCode === 'disabled') {
if (!ele.ruleValue) { if (!ele.ruleValue) {
item[ele.ruleCode] = false item[ele.ruleCode] = false
} else { } else {
@ -483,28 +522,33 @@ export default {
tableData: [{}], tableData: [{}],
detailFields: deepClone(table.sublistMdmModuleDbFileds), detailFields: deepClone(table.sublistMdmModuleDbFileds),
title: table.remark, title: table.remark,
name: table.dbName, name: table.dbName
} }
this.dialogTabaleInfo.push({...tempObj}) this.dialogTabaleInfo.push({ ...tempObj })
}) })
this.dialogShow = true this.dialogShow = true
}, },
searchHandle() { searchHandle() {
let tempSearch = JSON.parse(JSON.stringify(this.searchForm))
Object.keys(tempSearch).forEach((key) => {
tempSearch[key.split(".")[1]] = tempSearch[key]
})
console.log(tempSearch, 'tempSearch')
let obj = {} let obj = {}
this.searchFormRow.forEach(item => { this.searchFormRow.forEach(item => {
item.elCol.forEach(ele => { item.elCol.forEach(ele => {
if (this.searchForm[ele.enName]) { if (this.searchForm[ele.id]) {
if (obj[ele.dbName]) { if (obj[ele.dbName]) {
obj[ele.dbName].push({ obj[ele.dbName].push({
fields: ele.enName, fields: ele.enName,
fieldsType: ele.filedType, fieldsType: ele.filedType,
values: this.searchForm[ele.enName] values: this.searchForm[ele.id]
}) })
} else { } else {
obj[ele.dbName] = [{ obj[ele.dbName] = [{
fields: ele.enName, fields: ele.enName,
fieldsType: ele.filedType, fieldsType: ele.filedType,
values: this.searchForm[ele.enName] values: this.searchForm[ele.id]
}] }]
} }
} }
@ -512,7 +556,7 @@ export default {
}) })
let params = { let params = {
queryCondition: [], queryCondition: [],
detailQueryCondition: [], detailQueryCondition: []
} }
Object.keys(obj).forEach(key => { Object.keys(obj).forEach(key => {
if (key === this.mainTableName) { if (key === this.mainTableName) {
@ -527,7 +571,7 @@ export default {
}) })
if (this.treeActiveRow.id) { if (this.treeActiveRow.id) {
let obj = { let obj = {
fields: "id", fields: 'id',
values: this.treeActiveRow.arrId, values: this.treeActiveRow.arrId,
fieldsType: '5' fieldsType: '5'
} }
@ -541,29 +585,28 @@ export default {
this.lookFlag = false this.lookFlag = false
// //
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmShowDetails" dj: 'queryMdmShowDetails'
}, { }, {
mdmCode: this.$route.meta.mdmCode, mdmCode: this.$route.meta.mdmCode,
showType: "4" showType: '4'
}) })
res.attribute.mainMdmModuleDb.sublistMdmModuleDbFileds.forEach(item => { res.attribute.mainMdmModuleDb.sublistMdmModuleDbFileds.forEach(item => {
item.mdmModuleDbFiledsRules.forEach(ele => { item.mdmModuleDbFiledsRules.forEach(ele => {
if (ele.ruleCode === "required" || ele.ruleCode === "disabled") { if (ele.ruleCode === 'required' || ele.ruleCode === 'disabled') {
if (!ele.ruleValue) { if (!ele.ruleValue) {
item[ele.ruleCode] = false item[ele.ruleCode] = false
} else {
item[ele.ruleCode] = JSON.parse(ele.ruleValue)
}
} else { } else {
item[ele.ruleCode] = JSON.parse(ele.ruleValue) item[ele.ruleCode] = ele.ruleValue
} }
} else {
item[ele.ruleCode] = ele.ruleValue
}
item['id'] = item.enName
item['id'] = item.enName })
}) }
}
) )
this.dialogFormName = res.attribute.mainMdmModuleDb.dbName this.dialogFormName = res.attribute.mainMdmModuleDb.dbName
this.formRow = [] this.formRow = []
@ -583,15 +626,15 @@ export default {
tableData: [{}], tableData: [{}],
detailFields: deepClone(table.sublistMdmModuleDbFileds), detailFields: deepClone(table.sublistMdmModuleDbFileds),
title: table.remark, title: table.remark,
name: table.dbName, name: table.dbName
} }
this.dialogTabaleInfo.push({...tempObj}) this.dialogTabaleInfo.push({ ...tempObj })
}) })
// //
const data = await getUserModuleApi({ const data = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmShowDetailsData", dj: 'queryMdmShowDetailsData'
}, { }, {
mdmCode: this.$route.meta.mdmCode, mdmCode: this.$route.meta.mdmCode,
id: id id: id
@ -612,16 +655,16 @@ export default {
this.lookFlag = true this.lookFlag = true
// //
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmShowDetails" dj: 'queryMdmShowDetails'
}, { }, {
mdmCode: this.$route.meta.mdmCode, mdmCode: this.$route.meta.mdmCode,
showType: "5" showType: '5'
}) })
res.attribute.mainMdmModuleDb.sublistMdmModuleDbFileds.forEach(item => { res.attribute.mainMdmModuleDb.sublistMdmModuleDbFileds.forEach(item => {
item.mdmModuleDbFiledsRules.forEach(ele => { item.mdmModuleDbFiledsRules.forEach(ele => {
if (ele.ruleCode === "required" || ele.ruleCode === "disabled") { if (ele.ruleCode === 'required' || ele.ruleCode === 'disabled') {
if (!ele.ruleValue) { if (!ele.ruleValue) {
item[ele.ruleCode] = false item[ele.ruleCode] = false
} else { } else {
@ -651,15 +694,15 @@ export default {
tableData: [{}], tableData: [{}],
detailFields: deepClone(table.sublistMdmModuleDbFileds), detailFields: deepClone(table.sublistMdmModuleDbFileds),
title: table.remark, title: table.remark,
name: table.dbName, name: table.dbName
} }
this.dialogTabaleInfo.push({...tempObj}) this.dialogTabaleInfo.push({ ...tempObj })
}) })
// //
const data = await getUserModuleApi({ const data = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmShowDetailsData", dj: 'queryMdmShowDetailsData'
}, { }, {
mdmCode: this.$route.meta.mdmCode, mdmCode: this.$route.meta.mdmCode,
id: id id: id
@ -677,15 +720,15 @@ export default {
// //
async deleRowHanlde(id) { async deleRowHanlde(id) {
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "deleteMdmShowDetailsData", dj: 'deleteMdmShowDetailsData'
}, { }, {
mdmCode: this.$route.meta.mdmCode, mdmCode: this.$route.meta.mdmCode,
id: id id: id
}) })
if (res.status === '200') { if (res.status === '200') {
this.$vmNews("删除成功!", "success") this.$vmNews('删除成功!', 'success')
this.searchHandle() this.searchHandle()
this.initTree(this.treeObj.label, this.treeObj.upId) this.initTree(this.treeObj.label, this.treeObj.upId)
} }
@ -697,14 +740,14 @@ export default {
if (data.children) { if (data.children) {
this.treeIdHandle(data.children, arrId) this.treeIdHandle(data.children, arrId)
} }
this.pageModel.pageIndex = 1; this.pageModel.pageIndex = 1
this.pageModel.total = 0; this.pageModel.total = 0
this.pageModel.limit = 10; this.pageModel.limit = 10
this.searchForm = {}; this.searchForm = {}
this.tableData = []; this.tableData = []
this.lookFlag = false; this.lookFlag = false
this.newFlag = false; this.newFlag = false
this.treeActiveRow = {...data, arrId: arrId} this.treeActiveRow = { ...data, arrId: arrId }
this.searchHandle() this.searchHandle()
} }
, ,
@ -720,9 +763,9 @@ export default {
// //
async sendHandle(id) { async sendHandle(id) {
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmShowDistribute" dj: 'queryMdmShowDistribute'
}, { }, {
mdmCode: this.$route.meta.mdmCode, mdmCode: this.$route.meta.mdmCode,
id: id id: id
@ -737,8 +780,8 @@ export default {
// //
async appSearch(id, row) { async appSearch(id, row) {
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "sysApplicationService", tl: 'sysApplicationService',
as: "application", as: 'application',
dj: 'getApp' dj: 'getApp'
}, { }, {
id: id id: id
@ -749,14 +792,14 @@ export default {
async sendRowHandle(row) { async sendRowHandle(row) {
let status = row.status === '1' ? 1 : 2 let status = row.status === '1' ? 1 : 2
if (row.status === '2') { if (row.status === '2') {
this.$vmNews("发送中,请等待发送完成,再删除", 'warning') this.$vmNews('发送中,请等待发送完成,再删除', 'warning')
return return
} }
console.log(row) console.log(row)
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "doMdmDistribute", dj: 'doMdmDistribute'
}, { }, {
mdmCode: this.$route.meta.mdmCode, mdmCode: this.$route.meta.mdmCode,
appID: row.appId, appID: row.appId,
@ -765,7 +808,7 @@ export default {
}) })
this.$vmNews(`${res.msg}`, 'success') this.$vmNews(`${res.msg}`, 'success')
this.sendHandle(row.rowId) this.sendHandle(row.rowId)
}, }
}, },
created() { created() {
this.init() this.init()
@ -782,9 +825,9 @@ export default {
, ,
computed: { computed: {
funWidth() { funWidth() {
return this.mainFunData.length * 70; return this.mainFunData.length * 70
} }
,
} }
, ,
watch: { watch: {

View File

@ -147,13 +147,13 @@ const formRowShow = [
{ {
elCol: [{ elCol: [{
label: '源系统主键', label: '源系统主键',
prop: 'root_app_pk', prop: 'rootAppPk',
tag: 'elInput', tag: 'elInput',
disabled:true, disabled:true,
placeholder:"暂无数据" placeholder:"暂无数据"
},{ },{
label: '源系统编码', label: '源系统编码',
prop: 'root_app_bill', prop: 'rootAppBill',
tag: 'elInput', tag: 'elInput',
disabled:true, disabled:true,
placeholder:"暂无数据" placeholder:"暂无数据"
@ -162,13 +162,13 @@ const formRowShow = [
{ {
elCol: [{ elCol: [{
label: '创建时间', label: '创建时间',
prop: 'create_time', prop: 'createTime',
tag: 'elInput', tag: 'elInput',
disabled:true, disabled:true,
placeholder:"暂无数据" placeholder:"暂无数据"
},{ },{
label: '最新推送状态', label: '最新推送状态',
prop: 'new_state', prop: 'newState',
tag: 'elRadio', tag: 'elRadio',
options: [ options: [
{ label: '成功', value: 'Y' }, { label: '成功', value: 'Y' },
@ -182,7 +182,7 @@ const formRowShow = [
{ {
elCol: [{ elCol: [{
label: '最新传输结果', label: '最新传输结果',
prop: 'new_transmit_info', prop: 'newTransmitInfo',
tag: 'elInput', tag: 'elInput',
type: 'textarea', type: 'textarea',
disabled:true, disabled:true,
@ -193,7 +193,7 @@ const formRowShow = [
{ {
elCol: [{ elCol: [{
label: '最新元数据', label: '最新元数据',
prop: 'root_app_new_data', prop: 'rootAppNewData',
tag: 'elInput', tag: 'elInput',
type: 'textarea', type: 'textarea',
disabled:true, disabled:true,
@ -204,13 +204,13 @@ const formRowShow = [
{ {
elCol: [{ elCol: [{
label: '最新推送时间', label: '最新推送时间',
prop: 'new_push_date', prop: 'newPushDate',
tag: 'elInput', tag: 'elInput',
disabled:true, disabled:true,
placeholder:"暂无数据" placeholder:"暂无数据"
},{ },{
label: '业务日期', label: '业务日期',
prop: 'business_date', prop: 'businessDate',
tag: 'elInput', tag: 'elInput',
disabled:true, disabled:true,
placeholder:"暂无数据" placeholder:"暂无数据"
@ -219,13 +219,13 @@ const formRowShow = [
{ {
elCol: [{ elCol: [{
label: '下游系统主键', label: '下游系统主键',
prop: 'new_system_number', prop: 'newSystemNumber',
tag: 'elInput', tag: 'elInput',
disabled:true, disabled:true,
placeholder:"暂无数据" placeholder:"暂无数据"
},{ },{
label: '下游系统单号', label: '下游系统单号',
prop: 'new_system_primary', prop: 'newSystemPrimary',
tag: 'elInput', tag: 'elInput',
disabled:true, disabled:true,
placeholder:"暂无数据" placeholder:"暂无数据"
@ -234,13 +234,13 @@ const formRowShow = [
{ {
elCol: [{ elCol: [{
label: '处理人名称', label: '处理人名称',
prop: 'processor_name', prop: 'processorName',
tag: 'elInput', tag: 'elInput',
disabled:true, disabled:true,
placeholder:"暂无数据" placeholder:"暂无数据"
},{ },{
label: '处理时间', label: '处理时间',
prop: 'processing_time', prop: 'processingTime',
tag: 'elInput', tag: 'elInput',
disabled:true, disabled:true,
placeholder:"暂无数据" placeholder:"暂无数据"
@ -249,7 +249,7 @@ const formRowShow = [
{ {
elCol: [{ elCol: [{
label: '处理备注 ', label: '处理备注 ',
prop: 'processing_remarks', prop: 'processingRemarks',
tag: 'elInput', tag: 'elInput',
type: 'textarea', type: 'textarea',
span: 24, span: 24,
@ -264,4 +264,4 @@ export default {
basicsRules, basicsRules,
formRowShow, formRowShow,
tableVersionColumn tableVersionColumn
} }

View File

@ -3,6 +3,7 @@
<base-layout ref="baseLayout" :buttonList="buttonList" @onFuncBtn="onFuncBtn" :querySwitch="true" <base-layout ref="baseLayout" :buttonList="buttonList" @onFuncBtn="onFuncBtn" :querySwitch="true"
:searchBtnList="searchBtnList" :searchList="requirementList" @search="handleSearchEvent" :isPage="true" :searchBtnList="searchBtnList" :searchList="requirementList" @search="handleSearchEvent" :isPage="true"
@pageChange="handlePageChange" @onFuncSearchBtn="onFuncSearchBtn" @pageChange="handlePageChange" @onFuncSearchBtn="onFuncSearchBtn"
@onQuery="refresh"
> >
<div slot="main" slot-scope="{ tableHeight }"> <div slot="main" slot-scope="{ tableHeight }">
<base-table ref="baseTable" :showIndex="true" :funWidth="350" :funData="funData" @onFunc="onFunc" <base-table ref="baseTable" :showIndex="true" :funWidth="350" :funData="funData" @onFunc="onFunc"
@ -137,6 +138,11 @@ export default {
this.GetProductionTableData() this.GetProductionTableData()
}, },
methods: { methods: {
//
refresh(fun, form) {
console.log(form)
this.$set(form, 'new_state', 'Y')
},
// //
async GetProductionTableData() { async GetProductionTableData() {
this.tabLoading = true this.tabLoading = true
@ -189,24 +195,24 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) })
.then(() => { .then(() => {
this.openLoading('submit') this.openLoading('submit')
this.rePushBatch(data) this.rePushBatch(data)
}) })
.catch(() => { .catch(() => {
this.$vmNews('取消操作', 'info') this.$vmNews('取消操作', 'info')
}) })
} else { } else {
this.$vmNews('请选择需要推送的单据', 'warning') this.$vmNews('请选择需要推送的单据', 'warning')
} }
}, },
async rePushBatch(data) { async rePushBatch(data) {
const res = await option({ const res = await option({
tl: 'integrationTaskLivingDetailsService', tl: 'integrationTaskLivingDetailsService',
as: 'integrationTaskLog', as: 'integrationTaskLog',
dj: 'batchPush' dj: 'batchPush'
}, },
data data
) )
if (res.status == '200') { if (res.status == '200') {
this.$vmNews('批量推送成功', 'success') this.$vmNews('批量推送成功', 'success')
@ -245,17 +251,17 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) })
.then(() => { .then(() => {
this.openLoading('submit') this.openLoading('submit')
this.handleRePush(row) this.handleRePush(row)
}) })
.catch(() => { .catch(() => {
this.$vmNews('取消操作', 'info') this.$vmNews('取消操作', 'info')
}) })
} }
// //
if (index == 2) { if (index == 2) {
this.$prompt('请填写旺店通或者NC的线下单据号,方便以后排查', '提示', { this.$prompt('请填写线下单据号,方便以后排查', '提示', {
confirmButtonText: '提交', confirmButtonText: '提交',
cancelButtonText: '取消', cancelButtonText: '取消',
inputType: 'textarea', inputType: 'textarea',
@ -265,22 +271,23 @@ export default {
} }
} }
}) })
.then(({ value }) => { .then(({ value }) => {
this.openLoading('submit') this.openLoading('submit')
let params = let params =
{ {
id: row.id, id: row.id,
processing_remarks: value newState: row.new_state,
} processing_remarks: value
}
this.updateManualProcess(params) this.updateManualProcess(params)
}) })
.catch(() => { .catch(() => {
this.$message({ this.$message({
type: 'info', type: 'info',
message: '取消操作' message: '取消操作'
})
}) })
})
} }
// //
if (index == 3) { if (index == 3) {
@ -289,13 +296,13 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}) })
.then(() => { .then(() => {
this.openLoading('del') this.openLoading('del')
this.productionDeleteById(row) this.productionDeleteById(row)
}) })
.catch(() => { .catch(() => {
this.$vmNews('取消操作', 'info') this.$vmNews('取消操作', 'info')
}) })
} }
}, },
async handleRePush(row) { async handleRePush(row) {
@ -332,14 +339,14 @@ export default {
this.resetTable() this.resetTable()
} }
}, },
async productionDeleteById(id) { async productionDeleteById(row) {
const res = await option({ const res = await option({
tl: 'integrationTaskLivingDetailsService', tl: 'integrationTaskLivingDetailsService',
as: 'integrationTaskLog', as: 'integrationTaskLog',
dj: 'deleteEntity' dj: 'deleteEntity'
}, { }, {
id: row.id, id: row.id,
new_state: row.new_state newState: row.new_state
}) })
if (res.status == '200') { if (res.status == '200') {
this.$vmNews('删除成功', 'success') this.$vmNews('删除成功', 'success')

View File

@ -26,10 +26,12 @@
<!-- <el-button icon="el-icon-plus" type="primary" @click="addHandle">新增</el-button>--> <!-- <el-button icon="el-icon-plus" type="primary" @click="addHandle">新增</el-button>-->
<!-- </div>--> <!-- </div>-->
<baseTable @onFunc="onFunc" :tableData="tableData" :tabLoading="tabLoading" <baseTable @onFunc="onFunc" :tableData="tableData" :tabLoading="tabLoading"
:tableColumn="tableColumn" :funData="funData" :border="false"> :tableColumn="tableColumn" :funData="funData" :border="false"
>
<template #appId="{row}"> <template #appId="{row}">
<baseNewSelect v-model="row['appId']" :itemObj="{label:'name',value:'id'}" <baseNewSelect v-model="row['appId']" :itemObj="{label:'name',value:'id'}"
@seleChange="(val)=>seleChangeHanlde(val,row,'main')"></baseNewSelect> @seleChange="(val)=>seleChangeHanlde(val,row,'main')"
></baseNewSelect>
</template> </template>
<template #addApi="{row}"> <template #addApi="{row}">
<div class="line" flex> <div class="line" flex>
@ -50,7 +52,8 @@
@seleChange="(val)=>seleChangeHanlde(val,row,'deleteApi')" @seleChange="(val)=>seleChangeHanlde(val,row,'deleteApi')"
></baseNewSelect> ></baseNewSelect>
<el-button :disabled="!row['deleteApi']" @click="configurationHanlde(row,row['deleteApi'],'deleteApi')" <el-button :disabled="!row['deleteApi']" @click="configurationHanlde(row,row['deleteApi'],'deleteApi')"
icon="el-icon-edit" type="primary"></el-button> icon="el-icon-edit" type="primary"
></el-button>
</div> </div>
</template> </template>
@ -87,9 +90,10 @@
<el-select v-model="plugIn" placeholder="请选择"> <el-select v-model="plugIn" placeholder="请选择">
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.pluginId" :key="item.id"
:label="item.pluginLabel" :label="item.pluginName"
:value="item.pluginId"> :value="item.id"
>
</el-option> </el-option>
</el-select> </el-select>
</div> </div>
@ -141,15 +145,15 @@
</template> </template>
<script> <script>
import baseDialog from "@/views/integrationOption/compoments/baseDialog"; import baseDialog from '@/views/integrationOption/compoments/baseDialog'
import BaseTable from "@/views/intergrationTask/compoments/baseTable.vue"; import BaseTable from '@/views/intergrationTask/compoments/baseTable.vue'
import baseNewForm from "@/views/intergrationTask/compoments/baseNewForm"; import baseNewForm from '@/views/intergrationTask/compoments/baseNewForm'
import {getApiModuleApi} from "@/api/apiChunks"; import { getApiModuleApi } from '@/api/apiChunks'
import {deepClone} from "@/utils/index.js"; import { deepClone } from '@/utils/index.js'
import {getUserModuleApi} from "@/api/integrationOption/integrationOption"; import { getUserModuleApi } from '@/api/integrationOption/integrationOption'
import basePage from "@/views/intergrationTask/compoments/basePage.vue"; import basePage from '@/views/intergrationTask/compoments/basePage.vue'
import baseLink from "./baseLink/index.vue" import baseLink from './baseLink/index.vue'
import baseNewSelect from "./baseNewSelect.vue" import baseNewSelect from './baseNewSelect.vue'
export default { export default {
data() { data() {
@ -158,64 +162,64 @@ export default {
addApiOptions: [], addApiOptions: [],
deleApiOptopns: [], deleApiOptopns: [],
options: [],//op options: [],//op
plugIn: "",// plugIn: '',//
addSwitch: false, //dialog addSwitch: false, //dialog
tabLoading: false, // tableloading tabLoading: false, // tableloading
tableColumn: [ //table tableColumn: [ //table
{ {
title: "应用列表", title: '应用列表',
id: "appId", id: 'appId'
}, },
{ {
title: "新增接口", title: '新增接口',
id: "addApi", id: 'addApi'
}, },
{ {
title: "删除接口", title: '删除接口',
id: "deleteApi", id: 'deleteApi'
}, }
], ],
tableData: [], //table tableData: [], //table
pageModel: { //page pageModel: { //page
pageIndex: 1, pageIndex: 1,
total: 10, total: 10,
limit: 10, limit: 10
}, },
funData: [ //table funData: [ //table
{text: "删除", color: "#e44b2d"} { text: '删除', color: '#e44b2d' }
], ],
addType: "1", //使 addType: '1', //使
linkloading: false, //linkloading linkloading: false, //linkloading
lookFlag: false, // lookFlag: false, //
linkData: { //线 linkData: { //线
leftData: [ leftData: [
{label: 1, id: 1}, { label: 1, id: 1 },
{label: 1, id: 2}, { label: 1, id: 2 },
{label: 1, id: 3}, { label: 1, id: 3 },
{label: 1, id: 4}, { label: 1, id: 4 },
{label: 1, id: 5}, { label: 1, id: 5 }
], ],
leftDataCopy: [{label: 1, id: 1}, leftDataCopy: [{ label: 1, id: 1 },
{label: 1, id: 2}, { label: 1, id: 2 },
{label: 1, id: 3}, { label: 1, id: 3 },
{label: 1, id: 4}, { label: 1, id: 4 },
{label: 1, id: 5},], { label: 1, id: 5 }],
rightData: [{label: 1, id: 6}, rightData: [{ label: 1, id: 6 },
{label: 1, id: 7}, { label: 1, id: 7 },
{label: 1, id: 8}, { label: 1, id: 8 },
{label: 1, id: 9}, { label: 1, id: 9 },
{label: 1, id: 10},], { label: 1, id: 10 }],
rightDataCopy: [{label: 1, id: 6}, rightDataCopy: [{ label: 1, id: 6 },
{label: 1, id: 7}, { label: 1, id: 7 },
{label: 1, id: 8}, { label: 1, id: 8 },
{label: 1, id: 9}, { label: 1, id: 9 },
{label: 1, id: 10},], { label: 1, id: 10 }],
lineData: [], lineData: []
}, },
dialogWidth: '40%', dialogWidth: '40%',
activedRow: {}, activedRow: {},
activedType: "", activedType: ''
}; }
}, },
methods: { methods: {
onFunc(row) { onFunc(row) {
@ -224,11 +228,11 @@ export default {
confirmHandle() { confirmHandle() {
//addTypedeleteTypeaddListdeleteListaddPlugdeletePlug //addTypedeleteTypeaddListdeleteListaddPlugdeletePlug
if (this.addType === '1' && !this.plugIn) { if (this.addType === '1' && !this.plugIn) {
this.$vmNews("请选择使用插件", "warning") this.$vmNews('请选择使用插件', 'warning')
return return
} }
if (this.addType === '2' && !this.linkData.lineData.length) { if (this.addType === '2' && !this.linkData.lineData.length) {
this.$vmNews("请配置链接对照表", "warning") this.$vmNews('请配置链接对照表', 'warning')
return return
} }
@ -240,17 +244,17 @@ export default {
let arr = [] let arr = []
this.linkData.lineData.forEach((item) => { this.linkData.lineData.forEach((item) => {
//2 线 //2 线
let tempObj = {}; let tempObj = {}
tempObj["sourceFeld"] = item["leftTitle"].split(".").slice(-1); tempObj['sourceFeld'] = item['leftTitle'].split('.').slice(-1)
tempObj["sourceName"] = item["leftTitle"]; tempObj['sourceName'] = item['leftTitle']
tempObj["sourcePath"] = item["leftTitle"]; tempObj['sourcePath'] = item['leftTitle']
tempObj["targetField"] = item["rightTitle"].split(".").slice(-1); tempObj['targetField'] = item['rightTitle'].split('.').slice(-1)
tempObj["targetPath"] = item["rightTitle"]; tempObj['targetPath'] = item['rightTitle']
tempObj["sourceFieldPath"] = JSON.stringify(item["leftidarr"]); tempObj['sourceFieldPath'] = JSON.stringify(item['leftidarr'])
tempObj["targetFieldPath"] = JSON.stringify(item["rightidarr"]); tempObj['targetFieldPath'] = JSON.stringify(item['rightidarr'])
tempObj["coordinate"] = JSON.stringify(item); tempObj['coordinate'] = JSON.stringify(item)
arr.push(tempObj); arr.push(tempObj)
}); })
this.$set(this.activedRow, 'addList', arr) this.$set(this.activedRow, 'addList', arr)
} }
} else { } else {
@ -261,17 +265,17 @@ export default {
let arr = [] let arr = []
this.linkData.lineData.forEach((item) => { this.linkData.lineData.forEach((item) => {
//2 线 //2 线
let tempObj = {}; let tempObj = {}
tempObj["sourceField"] = item["leftTitle"].split(".").slice(-1); tempObj['sourceField'] = item['leftTitle'].split('.').slice(-1)
tempObj["sourceName"] = item["leftTitle"]; tempObj['sourceName'] = item['leftTitle']
tempObj["sourcePath"] = item["leftTitle"]; tempObj['sourcePath'] = item['leftTitle']
tempObj["targetField"] = item["rightTitle"].split(".").slice(-1); tempObj['targetField'] = item['rightTitle'].split('.').slice(-1)
tempObj["targetPath"] = item["rightTitle"]; tempObj['targetPath'] = item['rightTitle']
tempObj["sourceFieldPath"] = JSON.stringify(item["leftidarr"]); tempObj['sourceFieldPath'] = JSON.stringify(item['leftidarr'])
tempObj["targetFieldPath"] = JSON.stringify(item["rightidarr"]); tempObj['targetFieldPath'] = JSON.stringify(item['rightidarr'])
tempObj["coordinate"] = JSON.stringify(item); tempObj['coordinate'] = JSON.stringify(item)
arr.push(tempObj); arr.push(tempObj)
}); })
this.$set(this.activedRow, 'deleteList', arr) this.$set(this.activedRow, 'deleteList', arr)
} }
} }
@ -281,29 +285,29 @@ export default {
lineDataHandle(targetid, arr, saveName, saveId) { lineDataHandle(targetid, arr, saveName, saveId) {
arr.some((item) => { arr.some((item) => {
if (item.id === targetid) { if (item.id === targetid) {
this.$set(item, "value", true); this.$set(item, 'value', true)
this.$set(item, "isline", true); this.$set(item, 'isline', true)
this.$set(item, saveName, saveId); this.$set(item, saveName, saveId)
return true; return true
} else if (item.children && item.children.length) { } else if (item.children && item.children.length) {
this.lineDataHandle(targetid, item.children, saveName, saveId); this.lineDataHandle(targetid, item.children, saveName, saveId)
return false; return false
} }
}); })
}, },
// //
selectDataHanlde(resultArr, arr) { selectDataHanlde(resultArr, arr) {
arr.forEach((item) => { arr.forEach((item) => {
let obj = {}; let obj = {}
resultArr.push(obj); resultArr.push(obj)
obj["label"] = item.parameterName; obj['label'] = item.parameterName
obj["id"] = item.id; obj['id'] = item.id
obj["type"] = item.concreteType; obj['type'] = item.concreteType
if (item.children) { if (item.children) {
obj["children"] = []; obj['children'] = []
this.selectDataHanlde(obj["children"], item.children); this.selectDataHanlde(obj['children'], item.children)
} }
}); })
}, },
// //
async configurationHanlde(row, val, key) { async configurationHanlde(row, val, key) {
@ -313,66 +317,68 @@ export default {
addApi: ['addType', 'addList', 'addPlug'], addApi: ['addType', 'addList', 'addPlug'],
deleteApi: ['deleteType', 'deleteList', 'deletePlug'] deleteApi: ['deleteType', 'deleteList', 'deletePlug']
} }
this.addType = row[dist[key][0]] || "1" this.addType = row[dist[key][0]] || '1'
if (this.addType === '1') { if (this.addType === '1') {
this.plugIn = row[dist[key][2]] this.plugIn = row[dist[key][2]]
} else { } else {
this.dialogWidth = "90%" this.dialogWidth = '90%'
} }
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "sysApplicationService", tl: 'sysApplicationService',
as: "application", as: '',
dj: "debugAppApi" dj: 'queryPlugAndApi'
}, { }, {
id: val, id: val,
appId: row['appId'] appId: row['appId']
}) })
const res1 = await getApiModuleApi( const res1 = await getApiModuleApi(
{ {
tl: "sysApplicationService", tl: 'sysApplicationService',
as: "application", as: '',
dj: "debugAppApi", dj: 'queryPlugAndApi'
}, },
{id: val, appId: row['appId']} { id: val, appId: row['appId'] }
); )
let tempArr = [] let tempArr = []
//
this.options = res.attribute.app
let bodyIn = JSON.parse(res.attribute.api.bodyIn) let bodyIn = JSON.parse(res.attribute.api.bodyIn)
if (bodyIn[0] && bodyIn[0].children) { if (bodyIn[0] && bodyIn[0].children) {
this.selectDataHanlde(tempArr, bodyIn[0].children); this.selectDataHanlde(tempArr, bodyIn[0].children)
} }
this.linkData.rightData = tempArr this.linkData.rightData = tempArr
res1.attribute.para.forEach(item => { //
if (item.interfaceType === '2') { // res1.attribute.para.forEach(item => {
this.linkData.rightData.push({ // if (item.interfaceType === '2') {
label: item.interfaceKey, // this.linkData.rightData.push({
id: item.id // label: item.interfaceKey,
}) // id: item.id
} // })
// }
}) //
// })
if (row[dist[key][1]] && row[dist[key][1]].length) { if (row[dist[key][1]] && row[dist[key][1]].length) {
this.linkData.lineData = [] this.linkData.lineData = []
row[dist[key][1]].forEach(item => { row[dist[key][1]].forEach(item => {
// //
let leftArr = JSON.parse(item.sourceFieldPath); let leftArr = JSON.parse(item.sourceFieldPath)
let saveId = leftArr[leftArr.length - 1]; let saveId = leftArr[leftArr.length - 1]
let rightArr = JSON.parse(item.targetFieldPath); let rightArr = JSON.parse(item.targetFieldPath)
let targetid = rightArr[rightArr.length - 1]; let targetid = rightArr[rightArr.length - 1]
this.lineDataHandle( this.lineDataHandle(
targetid, targetid,
this.linkData.rightData, this.linkData.rightData,
"leftid", 'leftid',
saveId saveId
); )
this.lineDataHandle( this.lineDataHandle(
saveId, saveId,
this.linkData.leftData, this.linkData.leftData,
"rightid", 'rightid',
targetid targetid
); )
console.log(item)
if (item.coordinate) { if (item.coordinate) {
this.linkData.lineData.push(JSON.parse(item.coordinate)); this.linkData.lineData.push(JSON.parse(item.coordinate))
} }
}) })
@ -380,8 +386,8 @@ export default {
this.addSwitch = true this.addSwitch = true
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.link.line = deepClone(this.linkData.lineData) this.$refs.link.line = deepClone(this.linkData.lineData)
this.$refs.link.resizeHeight(); this.$refs.link.resizeHeight()
}); })
}, },
seleChangeHanlde(val, row, key) { seleChangeHanlde(val, row, key) {
let dist = { let dist = {
@ -390,13 +396,13 @@ export default {
} }
if (key === 'main') { if (key === 'main') {
this.$set(row, "addApi", "") this.$set(row, 'addApi', '')
this.$set(row, "deleteApi", "") this.$set(row, 'deleteApi', '')
} else { } else {
console.log(key) console.log(key)
this.$set(row, dist[key][0], "") this.$set(row, dist[key][0], '')
this.$set(row, dist[key][1], []) this.$set(row, dist[key][1], [])
this.$set(row, dist[key][2], "") this.$set(row, dist[key][2], '')
console.log(row) console.log(row)
} }
@ -406,19 +412,20 @@ export default {
}, },
async initSelect() { async initSelect() {
const plugRes = await getUserModuleApi({ const plugRes = await getUserModuleApi({
tl: "pluginService", tl: 'pluginService',
as: "plugins", as: 'plugins',
dj: "queryPluginsByType" dj: 'queryPluginsByType'
}, { }, {
"pluginType": "1" 'pluginType': '1'
}) })
this.options = plugRes.attribute // console.log(plugRes.attribute, 'plugRes.attribute')
// this.options = plugRes.attribute
}, },
async init() { async init() {
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmModuleDistribute" dj: 'queryMdmModuleDistribute'
}, { }, {
id: this.$route.query.id id: this.$route.query.id
}) })
@ -429,10 +436,10 @@ export default {
}, },
async initLeftLink() { async initLeftLink() {
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "queryMdmShowAll" dj: 'queryMdmShowAll'
}, {id: this.$route.query.id}) }, { id: this.$route.query.id })
if (res.status === '200') { if (res.status === '200') {
let arr = [] let arr = []
res.attribute.forEach(item => { res.attribute.forEach(item => {
@ -450,8 +457,8 @@ export default {
if (val == 2) { if (val == 2) {
this.dialogWidth = '95%' this.dialogWidth = '95%'
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.link.resizeHeight(); this.$refs.link.resizeHeight()
}); })
} else { } else {
this.dialogWidth = '40%' this.dialogWidth = '40%'
} }
@ -459,68 +466,68 @@ export default {
// dialog // dialog
dialogCloseHandle() { dialogCloseHandle() {
//线 //线
this.linkData.lineData = []; this.linkData.lineData = []
this.linkData.leftData = deepClone(this.linkData.leftDataCopy); this.linkData.leftData = deepClone(this.linkData.leftDataCopy)
this.linkData.rightData = [] this.linkData.rightData = []
//radio //radio
this.addType = "1"; this.addType = '1'
//select //select
this.plugIn = ""; this.plugIn = ''
// //
this.dialogWidth = '40%' this.dialogWidth = '40%'
}, },
// 线 x y // 线 x y
getLineData(data) { getLineData(data) {
this.linkData.lineData = deepClone(data); this.linkData.lineData = deepClone(data)
}, },
// //
currentChangeHandle(pageModel) { currentChangeHandle(pageModel) {
this.pageModel = pageModel; this.pageModel = pageModel
this.$nextTick(() => { this.$nextTick(() => {
}); })
}, },
// save // save
async saveHandle() { async saveHandle() {
let arr = [] let arr = []
let flag = this.tableData.some((item, index) => { let flag = this.tableData.some((item, index) => {
if (!item.appId) { if (!item.appId) {
this.$vmNews("请选择应用", "warning") this.$vmNews('请选择应用', 'warning')
return true return true
} }
if (arr.includes(item.appId)) { if (arr.includes(item.appId)) {
this.$vmNews("不允许重复选择应用", "warning") this.$vmNews('不允许重复选择应用', 'warning')
return true return true
} }
arr.push(item.appId) arr.push(item.appId)
if (!item.addApi || !item.deleteApi) { if (!item.addApi || !item.deleteApi) {
this.$vmNews("请选择接口", "warning") this.$vmNews('请选择接口', 'warning')
return true return true
} }
if (item.addApi === item.deleteApi) { if (item.addApi === item.deleteApi) {
this.$vmNews("新增接口和删除接口不能选同一个", "warning") this.$vmNews('新增接口和删除接口不能选同一个', 'warning')
return true return true
} }
if (!item.addType) { if (!item.addType) {
this.$vmNews(`请配置${index + 1}行新增接口`, "warning") this.$vmNews(`请配置${index + 1}行新增接口`, 'warning')
return true return true
} }
if (!item.deleteType) { if (!item.deleteType) {
this.$vmNews(`请配置${index + 1}行删除接口`, "warning") this.$vmNews(`请配置${index + 1}行删除接口`, 'warning')
return true return true
} }
}) })
if (flag) return if (flag) return
let params = { let params = {
id: this.$route.query.id, id: this.$route.query.id,
mdmModuleDistributeEntities: this.tableData, mdmModuleDistributeEntities: this.tableData
} }
const res = await getUserModuleApi({ const res = await getUserModuleApi({
tl: "mdmService", tl: 'mdmService',
as: "mdmService", as: 'mdmService',
dj: "doSaveMdmModuleDistribute", dj: 'doSaveMdmModuleDistribute'
}, params) }, params)
if (res.status === '200') { if (res.status === '200') {
this.$vmNews("保存成功", "success") this.$vmNews('保存成功', 'success')
this.init() this.init()
} }
}, },
@ -541,9 +548,9 @@ export default {
this.init() this.init()
this.initSelect() this.initSelect()
this.initLeftLink() this.initLeftLink()
this.$emit("flashActive", 4) this.$emit('flashActive', 4)
}, }
}; }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">