Commit c255eb5a authored by 赵伟庚's avatar 赵伟庚

update:首页配置需求&部分需求优化

parent b552c48f
<template>
<div class="item_card">
<div class="action_box" v-if="props.flag">
<div class="can_click_text" @click="deleteItem(props.item)">删除</div>
<div class="can_click_text" @click="move(1)" :class="props.item.canDown ? '' : 'disabled'">下移</div>
<div class="can_click_text" @click="move(2)" :class="props.item.canUp ? '' : 'disabled'">上移</div>
</div>
<div class="top_info">
<el-checkbox
class="select_box"
v-model="props.item.checked"
@change="change_check"
></el-checkbox>
<div class="logo">
<img v-if="props.item.ability_logo" :src="props.item.ability_logo" alt="">
<img v-else src="../assets/imgs/img_cover_ability.png" alt="">
</div>
<div class="info">
<div class="name">
<span class="ability_name">{{props.item.ability_name}}</span>
<span class="icon_box openness" :class="openClassObj[props.item.openness_id]">{{props.item.openness}}</span>
<span class="icon_box mock" v-if="props.item.include_mock_service">mock</span>
</div>
<div class="count">
<div class="box1">
<div class="score_box">
<el-rate
v-model="props.item.score"
disabled
/>
</div>
<span class="score">{{props.item.score}}</span>
</div>
<div class="line"></div>
<div class="box2">
阅读{{
props.item.browse_count == 0 || (props.item.browse_count && props.item.browse_count < 10000)
? props.item.browse_count
: props.item.browse_count < 10000000
? Math.floor(props.item.browse_count/10000) + '万+'
: '999万+'
}}
</div>
<div class="line"></div>
<div class="box3">
调用{{
props.item.call_count == 0 || (props.item.call_count && props.item.call_count < 10000)
? props.item.call_count
: props.item.call_count < 10000000
? Math.floor(props.item.call_count/10000) + '万+'
: '999万+'
}}
</div>
</div>
</div>
</div>
<div class="bottom_info">
<div class="desc" :title="props.item.synopsis">
{{props.item.synopsis}}
</div>
<div class="action">
<span class="fws" :title="props.item.develop">
<bg-icon style="font-size: 14px; color: #909bb6;" icon="#bg-ic-shop" />
{{props.item.develop}}
</span>
</div>
</div>
</div>
</template>
<script setup>
import { useRouter } from "vue-router"
const router = useRouter()
const props = defineProps({
item: {
type: Object,
default: {}
},
flag: {
type: Boolean,
default: false
}
})
const emit = defineEmits(["change_check","deleteItem","move"])
const openClassObj = {
'9de06ba6-6ee2-4449-91d9-31a1c7554311':'open',
'4e8b4c37-e565-4195-8303-3b1ccd48dd13':'share',
'4e8b4c37-e565-4195-8303-3b1ccd48dd12':'limit',
'4e8b4c37-e565-4195-8303-3b1ccd48dd16':'sensitive'
}
const change_check = () => {
console.log(props.item)
emit("change_check",props.item)
}
const deleteItem = (item) => {
emit("deleteItem",item)
}
const move = (type) => {
if ((type == 1 && !props.item.canDown) || (type == 2 && !props.item.canUp)) {
return
}
let temp = {
item: props.item,
type: type
}
emit("move",temp)
}
</script>
<style lang="scss" scoped>
.item_card {
width: 100%;
margin-right: 16px;
margin-bottom: 16px;
height: 206px;
background-color: #ffffff;
box-shadow: 0px 4px 16px 0px
rgba(18, 30, 63, 0.08);
border-radius: 6px;
&:nth-child(3n) {
margin-right: 0;
}
.action_box {
height: 36px;
background-color: #dfe5f5;
display: flex;
line-height: 36px;
flex-direction: row-reverse;
.can_click_text {
margin-right: 16px;
}
.disabled {
cursor: not-allowed;
color: #a9b1c7;
}
}
.top_info {
width: 100%;
height: 92px;
padding: 0 16px 0 8px;
padding-top: 24px;
border-bottom: 1px solid #edeff2;
display: flex;
.select_box {
width: 16px;
height: 16px;
margin-right: 8px;
margin-top: 16px;
}
.logo {
width: 48px;
height: 48px;
margin-right: 16px;
img {
width: 48px;
}
}
.info {
width: calc(100% - 86px);
.name {
width: 100%;
display: flex;
align-items: center;
.ability_name {
max-width: calc(100% - 85px);
font-size: 16px;
font-weight: 700;
line-height: 24px;
color: #202531;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.icon_box {
height: 18px;
border: 1px solid #fff;
font-size: 12px;
line-height: 16px;
margin-left: 6px;
text-align: center;
border-radius: 3px;
}
.openness {
width: 33px;
color: #429e8a;
background-color: #ecf5f4;
border-color: #a1cfc5;
}
.open{
background-color: #f0f5eb;
border-color:#bbd19e;
color: #78a33d;
}
.share{
}
.limit{
background-color: #fcf0e6;
border-color: #f2b380;
color: #e56600;
}
.sensitive{
background-color: #fbeeeb;
border-color: #eba89c;
color: #d75138;
}
.mock {
width: 40px;
color: #3759be;
background-color: #ebeff9;
border-color: #9bacdf;
}
}
.count {
width: 100%;
display: flex;
align-items: center;
margin-top: 10px;
font-size: 12px;
color: #404a62;
.line {
width: 1px;
height: 12px;
margin: 0 8px;
background-color: #cbced7;
}
.box1 {
max-width: calc(100% - 166px);
height: 14px;
display: flex;
align-items: center;
.score_box {
max-width: 60px;
padding-top: 1px;
overflow: hidden;
.el-rate {
height: 14px;
// padding-top: 1px;
:deep().el-rate__item {
width: 12px;
height: 12px;
.el-rate__icon {
font-size: 14px;
}
}
}
}
.score {
color: #e56600;
margin-left: 5px;
font-size: 14px;
}
}
.box2,
.box3 {
max-width: 66px;
}
}
}
}
.bottom_info {
height: calc(100% - 92px);
background-color: #fbfbfc;
border-radius: 0 0 6px 6px;
padding: 20px 24px 24px;
font-size: 14px;
color: #404a62;
line-height: 22px;
.desc {
height: 44px;
overflow: hidden;
text-overflow: ellipsis;
// white-space: nowrap;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
margin-bottom: 6px;
text-align: left;
}
.action {
display: flex;
justify-content: space-between;
.fws {
color: #7784a6;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 160px;
}
}
}
}
</style>
\ No newline at end of file
<template>
<div class="card_list">
<div v-for="(e,i) in props.list" :key="'card' + i" class="item" style="width: calc((100% - 32px) / 3)">
<ability-card v-if="e.id" :item="e" @change_check="changeCheck" :flag="props.flag" @deleteItem="deleteItem" @move="move"/>
<div v-else class="empty_card" @click="open">
<span>+</span>
</div>
</div>
</div>
</template>
<script setup>
import abilityCard from "./ability-card.vue"
const props = defineProps({
list: {
type: Array,
default: []
},
flag: {
type: Boolean,
default: false
}
})
const emit = defineEmits(["changeCheck","openBox","deleteItem","move"])
const changeCheck = (item) => {
emit("changeCheck",item)
}
const open = () => {
console.log(3333)
emit("openBox")
}
const deleteItem = (item) => {
emit("deleteItem",item)
}
const move = (temp) => {
emit("move",temp)
}
</script>
<style lang="scss" scoped>
.card_list {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
// .item {
// width: calc(100% - 32px);
// }
.empty_card {
cursor: pointer;
width: 384px;
height: 242px;
border: 1px dashed #dadee7;
border-radius: 4px;
margin-bottom: 24px;
color: #dadee7;
text-align: center;
line-height: 242px;
font-size: 48px;
font-weight: 100;
}
}
</style>
\ No newline at end of file
...@@ -54,22 +54,22 @@ const checkPhone = (rule, value, callback) => { ...@@ -54,22 +54,22 @@ const checkPhone = (rule, value, callback) => {
}); });
}; };
const checkPhoneRepet = (rule, value, callback) => { // const checkPhoneRepet = (rule, value, callback) => {
let params = null; // let params = null;
if (props.id){ // if (props.id){
params = {id: parseInt(props.id),contact_phone: value,} // params = {id: parseInt(props.id),contact_phone: value,}
}else { // }else {
params = {id: 0,contact_phone: value} // params = {id: 0,contact_phone: value}
} // }
$axios.post(`/apaas/system/v5/org/check`,params) // $axios.post(`/apaas/system/v5/org/check`,params)
.then((res) => { // .then((res) => {
if (res.data.code == 200) { // if (res.data.code == 200) {
callback() // callback()
}else { // }else {
callback(new Error(res.data.data)) // callback(new Error(res.data.data))
} // }
}) // })
} // }
const checkName = (rule, value, callback) => { const checkName = (rule, value, callback) => {
var reg = /^[a-zA-Z0-9\u4e00-\u9fa5]+$/ var reg = /^[a-zA-Z0-9\u4e00-\u9fa5]+$/
...@@ -89,7 +89,7 @@ const contactFormRules = reactive({ ...@@ -89,7 +89,7 @@ const contactFormRules = reactive({
contact_phone: [ contact_phone: [
{ required: true, message: '请输入联系人手机号', trigger: 'blur' }, { required: true, message: '请输入联系人手机号', trigger: 'blur' },
{ validator: checkPhone, trigger: 'blur' }, { validator: checkPhone, trigger: 'blur' },
{ validator: checkPhoneRepet, trigger: 'blur' } // { validator: checkPhoneRepet, trigger: 'blur' }
], ],
contact_email: [ contact_email: [
{ type: 'email', message: '请输入正确的邮箱', trigger: 'blur' }, { type: 'email', message: '请输入正确的邮箱', trigger: 'blur' },
......
...@@ -180,7 +180,13 @@ const continueCreate = () => { ...@@ -180,7 +180,13 @@ const continueCreate = () => {
} }
//取消 //取消
const cancel = () => { const cancel = () => {
router.go(-1); // router.go(-1);
router.push({
path: "/develop/account",
query: {
id: formData.organization_id
}
})
} }
const getDetail = () => { const getDetail = () => {
......
...@@ -245,10 +245,9 @@ const getOrgTree = () => { ...@@ -245,10 +245,9 @@ const getOrgTree = () => {
const copyText = (data) => { const copyText = (data) => {
navigator.clipboard.writeText(data).then( navigator.clipboard.writeText(data).then(
function () { function () {
$message.success("复制成功")
}, },
function () { function () {
} }
); );
} }
......
...@@ -205,7 +205,7 @@ import { Search } from '@element-plus/icons-vue' ...@@ -205,7 +205,7 @@ import { Search } from '@element-plus/icons-vue'
import { reactive, toRefs, ref, } from '@vue/reactivity' import { reactive, toRefs, ref, } from '@vue/reactivity'
import { getCurrentInstance, watch, nextTick } from 'vue' import { getCurrentInstance, watch, nextTick } from 'vue'
import { computed, onBeforeMount } from '@vue/runtime-core' import { computed, onBeforeMount } from '@vue/runtime-core'
import { useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import { edit } from 'ace-builds'; import { edit } from 'ace-builds';
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
...@@ -272,6 +272,7 @@ import CryptoJS from "crypto-js"; ...@@ -272,6 +272,7 @@ import CryptoJS from "crypto-js";
confirm_password: '', confirm_password: '',
}) })
const selectNode = ref(null) const selectNode = ref(null)
const selectNodeObj = ref(null)
const filterTree = ref('') const filterTree = ref('')
const treeRef = ref(null) const treeRef = ref(null)
const validatePass = (rule, value, callback) => { const validatePass = (rule, value, callback) => {
...@@ -294,7 +295,7 @@ import CryptoJS from "crypto-js"; ...@@ -294,7 +295,7 @@ import CryptoJS from "crypto-js";
}) })
const router = useRouter(); const router = useRouter();
const route = useRoute()
const getTableRows = () => { const getTableRows = () => {
let params = {...filter, organization_id: selectNode.value} let params = {...filter, organization_id: selectNode.value}
$axios.get( $axios.get(
...@@ -320,20 +321,30 @@ import CryptoJS from "crypto-js"; ...@@ -320,20 +321,30 @@ import CryptoJS from "crypto-js";
} }
const handleNodeClick = (data) => { const handleNodeClick = (data) => {
console.log(data.data_type)
if(data.data_type == 1) { if(data.data_type == 1) {
selectNode.value = data.id; selectNode.value = data.id;
changePage(1) changePage(1)
}else {
nextTick(() => {
treeRef.value.setCurrentKey(null)
})
} }
} }
const orgData = ref([]) const orgData = ref([])
const customNodeClass = (data,node) => {
if (data.data_type == 0) {
return 'noFocus'
}else {
return ''
}
}
const defaultProps = { const defaultProps = {
label: 'name', label: 'name',
children: 'Child', children: 'Child',
value: 'organization_id' value: 'organization_id',
class: customNodeClass,
} }
const getOrgTree = () => { const getOrgTree = () => {
$axios.get(`/apaas/system/v5/org/tree`) $axios.get(`/apaas/system/v5/org/tree`)
.then((res) => { .then((res) => {
...@@ -341,11 +352,19 @@ import CryptoJS from "crypto-js"; ...@@ -341,11 +352,19 @@ import CryptoJS from "crypto-js";
orgData.value = res.data.data || []; orgData.value = res.data.data || [];
orgData.value.shift() orgData.value.shift()
const orgList = searchOrg(orgData.value); const orgList = searchOrg(orgData.value);
if (route.query.id) {
searchItem(orgData.value,route.query.id)
}else {
selectNode.value = orgList.length > 0 ? orgList[0].id : ''; selectNode.value = orgList.length > 0 ? orgList[0].id : '';
}
nextTick(() =>{ nextTick(() =>{
if (route.query.id) {
treeRef.value.setCurrentNode(selectNodeObj.value)
}else {
if(orgList.length > 0) { if(orgList.length > 0) {
treeRef.value.setCurrentNode(orgList[0]) treeRef.value.setCurrentNode(orgList[0])
} }
}
}) })
getTableRows() getTableRows()
}else { }else {
...@@ -353,7 +372,18 @@ import CryptoJS from "crypto-js"; ...@@ -353,7 +372,18 @@ import CryptoJS from "crypto-js";
} }
}) })
} }
const searchItem = (data,id) => {
data.forEach(e => {
if (e.organization_id == id) {
selectNodeObj.value = e
selectNode.value = e.id
}else {
if (e.Child) {
searchItem(e.Child,id)
}
}
})
}
const searchOrg = (data) => { const searchOrg = (data) => {
const arr = [] const arr = []
data.forEach(item => { data.forEach(item => {
...@@ -596,6 +626,9 @@ import CryptoJS from "crypto-js"; ...@@ -596,6 +626,9 @@ import CryptoJS from "crypto-js";
.tree :deep() .el-tree-node>.el-tree-node__children { .tree :deep() .el-tree-node>.el-tree-node__children {
overflow: unset; overflow: unset;
} }
.tree :deep().noFocus:focus>.el-tree-node__content {
background-color: #fff;
}
.custom_tree_node { .custom_tree_node {
width: 100%; width: 100%;
font-size: 14px; font-size: 14px;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
ref="menuTree" ref="menuTree"
:filter-node-method="filterNode" :filter-node-method="filterNode"
:expand-on-click-node="false" :expand-on-click-node="false"
> >
<template #default="{ node, data }"> <template #default="{ node, data }">
<div class="custom-tree-node" pointer-events="none"> <div class="custom-tree-node" pointer-events="none">
...@@ -182,6 +183,9 @@ const getMenuTree = (type,id) => { ...@@ -182,6 +183,9 @@ const getMenuTree = (type,id) => {
if (type == 1) { // 删除数据后默认选中父节点或第一个节点 if (type == 1) { // 删除数据后默认选中父节点或第一个节点
state.menuTree && state.menuTree.setCurrentKey(state.selectParentData.menu_id); state.menuTree && state.menuTree.setCurrentKey(state.selectParentData.menu_id);
handleNodeClick(state.selectParentData); handleNodeClick(state.selectParentData);
nextTick().then(() => {
setScroll()
})
}else { }else {
state.menuTree && state.menuTree.setCurrentKey(state.data[0].menu_id); state.menuTree && state.menuTree.setCurrentKey(state.data[0].menu_id);
handleNodeClick(state.data[0]); handleNodeClick(state.data[0]);
...@@ -193,6 +197,9 @@ const getMenuTree = (type,id) => { ...@@ -193,6 +197,9 @@ const getMenuTree = (type,id) => {
if (state.selectData) { if (state.selectData) {
state.menuTree && state.menuTree.setCurrentKey(state.selectData.menu_id); state.menuTree && state.menuTree.setCurrentKey(state.selectData.menu_id);
handleNodeClick(state.selectData); handleNodeClick(state.selectData);
nextTick().then(() => {
setScroll()
})
}else { }else {
state.menuTree && state.menuTree.setCurrentKey(state.data[0].menu_id); state.menuTree && state.menuTree.setCurrentKey(state.data[0].menu_id);
handleNodeClick(state.data[0]); handleNodeClick(state.data[0]);
...@@ -205,7 +212,21 @@ const getMenuTree = (type,id) => { ...@@ -205,7 +212,21 @@ const getMenuTree = (type,id) => {
} }
}) })
} // 获取菜单树 } // 获取菜单树
const setScroll = () => {
setTimeout(()=> {
var nodeOffsetTop = document.querySelector(
".file-tree .is-current"
).offsetTop
var treeScroll = document.querySelector(
".tree"
)
var parentHeight = treeScroll.clientHeight
if (nodeOffsetTop > parentHeight) {
treeScroll.scrollTop = nodeOffsetTop - parentHeight / 2
}
},300)
}
const findData = (arr,id) => { const findData = (arr,id) => {
arr.forEach(e => { arr.forEach(e => {
if (e.menu_id == id) { if (e.menu_id == id) {
...@@ -309,6 +330,8 @@ const fileAction = (val,data,parent,disabled=false) => { ...@@ -309,6 +330,8 @@ const fileAction = (val,data,parent,disabled=false) => {
level: data.level, // 当前的level level: data.level, // 当前的level
p_menu_type: parent ? parent.menu_type : 0, // 父级的类型,用于判断菜单下不能建目录 p_menu_type: parent ? parent.menu_type : 0, // 父级的类型,用于判断菜单下不能建目录
system_type: "", // 系统类型 system_type: "", // 系统类型
new_window: 0,
remark: "",
} }
state.menuTree.insertAfter(newChild,parent? parent.Child[parent.Child.length-1] : state.data[state.data.length -1]) state.menuTree.insertAfter(newChild,parent? parent.Child[parent.Child.length-1] : state.data[state.data.length -1])
state.menuTree && state.menuTree.setCurrentKey(newChild.menu_id); state.menuTree && state.menuTree.setCurrentKey(newChild.menu_id);
...@@ -331,6 +354,8 @@ const fileAction = (val,data,parent,disabled=false) => { ...@@ -331,6 +354,8 @@ const fileAction = (val,data,parent,disabled=false) => {
p_menu_type: data.menu_type, p_menu_type: data.menu_type,
level: data.level + 1, level: data.level + 1,
system_type: "", // 系统类型 system_type: "", // 系统类型
new_window: 0,
remark: "",
} }
state.menuTree.append(newChild,data) state.menuTree.append(newChild,data)
state.menuTree && state.menuTree.setCurrentKey(newChild.menu_id); state.menuTree && state.menuTree.setCurrentKey(newChild.menu_id);
...@@ -338,11 +363,15 @@ const fileAction = (val,data,parent,disabled=false) => { ...@@ -338,11 +363,15 @@ const fileAction = (val,data,parent,disabled=false) => {
state.selectParentData = data state.selectParentData = data
state.newMenuId++ state.newMenuId++
}else if (val == 3) { // 删除菜单 }else if (val == 3) { // 删除菜单
if (data.id) {
if (data.state == 1) { if (data.state == 1) {
ElMessage.error("删除内容中有启用状态的数据,不可删除!") ElMessage.error("删除内容中有启用状态的数据,不可删除!")
return return
} }
state.delDialog = true state.delDialog = true
}else {
state.delDialog = true
}
}else if (val == 4) { // 菜单上移 }else if (val == 4) { // 菜单上移
if (disabled) { if (disabled) {
...@@ -395,6 +424,7 @@ const fileAction = (val,data,parent,disabled=false) => { ...@@ -395,6 +424,7 @@ const fileAction = (val,data,parent,disabled=false) => {
} // 各种操作按钮 } // 各种操作按钮
const deleteData = () => { const deleteData = () => {
if (state.selectData.id) {
axios axios
.delete(`/apaas/system/v5/menu/${state.selectData.id}`) .delete(`/apaas/system/v5/menu/${state.selectData.id}`)
.then((res) => { .then((res) => {
...@@ -408,6 +438,19 @@ const deleteData = () => { ...@@ -408,6 +438,19 @@ const deleteData = () => {
ElMessage.error(res.data.data) ElMessage.error(res.data.data)
} }
}) })
}else {
state.menuTree.remove(state.selectData)
state.selectData = null
let type = state.selectParentData ? 1 : 2 // 1--有父级 2--无父级
if (type == 1) {
state.menuTree && state.menuTree.setCurrentKey(state.selectParentData.menu_id);
handleNodeClick(state.selectParentData);
}else {
state.menuTree && state.menuTree.setCurrentKey(state.data[0].menu_id);
handleNodeClick(state.data[0]);
}
state.delDialog = false
}
} }
const changeSort = (data,nextObj) => { const changeSort = (data,nextObj) => {
...@@ -449,6 +492,8 @@ const saveMenu = (el,type) => { ...@@ -449,6 +492,8 @@ const saveMenu = (el,type) => {
menu_logo: el.menuForm.menu_logo, menu_logo: el.menuForm.menu_logo,
source: el.menuForm.menu_type == 0 ? "" : el.menuForm.source, source: el.menuForm.menu_type == 0 ? "" : el.menuForm.source,
system_type: el.menuForm.system_type, system_type: el.menuForm.system_type,
new_window: el.menuForm.new_window,
remark: el.menuForm.remark,
} }
if (state.selectData.id) { // 编辑 if (state.selectData.id) { // 编辑
axios axios
......
...@@ -28,6 +28,15 @@ ...@@ -28,6 +28,15 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="跳转方式" prop="new_window" v-if="menuForm.menu_type !=0">
<el-radio-group v-model="menuForm.new_window">
<el-radio :label="0">当前窗口</el-radio>
<el-radio :label="1">新窗口</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input v-model="menuForm.remark" show-word-limit maxlength="8" placeholder="请输入备注" />
</el-form-item>
<el-form-item label="系统类型" prop="system_type" v-if="topLevel"> <el-form-item label="系统类型" prop="system_type" v-if="topLevel">
<el-select v-model="menuForm.system_type" placeholder="请选择系统类型"> <el-select v-model="menuForm.system_type" placeholder="请选择系统类型">
<el-option <el-option
...@@ -131,6 +140,8 @@ const state = reactive({ ...@@ -131,6 +140,8 @@ const state = reactive({
menu_logo: "", menu_logo: "",
source: "", source: "",
system_type: "", system_type: "",
new_window: 0,
remark: "",
}, },
formRules: { formRules: {
menu_name: [ menu_name: [
...@@ -147,6 +158,9 @@ const state = reactive({ ...@@ -147,6 +158,9 @@ const state = reactive({
], ],
menu_url: [ menu_url: [
{ required: true, message: '请输入菜单路径', trigger: 'blur' }, { required: true, message: '请输入菜单路径', trigger: 'blur' },
],
new_window: [
{ required: true, message: '请选择跳转方式', trigger: 'change' },
] ]
}, },
groupList: [], // 菜单分组 groupList: [], // 菜单分组
......
...@@ -22,7 +22,7 @@ import axios from '../../../../../request/http.js' ...@@ -22,7 +22,7 @@ import axios from '../../../../../request/http.js'
import { ElMessage } from 'element-plus' import { ElMessage } from 'element-plus'
import { useRoute, useRouter } from 'vue-router' import { useRoute, useRouter } from 'vue-router'
import bgBreadcrumb from "@/components/bg-breadcrumb.vue"; import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
import bannerForm from "./banner_form.vue" import bannerForm from "./banner-form.vue"
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const bannerFormRef = ref(null); const bannerFormRef = ref(null);
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
<el-form-item label="公司地址" prop="company_address"> <el-form-item label="公司地址" prop="company_address">
<el-input v-model="formData.company_address" placeholder="请输入公司地址" show-word-limit maxlength="100"/> <el-input v-model="formData.company_address" placeholder="请输入公司地址" show-word-limit maxlength="100"/>
</el-form-item> </el-form-item>
<el-form-item label="公司logo" prop="company_logo"> <el-form-item label="公司logo" prop="logo">
<bg-upload-image v-model="formData.company_logo" :limit="1" listType="picture-card" :accept="['.jpg','.jpeg','.png']"></bg-upload-image> <bg-upload-image v-model="formData.logo" :fileSize="500" :fileSizeUnit="'KB'" :showTips="true" customTips="请选择图片上传:大小80 * 80像素支持jpg、png等格式,图片需小于500KB" :limit="1" listType="picture-card" :accept="['.jpg','.jpeg','.png']"></bg-upload-image>
</el-form-item> </el-form-item>
<el-form-item label="公司电话" prop="company_phone"> <el-form-item label="公司电话" prop="contact_phone">
<el-input v-model="formData.company_phone" placeholder="请输入公司电话" show-word-limit maxlength="20" /> <el-input v-model="formData.contact_phone" placeholder="请输入公司电话" show-word-limit maxlength="20" />
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
...@@ -43,12 +43,28 @@ import bgBreadcrumb from "@/components/bg-breadcrumb.vue"; ...@@ -43,12 +43,28 @@ import bgBreadcrumb from "@/components/bg-breadcrumb.vue";
const router = useRouter() const router = useRouter()
const route = useRoute() const route = useRoute()
const formRef = ref(null); const formRef = ref(null);
const checkPhone = (rule,value,callback) => {
let reg = /^((1[0-9]{10})|(((([0-9]{3}-)?[0-9]{8})|(([0-9]{4}-)?[0-9]{7}))(-[0-9]{1,4})?))$/
if (value !== '') {
console.log(1)
if (!reg.test(value)) {
console.log(2)
callback(new Error("电话号码格式不正确,请重新输入"))
}else {
console.log(3)
callback()
}
}else {
callback()
}
}
const state = reactive({ const state = reactive({
formData: { formData: {
company_name: "", company_name: "",
company_address: "", company_address: "",
company_logo: [], logo: [],
company_phone: "" contact_phone: ""
}, },
formRules: { formRules: {
company_name: [ company_name: [
...@@ -58,40 +74,52 @@ const state = reactive({ ...@@ -58,40 +74,52 @@ const state = reactive({
company_address: [ company_address: [
], ],
company_logo: [ logo: [
], ],
company_phone: [ contact_phone: [
{ validator: checkPhone, trigger: "blur"}
], ],
} }
}) })
const getFootInfo = () => { const getFootInfo = () => {
// axios axios
// .get(`/apaas/system/v5/banner/${id}`) .get(`/apaas/system/v5/config/get`)
// .then(res => { .then(res => {
// if (res.data.code == 200) { if (res.data.code == 200) {
// const data = res.data.data const data = res.data.data
// bannerFormRef.value.setForm({ state.formData = {
// company_name: data.company_name, company_name: data.company_name,
// company_address: data.company_address, company_address: data.company_address,
// company_logo: data.company_logo ? [{url: data.company_logo}] : [], logo: data.logo ? [{url: data.logo}] : [],
// company_phone: data.company_phone contact_phone: data.contact_phone
// }) }
// }else { }else {
// ElMessage.error(res.data.data) ElMessage.error(res.data.data)
// } }
// }) })
// .catch(err => { .catch(err => {
// console.log(err) console.log(err)
// }) })
} }
const submit = () => { const submit = () => {
formRef.value.validate((valid, fields) => { formRef.value.validate((valid, fields) => {
if (valid) { if (valid) {
let params = {
...state.formData,
logo: state.formData.logo && state.formData.logo.length > 0 ? state.formData.logo[0].url : '',
}
axios
.post(`/apaas/system/v5/config/set`,params)
.then(res => {
if (res.data.code == 200) {
ElMessage.success(res.data.msg)
}else {
ElMessage.error(res.data.data)
}
})
} }
}) })
} }
...@@ -139,6 +167,18 @@ const { ...@@ -139,6 +167,18 @@ const {
.form { .form {
.el-form-item { .el-form-item {
display: block; display: block;
:deep().bg-upload {
.el-upload--picture-card {
width: 80px;
height: 80px;
background-color: #fff;
border: 1px solid #dadee7;
}
.el-upload-list--picture-card .el-upload-list__item {
width: 80px;
height: 80px;
}
}
} }
} }
} }
......
<template>
<el-form
:model="formData"
:rules="formRules"
ref="form"
style="max-width: 1048px"
class="form"
>
<el-form-item label="能力类型" prop="type">
<el-select v-model="formData.type" placeholder="请选择能力类型" style="width: 100%" @change="changeType">
<el-option
v-for="item in TypeList"
:key="item.dict_id"
:label="item.name"
:value="item.dict_id"
/>
</el-select>
</el-form-item>
<el-form-item label="上传图标" prop="icon">
<bg-upload-image v-model="formData.icon" :fileSize="500" :fileSizeUnit="'KB'" :showTips="true" customTips="请选择图片上传:大小36 * 36像素支持jpg、png等格式,图片需小于500KB" :limit="1" listType="picture-card" :accept="['.jpg','.jpeg','.png']"></bg-upload-image>
</el-form-item>
</el-form>
</template>
<script setup>
import { reactive, toRefs, ref, onBeforeMount, nextTick } from 'vue'
import axios from '../../../../../request/http.js'
import { ElMessage } from 'element-plus'
import { useRoute, useRouter } from 'vue-router'
const router = useRouter()
const route = useRoute()
const form = ref(null)
const state = reactive({
formData: {
type: "",
icon: [],
},
formRules: {
type: [
{ required: true, message: '请选择业务类型', trigger: 'change' },
],
icon: [
{ required: true, message: '请上传图标', trigger: 'change' },
],
},
TypeList: [],
})
const emit = defineEmits(['action','changeType'])
const submitForm = async () => {
if (!form) return
await form.value.validate((valid, fields) => {
if (valid) {
emit('action', state.formData)
} else {
emit('action',null)
}
})
}
const changeType = (val) => {
emit("changeType",val)
}
const clearForm = () => {
if (!form) return
form.value.resetFields()
}
const setForm = (data) => {
Object.assign(state.formData, data);
}
const getTypeList = () => {
axios
.get("/apaas/system/v5/dictionary/alllist")
.then((res) => {
if (res.data.code == 200) {
let data = res.data.data || []
data.forEach(e => {
if (e.classify_id == "eb9c7d70-c123-42b7-8e61-dde1b022b669") {
state.TypeList = e.list || [];
}
})
}else {
ElMessage.error(res.data.data)
}
})
}
onBeforeMount(() => {
getTypeList()
})
const {
formData,
formRules,
TypeList,
} = toRefs(state)
defineExpose({ submitForm, clearForm, setForm })
</script>
<style lang="scss" scoped>
.form {
.el-form-item {
display: block;
}
:deep().bg-upload {
.el-upload--picture-card {
width: 56px;
height: 56px;
background-color: #fff;
border: 1px solid #dadee7;
}
.el-upload-list--picture-card .el-upload-list__item {
width: 56px;
height: 56px;
}
}
}
</style>
\ No newline at end of file
...@@ -191,7 +191,8 @@ const getOperations = (row) => { ...@@ -191,7 +191,8 @@ const getOperations = (row) => {
} // 表格操作按钮 } // 表格操作按钮
const addBanner = () => { const addBanner = () => {
console.log("新增banner") console.log("新建")
router.push("/home-config/recommend/add")
} }
const edit_row = (row) => { const edit_row = (row) => {
......
...@@ -79,7 +79,7 @@ import { reactive, ref, onMounted, onBeforeMount, getCurrentInstance, nextTick } ...@@ -79,7 +79,7 @@ import { reactive, ref, onMounted, onBeforeMount, getCurrentInstance, nextTick }
label: 'name', label: 'name',
children: 'Child', children: 'Child',
value: 'organization_id', value: 'organization_id',
// disabled: 'disabled' disabled: 'disabled'
} }
const getOrgTree = () => { const getOrgTree = () => {
$axios.get(`/apaas/system/v5/org/tree`) $axios.get(`/apaas/system/v5/org/tree`)
......
...@@ -88,23 +88,23 @@ ...@@ -88,23 +88,23 @@
</template> </template>
</bg-filter-group> </bg-filter-group>
<div class="table_container apaas_scroll"> <div class="table_container apaas_scroll">
<bg-table ref="dataTable" :headers="headers" :rows="tableRows" :isIndex="true" :stripe="true" :select="true" @selectAc="selectRows"> <bg-table ref="dataTable" :headers="headers" :rows="tableRows" :isIndex="true" canEdit canEditFlag='canSelect' :stripe="true" :select="true" @selectAc="selectRows">
<template v-slot:system_account="{ row }"> <template v-slot:system_account="{ row }">
<span @click="goDetail(row)" class="can_click_text"> <span @click="goDetail(row)" class="can_click_text">
{{ row.system_account }} {{ row.system_account }}
</span> </span>
</template> </template>
<template v-slot:state="{ row }"> <template v-slot:state="{ row }">
<bg-switch @click="stateChange(row)" :labels="['否','是']" :values="[0,1]" v-model="row.state"></bg-switch> <bg-switch @click="stateChange(row)" :labels="['否','是']" :values="[0,1]" v-model="row.state" :disabled="row.is_admin== 4"></bg-switch>
</template> </template>
<template v-slot:action="{ row }"> <template v-slot:action="{ row }">
<bg-table-btn @click="editAccount(row)" class="can_click_text"> <bg-table-btn :disabled="row.is_admin== 4" @click="editAccount(row)" class="can_click_text">
编辑 编辑
</bg-table-btn> </bg-table-btn>
<bg-table-btn @click="editPsdAccount(row)" class="can_click_text"> <bg-table-btn :disabled="row.is_admin== 4 && userInfo.is_admin !== 4" @click="editPsdAccount(row)" class="can_click_text">
修改密码 修改密码
</bg-table-btn> </bg-table-btn>
<bg-table-btn @click="deleteAccount(row)" class="can_click_text"> <bg-table-btn :disabled="row.is_admin== 4" @click="deleteAccount(row)" class="can_click_text">
删除 删除
</bg-table-btn> </bg-table-btn>
</template> </template>
...@@ -285,6 +285,7 @@ import directoryForm from './directory-form.vue'; ...@@ -285,6 +285,7 @@ import directoryForm from './directory-form.vue';
import orgForm from './org-form.vue'; import orgForm from './org-form.vue';
import CryptoJS from "crypto-js"; import CryptoJS from "crypto-js";
import { downloadFileFormatNew } from '@/services/helper' import { downloadFileFormatNew } from '@/services/helper'
import store from '@/store'
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy const { $axios,$message } = proxy
...@@ -428,6 +429,9 @@ import { downloadFileFormatNew } from '@/services/helper' ...@@ -428,6 +429,9 @@ import { downloadFileFormatNew } from '@/services/helper'
confirm_password: '', confirm_password: '',
}) })
const search = ref('') const search = ref('')
const userInfo = computed(() => {
return store.state.userInfo
})
const validatePass = (rule, value, callback) => { const validatePass = (rule, value, callback) => {
if (value !== passwordForm.password) { if (value !== passwordForm.password) {
callback(new Error("密码输入不一致")) callback(new Error("密码输入不一致"))
...@@ -696,10 +700,16 @@ import { downloadFileFormatNew } from '@/services/helper' ...@@ -696,10 +700,16 @@ import { downloadFileFormatNew } from '@/services/helper'
.then((res) => { .then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
tableRows.value = (res.data.data.org_users.data || []).map(item => { tableRows.value = (res.data.data.org_users.data || []).map(item => {
item.system_role = item.system_role ? item.system_role.join('') : '-';
item.system_role = item.system_role ? item.system_role.join('') : '';
return item; return item;
}); });
tableRows.value.forEach(e => {
if (e.is_admin == 4 && userInfo.value.is_admin != 4) {
e.canSelect = 1
}else {
e.canSelect = 0
}
})
tableTotal.value = res.data.data.org_users.total; tableTotal.value = res.data.data.org_users.total;
if(params.data_type === 1) { if(params.data_type === 1) {
baseInfo[0].value = res.data.data.org_info.organization_type; baseInfo[0].value = res.data.data.org_info.organization_type;
...@@ -735,6 +745,9 @@ import { downloadFileFormatNew } from '@/services/helper' ...@@ -735,6 +745,9 @@ import { downloadFileFormatNew } from '@/services/helper'
} }
const stateChange = (row) => { const stateChange = (row) => {
if (row.is_admin== 4) {
return
}
const state = row.state.toString(); const state = row.state.toString();
$axios.post( $axios.post(
`/apaas/system/v5/user/state/${row.id}/${state}`, `/apaas/system/v5/user/state/${row.id}/${state}`,
......
...@@ -183,7 +183,12 @@ const continueCreate = () => { ...@@ -183,7 +183,12 @@ const continueCreate = () => {
} }
//取消 //取消
const cancel = () => { const cancel = () => {
router.go(-1); router.push({
path: "/system/organization",
query: {
id: route.query.orgId
}
})
} }
const getDetail = () => { const getDetail = () => {
$axios.get(`/apaas/system/v5/org/user/${route.query.id}`) $axios.get(`/apaas/system/v5/org/user/${route.query.id}`)
......
...@@ -216,6 +216,7 @@ const getDetail = () => { ...@@ -216,6 +216,7 @@ const getDetail = () => {
.then((res) => { .then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
const form = res.data.data; const form = res.data.data;
console.log(form)
platformAccountFormRef.value.setForm({ platformAccountFormRef.value.setForm({
logo: form.logo ? [{url:form.logo}] : [], logo: form.logo ? [{url:form.logo}] : [],
system_account: form.system_account, system_account: form.system_account,
...@@ -224,6 +225,7 @@ const getDetail = () => { ...@@ -224,6 +225,7 @@ const getDetail = () => {
contact_name: form.contact_name, contact_name: form.contact_name,
contact_email: form.contact_email, contact_email: form.contact_email,
remark: form.remark, remark: form.remark,
select_role: form.select_role
}) })
}else { }else {
$message.error(res.data.data) $message.error(res.data.data)
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<el-form-item v-if="!formType" label="确认密码" prop="confirm_password"> <el-form-item v-if="!formType" label="确认密码" prop="confirm_password">
<el-input type="password" v-model="platformAccountForm.confirm_password" /> <el-input type="password" v-model="platformAccountForm.confirm_password" />
</el-form-item> </el-form-item>
<el-form-item v-if="!formType" label="角色授权" prop="select_role"> <el-form-item label="角色授权" prop="select_role">
<el-select v-model="platformAccountForm.select_role" multiple placeholder="请选择角色" style="width: 100%"> <el-select v-model="platformAccountForm.select_role" multiple placeholder="请选择角色" style="width: 100%">
<el-option <el-option
v-for="item in roleList" v-for="item in roleList"
...@@ -159,8 +159,6 @@ const platformAccountFormRules = reactive({ ...@@ -159,8 +159,6 @@ const platformAccountFormRules = reactive({
const roleList = ref([]) const roleList = ref([])
const platformAccountRef = ref(null) const platformAccountRef = ref(null)
const emit = defineEmits(['action']) const emit = defineEmits(['action'])
......
...@@ -35,9 +35,10 @@ ...@@ -35,9 +35,10 @@
</el-tree> </el-tree>
<Teleport to="body"> <Teleport to="body">
<div <div
ref="treeActionRef"
class="tree-action" class="tree-action"
v-show="actionFlag" v-show="actionFlag"
:style="{ top: acTop, left: acLeft }" :style="{ top: acTop, left: acLeft, bottom:acBottom }"
> >
<!-- 平台用户组织 --> <!-- 平台用户组织 -->
<div v-if="selectData && selectData.data_type === 2" class="action" @click="treeAction({type: 'directory',action: 'create',target: null})">新建目录</div> <div v-if="selectData && selectData.data_type === 2" class="action" @click="treeAction({type: 'directory',action: 'create',target: null})">新建目录</div>
...@@ -65,23 +66,35 @@ ...@@ -65,23 +66,35 @@
import { reactive, toRefs, ref } from '@vue/reactivity' import { reactive, toRefs, ref } from '@vue/reactivity'
import { getCurrentInstance, watch, nextTick} from 'vue' import { getCurrentInstance, watch, nextTick} from 'vue'
import { computed, onBeforeMount, onBeforeUnmount } from '@vue/runtime-core' import { computed, onBeforeMount, onBeforeUnmount } from '@vue/runtime-core'
import { useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
const route = useRoute()
const { proxy } = getCurrentInstance() const { proxy } = getCurrentInstance()
const { $axios,$message } = proxy const { $axios,$message } = proxy
const acTop = ref(0); const acTop = ref('');
const acLeft = ref(0); const acLeft = ref('');
const acBottom = ref('')
const actionFlag = ref(false) const actionFlag = ref(false)
const selectData = ref(null) const selectData = ref(null)
const selectDataParent = ref(null) const selectDataParent = ref(null)
const mvDataParent = ref([]) const mvDataParent = ref([])
const treeRef = ref(null) const treeRef = ref(null)
const treeActionRef = ref(null)
const bottomGap = ref(30) //弹窗吸底高度
const orgData = ref([]) const orgData = ref([])
const selectNodeObj = ref(null)
const customNodeClass = (data,node) => {
if (data.data_type == 0) {
return 'noFocus'
}else {
return ''
}
}
const defaultProps = { const defaultProps = {
label: 'name', label: 'name',
children: 'Child', children: 'Child',
value: 'organization_id' value: 'organization_id',
class: customNodeClass,
} }
const getOrgTree = (data) => { const getOrgTree = (data) => {
...@@ -89,6 +102,11 @@ import { useRouter } from 'vue-router'; ...@@ -89,6 +102,11 @@ import { useRouter } from 'vue-router';
.then((res) => { .then((res) => {
if (res.data.code == 200) { if (res.data.code == 200) {
orgData.value = res.data.data || []; orgData.value = res.data.data || [];
console.log(route.query.id)
if (route.query.id) {
searchItem(orgData.value,route.query.id)
data = selectNodeObj.value
}
if(data) { if(data) {
nextTick(() =>{ nextTick(() =>{
setCurrentNode(data) setCurrentNode(data)
...@@ -106,7 +124,17 @@ import { useRouter } from 'vue-router'; ...@@ -106,7 +124,17 @@ import { useRouter } from 'vue-router';
}) })
} }
const searchItem = (data,id) => {
data.forEach(e => {
if (e.organization_id == id) {
selectNodeObj.value = e
}else {
if (e.Child) {
searchItem(e.Child,id)
}
}
})
}
const filterTree =(val) => { const filterTree =(val) => {
treeRef.value.filter(val) treeRef.value.filter(val)
} }
...@@ -132,13 +160,32 @@ import { useRouter } from 'vue-router'; ...@@ -132,13 +160,32 @@ import { useRouter } from 'vue-router';
} }
const showAction = (e, data,node) => { const showAction = (e, data,node) => {
const rect = e.target.getBoundingClientRect(); //获取点击的dom的位置 acTop.value = ''
acTop.value = rect.y - 17 + "px"; acLeft.value = ''
acLeft.value = rect.x + 35 + "px"; acBottom.value = ''
var allHeight = document.body.scrollHeight
actionFlag.value = true; actionFlag.value = true;
selectData.value = data; selectData.value = data;
selectDataParent.value = node.parent.data.name ? node.parent.data : null; selectDataParent.value = node.parent.data.name ? node.parent.data : null;
mvDataParent.value = node.parent.data.Child ? node.parent.data.Child : node.parent.data; mvDataParent.value = node.parent.data.Child ? node.parent.data.Child : node.parent.data;
const rect = e.target.getBoundingClientRect(); //获取点击的dom的位置
nextTick().then(()=>{
setTimeout(()=>{
var height = window.getComputedStyle(treeActionRef.value).height
height = parseInt(height)
//判断弹窗位置是否超过屏幕,超过则吸底展示
if(height+rect.y - 17>allHeight-bottomGap.value){
console.log(123)
acBottom.value = bottomGap.value+ "px";
acLeft.value = rect.x + 35 + "px";
}else{
acTop.value = rect.y - 17 + "px";
acLeft.value = rect.x + 35 + "px";
}
})
})
// acTop.value = rect.y - 17 + "px";
// acLeft.value = rect.x + 35 + "px";
}; };
const isSticky = (data) => { const isSticky = (data) => {
...@@ -157,8 +204,14 @@ import { useRouter } from 'vue-router'; ...@@ -157,8 +204,14 @@ import { useRouter } from 'vue-router';
const emit = defineEmits(['action','select']) const emit = defineEmits(['action','select'])
const handleNodeClick = (node,nodeAttr,treeNode,event) => { const handleNodeClick = (node,nodeAttr,treeNode,event) => {
if (node.data_type !== 0) {
selectData.value = node; selectData.value = node;
emit('select',{data: selectData,type: 'click'}); emit('select',{data: selectData,type: 'click'});
}else {
nextTick(() => {
treeRef.value.setCurrentKey(null)
})
}
//只读则无操作事件 //只读则无操作事件
closeAction(); closeAction();
} }
...@@ -347,4 +400,7 @@ import { useRouter } from 'vue-router'; ...@@ -347,4 +400,7 @@ import { useRouter } from 'vue-router';
color: #616f94; color: #616f94;
} }
.file-tree :deep().noFocus:focus>.el-tree-node__content {
background-color: #fff;
}
</style> </style>
\ No newline at end of file
...@@ -306,7 +306,7 @@ const getRoleRows = () => { ...@@ -306,7 +306,7 @@ const getRoleRows = () => {
state.tableRows = res.data.data || [] state.tableRows = res.data.data || []
state.tableTotal = res.data.total state.tableTotal = res.data.total
}else { }else {
ElMessage.error(re.data.data) ElMessage.error(res.data.data)
} }
}) })
} // 获取角色列表 } // 获取角色列表
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment