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) {
|
||||
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) {
|
||||
const pattern = /^\{(.+)\}$/
|
||||
|
@ -122,10 +122,11 @@ export function useFormValues({ defaultValueRef, getSchema, formModel, getProps
|
|||
const { defaultValue, defaultValueObj } = item
|
||||
const fieldKeys = Object.keys(defaultValueObj || {})
|
||||
if (fieldKeys.length) {
|
||||
// eslint-disable-next-line array-callback-return
|
||||
fieldKeys.map((field) => {
|
||||
obj[field] = defaultValueObj[field]
|
||||
obj[field] = defaultValueObj![field]
|
||||
if (formModel[field] === undefined)
|
||||
formModel[field] = defaultValueObj[field]
|
||||
formModel[field] = defaultValueObj![field]
|
||||
})
|
||||
}
|
||||
if (!isNullOrUnDef(defaultValue)) {
|
||||
|
|
|
@ -128,14 +128,14 @@ export default defineComponent({
|
|||
// 控制性的选项
|
||||
const controlOptions = computed(() => {
|
||||
return allOptions.value.filter((item) => {
|
||||
return item.category == 'control'
|
||||
return item.category === 'control'
|
||||
})
|
||||
})
|
||||
|
||||
// 非控制性选择
|
||||
const inputOptions = computed(() => {
|
||||
return allOptions.value.filter((item) => {
|
||||
return item.category == 'input'
|
||||
return item.category === 'input'
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import type { Component } from 'vue'
|
||||
import {
|
||||
Input,
|
||||
// eslint-disable-next-line sort-imports
|
||||
Button,
|
||||
Select,
|
||||
Radio,
|
||||
|
|
|
@ -78,20 +78,6 @@ export function useVFormMethods(
|
|||
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 需要设置的字段
|
||||
|
@ -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
|
||||
|
|
|
@ -199,6 +199,7 @@ export function strToReg(rules: IValidationRule[]) {
|
|||
*/
|
||||
export function runCode<T>(code: any): T {
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-implied-eval, no-new-func
|
||||
return new Function(`return ${code}`)()
|
||||
}
|
||||
catch {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<!-- eslint-disable vue/no-mutating-props -->
|
||||
<script lang="tsx">
|
||||
import type { CSSProperties } from 'vue'
|
||||
import { computed, defineComponent, nextTick, ref, toRaw, unref, watchEffect } from 'vue'
|
||||
|
@ -138,6 +139,11 @@ export default defineComponent({
|
|||
return option?.label ?? value
|
||||
})
|
||||
|
||||
const getRowEditable = computed(() => {
|
||||
const { editable } = props.record || {}
|
||||
return !!editable
|
||||
})
|
||||
|
||||
const getWrapperStyle = computed((): CSSProperties => {
|
||||
if (unref(getIsCheckComp) || unref(getRowEditable))
|
||||
return {}
|
||||
|
@ -152,11 +158,6 @@ export default defineComponent({
|
|||
return `edit-cell-align-${align}`
|
||||
})
|
||||
|
||||
const getRowEditable = computed(() => {
|
||||
const { editable } = props.record || {}
|
||||
return !!editable
|
||||
})
|
||||
|
||||
watchEffect(() => {
|
||||
// defaultValueRef.value = props.value;
|
||||
currentValueRef.value = props.value
|
||||
|
@ -339,10 +340,8 @@ export default defineComponent({
|
|||
}
|
||||
|
||||
function initCbs(cbs: 'submitCbs' | 'validCbs' | 'cancelCbs', handle: Fn) {
|
||||
if (props.record) {
|
||||
/* eslint-disable */
|
||||
if (props.record)
|
||||
isArray(props.record[cbs]) ? props.record[cbs]?.push(handle) : (props.record[cbs] = [handle])
|
||||
}
|
||||
}
|
||||
|
||||
if (props.record) {
|
||||
|
@ -351,19 +350,19 @@ export default defineComponent({
|
|||
initCbs('cancelCbs', handleCancel)
|
||||
|
||||
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
|
||||
}
|
||||
/* eslint-disable */
|
||||
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 () => {
|
||||
if (isArray(props.record?.submitCbs)) {
|
||||
if (!props.record?.onValid?.()) return
|
||||
if (!props.record?.onValid?.())
|
||||
return
|
||||
const submitFns = props.record?.submitCbs || []
|
||||
submitFns.forEach((fn) => fn(false, false))
|
||||
submitFns.forEach(fn => fn(false, false))
|
||||
table.emit?.('edit-row-end')
|
||||
return true
|
||||
}
|
||||
|
@ -392,7 +391,7 @@ export default defineComponent({
|
|||
getValues,
|
||||
handleEnter,
|
||||
handleSubmitClick,
|
||||
spinning
|
||||
spinning,
|
||||
}
|
||||
},
|
||||
render() {
|
||||
|
@ -406,11 +405,11 @@ export default defineComponent({
|
|||
<div class="cell-content" title={this.column.ellipsis ? this.getValues ?? '' : ''}>
|
||||
{this.column.editRender
|
||||
? this.column.editRender({
|
||||
text: this.value,
|
||||
record: this.record as Recordable,
|
||||
column: this.column,
|
||||
index: this.index
|
||||
})
|
||||
text: this.value,
|
||||
record: this.record as Recordable,
|
||||
column: this.column,
|
||||
index: this.index,
|
||||
})
|
||||
: this.getValues ?? '\u00A0'}
|
||||
</div>
|
||||
{!this.column.editRow && <FormOutlined class={`${this.prefixCls}__normal-icon`} />}
|
||||
|
@ -442,9 +441,10 @@ export default defineComponent({
|
|||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="less">
|
||||
@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
|
||||
* @type boolean | Function
|
||||
*/
|
||||
sorter?: boolean | Function
|
||||
sorter?: boolean | Fn
|
||||
|
||||
/**
|
||||
* Order of sorted values: 'ascend' 'descend' false
|
||||
|
|
|
@ -59,7 +59,6 @@ export enum IconEnum {
|
|||
TEST = 'ant-design:deployment-unit-outlined',
|
||||
EDIT = 'clarity:note-edit-line',
|
||||
AUTH = 'ant-design:safety-certificate-outlined',
|
||||
DATA = 'clarity:note-edit-line',
|
||||
DELETE = 'ant-design:delete-outlined',
|
||||
SEARCH = 'ant-design:search-outlined',
|
||||
RESET = 'ant-design:sync-outlined',
|
||||
|
|
|
@ -16,6 +16,7 @@ export function useDesign(scope: string) {
|
|||
// }
|
||||
return {
|
||||
// prefixCls: computed(() => `${values.prefixCls}-${scope}`),
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
prefixCls: `${values.prefixCls}-${scope}`,
|
||||
prefixVar: values.prefixCls,
|
||||
// style,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import type { RouteLocationRaw, Router } from 'vue-router'
|
||||
|
||||
import { unref } from 'vue'
|
||||
|
|
|
@ -8,7 +8,7 @@ import { propTypes } from '@/utils/propTypes'
|
|||
defineOptions({ name: 'DropdownMenuItem' })
|
||||
|
||||
const props = defineProps({
|
||||
// eslint-disable-next-line
|
||||
// eslint-disable-next-line vue/no-reserved-props
|
||||
key: propTypes.string,
|
||||
text: propTypes.string,
|
||||
icon: propTypes.string,
|
||||
|
|
|
@ -8,6 +8,7 @@ import { useLocaleStoreWithOut } from '@/store/modules/locale'
|
|||
|
||||
const { fallback, availableLocales } = localeSetting
|
||||
|
||||
// eslint-disable-next-line import/no-mutable-exports
|
||||
export let i18n: ReturnType<typeof createI18n>
|
||||
|
||||
async function createI18nOptions(): Promise<I18nOptions> {
|
||||
|
|
|
@ -80,7 +80,7 @@ export function transformObjToRoute<T = AppRouteModule>(routeList: AppRouteModul
|
|||
routeList.forEach((route) => {
|
||||
if (isUrl(route.path))
|
||||
route.component = 'IFrame'
|
||||
else if (route.children && route.parentId == 0)
|
||||
else if (route.children && route.parentId === 0)
|
||||
route.component = 'LAYOUT'
|
||||
else if (!route.children)
|
||||
route.component = route.component as string
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable @typescript-eslint/unbound-method */
|
||||
import type { BasicKeys } from '@/utils/cache/persistent'
|
||||
import { Persistent } from '@/utils/cache/persistent'
|
||||
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}`
|
||||
|
||||
if (Array.isArray(mods))
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
||||
return mods.reduce((ret, item) => ret + genBem(name, item), '')
|
||||
|
||||
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]
|
||||
})
|
||||
// eslint-disable-next-line no-unused-expressions
|
||||
branchArr.length > 0 ? (father.children = branchArr) : ''
|
||||
// 返回第一层
|
||||
return father[parentId] === rootId
|
||||
|
|
|
@ -32,6 +32,7 @@ const getShow = computed(() => unref(getLoginState) === LoginStateEnum.REGISTER)
|
|||
async function handleRegister() {
|
||||
const data = await validForm()
|
||||
if (!data)
|
||||
// eslint-disable-next-line no-useless-return
|
||||
return
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -5,7 +5,7 @@ import { getRecordPage } from '@/api/member/point/record'
|
|||
|
||||
defineOptions({ name: 'PointRecord' })
|
||||
|
||||
const [registerTable, { reload }] = useTable({
|
||||
const [registerTable] = useTable({
|
||||
title: '积分记录列表',
|
||||
api: getRecordPage,
|
||||
columns,
|
||||
|
|
|
@ -39,7 +39,7 @@ async function handleQueryDetails(record: Recordable) {
|
|||
<template v-if="column.key === 'action'">
|
||||
<TableAction
|
||||
: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>
|
||||
|
|
|
@ -59,7 +59,7 @@ async function handleExport() {
|
|||
<template v-if="column.key === 'action'">
|
||||
<TableAction
|
||||
: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>
|
||||
|
|
|
@ -59,7 +59,7 @@ async function handleExport() {
|
|||
<template v-if="column.key === 'action'">
|
||||
<TableAction
|
||||
: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>
|
||||
|
|
Loading…
Reference in New Issue