clay : 用户信息回显完成 #29

Merged
clay merged 1 commits from master into pro 2023-02-26 17:43:27 +00:00
9 changed files with 236 additions and 60 deletions
Showing only changes of commit 4be0068978 - Show all commits

View File

@ -10,8 +10,8 @@ Vue.prototype.$axios = axios;
// 字体图标 // 字体图标
export function getBaseUrl(){ export function getBaseUrl(){
return "http://gateway.mytwins.top" // return "http://gateway.mytwins.top"
// return "http://localhost:8000" return "http://localhost:8000"
} }
const service = axios.create({ const service = axios.create({

View File

@ -0,0 +1,94 @@
<template>
<div :class="{'line': row === 1, 'lines': row > 1}"
:title="hoverTip ? content: null"
:style="{'--row':row}">
<slot name="pre"></slot>
<div style="display: flex;">
<div v-for="(user,index) in userInfo" :key="index">
<div>
<el-avatar style="margin-right: 5px;" size="large"
:src="user.avatar"></el-avatar>
<div v-if="user.icon"
class="el-timeline-item__node" :style="{
backgroundColor: user.color
}">
<i v-if="user.icon"
class="el-timeline-item__icon"
:class="user.icon"
></i>
</div>
</div>
<div>{{user.name}}</div>
</div>
</div>
</div>
</template>
<script>
export default {
name: "AvatarEllipsis",
install(Vue){
Vue.component('avatarEllipsis', this)
},
components: {},
props:{
row: {
type: Number,
default: 1
},
hoverTip:{
type: Boolean,
default: false
},
userInfo:{
type: Array,
default: []
}
},
created() {
this.init()
},
data() {
return {}
},
methods: {
init(){
for (let user of this.userInfo) {
this.initUser(user)
}
},
initUser(user) {
let state = user.state
//
if (state === 'create') {
this.$set(user, "icon", "el-icon-check")
this.$set(user, "color", "#0bbd87")
}
//
if (state === 'agree') {
this.$set(user, "icon", "el-icon-check")
this.$set(user, "color", "#0bbd87")
}
//
if (state === 'process') {
this.$set(user, "icon", "el-icon-loading")
this.$set(user, "color", "#f78f5f")
}
//
if (state === 'refuse') {
this.$set(user, "icon", "el-icon-close")
this.$set(user, "color", "#f56c6c")
}
if (state === 'pass'){
this.$set(user, "icon", "el-icon-more")
this.$set(user, "color", "#c0c4cc")
}
return user;
},
}
}
</script>
<style scoped>
</style>

View File

@ -12,13 +12,13 @@ import "@/assets/theme.less";
import "@/assets/global.css"; import "@/assets/global.css";
import "@/assets/iconfont/iconfont.css" import "@/assets/iconfont/iconfont.css"
import AvatarEllipsis from '@/components/common/AvatarEllipsis'
import Ellipsis from '@/components/common/Ellipsis' import Ellipsis from '@/components/common/Ellipsis'
import WDialog from '@/components/common/WDialog' import WDialog from '@/components/common/WDialog'
import Tip from '@/components/common/Tip' import Tip from '@/components/common/Tip'
import axios from "axios";
import {getBaseUrl} from "./api/request";
Vue.use(ElementUI); Vue.use(ElementUI);
Vue.use(AvatarEllipsis);
Vue.use(Ellipsis); Vue.use(Ellipsis);
Vue.use(WDialog); Vue.use(WDialog);
Vue.use(Tip); Vue.use(Tip);

View File

@ -74,6 +74,8 @@ export default {
</script> </script>
<style scoped> <style scoped>
p{
background-color: #fff;
}
</style> </style>

View File

@ -9,8 +9,18 @@
placement="top"> placement="top">
<el-card> <el-card>
<div style="display: flex;"> <div style="display: flex;">
<div> <div v-for="(user,index) in operation.userInfo" :key="index">
<el-avatar size="large" :src="operation.userInfo.avatar"></el-avatar> <el-avatar style="margin-right: 5px;" size="large"
:src="user.avatar"></el-avatar>
<div v-if="!$slots.dot && operation.userInfo.length > 1"
class="el-timeline-item__node" :style="{
backgroundColor: user.color
}">
<i v-if="user.icon"
class="el-timeline-item__icon"
:class="user.icon"
></i>
</div>
</div> </div>
<div style="margin-left: 10px;"> <div style="margin-left: 10px;">
<div style="color: #c0bebe">{{ operation.operationName }}</div> <div style="color: #c0bebe">{{ operation.operationName }}</div>
@ -67,46 +77,106 @@ export default {
}, },
data() { data() {
return { return {
timeline: {} timeline: {},
} }
}, },
created() { created() {
console.log(this.operationList)
this.init()
switch (this.state) { },
case '1': methods: {
this.timeline = { init() {
color: '#f78f5f', switch (this.state) {
icon: 'el-icon-more', case '1':
context: '审批进行中' this.timeline = {
color: '#f78f5f',
icon: 'el-icon-more',
context: '审批进行中'
}
break
case '2':
this.timeline = {
color: '#0bbd87',
icon: 'el-icon-check',
context: '审批通过'
}
break
case '3':
this.timeline = {
color: '#f56c6c',
icon: 'el-icon-close',
context: '审核已驳回'
}
break
case '4':
this.timeline = {
color: '#0bbd87',
icon: 'el-icon-check',
context: '审批通过'
}
break
default:
break
}
// let operationListNew = []
console.log(this.operationList.length, "sdjshjdhasjds")
for (let i = 0;i<this.operationList.length;i++) {
let operationNew = this.initOperationFun(this.operationList[i])
console.log(operationNew, "sdjshjdhasjds")
let userList = []
for (let user of operationNew.userInfo) {
let userNew = this.initUser(user)
userList.push(userNew)
} }
break console.log(userList, "userList")
case '2': operationNew.userInfo = userList
this.timeline = { // operationListNew.push(operationNew)
color: '#0bbd87', // this.operationList.push(operationNew)
icon: 'el-icon-check', this.operationList[i] = operationNew
context: '审批通过' }
console.log(this.operationList, "operationListNew")
},
//
getAttachmentList(attachments, image) {
let result = [];
for (let attachment of attachments) {
if (attachment.isImage === image) {
result.push(attachment)
} }
break }
case '3': return result;
this.timeline = { },
color: '#f56c6c', initUser(user) {
icon: 'el-icon-close', let state = user.state
context: '审核已驳回' //
} if (state === 'create') {
break this.$set(user, "icon", "el-icon-check")
case '4': this.$set(user, "color", "#0bbd87")
this.timeline = { }
color: '#0bbd87', //
icon: 'el-icon-check', if (state === 'agree') {
context: '审批通过' this.$set(user, "icon", "el-icon-check")
} this.$set(user, "color", "#0bbd87")
break }
default: //
break if (state === 'process') {
} this.$set(user, "icon", "el-icon-loading")
this.$set(user, "color", "#f78f5f")
for (let operation of this.operationList) { }
//
if (state === 'refuse') {
this.$set(user, "icon", "el-icon-close")
this.$set(user, "color", "#f56c6c")
}
if (state === 'pass'){
this.$set(user, "icon", "el-icon-more")
this.$set(user, "color", "#c0c4cc")
}
return user;
},
initOperationFun(operation) {
console.log("开始处理内容了")
let state = operation.state let state = operation.state
let type = operation.operation let type = operation.operation
// //
@ -121,6 +191,10 @@ export default {
this.$set(operation, "color", "#0bbd87") this.$set(operation, "color", "#0bbd87")
this.$set(operation, "remark", operation.userInfo.name + ' (已同意)') this.$set(operation, "remark", operation.userInfo.name + ' (已同意)')
} }
if (state === 'pass'){
this.$set(operation, "icon", "el-icon-more")
this.$set(operation, "color", "#c0c4cc")
}
// //
if (state === 'process') { if (state === 'process') {
this.$set(operation, "icon", "el-icon-loading") this.$set(operation, "icon", "el-icon-loading")
@ -151,18 +225,7 @@ export default {
this.$set(operation, "color", "#f56c6c") this.$set(operation, "color", "#f56c6c")
this.$set(operation, "remark", operation.userInfo.name + ' (拒绝)') this.$set(operation, "remark", operation.userInfo.name + ' (拒绝)')
} }
} return operation;
},
methods: {
//
getAttachmentList(attachments, image) {
let result = [];
for (let attachment of attachments) {
if (attachment.isImage === image) {
result.push(attachment)
}
}
return result;
}, },
} }
} }

View File

@ -1,7 +1,8 @@
<template> <template>
<node :title="config.name" :show-error="showError" :content="content" :error-info="errorInfo" <node :title="config.name" :show-error="showError" :content="content" :user-info="config.props.assignedUser" :error-info="errorInfo"
@selected="$emit('selected')" @delNode="$emit('delNode')" @insertNode="type => $emit('insertNode', type)" @selected="$emit('selected')" @delNode="$emit('delNode')" @insertNode="type => $emit('insertNode', type)"
placeholder="请设置审批人" :header-bgc="headerBgc" header-icon="el-icon-s-check"/> placeholder="请设置审批人" :header-bgc="headerBgc" header-icon="el-icon-s-check"/>
</template> </template>
<script> <script>

View File

@ -1,5 +1,5 @@
<template> <template>
<node :title="config.name" :show-error="showError" :content="content" :error-info="errorInfo" <node :title="config.name" :show-error="showError" :content="content" :error-info="errorInfo" :user-info="config.props.assignedUser"
@selected="$emit('selected')" @delNode="$emit('delNode')" @insertNode="type => $emit('insertNode', type)" @selected="$emit('selected')" @delNode="$emit('delNode')" @insertNode="type => $emit('insertNode', type)"
placeholder="请设置抄送人" :header-bgc="headerBgc" header-icon="el-icon-s-promotion"/> placeholder="请设置抄送人" :header-bgc="headerBgc" header-icon="el-icon-s-promotion"/>
</template> </template>

View File

@ -9,9 +9,20 @@
</div> </div>
<div class="node-body-content"> <div class="node-body-content">
<i :class="leftIcon" v-if="leftIcon"></i> <i :class="leftIcon" v-if="leftIcon"></i>
<span class="placeholder" v-if="(content || '').trim() === ''">{{placeholder}}</span> <template v-if="$store.state.diagramMode !== 'viewer'">
<ellipsis :row="3" :content="content" v-else/> <span class="placeholder" v-if="(content || '').trim() === ''">{{placeholder}}</span>
<i class="el-icon-arrow-right" v-if="$store.state.diagramMode !== 'viewer'" ></i> <ellipsis :row="3" :content="content" v-else/>
<i class="el-icon-arrow-right"></i>
</template>
<template v-else>
<template v-if="userInfo.length > 0">
<avatar-ellipsis :row="3" :user-info="userInfo"/>
</template>
<template v-else>
<span class="placeholder" v-if="(content || '').trim() === ''">{{placeholder}}</span>
<ellipsis :row="3" :content="content" v-else/>
</template>
</template>
</div> </div>
<div class="node-error" v-if="showError"> <div class="node-error" v-if="showError">
<el-tooltip effect="dark" :content="errorInfo" placement="top-start"> <el-tooltip effect="dark" :content="errorInfo" placement="top-start">
@ -56,6 +67,11 @@ export default {
type: String, type: String,
default: "" default: ""
}, },
//
userInfo: {
type: Array,
default: []
},
title:{ title:{
type: String, type: String,
default: "标题" default: "标题"

View File

@ -1,5 +1,5 @@
<template> <template>
<node title="发起人" :is-root="true" :content="content" <node title="发起人" :is-root="true" :content="content" :user-info="config.props.assignedUser"
@selected="$emit('selected')" @insertNode="type => $emit('insertNode', type)" @selected="$emit('selected')" @insertNode="type => $emit('insertNode', type)"
placeholder="所有人" :header-bgc="config.props.headerBgc" header-icon="el-icon-user-solid"/> placeholder="所有人" :header-bgc="config.props.headerBgc" header-icon="el-icon-user-solid"/>
</template> </template>