替换var 为const/let

删除未使用import
替换 == 为 ===
This commit is contained in:
xingyu4j
2022-11-08 13:31:08 +08:00
parent c9e11e7636
commit 011dc23699
66 changed files with 305 additions and 319 deletions

View File

@ -2,7 +2,7 @@
<el-breadcrumb class="app-breadcrumb" separator="/">
<transition-group name="breadcrumb">
<el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
<span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
<span v-if="item.redirect==='noRedirect'||index===levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
<a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
</el-breadcrumb-item>
</transition-group>

View File

@ -103,25 +103,25 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'day', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'day', this.averageTotal);
}
},
// 最近工作日值变化时
workdayChange() {
if (this.radioValue == '5') {
if (this.radioValue === '5') {
this.$emit('update', 'day', this.workdayCheck + 'W');
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '7') {
if (this.radioValue === '7') {
this.$emit('update', 'day', this.checkboxString);
}
}
@ -148,13 +148,12 @@ export default {
},
// 计算工作日格式
workdayCheck: function () {
const workday = this.checkNum(this.workday, 1, 31)
return workday;
return this.checkNum(this.workday, 1, 31);
},
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}

View File

@ -68,19 +68,19 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
if (this.radioValue === '2') {
this.$emit('update', 'hour', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'hour', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'hour', this.checkboxString);
}
}
@ -107,7 +107,7 @@ export default {
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}

View File

@ -143,8 +143,8 @@ export default {
props: ["expression", "hideComponent"],
methods: {
shouldHide(key) {
if (this.hideComponent && this.hideComponent.includes(key)) return false;
return true;
return !(this.hideComponent && this.hideComponent.includes(key));
},
resolveExp() {
// 反解析 表达式
@ -215,10 +215,10 @@ export default {
insValue = 4;
this.$refs[refName].checkboxList = value.split(",");
}
} else if (name == "day") {
} else if (name === "day") {
if (value === "*") {
insValue = 1;
} else if (value == "?") {
} else if (value === "?") {
insValue = 2;
} else if (value.indexOf("-") > -1) {
let indexArr = value.split("-");
@ -246,10 +246,10 @@ export default {
this.$refs[refName].checkboxList = value.split(",");
insValue = 7;
}
} else if (name == "week") {
} else if (name === "week") {
if (value === "*") {
insValue = 1;
} else if (value == "?") {
} else if (value === "?") {
insValue = 2;
} else if (value.indexOf("-") > -1) {
let indexArr = value.split("-");
@ -275,10 +275,10 @@ export default {
this.$refs[refName].checkboxList = value.split(",");
insValue = 6;
}
} else if (name == "year") {
if (value == "") {
} else if (name === "year") {
if (value === "") {
insValue = 1;
} else if (value == "*") {
} else if (value === "*") {
insValue = 2;
} else if (value.indexOf("-") > -1) {
insValue = 3;
@ -343,7 +343,7 @@ export default {
obj.month +
" " +
obj.week +
(obj.year == "" ? "" : " " + obj.year);
(obj.year === "" ? "" : " " + obj.year);
return str;
},
},

View File

@ -69,19 +69,19 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
if (this.radioValue === '2') {
this.$emit('update', 'min', this.cycleTotal, 'min');
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'min', this.averageTotal, 'min');
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'min', this.checkboxString, 'min');
}
},
@ -109,8 +109,8 @@ export default {
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}
</script>
</script>

View File

@ -68,19 +68,19 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
if (this.radioValue === '2') {
this.$emit('update', 'month', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'month', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'month', this.checkboxString);
}
}
@ -107,7 +107,7 @@ export default {
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}

View File

@ -126,7 +126,7 @@ export default {
// 如果到达最大值时
if (nDay > DDate[DDate.length - 1]) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -141,9 +141,9 @@ export default {
// 如果到达最大值时
if (nHour > hDate[hDate.length - 1]) {
resetHour();
if (Di == DDate.length - 1) {
if (Di === DDate.length - 1) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -158,7 +158,7 @@ export default {
continue goMonth;
}
// 如果日期规则中有值时
if (this.dayRule == 'lastDay') {
if (this.dayRule === 'lastDay') {
// 如果不是合法日期则需要将前将日期调到合法日期即月末最后一天
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
@ -168,7 +168,7 @@ export default {
thisDD = DD < 10 ? '0' + DD : DD;
}
}
} else if (this.dayRule == 'workDay') {
} else if (this.dayRule === 'workDay') {
// 校验并调整如果是2月30号这种日期传进来时需调整至正常月底
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
while (DD > 0 && this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
@ -179,7 +179,7 @@ export default {
// 获取达到条件的日期是星期X
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + thisDD + ' 00:00:00'), 'week');
// 当星期日时
if (thisWeek == 1) {
if (thisWeek === 1) {
// 先找下一个日,并判断是否为月底
DD++;
thisDD = DD < 10 ? '0' + DD : DD;
@ -187,7 +187,7 @@ export default {
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
DD -= 3;
}
} else if (thisWeek == 7) {
} else if (thisWeek === 7) {
// 当星期6时只需判断不是1号就可进行操作
if (this.dayRuleSup !== 1) {
DD--;
@ -195,16 +195,16 @@ export default {
DD += 2;
}
}
} else if (this.dayRule == 'weekDay') {
} else if (this.dayRule === 'weekDay') {
// 如果指定了是星期几
// 获取当前日期是属于星期几
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
// 校验当前星期是否在星期池dayRuleSup
if (this.dayRuleSup.indexOf(thisWeek) < 0) {
// 如果到达最大值时
if (Di == DDate.length - 1) {
if (Di === DDate.length - 1) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -212,7 +212,7 @@ export default {
}
continue;
}
} else if (this.dayRule == 'assWeek') {
} else if (this.dayRule === 'assWeek') {
// 如果指定了是第几周的星期几
// 获取每月1号是属于星期几
let thisWeek = this.formatDate(new Date(YY + '-' + MM + '-' + DD + ' 00:00:00'), 'week');
@ -221,7 +221,7 @@ export default {
} else {
DD = this.dayRuleSup[0] * 7 + this.dayRuleSup[1] - thisWeek + 1;
}
} else if (this.dayRule == 'lastWeek') {
} else if (this.dayRule === 'lastWeek') {
// 如果指定了每月最后一个星期几
// 校验并调整如果是2月30号这种日期传进来时需调整至正常月底
if (this.checkDate(YY + '-' + MM + '-' + thisDD + ' 00:00:00') !== true) {
@ -249,11 +249,11 @@ export default {
// 如果到达最大值时
if (nMin > mDate[mDate.length - 1]) {
resetMin();
if (hi == hDate.length - 1) {
if (hi === hDate.length - 1) {
resetHour();
if (Di == DDate.length - 1) {
if (Di === DDate.length - 1) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -270,13 +270,13 @@ export default {
// 如果到达最大值时
if (nSecond > sDate[sDate.length - 1]) {
resetSecond();
if (mi == mDate.length - 1) {
if (mi === mDate.length - 1) {
resetMin();
if (hi == hDate.length - 1) {
if (hi === hDate.length - 1) {
resetHour();
if (Di == DDate.length - 1) {
if (Di === DDate.length - 1) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -297,17 +297,17 @@ export default {
nums++;
}
// 如果条数满了就退出循环
if (nums == 5) break goYear;
if (nums === 5) break goYear;
// 如果到达最大值时
if (si == sDate.length - 1) {
if (si === sDate.length - 1) {
resetSecond();
if (mi == mDate.length - 1) {
if (mi === mDate.length - 1) {
resetMin();
if (hi == hDate.length - 1) {
if (hi === hDate.length - 1) {
resetHour();
if (Di == DDate.length - 1) {
if (Di === DDate.length - 1) {
resetDay();
if (Mi == MDate.length - 1) {
if (Mi === MDate.length - 1) {
resetMonth();
continue goYear;
}
@ -326,7 +326,7 @@ export default {
}//goMonth
}
// 判断100年内的结果条数
if (resultArr.length == 0) {
if (resultArr.length === 0) {
this.resultList = ['没有达到条件的结果!'];
} else {
this.resultList = resultArr;
@ -378,23 +378,23 @@ export default {
// 获取"日"数组-主要为日期规则
getWeekArr(rule) {
// 只有当日期规则的两个值均为“”时则表达日期是有选项的
if (this.dayRule == '' && this.dayRuleSup == '') {
if (this.dayRule === '' && this.dayRuleSup === '') {
if (rule.indexOf('-') >= 0) {
this.dayRule = 'weekDay';
this.dayRuleSup = this.getCycleArr(rule, 7, false)
} else if (rule.indexOf('#') >= 0) {
this.dayRule = 'assWeek';
let matchRule = rule.match(/[0-9]{1}/g);
let matchRule = rule.match(/[0-9]/g);
this.dayRuleSup = [Number(matchRule[1]), Number(matchRule[0])];
this.dateArr[3] = [1];
if (this.dayRuleSup[1] == 7) {
if (this.dayRuleSup[1] === 7) {
this.dayRuleSup[1] = 0;
}
} else if (rule.indexOf('L') >= 0) {
this.dayRule = 'lastWeek';
this.dayRuleSup = Number(rule.match(/[0-9]{1,2}/g)[0]);
this.dateArr[3] = [31];
if (this.dayRuleSup == 7) {
if (this.dayRuleSup === 7) {
this.dayRuleSup = 0;
}
} else if (rule !== '*' && rule !== '?') {
@ -425,7 +425,7 @@ export default {
} else if (rule !== '*' && rule !== '?') {
this.dateArr[3] = this.getAssignArr(rule)
this.dayRuleSup = 'null';
} else if (rule == '*') {
} else if (rule === '*') {
this.dayRuleSup = 'null';
}
},
@ -504,7 +504,7 @@ export default {
}
for (let i = min; i <= max; i++) {
let add = 0;
if (status == false && i % limit == 0) {
if (status === false && i % limit === 0) {
add = limit;
}
arr.push(Math.round(i % limit + add))
@ -532,9 +532,9 @@ export default {
let s = time.getSeconds();
let week = time.getDay();
// 如果传递了type的话
if (type == undefined) {
if (type === undefined) {
return Y + '-' + (M < 10 ? '0' + M : M) + '-' + (D < 10 ? '0' + D : D) + ' ' + (h < 10 ? '0' + h : h) + ':' + (m < 10 ? '0' + m : m) + ':' + (s < 10 ? '0' + s : s);
} else if (type == 'week') {
} else if (type === 'week') {
// 在quartz中 1为星期日
return week + 1;
}

View File

@ -68,19 +68,19 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '2') {
if (this.radioValue === '2') {
this.$emit('update', 'second', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'second', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'second', this.checkboxString);
}
}
@ -110,7 +110,7 @@ export default {
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}

View File

@ -144,25 +144,25 @@ export default {
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'week', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'week', this.averageTotal);
}
},
// 最近工作日值变化时
weekdayChange() {
if (this.radioValue == '5') {
if (this.radioValue === '5') {
this.$emit('update', 'week', this.weekday + 'L');
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '6') {
if (this.radioValue === '6') {
this.$emit('update', 'week', this.checkboxString);
}
},
@ -195,7 +195,7 @@ export default {
// 计算勾选的checkbox值合集
checkboxString: function () {
let str = this.checkboxList.join();
return str == '' ? '*' : str;
return str === '' ? '*' : str;
}
}
}

View File

@ -79,19 +79,19 @@ export default {
},
// 周期两个值变化时
cycleChange() {
if (this.radioValue == '3') {
if (this.radioValue === '3') {
this.$emit('update', 'year', this.cycleTotal);
}
},
// 平均两个值变化时
averageChange() {
if (this.radioValue == '4') {
if (this.radioValue === '4') {
this.$emit('update', 'year', this.averageTotal);
}
},
// checkbox值变化时
checkboxChange() {
if (this.radioValue == '5') {
if (this.radioValue === '5') {
this.$emit('update', 'year', this.checkboxString);
}
}

View File

@ -108,7 +108,6 @@ export default {
.pan-info p a {
display: block;
color: #333;
width: 80px;
height: 80px;
background: rgba(255, 255, 255, 0.3);

View File

@ -62,7 +62,7 @@ export default {
},
// 右侧列表元素变化
dataChange(data) {
for (var item in this.columns) {
for (let item in this.columns) {
const key = this.columns[item].key;
this.columns[item].visible = !data.includes(key);
}

View File

@ -69,7 +69,7 @@ export default {
childrenMenus() {
const childrenMenus = [];
this.routers.map((router) => {
for (var item in router.children) {
for (let item in router.children) {
if (router.children[item].parentPath === undefined) {
if(router.path === "/") {
router.children[item].path = "/" + router.children[item].path;
@ -135,10 +135,10 @@ export default {
},
// 当前激活的路由
activeRoutes(key) {
var routes = [];
const routes = []
if (this.childrenMenus && this.childrenMenus.length > 0) {
this.childrenMenus.map((item) => {
if (key == item.parentPath || (key == "index" && "" == item.path)) {
if (key === item.parentPath || (key === "index" && "" === item.path)) {
routes.push(item);
}
});

File diff suppressed because one or more lines are too long

View File

@ -58,7 +58,7 @@
* VerifyPoints
* @description 点选
* */
import { resetSize, _code_chars, _code_color1, _code_color2 } from './../utils/util'
import { resetSize } from './../utils/util'
import { aesEncrypt } from '@/utils/ase'
import { reqGet, reqCheck } from './../api/index'
@ -167,7 +167,7 @@ export default {
setTimeout(() => {
// var flag = this.comparePos(this.fontPos, this.checkPosArr);
// 发送后端请求
var captchaVerification = this.secretKey ? aesEncrypt(this.backToken + '---' + JSON.stringify(this.checkPosArr), this.secretKey) : this.backToken + '---' + JSON.stringify(this.checkPosArr)
const captchaVerification = this.secretKey ? aesEncrypt(this.backToken + '---' + JSON.stringify(this.checkPosArr), this.secretKey) : this.backToken + '---' + JSON.stringify(this.checkPosArr)
const data = {
captchaType: this.captchaType,
'pointJson': this.secretKey ? aesEncrypt(JSON.stringify(this.checkPosArr), this.secretKey) : JSON.stringify(this.checkPosArr),
@ -205,8 +205,8 @@ export default {
// 获取坐标
getMousePos: function(obj, e) {
var x = e.offsetX
var y = e.offsetY
const x = e.offsetX
const y = e.offsetY
return { x, y }
},
// 创建坐标点
@ -253,7 +253,7 @@ export default {
},
// 坐标转换函数
pointTransfrom(pointArr, imgSize) {
var newPointArr = pointArr.map(p => {
const newPointArr = pointArr.map(p => {
const x = Math.round(310 * p.x / parseInt(imgSize.imgWidth))
const y = Math.round(155 * p.y / parseInt(imgSize.imgHeight))
return { x, y }

View File

@ -193,7 +193,7 @@ export default {
this.$parent.$emit('ready', this)
})
var _this = this
const _this = this
window.removeEventListener('touchmove', function(e) {
_this.move(e)
@ -228,11 +228,12 @@ export default {
// 鼠标按下
start: function(e) {
let x
e = e || window.event
if (!e.touches) { // 兼容PC端
var x = e.clientX
x = e.clientX
} else { // 兼容移动端
var x = e.touches[0].pageX
x = e.touches[0].pageX
}
this.startLeft = Math.floor(x - this.barArea.getBoundingClientRect().left)
this.startMoveTime = +new Date() // 开始滑动的时间
@ -247,15 +248,16 @@ export default {
},
// 鼠标移动
move: function(e) {
let x
e = e || window.event
if (this.status && this.isEnd === false) {
if (!e.touches) { // 兼容PC端
var x = e.clientX
x = e.clientX
} else { // 兼容移动端
var x = e.touches[0].pageX
x = e.touches[0].pageX
}
var bar_area_left = this.barArea.getBoundingClientRect().left
var move_block_left = x - bar_area_left // 小方块相对于父元素的left值
const bar_area_left = this.barArea.getBoundingClientRect().left
let move_block_left = x - bar_area_left // 小方块相对于父元素的left值
if (move_block_left >= this.barArea.offsetWidth - parseInt(parseInt(this.blockSize.width) / 2) - 2) {
move_block_left = this.barArea.offsetWidth - parseInt(parseInt(this.blockSize.width) / 2) - 2
}
@ -271,10 +273,10 @@ export default {
// 鼠标松开
end: function() {
this.endMovetime = +new Date()
var _this = this
const _this = this
// 判断是否重合
if (this.status && this.isEnd === false) {
var moveLeftDistance = parseInt((this.moveBlockLeft || '').replace('px', ''))
const moveLeftDistance = parseInt((this.moveBlockLeft || '').replace('px', ''))
moveLeftDistance = moveLeftDistance * 310 / parseInt(this.setSize.imgWidth)
const data = {
captchaType: this.captchaType,
@ -297,7 +299,10 @@ export default {
}
this.passFlag = true
this.tipWords = `${((this.endMovetime - this.startMoveTime) / 1000).toFixed(2)}s验证成功`
var captchaVerification = this.secretKey ? aesEncrypt(this.backToken + '---' + JSON.stringify({ x: moveLeftDistance, y: 5.0 }), this.secretKey) : this.backToken + '---' + JSON.stringify({ x: moveLeftDistance, y: 5.0 })
const captchaVerification = this.secretKey ? aesEncrypt(this.backToken + '---' + JSON.stringify({
x: moveLeftDistance,
y: 5.0
}), this.secretKey) : this.backToken + '---' + JSON.stringify({ x: moveLeftDistance, y: 5.0 })
setTimeout(() => {
this.tipWords = ''
this.$parent.closeBox()

View File

@ -21,8 +21,7 @@ service.interceptors.request.use(
// response interceptor
service.interceptors.response.use(
response => {
const res = response.data
return res
return response.data
},
error => {
}

View File

@ -49,14 +49,14 @@ export default function ContextPadProvider(
}
eventBus.on("create.end", 250, function(event) {
var context = event.context,
shape = context.shape;
const context = event.context,
shape = context.shape
if (!hasPrimaryModifier(event) || !contextPad.isOpen(shape)) {
return;
}
var entries = contextPad.getEntries(shape);
const entries = contextPad.getEntries(shape)
if (entries.replace) {
entries.replace.action.click(event, shape);
@ -81,7 +81,7 @@ ContextPadProvider.$inject = [
];
ContextPadProvider.prototype.getContextPadEntries = function(element) {
var contextPad = this._contextPad,
const contextPad = this._contextPad,
modeling = this._modeling,
elementFactory = this._elementFactory,
connect = this._connect,
@ -90,15 +90,15 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
canvas = this._canvas,
rules = this._rules,
autoPlace = this._autoPlace,
translate = this._translate;
translate = this._translate
var actions = {};
const actions = {}
if (element.type === "label") {
return actions;
}
var businessObject = element.businessObject;
const businessObject = element.businessObject
function startConnect(event, element) {
connect.start(event, element);
@ -109,21 +109,21 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
}
function getReplaceMenuPosition(element) {
var Y_OFFSET = 5;
const Y_OFFSET = 5
var diagramContainer = canvas.getContainer(),
pad = contextPad.getPad(element).html;
const diagramContainer = canvas.getContainer(),
pad = contextPad.getPad(element).html
var diagramRect = diagramContainer.getBoundingClientRect(),
padRect = pad.getBoundingClientRect();
const diagramRect = diagramContainer.getBoundingClientRect(),
padRect = pad.getBoundingClientRect()
var top = padRect.top - diagramRect.top;
var left = padRect.left - diagramRect.left;
const top = padRect.top - diagramRect.top
const left = padRect.left - diagramRect.left
var pos = {
const pos = {
x: left,
y: top + padRect.height + Y_OFFSET
};
}
return pos;
}
@ -145,19 +145,19 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
}
function appendStart(event, element) {
var shape = elementFactory.createShape(assign({ type: type }, options));
const shape = elementFactory.createShape(assign({ type: type }, options))
create.start(event, shape, {
source: element
});
}
var append = autoPlace
const append = autoPlace
? function(event, element) {
var shape = elementFactory.createShape(assign({ type: type }, options));
const shape = elementFactory.createShape(assign({ type: type }, options))
autoPlace.append(element, shape);
}
: appendStart;
autoPlace.append(element, shape)
}
: appendStart
return {
group: "model",
@ -182,7 +182,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
}
if (isAny(businessObject, ["bpmn:Lane", "bpmn:Participant"]) && isExpanded(businessObject)) {
var childLanes = getChildLanes(element);
const childLanes = getChildLanes(element)
assign(actions, {
"lane-insert-above": {
@ -302,9 +302,9 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
title: translate("Change type"),
action: {
click: function(event, element) {
var position = assign(getReplaceMenuPosition(element), {
const position = assign(getReplaceMenuPosition(element), {
cursor: { x: event.x, y: event.y }
});
})
popupMenu.open(element, "bpmn-replace", position);
}
@ -350,7 +350,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
}
// delete element entry, only show if allowed by rules
var deleteAllowed = rules.allowed("elements.delete", { elements: [element] });
let deleteAllowed = rules.allowed('elements.delete', { elements: [element] })
if (isArray(deleteAllowed)) {
// was the element returned as a deletion candidate?
@ -376,10 +376,10 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
// helpers /////////
function isEventType(eventBo, type, definition) {
var isType = eventBo.$instanceOf(type);
var isDefinition = false;
const isType = eventBo.$instanceOf(type)
let isDefinition = false
var definitions = eventBo.eventDefinitions || [];
const definitions = eventBo.eventDefinitions || []
forEach(definitions, function(def) {
if (def.$type === definition) {
isDefinition = true;

View File

@ -1,12 +1,12 @@
"use strict";
var some = require("min-dash").some;
const some = require('min-dash').some
var ALLOWED_TYPES = {
FailedJobRetryTimeCycle: ["bpmn:StartEvent", "bpmn:BoundaryEvent", "bpmn:IntermediateCatchEvent", "bpmn:Activity"],
Connector: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"],
Field: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"]
};
const ALLOWED_TYPES = {
FailedJobRetryTimeCycle: ['bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:Activity'],
Connector: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'],
Field: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent']
}
function is(element, type) {
return element && typeof element.$instanceOf === "function" && element.$instanceOf(type);
@ -32,8 +32,8 @@ function anyType(element, types) {
}
function isAllowed(propName, propDescriptor, newElement) {
var name = propDescriptor.name,
types = ALLOWED_TYPES[name.replace(/activiti:/, "")];
const name = propDescriptor.name,
types = ALLOWED_TYPES[name.replace(/activiti:/, '')]
return name === propName && anyType(newElement, types);
}
@ -42,8 +42,8 @@ function ActivitiModdleExtension(eventBus) {
eventBus.on(
"property.clone",
function(context) {
var newElement = context.newElement,
propDescriptor = context.propertyDescriptor;
const newElement = context.newElement,
propDescriptor = context.propertyDescriptor
this.canCloneProperty(newElement, propDescriptor);
},

View File

@ -1,17 +1,17 @@
"use strict";
var isFunction = require("min-dash").isFunction,
isObject = require("min-dash").isObject,
some = require("min-dash").some;
const isFunction = require('min-dash').isFunction,
isObject = require('min-dash').isObject,
some = require('min-dash').some
var WILDCARD = "*";
const WILDCARD = '*'
function CamundaModdleExtension(eventBus) {
var self = this;
const self = this
eventBus.on("moddleCopy.canCopyProperty", function(context) {
var property = context.property,
parent = context.parent;
const property = context.property,
parent = context.parent
return self.canCopyProperty(property, parent);
});
@ -45,14 +45,14 @@ CamundaModdleExtension.prototype.canCopyProperty = function(property, parent) {
CamundaModdleExtension.prototype.canHostInputOutput = function(parent) {
// allowed in camunda:Connector
var connector = getParent(parent, "camunda:Connector");
const connector = getParent(parent, 'camunda:Connector')
if (connector) {
return true;
}
// special rules inside bpmn:FlowNode
var flowNode = getParent(parent, "bpmn:FlowNode");
const flowNode = getParent(parent, 'bpmn:FlowNode')
if (!flowNode) {
return false;
@ -62,15 +62,13 @@ CamundaModdleExtension.prototype.canHostInputOutput = function(parent) {
return false;
}
if (is(flowNode, "bpmn:SubProcess") && flowNode.get("triggeredByEvent")) {
return false;
}
return !(is(flowNode, "bpmn:SubProcess") && flowNode.get("triggeredByEvent"));
return true;
};
CamundaModdleExtension.prototype.canHostConnector = function(parent) {
var serviceTaskLike = getParent(parent, "camunda:ServiceTaskLike");
const serviceTaskLike = getParent(parent, 'camunda:ServiceTaskLike')
if (is(serviceTaskLike, "bpmn:MessageEventDefinition")) {
// only allow on throw and end events
@ -81,13 +79,13 @@ CamundaModdleExtension.prototype.canHostConnector = function(parent) {
};
CamundaModdleExtension.prototype.canHostIn = function(parent) {
var callActivity = getParent(parent, "bpmn:CallActivity");
const callActivity = getParent(parent, 'bpmn:CallActivity')
if (callActivity) {
return true;
}
var signalEventDefinition = getParent(parent, "bpmn:SignalEventDefinition");
const signalEventDefinition = getParent(parent, 'bpmn:SignalEventDefinition')
if (signalEventDefinition) {
// only allow on throw and end events
@ -129,9 +127,9 @@ function getParent(element, type) {
function isAllowedInParent(property, parent) {
// (1) find property descriptor
var descriptor = property.$type && property.$model.getTypeDescriptor(property.$type);
const descriptor = property.$type && property.$model.getTypeDescriptor(property.$type)
var allowedIn = descriptor && descriptor.meta && descriptor.meta.allowedIn;
const allowedIn = descriptor && descriptor.meta && descriptor.meta.allowedIn
if (!allowedIn || isWildcard(allowedIn)) {
return true;

View File

@ -1,12 +1,12 @@
"use strict";
var some = require("min-dash").some;
const some = require('min-dash').some
var ALLOWED_TYPES = {
FailedJobRetryTimeCycle: ["bpmn:StartEvent", "bpmn:BoundaryEvent", "bpmn:IntermediateCatchEvent", "bpmn:Activity"],
Connector: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"],
Field: ["bpmn:EndEvent", "bpmn:IntermediateThrowEvent"]
};
const ALLOWED_TYPES = {
FailedJobRetryTimeCycle: ['bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:Activity'],
Connector: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent'],
Field: ['bpmn:EndEvent', 'bpmn:IntermediateThrowEvent']
}
function is(element, type) {
return element && typeof element.$instanceOf === "function" && element.$instanceOf(type);
@ -32,8 +32,8 @@ function anyType(element, types) {
}
function isAllowed(propName, propDescriptor, newElement) {
var name = propDescriptor.name,
types = ALLOWED_TYPES[name.replace(/flowable:/, "")];
const name = propDescriptor.name,
types = ALLOWED_TYPES[name.replace(/flowable:/, '')]
return name === propName && anyType(newElement, types);
}
@ -42,8 +42,8 @@ function FlowableModdleExtension(eventBus) {
eventBus.on(
"property.clone",
function(context) {
var newElement = context.newElement,
propDescriptor = context.propertyDescriptor;
const newElement = context.newElement,
propDescriptor = context.propertyDescriptor
this.canCloneProperty(newElement, propDescriptor);
},

View File

@ -10,18 +10,18 @@ F.prototype = PaletteProvider.prototype; // 核心,将父类的原型赋值给
// 利用中介函数重写原型链方法
F.prototype.getPaletteEntries = function() {
var actions = {},
const actions = {},
create = this._create,
elementFactory = this._elementFactory,
spaceTool = this._spaceTool,
lassoTool = this._lassoTool,
handTool = this._handTool,
globalConnect = this._globalConnect,
translate = this._translate;
translate = this._translate
function createAction(type, group, className, title, options) {
function createListener(event) {
var shape = elementFactory.createShape(assign({ type: type }, options));
const shape = elementFactory.createShape(assign({ type: type }, options))
if (options) {
shape.businessObject.di.isExpanded = options.isExpanded;
@ -30,7 +30,7 @@ F.prototype.getPaletteEntries = function() {
create.start(event, shape);
}
var shortType = type.replace(/^bpmn:/, "");
const shortType = type.replace(/^bpmn:/, '')
return {
group: group,
@ -44,19 +44,19 @@ F.prototype.getPaletteEntries = function() {
}
function createSubprocess(event) {
var subProcess = elementFactory.createShape({
type: "bpmn:SubProcess",
const subProcess = elementFactory.createShape({
type: 'bpmn:SubProcess',
x: 0,
y: 0,
isExpanded: true
});
})
var startEvent = elementFactory.createShape({
type: "bpmn:StartEvent",
const startEvent = elementFactory.createShape({
type: 'bpmn:StartEvent',
x: 40,
y: 82,
parent: subProcess
});
})
create.start(event, [subProcess, startEvent], {
hints: {

View File

@ -19,18 +19,18 @@ export default function PaletteProvider(palette, create, elementFactory, spaceTo
PaletteProvider.$inject = ["palette", "create", "elementFactory", "spaceTool", "lassoTool", "handTool", "globalConnect", "translate"];
PaletteProvider.prototype.getPaletteEntries = function() {
var actions = {},
const actions = {},
create = this._create,
elementFactory = this._elementFactory,
spaceTool = this._spaceTool,
lassoTool = this._lassoTool,
handTool = this._handTool,
globalConnect = this._globalConnect,
translate = this._translate;
translate = this._translate
function createAction(type, group, className, title, options) {
function createListener(event) {
var shape = elementFactory.createShape(assign({ type: type }, options));
const shape = elementFactory.createShape(assign({ type: type }, options))
if (options) {
shape.businessObject.di.isExpanded = options.isExpanded;
@ -39,7 +39,7 @@ PaletteProvider.prototype.getPaletteEntries = function() {
create.start(event, shape);
}
var shortType = type.replace(/^bpmn:/, "");
const shortType = type.replace(/^bpmn:/, '')
return {
group: group,
@ -53,19 +53,19 @@ PaletteProvider.prototype.getPaletteEntries = function() {
}
function createSubprocess(event) {
var subProcess = elementFactory.createShape({
type: "bpmn:SubProcess",
const subProcess = elementFactory.createShape({
type: 'bpmn:SubProcess',
x: 0,
y: 0,
isExpanded: true
});
})
var startEvent = elementFactory.createShape({
type: "bpmn:StartEvent",
const startEvent = elementFactory.createShape({
type: 'bpmn:StartEvent',
x: 40,
y: 82,
parent: subProcess
});
})
create.start(event, [subProcess, startEvent], {
hints: {

View File

@ -76,7 +76,7 @@ export default {
if (!value) {
return;
}
if (!value.match(/[a-zA-Z_][\-_.0-9_a-zA-Z$]*/)) {
if (!value.match(/[a-zA-Z_][\-_.0-9a-zA-Z$]*/)) {
console.log('key 不满足 XML NCName 规则,所以不进行赋值');
return;
}

View File

@ -1,5 +1,5 @@
import { isArray } from 'util'
import { exportDefault, titleCase, deepClone } from '@/utils/index'
import { exportDefault, titleCase, deepClone } from '@/utils'
import ruleTrigger from './ruleTrigger'
const units = {