fix: 手动解决lint校验 (#142)

This commit is contained in:
dayou 2024-05-20 18:16:29 +08:00 committed by GitHub
parent c714f13905
commit 34f242a892
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 4006 additions and 97 deletions

9
web/components.d.ts vendored
View File

@ -19,23 +19,21 @@ declare module 'vue' {
ElIconCheck: typeof import('@element-plus/icons-vue')['Check']
ElIconLoading: typeof import('@element-plus/icons-vue')['Loading']
ElInput: typeof import('element-plus/es')['ElInput']
ElInputNumber: typeof import('element-plus/es')['ElInputNumber']
ElMenu: typeof import('element-plus/es')['ElMenu']
ElMenuItem: typeof import('element-plus/es')['ElMenuItem']
ElOption: typeof import('element-plus/es')['ElOption']
ElPagination: typeof import('element-plus/es')['ElPagination']
ElPopover: typeof import('element-plus/es')['ElPopover']
ElRadio: typeof import('element-plus/es')['ElRadio']
ElRadioButton: typeof import('element-plus/es')['ElRadioButton']
ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup']
ElRow: typeof import('element-plus/es')['ElRow']
ElSelect: typeof import('element-plus/es')['ElSelect']
ElSlider: typeof import('element-plus/es')['ElSlider']
ElSubMenu: typeof import('element-plus/es')['ElSubMenu']
ElSwitch: typeof import('element-plus/es')['ElSwitch']
ElTable: typeof import('element-plus/es')['ElTable']
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElTimePicker: typeof import('element-plus/es')['ElTimePicker']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
IEpBottom: typeof import('~icons/ep/bottom')['default']
IEpCheck: typeof import('~icons/ep/check')['default']
@ -48,7 +46,6 @@ declare module 'vue' {
IEpPlus: typeof import('~icons/ep/plus')['default']
IEpQuestionFilled: typeof import('~icons/ep/question-filled')['default']
IEpRank: typeof import('~icons/ep/rank')['default']
IEpRankMinus: typeof import('~icons/ep/rank-minus')['default']
IEpRemove: typeof import('~icons/ep/remove')['default']
IEpSearch: typeof import('~icons/ep/search')['default']
IEpSort: typeof import('~icons/ep/sort')['default']

View File

@ -80,7 +80,7 @@ export class RuleNode {
// 匹配条件规则
match(fact: Fact) {
const res = Array.from(this.conditions.entries()).every(([key, value]) => {
const res = Array.from(this.conditions.entries()).every(([, value]) => {
const res = value.match(fact)
if (res) {
return true;
@ -92,7 +92,7 @@ export class RuleNode {
return res
}
getResult() {
const res = Array.from(this.conditions.entries()).every(([key, value]) => {
const res = Array.from(this.conditions.entries()).every(([, value]) => {
const res = value.getResult()
return res
})
@ -186,15 +186,15 @@ export class RuleMatch {
return target + scope;
}
findTargetsByField(field: string) {
const rules = new Map([...this.rules.entries()].filter(([key, value]) => {
return [...value.conditions.entries()].filter(([key, value]) => {
const rules = new Map([...this.rules.entries()].filter(([, value]) => {
return [...value.conditions.entries()].filter(([, value]) => {
return value.field === field
})
}))
return [...rules.values()].map(obj => obj.target);
}
toJson() {
return Array.from(this.rules.entries()).map(([key, value]) => {
return Array.from(this.rules.entries()).map(([, value]) => {
return value.toJson()
})
}

View File

@ -67,13 +67,7 @@ export default {
},
updateLogicConf() {
if(showLogicEngine.value) {
try {
showLogicEngine.value.validateSchema()
} catch (error) {
throw error
return
}
showLogicEngine.value.validateSchema()
const showLogicConf = showLogicEngine.value.toJson()
//
this.$store.dispatch('edit/changeSchema', { key: 'logicConf', value: { showLogicConf } })

View File

@ -91,12 +91,7 @@ export default {
},
updateLogicConf() {
if(showLogicEngine.value) {
try {
showLogicEngine.value.validateSchema()
} catch (error) {
throw error
return
}
showLogicEngine.value.validateSchema()
const showLogicConf = showLogicEngine.value.toJson()
//
this.$store.dispatch('edit/changeSchema', { key: 'logicConf', value: { showLogicConf } })

View File

@ -1,7 +1,7 @@
<template>
<div class="rule-list">
<RuleNodeView
v-for="(item, index) in list"
v-for="(item) in list"
ref="ruleWrappers"
:key="item.id"
:ruleNode="item"

View File

@ -7,7 +7,7 @@
>
<el-select
class="select field-select"
v-model="conditionNode.field"
v-model="conditionField"
placeholder="请选择题目"
@change="(val: any) => handleChange(conditionNode, 'field', val)"
>
@ -22,7 +22,7 @@
:rules="[{ required: true, message: '请选择选项', trigger: 'change' }]"
>
<el-select
v-model="conditionNode.value"
v-model="conditionValue"
placeholder="请选择选项"
multiple
@change="(val: any) => handleChange(conditionNode, 'value', val)"
@ -103,6 +103,14 @@ const getRelyOptions = computed(() => {
)
})
const conditionField = computed(() => {
return props.conditionNode.field
})
const conditionValue = computed(() => {
return props.conditionNode.value
})
const handleChange = (conditionNode: ConditionNode, key: string, value: any) => {
switch (key) {
case 'field':

View File

@ -24,7 +24,7 @@
>
<el-select
class="select field-select"
v-model="ruleNode.target"
v-model="ruleTarget"
placeholder="请选择"
@change="(val: any) => handleChange(ruleNode, 'target', val)"
>
@ -63,7 +63,9 @@ const props = defineProps({
}
})
const emit = defineEmits(['delete'])
const ruleTarget = computed(() => {
return props.ruleNode.target
})
const handleChange = (ruleNode: any, key: any, value: any) => {
switch (key) {
case 'target':

View File

@ -10,7 +10,7 @@ export default {
}
dispatch('resetState')
},
async getSchemaFromRemote({ commit, state, dispatch }) {
async getSchemaFromRemote({ commit, state }) {
const res = await getSurveyById(state.surveyId)
if (res.code === 200) {
const metaData = res.data.surveyMetaRes

View File

@ -3,7 +3,7 @@ export const QOP_MAP = {
COPY: 'copy',
EDIT: 'edit'
}
export const qAbleList = [,
export const qAbleList = [
'radio',
'checkbox',
'binary-choice',

View File

@ -16,7 +16,7 @@
<script setup>
import { inject, provide, computed, onBeforeMount } from 'vue'
import QuestionWrapper from './QuestionWrapper.vue'
import store from '@/render/store'
const $bus = inject('$bus')
const props = defineProps({
rules: {

View File

@ -1,4 +1,3 @@
import { computed } from 'vue'
import store from '../store/index'
export const useVoteMap = (questionKey) => {

View File

@ -1,5 +1,3 @@
import { flatten } from 'lodash-es'
export default {
// 题目列表
renderData: (state) => {
@ -14,71 +12,10 @@ export default {
item.forEach(questionKey => {
console.log('题目重新计算')
const question = { ...questionData[questionKey] }
const { type, extraOptions, options, rangeConfig } = question
// const questionVal = formValues[questionKey]
// question.value = questionVal
// 本题开启了
// 开启显示序号
if (question.showIndex) {
question.indexNumber = index++
}
// const allOptions = []
// if (Array.isArray(extraOptions)) {
// allOptions.push(...extraOptions)
// }
// if (Array.isArray(options)) {
// allOptions.push(...options)
// }
// let othersValue = {}
// let voteTotal = 0
// const voteMap = state.voteMap
// if (/vote/.test(type)) {
// voteTotal = voteMap?.[questionKey]?.total || 0
// }
// 遍历所有的选项
// for (const optionItem of allOptions) {
// 开启了更多输入框生成othersValue的值
// if (optionItem.others) {
// const opKey = `${questionKey}_${optionItem.hash}`
// optionItem.othersKey = opKey
// optionItem.othersValue = formValues[opKey]
// othersValue[opKey] = formValues[opKey]
// }
// 投票题,用户手动选择选项后,要实时更新展示数据和进度
// if (/vote/.test(type)) {
// const voteCount = voteMap?.[questionKey]?.[optionItem.hash] || 0
// if (
// Array.isArray(questionVal)
// ? questionVal.includes(optionItem.hash)
// : questionVal === optionItem.hash
// ) {
// optionItem.voteCount = voteCount + 1
// voteTotal = voteTotal + 1
// } else {
// optionItem.voteCount = voteCount
// }
// question.voteTotal = voteTotal
// }
// }
// 开启了更多输入框要将当前的value赋值给question
// if (rangeConfig && Object.keys(rangeConfig).length > 0 && rangeConfig[questionVal]) {
// const curRange = rangeConfig[questionVal]
// if (curRange?.isShowInput) {
// const rangeKey = `${questionKey}_${questionVal}`
// curRange.othersKey = rangeKey
// curRange.othersValue = formValues[rangeKey]
// othersValue[rangeKey] = formValues[rangeKey]
// }
// }
// 将othersValue赋值给
// question.othersValue = othersValue
questionArr.push(question)
})

3977
web/yarn.lock Normal file

File diff suppressed because it is too large Load Diff