张同海 7 months ago
commit 85ff828b96

@ -26,27 +26,263 @@ module.exports = {
'plugin:prettier/recommended',
],
rules: {
// 不允许使用 console.log 等
'no-console': 'warn',
// 不允许存在未使用的变量
'no-unused-vars': 'warn',
// 不允许使用未定义的变量
'no-undef': 'error',
// HTML 缩进为 2 个空格
'vue/html-indent': ['error', 2],
// 属性名使用连字符形式
'vue/attribute-hyphenation': 'error',
// 关闭自闭合标签要求,根据个人或团队喜好配置
'vue/html-self-closing': 'off',
// 允许使用 v-html 指令
'vue/max-attributes-per-line': [
2,
{
singleline: 10,
multiline: {
max: 1,
allowFirstLine: false
}
}
],
// 'vue/singleline-html-element-content-newline': 'off',
// 'vue/multiline-html-element-content-newline': 'off',
'vue/name-property-casing': ['error', 'PascalCase'],
'eqeqeq': 'off',
'vue/no-v-html': 'off',
// 不允许存在未使用的组件
'vue/no-unused-components': 'warn',
// 不允许存在未使用的 TypeScript 变量
'@typescript-eslint/no-unused-vars': 'warn',
// 允许不显式指定导出函数的返回类型
'@typescript-eslint/explicit-module-boundary-types': 'off',
// 允许使用 any 类型
'@typescript-eslint/no-explicit-any': 'off',
},
'accessor-pairs': 2,
'arrow-spacing': [
2,
{
before: true,
after: true
}
],
'block-spacing': [2, 'always'],
'brace-style': [
2,
'1tbs',
{
allowSingleLine: true
}
],
camelcase: [
0,
{
properties: 'always'
}
],
'comma-dangle': [2, 'never'],
'comma-spacing': [
2,
{
before: false,
after: true
}
],
'comma-style': [2, 'last'],
'constructor-super': 2,
curly: [2, 'multi-line'],
'dot-location': [2, 'property'],
'eol-last': 2,
// eqeqeq: ['error', 'always', { null: 'ignore' }],
'generator-star-spacing': [
2,
{
before: true,
after: true
}
],
'handle-callback-err': [2, '^(err|error)$'],
indent: [
2,
2,
{
SwitchCase: 1
}
],
'jsx-quotes': [2, 'prefer-single'],
'key-spacing': [
2,
{
beforeColon: false,
afterColon: true
}
],
'keyword-spacing': [
2,
{
before: true,
after: true
}
],
'new-cap': [
2,
{
newIsCap: true,
capIsNew: false
}
],
'new-parens': 2,
'no-array-constructor': 2,
'no-caller': 2,
'no-console': 'off',
'no-class-assign': 2,
'no-cond-assign': 2,
'no-const-assign': 2,
'no-control-regex': 0,
'no-delete-var': 2,
'no-dupe-args': 2,
'no-dupe-class-members': 2,
'no-dupe-keys': 2,
'no-duplicate-case': 2,
'no-empty-character-class': 2,
'no-empty-pattern': 2,
'no-eval': 2,
'no-ex-assign': 2,
'no-extend-native': 2,
'no-extra-bind': 2,
'no-extra-boolean-cast': 2,
'no-extra-parens': [2, 'functions'],
'no-fallthrough': 2,
'no-floating-decimal': 2,
'no-func-assign': 2,
'no-implied-eval': 2,
'no-inner-declarations': [2, 'functions'],
'no-invalid-regexp': 2,
'no-irregular-whitespace': 2,
'no-iterator': 2,
'no-label-var': 2,
'no-labels': [
2,
{
allowLoop: false,
allowSwitch: false
}
],
'no-lone-blocks': 2,
'no-mixed-spaces-and-tabs': 2,
'no-multi-spaces': 2,
'no-multi-str': 2,
'no-multiple-empty-lines': [
2,
{
max: 1
}
],
'no-native-reassign': 2,
'no-negated-in-lhs': 2,
'no-new-object': 2,
'no-new-require': 2,
'no-new-symbol': 2,
'no-new-wrappers': 2,
'no-obj-calls': 2,
'no-octal': 2,
'no-octal-escape': 2,
'no-path-concat': 2,
'no-proto': 2,
'no-redeclare': 2,
'no-regex-spaces': 2,
'no-return-assign': [2, 'except-parens'],
'no-self-assign': 2,
'no-self-compare': 2,
'no-sequences': 2,
'no-shadow-restricted-names': 2,
'no-spaced-func': 2,
'no-sparse-arrays': 2,
'no-this-before-super': 2,
'no-throw-literal': 2,
'no-trailing-spaces': 2,
'no-undef': 2,
'no-undef-init': 2,
'no-unexpected-multiline': 2,
'no-unmodified-loop-condition': 2,
'no-unneeded-ternary': [
2,
{
defaultAssignment: false
}
],
'no-unreachable': 2,
'no-unsafe-finally': 2,
'no-unused-vars': [
2,
{
vars: 'all',
args: 'none'
}
],
'no-useless-call': 2,
'no-useless-computed-key': 2,
'no-useless-constructor': 2,
'no-useless-escape': 0,
'no-whitespace-before-property': 2,
'no-with': 2,
'one-var': [
2,
{
initialized: 'never'
}
],
'operator-linebreak': [
2,
'after',
{
overrides: {
'?': 'before',
':': 'before'
}
}
],
'padded-blocks': [2, 'never'],
quotes: [
2,
'single',
{
avoidEscape: true,
allowTemplateLiterals: true
}
],
semi: [2, 'never'],
'semi-spacing': [
2,
{
before: false,
after: true
}
],
'space-before-blocks': [2, 'always'],
'space-before-function-paren': [2, 'never'],
'space-in-parens': [2, 'never'],
'space-infix-ops': 2,
'space-unary-ops': [
2,
{
words: true,
nonwords: false
}
],
'spaced-comment': [
2,
'always',
{
markers: [
'global',
'globals',
'eslint',
'eslint-disable',
'*package',
'!',
','
]
}
],
'template-curly-spacing': [2, 'never'],
'use-isnan': 2,
'valid-typeof': 2,
'wrap-iife': [2, 'any'],
'yield-star-spacing': [2, 'both'],
yoda: [2, 'never'],
'prefer-const': 2,
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0,
'object-curly-spacing': [
2,
'always',
{
objectsInObjects: false
}
],
'array-bracket-spacing': [2, 'never']
}
}

@ -58,6 +58,7 @@ enum Api {
getVouchingClerkList = '/mainApi/ClientCommon/GetVouchingClerkList',
getSaleUserList = '/mainApi/ClientCommon/GetSaleUserList',
getCustomerServiceList = '/mainApi/ClientCommon/GetCustomerServiceList',
GetClientUserPermissionCode = '/mainApi/Common/GetClientUserPermissionCode'
}
export function getCustomerServiceList() {
return request<DataResult>({
@ -255,6 +256,13 @@ export function getPermCode() {
method: 'get',
})
}
export function getClientUserPermissionCode() {
return request<DataResult<string[]>>({
url: Api.GetClientUserPermissionCode,
method: 'get',
})
}
export function getUserTenants() {
return request<DataResult<TenantSelectList>>({
url: Api.getUserTenants,

@ -211,21 +211,43 @@ export function useFormEvents({
)
return
}
// 重组的表单
const schema: FormSchema[] = []
updateData.forEach((item) => {
let _val
unref(getSchema).forEach((val) => {
if (item.field === val.field) {
_val = val
// 原始的表单
const oldSchema = unref(getSchema)
if (updateData.length == oldSchema.length) {
// 如果原始表单和赋值表单长度相同,则用赋值表单排序
updateData.forEach((item) => {
let _val
oldSchema.forEach((val) => {
if (item.field === val.field) {
_val = val
}
})
if (_val !== undefined && item.field === _val.field) {
const newSchema = deepMerge(_val, item)
schema.push(newSchema as FormSchema)
} else {
schema.push(_val)
}
})
if (_val !== undefined && item.field === _val.field) {
const newSchema = deepMerge(_val, item)
schema.push(newSchema as FormSchema)
} else {
schema.push(_val)
}
})
} else {
// 如果原始表单和赋值表单长度不同,则不考虑排序,用原始表单进行赋值
oldSchema.forEach((val) => {
let _val
updateData.forEach((item) => {
if (val.field === item.field) {
_val = item
}
})
if (_val !== undefined && val.field === _val.field) {
const newSchema = deepMerge(val, _val)
schema.push(newSchema as FormSchema)
} else {
schema.push(val)
}
})
}
_setDefaultValue(schema)
schemaRef.value = uniqBy(schema, 'field')
}

@ -7,6 +7,13 @@
>
<DiffOutlined @click="addFormToSet" />
</Tooltip>
<Tooltip
v-if="formSchema && formSchema.length"
:title="t('component.modal.copy')"
placement="bottom"
>
<CopyrightOutlined @click="copyFormToSet" />
</Tooltip>
<template v-if="canFullscreen">
<Tooltip v-if="fullScreen" :title="t('component.modal.restore')" placement="bottom">
<FullscreenExitOutlined role="full" @click="handleFullScreen" />
@ -22,13 +29,17 @@
</template>
<script lang="ts">
import { FormSchema } from '/@/components/Table'
//
import { editCodeGoodsType } from '/@/views/baseinfo/formset/api'
//
import { EditFormCopy } from '/@/views/baseinfo/formcopy/api'
import { defineComponent, computed } from 'vue'
import {
FullscreenExitOutlined,
FullscreenOutlined,
CloseOutlined,
DiffOutlined
DiffOutlined,
CopyrightOutlined
} from '@ant-design/icons-vue'
import { useDesign } from '/@/hooks/web/useDesign'
import { Tooltip } from 'ant-design-vue'
@ -46,7 +57,8 @@
FullscreenExitOutlined,
FullscreenOutlined,
CloseOutlined,
DiffOutlined
DiffOutlined,
CopyrightOutlined
},
props: {
canFullscreen: { type: Boolean, default: true },
@ -81,6 +93,32 @@
e?.preventDefault()
emit('fullscreen')
}
//
const copyFormToSet = () => {
const columns = props.formSchema.map((item: FormSchema) => {
const res = {
field: item.field || '',
label: item.label || '',
enLabel: item.enLabel || ''
}
return res
})
const Apidata = {
id: 0,
permissionId: permissionsInfo().permissionId,
templateName: permissionsInfo().permissionName,
permissionName: permissionsInfo().permissionName,
copyFields: '',
content: JSON.stringify({
columns: columns
})
}
EditFormCopy(Apidata).then(res => {
if (res.succeeded) {
createMessage.success('添加成功!')
}
})
}
//
const addFormToSet = () => {
const columns = props.formSchema.map((item: FormSchema) => {
@ -123,6 +161,7 @@
prefixCls,
handleCancel,
addFormToSet,
copyFormToSet,
handleFullScreen,
}
},
@ -134,7 +173,8 @@
display: flex;
height: 95%;
align-items: center;
justify-content: center;
justify-content: flex-end;
margin-right: 15px;
> span {
margin-left: 48px;
font-size: 16px;

@ -21,6 +21,10 @@ import { isEqual } from 'lodash-es'
import { tryOnUnmounted } from '@vueuse/core'
import { error } from '/@/utils/log'
import { computed } from 'vue'
// 获取表单更改过的字段接口
import { getFormSetInfoByModule } from '/@/views/baseinfo/formset/api'
// 引入表格权限信息包含id和name
import { permissionsInfo } from '/@/hooks/web/usePermission'
const dataTransfer = reactive<any>({})
@ -135,6 +139,14 @@ export const useModalInner = (callbackFn?: Fn): UseModalInnerReturnType => {
return [
register,
{
updateFormField: (updateSchema) => {
getFormSetInfoByModule({ permissionId: permissionsInfo().permissionId }).then(res => {
if (res?.data?.content) {
const content = JSON.parse(res.data.content)
updateSchema(content.columns)
}
})
},
changeLoading: (loading = true) => {
getInstance()?.setModalProps({ loading })
},

@ -69,7 +69,7 @@
&-close-x {
display: inline-block;
width: 96px;
width: 135px;
height: 56px;
line-height: 56px;
}

@ -24,7 +24,9 @@ export interface ReturnInnerMethods extends ModalMethods {
changeLoading: (loading: boolean) => void
changeOkLoading: (loading: boolean) => void
getVisible?: ComputedRef<boolean>
redoModalHeight: () => void
redoModalHeight: () => void,
// 更新设置后的表单字段
updateFormField: (updateSchema) => void
}
export type UseModalInnerReturnType = [RegisterFn, ReturnInnerMethods]

@ -1,5 +1,5 @@
<template>
<div ref="wrapRef" :class="getWrapperClass">
<div ref="wrapRef" :class="getWrapperClass" class="basic-table-search-form">
<BasicForm
v-if="getBindValues.useSearchForm"
ref="formRef"
@ -448,4 +448,9 @@
}
}
}
.basic-table-search-form {
.ant-form-item-no-colon {
color: #79868c;
}
}
</style>

@ -14,6 +14,7 @@ html {
@content-bg: #f4f7f9;
// :export {
// name: "less";
// mainColor: @mainColor;

@ -28,7 +28,6 @@ export function permissionsInfo() {
const routerList = treeOptionData(usePermissionStore().getWrouteList)
routerList.forEach(item => {
if (item.path === fullPath.value) {
console.log(fullPath.value)
permissionId = item.id
permissionName = item.name
}

@ -52,7 +52,8 @@ export default {
close: 'Close',
maximize: 'Maximize',
restore: 'Restore',
edit: 'Add form to form settings'
edit: 'Add form to form settings',
copy: 'Add this form to the form copying template',
},
table: {
settingDens: 'Density',

@ -54,7 +54,8 @@ export default {
close: '关闭',
maximize: '最大化',
restore: '还原',
edit: '将该表单添加到表单设置'
edit: '将该表单添加到表单设置',
copy: '将该表单添加到表单复制模版',
},
table: {
settingDens: '密度',

@ -21,7 +21,7 @@ import { filter } from '/@/utils/helper/treeHelper'
import { useMessage } from '/@/hooks/web/useMessage'
import { PageEnum } from '/@/enums/pageEnum'
import { getMenuList } from '/@/api/common/index'
import { getMenuList, getClientUserPermissionCode } from '/@/api/common/index'
interface PermissionState {
// Permission code list
@ -111,10 +111,10 @@ export const usePermissionStore = defineStore({
this.backMenuList = []
this.lastBuildMenuTime = 0
},
// async changePermissionCode() {
// const codeList = await getPermCode()
// this.setPermCodeList(codeList)
// },
async changePermissionCode() {
const codeList = await getClientUserPermissionCode()
this.setPermCodeList(codeList.data)
},
// 构建路由
async buildRoutesAction(): Promise<AppRouteRecordRaw[]> {
@ -228,7 +228,7 @@ export const usePermissionStore = defineStore({
// 这个功能可能只需要执行一次,实际项目可以自己放在合适的时间
let routeList: AppRouteRecordRaw[] = []
try {
// await this.changePermissionCode()
await this.changePermissionCode()
// routeList = (await getMenuList()) as AppRouteRecordRaw[]
const res = await getMenuList()
console.log('后台返回路由', res, res.data[0].children)

@ -1,4 +1,4 @@
h1, h2, h3, h4, h5, h6 {
h1, h2, h3, h4, h5 {
font-weight: 600;
color: #262626;
padding: 0;

@ -1,109 +0,0 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
title="表单设置"
width="50%"
@register="registerModal"
@ok="handleSave"
>
<BasicForm @register="registerForm" />
<!--右下角按钮-->
<template #footer>
<a-button
pre-icon="ant-design:close-outlined"
type="warning"
:loading="loading"
ghost
style="margin-right: 0.8rem"
@click="closeModal"
>取消</a-button
>
<a-button
type="success"
:loading="loading"
pre-icon="ant-design:check-outlined"
style="margin-right: 0.8rem"
@click="handleSave(true)"
>
确定
</a-button>
</template>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref, h } from 'vue'
import { BasicModal, useModalInner } from '/@/components/Modal'
import { BasicForm, useForm } from '/@/components/Form/index'
// import { formSchema } from './columns'
import { editCodeGoodsType, getCodeGoodsTypeInfo } from './api'
import { useMessage } from '/@/hooks/web/useMessage'
import { Icon } from '/@/components/Icon'
import { useModal } from '/@/components/Modal'
const props = defineProps({
schemaArr: { type: Array },
})
let formSchema = props.schemaArr
const [register, { openModal }] = useModal()
// Emits
const emit = defineEmits(['contentOk', 'register'])
const isUpdate = ref(true)
const loading = ref(false)
const [registerForm, { resetFields, setFieldsValue, updateSchema, validate }] = useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
})
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields()
setModalProps({ confirmLoading: false, loading: true })
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
let obj = {}
JSON.parse(data.record.content).forEach((e) => {
obj[`${e.field}-defaultValue`] = e.defaultValue
obj[`${e.field}-required`] = e.required
obj[`${e.field}-show`] = e.show
})
setFieldsValue(obj)
setModalProps({ confirmLoading: false })
} else {
setFieldsValue({ permissionIdentity: unref(2) })
}
setModalProps({ loading: false })
})
async function handleSave(exit) {
try {
const values = await validate()
setModalProps({ confirmLoading: true, loading: true })
// TODO custom api
console.log(values)
let Arr = []
Object.keys(values).forEach((e) => {
let type = true
Arr.forEach((item) => {
if (item.field == e.split('-')[0]) {
item[e.split('-')[1]] = values[e]
type = false
}
})
if (type) {
let obj = {
field: e.split('-')[0],
}
obj[e.split('-')[1]] = values[e]
Arr.push(obj)
}
// console.log()
})
emit('contentOk', JSON.stringify(Arr))
exit && closeModal()
} finally {
// loading.value = false;
setModalProps({ confirmLoading: false, loading: false })
}
}
</script>

@ -1,229 +0,0 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
:title="getTitle"
width="35%"
@register="registerModal"
@ok="handleSave"
>
<BasicForm @register="registerForm" />
<!--右下角按钮-->
<template #footer>
<a-button
pre-icon="ant-design:close-outlined"
type="warning"
:loading="loading"
ghost
style="margin-right: 0.8rem"
@click="closeModal"
>
取消
</a-button>
<a-button
type="success"
:loading="loading"
pre-icon="ant-design:check-outlined"
style="margin-right: 0.8rem"
@click="handleSave(false)"
>
仅保存
</a-button>
<a-button
pre-icon="ant-design:check-circle-outlined"
type="primary"
:loading="loading"
@click="handleSave(true)"
>保存并关闭</a-button
>
</template>
</BasicModal>
<Modal v-if="ModalType" :schema-arr="schemaArr" @register="register" @contentOk="contentOk" />
</template>
<script lang="ts" setup>
import { ref, computed, unref, h } from 'vue'
import { BasicModal, useModalInner } from '/@/components/Modal'
import { BasicForm, useForm } from '/@/components/Form/index'
import { formSchema } from './columns'
import { editCodeGoodsType, getCodeGoodsTypeInfo, getColumnsByClient } from './api'
import { useMessage } from '/@/hooks/web/useMessage'
import { Icon } from '/@/components/Icon'
import { useModal } from '/@/components/Modal'
import Modal from './Modal.vue'
const [register, { openModal }] = useModal()
// Emits
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const loading = ref(false)
const rowId = ref('')
const schemaArr = ref([])
const ModalType = ref(false)
const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, updateSchema, validate }] = useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
})
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields()
setModalProps({ confirmLoading: false, loading: true })
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
// setModalProps({ confirmLoading: true });
rowId.value = data.record.id
const res: API.DataResult = await getCodeGoodsTypeInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({
...res.data,
})
// console.log('Form', getFieldsValue());
// setFieldsValue({ trainId: unref(res.data.trainId) });
}
// setModalProps({ confirmLoading: false });
} else {
setFieldsValue({ permissionIdentity: unref(2) })
}
updateSchema({
field: 'setting',
label: '',
component: 'Input',
colProps: { span: 2 },
// Input
render: ({ model, field }) => {
return h(Icon, {
icon: 'ant-design:setting-filled',
style: { marginLeft: '10px', cursor: 'pointer' },
// value: model[field],
// onChange: (e: ChangeEvent) => {
// model[field] = e.target.value
// },
onClick: async (e) => {
if (model.columnView) {
schemaArr.value = []
let schemaA = []
const res: API.DataResult = await getColumnsByClient({
tableViewName: model.columnView,
})
// const res: API.DataResult = await getCodeGoodsTypeInfo({ id: unref(rowId) })
if (res.succeeded) {
res.data.forEach((e) => {
schemaA.push(
...[
{
field: `divider-${e.dbColumnName}`,
component: 'Divider',
label: e.columnDescription,
colProps: {
span: 24,
},
},
{
field: `${e.dbColumnName}-defaultValue`,
label: '默认值',
component: 'Input',
colProps: { span: 8 },
defaultValue: '',
},
{
field: `${e.dbColumnName}-required`,
label: '是否必填',
component: 'RadioButtonGroup',
defaultValue: false,
colProps: { span: 8 },
componentProps: {
options: [
{ label: '是', value: true },
{ label: '否', value: false },
],
},
},
{
field: `${e.dbColumnName}-show`,
label: '是否显示',
component: 'RadioButtonGroup',
defaultValue: false,
colProps: { span: 8 },
componentProps: {
options: [
{ label: '是', value: true },
{ label: '否', value: false },
],
},
},
],
)
// schemaA.push({
// field: e.dbColumnName,
// label: e.columnDescription,
// defaultValue: '',
// show: true,
// required: false,
// })
})
schemaArr.value = schemaA
}
ModalType.value = true
setTimeout(() => {
openModal(true, {
record: model,
isUpdate: model.content ? true : false,
})
}, 300)
} else {
createMessage.warning('请先选择中文视图名')
}
},
})
},
})
setModalProps({ loading: false })
})
function contentOk(data) {
console.log(data)
setFieldsValue({
content: data,
})
}
const getTitle = computed(() => (!unref(isUpdate) ? '新增表单复制模板' : '编辑表单复制模板'))
async function handleSave(exit) {
try {
const values = await validate()
setModalProps({ confirmLoading: true, loading: true })
// TODO custom api
console.log(values)
// loading.value = true;
const res: API.DataResult = await editCodeGoodsType(values)
console.log(res)
if (res.succeeded) {
createMessage.success(res.message)
emit('success')
//
if (!exit) {
if (unref(isUpdate)) {
await refresh()
} else {
rowId.value = res.data
isUpdate.value = true
await refresh()
}
}
} else {
createMessage.error(res.message)
}
ModalType.value = false
exit && closeModal()
} finally {
// loading.value = false;
setModalProps({ confirmLoading: false, loading: false })
}
}
async function refresh() {
const res: API.DataResult = await getCodeGoodsTypeInfo({ id: unref(rowId) })
if (res.succeeded) {
await setFieldsValue({
...res.data,
})
}
}
</script>

@ -3,7 +3,7 @@ import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/mainApi/FormCopy/GetFormCopyList',
EditCodeGoodsType = '/mainApi/FormCopy/EditFormCopy',
EditFormCopy = '/mainApi/FormCopy/EditFormCopy',
GetCodeGoodsTypeInfo = '/mainApi/FormCopy/GetFormCopyInfo',
GetTablesByClient = '/mainApi/Common/GetTablesByClient',
@ -18,9 +18,9 @@ export function getCodeGoodsTypeList(data: PageRequest) {
})
}
// 编辑 (Auth)
export function editCodeGoodsType(data: PageRequest) {
export function EditFormCopy(data: PageRequest) {
return request<DataResult>({
url: Api.EditCodeGoodsType,
url: Api.EditFormCopy,
method: 'post',
data,
})

@ -18,7 +18,6 @@ const ClientPermissionData = []
let ClientPermissionList = []
const res2: API.DataResult = await getClientPermissionList()
if (res2.succeeded) {
console.log(res2)
ClientPermissionList = res2.data
res2.data.forEach((item) => {
ClientPermissionData.push({
@ -51,11 +50,11 @@ export const columns: BasicColumn[] = [
return text
},
},
{
title: '备注',
dataIndex: 'note',
width: 150,
},
// {
// title: '备注',
// dataIndex: 'note',
// width: 150,
// },
{
title: '排序号',
dataIndex: 'orderNo',
@ -185,13 +184,13 @@ export const formSchema: FormSchema[] = [
colProps: { span: 20 },
defaultValue: 1,
},
{
field: 'note',
label: '备注',
component: 'InputTextArea',
colProps: { span: 20 },
componentProps: {
rows: 2,
},
},
// {
// field: 'note',
// label: '备注',
// component: 'InputTextArea',
// colProps: { span: 20 },
// componentProps: {
// rows: 2,
// },
// },
]

@ -0,0 +1,181 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
title="编辑表单复制模板"
width="50%"
@register="registerModal"
@ok="handleSave"
>
<a-form v-model="formData" class="copy-form-model" layout="vertical">
<a-row :gutter="16">
<a-col :span="12">
<a-form-item label="模版名称" name="templateName">
<a-input v-model:value="formData.templateName" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="权限模块名称">
<a-input v-model:value="formData.permissionName" disabled placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="排序号">
<a-input v-model:value="formData.orderNo" placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="表单号">
<a-input v-model:value="formData.formNo" disabled placeholder="请输入" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="是否可用">
<a-radio-group v-model:value="formData.status" button-style="solid">
<a-radio-button :value="0">禁用</a-radio-button>
<a-radio-button :value="1">启用</a-radio-button>
</a-radio-group>
</a-form-item>
</a-col>
<a-col :span="12">
<a-form-item label="是否公共表示">
<a-radio-group v-model:value="formData.isPublic" button-style="solid">
<a-radio-button :value="true"></a-radio-button>
<a-radio-button :value="false"></a-radio-button>
</a-radio-group>
</a-form-item>
</a-col>
</a-row>
<a-form-item label="表单设置">
<a-checkbox-group v-model:value="checkedList" style="width: 100%">
<a-row>
<a-col
v-for="(item, index) in plainOptions"
v-show="item.field != 'id'"
:span="6"
:key="index">
<a-checkbox :value="item.field">{{ item.label }}</a-checkbox>
</a-col>
</a-row>
</a-checkbox-group>
</a-form-item>
</a-form>
<!--右下角按钮-->
<template #footer>
<a-button
pre-icon="ant-design:close-outlined"
type="warning"
:loading="loading"
ghost
style="margin-right: 0.8rem"
@click="closeModal"
>
取消
</a-button>
<a-button
type="success"
:loading="loading"
pre-icon="ant-design:check-outlined"
style="margin-right: 0.8rem"
@click="handleSave(false)"
>
仅保存
</a-button>
<a-button
pre-icon="ant-design:check-circle-outlined"
type="primary"
:loading="loading"
@click="handleSave(true)"
>
保存并关闭
</a-button>
</template>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, unref, reactive, defineEmits } from 'vue'
import { BasicModal, useModalInner } from '/@/components/Modal'
import { EditFormCopy, getCodeGoodsTypeInfo } from '../api'
import { useMessage } from '/@/hooks/web/useMessage'
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
const loading = ref(false)
const rowId = ref('')
const form = ref()
const checkedList = ref()
const formData = reactive({
id: '',
templateName: '',
permissionId: '',
permissionName: '',
isPublic: '',
copyFields: '',
formNo: '',
orderNo: '',
status: '',
content: ''
})
const plainOptions = ref([])
const { createMessage } = useMessage()
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
setModalProps({ confirmLoading: false, loading: true })
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
rowId.value = data.record.id
const res: API.DataResult = await getCodeGoodsTypeInfo({ id: unref(rowId) })
if (res?.data?.content) {
const content = JSON.parse(res.data.content)
plainOptions.value = content.columns
}
formData.id = res.data.id
formData.templateName = res.data.templateName
formData.permissionId = res.data.permissionId
formData.permissionName = res.data.permissionName
formData.isPublic = res.data.isPublic
formData.formNo = res.data.formNo
formData.orderNo = res.data.orderNo
formData.status = res.data.status
formData.content = res.data.content
if (res.data.copyFields) {
checkedList.value = res.data.copyFields.split(',')
}
}
setModalProps({ loading: false })
})
async function handleSave(exit) {
try {
setModalProps({ confirmLoading: true, loading: true })
// TODO custom api
if (checkedList.value && checkedList.value.length) {
formData.copyFields = String(checkedList.value)
}
loading.value = true
const res: API.DataResult = await EditFormCopy(formData)
loading.value = false
if (res.succeeded) {
createMessage.success(res.message)
emit('success')
} else {
createMessage.error(res.message)
}
exit && closeModal()
} finally {
// loading.value = false;
setModalProps({ confirmLoading: false, loading: false })
}
}
</script>
<style lang="scss">
.copy-form-model {
.ant-form-item-label {
padding-bottom: 0;
label {
font-size: 12px;
font-weight: 600;
}
}
}
</style>

@ -1,9 +1,6 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleCreate"> </a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction
@ -18,21 +15,15 @@
</template>
</template>
</BasicTable>
<TenantAuditStepModal @register="registerModal" @success="handleSuccess" />
<Modal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { defineComponent, onMounted, ref } from 'vue'
import { BasicTable, useTable, TableAction, SorterResult } from '/@/components/Table'
import { BasicTable, useTable, TableAction } from '/@/components/Table'
import { getCodeGoodsTypeList } from './api'
import { useModal } from '/@/components/Modal'
import TenantAuditStepModal from './TenantAuditStepModal.vue'
import Modal from './components/Modal.vue'
import { columns, searchFormSchema } from './columns'
import { useMessage } from '/@/hooks/web/useMessage'
const { notification } = useMessage()
let filterInfo: Partial<Recordable<string[]>> = []
let sortInfo: SorterResult = {}
const refImportFlow = ref()
const [registerModal, { openModal }] = useModal()
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
title: '表单复制模板列表',
@ -114,12 +105,6 @@
fixed: 'right',
},
})
function handleCreate() {
openModal(true, {
isParent: false,
isUpdate: false,
})
}
function handleAudit(record: Recordable) {
openModal(true, {
record,

@ -25,6 +25,7 @@
</a-button>
<a-button
type="success"
:loading="loading"
pre-icon="ant-design:check-outlined"
style="margin-right: 0.8rem"
@click="handleSave(false)"
@ -32,6 +33,7 @@
仅保存
</a-button>
<a-button
:loading="loading"
pre-icon="ant-design:check-circle-outlined"
type="primary"
@click="handleSave(true)"
@ -51,6 +53,7 @@
import DsForm from './form.vue'
// Emits
const emit = defineEmits(['success', 'register'])
const loading = ref(false)
const isUpdate = ref(true)
const rowId = ref('')
const content = ref({})
@ -76,9 +79,11 @@
async function handleSave(exit) {
const contents = await FormDragRef.value.validate()
if (contents) {
loading.value = true
setModalProps({ confirmLoading: true, loading: true })
postData.content = JSON.stringify({ columns: contents })
editCodeGoodsType(postData).then(res => {
loading.value = false
if (exit) {
closeModal()
}

@ -6,9 +6,6 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleCreate"> </a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'action'">
<TableAction

@ -44,10 +44,6 @@
import { BasicForm, useForm } from '/@/components/Form/index'
import { formSchema } from './columns'
import { ApiEdit, ApiInfo } from './api'
// idname
import { permissionsInfo } from '/@/hooks/web/usePermission'
//
import { getFormSetInfoByModule } from '/@/views/baseinfo/formset/api'
import { useMessage } from '/@/hooks/web/useMessage'
// Emits
const emit = defineEmits(['success', 'register'])
@ -61,19 +57,14 @@
showActionButtonGroup: false,
})
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
const [registerModal, { setModalProps, closeModal, updateFormField }] = useModalInner(async (data) => {
resetFields()
setModalProps({ confirmLoading: false, loading: true })
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
// setModalProps({ confirmLoading: true });
rowId.value = data.record.id
getFormSetInfoByModule({ permissionId: permissionsInfo().permissionId }).then(res => {
if (res?.data?.content) {
const content = JSON.parse(res.data.content)
updateSchema(content.columns)
}
})
updateFormField(updateSchema)
const res: API.DataResult = await ApiInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({

@ -0,0 +1,37 @@
/*
* @Description: ->
* @Author: lijj
* @Date: 2024-04-25 15:48:33
*/
import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/feeApi/FeeCurrency/GetFeeCurrencyList',
edit = '/feeApi/FeeCurrency/EditFeeCurrency',
info = '/feeApi/FeeCurrency/GetFeeCurrencyInfo'
}
// 列表 (Auth)
export function getFeeCurrencyList(data: PageRequest) {
return request<DataResult>({
url: Api.list,
method: 'post',
data
})
}
// 编辑 (Auth)
export function editFeeCurrency(data: PageRequest) {
return request<DataResult>({
url: Api.edit,
method: 'post',
data
})
}
// 详情 (Auth)
export function getFeeCurrencyInfo(query) {
return request<DataResult>({
url: Api.info,
method: 'get',
params: query
})
}

@ -0,0 +1,85 @@
/*
* @Description: tsx
* @Author: lijj
* @Date: 2024-04-25 15:48:33
*/
import { BasicColumn, FormSchema } from '/@/components/Table'
export const columns: BasicColumn[] = [
{
title: '币别代码',
dataIndex: 'codeName',
width: 150
},
{
title: '英文名称',
dataIndex: 'name',
width: 200
},
{
title: '中文描述名称',
dataIndex: 'description',
width: 200
},
{
title: '对人民币汇率',
dataIndex: 'defaultRate',
width: 200
},
{
title: '财务软件代码',
dataIndex: 'financeSoftCode',
width: 200
}
]
export const searchFormSchema: FormSchema[] = [
{
field: 'codeName',
label: '币别代码',
component: 'Input',
colProps: { span: 6 },
},
]
export const formSchema: FormSchema[] = [
{
label: '',
field: 'id',
component: 'Input',
defaultValue: '',
show: false
},
{
field: 'codeName',
label: '币别代码',
component: 'Input',
required: true,
colProps: { span: 12 }
},
{
field: 'name',
label: '英文名称',
component: 'Input',
required: true,
colProps: { span: 12 }
},
{
field: 'description',
label: '中文描述名称',
component: 'Input',
required: true,
colProps: { span: 12 },
},
{
field: 'defaultRate',
label: '对人民币汇率',
component: 'Input',
colProps: { span: 12 }
},
{
field: 'financeSoftCode',
label: '财务软件代码',
required: true,
component: 'Input',
colProps: { span: 12 }
}
]

@ -0,0 +1,110 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
:title="getTitle"
:form-schema="formSchema"
width="50%"
@register="registerModal"
@ok="handleSave"
>
<!-- 币别表单 -->
<BasicForm @register="registerForm" />
<!--右下角按钮-->
<template #footer>
<a-button
pre-icon="ant-design:close-outlined"
type="warning"
:loading="loading"
ghost
style="margin-right: 0.8rem"
@click="closeModal"
>
取消
</a-button>
<a-button
type="success"
:loading="loading"
pre-icon="ant-design:check-outlined"
style="margin-right: 0.8rem"
@click="handleSave(false)"
>
仅保存
</a-button>
<a-button
pre-icon="ant-design:check-circle-outlined"
type="primary"
:loading="loading"
@click="handleSave(true)"
>
保存并关闭
</a-button>
</template>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, computed, unref } from 'vue'
//
import { BasicModal, useModalInner } from '/@/components/Modal'
import { BasicForm, useForm } from '/@/components/Form/index'
//
import { formSchema } from '../columns'
//
import { editFeeCurrency, getFeeCurrencyInfo } from '../api'
//
import { useMessage } from '/@/hooks/web/useMessage'
// Emits
const emit = defineEmits(['success', 'register'])
const isUpdate = ref(true)
// loading
const loading = ref(false)
const rowId = ref('')
const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, validate, updateSchema }] =
useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
})
const [registerModal, { setModalProps, closeModal, updateFormField }] = useModalInner(async (data) => {
resetFields()
setModalProps({ confirmLoading: false, loading: true })
isUpdate.value = !!data?.isUpdate
if (unref(isUpdate)) {
setModalProps({ confirmLoading: true });
updateFormField(updateSchema)
rowId.value = data.record.id
const res: API.DataResult = await getFeeCurrencyInfo({ id: unref(rowId) })
if (res.succeeded) {
setFieldsValue({
...res.data,
})
}
} else {
setFieldsValue({ permissionIdentity: unref(2) })
}
setModalProps({ loading: false })
})
const getTitle = computed(() => (!unref(isUpdate) ? '新增币别' : '编辑币别'))
async function handleSave(exit) {
try {
const values = await validate()
loading.value = true
setModalProps({ confirmLoading: true, loading: true })
const res: API.DataResult = await editFeeCurrency(values)
loading.value = false
if (res.succeeded) {
createMessage.success(res.message)
emit('success')
} else {
createMessage.error(res.message)
}
exit && closeModal()
} finally {
setModalProps({ confirmLoading: false, loading: false })
}
}
</script>

@ -0,0 +1,121 @@
<template>
<div>
<BasicTable @register="registerTable">
<template #toolbar>
<a-button type="primary" @click="handleCreate"> </a-button>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.key === 'userName'">
<span style="color: #0d84ff" @click="handleEdit(record)">{{ record.userName }}</span>
</template>
<template v-if="column.key === 'action'">
<TableAction
:actions="[
{
icon: 'clarity:note-edit-line',
tooltip: '编辑',
onClick: handleEdit.bind(null, record),
},
]"
/>
</template>
</template>
</BasicTable>
<Modal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { defineComponent, onMounted, ref } from 'vue'
import { BasicTable, useTable, TableAction } from '/@/components/Table'
import { getFeeCurrencyList, ApiImport } from './api'
import { useModal } from '/@/components/Modal'
import Modal from './components/Modal.vue'
import { columns, searchFormSchema } from './columns'
const dictOptions = ref<any[]>([])
const [registerModal, { openModal }] = useModal()
const [registerPermissionModal, { openModal: openPermissionModal }] = useModal()
const [registerTable, { reload, getForm, getPaginationRef }] = useTable({
title: '币别设置',
// api: getSysDictTypeList,
api: async (p) => {
const res: API.DataResult = await getFeeCurrencyList(p)
// console.log(items);
return new Promise((resolve) => {
resolve({ data: [...res.data], total: res.count })
})
},
beforeFetch: () => {
var currentPageInfo: any = getPaginationRef()
var data = getForm().getFieldsValue()
const postParam: API.PageRequest = {
queryCondition: '',
pageCondition: {
pageIndex: currentPageInfo.current,
pageSize: currentPageInfo.pageSize,
sortConditions: [],
},
}
let condition: API.ConditionItem[] = []
if (!!data.UserName) {
condition.push({
FieldName: 'UserName',
FieldValue: data.UserName,
ConditionalType: 1,
})
}
if (!!data.UserCode) {
condition.push({
FieldName: 'UserCode',
FieldValue: data.UserCode,
ConditionalType: 1,
})
}
postParam.queryCondition = JSON.stringify(condition)
// console.log(postParam);
return postParam
},
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
},
isTreeTable: false,
pagination: true,
striped: true,
useSearchForm: true,
showTableSetting: true,
bordered: true,
showIndexColumn: true,
canResize: false,
actionColumn: {
width: 80,
title: '操作',
dataIndex: 'action',
fixed: 'right',
},
})
function handleCreate() {
openModal(true, {
isParent: false,
isUpdate: false,
})
}
function handleEdit(record: Recordable) {
openModal(true, {
record,
isUpdate: true,
})
}
function handleDelete(record: Recordable) {
console.log(record)
}
onMounted(() => {
//
})
function handleSuccess() {
reload()
}
</script>

@ -1,6 +1,9 @@
import { ref } from 'vue'
import { BasicColumn, FormSchema } from '/@/components/Table'
import { getRoleList, getOrgList, getDeptList } from '/@/api/common'
import { Tag } from 'ant-design-vue'
const selectOrgList = ref([])
const selectDeptList = ref([])
export const columns: BasicColumn[] = [
{
title: '用户唯一码',
@ -277,39 +280,49 @@ export const formSchema: FormSchema[] = [
span: 24,
},
},
{
field: 'orgIds',
label: '所属机构',
component: 'ApiSelect',
required: true,
defaultValue: [],
colProps: { span: 12 },
componentProps: ({ formActionType }) => {
return {
mode: 'multiple',
api: getOrgList,
resultField: 'data',
onChange: async (e, list) => {
selectOrgList.value = list
formActionType.setFieldsValue({
defaultOrgId: '',
deptId: ''
})
}
}
},
},
{
field: 'defaultOrgId',
label: '默认机构',
component: 'ApiSelect',
required: true,
component: 'Select',
defaultValue: '',
colProps: { span: 12 },
componentProps: ({ schema, tableAction, formActionType, formModel }) => {
componentProps: ({ formActionType }) => {
return {
api: getOrgList,
options: selectOrgList,
resultField: 'data',
onChange: async (e: ChangeEvent) => {
const { updateSchema } = formActionType
let Arr = []
const res: API.DataResult = await getDeptList({ orgId: e })
if (res.succeeded) {
Arr = []
selectDeptList.value = []
res.data.forEach((e) => {
Arr.push({ label: e.orgName, value: e.id })
selectDeptList.value.push({ label: e.orgName, value: e.id })
})
}
updateSchema({
field: 'deptId',
label: '默认部门',
component: 'Select',
defaultValue: '',
colProps: { span: 12 },
componentProps: {
options: Arr,
allowClear: true,
},
dynamicDisabled: ({ values }) => {
return !values.defaultOrgId
},
formActionType.setFieldsValue({
deptId: ''
})
},
}
@ -322,7 +335,7 @@ export const formSchema: FormSchema[] = [
defaultValue: '',
colProps: { span: 12 },
componentProps: {
options: [{ label: 'WebTest001-1-1', value: '1760142686767157248' }],
options: selectDeptList,
allowClear: true,
},
dynamicDisabled: ({ values }) => {
@ -342,17 +355,4 @@ export const formSchema: FormSchema[] = [
resultField: 'data',
},
},
{
field: 'orgIds',
label: '所属机构',
component: 'ApiSelect',
required: true,
defaultValue: [],
colProps: { span: 12 },
componentProps: {
mode: 'multiple',
api: getOrgList,
resultField: 'data',
},
},
]

Loading…
Cancel
Save