a8634161 by renchao@pashanhoo.com

Merge branch 'dev'

2 parents 03ebda90 1ed430ae
Showing 46 changed files with 2052 additions and 758 deletions
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-07-20 10:22:20
-->
<template>
<label class="el-checkbox" :class="[
border && checkboxSize ? 'el-checkbox--' + checkboxSize : '',
......@@ -26,217 +31,217 @@
</label>
</template>
<script>
import Emitter from 'element-ui/src/mixins/emitter';
import Emitter from 'element-ui/src/mixins/emitter';
export default {
name: 'ElCheckbox',
export default {
name: 'ElCheckbox',
mixins: [Emitter],
mixins: [Emitter],
inject: {
elForm: {
default: ''
inject: {
elForm: {
default: ''
},
elFormItem: {
default: ''
}
},
componentName: 'ElCheckbox',
data () {
return {
selfModel: false,
focus: false,
isLimitExceeded: false
};
},
elFormItem: {
default: ''
}
},
componentName: 'ElCheckbox',
computed: {
model: {
/**
* @description: get
* @author: renchao
*/
get () {
return this.isGroup
? this.store : this.value !== undefined
? this.value : this.selfModel;
},
/**
* @description: set
* @param {*} val
* @author: renchao
*/
set (val) {
if (this.isGroup) {
this.isLimitExceeded = false;
(this._checkboxGroup.min !== undefined &&
val.length < this._checkboxGroup.min &&
(this.isLimitExceeded = true));
data () {
return {
selfModel: false,
focus: false,
isLimitExceeded: false
};
},
(this._checkboxGroup.max !== undefined &&
val.length > this._checkboxGroup.max &&
(this.isLimitExceeded = true));
this.isLimitExceeded === false &&
this.dispatch('ElCheckboxGroup', 'input', [val]);
} else {
this.$emit('input', val);
this.selfModel = val;
}
}
},
computed: {
model: {
/**
* @description: get
* @description: isChecked
* @author: renchao
*/
get () {
return this.isGroup
? this.store : this.value !== undefined
? this.value : this.selfModel;
isChecked () {
if ({}.toString.call(this.model) === '[object Boolean]') {
return this.model;
} else if (Array.isArray(this.model)) {
return this.model.indexOf(this.label) > -1;
} else if (this.model !== null && this.model !== undefined) {
return this.model === this.trueLabel;
}
},
/**
* @description: set
* @param {*} val
* @description: isGroup
* @author: renchao
*/
set (val) {
if (this.isGroup) {
this.isLimitExceeded = false;
(this._checkboxGroup.min !== undefined &&
val.length < this._checkboxGroup.min &&
(this.isLimitExceeded = true));
(this._checkboxGroup.max !== undefined &&
val.length > this._checkboxGroup.max &&
(this.isLimitExceeded = true));
this.isLimitExceeded === false &&
this.dispatch('ElCheckboxGroup', 'input', [val]);
} else {
this.$emit('input', val);
this.selfModel = val;
isGroup () {
let parent = this.$parent;
while (parent) {
if (parent.$options.componentName !== 'ElCheckboxGroup') {
parent = parent.$parent;
} else {
this._checkboxGroup = parent;
return true;
}
}
return false;
},
/**
* @description: store
* @author: renchao
*/
store () {
return this._checkboxGroup ? this._checkboxGroup.value : this.value;
},
/**
* @description: isLimitDisabled
* @author: renchao
*/
isLimitDisabled () {
const { max, min } = this._checkboxGroup;
return !!(max || min) &&
(this.model.length >= max && !this.isChecked) ||
(this.model.length <= min && this.isChecked);
},
/**
* @description: isDisabled
* @author: renchao
*/
isDisabled () {
return this.isGroup
? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled
: this.disabled || (this.elForm || {}).disabled;
},
/**
* @description: _elFormItemSize
* @author: renchao
*/
_elFormItemSize () {
return (this.elFormItem || {}).elFormItemSize;
},
/**
* @description: checkboxSize
* @author: renchao
*/
checkboxSize () {
const temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
return this.isGroup
? this._checkboxGroup.checkboxGroupSize || temCheckboxSize
: temCheckboxSize;
}
},
/**
* @description: isChecked
* @author: renchao
*/
isChecked () {
if ({}.toString.call(this.model) === '[object Boolean]') {
return this.model;
} else if (Array.isArray(this.model)) {
return this.model.indexOf(this.label) > -1;
} else if (this.model !== null && this.model !== undefined) {
return this.model === this.trueLabel;
}
props: {
value: {},
label: {},
indeterminate: Boolean,
disabled: Boolean,
checked: Boolean,
name: String,
trueLabel: [String, Number],
falseLabel: [String, Number],
id: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
controls: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
border: Boolean,
size: String
},
/**
* @description: isGroup
* @author: renchao
*/
isGroup () {
let parent = this.$parent;
while (parent) {
if (parent.$options.componentName !== 'ElCheckboxGroup') {
parent = parent.$parent;
methods: {
/**
* @description: addToStore
* @author: renchao
*/
addToStore () {
if (
Array.isArray(this.model) &&
this.model.indexOf(this.label) === -1
) {
this.model.push(this.label);
} else {
this._checkboxGroup = parent;
return true;
this.model = this.trueLabel || true;
}
},
/**
* @description: handleChange
* @author: renchao
*/
handleChange (ev) {
if (this.isLimitExceeded) return;
let value;
if (ev.target.checked) {
value = this.trueLabel === undefined ? true : this.trueLabel;
} else {
value = this.falseLabel === undefined ? false : this.falseLabel;
}
this.$emit('change', value, ev);
this.$nextTick(() => {
if (this.isGroup) {
this.dispatch('ElCheckboxGroup', 'change', [this._checkboxGroup.value]);
}
});
}
return false;
},
/**
* @description: store
* @author: renchao
*/
store () {
return this._checkboxGroup ? this._checkboxGroup.value : this.value;
},
/**
* @description: isLimitDisabled
* @author: renchao
*/
isLimitDisabled () {
const { max, min } = this._checkboxGroup;
return !!(max || min) &&
(this.model.length >= max && !this.isChecked) ||
(this.model.length <= min && this.isChecked);
},
/**
* @description: isDisabled
* @author: renchao
*/
isDisabled () {
return this.isGroup
? this._checkboxGroup.disabled || this.disabled || (this.elForm || {}).disabled || this.isLimitDisabled
: this.disabled || (this.elForm || {}).disabled;
},
/**
* @description: _elFormItemSize
* @description: created
* @author: renchao
*/
_elFormItemSize () {
return (this.elFormItem || {}).elFormItemSize;
created () {
this.checked && this.addToStore();
},
/**
* @description: checkboxSize
* @description: mounted
* @author: renchao
*/
checkboxSize () {
const temCheckboxSize = this.size || this._elFormItemSize || (this.$ELEMENT || {}).size;
return this.isGroup
? this._checkboxGroup.checkboxGroupSize || temCheckboxSize
: temCheckboxSize;
}
},
props: {
value: {},
label: {},
indeterminate: Boolean,
disabled: Boolean,
checked: Boolean,
name: String,
trueLabel: [String, Number],
falseLabel: [String, Number],
id: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
controls: String, /* 当indeterminate为真时,为controls提供相关连的checkbox的id,表明元素间的控制关系*/
border: Boolean,
size: String
},
methods: {
/**
* @description: addToStore
* @author: renchao
*/
addToStore () {
if (
Array.isArray(this.model) &&
this.model.indexOf(this.label) === -1
) {
this.model.push(this.label);
} else {
this.model = this.trueLabel || true;
mounted () { // 为indeterminate元素 添加aria-controls 属性
if (this.indeterminate) {
this.$el.setAttribute('aria-controls', this.controls);
}
},
/**
* @description: handleChange
* @description: watch
* @author: renchao
*/
handleChange (ev) {
if (this.isLimitExceeded) return;
let value;
if (ev.target.checked) {
value = this.trueLabel === undefined ? true : this.trueLabel;
} else {
value = this.falseLabel === undefined ? false : this.falseLabel;
watch: {
value (value) {
this.dispatch('ElFormItem', 'el.form.change', value);
}
this.$emit('change', value, ev);
this.$nextTick(() => {
if (this.isGroup) {
this.dispatch('ElCheckboxGroup', 'change', [this._checkboxGroup.value]);
}
});
}
},
/**
* @description: created
* @author: renchao
*/
created () {
this.checked && this.addToStore();
},
/**
* @description: mounted
* @author: renchao
*/
mounted () { // 为indeterminate元素 添加aria-controls 属性
if (this.indeterminate) {
this.$el.setAttribute('aria-controls', this.controls);
}
},
/**
* @description: watch
* @author: renchao
*/
watch: {
value (value) {
this.dispatch('ElFormItem', 'el.form.change', value);
}
}
};
};
</script>
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-07-20 13:33:07
-->
<template>
<el-dialog :visible.sync="dialogVisible" v-if="dialogVisible" :width="width" :fullscreen="fullscreen" top="0"
:append-to-body="appendToBody" :lock-scroll="true" :close-on-click-modal="false" @close="closeDialog" :key="key"
......@@ -23,117 +28,117 @@
</el-dialog>
</template>
<script>
export default {
props: {
value: { type: Boolean, default: false },
isMain: {
type: Boolean,
default: false
},
appendToBody: {
type: Boolean,
default: true
},
isButton: {
type: Boolean,
default: true,
},
width: {
type: String,
default: '70%',
},
title: {
type: String,
default: '',
},
isFullscreen: {
type: Boolean,
default: true,
},
isSave: {
type: Boolean,
default: true,
},
saveButton: {
type: String,
default: '提交',
},
isReset: {
type: Boolean,
default: true,
},
saveloding: {
type: Boolean,
default: false,
export default {
props: {
value: { type: Boolean, default: false },
isMain: {
type: Boolean,
default: false
},
appendToBody: {
type: Boolean,
default: true
},
isButton: {
type: Boolean,
default: true,
},
width: {
type: String,
default: '70%',
},
title: {
type: String,
default: '',
},
isFullscreen: {
type: Boolean,
default: true,
},
isSave: {
type: Boolean,
default: true,
},
saveButton: {
type: String,
default: '提交',
},
isReset: {
type: Boolean,
default: true,
},
saveloding: {
type: Boolean,
default: false,
},
btnDisabled: {
type: Boolean,
default: false
},
height: {
type: String,
default: ''
}
},
btnDisabled: {
type: Boolean,
default: false
data () {
return {
key: 0,
dialogVisible: false,
fullscreen: false,
scrollerHeight: ''
}
},
height: {
type: String,
default: ''
}
},
data () {
return {
key: 0,
dialogVisible: false,
fullscreen: false,
scrollerHeight: ''
}
},
watch: {
value (val) {
this.$nextTick(() => {
this.dialogVisible = val
})
this.height && (this.scrollerHeight = this.height + 'px')
}
},
methods: {
/**
* @description: handleFullscreen
* @author: renchao
*/
handleFullscreen () {
this.fullscreen = !this.fullscreen
if (!this.fullscreen) {
this.scrollerHeight = ''
} else {
this.scrollerHeight = (window.innerHeight - 120) + 'px'
watch: {
value (val) {
this.$nextTick(() => {
this.dialogVisible = val
})
this.height && (this.scrollerHeight = this.height + 'px')
}
},
/**
* @description: submitForm
* @author: renchao
*/
submitForm () {
if (this.isButton) {
this.$emit('submitForm');
methods: {
/**
* @description: handleFullscreen
* @author: renchao
*/
handleFullscreen () {
this.fullscreen = !this.fullscreen
if (!this.fullscreen) {
this.scrollerHeight = ''
} else {
this.scrollerHeight = (window.innerHeight - 120) + 'px'
}
},
/**
* @description: submitForm
* @author: renchao
*/
submitForm () {
if (this.isButton) {
this.$emit('submitForm');
}
},
/**
* @description: closeDialog
* @author: renchao
*/
closeDialog () {
this.key++
this.$emit('input', false)
this.$emit('closeDialog')
}
},
/**
* @description: closeDialog
* @author: renchao
*/
closeDialog () {
this.key++
this.$emit('input', false)
this.$emit('closeDialog')
}
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" >
@import "~@/styles/mixin.scss";
@import "~@/styles/dialogBox.scss";
@import "~@/styles/mixin.scss";
@import "~@/styles/dialogBox.scss";
</style>
<style rel="stylesheet/scss" scoped lang="scss" >
/deep/.is-fullscreen {
position: absolute;
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
}
/deep/.is-fullscreen {
position: absolute;
top: 50% !important;
left: 50% !important;
transform: translate(-50%, -50%) !important;
}
</style>
......
......@@ -6,6 +6,11 @@ import afterLeave from 'element-ui/src/utils/after-leave';
const Mask = Vue.extend(Loading);
const loadingDirective = {};
/**
* @description: install
* @author: renchao
*/
loadingDirective.install = Vue => {
if (Vue.prototype.$isServer) return;
const toggleLoading = (el, binding) => {
......@@ -110,14 +115,24 @@ loadingDirective.install = Vue => {
binding.value && toggleLoading(el, binding);
},
/**
* @description: update
* @param {*} el
* @param {*} binding
* @author: renchao
*/
update: function (el, binding) {
el.instance.setText(el.getAttribute('element-loading-text'));
if (binding.oldValue !== binding.value) {
toggleLoading(el, binding);
}
},
/**
* @description: unbind
* @param {*} el
* @param {*} binding
* @author: renchao
*/
unbind: function (el, binding) {
if (el.domInserted) {
el.mask &&
......
......@@ -20,6 +20,10 @@ let fullscreenLoading;
LoadingConstructor.prototype.originalPosition = '';
LoadingConstructor.prototype.originalOverflow = '';
/**
* @description: close
* @author: renchao
*/
LoadingConstructor.prototype.close = function() {
if (this.fullscreen) {
fullscreenLoading = undefined;
......@@ -38,6 +42,13 @@ LoadingConstructor.prototype.close = function() {
this.visible = false;
};
/**
* @description: addStyle
* @param {*} options
* @param {*} parent
* @param {*} instance
* @author: renchao
*/
const addStyle = (options, parent, instance) => {
let maskStyle = {};
if (options.fullscreen) {
......@@ -64,6 +75,10 @@ const addStyle = (options, parent, instance) => {
});
};
/**
* @description: Loading
* @author: renchao
*/
const Loading = (options = {}) => {
if (Vue.prototype.$isServer) return;
options = merge({}, defaults, options);
......
......@@ -43,6 +43,11 @@ const MessageBoxConstructor = Vue.extend(msgboxVue);
let currentMsg, instance;
let msgQueue = [];
/**
* @description: defaultCallback
* @author: renchao
*/
const defaultCallback = action => {
if (currentMsg) {
let callback = currentMsg.callback;
......@@ -56,6 +61,10 @@ const defaultCallback = action => {
}
};
/**
* @description: initInstance
* @author: renchao
*/
const initInstance = () => {
instance = new MessageBoxConstructor({
el: document.createElement('div')
......@@ -64,6 +73,10 @@ const initInstance = () => {
instance.callback = defaultCallback;
};
/**
* @description: showNextMsg
* @author: renchao
*/
const showNextMsg = () => {
if (!instance) {
initInstance();
......@@ -109,6 +122,10 @@ const showNextMsg = () => {
}
};
/**
* @description: MessageBox
* @author: renchao
*/
const MessageBox = function (options, callback) {
if (Vue.prototype.$isServer) return;
if (typeof options === 'string' || isVNode(options)) {
......@@ -143,10 +160,18 @@ const MessageBox = function (options, callback) {
}
};
/**
* @description: setDefaults
* @author: renchao
*/
MessageBox.setDefaults = defaults => {
MessageBox.defaults = defaults;
};
/**
* @description: alert
* @author: renchao
*/
MessageBox.alert = (title, message, options) => {
if (typeof title === 'object') {
options = title;
......@@ -163,6 +188,10 @@ MessageBox.alert = (title, message, options) => {
}, options));
};
/**
* @description: close
* @author: renchao
*/
MessageBox.close = () => {
instance.doClose();
instance.visible = false;
......
......@@ -97,6 +97,10 @@ export default {
},
methods: {
/**
* @description: getSafeClose
* @author: renchao
*/
getSafeClose () {
const currentId = this.uid;
return () => {
......@@ -105,6 +109,10 @@ export default {
});
};
},
/**
* @description: doClose
* @author: renchao
*/
doClose () {
if (!this.visible) return;
this.visible = false;
......@@ -122,18 +130,31 @@ export default {
});
},
/**
* @description: handleWrapperClick
* @author: renchao
*/
handleWrapperClick () {
if (this.closeOnClickModal) {
this.handleAction(this.distinguishCancelAndClose ? 'close' : 'cancel');
}
},
/**
* @description: handleInputEnter
* @author: renchao
*/
handleInputEnter () {
if (this.inputType !== 'textarea') {
return this.handleAction('confirm');
}
},
/**
* @description: handleAction
* @param {*} action
* @author: renchao
*/
handleAction (action) {
if (this.$type === 'prompt' && action === 'confirm' && !this.validate()) {
return;
......@@ -147,6 +168,10 @@ export default {
}
},
/**
* @description: validate
* @author: renchao
*/
validate () {
if (this.$type === 'prompt') {
const inputPattern = this.inputPattern;
......@@ -174,15 +199,27 @@ export default {
removeClass(this.getInputElement(), 'invalid');
return true;
},
/**
* @description: getFirstFocus
* @author: renchao
*/
getFirstFocus () {
const btn = this.$el.querySelector('.el-message-box__btns .el-button');
const title = this.$el.querySelector('.el-message-box__btns .el-message-box__title');
return btn || title;
},
/**
* @description: getInputElement
* @author: renchao
*/
getInputElement () {
const inputRefs = this.$refs.input.$refs;
return inputRefs.input || inputRefs.textarea;
},
/**
* @description: handleClose
* @author: renchao
*/
handleClose () {
this.handleAction('close');
}
......@@ -200,6 +237,11 @@ export default {
}
},
/**
* @description: visible
* @param {*} val
* @author: renchao
*/
visible (val) {
if (val) {
this.uid++;
......@@ -222,6 +264,10 @@ export default {
}
},
/**
* @description: mounted
* @author: renchao
*/
mounted () {
this.$nextTick(() => {
if (this.closeOnHashChange) {
......@@ -230,6 +276,10 @@ export default {
});
},
/**
* @description: beforeDestroy
* @author: renchao
*/
beforeDestroy () {
if (this.closeOnHashChange) {
window.removeEventListener('hashchange', this.close);
......@@ -298,4 +348,4 @@ export default {
/deep/.el-message-box__content {
padding-top: 0;
}
</style>
\ No newline at end of file
</style>
......
......@@ -49,10 +49,18 @@ export default {
}
},
methods: {
/**
* @description: handleNotice
* @param {*} item
* @author: renchao
*/
handleNotice (item) {
this.$alertMes(item.noticeTitle, item.noticeContent)
},
// 获取数据
/**
* @description: 获取数据
* @author: renchao
*/
getData () {
let style = document.styleSheets[0];
let text = this.$refs.text;
......@@ -72,13 +80,19 @@ export default {
this.changeState();
}, 300);
},
// 用速度计算时间(想要保持速度一样,2种状态时间不同需算出)
/**
* @description: 用速度计算时间(想要保持速度一样,2种状态时间不同需算出)
* @author: renchao
*/
ComputationTime () {
this.firstAnimationTime = this.wordLength / this.speed;
this.secondAnimationTime =
(this.wordLength + this.backWidth) / this.speed;
},
// 根据状态切换动画
/**
* @description: 根据状态切换动画
* @author: renchao
*/
changeState () {
let text = this.$refs.text;
if (this.state == 1) {
......@@ -88,6 +102,10 @@ export default {
text.style.animation = `secondAnimation ${this.secondAnimationTime}s linear infinite`;
}
},
/**
* @description: Listener
* @author: renchao
*/
Listener () {
let text = this.$refs.text;
text.addEventListener(
......@@ -98,10 +116,18 @@ export default {
false
)
},
/**
* @description: mouseOver
* @author: renchao
*/
mouseOver () {
let text = this.$refs.text;
text.style.animationPlayState = 'paused'
},
/**
* @description: mouseLeave
* @author: renchao
*/
mouseLeave () {
let text = this.$refs.text;
text.style.animationPlayState = ''
......@@ -151,4 +177,4 @@ export default {
}
}
}
</style>
\ No newline at end of file
</style>
......
......@@ -188,6 +188,10 @@
this.$img = this.$refs["img"];
},
methods: {
/**
* @description: imgLoaded
* @author: renchao
*/
imgLoaded () {
let imgInfo = this.$img.getBoundingClientRect();
if (JSON.stringify(this.imgInfo) != JSON.stringify(imgInfo)) {
......@@ -200,6 +204,10 @@
this.$emit("created", imgInfo);
}
},
/**
* @description: mouseMove
* @author: renchao
*/
mouseMove (e) {
if (!this.hideZoom && this.imgLoadedFlag) {
this.imgLoaded();
......@@ -225,6 +233,11 @@
selector.bgTop = addWidth - y * scale;
}
},
/**
* @description: initSelectorProperty
* @param {*} selectorWidth
* @author: renchao
*/
initSelectorProperty (selectorWidth) {
const selectorHalfWidth = selectorWidth / 2;
const selector = this.selector;
......@@ -236,12 +249,20 @@
selector.absoluteLeft = left + selectorHalfWidth + scrollLeft;
selector.absoluteTop = top + selectorHalfWidth + scrollTop;
},
/**
* @description: mouseLeave
* @author: renchao
*/
mouseLeave () {
this.hideSelector = true;
if (this.outShow) {
this.hideOutShow = true;
}
},
/**
* @description: reset
* @author: renchao
*/
reset () {
Object.assign(this.selector, {
top: 0,
......@@ -251,9 +272,18 @@
});
this.resetOutShowInitPosition();
},
/**
* @description: resetOutShowInitPosition
* @author: renchao
*/
resetOutShowInitPosition () {
this.outShowInitTop = 0;
},
/**
* @description: resetOutShowInitPosition
* @param {*} e
* @author: renchao
*/
imgerrorfun (e) {
// let img = require('@/assets/vehicle_img/blank_vehicle.jpg')
// this.url = img
......@@ -326,4 +356,4 @@
top: 50%;
transform: translateY(-50%);
}
</style>
\ No newline at end of file
</style>
......
......@@ -2,6 +2,15 @@ import Vue from 'vue'
import Popup from './index.vue'
const PopupBox = Vue.extend(Popup)
/**
* @description: install
* @param {*} title
* @param {*} editItem
* @param {*} data
* @param {*} formData
* @author: renchao
*/
Popup.install = function (title, editItem, data, formData) {
data.title = title
data.editItem = editItem
......
......@@ -55,7 +55,10 @@ export default {
}
},
mounted () {
// 计算滚动条高度
/**
* @description: 计算滚动条高度
* @author: renchao
*/
setTimeout(() => {
if (this.btnShow) {
if (this.height == 'auto') {
......@@ -73,10 +76,18 @@ export default {
}, 300)
},
methods: {
/**
* @description: onCancel
* @author: renchao
*/
onCancel () {
this.isShow = false
this.cancel()
},
/**
* @description: onConfirm
* @author: renchao
*/
onConfirm () {
this.loading = true
let res = new Promise((resolve, reject) => {
......@@ -87,9 +98,19 @@ export default {
this.isShow = false
}
},
/**
* @description: loadingFn
* @param {*} e
* @author: renchao
*/
loadingFn (e) { //加载状态
this.loading = e
},
/**
* @description: loadViewFn
* @param {*} view
* @author: renchao
*/
loadViewFn (view) {
return (r) =>
require.ensure([], () =>
......
/*
* @Description:
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-06-14 15:05:38
*/
......@@ -8,6 +8,10 @@ import Popup from './index.vue'
const PopupBox = Vue.extend(Popup)
let popuping = undefined
/**
* @description: close
* @author: renchao
*/
PopupBox.prototype.close = function () {
// 如果Popup 有引用,则去掉引用
if (popuping) {
......@@ -23,7 +27,14 @@ PopupBox.prototype.close = function () {
}
}, 300)
}
/**
* @description: Popup1
* @param {*} title
* @param {*} editItem
* @param {*} data
* @param {*} formData
* @author: renchao
*/
const Popup1 = (title, editItem, data, formData) => {
// 如果组件已渲染,则返回即可
if (popuping) {
......
......@@ -56,7 +56,10 @@
}
},
mounted () {
// 计算滚动条高度
/**
* @description: 计算滚动条高度
* @author: renchao
*/
setTimeout(() => {
if (this.btnShow) {
if (this.height == 'auto') {
......@@ -74,9 +77,17 @@
}, 300)
},
methods: {
/**
* @description: onCancel
* @author: renchao
*/
onCancel () {
Popup1().close()
},
/**
* @description: onConfirm
* @author: renchao
*/
onConfirm () {
let res = new Promise((resolve, reject) => {
this.confirm()
......@@ -86,6 +97,11 @@
this.isShow = false
}
},
/**
* @description: loadViewFn
* @param {*} view
* @author: renchao
*/
loadViewFn (view) {
return (r) =>
require.ensure([], () =>
......@@ -185,4 +201,3 @@
opacity: 0;
}
</style>
\ No newline at end of file
......
......@@ -84,6 +84,13 @@ export default {
},
methods: {
/**
* @description: updateStyle
* @param {*} style
* @param {*} oldCluster
* @param {*} newCluster
* @author: renchao
*/
updateStyle (style, oldCluster, newCluster) {
let newStyle = style
oldCluster.forEach((color, index) => {
......@@ -92,6 +99,12 @@ export default {
return newStyle
},
/**
* @description: getCSSString
* @param {*} url
* @param {*} variable
* @author: renchao
*/
getCSSString (url, variable) {
return new Promise(resolve => {
const xhr = new XMLHttpRequest()
......@@ -106,6 +119,11 @@ export default {
})
},
/**
* @description: getThemeCluster
* @param {*} theme
* @author: renchao
*/
getThemeCluster (theme) {
const tintColor = (color, tint) => {
let red = parseInt(color.slice(0, 2), 16)
......@@ -169,4 +187,4 @@ export default {
.theme-picker-dropdown .el-color-dropdown__link-btn {
display: none;
}
</style>
\ No newline at end of file
</style>
......
......@@ -2,6 +2,10 @@ import objectAssign from 'element-ui/src/utils/merge';
import { markNodeData, NODE_KEY } from './util';
import { arrayFindIndex } from 'element-ui/src/utils/util';
/**
* @description: getChildState
* @author: renchao
*/
export const getChildState = node => {
let all = true;
let none = true;
......@@ -22,6 +26,11 @@ export const getChildState = node => {
return { all, none, allWithoutDisable, half: !all && !none };
};
/**
* @description: reInitChecked
* @param {*} node
* @author: renchao
*/
const reInitChecked = function(node) {
if (node.childNodes.length === 0 || node.loading) return;
......@@ -45,6 +54,12 @@ const reInitChecked = function(node) {
}
};
/**
* @description: getPropertyFromData
* @param {*} node
* @param {*} prop
* @author: renchao
*/
const getPropertyFromData = function(node, prop) {
const props = node.store.props;
const data = node.data || {};
......@@ -63,6 +78,11 @@ const getPropertyFromData = function(node, prop) {
let nodeIdSeed = 0;
export default class Node {
/**
* @description: constructor
* @param {*} options
* @author: renchao
*/
constructor(options) {
this.id = nodeIdSeed++;
this.text = null;
......@@ -135,6 +155,11 @@ export default class Node {
this.updateLeafState();
}
/**
* @description: setData
* @param {*} data
* @author: renchao
*/
setData(data) {
if (!Array.isArray(data)) {
markNodeData(this, data);
......@@ -155,20 +180,36 @@ export default class Node {
}
}
/**
* @description: label
* @author: renchao
*/
get label() {
return getPropertyFromData(this, 'label');
}
/**
* @description: key
* @author: renchao
*/
get key() {
const nodeKey = this.store.key;
if (this.data) return this.data[nodeKey];
return null;
}
/**
* @description: disabled
* @author: renchao
*/
get disabled() {
return getPropertyFromData(this, 'disabled');
}
/**
* @description: nextSibling
* @author: renchao
*/
get nextSibling() {
const parent = this.parent;
if (parent) {
......@@ -180,6 +221,10 @@ export default class Node {
return null;
}
/**
* @description: previousSibling
* @author: renchao
*/
get previousSibling() {
const parent = this.parent;
if (parent) {
......@@ -191,6 +236,12 @@ export default class Node {
return null;
}
/**
* @description: contains
* @param {*} target
* @param {*} deep
* @author: renchao
*/
contains(target, deep = true) {
const walk = function(parent) {
const children = parent.childNodes || [];
......@@ -208,6 +259,10 @@ export default class Node {
return walk(this);
}
/**
* @description: remove
* @author: renchao
*/
remove() {
const parent = this.parent;
if (parent) {
......@@ -215,6 +270,13 @@ export default class Node {
}
}
/**
* @description: insertChild
* @param {*} child
* @param {*} index
* @param {*} batch
* @author: renchao
*/
insertChild(child, index, batch) {
if (!child) throw new Error('insertChild error: child is required.');
......@@ -247,6 +309,12 @@ export default class Node {
this.updateLeafState();
}
/**
* @description: insertBefore
* @param {*} child
* @param {*} ref
* @author: renchao
*/
insertBefore(child, ref) {
let index;
if (ref) {
......@@ -255,6 +323,12 @@ export default class Node {
this.insertChild(child, index);
}
/**
* @description: insertAfter
* @param {*} child
* @param {*} ref
* @author: renchao
*/
insertAfter(child, ref) {
let index;
if (ref) {
......@@ -264,6 +338,11 @@ export default class Node {
this.insertChild(child, index);
}
/**
* @description: removeChild
* @param {*} child
* @author: renchao
*/
removeChild(child) {
const children = this.getChildren() || [];
const dataIndex = children.indexOf(child.data);
......@@ -282,6 +361,11 @@ export default class Node {
this.updateLeafState();
}
/**
* @description: removeChildByData
* @param {*} data
* @author: renchao
*/
removeChildByData(data) {
let targetNode = null;
......@@ -297,6 +381,12 @@ export default class Node {
}
}
/**
* @description: expand
* @param {*} callback
* @param {*} expandParent
* @author: renchao
*/
expand(callback, expandParent) {
const done = () => {
if (expandParent) {
......@@ -326,20 +416,38 @@ export default class Node {
}
}
/**
* @description: doCreateChildren
* @param {*} array
* @param {*} defaultProps
* @author: renchao
*/
doCreateChildren(array, defaultProps = {}) {
array.forEach((item) => {
this.insertChild(objectAssign({ data: item }, defaultProps), undefined, true);
});
}
/**
* @description: collapse
* @author: renchao
*/
collapse() {
this.expanded = false;
}
/**
* @description: shouldLoadData
* @author: renchao
*/
shouldLoadData() {
return this.store.lazy === true && this.store.load && !this.loaded;
}
/**
* @description: updateLeafState
* @author: renchao
*/
updateLeafState() {
if (this.store.lazy === true && this.loaded !== true && typeof this.isLeafByUser !== 'undefined') {
this.isLeaf = this.isLeafByUser;
......@@ -353,6 +461,14 @@ export default class Node {
this.isLeaf = false;
}
/**
* @description: setChecked
* @param {*} value
* @param {*} deep
* @param {*} recursion
* @param {*} passValue
* @author: renchao
*/
setChecked(value, deep, recursion, passValue) {
this.indeterminate = value === 'half';
this.checked = value === true;
......@@ -406,6 +522,11 @@ export default class Node {
}
}
/**
* @description: getChildren
* @param {*} forceInit
* @author: renchao
*/
getChildren(forceInit = false) { // this is data
if (this.level === 0) return this.data;
const data = this.data;
......@@ -428,6 +549,10 @@ export default class Node {
return data[children];
}
/**
* @description: updateChildren
* @author: renchao
*/
updateChildren() {
const newData = this.getChildren() || [];
const oldData = this.childNodes.map((node) => node.data);
......@@ -458,6 +583,12 @@ export default class Node {
this.updateLeafState();
}
/**
* @description: loadData
* @param {*} callback
* @param {*} defaultProps
* @author: renchao
*/
loadData(callback, defaultProps = {}) {
if (this.store.lazy === true && this.store.load && !this.loaded && (!this.loading || Object.keys(defaultProps).length)) {
this.loading = true;
......
......@@ -2,6 +2,11 @@ import Node from './node';
import { getNodeKey } from './util';
export default class TreeStore {
/**
* @description: constructor
* @param {*} options
* @author: renchao
*/
constructor(options) {
this.currentNode = null;
this.currentNodeKey = null;
......@@ -30,6 +35,11 @@ export default class TreeStore {
}
}
/**
* @description: filter
* @param {*} value
* @author: renchao
*/
filter(value) {
const filterNodeMethod = this.filterNodeMethod;
const lazy = this.lazy;
......@@ -60,6 +70,11 @@ export default class TreeStore {
traverse(this);
}
/**
* @description: setData
* @param {*} newVal
* @author: renchao
*/
setData(newVal) {
const instanceChanged = newVal !== this.root.data;
if (instanceChanged) {
......@@ -70,22 +85,44 @@ export default class TreeStore {
}
}
/**
* @description: getNode
* @param {*} data
* @author: renchao
*/
getNode(data) {
if (data instanceof Node) return data;
const key = typeof data !== 'object' ? data : getNodeKey(this.key, data);
return this.nodesMap[key] || null;
}
/**
* @description: insertBefore
* @param {*} data
* @param {*} refData
* @author: renchao
*/
insertBefore(data, refData) {
const refNode = this.getNode(refData);
refNode.parent.insertBefore({ data }, refNode);
}
/**
* @description: insertAfter
* @param {*} data
* @param {*} refData
* @author: renchao
*/
insertAfter(data, refData) {
const refNode = this.getNode(refData);
refNode.parent.insertAfter({ data }, refNode);
}
/**
* @description: remove
* @param {*} data
* @author: renchao
*/
remove(data) {
const node = this.getNode(data);
......@@ -97,6 +134,12 @@ export default class TreeStore {
}
}
/**
* @description: append
* @param {*} data
* @param {*} parentData
* @author: renchao
*/
append(data, parentData) {
const parentNode = parentData ? this.getNode(parentData) : this.root;
......@@ -105,6 +148,10 @@ export default class TreeStore {
}
}
/**
* @description: _initDefaultCheckedNodes
* @author: renchao
*/
_initDefaultCheckedNodes() {
const defaultCheckedKeys = this.defaultCheckedKeys || [];
const nodesMap = this.nodesMap;
......@@ -118,6 +165,11 @@ export default class TreeStore {
});
}
/**
* @description: _initDefaultCheckedNode
* @param {*} node
* @author: renchao
*/
_initDefaultCheckedNode(node) {
const defaultCheckedKeys = this.defaultCheckedKeys || [];
......@@ -126,6 +178,11 @@ export default class TreeStore {
}
}
/**
* @description: setDefaultCheckedKey
* @param {*} newVal
* @author: renchao
*/
setDefaultCheckedKey(newVal) {
if (newVal !== this.defaultCheckedKeys) {
this.defaultCheckedKeys = newVal;
......@@ -133,6 +190,11 @@ export default class TreeStore {
}
}
/**
* @description: registerNode
* @param {*} node
* @author: renchao
*/
registerNode(node) {
const key = this.key;
if (!key || !node || !node.data) return;
......@@ -141,6 +203,11 @@ export default class TreeStore {
if (nodeKey !== undefined) this.nodesMap[node.key] = node;
}
/**
* @description: deregisterNode
* @param {*} node
* @author: renchao
*/
deregisterNode(node) {
const key = this.key;
if (!key || !node || !node.data) return;
......@@ -152,6 +219,12 @@ export default class TreeStore {
delete this.nodesMap[node.key];
}
/**
* @description: getCheckedNodes
* @param {*} leafOnly
* @param {*} includeHalfChecked
* @author: renchao
*/
getCheckedNodes(leafOnly = false, includeHalfChecked = false) {
const checkedNodes = [];
const traverse = function(node) {
......@@ -171,10 +244,19 @@ export default class TreeStore {
return checkedNodes;
}
/**
* @description: getCheckedKeys
* @param {*} leafOnly
* @author: renchao
*/
getCheckedKeys(leafOnly = false) {
return this.getCheckedNodes(leafOnly).map((data) => (data || {})[this.key]);
}
/**
* @description: getHalfCheckedNodes
* @author: renchao
*/
getHalfCheckedNodes() {
const nodes = [];
const traverse = function(node) {
......@@ -194,10 +276,18 @@ export default class TreeStore {
return nodes;
}
/**
* @description: getHalfCheckedKeys
* @author: renchao
*/
getHalfCheckedKeys() {
return this.getHalfCheckedNodes().map((data) => (data || {})[this.key]);
}
/**
* @description: _getAllNodes
* @author: renchao
*/
_getAllNodes() {
const allNodes = [];
const nodesMap = this.nodesMap;
......@@ -210,6 +300,12 @@ export default class TreeStore {
return allNodes;
}
/**
* @description: updateChildren
* @param {*} key
* @param {*} data
* @author: renchao
*/
updateChildren(key, data) {
const node = this.nodesMap[key];
if (!node) return;
......@@ -224,6 +320,13 @@ export default class TreeStore {
}
}
/**
* @description: _setCheckedKeys
* @param {*} key
* @param {*} leafOnly
* @param {*} checkedKeys
* @author: renchao
*/
_setCheckedKeys(key, leafOnly = false, checkedKeys) {
const allNodes = this._getAllNodes().sort((a, b) => b.level - a.level);
const cache = Object.create(null);
......@@ -268,6 +371,12 @@ export default class TreeStore {
}
}
/**
* @description: setCheckedNodes
* @param {*} array
* @param {*} leafOnly
* @author: renchao
*/
setCheckedNodes(array, leafOnly = false) {
const key = this.key;
const checkedKeys = {};
......@@ -278,6 +387,12 @@ export default class TreeStore {
this._setCheckedKeys(key, leafOnly, checkedKeys);
}
/**
* @description: setCheckedKeys
* @param {*} array
* @param {*} leafOnly
* @author: renchao
*/
setCheckedKeys(keys, leafOnly = false) {
this.defaultCheckedKeys = keys;
const key = this.key;
......@@ -289,6 +404,11 @@ export default class TreeStore {
this._setCheckedKeys(key, leafOnly, checkedKeys);
}
/**
* @description: setDefaultExpandedKeys
* @param {*} keys
* @author: renchao
*/
setDefaultExpandedKeys(keys) {
keys = keys || [];
this.defaultExpandedKeys = keys;
......@@ -299,6 +419,13 @@ export default class TreeStore {
});
}
/**
* @description: setChecked
* @param {*} data
* @param {*} checked
* @param {*} deep
* @author: renchao
*/
setChecked(data, checked, deep) {
const node = this.getNode(data);
......@@ -307,10 +434,19 @@ export default class TreeStore {
}
}
/**
* @description: getCurrentNode
* @author: renchao
*/
getCurrentNode() {
return this.currentNode;
}
/**
* @description: setCurrentNode
* @param {*} currentNode
* @author: renchao
*/
setCurrentNode(currentNode) {
const prevCurrentNode = this.currentNode;
if (prevCurrentNode) {
......@@ -320,12 +456,22 @@ export default class TreeStore {
this.currentNode.isCurrent = true;
}
/**
* @description: setUserCurrentNode
* @param {*} node
* @author: renchao
*/
setUserCurrentNode(node) {
const key = node[this.key];
const currNode = this.nodesMap[key];
this.setCurrentNode(currNode);
}
/**
* @description: setCurrentNodeKey
* @param {*} key
* @author: renchao
*/
setCurrentNodeKey(key) {
if (key === null || key === undefined) {
this.currentNode && (this.currentNode.isCurrent = false);
......
export const NODE_KEY = '$treeNodeId';
/**
* @description: markNodeData
* @param {*} node
* @param {*} data
* @author: renchao
*/
export const markNodeData = function(node, data) {
if (!data || data[NODE_KEY]) return;
Object.defineProperty(data, NODE_KEY, {
......@@ -10,11 +16,23 @@ export const markNodeData = function(node, data) {
});
};
/**
* @description: getNodeKey
* @param {*} key
* @param {*} data
* @author: renchao
*/
export const getNodeKey = function(key, data) {
if (!key) return data[NODE_KEY];
return data[key];
};
/**
* @description: findNearestComponent
* @param {*} element
* @param {*} componentName
* @author: renchao
*/
export const findNearestComponent = (element, componentName) => {
let target = element;
while (target && target.tagName !== 'BODY') {
......
......@@ -116,10 +116,21 @@ export default {
},
methods: {
/**
* @description: getNodeKey
* @param {*} node
* @author: renchao
*/
getNodeKey (node) {
return getNodeKey(this.tree.nodeKey, node.data);
},
/**
* @description: handleSelectChange
* @param {*} checked
* @param {*} indeterminate
* @author: renchao
*/
handleSelectChange (checked, indeterminate) {
if (this.oldChecked !== checked && this.oldIndeterminate !== indeterminate) {
this.tree.$emit('check-change', this.node.data, checked, indeterminate);
......@@ -128,6 +139,10 @@ export default {
this.indeterminate = indeterminate;
},
/**
* @description: handleClick
* @author: renchao
*/
handleClick () {
const store = this.tree.store;
store.setCurrentNode(this.node);
......@@ -144,6 +159,11 @@ export default {
this.tree.$emit('node-click', this.node.data, this.node, this);
},
/**
* @description: handleContextMenu
* @param {*} event
* @author: renchao
*/
handleContextMenu (event) {
if (this.tree._events['node-contextmenu'] && this.tree._events['node-contextmenu'].length > 0) {
event.stopPropagation();
......@@ -152,6 +172,10 @@ export default {
this.tree.$emit('node-contextmenu', event, this.node.data, this.node, this);
},
/**
* @description: handleExpandIconClick
* @author: renchao
*/
handleExpandIconClick () {
if (this.node.isLeaf) return;
if (this.expanded) {
......@@ -163,6 +187,12 @@ export default {
}
},
/**
* @description: handleCheckChange
* @param {*} value
* @param {*} ev
* @author: renchao
*/
handleCheckChange (value, ev) {
this.node.setChecked(ev.target.checked, !this.tree.checkStrictly);
this.$nextTick(() => {
......@@ -176,26 +206,53 @@ export default {
});
},
/**
* @description: handleChildNodeExpand
* @param {*} nodeData
* @param {*} node
* @param {*} instance
* @author: renchao
*/
handleChildNodeExpand (nodeData, node, instance) {
this.broadcast('ElTreeNode', 'tree-node-expand', node);
this.tree.$emit('node-expand', nodeData, node, instance);
},
/**
* @description: handleDragStart
* @param {*} event
* @author: renchao
*/
handleDragStart (event) {
if (!this.tree.draggable) return;
this.tree.$emit('tree-node-drag-start', event, this);
},
/**
* @description: handleDragOver
* @param {*} event
* @author: renchao
*/
handleDragOver (event) {
if (!this.tree.draggable) return;
this.tree.$emit('tree-node-drag-over', event, this);
event.preventDefault();
},
/**
* @description: handleDrop
* @param {*} event
* @author: renchao
*/
handleDrop (event) {
event.preventDefault();
},
/**
* @description: handleDragEnd
* @param {*} event
* @author: renchao
*/
handleDragEnd (event) {
if (!this.tree.draggable) return;
this.tree.$emit('tree-node-drag-end', event, this);
......
......@@ -177,15 +177,30 @@
},
methods: {
/**
* @description: filter
* @param {*} value
* @author: renchao
*/
filter(value) {
if (!this.filterNodeMethod) throw new Error('[Tree] filterNodeMethod is required when filter');
this.store.filter(value);
},
/**
* @description: getNodeKey
* @param {*} node
* @author: renchao
*/
getNodeKey(node) {
return getNodeKey(this.nodeKey, node.data);
},
/**
* @description: getNodePath
* @param {*} data
* @author: renchao
*/
getNodePath(data) {
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getNodePath');
const node = this.store.getNode(data);
......@@ -199,87 +214,188 @@
return path.reverse();
},
/**
* @description: getCheckedNodes
* @param {*} leafOnly
* @param {*} includeHalfChecked
* @author: renchao
*/
getCheckedNodes(leafOnly, includeHalfChecked) {
return this.store.getCheckedNodes(leafOnly, includeHalfChecked);
},
/**
* @description: getCheckedKeys
* @param {*} leafOnly
* @author: renchao
*/
getCheckedKeys(leafOnly) {
return this.store.getCheckedKeys(leafOnly);
},
/**
* @description: getCurrentNode
* @author: renchao
*/
getCurrentNode() {
const currentNode = this.store.getCurrentNode();
return currentNode ? currentNode.data : null;
},
/**
* @description: getCurrentKey
* @author: renchao
*/
getCurrentKey() {
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in getCurrentKey');
const currentNode = this.getCurrentNode();
return currentNode ? currentNode[this.nodeKey] : null;
},
/**
* @description: setCheckedNodes
* @param {*} nodes
* @param {*} leafOnly
* @author: renchao
*/
setCheckedNodes(nodes, leafOnly) {
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedNodes');
this.store.setCheckedNodes(nodes, leafOnly);
},
/**
* @description: setCheckedKeys
* @param {*} keys
* @param {*} leafOnly
* @author: renchao
*/
setCheckedKeys(keys, leafOnly) {
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCheckedKeys');
this.store.setCheckedKeys(keys, leafOnly);
},
/**
* @description: setChecked
* @param {*} data
* @param {*} checked
* @param {*} deep
* @author: renchao
*/
setChecked(data, checked, deep) {
this.store.setChecked(data, checked, deep);
},
/**
* @description: getHalfCheckedNodes
* @author: renchao
*/
getHalfCheckedNodes() {
return this.store.getHalfCheckedNodes();
},
/**
* @description: getHalfCheckedKeys
* @author: renchao
*/
getHalfCheckedKeys() {
return this.store.getHalfCheckedKeys();
},
/**
* @description: setCurrentNode
* @param {*} node
* @author: renchao
*/
setCurrentNode(node) {
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentNode');
this.store.setUserCurrentNode(node);
},
/**
* @description: setCurrentKey
* @param {*} key
* @author: renchao
*/
setCurrentKey(key) {
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in setCurrentKey');
this.store.setCurrentNodeKey(key);
},
/**
* @description: getNode
* @param {*} data
* @author: renchao
*/
getNode(data) {
return this.store.getNode(data);
},
/**
* @description: remove
* @param {*} data
* @author: renchao
*/
remove(data) {
this.store.remove(data);
},
/**
* @description: append
* @param {*} data
* @param {*} parentNode
* @author: renchao
*/
append(data, parentNode) {
this.store.append(data, parentNode);
},
/**
* @description: insertBefore
* @param {*} data
* @param {*} refNode
* @author: renchao
*/
insertBefore(data, refNode) {
this.store.insertBefore(data, refNode);
},
/**
* @description: insertAfter
* @param {*} data
* @param {*} refNode
* @author: renchao
*/
insertAfter(data, refNode) {
this.store.insertAfter(data, refNode);
},
/**
* @description: handleNodeExpand
* @param {*} nodeData
* @param {*} node
* @param {*} instance
* @author: renchao
*/
handleNodeExpand(nodeData, node, instance) {
this.broadcast('ElTreeNode', 'tree-node-expand', node);
this.$emit('node-expand', nodeData, node, instance);
},
/**
* @description: updateKeyChildren
* @param {*} key
* @param {*} data
* @author: renchao
*/
updateKeyChildren(key, data) {
if (!this.nodeKey) throw new Error('[Tree] nodeKey is required in updateKeyChild');
this.store.updateChildren(key, data);
},
/**
* @description: initTabIndex
* @author: renchao
*/
initTabIndex() {
this.treeItems = this.$el.querySelectorAll('.is-focusable[role=treeitem]');
this.checkboxItems = this.$el.querySelectorAll('input[type=checkbox]');
......@@ -291,6 +407,11 @@
this.treeItems[0] && this.treeItems[0].setAttribute('tabindex', 0);
},
/**
* @description: handleKeydown
* @param {*} ev
* @author: renchao
*/
handleKeydown(ev) {
const currentItem = ev.target;
if (currentItem.className.indexOf('el-tree-node') === -1) return;
......@@ -319,6 +440,10 @@
}
},
/**
* @description: created
* @author: renchao
*/
created() {
this.isTree = true;
......
......@@ -36,9 +36,18 @@ export default {
})
},
methods: {
/**
* @description: closeViewer
* @author: renchao
*/
closeViewer () {
this.$emit('close-viewer')
},
/**
* @description: hideCusBtn
* @param {*} e
* @author: renchao
*/
hideCusBtn (e) {
let className = e.target.className
if (className === 'el-icon-download') {
......@@ -48,6 +57,11 @@ export default {
this.downloadImage(imgUrl)
}
},
/**
* @description: downloadImage
* @param {*} imgUrl
* @author: renchao
*/
downloadImage (imgUrl) {
let tmpArr = imgUrl.split('/')
let fileName = tmpArr[tmpArr.length - 1]
......@@ -83,4 +97,4 @@ export default {
/deep/ .el-image-viewer__close {
color: #ffffff;
}
</style>
\ No newline at end of file
</style>
......
......@@ -77,7 +77,11 @@
this.autoCurrentLabel()
},
methods: {
//表格显示隐藏回调
/**
* @description: 表格显示隐藏回调
* @param {*} visible
* @author: renchao
*/
visibleChange (visible) {
if (visible) {
this.formData = {}
......@@ -86,7 +90,10 @@
this.autoCurrentLabel()
}
},
//获取表格数据
/**
* @description: 获取表格数据
* @author: renchao
*/
async getData () {
//表格默认赋值
if (this.multiple) {
......@@ -104,11 +111,17 @@
}
// this.$refs.table.setScrollTop(0)
},
//插糟表单提交
/**
* @description: 插糟表单提交
* @author: renchao
*/
formSubmit () {
this.getData()
},
//自动模拟options赋值
/**
* @description: 自动模拟options赋值
* @author: renchao
*/
autoCurrentLabel () {
this.$nextTick(() => {
if (this.multiple) {
......@@ -122,7 +135,12 @@
}
})
},
//表格勾选事件
/**
* @description: 表格勾选事件
* @param {*} rows
* @param {*} row
* @author: renchao
*/
select (rows, row) {
var isSelect = rows.length && rows.indexOf(row) !== -1
if (isSelect) {
......@@ -134,7 +152,11 @@
this.$emit('update:modelValue', this.defaultValue);
this.$emit('change', this.defaultValue);
},
//表格全选事件
/**
* @description: 表格全选事件
* @param {*} rows
* @author: renchao
*/
selectAll (rows) {
var isAllSelect = rows.length > 0
if (isAllSelect) {
......@@ -156,6 +178,11 @@
this.$emit('update:modelValue', this.defaultValue);
this.$emit('change', this.defaultValue);
},
/**
* @description: click
* @param {*} row
* @author: renchao
*/
click (row) {
if (this.multiple) {
//处理多选点击行
......@@ -168,25 +195,42 @@
this.$emit('change', this.defaultValue);
}
},
//tags删除后回调
/**
* @description: tags删除后回调
* @param {*} tag
* @author: renchao
*/
removeTag (tag) {
var row = this.findRowByKey(tag[this.defaultProps.value])
this.$refs.table.toggleRowSelection(row, false);
this.$emit('update:modelValue', this.defaultValue);
},
//清空后的回调
/**
* @description: 清空后的回调
* @author: renchao
*/
clear () {
this.$emit('update:modelValue', this.defaultValue);
},
// 关键值查询表格数据行
/**
* @description: 关键值查询表格数据行
* @param {*} value
* @author: renchao
*/
findRowByKey (value) {
return this.tableData.find(item => item[this.defaultProps.value] === value)
},
// 触发select隐藏
/**
* @description: 触发select隐藏
* @author: renchao
*/
blur () {
this.$refs.select.blur();
},
// 触发select显示
/**
* @description: 触发select显示
* @author: renchao
*/
focus () {
this.$refs.select.focus();
}
......
/*
* @Description:
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-06-14 15:05:38
*/
......@@ -8,6 +8,10 @@ import Popup from './index.vue'
const PopupBox = Vue.extend(Popup)
let popuping = undefined
/**
* @description: close
* @author: renchao
*/
PopupBox.prototype.close = function () {
// 如果Popup 有引用,则去掉引用
if (popuping) {
......@@ -24,6 +28,14 @@ PopupBox.prototype.close = function () {
}, 300)
}
/**
* @description: Popup1
* @param {*} title
* @param {*} editItem
* @param {*} data
* @param {*} formData
* @author: renchao
*/
const Popup1 = (title, editItem, data, formData) => {
// 如果组件已渲染,则返回即可
if (popuping) {
......
......@@ -73,9 +73,17 @@
}, 300)
},
methods: {
/**
* @description: onCancel
* @author: renchao
*/
onCancel () {
Popup1().close()
},
/**
* @description: onConfirm
* @author: renchao
*/
onConfirm () {
let res = new Promise((resolve, reject) => {
this.confirm()
......@@ -85,6 +93,11 @@
this.isShow = false
}
},
/**
* @description: loadViewFn
* @param {*} view
* @author: renchao
*/
loadViewFn (view) {
return (r) =>
require.ensure([], () =>
......@@ -184,4 +197,3 @@
opacity: 0;
}
</style>
\ No newline at end of file
......
export const theme = {
/**
* @description: bind
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @author: renchao
*/
bind: function (el, binding, vnode) {
setEleStyleColorAttribute(el, binding);
},
/**
* @description: update
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @author: renchao
*/
update: function (el, binding, vnode) {
setEleStyleColorAttribute(el, binding);
},
/**
* @description: componentUpdated
* @param {*} el
* @param {*} binding
* @param {*} vnode
* @author: renchao
*/
componentUpdated: function (el, binding, vnode) {
setEleStyleColorAttribute(el, binding);
}
......@@ -16,4 +37,4 @@ function setEleStyleColorAttribute (el, binding) {
if (background) el.style['background-color'] = value;
if (font) el.style.color = value;
if (border) el.style['border-color'] = value;
}
\ No newline at end of file
}
......
......@@ -57,6 +57,10 @@
window.removeEventListener('message')
},
methods: {
/**
* @description: queryNoticeList
* @author: renchao
*/
queryNoticeList () {
getHomeNoticeList().then(res => {
if (res.result) {
......@@ -64,6 +68,10 @@
}
})
},
/**
* @description: logout
* @author: renchao
*/
logout () {
axios.post(window._config.services.management + "/management/logout").then(() => {
setToken(undefined)
......@@ -73,12 +81,22 @@
})
},
/**
* @description: themeChange
* @param {*} val
* @author: renchao
*/
themeChange (val) {
this.$store.dispatch('app/updateTheme', val)
},
searchMessageCenter () {
this.$router.push({ name: 'messagecenter' })
},
/**
* @description: handleCommand
* @param {*} command
* @author: renchao
*/
handleCommand (command) {
if (command == 'a') {
//个人中心
......
......@@ -10,6 +10,10 @@ export default {
this.fixBugIniOS()
},
methods: {
/**
* @description: fixBugIniOS
* @author: renchao
*/
fixBugIniOS() {
const $subMenu = this.$refs.subMenu
if ($subMenu) {
......
......@@ -26,6 +26,11 @@ export default {
}
},
methods: {
/**
* @description: linkProps
* @param {*} to
* @author: renchao
*/
linkProps(to) {
if (this.isExternal) {
return {
......
......@@ -53,6 +53,12 @@ export default {
return {}
},
methods: {
/**
* @description: hasOneShowingChild
* @param {*} children
* @param {*} parent
* @author: renchao
*/
hasOneShowingChild (children = [], parent) {
const showingChildren = children.filter(item => {
if (item.hidden) {
......@@ -75,6 +81,11 @@ export default {
}
return false
},
/**
* @description: resolvePath
* @param {*} routePath
* @author: renchao
*/
resolvePath (routePath) {
if (isExternal(routePath)) {
return routePath
......@@ -86,4 +97,4 @@ export default {
}
}
}
</script>
\ No newline at end of file
</script>
......
......@@ -26,14 +26,28 @@ export default {
this.scrollWrapper.removeEventListener('scroll', this.emitScroll)
},
methods: {
/**
* @description: handleScroll
* @param {*} e
* @author: renchao
*/
handleScroll (e) {
const eventDelta = e.wheelDelta || -e.deltaY * 40
const $scrollWrapper = this.scrollWrapper
$scrollWrapper.scrollLeft = $scrollWrapper.scrollLeft + eventDelta / 4
},
/**
* @description: emitScroll
* @author: renchao
*/
emitScroll () {
this.$emit('scroll')
},
/**
* @description: moveToTarget
* @param {*} currentTag
* @author: renchao
*/
moveToTarget (currentTag) {
const $container = this.$refs.scrollContainer.$el
const $containerWidth = $container.offsetWidth
......
......@@ -59,12 +59,28 @@
this.addTags()
},
methods: {
/**
* @description: isActive
* @param {*} route
* @author: renchao
*/
isActive (route) {
return route.path === this.$route.path
},
/**
* @description: isAffix
* @param {*} tag
* @author: renchao
*/
isAffix (tag) {
return tag.meta && tag.meta.affix
},
/**
* @description: filterAffixTags
* @param {*} routes
* @param {*} basePath
* @author: renchao
*/
filterAffixTags (routes, basePath = '/') {
let tags = []
routes.forEach(route => {
......@@ -86,6 +102,10 @@
})
return tags
},
/**
* @description: initTags
* @author: renchao
*/
initTags () {
const affixTags = this.affixTags = this.filterAffixTags(this.routes)
for (const tag of affixTags) {
......@@ -95,6 +115,10 @@
}
}
},
/**
* @description: addTags
* @author: renchao
*/
addTags () {
const { name } = this.$route
if (name) {
......@@ -102,6 +126,10 @@
}
return false
},
/**
* @description: moveToCurrentTag
* @author: renchao
*/
moveToCurrentTag () {
const tags = this.$refs.tag
this.$nextTick(() => {
......@@ -117,6 +145,11 @@
}
})
},
/**
* @description: refreshSelectedTag
* @param {*} view
* @author: renchao
*/
refreshSelectedTag (view) {
this.$store.dispatch('tagsView/delCachedView', view).then(() => {
const { fullPath } = view
......@@ -127,6 +160,11 @@
})
})
},
/**
* @description: closeSelectedTag
* @param {*} view
* @author: renchao
*/
closeSelectedTag (view) {
this.$store.dispatch('tagsView/delView', view).then(({ visitedViews }) => {
if (this.isActive(view)) {
......@@ -134,12 +172,21 @@
}
})
},
/**
* @description: closeOthersTags
* @author: renchao
*/
closeOthersTags () {
this.$router.push(this.selectedTag)
this.$store.dispatch('tagsView/delOthersViews', this.selectedTag).then(() => {
this.moveToCurrentTag()
})
},
/**
* @description: closeAllTags
* @param {*} view
* @author: renchao
*/
closeAllTags (view) {
this.$store.dispatch('tagsView/delAllViews').then(({ visitedViews }) => {
if (this.affixTags.some(tag => tag.path === view.path)) {
......@@ -148,6 +195,12 @@
this.toLastView(visitedViews, view)
})
},
/**
* @description: toLastView
* @param {*} visitedViews
* @param {*} view
* @author: renchao
*/
toLastView (visitedViews, view) {
const latestView = visitedViews.slice(-1)[0]
if (latestView) {
......@@ -163,6 +216,12 @@
}
}
},
/**
* @description: openMenu
* @param {*} tag
* @param {*} e
* @author: renchao
*/
openMenu (tag, e) {
// const menuMinWidth = 105
// const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
......@@ -179,9 +238,17 @@
this.visible = true
this.selectedTag = tag
},
/**
* @description: closeMenu
* @author: renchao
*/
closeMenu () {
this.visible = false
},
/**
* @description: handleScroll
* @author: renchao
*/
handleScroll () {
this.closeMenu()
}
......
......@@ -27,10 +27,18 @@ export default {
methods: {
// use $_ for mixins properties
// https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential
/**
* @description: $_isMobile
* @author: renchao
*/
$_isMobile() {
const rect = body.getBoundingClientRect()
return rect.width - 1 < WIDTH
},
/**
* @description: $_resizeHandler
* @author: renchao
*/
$_resizeHandler() {
if (!document.hidden) {
const isMobile = this.$_isMobile()
......
......@@ -20,6 +20,10 @@ const mutations = {
}
const actions = {
/**
* @description: generateDic
* @author: renchao
*/
generateDic ({ commit }) {
return new Promise(async (resolve) => {
let { result: res } = await getAllDict()
......@@ -27,6 +31,10 @@ const actions = {
resolve(true)
})
},
/**
* @description: resetdict
* @author: renchao
*/
resetdict ({ commit }) {
commit('RESET_DICT')
}
......
......@@ -6,7 +6,7 @@
import Layout from '@/layout'
/**
* @description:
* @description:
* @param {*} routers
* @author: renchao
*/
......@@ -30,6 +30,11 @@ export default function filterAsyncRouter (routers) {
})
return routers
}
/**
* @description: loadView
* @param {*} view
* @author: renchao
*/
function loadView (view) {
return r => require.ensure([], () => r(require(`@/views${view}.vue`)))
}
\ No newline at end of file
}
......
......@@ -2,7 +2,18 @@ import {loadModules} from 'esri-loader'
export default {
methods: {
/**
* @description: identify
* @param {*} url
* @param {*} layerIds
* @param {*} geometry
* @param {*} callBackFunction
* @param {*} returnGeometry
* @param {*} layerOption
* @param {*} tolerance
* @param {*} mapExtent
* @author: renchao
*/
identify(url,layerIds,geometry,callBackFunction,returnGeometry,layerOption,tolerance,mapExtent){
var self = this;
loadModules([
......@@ -19,7 +30,7 @@ export default {
identifyParameters.geometry = geometry;
if(layerIds){
identifyParameters.layerIds = layerIds;
}
}
identifyParameters.layerOption = layerOption ? layerOption : "all";
identifyParameters.tolerance = tolerance ? tolerance : 3;
identifyParameters.mapExtent = mapExtent ? mapExtent : geometry.extent;
......@@ -34,7 +45,7 @@ export default {
}).catch(err => {
throw(err);
});
}
}
}
\ No newline at end of file
}
......
import {maps} from '@/libs/map/mapUtils'
import {maps} from '@/libs/map/mapUtils'
import {loadModules} from 'esri-loader'
export default {
......@@ -10,6 +10,14 @@ export default {
}
},
methods: {
/**
* @description: initDraw
* @param {*} type
* @param {*} viewId
* @param {*} creationMode
* @param {*} callBackFunction
* @author: renchao
*/
initDraw(type,viewId,creationMode,callBackFunction){
var self = this;
loadModules([
......@@ -46,17 +54,21 @@ export default {
if(callBackFunction && typeof callBackFunction == 'function'){
callBackFunction(event.graphic.geometry);
}
}
})
}).catch(err=>{
throw(err);
});
},
/**
* @description: destroyeDraw
* @author: renchao
*/
destroyeDraw() {
if(this.drawAction){
this.drawAction.cancel();
}
}
}
}
\ No newline at end of file
}
......
......@@ -5,6 +5,13 @@ import {loadModules} from "esri-loader"
export default {
methods:{
/**
* @description: addGraphic
* @param {*} url
* @param {*} graphic
* @param {*} callBackFunction
* @author: renchao
*/
addGraphic(url,graphic,callBackFunction){
loadModules([
"esri/layers/FeatureLayer",
......@@ -57,6 +64,13 @@ export default {
throw (err);
})
},
/**
* @description: updateGraphic
* @param {*} url
* @param {*} graphic
* @param {*} callBackFunction
* @author: renchao
*/
updateGraphic(url,graphic,callBackFunction){
loadModules([
"esri/layers/FeatureLayer",
......@@ -107,6 +121,13 @@ export default {
throw (err);
})
},
/**
* @description: delGraphic
* @param {*} url
* @param {*} graphic
* @param {*} callBackFunction
* @author: renchao
*/
delGraphic(url,graphic,callBackFunction){
loadModules([
"esri/layers/FeatureLayer",
......@@ -160,4 +181,4 @@ export default {
})
}
}
}
\ No newline at end of file
}
......
......@@ -3,6 +3,16 @@ import {loadModules} from 'esri-loader'
export default {
methods:{
/**
* @description: findByPro
* @param {*} url
* @param {*} layerIds
* @param {*} searchFields
* @param {*} searchText
* @param {*} returnGeometry
* @param {*} callBackFunction
* @author: renchao
*/
findByPro(url,layerIds,searchFields,searchText,returnGeometry,callBackFunction){
loadModules([
"esri/tasks/FindTask",
......@@ -32,4 +42,4 @@ export default {
}
}
}
\ No newline at end of file
}
......
......@@ -9,6 +9,12 @@
}
},
methods: {
/**
* @description: measure
* @param {*} viewId
* @param {*} type
* @author: renchao
*/
measure(viewId,type){
var view = maps[viewId];
var self = this;
......@@ -35,8 +41,8 @@
view: view
});
}
// skip the initial 'new measurement' button
self.areaActive.viewModel.start();
break;
......@@ -59,4 +65,4 @@
}
}
}
\ No newline at end of file
}
......
......@@ -4,6 +4,17 @@ import {loadModules} from 'esri-loader'
export default{
methods: {
/**
* @description: queryByWhere
* @param {*} url
* @param {*} queryWhere
* @param {*} geometry
* @param {*} returnGeometry
* @param {*} outFields
* @param {*} outSpatialReference
* @param {*} callBackFunction
* @author: renchao
*/
queryByWhere(url,queryWhere,geometry,returnGeometry,outFields ,outSpatialReference ,callBackFunction){
var self = this;
loadModules([
......@@ -55,6 +66,11 @@ export default{
throw(err);
})
},
/**
* @description: parseObj2Arr
* @param {*} object
* @author: renchao
*/
parseObj2Arr(object){
var arr = [];
for(var key in object){
......@@ -64,6 +80,6 @@ export default{
arr.push(obj);
}
return arr;
}
}
},
}
......
......@@ -4,8 +4,14 @@ export default{
methods: {
/**
* @description: readShpByFile
* @param {*} file
* @param {*} callBackFunction
* @author: renchao
*/
readShpByFile(file,callBackFunction){
var reader = new FileReader();
var reader = new FileReader();
reader.readAsBinaryString(file);
reader.οnlοad=function(){
var fileData = this.result ; //fileData就是读取到的文件的二进制数据
......@@ -20,6 +26,12 @@ export default{
.catch(error => console.error(error.stack));
}
},
/**
* @description: readShpByFile
* @param {*} url
* @param {*} callBackFunction
* @author: renchao
*/
readShpByUrl(url,callBackFunction){
open(url).then(source => source.read()
.then(function log(result) {
......@@ -32,8 +44,14 @@ export default{
.catch(error => console.error(error.stack));
}
},
/**
* @description: readShpByZip
* @param {*} zipUrl
* @param {*} callBackFunction
* @author: renchao
*/
readShpByZip(zipUrl,callBackFunction){
}
}
\ No newline at end of file
}
......
......@@ -21,12 +21,21 @@ export default {
this.handleSearch()
},
methods: {
/**
* @description: handkeyCode
* @param {*} e
* @author: renchao
*/
handkeyCode(e) {
if(e.keyCode === 13){
console.log("安");
this.handleSearch()
}
},
/**
* @description: handleSearch
* @author: renchao
*/
handleSearch(){
this.pageData.currentPage = 1
if (this.fetchData) {
......@@ -36,22 +45,41 @@ export default {
this.queryClick()
}
},
/**
* @description: handleSizeChange
* @param {*} val
* @author: renchao
*/
handleSizeChange (val) {
this.pageData.currentPage = 1
this.pageData.pageSize = val
this.queryClick()
},
/**
* @description: handleCurrentChange
* @param {*} val
* @author: renchao
*/
handleCurrentChange (val) {
this.pageData.currentPage = val
if (this.queryClick) {
this.queryClick()
}
},
/**
* @description: handleDel
* @author: renchao
*/
handleDel () {
let deleteAfterPage = Math.ceil((this.tableData.total - 1) / this.pageData.pageSize)
let currentPage = this.pageData.currentPage > deleteAfterPage ? deleteAfterPage : this.pageData.currentPage
this.pageData.currentPage = currentPage < 1 ? 1 : currentPage
},
/**
* @description: resetForm
* @param {*} isYwbl
* @author: renchao
*/
resetForm(isYwbl){
if (isYwbl) {
this.queryForm = defaultParameters.defaultParameters();
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-07-20 13:40:27
-->
<template>
<dialogBox title="配置常办项目" @submitForm="submitForm" saveButton="保存" :isFullscreen="false" width="50%"
@closeDialog="closeDialog" v-model="myValue">
......@@ -6,103 +11,103 @@
</dialogBox>
</template>
<script>
import { getMenuInfo } from "@/api/user.js";
import Tree from "@/components/Tree/src/tree.vue"
import { saveFrequentProjectsList, getHomeFrequentProjects } from "@/api/home.js";
export default {
components: {
Tree
},
props: {
value: { type: Boolean, default: false },
bindItem: { type: Array, default: [] }
},
data () {
return {
myValue: false,
defaultCheckeds: [],
projectList: [],
checkedItem: [],
defaultProps: {
children: "children",
label: "name",
disabled: function (data, node) {
if (data.children && data.children.length > 0) {
return true
} else {
return false
import { getMenuInfo } from "@/api/user.js";
import Tree from "@/components/Tree/src/tree.vue"
import { saveFrequentProjectsList, getHomeFrequentProjects } from "@/api/home.js";
export default {
components: {
Tree
},
props: {
value: { type: Boolean, default: false },
bindItem: { type: Array, default: [] }
},
data () {
return {
myValue: false,
defaultCheckeds: [],
projectList: [],
checkedItem: [],
defaultProps: {
children: "children",
label: "name",
disabled: function (data, node) {
if (data.children && data.children.length > 0) {
return true
} else {
return false
}
}
}
},
uniqueValue: ''//最后拿到的唯一选择的moduldCode值,相当于id
}
},
watch: {
value (val) {
this.myValue = val
if (val) {
this.queryClick()
},
uniqueValue: ''//最后拿到的唯一选择的moduldCode值,相当于id
}
}
},
mounted () {
this.dealCheckedItem();
},
methods: {
submitForm () {
var checkedNodes = this.$refs.tree.getCheckedNodes();
if (checkedNodes.length > 6) {
this.$message.error("最多选择6个项目!");
return
}
saveFrequentProjectsList(checkedNodes).then(res => {
if (res.code == 200) {
this.$parent.queryProjectList();
this.$message.success("保存成功");
this.$emit("input", false);
} else {
this.$message.error(res.message);
}
})
},
queryClick () {
let that = this
getMenuInfo().then(res => {
this.projectList = res.result.slice(0, -2)
})
function lookForAllId (arr = []) {
for (let item of that.bindItem) {
arr.push(item.id)
if (item.children && item.children.length) lookForAllId(item.children, arr)
watch: {
value (val) {
this.myValue = val
if (val) {
this.queryClick()
}
return arr
}
this.defaultCheckeds = lookForAllId()
},
dealCheckedItem () {
mounted () {
this.dealCheckedItem();
},
//关闭窗口
closeDialog () {
this.$emit("input", false);
},
//节点选择状态发生改变时
handleClick (data, checked, node) {
var checkedNodes = this.$refs.tree.getCheckedNodes();
if (checkedNodes.length > 6) {
this.$message({
message: '最后选择6条数据',
type: 'warning',
customClass: 'messageIndex'
methods: {
submitForm () {
var checkedNodes = this.$refs.tree.getCheckedNodes();
if (checkedNodes.length > 6) {
this.$message.error("最多选择6个项目!");
return
}
saveFrequentProjectsList(checkedNodes).then(res => {
if (res.code == 200) {
this.$parent.queryProjectList();
this.$message.success("保存成功");
this.$emit("input", false);
} else {
this.$message.error(res.message);
}
})
},
queryClick () {
let that = this
getMenuInfo().then(res => {
this.projectList = res.result.slice(0, -2)
})
this.$refs.tree.setChecked(data, false) // 取消当前节点的选中状态
function lookForAllId (arr = []) {
for (let item of that.bindItem) {
arr.push(item.id)
if (item.children && item.children.length) lookForAllId(item.children, arr)
}
return arr
}
this.defaultCheckeds = lookForAllId()
},
dealCheckedItem () {
},
//关闭窗口
closeDialog () {
this.$emit("input", false);
},
//节点选择状态发生改变时
handleClick (data, checked, node) {
var checkedNodes = this.$refs.tree.getCheckedNodes();
if (checkedNodes.length > 6) {
this.$message({
message: '最后选择6条数据',
type: 'warning',
customClass: 'messageIndex'
})
this.$refs.tree.setChecked(data, false) // 取消当前节点的选中状态
}
}
}
}
}
</script>
<style scoped lang='scss'>
/deep/.el-tree-node.is-expanded>.el-tree-node__children {
display: flex;
flex-wrap: wrap;
}
/deep/.el-tree-node.is-expanded > .el-tree-node__children {
display: flex;
flex-wrap: wrap;
}
</style>
......
<!--
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-07-20 13:40:32
-->
<template>
<div class="model">
<div class="mask">123</div>
......@@ -18,71 +23,71 @@
<style scoped lang='scss'>
//css部分
.mask {
position: fixed; //这里用固定定位,后面设置动画时才不受影响
top: 0;
height: 100%;
width: 100%;
background-color: rgba(167, 165, 165, 0.486);
opacity: 0.5;
z-index: 9;
}
.model-dialog {
position: absolute;
//让弹框居中显示
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #fff;
border-radius: 12px;
width: 600px;
height: 300px;
border: 1px solid #f5f5f5;
overflow: hidden;
z-index: 10; //这里注意层级要比mask大,覆盖它
}
.model-header {
position: relative;
height: 50px;
padding-left: 10px;
padding-top: 10px;
font-size: 20px;
line-height: 50px;
background-color: #f5f5f5;
border-bottom: 1px solid rgb(177, 176, 176);
}
.model-body {
height: 150px;
line-height: 150px;
font-size: 28px;
text-align: center;
background-color: #fff;
}
.model-footer {
background-color: #f5f5f5;
height: 100px;
text-align: center;
line-height: 100px;
}
.btn {
width: 180px;
height: 40px;
border-radius: 8px;
background-color: rgb(180, 103, 103);
color: #fff;
font-size: 18px;
border: none;
}
.icon-close {
position: absolute; //如果不加绝对布局,图表显示不出来
background-color: pink;
right: 15px;
top: 16px;
width: 30px;
height: 30px;
z-index: 10;
//background: url("../assets/icon-close.png") no-repeat;
background-size: contain;
}
//css部分
.mask {
position: fixed; //这里用固定定位,后面设置动画时才不受影响
top: 0;
height: 100%;
width: 100%;
background-color: rgba(167, 165, 165, 0.486);
opacity: 0.5;
z-index: 9;
}
.model-dialog {
position: absolute;
//让弹框居中显示
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
background-color: #fff;
border-radius: 12px;
width: 600px;
height: 300px;
border: 1px solid #f5f5f5;
overflow: hidden;
z-index: 10; //这里注意层级要比mask大,覆盖它
}
.model-header {
position: relative;
height: 50px;
padding-left: 10px;
padding-top: 10px;
font-size: 20px;
line-height: 50px;
background-color: #f5f5f5;
border-bottom: 1px solid rgb(177, 176, 176);
}
.model-body {
height: 150px;
line-height: 150px;
font-size: 28px;
text-align: center;
background-color: #fff;
}
.model-footer {
background-color: #f5f5f5;
height: 100px;
text-align: center;
line-height: 100px;
}
.btn {
width: 180px;
height: 40px;
border-radius: 8px;
background-color: rgb(180, 103, 103);
color: #fff;
font-size: 18px;
border: none;
}
.icon-close {
position: absolute; //如果不加绝对布局,图表显示不出来
background-color: pink;
right: 15px;
top: 16px;
width: 30px;
height: 30px;
z-index: 10;
//background: url("../assets/icon-close.png") no-repeat;
background-size: contain;
}
</style>
\ No newline at end of file
......
......@@ -147,7 +147,8 @@
if (this.supplementarylist.length) {
this.unitClick(0)
} else {
this.$emit("getCurrentSelectProps", this.currentSelectProps);
this.loadBdcdylist()
// this.$emit("getCurrentSelectProps", this.currentSelectProps);
}
});
},
......@@ -179,7 +180,6 @@
});
this.$nextTick(() => {
this.getleftMenubl();
this.blxxClick()
if (!this.supplementarylist.length) {
getdjblist()
}
......@@ -285,5 +285,8 @@
height: 27px;
float: left;
}
.el-icon-delete:hover{
color: #0079fe;
}
}
</style>
......
......@@ -6,44 +6,123 @@
<template>
<div>
<div class="process-viewer">
<div v-show="!isLoading" ref="processCanvas" class="process-canvas" style="height: 280px;" />
<div
v-show="!isLoading"
ref="processCanvas"
class="process-canvas"
style="height: 280px"
/>
<!-- 自定义箭头样式,用于成功状态下流程连线箭头 -->
<defs ref="customSuccessDefs">
<marker id="sequenceflow-end-white-success" view-box="0 0 20 20" ref-x="11" ref-y="10" marker-width="10"
marker-height="10" orient="auto">
<path class="success-arrow" d="M 1 5 L 11 10 L 1 15 Z"
style="stroke-width: 1px; stroke-linecap: round; stroke-dasharray: 10000, 1;" />
<marker
id="sequenceflow-end-white-success"
view-box="0 0 20 20"
ref-x="11"
ref-y="10"
marker-width="10"
marker-height="10"
orient="auto"
>
<path
class="success-arrow"
d="M 1 5 L 11 10 L 1 15 Z"
style="
stroke-width: 1px;
stroke-linecap: round;
stroke-dasharray: 10000, 1;
"
/>
</marker>
<marker id="conditional-flow-marker-white-success" view-box="0 0 20 20" ref-x="-1" ref-y="10" marker-width="10"
marker-height="10" orient="auto">
<path class="success-conditional" d="M 0 10 L 8 6 L 16 10 L 8 14 Z"
style="stroke-width: 1px; stroke-linecap: round; stroke-dasharray: 10000, 1;" />
<marker
id="conditional-flow-marker-white-success"
view-box="0 0 20 20"
ref-x="-1"
ref-y="10"
marker-width="10"
marker-height="10"
orient="auto"
>
<path
class="success-conditional"
d="M 0 10 L 8 6 L 16 10 L 8 14 Z"
style="
stroke-width: 1px;
stroke-linecap: round;
stroke-dasharray: 10000, 1;
"
/>
</marker>
</defs>
<!-- 自定义箭头样式,用于失败状态下流程连线箭头 -->
<defs ref="customFailDefs">
<marker id="sequenceflow-end-white-fail" view-box="0 0 20 20" ref-x="11" ref-y="10" marker-width="10"
marker-height="10" orient="auto">
<path class="fail-arrow" d="M 1 5 L 11 10 L 1 15 Z"
style="stroke-width: 1px; stroke-linecap: round; stroke-dasharray: 10000, 1;" />
<marker
id="sequenceflow-end-white-fail"
view-box="0 0 20 20"
ref-x="11"
ref-y="10"
marker-width="10"
marker-height="10"
orient="auto"
>
<path
class="fail-arrow"
d="M 1 5 L 11 10 L 1 15 Z"
style="
stroke-width: 1px;
stroke-linecap: round;
stroke-dasharray: 10000, 1;
"
/>
</marker>
<marker id="conditional-flow-marker-white-fail" view-box="0 0 20 20" ref-x="-1" ref-y="10" marker-width="10"
marker-height="10" orient="auto">
<path class="fail-conditional" d="M 0 10 L 8 6 L 16 10 L 8 14 Z"
style="stroke-width: 1px; stroke-linecap: round; stroke-dasharray: 10000, 1;" />
<marker
id="conditional-flow-marker-white-fail"
view-box="0 0 20 20"
ref-x="-1"
ref-y="10"
marker-width="10"
marker-height="10"
orient="auto"
>
<path
class="fail-conditional"
d="M 0 10 L 8 6 L 16 10 L 8 14 Z"
style="
stroke-width: 1px;
stroke-linecap: round;
stroke-dasharray: 10000, 1;
"
/>
</marker>
</defs>
<div style="position: absolute; top: 0px; left: 0px; width: 100%;">
<div style="position: absolute; top: 0px; left: 0px; width: 100%">
<el-row type="flex" justify="end">
<el-button-group key="scale-control" size="medium">
<el-button size="medium" type="default" :plain="true" :disabled="defaultZoom <= 0.3" icon="el-icon-zoom-out"
@click="processZoomOut()" />
<el-button size="medium" type="default" style="width: 90px;">{{ Math.floor(this.defaultZoom * 10 * 10) + "%"
<el-button
size="medium"
type="default"
:plain="true"
:disabled="defaultZoom <= 0.3"
icon="el-icon-zoom-out"
@click="processZoomOut()"
/>
<el-button size="medium" type="default" style="width: 90px">{{
Math.floor(this.defaultZoom * 10 * 10) + "%"
}}</el-button>
<el-button size="medium" type="default" :plain="true" :disabled="defaultZoom >= 3.9" icon="el-icon-zoom-in"
@click="processZoomIn()" />
<el-button size="medium" type="default" icon="el-icon-c-scale-to-original" @click="processReZoom()" />
<el-button
size="medium"
type="default"
:plain="true"
:disabled="defaultZoom >= 3.9"
icon="el-icon-zoom-in"
@click="processZoomIn()"
/>
<el-button
size="medium"
type="default"
icon="el-icon-c-scale-to-original"
@click="processReZoom()"
/>
<slot />
</el-button-group>
</el-row>
......@@ -52,285 +131,396 @@
<!-- 已完成节点悬浮弹窗 -->
<div class="information-list">
<el-select v-model="selectValue" @change="handleSelect">
<el-option v-for="item in selectOptions" :key="item.value" :label="item.label" :value="item.value">
<el-option
v-for="item in selectOptions"
:key="item.value"
:label="item.label"
:value="item.value"
>
</el-option>
</el-select>
<el-table height="190" :data="taskCommentList" size="mini" border header-cell-class-name="table-header-gray">
<el-table-column label="序号" header-align="center" align="center" type="index" width="55px" />
<el-table
height="190"
:data="taskCommentList"
size="mini"
border
header-cell-class-name="table-header-gray"
>
<el-table-column
label="序号"
header-align="center"
align="center"
type="index"
width="55px"
/>
<el-table-column label="流程状态" header-align="center" align="center">
<template slot-scope="scope">
<div v-if="scope.row.endTime">已完结</div>
<div v-else>正在办理</div>
</template>
</el-table-column>
<el-table-column label="环节名称" prop="name" minWidth="100" align="center" />
<el-table-column label="办理人" prop="agent" minWidth="120" align="center" />
<el-table-column label="转入时间" prop="createTime" :formatter="formatDate" width="160" align="center" />
<el-table-column label="认领时间" prop="claimTime" :formatter="formatDate" width="160" align="center" />
<el-table-column label="转出时间" prop="endTime" :formatter="formatDate" width="160" align="center" />
<el-table-column label="操作方式" prop="controls" align="center"/>
<el-table-column label="意见" prop="idea" align="center"/>
<el-table-column
label="环节名称"
prop="name"
minWidth="100"
align="center"
/>
<el-table-column
label="办理人"
prop="agent"
minWidth="120"
align="center"
/>
<el-table-column
label="转入时间"
prop="createTime"
:formatter="formatDate"
width="160"
align="center"
/>
<el-table-column
label="认领时间"
prop="claimTime"
:formatter="formatDate"
width="160"
align="center"
/>
<el-table-column
label="转出时间"
prop="endTime"
:formatter="formatDate"
width="160"
align="center"
/>
<el-table-column label="操作方式" prop="controls" align="center" />
<el-table-column label="意见" prop="idea" align="center" />
</el-table>
</div>
</div>
</template>
<script>
import '@/styles/package/theme/index.scss'
import BpmnViewer from 'bpmn-js/lib/Viewer'
import MoveCanvasModule from 'diagram-js/lib/navigation/movecanvas'
export default {
props: {
formData: {
type: Object,
default: {}
import "@/styles/package/theme/index.scss";
import BpmnViewer from "bpmn-js/lib/Viewer";
import MoveCanvasModule from "diagram-js/lib/navigation/movecanvas";
export default {
props: {
formData: {
type: Object,
default: {},
},
},
data() {
return {
dlgTitle: undefined,
defaultZoom: 1,
// 是否正在加载流程图
isLoading: true,
bpmnViewer: undefined,
// 已完成流程元素
processNodeInfo: undefined,
// 当前任务id
selectTaskId: undefined,
// 任务节点审批记录
taskList: [],
taskCommentList: [],
// 已完成任务悬浮延迟Timer
hoverTimer: null,
// 下拉
selectValue: "",
selectOptions: [],
};
},
created() {
this.$nextTick(() => {
// 获取流程记录
this.getCommentList();
this.setProcessStatus(this.formData.finishedInfo);
this.importXML(this.formData.xml);
});
},
destroyed() {
this.clearViewer();
},
methods: {
formatDate(row, column) {
let data = row[column.property];
if (data == null) {
return null;
}
let dt = new Date(data);
return (
dt.getFullYear() +
"-" +
(dt.getMonth() + 1) +
"-" +
dt.getDate() +
" " +
dt.getHours() +
":" +
dt.getMinutes() +
":" +
dt.getSeconds()
);
},
processReZoom() {
this.defaultZoom = 1;
this.bpmnViewer.get("canvas").zoom("fit-viewport", "auto");
},
data () {
return {
dlgTitle: undefined,
defaultZoom: 1,
// 是否正在加载流程图
isLoading: true,
bpmnViewer: undefined,
// 已完成流程元素
processNodeInfo: undefined,
// 当前任务id
selectTaskId: undefined,
// 任务节点审批记录
taskList:[],
taskCommentList: [],
// 已完成任务悬浮延迟Timer
hoverTimer: null,
// 下拉
selectValue: '',
selectOptions: []
processZoomIn(zoomStep = 0.1) {
const newZoom = Math.floor(this.defaultZoom * 100 + zoomStep * 100) / 100;
if (newZoom > 4) {
throw new Error(
"[Process Designer Warn ]: The zoom ratio cannot be greater than 4"
);
}
this.defaultZoom = newZoom;
this.bpmnViewer.get("canvas").zoom(this.defaultZoom);
},
created () {
this.$nextTick(() => {
// 获取流程记录
this.getCommentList()
this.setProcessStatus(this.formData.finishedInfo);
this.importXML(this.formData.xml)
})
processZoomOut(zoomStep = 0.1) {
const newZoom = Math.floor(this.defaultZoom * 100 - zoomStep * 100) / 100;
if (newZoom < 0.2) {
throw new Error(
"[Process Designer Warn ]: The zoom ratio cannot be scss than 0.2"
);
}
this.defaultZoom = newZoom;
this.bpmnViewer.get("canvas").zoom(this.defaultZoom);
},
destroyed () {
this.clearViewer()
getOperationTagType(type) {
return "success";
},
methods: {
formatDate(row, column) {
let data = row[column.property]
if(data == null) {
return null
}
let dt = new Date(data)
return dt.getFullYear() + '-' + (dt.getMonth() + 1) + '-' + dt.getDate() + ' ' + dt.getHours() + ':' + dt.getMinutes() + ':' + dt.getSeconds()
},
processReZoom () {
this.defaultZoom = 1
this.bpmnViewer.get('canvas').zoom('fit-viewport', 'auto')
},
processZoomIn (zoomStep = 0.1) {
const newZoom = Math.floor(this.defaultZoom * 100 + zoomStep * 100) / 100
if (newZoom > 4) {
throw new Error('[Process Designer Warn ]: The zoom ratio cannot be greater than 4')
}
this.defaultZoom = newZoom
this.bpmnViewer.get('canvas').zoom(this.defaultZoom)
},
processZoomOut (zoomStep = 0.1) {
const newZoom = Math.floor(this.defaultZoom * 100 - zoomStep * 100) / 100
if (newZoom < 0.2) {
throw new Error('[Process Designer Warn ]: The zoom ratio cannot be scss than 0.2')
}
this.defaultZoom = newZoom
this.bpmnViewer.get('canvas').zoom(this.defaultZoom)
},
getOperationTagType (type) {
return 'success'
},
// 流程图预览清空
clearViewer (a) {
if (this.$refs.processCanvas) {
this.$refs.processCanvas.innerHTML = ''
}
if (this.bpmnViewer) {
this.bpmnViewer.destroy()
}
this.bpmnViewer = null
},
// 添加自定义箭头
addCustomDefs () {
const canvas = this.bpmnViewer.get('canvas')
const svg = canvas._svg
const customSuccessDefs = this.$refs.customSuccessDefs
const customFailDefs = this.$refs.customFailDefs
svg.appendChild(customSuccessDefs)
svg.appendChild(customFailDefs)
},
// 任务悬浮弹窗
onSelectElement (element) {
this.selectTaskId = undefined
this.dlgTitle = undefined
let allfinishedTaskSet = [...this.processNodeInfo.finishedTaskSet, ...this.processNodeInfo.unfinishedTaskSet]
if (this.processNodeInfo == null || allfinishedTaskSet == null)
return
if (element == null || allfinishedTaskSet.indexOf(element.id) === -1) {
return
}
this.selectTaskId = element.id
this.selectValue = element.id
this.dlgTitle = element.businessObject ? element.businessObject.name : undefined
// 计算当前悬浮任务审批记录,如果记录为空不显示弹窗
this.taskCommentList = (this.taskList || []).filter(item => {
return item.taskDefinitionKey === this.selectTaskId
})
if (this.taskCommentList.length==0) {
this.taskCommentList = this.taskList;
}
},
// 下拉列表切换
handleSelect (val) {
this.taskCommentList = (this.taskList || []).filter(item => {
return item.taskDefinitionKey === val
})
if (this.taskCommentList.length==0) {
this.taskCommentList = this.taskList;
}
},
// 显示流程图
async importXML (xml) {
let xmlData = this.$x2js.xml2js(xml).definitions.process;
this.selectOptions = xmlData.userTask.map(item => {
return { value: item._id, label: item._name }
})
this.selectOptions = [{ value: xmlData.startEvent._id, label: '浏览记录' }, ...this.selectOptions]
this.selectOptions = this.selectOptions.map(item => {
// 流程图预览清空
clearViewer(a) {
if (this.$refs.processCanvas) {
this.$refs.processCanvas.innerHTML = "";
}
if (this.bpmnViewer) {
this.bpmnViewer.destroy();
}
this.bpmnViewer = null;
},
// 添加自定义箭头
addCustomDefs() {
const canvas = this.bpmnViewer.get("canvas");
const svg = canvas._svg;
const customSuccessDefs = this.$refs.customSuccessDefs;
const customFailDefs = this.$refs.customFailDefs;
svg.appendChild(customSuccessDefs);
svg.appendChild(customFailDefs);
},
// 任务悬浮弹窗
onSelectElement(element) {
this.selectTaskId = undefined;
this.dlgTitle = undefined;
let allfinishedTaskSet = [
...this.processNodeInfo.finishedTaskSet,
...this.processNodeInfo.unfinishedTaskSet,
];
if (this.processNodeInfo == null || allfinishedTaskSet == null) return;
if (element == null || allfinishedTaskSet.indexOf(element.id) === -1) {
return;
}
this.selectTaskId = element.id;
this.selectValue = element.id;
this.dlgTitle = element.businessObject
? element.businessObject.name
: undefined;
// 计算当前悬浮任务审批记录,如果记录为空不显示弹窗
this.taskCommentList = (this.taskList || []).filter((item) => {
return item.taskDefinitionKey === this.selectTaskId;
});
if (this.taskCommentList.length == 0) {
this.taskCommentList = this.taskList;
}
},
// 下拉列表切换
handleSelect(val) {
this.taskCommentList = (this.taskList || []).filter((item) => {
return item.taskDefinitionKey === val;
});
if (this.taskCommentList.length == 0) {
this.taskCommentList = this.taskList;
}
},
// 显示流程图
async importXML(xml) {
let xmlData = this.$x2js.xml2js(xml).definitions.process;
this.selectOptions = xmlData.userTask.map((item) => {
return { value: item._id, label: item._name };
});
this.selectOptions = [
{ value: xmlData.startEvent._id, label: "浏览记录" },
...this.selectOptions,
];
this.selectOptions = this.selectOptions
.map((item) => {
if (this.formData.finishedInfo.finishedTaskSet.includes(item.value)) {
return item
return item;
}
if (this.formData.finishedInfo.unfinishedTaskSet.includes(item.value)) {
return item
if (
this.formData.finishedInfo.unfinishedTaskSet.includes(item.value)
) {
return item;
}
}).filter(Boolean);
this.selectValue = xmlData.startEvent._id
this.clearViewer('a')
if (xml != null && xml !== '') {
try {
this.bpmnViewer = new BpmnViewer({
additionalModules: [
// 移动整个画布
MoveCanvasModule
],
container: this.$refs.processCanvas
})
// 任务节点悬浮事件
this.bpmnViewer.on('element.click', ({ element }) => {
this.onSelectElement(element)
})
await this.bpmnViewer.importXML(xml)
this.isLoading = true
this.addCustomDefs()
} catch (e) {
this.clearViewer('b')
} finally {
this.isLoading = false
this.setProcessStatus(this.processNodeInfo)
this.$nextTick(() => {
this.processReZoom()
})
}
}
},
// 获取流程记录
getCommentList() {
this.formData.allCommentList.forEach(async (item,index) => {
item.comments.forEach(element => {
if(element.type=="COMPLETE"){
this.formData.allCommentList[index].idea=element.message
this.formData.allCommentList[index].controls="完成"
}
});
this.formData.allCommentList[index].agent=item.assignee.name
})
this.formData.handlinglist.forEach(async (item,index) => {
if(item.assignee.name){
this.formData.handlinglist[index].agent=item.assignee.name
}else{
let str=""
item.countersign.forEach((item) => {
str+=item.name+","
})
str=str.slice(0, -1);
this.formData.allCommentList[index].agent=str
}
})
this.taskList =[...this.formData.allCommentList,...this.formData.handlinglist];
// this.taskList =this.formData.allCommentList;
// 处理数据之后赋值
this.taskCommentList=this.taskList
},
// 设置流程图元素状态
setProcessStatus (processNodeInfo) {
this.processNodeInfo = processNodeInfo
if (this.isLoading || this.processNodeInfo == null || this.bpmnViewer == null) return
const { finishedTaskSet, rejectedTaskSet, unfinishedTaskSet, finishedSequenceFlowSet } = this.processNodeInfo
const canvas = this.bpmnViewer.get('canvas')
const elementRegistry = this.bpmnViewer.get('elementRegistry')
if (Array.isArray(finishedSequenceFlowSet)) {
finishedSequenceFlowSet.forEach(item => {
if (item != null) {
canvas.addMarker(item, 'success')
const element = elementRegistry.get(item)
const conditionExpression = element.businessObject.conditionExpression
if (conditionExpression) {
canvas.addMarker(item, 'condition-expression')
}
}
})
}
if (Array.isArray(finishedTaskSet)) {
finishedTaskSet.forEach(item => canvas.addMarker(item, 'success'))
.filter(Boolean);
this.selectValue = xmlData.startEvent._id;
this.clearViewer("a");
if (xml != null && xml !== "") {
try {
this.bpmnViewer = new BpmnViewer({
additionalModules: [
// 移动整个画布
MoveCanvasModule,
],
container: this.$refs.processCanvas,
});
// 任务节点悬浮事件
this.bpmnViewer.on("element.click", ({ element }) => {
this.onSelectElement(element);
});
await this.bpmnViewer.importXML(xml);
this.isLoading = true;
this.addCustomDefs();
} catch (e) {
this.clearViewer("b");
} finally {
this.isLoading = false;
this.setProcessStatus(this.processNodeInfo);
this.$nextTick(() => {
this.processReZoom();
});
}
if (Array.isArray(unfinishedTaskSet)) {
unfinishedTaskSet.forEach(item => canvas.addMarker(item, 'primary'))
}
},
// 获取流程记录
getCommentList() {
this.formData.allCommentList.forEach(async (item, index) => {
// item.comments.forEach(element => {
// if(element.type=="COMPLETE"){
// this.formData.allCommentList[index].idea=element.message
// this.formData.allCommentList[index].controls="完成"
// }
// });
let type = item.comments[item.comments.length - 1].type;
this.formData.allCommentList[index].idea =
item.comments[item.comments.length - 1].message;
// 操作方式
let controls = "";
switch (type) {
case "COMPLETE":
controls = "完成";
break;
case "CLAIM":
controls = "完成";
break;
case "ASSIGN":
controls = "转办";
break;
case "DELEGATE":
controls = "委派";
break;
case "UNCLAIM":
controls = "取消认领";
break;
case "STOP":
controls = "终止";
break;
case "BACK":
controls = "退回";
break;
}
if (Array.isArray(rejectedTaskSet)) {
rejectedTaskSet.forEach(item => {
if (item != null) {
const element = elementRegistry.get(item)
if (element.type.includes('Task')) {
canvas.addMarker(item, 'danger')
} else {
canvas.addMarker(item, 'warning')
}
}
})
this.formData.allCommentList[index].controls = controls;
this.formData.allCommentList[index].agent = item.assignee.name;
});
this.formData.handlinglist.forEach(async (item, index) => {
if (item.assignee.name) {
this.formData.handlinglist[index].agent = item.assignee.name;
} else {
let str = "";
item.countersign.forEach((item) => {
str += item.name + ",";
});
str = str.slice(0, -1);
this.formData.allCommentList[index].agent = str;
}
});
this.taskList = [
...this.formData.allCommentList,
...this.formData.handlinglist,
];
// this.taskList =this.formData.allCommentList;
// 处理数据之后赋值
this.taskCommentList = this.taskList;
},
// 设置流程图元素状态
setProcessStatus(processNodeInfo) {
this.processNodeInfo = processNodeInfo;
if (
this.isLoading ||
this.processNodeInfo == null ||
this.bpmnViewer == null
)
return;
const {
finishedTaskSet,
rejectedTaskSet,
unfinishedTaskSet,
finishedSequenceFlowSet,
} = this.processNodeInfo;
const canvas = this.bpmnViewer.get("canvas");
const elementRegistry = this.bpmnViewer.get("elementRegistry");
if (Array.isArray(finishedSequenceFlowSet)) {
finishedSequenceFlowSet.forEach((item) => {
if (item != null) {
canvas.addMarker(item, "success");
const element = elementRegistry.get(item);
const conditionExpression =
element.businessObject.conditionExpression;
if (conditionExpression) {
canvas.addMarker(item, "condition-expression");
}
}
});
}
}
}
if (Array.isArray(finishedTaskSet)) {
finishedTaskSet.forEach((item) => canvas.addMarker(item, "success"));
}
if (Array.isArray(unfinishedTaskSet)) {
unfinishedTaskSet.forEach((item) => canvas.addMarker(item, "primary"));
}
if (Array.isArray(rejectedTaskSet)) {
rejectedTaskSet.forEach((item) => {
if (item != null) {
const element = elementRegistry.get(item);
if (element.type.includes("Task")) {
canvas.addMarker(item, "danger");
} else {
canvas.addMarker(item, "warning");
}
}
});
}
},
},
};
</script>
<style scoped lang="scss">
.information-list {
height: 220px;
margin-top: 10px;
.information-list {
height: 220px;
margin-top: 10px;
p {
font-size: 16px;
line-height: 24px;
}
}
/deep/.bjs-powered-by {
display: none;
p {
font-size: 16px;
line-height: 24px;
}
// /deep/.information-list {
// height: 170px;
// overflow: visible;
// }
}
/deep/.bjs-powered-by {
display: none;
}
// /deep/.information-list {
// height: 170px;
// overflow: visible;
// }
</style>
......
......@@ -103,7 +103,7 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<!-- <el-row :gutter="10">
<el-col :span="8">
<el-form-item label="使用期限:">
<el-input v-model="ruleForm.jsydsyq.tdsyqx"></el-input>
......@@ -115,7 +115,7 @@
<el-input v-model="ruleForm.jsydsyq.syqqzsj"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="10">
<el-col>
<el-form-item label="附记:" prop="fj">
......
......@@ -105,7 +105,7 @@
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="10">
<!-- <el-row :gutter="10">
<el-col :span="8">
<el-form-item label="使用期限:">
<el-input disabled v-model="ruleForm.jsydsyq.tdsyqx"></el-input>
......@@ -117,7 +117,7 @@
<el-input disabled v-model="ruleForm.jsydsyq.syqqzsj"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-row> -->
<el-row :gutter="10">
<el-col>
<el-form-item label="附记:" prop="fj">
......