fix: eslint
parent
85fbbc0c10
commit
c4425a8286
|
@ -13,7 +13,7 @@ interface UseFormValuesContext {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @desription deconstruct array-link key. This method will mutate the target.
|
* @description deconstruct array-link key. This method will mutate the target.
|
||||||
*/
|
*/
|
||||||
function tryDeconstructArray(key: string, value: any, target: Recordable) {
|
function tryDeconstructArray(key: string, value: any, target: Recordable) {
|
||||||
const pattern = /^\[(.+)\]$/
|
const pattern = /^\[(.+)\]$/
|
||||||
|
@ -31,7 +31,7 @@ function tryDeconstructArray(key: string, value: any, target: Recordable) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @desription deconstruct object-link key. This method will mutate the target.
|
* @description deconstruct object-link key. This method will mutate the target.
|
||||||
*/
|
*/
|
||||||
function tryDeconstructObject(key: string, value: any, target: Recordable) {
|
function tryDeconstructObject(key: string, value: any, target: Recordable) {
|
||||||
const pattern = /^\{(.+)\}$/
|
const pattern = /^\{(.+)\}$/
|
||||||
|
@ -122,10 +122,11 @@ export function useFormValues({ defaultValueRef, getSchema, formModel, getProps
|
||||||
const { defaultValue, defaultValueObj } = item
|
const { defaultValue, defaultValueObj } = item
|
||||||
const fieldKeys = Object.keys(defaultValueObj || {})
|
const fieldKeys = Object.keys(defaultValueObj || {})
|
||||||
if (fieldKeys.length) {
|
if (fieldKeys.length) {
|
||||||
|
// eslint-disable-next-line array-callback-return
|
||||||
fieldKeys.map((field) => {
|
fieldKeys.map((field) => {
|
||||||
obj[field] = defaultValueObj[field]
|
obj[field] = defaultValueObj![field]
|
||||||
if (formModel[field] === undefined)
|
if (formModel[field] === undefined)
|
||||||
formModel[field] = defaultValueObj[field]
|
formModel[field] = defaultValueObj![field]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
if (!isNullOrUnDef(defaultValue)) {
|
if (!isNullOrUnDef(defaultValue)) {
|
||||||
|
|
|
@ -128,14 +128,14 @@ export default defineComponent({
|
||||||
// 控制性的选项
|
// 控制性的选项
|
||||||
const controlOptions = computed(() => {
|
const controlOptions = computed(() => {
|
||||||
return allOptions.value.filter((item) => {
|
return allOptions.value.filter((item) => {
|
||||||
return item.category == 'control'
|
return item.category === 'control'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// 非控制性选择
|
// 非控制性选择
|
||||||
const inputOptions = computed(() => {
|
const inputOptions = computed(() => {
|
||||||
return allOptions.value.filter((item) => {
|
return allOptions.value.filter((item) => {
|
||||||
return item.category == 'input'
|
return item.category === 'input'
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import type { Component } from 'vue'
|
import type { Component } from 'vue'
|
||||||
import {
|
import {
|
||||||
Input,
|
Input,
|
||||||
|
// eslint-disable-next-line sort-imports
|
||||||
Button,
|
Button,
|
||||||
Select,
|
Select,
|
||||||
Radio,
|
Radio,
|
||||||
|
|
|
@ -78,20 +78,6 @@ export function useVFormMethods(
|
||||||
formItem[key] = value
|
formItem[key] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置表单项的props
|
|
||||||
* @param {string} field 需要设置的表单项field
|
|
||||||
* @param {string} key 需要设置的key
|
|
||||||
* @param value 需要设置的值
|
|
||||||
*/
|
|
||||||
const setProps: ISetProps = (field, key, value) => {
|
|
||||||
const formItem = get(field)
|
|
||||||
if (formItem?.componentProps) {
|
|
||||||
['options', 'treeData'].includes(key) && setValue(field, undefined)
|
|
||||||
|
|
||||||
formItem.componentProps[key] = value
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* 设置字段的值,设置后触发校验
|
* 设置字段的值,设置后触发校验
|
||||||
* @param {string} field 需要设置的字段
|
* @param {string} field 需要设置的字段
|
||||||
|
@ -111,6 +97,20 @@ export function useVFormMethods(
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 设置表单项的props
|
||||||
|
* @param {string} field 需要设置的表单项field
|
||||||
|
* @param {string} key 需要设置的key
|
||||||
|
* @param value 需要设置的值
|
||||||
|
*/
|
||||||
|
const setProps: ISetProps = (field, key, value) => {
|
||||||
|
const formItem = get(field)
|
||||||
|
if (formItem?.componentProps) {
|
||||||
|
['options', 'treeData'].includes(key) && setValue(field, undefined)
|
||||||
|
|
||||||
|
formItem.componentProps[key] = value
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 设置表单配置方法
|
* 设置表单配置方法
|
||||||
* @param {string} key
|
* @param {string} key
|
||||||
|
|
|
@ -199,6 +199,7 @@ export function strToReg(rules: IValidationRule[]) {
|
||||||
*/
|
*/
|
||||||
export function runCode<T>(code: any): T {
|
export function runCode<T>(code: any): T {
|
||||||
try {
|
try {
|
||||||
|
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
|
||||||
return new Function(`return ${code}`)()
|
return new Function(`return ${code}`)()
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
<!-- eslint-disable vue/no-mutating-props -->
|
||||||
<script lang="tsx">
|
<script lang="tsx">
|
||||||
import type { CSSProperties } from 'vue'
|
import type { CSSProperties } from 'vue'
|
||||||
import { computed, defineComponent, nextTick, ref, toRaw, unref, watchEffect } from 'vue'
|
import { computed, defineComponent, nextTick, ref, toRaw, unref, watchEffect } from 'vue'
|
||||||
|
@ -138,6 +139,11 @@ export default defineComponent({
|
||||||
return option?.label ?? value
|
return option?.label ?? value
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const getRowEditable = computed(() => {
|
||||||
|
const { editable } = props.record || {}
|
||||||
|
return !!editable
|
||||||
|
})
|
||||||
|
|
||||||
const getWrapperStyle = computed((): CSSProperties => {
|
const getWrapperStyle = computed((): CSSProperties => {
|
||||||
if (unref(getIsCheckComp) || unref(getRowEditable))
|
if (unref(getIsCheckComp) || unref(getRowEditable))
|
||||||
return {}
|
return {}
|
||||||
|
@ -152,11 +158,6 @@ export default defineComponent({
|
||||||
return `edit-cell-align-${align}`
|
return `edit-cell-align-${align}`
|
||||||
})
|
})
|
||||||
|
|
||||||
const getRowEditable = computed(() => {
|
|
||||||
const { editable } = props.record || {}
|
|
||||||
return !!editable
|
|
||||||
})
|
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
// defaultValueRef.value = props.value;
|
// defaultValueRef.value = props.value;
|
||||||
currentValueRef.value = props.value
|
currentValueRef.value = props.value
|
||||||
|
@ -339,11 +340,9 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
|
|
||||||
function initCbs(cbs: 'submitCbs' | 'validCbs' | 'cancelCbs', handle: Fn) {
|
function initCbs(cbs: 'submitCbs' | 'validCbs' | 'cancelCbs', handle: Fn) {
|
||||||
if (props.record) {
|
if (props.record)
|
||||||
/* eslint-disable */
|
|
||||||
isArray(props.record[cbs]) ? props.record[cbs]?.push(handle) : (props.record[cbs] = [handle])
|
isArray(props.record[cbs]) ? props.record[cbs]?.push(handle) : (props.record[cbs] = [handle])
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (props.record) {
|
if (props.record) {
|
||||||
initCbs('submitCbs', handleSubmit)
|
initCbs('submitCbs', handleSubmit)
|
||||||
|
@ -351,19 +350,19 @@ export default defineComponent({
|
||||||
initCbs('cancelCbs', handleCancel)
|
initCbs('cancelCbs', handleCancel)
|
||||||
|
|
||||||
if (props.column.dataIndex) {
|
if (props.column.dataIndex) {
|
||||||
if (!props.record.editValueRefs) props.record.editValueRefs = {}
|
if (!props.record.editValueRefs)
|
||||||
|
props.record.editValueRefs = {}
|
||||||
props.record.editValueRefs[props.column.dataIndex as any] = currentValueRef
|
props.record.editValueRefs[props.column.dataIndex as any] = currentValueRef
|
||||||
}
|
}
|
||||||
/* eslint-disable */
|
|
||||||
props.record.onCancelEdit = () => {
|
props.record.onCancelEdit = () => {
|
||||||
isArray(props.record?.cancelCbs) && props.record?.cancelCbs.forEach((fn) => fn())
|
isArray(props.record?.cancelCbs) && props.record?.cancelCbs.forEach(fn => fn())
|
||||||
}
|
}
|
||||||
/* eslint-disable */
|
|
||||||
props.record.onSubmitEdit = async () => {
|
props.record.onSubmitEdit = async () => {
|
||||||
if (isArray(props.record?.submitCbs)) {
|
if (isArray(props.record?.submitCbs)) {
|
||||||
if (!props.record?.onValid?.()) return
|
if (!props.record?.onValid?.())
|
||||||
|
return
|
||||||
const submitFns = props.record?.submitCbs || []
|
const submitFns = props.record?.submitCbs || []
|
||||||
submitFns.forEach((fn) => fn(false, false))
|
submitFns.forEach(fn => fn(false, false))
|
||||||
table.emit?.('edit-row-end')
|
table.emit?.('edit-row-end')
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -392,7 +391,7 @@ export default defineComponent({
|
||||||
getValues,
|
getValues,
|
||||||
handleEnter,
|
handleEnter,
|
||||||
handleSubmitClick,
|
handleSubmitClick,
|
||||||
spinning
|
spinning,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
|
@ -409,7 +408,7 @@ export default defineComponent({
|
||||||
text: this.value,
|
text: this.value,
|
||||||
record: this.record as Recordable,
|
record: this.record as Recordable,
|
||||||
column: this.column,
|
column: this.column,
|
||||||
index: this.index
|
index: this.index,
|
||||||
})
|
})
|
||||||
: this.getValues ?? '\u00A0'}
|
: this.getValues ?? '\u00A0'}
|
||||||
</div>
|
</div>
|
||||||
|
@ -442,9 +441,10 @@ export default defineComponent({
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less">
|
<style lang="less">
|
||||||
@prefix-cls: ~'@{namespace}-editable-cell';
|
@prefix-cls: ~'@{namespace}-editable-cell';
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ export interface ColumnProps<T> {
|
||||||
* Sort function for local sort, see Array.sort's compareFunction. If you need sort buttons only, set to true
|
* Sort function for local sort, see Array.sort's compareFunction. If you need sort buttons only, set to true
|
||||||
* @type boolean | Function
|
* @type boolean | Function
|
||||||
*/
|
*/
|
||||||
sorter?: boolean | Function
|
sorter?: boolean | Fn
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Order of sorted values: 'ascend' 'descend' false
|
* Order of sorted values: 'ascend' 'descend' false
|
||||||
|
|
|
@ -59,7 +59,6 @@ export enum IconEnum {
|
||||||
TEST = 'ant-design:deployment-unit-outlined',
|
TEST = 'ant-design:deployment-unit-outlined',
|
||||||
EDIT = 'clarity:note-edit-line',
|
EDIT = 'clarity:note-edit-line',
|
||||||
AUTH = 'ant-design:safety-certificate-outlined',
|
AUTH = 'ant-design:safety-certificate-outlined',
|
||||||
DATA = 'clarity:note-edit-line',
|
|
||||||
DELETE = 'ant-design:delete-outlined',
|
DELETE = 'ant-design:delete-outlined',
|
||||||
SEARCH = 'ant-design:search-outlined',
|
SEARCH = 'ant-design:search-outlined',
|
||||||
RESET = 'ant-design:sync-outlined',
|
RESET = 'ant-design:sync-outlined',
|
||||||
|
|
|
@ -16,6 +16,7 @@ export function useDesign(scope: string) {
|
||||||
// }
|
// }
|
||||||
return {
|
return {
|
||||||
// prefixCls: computed(() => `${values.prefixCls}-${scope}`),
|
// prefixCls: computed(() => `${values.prefixCls}-${scope}`),
|
||||||
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||||
prefixCls: `${values.prefixCls}-${scope}`,
|
prefixCls: `${values.prefixCls}-${scope}`,
|
||||||
prefixVar: values.prefixCls,
|
prefixVar: values.prefixCls,
|
||||||
// style,
|
// style,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
import type { RouteLocationRaw, Router } from 'vue-router'
|
import type { RouteLocationRaw, Router } from 'vue-router'
|
||||||
|
|
||||||
import { unref } from 'vue'
|
import { unref } from 'vue'
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { propTypes } from '@/utils/propTypes'
|
||||||
defineOptions({ name: 'DropdownMenuItem' })
|
defineOptions({ name: 'DropdownMenuItem' })
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line vue/no-reserved-props
|
||||||
key: propTypes.string,
|
key: propTypes.string,
|
||||||
text: propTypes.string,
|
text: propTypes.string,
|
||||||
icon: propTypes.string,
|
icon: propTypes.string,
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { useLocaleStoreWithOut } from '@/store/modules/locale'
|
||||||
|
|
||||||
const { fallback, availableLocales } = localeSetting
|
const { fallback, availableLocales } = localeSetting
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/no-mutable-exports
|
||||||
export let i18n: ReturnType<typeof createI18n>
|
export let i18n: ReturnType<typeof createI18n>
|
||||||
|
|
||||||
async function createI18nOptions(): Promise<I18nOptions> {
|
async function createI18nOptions(): Promise<I18nOptions> {
|
||||||
|
|
|
@ -80,7 +80,7 @@ export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModul
|
||||||
routeList.forEach((route) => {
|
routeList.forEach((route) => {
|
||||||
if (isUrl(route.path))
|
if (isUrl(route.path))
|
||||||
route.component = 'IFrame'
|
route.component = 'IFrame'
|
||||||
else if (route.children && route.parentId == 0)
|
else if (route.children && route.parentId === 0)
|
||||||
route.component = 'LAYOUT'
|
route.component = 'LAYOUT'
|
||||||
else if (!route.children)
|
else if (!route.children)
|
||||||
route.component = route.component as string
|
route.component = route.component as string
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
/* eslint-disable @typescript-eslint/unbound-method */
|
||||||
import type { BasicKeys } from '@/utils/cache/persistent'
|
import type { BasicKeys } from '@/utils/cache/persistent'
|
||||||
import { Persistent } from '@/utils/cache/persistent'
|
import { Persistent } from '@/utils/cache/persistent'
|
||||||
import { ACCESS_TOKEN_KEY, CacheTypeEnum, REFRESH_TOKEN_KEY, TENANT_ID_KEY } from '@/enums/cacheEnum'
|
import { ACCESS_TOKEN_KEY, CacheTypeEnum, REFRESH_TOKEN_KEY, TENANT_ID_KEY } from '@/enums/cacheEnum'
|
||||||
|
|
|
@ -13,6 +13,7 @@ function genBem(name: string, mods?: Mods): string {
|
||||||
return ` ${name}--${mods}`
|
return ` ${name}--${mods}`
|
||||||
|
|
||||||
if (Array.isArray(mods))
|
if (Array.isArray(mods))
|
||||||
|
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
||||||
return mods.reduce((ret, item) => ret + genBem(name, item), '')
|
return mods.reduce((ret, item) => ret + genBem(name, item), '')
|
||||||
|
|
||||||
return Object.keys(mods).reduce((ret, key) => ret + (mods[key] ? genBem(name, key) : ''), '')
|
return Object.keys(mods).reduce((ret, key) => ret + (mods[key] ? genBem(name, key) : ''), '')
|
||||||
|
|
|
@ -268,6 +268,7 @@ export function handleTree2(data, id, parentId, children, rootId) {
|
||||||
// 返回每一项的子级数组
|
// 返回每一项的子级数组
|
||||||
return father[id] === child[parentId]
|
return father[id] === child[parentId]
|
||||||
})
|
})
|
||||||
|
// eslint-disable-next-line no-unused-expressions
|
||||||
branchArr.length > 0 ? (father.children = branchArr) : ''
|
branchArr.length > 0 ? (father.children = branchArr) : ''
|
||||||
// 返回第一层
|
// 返回第一层
|
||||||
return father[parentId] === rootId
|
return father[parentId] === rootId
|
||||||
|
|
|
@ -32,6 +32,7 @@ const getShow = computed(() => unref(getLoginState) === LoginStateEnum.REGISTER)
|
||||||
async function handleRegister() {
|
async function handleRegister() {
|
||||||
const data = await validForm()
|
const data = await validForm()
|
||||||
if (!data)
|
if (!data)
|
||||||
|
// eslint-disable-next-line no-useless-return
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { getRecordPage } from '@/api/member/point/record'
|
||||||
|
|
||||||
defineOptions({ name: 'PointRecord' })
|
defineOptions({ name: 'PointRecord' })
|
||||||
|
|
||||||
const [registerTable, { reload }] = useTable({
|
const [registerTable] = useTable({
|
||||||
title: '积分记录列表',
|
title: '积分记录列表',
|
||||||
api: getRecordPage,
|
api: getRecordPage,
|
||||||
columns,
|
columns,
|
||||||
|
|
|
@ -39,7 +39,7 @@ async function handleQueryDetails(record: Recordable) {
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
{ icon: IconEnum.DATA, label: t('action.detail'), auth: 'pay:order:query', onClick: handleQueryDetails.bind(null, record) },
|
{ icon: IconEnum.VIEW, label: t('action.detail'), auth: 'pay:order:query', onClick: handleQueryDetails.bind(null, record) },
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -59,7 +59,7 @@ async function handleExport() {
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
{ icon: IconEnum.DATA, label: t('action.detail'), auth: 'pay:order:query', onClick: handleQueryDetails.bind(null, record) },
|
{ icon: IconEnum.VIEW, label: t('action.detail'), auth: 'pay:order:query', onClick: handleQueryDetails.bind(null, record) },
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -59,7 +59,7 @@ async function handleExport() {
|
||||||
<template v-if="column.key === 'action'">
|
<template v-if="column.key === 'action'">
|
||||||
<TableAction
|
<TableAction
|
||||||
:actions="[
|
:actions="[
|
||||||
{ icon: IconEnum.DATA, label: t('action.detail'), auth: 'pay:order:query', onClick: handleQueryDetails.bind(null, record) },
|
{ icon: IconEnum.VIEW, label: t('action.detail'), auth: 'pay:order:query', onClick: handleQueryDetails.bind(null, record) },
|
||||||
]"
|
]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in New Issue