Commit e6e5a18d authored by xioln's avatar xioln

项目功能修改

parent 60cb809c
...@@ -8157,6 +8157,11 @@ ...@@ -8157,6 +8157,11 @@
"integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==", "integrity": "sha512-3j8wdDzYuWO3lM3Reg03MuQR957t287Rpcxp1njpEa8oDrikb+FwGdW3n+FELh/A6qib6yPit0j/pv9G/yeAqA==",
"dev": true "dev": true
}, },
"lodash.get": {
"version": "4.4.2",
"resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz",
"integrity": "sha512-z+Uw/vLuy6gQe8cfaFWD7p0wVv8fJl3mbzXh33RS+0oW2wvUqiRXiQ69gLWSLpgB5/6sU+r6BlQR0MBILadqTQ=="
},
"lodash.kebabcase": { "lodash.kebabcase": {
"version": "4.1.1", "version": "4.1.1",
"resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz", "resolved": "https://registry.npmjs.org/lodash.kebabcase/-/lodash.kebabcase-4.1.1.tgz",
...@@ -8175,6 +8180,11 @@ ...@@ -8175,6 +8180,11 @@
"integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=", "integrity": "sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4=",
"dev": true "dev": true
}, },
"lodash.set": {
"version": "4.3.2",
"resolved": "https://registry.npmjs.org/lodash.set/-/lodash.set-4.3.2.tgz",
"integrity": "sha512-4hNPN5jlm/N/HLMCO43v8BXKq9Z7QdAGc/VGrRD61w8gN9g/6jF9A4L1pbUgBLCffi0w9VsXfTOij5x8iTyFvg=="
},
"lodash.transform": { "lodash.transform": {
"version": "4.6.0", "version": "4.6.0",
"resolved": "https://registry.npmjs.org/lodash.transform/-/lodash.transform-4.6.0.tgz", "resolved": "https://registry.npmjs.org/lodash.transform/-/lodash.transform-4.6.0.tgz",
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
"crypto-js": "^4.0.0", "crypto-js": "^4.0.0",
"element-ui": "^2.15.6", "element-ui": "^2.15.6",
"js-cookie": "^2.2.1", "js-cookie": "^2.2.1",
"lodash.get": "^4.4.2",
"lodash.set": "^4.3.2",
"moment": "^2.29.1", "moment": "^2.29.1",
"pdfh5": "^1.4.2", "pdfh5": "^1.4.2",
"pdfjs-dist": "^2.5.207", "pdfjs-dist": "^2.5.207",
...@@ -69,4 +71,4 @@ ...@@ -69,4 +71,4 @@
"last 2 versions", "last 2 versions",
"not dead" "not dead"
] ]
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ module.exports = { ...@@ -9,7 +9,7 @@ module.exports = {
propList: ['*'], // 能转化为vw的属性列表 propList: ['*'], // 能转化为vw的属性列表
viewportUnit: 'vw', // 指定需要转换成的视窗单位,建议使用vw viewportUnit: 'vw', // 指定需要转换成的视窗单位,建议使用vw
fontViewportUnit: 'vw', // 字体使用的视口单位 fontViewportUnit: 'vw', // 字体使用的视口单位
selectorBlackList: ['.ignore-', '.hairlines'], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名 selectorBlackList: ['.ignore-', '.hairlines', 'keep-px'], // 指定不转换为视窗单位的类,可以自定义,可以无限添加,建议定义一至两个通用的类名
minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值 minPixelValue: 1, // 小于或等于`1px`不转换为视窗单位,你也可以设置为你想要的值
mediaQuery: false, // 允许在媒体查询中转换`px` mediaQuery: false, // 允许在媒体查询中转换`px`
replace: true, // 是否直接更换属性值,而不添加备用属性 replace: true, // 是否直接更换属性值,而不添加备用属性
......
// 测试环境 // 测试环境
// const VUE_APP_BASE_API = 'http://192.168.1.248:9100' // eslint-disable-line const VUE_APP_BASE_API = 'http://119.91.70.186:9002' // eslint-disable-line
// 开发环境 // 开发环境
const VUE_APP_BASE_API = '' // eslint-disable-line // const VUE_APP_BASE_API = '' // eslint-disable-line
// 供应商PC端地址&通飞PC端地址 // 供应商PC端地址&通飞PC端地址
// 生产 // 生产
// const SUPPLIER_BASE_IP = 'http://10.19.5.12:9300/#/home' // eslint-disable-line // const SUPPLIER_BASE_IP = 'http://10.19.5.12:9300/#/home' // eslint-disable-line
......
...@@ -2,34 +2,40 @@ ...@@ -2,34 +2,40 @@
<div id="app"> <div id="app">
<!-- <router-view class="main"></router-view> --> <!-- <router-view class="main"></router-view> -->
<keep-alive> <keep-alive>
<router-view v-if="$route.meta.keepAlive" class="main"></router-view> <router-view
v-if="$route.meta.keepAlive"
class="main"
></router-view>
</keep-alive> </keep-alive>
<router-view v-if="!$route.meta.keepAlive" class="main"></router-view> <router-view
<tabbar v-if="$route.path!=='/login'"/> v-if="!$route.meta.keepAlive"
class="main"
></router-view>
<tabbar v-if="$route.path!=='/login'" />
</div> </div>
</template> </template>
<script> <script>
import configure from '@/mixins/configure.js' // import configure from '@/mixins/configure.js'
import Tabbar from '@/views/tabbar/index.vue' import Tabbar from '@/views/tabbar/index.vue'
export default { export default {
name: 'app', name: 'app',
components: { Tabbar }, components: { Tabbar },
mixins: [configure], // mixins: [configure],
// 数据源 给组件分发数据用 // 数据源 给组件分发数据用
data () { data() {
return { return {
title: '登录', title: '登录',
transitionName: 'fade' transitionName: 'fade'
} }
}, },
mounted () { mounted() {
this.title = this.$route.name this.title = this.$route.name
}, },
// 基于路由变化的动态 设置路由切换动画 // 基于路由变化的动态 设置路由切换动画
watch: { watch: {
$route (to, from) { $route(to, from) {
// 仅登录时导航不显示返回按钮 其他都显示 // 仅登录时导航不显示返回按钮 其他都显示
this.title = to.name this.title = to.name
// 网页标题更改 // 网页标题更改
......
import { get, post } from '../utils/http' import { get, post } from '../utils/http'
import { setSearchParams } from '@/utils/util'
// import store from '../store' // import store from '../store'
export function getUserReceiveItem(params) { export function getUserReceiveItem(params) {
...@@ -28,3 +30,39 @@ export function getStatistics(params) { ...@@ -28,3 +30,39 @@ export function getStatistics(params) {
export function getInstStatistics(params) { export function getInstStatistics(params) {
return post('/workflow/inst/statistics', params) return post('/workflow/inst/statistics', params)
} }
// 获取待办任务列表
export function getUnfinishedTask(params) {
if (typeof (params) === 'string') {
return get(`/workflow/task/todo?${params}`)
} else {
return get('/workflow/task/todo', params)
}
}
// 获取已办任务列表
export function getFinishedTask(params) {
return get('/workflow/task/finished', params)
}
// 获取我发起的任务
export function getWFInsts(params) {
return post('/workflow/inst', params)
}
export function getDictListByCode(code, parentKey, attr) {
const params = {
searchParams: { dictState: 'ENABLE' },
sort: { dictSeq: 'asc' }
}
params.searchParams.dictCode = code
if (parentKey !== 'default') {
params.searchParams[attr] = parentKey
}
return post('/DictData/search', setSearchParams(params))
}
// 查询我的消息
export function searchMsg(params) {
return post('/Notify/searchNotify', params, true)
}
...@@ -36,9 +36,9 @@ export function isDisplayTopImport() { ...@@ -36,9 +36,9 @@ export function isDisplayTopImport() {
return get(`${store.state.user.urlBaseApi}/extRest/common/isDisplayTopImport`) return get(`${store.state.user.urlBaseApi}/extRest/common/isDisplayTopImport`)
} }
export function current() { // export function current() {
return get(`/api/users/current`) // return get(`/api/users/current`)
} // }
export function extUserPwd(parmas) { export function extUserPwd(parmas) {
return post(`${store.state.user.urlBaseApi}/extRest/extUserPwd/change`, parmas) return post(`${store.state.user.urlBaseApi}/extRest/extUserPwd/change`, parmas)
......
<template> <template>
<div class="form"> <div class="form">
<van-form v-model="form" ref="form" v-on="$listeners" @submit="onSubmit"> <van-form
v-model="form"
ref="form"
v-on="$listeners"
@submit="onSubmit"
>
<template v-if="formData.length"> <template v-if="formData.length">
<div v-for="(item, index) in formData" :key="index"> <div
<div v-if="item.title" class="van-cell van-field sub-title"> v-for="(item, index) in formData"
:key="index"
>
<div
v-if="item.title"
class="van-cell van-field sub-title"
>
{{ item.title }} {{ item.title }}
</div> </div>
<!-- <div v-if="item?.component && item?.component?.name === 'vanTitle'" class="sub-title">{{item?.component.label}}</div> --> <!-- <div v-if="item?.component && item?.component?.name === 'vanTitle'" class="sub-title">{{item?.component.label}}</div> -->
<template v-if="item.data && item.data.length"> <template v-if="item.data && item.data.length">
<div v-for="(formItem, itemIndex) in item.data" :key="itemIndex"> <div
v-for="(formItem, itemIndex) in item.data"
:key="itemIndex"
>
<van-field <van-field
v-if=" v-if="
formItem.component && formItem.component.name === 'custom' formItem.component && formItem.component.name === 'custom'
...@@ -57,31 +71,31 @@ export default { ...@@ -57,31 +71,31 @@ export default {
}, },
rules: { rules: {
type: Object, type: Object,
default: () => {} default: () => { }
} }
}, },
components: {}, components: {},
// 数据源 给组件分发数据用 // 数据源 给组件分发数据用
data () { data() {
return {} return {}
}, },
created () { created() {
}, },
mounted () {}, mounted() { },
watch: { watch: {
formData: { formData: {
deep: true, deep: true,
immediate: true, immediate: true,
handler (oldVal, newVal) { handler(oldVal, newVal) {
this.init() this.init()
} }
} }
}, },
methods: { methods: {
handleSubmit (params) { handleSubmit(params) {
this.$emit('handleSubmit', params) this.$emit('handleSubmit', params)
}, },
init () { init() {
if (this.formData.length) { if (this.formData.length) {
// 获取表单 // 获取表单
let formItemData = [] let formItemData = []
...@@ -126,6 +140,10 @@ export default { ...@@ -126,6 +140,10 @@ export default {
Vue.component(item?.component?.name, (resolve) => { Vue.component(item?.component?.name, (resolve) => {
require(['./vanCheckboxContent.vue'], resolve) require(['./vanCheckboxContent.vue'], resolve)
}) })
} else if (item?.component?.name === 'el-selectDate') {
Vue.component(item?.component?.name, (resolve) => {
require(['./vanSelectDate.vue'], resolve)
})
} else if (item?.component?.name === 'customTable') { } else if (item?.component?.name === 'customTable') {
Vue.component(item?.component?.name, (resolve) => { Vue.component(item?.component?.name, (resolve) => {
require(['./vanList.vue'], resolve) require(['./vanList.vue'], resolve)
...@@ -140,14 +158,14 @@ export default { ...@@ -140,14 +158,14 @@ export default {
} }
}, },
// 表单校验 // 表单校验
validate () { validate() {
return this.$refs.form.validate() return this.$refs.form.validate()
}, },
// 提交表单 // 提交表单
submit () { submit() {
this.$refs.form.submit() this.$refs.form.submit()
}, },
onSubmit (values) { onSubmit(values) {
console.log('submit', values) console.log('submit', values)
} }
} }
...@@ -187,5 +205,12 @@ export default { ...@@ -187,5 +205,12 @@ export default {
.van-cell__title.van-field__label { .van-cell__title.van-field__label {
font-size: 14px; font-size: 14px;
} }
.van-cell::after {
border-bottom: none !important;
}
.van-hairline--top-bottom::after,
.van-hairline-unset--top-bottom::after {
border-width: 0;
}
} }
</style> </style>
<template> <template>
<div v-if="itemObj" class="select-input"> <div
<van-field v-if="itemObj"
v-model="selectLabel" class="select-input"
readonly >
clickable <van-field
:name="name" v-model="selectLabel"
:label="label" readonly
@click="showPicker = true" clickable
:name="name"
:label="label"
@click="showPicker = true"
/>
<van-popup
v-model="showPicker"
position="bottom"
>
<van-picker
v-show="showPicker"
show-toolbar
value-key="label"
:columns="getOptions()"
@confirm="onConfirm"
@cancel="showPicker = false"
/> />
<van-picker </van-popup>
v-show="showPicker"
show-toolbar
value-key="label"
:columns="getOptions()"
@confirm="onConfirm"
@cancel="showPicker = false"
/>
</div> </div>
</template> </template>
<script> <script>
...@@ -46,7 +54,7 @@ export default { ...@@ -46,7 +54,7 @@ export default {
components: { components: {
}, },
// 数据源 给组件分发数据用 // 数据源 给组件分发数据用
data () { data() {
return { return {
selectValue: this.value, selectValue: this.value,
showPicker: false, showPicker: false,
...@@ -54,26 +62,26 @@ export default { ...@@ -54,26 +62,26 @@ export default {
multipleVal: [] multipleVal: []
} }
}, },
mounted () { mounted() {
}, },
watch: { watch: {
value: { value: {
immediate: true, immediate: true,
deep: true, deep: true,
handler (val) { handler(val) {
this.selectValue = val this.selectValue = val
} }
}, },
selectValue: { selectValue: {
deep: true, deep: true,
handler (val) { handler(val) {
this.$emit('input', val) this.$emit('input', val)
} }
} }
}, },
computed: { computed: {
selectLabel: { selectLabel: {
get () { get() {
let label = '' let label = ''
if (this.selectValue instanceof Array) { if (this.selectValue instanceof Array) {
label = this.itemObj.options && this.itemObj.options.filter(item => { label = this.itemObj.options && this.itemObj.options.filter(item => {
...@@ -84,10 +92,10 @@ export default { ...@@ -84,10 +92,10 @@ export default {
} }
return label return label
}, },
set () {} set() { }
}, },
multipleLable: { multipleLable: {
get () { get() {
let label = '' let label = ''
if (this.selectValue instanceof Array) { if (this.selectValue instanceof Array) {
label = this.itemObj.options && this.itemObj.options.filter(item => { label = this.itemObj.options && this.itemObj.options.filter(item => {
...@@ -96,11 +104,11 @@ export default { ...@@ -96,11 +104,11 @@ export default {
} }
return label return label
}, },
set () {} set() { }
} }
}, },
methods: { methods: {
onConfirm (value) { onConfirm(value) {
if (this.itemObj.multiple) { if (this.itemObj.multiple) {
if (value.value) { if (value.value) {
this.selectValue = [value.value] this.selectValue = [value.value]
...@@ -112,7 +120,7 @@ export default { ...@@ -112,7 +120,7 @@ export default {
} }
this.showPicker = false this.showPicker = false
}, },
getOptions () { getOptions() {
return this.itemObj.options || [] return this.itemObj.options || []
} }
} }
......
<template>
<div
v-if="itemObj"
class="select-date"
>
<van-cell-group border>
<van-cell
is-link
title="日期"
:value="date"
@click="show = true"
center
/>
</van-cell-group>
<van-calendar
v-model="show"
type="range"
color="#4187f2"
:min-date="minDate"
:max-date="maxDate"
@confirm="onConfirm"
:allow-same-day="true"
/>
</div>
</template>
<script>
export default {
props: {
itemObj: {
type: Object,
default: () => null
},
value: {
type: [String, Array],
default: ''
},
name: {
type: String,
default: ''
},
label: {
type: String,
default: ''
},
form: {
type: Object,
require: true
}
},
components: {
},
// 数据源 给组件分发数据用
data() {
return {
date: null,
show: false,
minDate: new Date(2010, 0, 1),
maxDate: new Date(2050, 0, 31),
}
},
mounted() {
},
watch: {
},
computed: {
},
methods: {
onConfirm(val) {
const [start, end] = val;
this.date = `${this.formatDate(start)}${this.formatDate(end)}`;
this.$emit('input', this.date)
this.show = false
},
formatDate(date) {
return `${date.getFullYear()}-${this.addZero(date.getMonth() + 1)}-${date.getDate()}`;
},
addZero(num) {
return num < 10 ? '0' + num : num;
}
}
}
</script>
<style lang="scss" scoped>
.select-date {
box-sizing: border-box;
}
</style>
<template> <template>
<van-nav-bar class="headerNavBar" fixed :border="false" :left-arrow="$attrs.hasOwnProperty('left-arrow') ? $attrs['left-arrow'] : true" v-on="$listeners" v-bind="$attrs"> <van-nav-bar
class="headerNavBar"
fixed
:border="false"
:left-arrow="$attrs.hasOwnProperty('left-arrow') ? $attrs['left-arrow'] : true"
v-on="$listeners"
v-bind="$attrs"
>
<slot slot="left"></slot> <slot slot="left"></slot>
<slot slot="title"></slot> <slot slot="title"></slot>
<slot slot="right"></slot> <slot slot="right"></slot>
...@@ -12,26 +19,27 @@ export default { ...@@ -12,26 +19,27 @@ export default {
props: { props: {
}, },
components: {}, components: {},
data () { data() {
return { return {
} }
}, },
created () { created() {
}, },
mounted () { mounted() {
}, },
computed: { computed: {
}, },
methods: { methods: {
onClickLeft () {}, onClickLeft() { },
goHome () {} goHome() { }
} }
} }
</script> </script>
<style lang="scss"> <style lang="scss">
.headerNavBar, .van-nav-bar { .headerNavBar,
background: linear-gradient(197deg, #2AB1F4 0%, #3693E6 100%); .van-nav-bar {
background: linear-gradient(197deg, #2ab1f4 0%, #3693e6 100%);
line-height: 60px; line-height: 60px;
.van-icon { .van-icon {
color: #000; color: #000;
......
import { getConfigure, saveConfigure } from '../api/configure.js' import { getConfigure, saveConfigure } from '../api/configure.js'
import $store from '@/store' import $store from '@/store'
export default { export default {
data () { data() {
return { return {
Timer: null, Timer: null,
loading: false, loading: false,
...@@ -11,24 +11,24 @@ export default { ...@@ -11,24 +11,24 @@ export default {
} }
}, },
computed: { computed: {
configureFont () { configureFont() {
return this.$store.state.theme.fontSize return this.$store.state.theme.fontSize
}, },
configureCards () { configureCards() {
}, },
configureTags () { configureTags() {
return this.$store.state.tagsView.visitedViews return this.$store.state.tagsView.visitedViews
}, },
configureThemeName () { configureThemeName() {
return this.$store.state.theme.themeName return this.$store.state.theme.themeName
}, },
configureFamily () { configureFamily() {
return this.$store.state.theme.family return this.$store.state.theme.family
} }
}, },
watch: { watch: {
'$route.path' (path) { '$route.path'(path) {
if (path === '/login' || path === '/') { if (path === '/login' || path === '/') {
this.loading = false this.loading = false
this.loaded = false this.loaded = false
...@@ -43,7 +43,7 @@ export default { ...@@ -43,7 +43,7 @@ export default {
// configureThemeName () { // configureThemeName () {
// this.delayed('theme') // this.delayed('theme')
// }, // },
configureCards () { configureCards() {
this.delayed('card') this.delayed('card')
} }
// configureTags () { // configureTags () {
...@@ -53,7 +53,7 @@ export default { ...@@ -53,7 +53,7 @@ export default {
// this.delayed('family') // this.delayed('family')
// } // }
}, },
created () { created() {
if (this.$route.path !== '/login' && this.$route.path !== '/') { if (this.$route.path !== '/login' && this.$route.path !== '/') {
this.getConfigure() this.getConfigure()
} }
...@@ -63,7 +63,7 @@ export default { ...@@ -63,7 +63,7 @@ export default {
window.removeEventListener('beforeunload', this.uploadConfig) window.removeEventListener('beforeunload', this.uploadConfig)
}, },
methods: { methods: {
async getConfigure () { async getConfigure() {
if (this.loading || this.loaded) { if (this.loading || this.loaded) {
return return
} }
...@@ -81,7 +81,7 @@ export default { ...@@ -81,7 +81,7 @@ export default {
this.loading = false this.loading = false
}) })
}, },
handlerConfigure (items) { handlerConfigure(items) {
try { try {
var params = items.content var params = items.content
params = JSON.parse(params) params = JSON.parse(params)
...@@ -92,7 +92,7 @@ export default { ...@@ -92,7 +92,7 @@ export default {
console.log(err) console.log(err)
} }
}, },
writeConfigure (params) { writeConfigure(params) {
// theme // theme
this.$store.state.theme.fontSize = params.font this.$store.state.theme.fontSize = params.font
this.$store.state.theme.family = params.family || 'default-family' this.$store.state.theme.family = params.family || 'default-family'
...@@ -106,7 +106,7 @@ export default { ...@@ -106,7 +106,7 @@ export default {
// tags // tags
$store.dispatch('tagsView/addTags', params.tags) $store.dispatch('tagsView/addTags', params.tags)
}, },
saveConfigure () { saveConfigure() {
clearTimeout(this.Timer) clearTimeout(this.Timer)
this.Timer = null this.Timer = null
// 没有登入不保存 配置 // 没有登入不保存 配置
...@@ -117,13 +117,13 @@ export default { ...@@ -117,13 +117,13 @@ export default {
this.fixTagsList.forEach(item => { item = null }) this.fixTagsList.forEach(item => { item = null })
}) })
}, },
uploadConfig () { uploadConfig() {
if (this.Timer) { if (this.Timer) {
event.returnValue = '有配置没有保存' event.returnValue = '有配置没有保存'
this.saveConfigure() this.saveConfigure()
} }
}, },
fixTagsParams () { fixTagsParams() {
this.fixTagsList = [] this.fixTagsList = []
this.configureTags.forEach(item => { this.configureTags.forEach(item => {
const { fullPath, title, path, meta, query } = item const { fullPath, title, path, meta, query } = item
...@@ -135,7 +135,7 @@ export default { ...@@ -135,7 +135,7 @@ export default {
}) })
return this.fixTagsList return this.fixTagsList
}, },
getParams () { getParams() {
const a = { const a = {
cards: this.configureCards cards: this.configureCards
// tags: this.fixTagsParams(this.configureTags), // tags: this.fixTagsParams(this.configureTags),
...@@ -145,7 +145,7 @@ export default { ...@@ -145,7 +145,7 @@ export default {
} }
return JSON.stringify(a) return JSON.stringify(a)
}, },
delayed (type) { delayed(type) {
if (this.writeConfigFlag) { if (this.writeConfigFlag) {
return return
} }
......
import router from './router' import router from './router'
import { getToken } from './utils/auth' // get token from cookie import { getToken } from './utils/auth' // get token from cookie
import store from './store' import store from './store'
import { current } from './api/user/users'
import util from './utils/util.js' import util from './utils/util.js'
import Cookies from 'js-cookie' import Cookies from 'js-cookie'
import { setCookie, getCookie, delCookie } from './utils/cookies.js' import { setCookie, getCookie, delCookie } from './utils/cookies.js'
...@@ -10,11 +9,6 @@ let path = '' ...@@ -10,11 +9,6 @@ let path = ''
router.beforeEach(async (to, from, next) => { router.beforeEach(async (to, from, next) => {
const hasToken = getToken() const hasToken = getToken()
if (hasToken) { if (hasToken) {
if (to.path !== '/login') {
current().then(res => {
store.dispatch('tagsView/setOverflow')
})
}
if (!to.matched.length) { if (!to.matched.length) {
from.name ? next({ name: from.name }) : next('/home') from.name ? next({ name: from.name }) : next('/home')
} else { } else {
...@@ -53,7 +47,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -53,7 +47,7 @@ router.beforeEach(async (to, from, next) => {
} }
} }
}) })
function singleLogin (state) { function singleLogin(state) {
const params = {} const params = {}
console.log('util.getCookie', util.getCookie('url')) console.log('util.getCookie', util.getCookie('url'))
if (util.getCookie('url')) { if (util.getCookie('url')) {
......
...@@ -51,9 +51,9 @@ const routes = [ ...@@ -51,9 +51,9 @@ const routes = [
} }
}, },
{ {
path: '/EbomStructure', path: '/msgList',
name: 'EBOM结构', name: '消息',
component: () => import('@/views/EbomStructure/index.vue'), component: () => import('@/views/MsgList/index.vue'),
meta: { meta: {
keepAlive: true keepAlive: true
} }
...@@ -155,13 +155,13 @@ const createRouter = () => new VueRouter({ ...@@ -155,13 +155,13 @@ const createRouter = () => new VueRouter({
}) })
const router = createRouter() const router = createRouter()
export function resetRouter () { export function resetRouter() {
const newRouter = createRouter() const newRouter = createRouter()
router.matcher = newRouter.matcher // reset router router.matcher = newRouter.matcher // reset router
} }
const originalPush = VueRouter.prototype.push const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location, onResolve, onReject) { VueRouter.prototype.push = function push(location, onResolve, onReject) {
if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject) if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
return originalPush.call(this, location).catch(err => err) return originalPush.call(this, location).catch(err => err)
......
const getters = { const getters = {
token: (state) => state.user.token, token: (state) => state.user.token,
urlBaseApi: (state) => state.user.urlBaseApi urlBaseApi: (state) => state.user.urlBaseApi,
dictionaries: state => state.dictionaries.list || []
} }
export default getters export default getters
import { getDictListByCode } from '@/api/home'
import _get from 'lodash.get'
import _set from 'lodash.set'
const state = {
list: [],
dict: {},
loading: {}
}
const mutations = {
UPDATE_DICT: (state, dict) => {
state.list = []
state.list.push(...dict)
},
SET_DICT: (state, dict) => {
for (const a in dict) {
if (state.dict[a]) {
state.dict[a] = Object.assign(state.dict[a], dict[a])
} else {
state.dict[a] = dict[a]
}
}
}
}
const actions = {
updateDict({ commit }, dict) {
commit('UPDATE_DICT', dict)
},
getDictByCode({ commit, state }, { dictCode, isReset, parentCode, attr }) {
return new Promise(async (resolve, reject) => {
if (!isReset && _get(state.dict, `${dictCode}.${parentCode}`)) {
resolve(_get(state.dict, `${dictCode}.${parentCode}`))
return
}
// 正在加载同类字典项 等待
if (_get(state.loading, `${dictCode}.${parentCode}`)) {
let count = 0
const timer = setInterval(() => {
count++
if (_get(state.dict, `${dictCode}.${parentCode}`) || count > 1000) {
clearInterval(timer)
resolve(_get(state.dict, `${dictCode}.${parentCode}`) || [])
}
}, 100)
return
}
_set(state.loading, `${dictCode}.${parentCode}`, true)
await getDictListByCode(dictCode, parentCode, attr).then(async res => {
_set(state.loading, `${dictCode}.${parentCode}`, false)
if (!res || !res.items) {
return []
}
const list = res.items.content.map(row => {
return {
label: row.dictValue,
value: row.dictKey,
id: row.id,
parentId: row.parentId
}
})
const dict = {}
_set(dict, `${dictCode}.${parentCode}`, list)
commit('SET_DICT', dict)
resolve(list)
}).catch(() => {
_set(state.loading, `${dictCode}.${parentCode}`, false)
resolve([])
})
})
},
setDictList({ commit }, dict) {
commit('SET_DICT', dict)
}
}
export default {
namespaced: true,
state,
mutations,
actions
}
...@@ -55,7 +55,7 @@ const state = { ...@@ -55,7 +55,7 @@ const state = {
{ key: 'setParticipantWithRole', title: '签审人员' }, { key: 'setParticipantWithRole', title: '签审人员' },
{ key: 'templeteNumberWriteTable', title: '传阅' }, { key: 'templeteNumberWriteTable', title: '传阅' },
{ key: 'taskHistory', title: '签审历史' } { key: 'taskHistory', title: '签审历史' }
] ],
} }
export default { export default {
......
// import store from '../../store' // import store from '../../store'
import { Notify } from 'vant' import { Notify } from 'vant'
import { getToken, setToken } from '../../utils/auth' import { getToken, setToken, removeToken } from '../../utils/auth'
import { captchaLogin } from '../../api/user' import { captchaLogin } from '../../api/user'
import router, { resetRouter } from '../../router'
const state = { const state = {
token: getToken(), token: getToken(),
...@@ -45,38 +46,24 @@ const actions = { ...@@ -45,38 +46,24 @@ const actions = {
reject(error) reject(error)
}) })
}) })
},
logout({ commit }) {
return new Promise((resolve, reject) => {
commit('SET_TOKEN', '')
removeToken()
resetRouter()
Notify({ type: 'success', message: '已注销' })
router.push({ path: '/login' })
resolve()
})
},
resetToken({ commit }) {
return new Promise((resolve) => {
commit('SET_TOKEN', 'undefined')
removeToken()
resolve()
})
} }
// logout({ commit }) {
// return new Promise((resolve, reject) => {
// logout().then((response) => {
// commit('SET_TOKEN', '')
// removeToken()
// resetRouter()
// Notify({ type: 'success', message: '已注销' })
// router.push({ path: '/login' })
// resolve()
// }).catch((error) => {
// Notify({ type: 'danger', message: '注销失败,请联系系统管理员!' })
// reject(error)
// })
// })
// },
// resetToken({ commit }) {
// return new Promise((resolve) => {
// commit('SET_TOKEN', 'undefined')
// removeToken()
// resolve()
// })
// },
// loginCount() {
// loginCount()
// .then((res) => {
// console.log('loginCount', res)
// })
// .catch((e) => {
// console.log(e)
// })
// }
} }
export default { export default {
namespaced: true, namespaced: true,
......
...@@ -8,6 +8,8 @@ import { getToken } from './auth' ...@@ -8,6 +8,8 @@ import { getToken } from './auth'
axios.defaults.baseURL = VUE_APP_BASE_API || process.env.VUE_APP_BASE_API // eslint-disable-line axios.defaults.baseURL = VUE_APP_BASE_API || process.env.VUE_APP_BASE_API // eslint-disable-line
// axios.defaults.withCredentials = true // axios.defaults.withCredentials = true
axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8' axios.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded;charset=UTF-8'
axios.defaults.headers.post['Cache-Control'] = 'no-cache'
axios.defaults.timeout = process.env.NODE_ENV === 'development' ? 7200000 : 720000000
axios.interceptors.request.use( axios.interceptors.request.use(
(config) => { (config) => {
if (store.getters.token) { if (store.getters.token) {
...@@ -22,6 +24,19 @@ axios.interceptors.request.use( ...@@ -22,6 +24,19 @@ axios.interceptors.request.use(
config.headers.toValidateKeys = config.data.toValidateKeys config.headers.toValidateKeys = config.data.toValidateKeys
delete config.data.toValidateKeys delete config.data.toValidateKeys
} }
if (!config.headers['X-User-Action'] && config.data && config.data.userAction) {
config.headers['X-User-Action'] = 'user-action'
delete config.data.userAction
}
if (store.getters.token) {
config.headers.authorization = getToken()
config.headers['Dex-Token'] = getToken()
config.headers['Dex-Auth-Type'] = 'Token'
if (!getToken()) {
delete config.headers.authorization
delete config.headers['Dex-Token']
}
}
return config return config
}, },
(error) => { (error) => {
...@@ -64,7 +79,7 @@ axios.interceptors.response.use( ...@@ -64,7 +79,7 @@ axios.interceptors.response.use(
} }
) )
function get (url, params, responseType = null) { function get(url, params, responseType = null) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.get(url, { axios.get(url, {
params: Object.assign({ monmentDataTime: Date.parse(new Date()) }, params) params: Object.assign({ monmentDataTime: Date.parse(new Date()) }, params)
...@@ -81,7 +96,7 @@ function get (url, params, responseType = null) { ...@@ -81,7 +96,7 @@ function get (url, params, responseType = null) {
}) })
} }
function downloadFile (url, params = null) { function downloadFile(url, params = null) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios({ axios({
method: 'get', method: 'get',
...@@ -99,7 +114,7 @@ function downloadFile (url, params = null) { ...@@ -99,7 +114,7 @@ function downloadFile (url, params = null) {
}) })
} }
function downloadFilePost (url, params = null) { function downloadFilePost(url, params = null) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios({ axios({
method: 'post', method: 'post',
...@@ -117,19 +132,19 @@ function downloadFilePost (url, params = null) { ...@@ -117,19 +132,19 @@ function downloadFilePost (url, params = null) {
}) })
} }
function post (url, params, responseType = null) { function post(url, params, userAction = false) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.post(url, params, responseType) axios.post(url, params, userAction ? { headers: { 'X-User-Action': 'user-action' } } : null)
.then((res) => { .then(res => {
resolve(res.data) resolve(res.data)
}) })
.catch((err) => { .catch(err => {
reject(err.data) reject(err.data)
}) })
}) })
} }
function put (url, params) { function put(url, params) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.put(url, params) axios.put(url, params)
.then((res) => { .then((res) => {
...@@ -141,7 +156,7 @@ function put (url, params) { ...@@ -141,7 +156,7 @@ function put (url, params) {
}) })
} }
function del (url, params) { function del(url, params) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
axios.delete(url, { data: params }) axios.delete(url, { data: params })
.then((res) => { .then((res) => {
......
...@@ -463,4 +463,13 @@ export function showMessage(msg, type) { ...@@ -463,4 +463,13 @@ export function showMessage(msg, type) {
Notify({ type: t, message: msg }) Notify({ type: t, message: msg })
} }
// json数据转成query拼接
export function filterParams(params) {
const str = []
for (const attr in params) {
str.push(`${attr}=${params[attr]}`)
}
return str.join('&')
}
export default { getCookie, showMessage } export default { getCookie, showMessage }
<template>
<div class="pbomStructure">
<header-nav-bar
:title="title"
left-arrow
@click-left="onClickLeft"
/>
<div class="pbom-container">
<div
class="searchModel"
ref="searchModel"
>
<dee-form
class="searchForm"
:form="form"
:form-data="formData"
@handleSubmit="handleSubmit"
/>
<div class="searchButton">
<van-button
type="info"
size="small"
@click="search"
>查询</van-button>
<van-button
plain
hairline
type="info"
size="small"
@click="hiddenTop"
:icon="iconButton"
></van-button>
</div>
</div>
<div
ref="searchList"
class="search-list"
>
<van-list
v-model="loading"
:finished="finished"
finished-text="没有更多了"
@load="onLoad"
>
<div
class="taskItem"
v-for="item in list"
:key="item.oid"
@click="goDetailsInfo(item)"
>
<div class="itemTitle">
<!-- <van-image :src="require('@/assets/home/new@2x.png')" /> -->
<div
v-if="item.state === 1"
class="message-keep-px unread"
>
<span>未读</span>
</div>
<div
v-else
class="message-keep-px read"
>
<span>已读</span>
</div>
<span class="text">{{ item.title }}</span>
<span class="itemTitle-time">{{ item.sender }}</span>
</div>
<div class="content">
<span class="title"> {{ item.sendTime }} </span>
<div class="time">
<van-icon name="arrow" />
</div>
</div>
</div>
</van-list>
</div>
</div>
</div>
</template>
<script>
import HeaderNavBar from '../../components/headerNavBar/index.vue'
import DeeForm from '../../components/form/form'
import moment from 'moment'
import { searchMsg } from '@/api/home'
export default {
props: {},
components: { HeaderNavBar, DeeForm },
data() {
return {
iconButton: 'arrow-up',
form: {},
formData: [
{
data: [
{
title: '标题',
key: 'title',
component: {
name: 'el-input',
placeholder: '请输入标题',
clearable: true,
border: true
}
},
{
title: '状态',
key: 'state',
component: {
name: 'el-select',
placeholder: '请输入状态',
clearable: true,
// border: true,
options: [
{
label: '未读',
value: 1
},
{
label: '已读',
value: 0
}
]
}
},
{
title: '发送时间',
key: 'time',
component: {
name: 'el-selectDate',
placeholder: '请输入发送时间',
clearable: true,
border: true
}
}
]
}
],
list: [],
loading: false,
finished: false,
curr: 1,
date: null,
show: false,
}
},
created() {
},
mounted() { },
computed: {
title() {
return this.$route.query.title || ''
}
},
methods: {
onConfirm() { },
onClickLeft() {
history.back(-1)
},
search() {
this.list = []
this.curr = 1
this.loading = true
this.onLoad()
},
handleSubmit(params) {
this.form = Object.assign(this.form, params)
},
onLoad() {
const searchParams = {
'operator': 'AND',
'items': [
{
fieldName: 'receiver',
operator: 'EQ',
value: localStorage.getItem('userId')
},
// {
// fieldName: 'type',
// operator: 'EQ',
// value: 'MESSAGE'
// }
]
}
this.form.title && searchParams.items.push({
'fieldName': 'title',
'operator': 'LIKE',
'value': this.form.title
})
typeof this.form.state === 'number' && !isNaN(this.form.state) && searchParams.items.push({
'fieldName': 'state',
'operator': 'EQ',
'value': this.form.state
})
this.form.time && searchParams.items.push({
'fieldName': 'sendTime',
'operator': 'BTWN',
'value': this.form.time.split(' 至 ')[0] + ' 00:00:00',
'value1': this.form.time.split(' 至 ')[1] + ' 00:00:00'
})
const params = {
pageFrom: this.curr,
pageSize: 10,
'sortItem': [{ 'fieldName': 'sendTime', 'sortOrder': 'desc' }],
'searchItems': searchParams
}
searchMsg(params).then(res => {
const items = res.items
this.list = [...this.list, ...items.content];
this.loading = false
if (items.totalPages === this.curr || items.totalElements === 0) {
this.finished = true
}
this.curr++
})
},
hiddenTop() {
if (this.iconButton === 'arrow-down') {
this.$refs.searchModel.style.height = '90px'
this.$refs.searchModel.style.transitionDuration = '.5s'
this.$refs.searchList.style.height = 'calc(100vh - 260px)'
this.iconButton = 'arrow-up'
return
}
this.$refs.searchModel.style.height = '23px'
this.$refs.searchList.style.height = 'calc(100vh - 190px)'
this.$refs.searchModel.style.transitionDuration = '.5s'
this.iconButton = 'arrow-down'
},
}
}
</script>
<style lang="scss">
.pbomStructure {
overflow: hidden;
.pbom-container {
height: calc(100vh - 75px);
overflow: hidden;
}
.searchModel {
padding: 20% 0.625rem 1rem 0.625rem;
display: flex;
overflow: hidden;
.searchForm {
flex: 1;
}
.searchButton {
padding: 0 10px;
.van-button {
margin-right: 10px;
}
}
}
.van-input-select .van-cell__title {
width: 70px;
}
.search-list {
padding: 0 30px;
overflow-y: auto;
height: calc(100vh - 260px);
.taskItem {
font-size: 16px;
color: #000000;
box-sizing: border-box;
border-bottom: 1px solid #e1e1e1;
margin-top: 10px;
.itemTitle {
display: flex;
align-items: center;
.message-keep-px {
flex-shrink: 0;
width: 35px;
height: 15px;
font-size: 10px;
font-weight: 800;
display: inline-flex;
justify-content: center;
align-items: center;
border-radius: 10px;
}
.unread {
background-color: #de6e69; /* 未读状态背景色 */
color: #fdfdfd; /* 文字颜色 */
}
.read {
background-color: #aaaaaa; /* 已读状态背景色 */
color: #fff; /* 文字颜色 */
}
.van-image__img {
width: 30px;
height: 15px;
}
.text {
margin-left: 0.625rem;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.itemTitle-time {
text-align: right;
flex: auto;
margin-right: 10px;
font-size: 10px;
}
}
.content {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 12px;
color: #797979;
.title {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
flex: 30;
margin: 5px 0;
text-align: left;
}
.time {
flex: 2;
text-align: right;
margin-right: 10px;
}
}
}
}
}
</style>
\ No newline at end of file
...@@ -5,9 +5,17 @@ ...@@ -5,9 +5,17 @@
* @FilePath: src/views/home/components/loadTableCell.vue * @FilePath: src/views/home/components/loadTableCell.vue
*/ */
<template> <template>
<div class="load-table-cell" ref="loadTableCell"> <div
class="load-table-cell"
ref="loadTableCell"
>
<!-- <div class="load-table-cell" @scroll="isScrollBottom" ref="loadTableCell"> --> <!-- <div class="load-table-cell" @scroll="isScrollBottom" ref="loadTableCell"> -->
<van-loading v-if="showLoading" type="spinner" size="24px" vertical /> <van-loading
v-if="showLoading"
type="spinner"
size="24px"
vertical
/>
<div <div
class="taskItem" class="taskItem"
v-for="item in list" v-for="item in list"
...@@ -16,11 +24,11 @@ ...@@ -16,11 +24,11 @@
> >
<div class="itemTitle"> <div class="itemTitle">
<van-image :src="require('@/assets/home/new@2x.png')" /> <van-image :src="require('@/assets/home/new@2x.png')" />
<span class="text">{{ item.wiName }}</span> <span class="text">{{ item.title }}</span>
<span class="itemTitle-time">{{ item.wiCreaetime }}</span> <span class="itemTitle-time">{{ item.sender }}</span>
</div> </div>
<div class="content"> <div class="content">
<span class="title"> {{ item.pboInfo }}|{{ item.pboState }} </span> <span class="title"> {{ item.sendTime }} </span>
<div class="time"> <div class="time">
<van-icon name="arrow" /> <van-icon name="arrow" />
</div> </div>
...@@ -29,29 +37,28 @@ ...@@ -29,29 +37,28 @@
</div> </div>
</template> </template>
<script> <script>
import { getLatestTask } from '@/api/taskDetail' import { searchMsg } from '@/api/home'
export default { export default {
name: 'LoadTableCell', // name写在组件的最前方,自定义组件为必填 name: 'LoadTableCell', // name写在组件的最前方,自定义组件为必填
components: {}, components: {},
data () { data() {
return { return {
allList: [], allList: [],
list: [], list: [],
list1: [],
curr: 2, curr: 2,
prevY: 0, prevY: 0,
showLoading: true showLoading: true
} }
}, },
computed: {}, computed: {},
created () { created() {
// 初始化数据 // 初始化数据
this.getLatestTask() this.getLatestTask()
}, },
methods: { methods: {
// 跳转详情页面 // 跳转详情页面
goDetailsInfo (item) { goDetailsInfo(item) {
this.$router.push({ this.$router.push({
path: `/taskDetails-${item.oid}`, path: `/taskDetails-${item.oid}`,
query: { query: {
...@@ -61,23 +68,34 @@ export default { ...@@ -61,23 +68,34 @@ export default {
} }
}) })
}, },
getLatestTask () { getLatestTask() {
getLatestTask().then((res) => { const items = [
if (res.items) { {
// const todotitle = this.$store.state.list.TODOTITLE fieldName: 'receiver',
// const todolist = this.$store.state.list.TODOLIST operator: 'EQ',
// res.items = res.items.filter( value: localStorage.getItem('userId')
// (item) => },
// !todotitle.includes(item.classifyName) && {
// todolist.includes(item.subTypeName.split('___')[1]) fieldName: 'type',
// ) operator: 'EQ',
this.allList = res.items value: 'MESSAGE'
this.dealWithtaskData()
this.showLoading = false
} }
]
const params = {
pageFrom: 1,
pageSize: 10,
'sortItem': [{ 'fieldName': 'sendTime', 'sortOrder': 'desc' }],
searchItems: {
items: items,
operator: 'AND'
}
}
searchMsg(params).then(res => {
this.list = res.items.content
this.showLoading = false
}) })
}, },
dealWithtaskData () { dealWithtaskData() {
if (this.allList.length > 10 * this.curr) { if (this.allList.length > 10 * this.curr) {
this.list = this.allList.slice(0, 10 * this.curr) this.list = this.allList.slice(0, 10 * this.curr)
} else { } else {
...@@ -85,7 +103,7 @@ export default { ...@@ -85,7 +103,7 @@ export default {
} }
}, },
// 暂时不用 // 暂时不用
isScrollBottom () { isScrollBottom() {
// 是否滚动到了底部 // 是否滚动到了底部
this.box = this.$refs.loadTableCell this.box = this.$refs.loadTableCell
var clientHeight = this.box.clientHeight var clientHeight = this.box.clientHeight
...@@ -98,7 +116,7 @@ export default { ...@@ -98,7 +116,7 @@ export default {
} }
}, },
// 防抖 // 防抖
debounce (fn, delay = 50) { debounce(fn, delay = 50) {
let timer = 0 let timer = 0
return function () { return function () {
// 如果这个函数已经被触发了 // 如果这个函数已经被触发了
...@@ -110,7 +128,7 @@ export default { ...@@ -110,7 +128,7 @@ export default {
timer = 0 timer = 0
}, delay) }, delay)
} }
} },
} }
} }
</script> </script>
......
...@@ -2,8 +2,14 @@ ...@@ -2,8 +2,14 @@
<div class="home"> <div class="home">
<div class="header"> <div class="header">
<van-swipe :autoplay="3000"> <van-swipe :autoplay="3000">
<van-swipe-item v-for="(image, index) in images" :key="index"> <van-swipe-item
<img class="swipeImage" v-lazy="image" /> v-for="(image, index) in images"
:key="index"
>
<img
class="swipeImage"
v-lazy="image"
/>
</van-swipe-item> </van-swipe-item>
</van-swipe> </van-swipe>
<div class="logo"> <div class="logo">
...@@ -15,19 +21,36 @@ ...@@ -15,19 +21,36 @@
</div> </div>
</div> </div>
<!-- 快速入口 --> <!-- 快速入口 -->
<van-grid class="modelArr" :column-num="3" :border="false"> <van-grid
<van-grid-item v-for="item in modelArr" :key="item.key" :icon="item.icon" :text="item.title" class="modelArr"
:to="{ path: item.path, query: { title: `${item.title}任务` } }" /> :column-num="3"
:border="false"
>
<van-grid-item
v-for="item in modelArr"
:key="item.key"
:icon="item.icon"
:text="item.title"
:to="{ path: item.path, query: { title: `${item.title}任务` } }"
/>
</van-grid> </van-grid>
<div class="task"> <div class="task">
<van-notice-bar color="#3D3D3D" background="#FFF4F0" :left-icon="noticeIcon" @click="toNotice"> <van-notice-bar
color="#3D3D3D"
background="#FFF4F0"
:left-icon="noticeIcon"
@click="toNotice"
>
《5G移动端数字样机审查环境项目上线公告》 《5G移动端数字样机审查环境项目上线公告》
</van-notice-bar> </van-notice-bar>
<div class="taskList"> <div class="taskList">
<div class="taskTitle"> <div class="taskTitle">
<span>最新任务</span> <span>我的消息</span>
<span class="more" @click="goTodoList">更多 ></span> <span
class="more"
@click="goTodoList"
>更多 ></span>
</div> </div>
<div class="list"> <div class="list">
<Load-table-cell></Load-table-cell> <Load-table-cell></Load-table-cell>
...@@ -77,7 +100,7 @@ export default { ...@@ -77,7 +100,7 @@ export default {
loading: false, loading: false,
finished: false, finished: false,
refreshing: false, refreshing: false,
curr: 0 curr: 0,
} }
}, },
computed: {}, computed: {},
...@@ -111,9 +134,10 @@ export default { ...@@ -111,9 +134,10 @@ export default {
}, },
goTodoList() { goTodoList() {
this.$router.push({ this.$router.push({
path: '/taskSearch', path: '/msgList',
query: { query: {
title: '任务搜索' title: '消息',
key: 'msgList'
} }
}) })
}, },
......
...@@ -6,38 +6,70 @@ ...@@ -6,38 +6,70 @@
*/ */
<template> <template>
<div class="tabbar"> <div class="tabbar">
<van-tabbar class="menu" v-model="activeMenu" active-color="#1077CE" inactive-color="#6F7277"> <van-tabbar
<van-tabbar-item v-for="item in menu" :class="item.key" :key="item.key" :name="item.key" class="menu"
@click="changeMenu(item)"> v-model="activeMenu"
active-color="#1077CE"
inactive-color="#6F7277"
>
<van-tabbar-item
v-for="item in menu"
:class="item.key"
:key="item.key"
:name="item.key"
@click="changeMenu(item)"
>
<span>{{ item.title }}</span> <span>{{ item.title }}</span>
<template #icon="props"> <template #icon="props">
<img :src="props.active ? item.iconActive : item.iconInactive" /> <img :src="props.active ? item.iconActive : item.iconInactive" />
</template> </template>
</van-tabbar-item> </van-tabbar-item>
</van-tabbar> </van-tabbar>
<van-popup round v-if="actions.length !== 0" v-model="showPopover" position="bottom" closeable close-icon="close" <van-popup
:style="{ height: '35%' }" :get-container="getContainer" @close="closePopup()"> round
<van-cell-group inset v-for="component in actions" :key="component.text" :name="component.text"> v-if="actions.length !== 0"
<van-cell is-link @click="toDetail(component)"> v-model="showPopover"
position="bottom"
closeable
close-icon="close"
:style="{ height: '35%' }"
:get-container="getContainer"
@close="closePopup()"
>
<van-cell-group
inset
v-for="component in actions"
:key="component.text"
:name="component.text"
>
<van-cell
is-link
@click="toDetail(component)"
>
<template #title> <template #title>
<van-tag plain type="primary" size="large">{{ <van-tag
plain
type="primary"
size="large"
>{{
component.text component.text
}}</van-tag> }}</van-tag>
</template> </template>
</van-cell> </van-cell>
</van-cell-group> </van-cell-group>
</van-popup> </van-popup>
<ChangePassword ref="changePsw"></ChangePassword>
</div> </div>
</template> </template>
<script> <script>
import { Dialog } from 'vant' import { Dialog } from 'vant'
import ChangePassword from './changePassword.vue'
export default { export default {
name: 'Tabbar', // name写在组件的最前方,自定义组件为必填 name: 'Tabbar', // name写在组件的最前方,自定义组件为必填
components: { [Dialog.Component.name]: Dialog.Component }, components: { [Dialog.Component.name]: Dialog.Component, ChangePassword },
data() { data() {
return { return {
activeMenu: 'home', activeMenu: null,
showPopover: false, showPopover: false,
menu: [ menu: [
{ {
...@@ -55,12 +87,12 @@ export default { ...@@ -55,12 +87,12 @@ export default {
}, },
{ {
title: '消息', title: '消息',
key: 'design', key: 'msgList',
route: { route: {
path: '/EbomStructure', path: '/msgList',
query: { query: {
title: '消息', title: '消息',
key: 'design' key: 'msgList'
} }
}, },
iconActive: require('../../assets/home/menu/消息active.png'), iconActive: require('../../assets/home/menu/消息active.png'),
...@@ -75,26 +107,26 @@ export default { ...@@ -75,26 +107,26 @@ export default {
{ {
text: '更改密码', text: '更改密码',
route: { route: {
path: '/PbomStructure', path: 'changePsd',
query: { query: {
title: '更改密码', title: '更改密码',
key: 'craft' key: 'changePsd'
} }
} }
}, },
{ {
text: '退出登陆', text: '退出登陆',
route: { route: {
path: '/MbomStructure', path: '/login',
query: { query: {
title: '退出登陆', title: '退出登陆',
key: 'craft' key: 'quitLogin'
} }
} }
} }
] ]
} }
] ],
} }
}, },
computed: { computed: {
...@@ -103,8 +135,18 @@ export default { ...@@ -103,8 +135,18 @@ export default {
return action?.components ? action.components : [] return action?.components ? action.components : []
} }
}, },
watch: {
'$route.query.key': {
handler(val) {
this.activeMenu = val || 'home'
},
immediate: true
}
},
created() { created() {
}, },
mounted() {
},
methods: { methods: {
getContainer() { getContainer() {
return document.querySelector(this.activeMenu) return document.querySelector(this.activeMenu)
...@@ -116,6 +158,7 @@ export default { ...@@ -116,6 +158,7 @@ export default {
} }
}, },
changeMenu(item) { changeMenu(item) {
console.log('item', item)
if (item.route) { if (item.route) {
this.$router.push(item.route) this.$router.push(item.route)
} else { } else {
...@@ -124,7 +167,7 @@ export default { ...@@ -124,7 +167,7 @@ export default {
}, },
toDetail(component) { toDetail(component) {
this.showPopover = false this.showPopover = false
if (component.text === '退出') { if (component.text === '退出登陆') {
Dialog.confirm({ Dialog.confirm({
title: '是否退出?' title: '是否退出?'
}) })
...@@ -134,30 +177,13 @@ export default { ...@@ -134,30 +177,13 @@ export default {
.catch(() => { .catch(() => {
// on cancel // on cancel
}) })
} else if (component.text === '转PC版') { } else if (component.text === '更改密码') {
window.open(component.route.path) this.$refs.changePsw.show = true
} else if (component.text === '登录统计下载') {
const url = 'Windchill/extRest/extUserPwd/exportLoginCount'
const name = '登录统计.xlsx'
this.$utils.downLoad(url, name)
} else { } else {
this.$router.push(component.route) this.$router.push(component.route)
} }
} },
// isSupplierAccount () {
// isSupplierAccount({ account: this.loginForm.account }).then(res => {
// if (res.items) {
// this.loading = false
// this.$utils.showNotification(`当前登录账户[${this.loginForm.account}]为供应商账户,请访问供应商门户!`)
// } else {
// this.$store.dispatch('user/login', { form: this.loginForm }).then(x => {
// this.loading = false
// }).catch(e => {
// this.loading = false
// })
// }
// })
// }
} }
} }
</script> </script>
......
/** /**
* @Description: 滚动加载表格 * @Description: 滚动加载表格
* @author xioln * @author xioln
* @date 2022-07-03 * @date 2022-07-03
* @FilePath: src/views/home/components/todoListLazyCell.vue * @FilePath: src/views/home/components/todoListLazyCell.vue
*/ */
<template> <template>
<div <div class="todoList-lazyCell" @scroll="isScrollBottom" ref="todoListLazyCell">
class="todoList-lazyCell" <!-- <van-loading class="loading" v-if="loading" vertical /> -->
@scroll="isScrollBottom"
ref="todoListLazyCell"
>
<van-empty v-if="list.length === 0" description="数据为空" /> <van-empty v-if="list.length === 0" description="数据为空" />
<div <div class="taskItem" v-for="item in list" :key="item.id" @click="goDetailsInfo(item)">
class="taskItem"
v-for="item in list"
:key="item.oid"
@click="goDetailsInfo(item)"
>
<div class="itemTitle"> <div class="itemTitle">
{{ item.wiName }} {{ item.name }}
<span class="time"> <span class="time">
<span>{{ item.wiCreaetime }}</span> <span>{{ item.time }}</span>
<van-icon name="arrow" /> <van-icon name="arrow" />
</span> </span>
</div> </div>
<div class="content"> <div class="content">
<span class="title"> {{ item.pboInfo }}|{{ item.pboState }} </span> <span v-for="(attr, i) in item.showTitle" :key="`attr_${i}`">
{{ attr.title }}
</span>
</div> </div>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
export default { export default {
name: 'TodoListLazyCell', // name写在组件的最前方,自定义组件为必填 name: 'TodoListLazyCell', // name写在组件的最前方,自定义组件为必填
props: { props: {
allList: { allList: {
type: Array, type: Array,
require: true default: () => []
} }
}, },
components: {}, components: {
data () { },
data() {
return { return {
curr: 1,
list: [], list: [],
curr: 1 loading: false
} }
}, },
computed: {}, computed: {
created () {
},
created() {
// 初始化数据 // 初始化数据
this.dealWithtaskData() this.dealWithtaskData()
}, },
methods: { methods: {
// 跳转详情页面 // 跳转详情页面
goDetailsInfo (item) { goDetailsInfo(item) {
this.$router.push({ this.$router.push({
path: `/taskDetails-${item.oid}`, path: `/taskDetails-${item.oid}`,
query: { query: {
...@@ -64,14 +63,14 @@ export default { ...@@ -64,14 +63,14 @@ export default {
} }
}) })
}, },
dealWithtaskData () { dealWithtaskData() {
if (this.allList.length > 10 * this.curr) { if (this.allList.length > 10 * this.curr) {
this.list = this.allList.slice(0, 10 * this.curr) this.list = this.allList.slice(0, 10 * this.curr)
} else { } else {
this.list = this.allList.slice(0, this.allList.length) this.list = this.allList.slice(0, this.allList.length)
} }
}, },
isScrollBottom () { isScrollBottom() {
// 是否滚动到了底部 // 是否滚动到了底部
this.box = this.$refs.todoListLazyCell this.box = this.$refs.todoListLazyCell
var clientHeight = this.box.clientHeight var clientHeight = this.box.clientHeight
...@@ -84,7 +83,7 @@ export default { ...@@ -84,7 +83,7 @@ export default {
} }
}, },
// 防抖 // 防抖
debounce (fn, delay = 50) { debounce(fn, delay = 50) {
let timer = 0 let timer = 0
return function () { return function () {
// 如果这个函数已经被触发了 // 如果这个函数已经被触发了
...@@ -104,38 +103,45 @@ export default { ...@@ -104,38 +103,45 @@ export default {
.todoList-lazyCell { .todoList-lazyCell {
overflow: scroll; overflow: scroll;
max-height: calc(100vh - 200px); max-height: calc(100vh - 200px);
.taskItem { .taskItem {
font-size: 16px; font-size: 16px;
color: #000000; color: #000000;
box-sizing: border-box; box-sizing: border-box;
border-bottom: 1px solid #e1e1e1; border-bottom: 1px solid #e1e1e1;
margin-top: 10px; margin-top: 10px;
.itemTitle { .itemTitle {
text-align: left; text-align: left;
display: flex; display: flex;
align-items: center; align-items: center;
.van-image__img { .van-image__img {
width: 30px; width: 30px;
height: 15px; height: 15px;
} }
.text { .text {
margin-left: 0.625rem; margin-left: 0.625rem;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.time { .time {
text-align: right; text-align: right;
flex: auto; flex: auto;
margin-right: 10px; margin-right: 10px;
} }
} }
.content { .content {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
font-size: 12px; font-size: 12px;
color: #797979; color: #797979;
.title { .title {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
......
<template> <template>
<div class="todoList"> <div class="todoList">
<header-nav-bar :title="title" left-arrow @click-left="onClickLeft" /> <header-nav-bar
<van-loading v-if="showLoading" type="spinner" size="24px" vertical /> :title="title"
<div class="todoList-content" v-else> left-arrow
@click-left="onClickLeft"
/>
<van-loading
class="home-loading"
v-if="showLoading"
type="spinner"
size="24px"
vertical
/>
<div
class="todoList-content"
v-else
>
<!-- 任务列表 --> <!-- 任务列表 -->
<van-collapse v-model="name" accordion lazy-render="true" @change="tabChange"> <van-collapse
<van-collapse-item v-for="itemName in listName" :key="itemName.classifId" :name="itemName.classifId" v-model="name"
class="list" ref="listRef"> accordion
lazy-render="false"
@change="tabChange"
>
<van-collapse-item
v-for="itemName in listName"
:key="itemName.processDefKey"
:name="itemName.processDefKey + '+' + itemName.count"
class="list"
ref="listRef"
>
<template #title> <template #title>
<van-badge :content="itemName.count" color="rgb(54,149,231)"> <van-badge
:content="itemName.count"
color="rgb(54,149,231)"
>
<div class="child"> <div class="child">
<b class="textScroll"> <b class="textScroll">
<van-icon name="certificate" />&ensp;{{ <van-icon name="certificate" />
itemName.classifyName &ensp;
}}</b> {{ itemName.modelName }}
</b>
</div> </div>
</van-badge> </van-badge>
</template> </template>
<div class="lazy-list"> <div class="lazy-list">
<todo-list-lazy-cell :allList="list"></todo-list-lazy-cell> <van-loading
class="loading"
v-if="loading"
vertical
/>
<todo-list-lazy-cell
v-else
ref="lazyListRef"
:allList="listObj[itemName.processDefKey]"
></todo-list-lazy-cell>
</div> </div>
</van-collapse-item> </van-collapse-item>
</van-collapse> </van-collapse>
...@@ -27,8 +63,7 @@ ...@@ -27,8 +63,7 @@
</template> </template>
<script> <script>
import { getUserReceiveItem, getUserCreateProcess, getStatistics, getInstStatistics } from '@/api/home' import { getStatistics, getInstStatistics, getUnfinishedTask, getFinishedTask, getWFInsts } from '@/api/home'
import { getDoneTask } from '@/api/taskDetail'
import HeaderNavBar from '@/components/headerNavBar/index.vue' import HeaderNavBar from '@/components/headerNavBar/index.vue'
import TodoListLazyCell from '@/views/todoList/components/todoListLazyCell' import TodoListLazyCell from '@/views/todoList/components/todoListLazyCell'
...@@ -39,7 +74,19 @@ export default { ...@@ -39,7 +74,19 @@ export default {
list: [], list: [],
listName: [], listName: [],
name: '', name: '',
showLoading: true showLoading: true,
taskType: null,
classKey: null,
pagination: {
currentPage: 1,
pageSize: 10,
pageSizes: [5],
total: 10
},
stateDictName: 'ObjStatus',
dict: {},
listObj: {},
loading: false
} }
}, },
computed: { computed: {
...@@ -67,37 +114,47 @@ export default { ...@@ -67,37 +114,47 @@ export default {
this.showLoading = true this.showLoading = true
if (this.title.includes('待办')) { if (this.title.includes('待办')) {
this.getMyLaunchList() this.getMyLaunchList()
this.taskType = 'TODOTASK'
} else if (this.title.includes('已办')) { } else if (this.title.includes('已办')) {
this.getDoneTask() this.getDoneTask()
this.taskType = 'FINISHEDTASK'
} else if (this.title.includes('我发起')) { } else if (this.title.includes('我发起')) {
this.getTaskList() this.getTaskList()
this.taskType = 'CREATETASK'
} }
}, },
getTaskList() { getTaskList() {
getStatistics().then((res) => { const params = {
startedUserId: localStorage.getItem('userId'),
groupBys: ['processDefKey', 'modelName']
}
getInstStatistics(params).then((res) => {
this.handleListData(res) this.handleListData(res)
}) })
}, },
getDoneTask() { getDoneTask() {
getDoneTask().then((res) => { const params = {
assignee: localStorage.getItem('userId'),
taskQueryType: 'FINISHEDTASK',
groupBys: ['processDefKey', 'modelName']
}
getStatistics(params).then((res) => {
this.handleListData(res) this.handleListData(res)
}) })
}, },
getMyLaunchList() { getMyLaunchList() {
getUserReceiveItem().then((res) => { const params = {
assignee: localStorage.getItem('userId'),
taskQueryType: 'TODOTASK',
groupBys: ['processDefKey', 'modelName']
}
getStatistics(params).then((res) => {
this.handleListData(res) this.handleListData(res)
}) })
}, },
handleListData(res) { handleListData(res) {
const todotitle = this.$store.state.list.TODOTITLE if (res.items && res.items.statistics) {
const todolist = this.$store.state.list.TODOLIST this.listName = res.items.statistics
res.items.childClassify = res.items?.childClassify.filter(item => !todotitle.includes(item.classifyName))
if (res.items && res.items.childClassify) {
res.items.childClassify.map(item => {
// item.workItems = item.workItems.filter(i => todolist.includes(i.subTypeName.split('___')[1]))
item.count = item.workItems?.length
})
this.listName = res.items.childClassify
} }
this.showLoading = false this.showLoading = false
}, },
...@@ -113,16 +170,99 @@ export default { ...@@ -113,16 +170,99 @@ export default {
}) })
}, },
tabChange(val) { tabChange(val) {
if (val) { // eslint-disable-next-line no-prototype-builtins
let list = this.list if (val && !(this.listObj.hasOwnProperty(val.split('+')[0]))) {
list = this.listName.filter((item) => item.classifId === val)[0] this.getTasks(val.split('+')[0], val.split('+')[1])
.workItems
if (list === null) {
list = []
}
this.list = list
} }
this.classKey = val.split('+')[0]
this.showLoading = false this.showLoading = false
},
// 获取待办任务列表
getTasks(classKey, size) {
this.loading = true
const params = {
page: 1,
size: size,
processDefKey: classKey,
assignee: localStorage.getItem('userId')
}
// eslint-disable-next-line no-prototype-builtins
if (!(this.listObj.hasOwnProperty(classKey))) {
this.listObj[classKey] = []
}
if (this.taskType === 'TODOTASK') {
getUnfinishedTask(this.$utils.filterParams(params)).then(res => {
this.reponseData(res, classKey)
})
} else if (this.taskType === 'FINISHEDTASK') {
getFinishedTask(params).then(res => {
this.reponseData(res, classKey)
})
} else if (this.taskType === 'CREATETASK') {
const instParams = {
checkOwnerSignAddFlag: true,
startedUserId: parseInt(localStorage.getItem('userId')),
processDefKey: classKey,
}
getWFInsts(instParams).then(res => {
res.items.content.forEach((item) => {
this.listObj[classKey].push({
id: item.id,
name: item.taskName || '完成',
showTitle: [{ title: item.name }],
title: item.name,
theme: '',
time: item.gmtCreate,
status: item.status,
proxyUserName: '',
expireTimeInMillis: '',
unClaimedFlag: '',
instItem: item
})
})
this.loading = false
// this.goInfo(this.taskList.length ? this.taskList[0] : null)
})
}
},
// 处理返回数据
reponseData(res, classKey) {
res.items.content.forEach((item) => {
let showTitle = []
if (item.bizExtInfo && item.bizExtInfo.bizAttrValues &&
item.bizExtInfo && item.bizExtInfo.bizConfig) {
const bizConfig = JSON.parse(item.bizExtInfo.bizConfig)
showTitle = this.showTitleParams(item.bizExtInfo.bizAttrValues, bizConfig[0].pending, (item.bizExtInfo && item.bizExtInfo.taskTitle) || '')
} else {
showTitle = [{ title: (item.bizExtInfo && item.bizExtInfo.taskTitle) || (item.bizExtInfo && item.bizExtInfo.processTitle) || '' }]
}
this.listObj[classKey].push({
id: item.id,
processInstanceId: item.processInstanceId,
name: item.aliasName || item.name,
showTitle,
theme: '',
// theme: theme,
title: item.bizExtInfo && item.bizExtInfo.taskTitle ? item.bizExtInfo.taskTitle : item.name,
time: item.startTime,
status: this.getStateDisplayName(item),
proxyUserName: item.proxyUserName || '',
expireTimeInMillis: item.expireTimeInMillis,
unClaimedFlag: item.unClaimedFlag
})
})
this.loading = false
},
getStateDisplayName(item) {
if (!item.bizExtInfo || !item.bizExtInfo.bizObjectState) {
return ''
}
const code = item.bizExtInfo.bizObjectState
return this.$utils.getParamsFromLists(this.dict[this.stateDictName], 'value', code, 'label') || code
},
async getDict(flag) {
const list = await this.$utils.getDicListByCode(this.stateDictName)
this.$set(this.dict, this.stateDictName, list)
} }
} }
} }
...@@ -138,7 +278,7 @@ export default { ...@@ -138,7 +278,7 @@ export default {
height: 60px; height: 60px;
} }
.van-loading { .home-loading {
margin-top: calc(60% + 60px); margin-top: calc(60% + 60px);
} }
...@@ -205,6 +345,10 @@ export default { ...@@ -205,6 +345,10 @@ export default {
.lazy-list { .lazy-list {
height: calc(100vh - 120px); height: calc(100vh - 120px);
.loading {
margin-top: 10px !important;
}
} }
} }
} }
......
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