最新提交

This commit is contained in:
2024-09-23 19:11:24 +08:00
parent 2866a07493
commit 7d594e0ec1
9 changed files with 219 additions and 183 deletions

148
cdTMP/package-lock.json generated
View File

@@ -26,7 +26,7 @@
"postcss-import": "^16.1.0", "postcss-import": "^16.1.0",
"qs": "^6.13.0", "qs": "^6.13.0",
"tinymce": "^7.3.0", "tinymce": "^7.3.0",
"vue": "^3.5.6", "vue": "^3.5.8",
"vue-clipboard3": "^2.0.0", "vue-clipboard3": "^2.0.0",
"vue-color-kit": "^1.0.6", "vue-color-kit": "^1.0.6",
"vue-echarts": "^7.0.3", "vue-echarts": "^7.0.3",
@@ -43,8 +43,8 @@
"@vue/babel-plugin-jsx": "^1.2.5", "@vue/babel-plugin-jsx": "^1.2.5",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"browserslist": "^4.23.0", "browserslist": "^4.23.0",
"caniuse-lite": "^1.0.30001662", "caniuse-lite": "^1.0.30001663",
"eslint": "^9.10.0", "eslint": "^9.11.0",
"eslint-plugin-vue": "^9.28.0", "eslint-plugin-vue": "^9.28.0",
"less": "^4.2.0", "less": "^4.2.0",
"less-loader": "^12.2.0", "less-loader": "^12.2.0",
@@ -53,7 +53,7 @@
"rollup-plugin-visualizer": "^5.12.0", "rollup-plugin-visualizer": "^5.12.0",
"tailwindcss": "^3.4.12", "tailwindcss": "^3.4.12",
"typescript": "^5.6.2", "typescript": "^5.6.2",
"vite": "^5.4.6" "vite": "^5.4.7"
} }
}, },
"node_modules/@alloc/quick-lru": { "node_modules/@alloc/quick-lru": {
@@ -994,9 +994,9 @@
} }
}, },
"node_modules/@eslint/js": { "node_modules/@eslint/js": {
"version": "9.10.0", "version": "9.11.0",
"resolved": "https://registry.npmmirror.com/@eslint/js/-/js-9.10.0.tgz", "resolved": "https://registry.npmmirror.com/@eslint/js/-/js-9.11.0.tgz",
"integrity": "sha512-fuXtbiP5GWIn8Fz+LWoOMVf/Jxm+aajZYkhi6CuEm4SxymFM+eUWzbO9qXT+L0iCkL5+KGYMCSGxo686H19S1g==", "integrity": "sha512-LPkkenkDqyzTFauZLLAPhIb48fj6drrfMvRGSL9tS3AcZBSVTllemLSNyCvHNNL2t797S/6DJNSIwRwXgMO/eQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
@@ -1014,9 +1014,9 @@
} }
}, },
"node_modules/@eslint/plugin-kit": { "node_modules/@eslint/plugin-kit": {
"version": "0.1.0", "version": "0.2.0",
"resolved": "https://registry.npmmirror.com/@eslint/plugin-kit/-/plugin-kit-0.1.0.tgz", "resolved": "https://registry.npmmirror.com/@eslint/plugin-kit/-/plugin-kit-0.2.0.tgz",
"integrity": "sha512-autAXT203ixhqei9xt+qkYOvY8l6LAFIdT2UXc/RPNeUVfqRF1BV94GTJyVPFKT8nFM6MyVJhjLj9E8JWvf5zQ==", "integrity": "sha512-vH9PiIMMwvhCx31Af3HiGzsVNULDbyVkHXwlemn/B0TFj/00ho3y55efXrUZTfQipxoHC5u4xq6zblww1zm1Ig==",
"dev": true, "dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
@@ -1626,39 +1626,39 @@
} }
}, },
"node_modules/@vue/compiler-core": { "node_modules/@vue/compiler-core": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.5.6.tgz", "resolved": "https://registry.npmmirror.com/@vue/compiler-core/-/compiler-core-3.5.8.tgz",
"integrity": "sha512-r+gNu6K4lrvaQLQGmf+1gc41p3FO2OUJyWmNqaIITaJU6YFiV5PtQSFZt8jfztYyARwqhoCayjprC7KMvT3nRA==", "integrity": "sha512-Uzlxp91EPjfbpeO5KtC0KnXPkuTfGsNDeaKQJxQN718uz+RqDYarEf7UhQJGK+ZYloD2taUbHTI2J4WrUaZQNA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/parser": "^7.25.3", "@babel/parser": "^7.25.3",
"@vue/shared": "3.5.6", "@vue/shared": "3.5.8",
"entities": "^4.5.0", "entities": "^4.5.0",
"estree-walker": "^2.0.2", "estree-walker": "^2.0.2",
"source-map-js": "^1.2.0" "source-map-js": "^1.2.0"
} }
}, },
"node_modules/@vue/compiler-dom": { "node_modules/@vue/compiler-dom": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.5.6.tgz", "resolved": "https://registry.npmmirror.com/@vue/compiler-dom/-/compiler-dom-3.5.8.tgz",
"integrity": "sha512-xRXqxDrIqK8v8sSScpistyYH0qYqxakpsIvqMD2e5sV/PXQ1mTwtXp4k42yHK06KXxKSmitop9e45Ui/3BrTEw==", "integrity": "sha512-GUNHWvoDSbSa5ZSHT9SnV5WkStWfzJwwTd6NMGzilOE/HM5j+9EB9zGXdtu/fCNEmctBqMs6C9SvVPpVPuk1Eg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/compiler-core": "3.5.6", "@vue/compiler-core": "3.5.8",
"@vue/shared": "3.5.6" "@vue/shared": "3.5.8"
} }
}, },
"node_modules/@vue/compiler-sfc": { "node_modules/@vue/compiler-sfc": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.5.6.tgz", "resolved": "https://registry.npmmirror.com/@vue/compiler-sfc/-/compiler-sfc-3.5.8.tgz",
"integrity": "sha512-pjWJ8Kj9TDHlbF5LywjVso+BIxCY5wVOLhkEXRhuCHDxPFIeX1zaFefKs8RYoHvkSMqRWt93a0f2gNJVJixHwg==", "integrity": "sha512-taYpngQtSysrvO9GULaOSwcG5q821zCoIQBtQQSx7Uf7DxpR6CIHR90toPr9QfDD2mqHQPCSgoWBvJu0yV9zjg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@babel/parser": "^7.25.3", "@babel/parser": "^7.25.3",
"@vue/compiler-core": "3.5.6", "@vue/compiler-core": "3.5.8",
"@vue/compiler-dom": "3.5.6", "@vue/compiler-dom": "3.5.8",
"@vue/compiler-ssr": "3.5.6", "@vue/compiler-ssr": "3.5.8",
"@vue/shared": "3.5.6", "@vue/shared": "3.5.8",
"estree-walker": "^2.0.2", "estree-walker": "^2.0.2",
"magic-string": "^0.30.11", "magic-string": "^0.30.11",
"postcss": "^8.4.47", "postcss": "^8.4.47",
@@ -1666,13 +1666,13 @@
} }
}, },
"node_modules/@vue/compiler-ssr": { "node_modules/@vue/compiler-ssr": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.5.6.tgz", "resolved": "https://registry.npmmirror.com/@vue/compiler-ssr/-/compiler-ssr-3.5.8.tgz",
"integrity": "sha512-VpWbaZrEOCqnmqjE83xdwegtr5qO/2OPUC6veWgvNqTJ3bYysz6vY3VqMuOijubuUYPRpG3OOKIh9TD0Stxb9A==", "integrity": "sha512-W96PtryNsNG9u0ZnN5Q5j27Z/feGrFV6zy9q5tzJVyJaLiwYxvC0ek4IXClZygyhjm+XKM7WD9pdKi/wIRVC/Q==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/compiler-dom": "3.5.6", "@vue/compiler-dom": "3.5.8",
"@vue/shared": "3.5.6" "@vue/shared": "3.5.8"
} }
}, },
"node_modules/@vue/devtools-api": { "node_modules/@vue/devtools-api": {
@@ -1682,53 +1682,53 @@
"license": "MIT" "license": "MIT"
}, },
"node_modules/@vue/reactivity": { "node_modules/@vue/reactivity": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.5.6.tgz", "resolved": "https://registry.npmmirror.com/@vue/reactivity/-/reactivity-3.5.8.tgz",
"integrity": "sha512-shZ+KtBoHna5GyUxWfoFVBCVd7k56m6lGhk5e+J9AKjheHF6yob5eukssHRI+rzvHBiU1sWs/1ZhNbLExc5oYQ==", "integrity": "sha512-mlgUyFHLCUZcAYkqvzYnlBRCh0t5ZQfLYit7nukn1GR96gc48Bp4B7OIcSfVSvlG1k3BPfD+p22gi1t2n9tsXg==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/shared": "3.5.6" "@vue/shared": "3.5.8"
} }
}, },
"node_modules/@vue/runtime-core": { "node_modules/@vue/runtime-core": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.5.6.tgz", "resolved": "https://registry.npmmirror.com/@vue/runtime-core/-/runtime-core-3.5.8.tgz",
"integrity": "sha512-FpFULR6+c2lI+m1fIGONLDqPQO34jxV8g6A4wBOgne8eSRHP6PQL27+kWFIx5wNhhjkO7B4rgtsHAmWv7qKvbg==", "integrity": "sha512-fJuPelh64agZ8vKkZgp5iCkPaEqFJsYzxLk9vSC0X3G8ppknclNDr61gDc45yBGTaN5Xqc1qZWU3/NoaBMHcjQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/reactivity": "3.5.6", "@vue/reactivity": "3.5.8",
"@vue/shared": "3.5.6" "@vue/shared": "3.5.8"
} }
}, },
"node_modules/@vue/runtime-dom": { "node_modules/@vue/runtime-dom": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.5.6.tgz", "resolved": "https://registry.npmmirror.com/@vue/runtime-dom/-/runtime-dom-3.5.8.tgz",
"integrity": "sha512-SDPseWre45G38ENH2zXRAHL1dw/rr5qp91lS4lt/nHvMr0MhsbCbihGAWLXNB/6VfFOJe2O+RBRkXU+CJF7/sw==", "integrity": "sha512-DpAUz+PKjTZPUOB6zJgkxVI3GuYc2iWZiNeeHQUw53kdrparSTG6HeXUrYDjaam8dVsCdvQxDz6ZWxnyjccUjQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/reactivity": "3.5.6", "@vue/reactivity": "3.5.8",
"@vue/runtime-core": "3.5.6", "@vue/runtime-core": "3.5.8",
"@vue/shared": "3.5.6", "@vue/shared": "3.5.8",
"csstype": "^3.1.3" "csstype": "^3.1.3"
} }
}, },
"node_modules/@vue/server-renderer": { "node_modules/@vue/server-renderer": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.5.6.tgz", "resolved": "https://registry.npmmirror.com/@vue/server-renderer/-/server-renderer-3.5.8.tgz",
"integrity": "sha512-zivnxQnOnwEXVaT9CstJ64rZFXMS5ZkKxCjDQKiMSvUhXRzFLWZVbaBiNF4HGDqGNNsTgmjcCSmU6TB/0OOxLA==", "integrity": "sha512-7AmC9/mEeV9mmXNVyUIm1a1AjUhyeeGNbkLh39J00E7iPeGks8OGRB5blJiMmvqSh8SkaS7jkLWSpXtxUCeagA==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/compiler-ssr": "3.5.6", "@vue/compiler-ssr": "3.5.8",
"@vue/shared": "3.5.6" "@vue/shared": "3.5.8"
}, },
"peerDependencies": { "peerDependencies": {
"vue": "3.5.6" "vue": "3.5.8"
} }
}, },
"node_modules/@vue/shared": { "node_modules/@vue/shared": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.5.6.tgz", "resolved": "https://registry.npmmirror.com/@vue/shared/-/shared-3.5.8.tgz",
"integrity": "sha512-eidH0HInnL39z6wAt6SFIwBrvGOpDWsDxlw3rCgo1B+CQ1781WzQUSU3YjxgdkcJo9Q8S6LmXTkvI+cLHGkQfA==", "integrity": "sha512-mJleSWbAGySd2RJdX1RBtcrUBX6snyOc0qHpgk3lGi4l9/P/3ny3ELqFWqYdkXIwwNN/kdm8nD9ky8o6l/Lx2A==",
"license": "MIT" "license": "MIT"
}, },
"node_modules/@vueuse/core": { "node_modules/@vueuse/core": {
@@ -2327,9 +2327,9 @@
} }
}, },
"node_modules/caniuse-lite": { "node_modules/caniuse-lite": {
"version": "1.0.30001662", "version": "1.0.30001663",
"resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001662.tgz", "resolved": "https://registry.npmmirror.com/caniuse-lite/-/caniuse-lite-1.0.30001663.tgz",
"integrity": "sha512-sgMUVwLmGseH8ZIrm1d51UbrhqMCH3jvS7gF/M6byuHOnKyLOBL7W8yz5V02OHwgLGA36o/AFhWzzh4uc5aqTA==", "integrity": "sha512-o9C3X27GLKbLeTYZ6HBOLU1tsAcBZsLis28wrVzddShCS16RujjHp9GDHKZqrB3meE0YjhawvMFsGb/igqiPzA==",
"dev": true, "dev": true,
"funding": [ "funding": [
{ {
@@ -2791,9 +2791,9 @@
} }
}, },
"node_modules/eslint": { "node_modules/eslint": {
"version": "9.10.0", "version": "9.11.0",
"resolved": "https://registry.npmmirror.com/eslint/-/eslint-9.10.0.tgz", "resolved": "https://registry.npmmirror.com/eslint/-/eslint-9.11.0.tgz",
"integrity": "sha512-Y4D0IgtBZfOcOUAIQTSXBKoNGfY0REGqHJG6+Q81vNippW5YlKjHFj4soMxamKK1NXHUWuBZTLdU3Km+L/pcHw==", "integrity": "sha512-yVS6XODx+tMFMDFcG4+Hlh+qG7RM6cCJXtQhCKLSsr3XkLvWggHjCqjfh0XsPPnt1c56oaT6PMgW9XWQQjdHXA==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -2801,8 +2801,8 @@
"@eslint-community/regexpp": "^4.11.0", "@eslint-community/regexpp": "^4.11.0",
"@eslint/config-array": "^0.18.0", "@eslint/config-array": "^0.18.0",
"@eslint/eslintrc": "^3.1.0", "@eslint/eslintrc": "^3.1.0",
"@eslint/js": "9.10.0", "@eslint/js": "9.11.0",
"@eslint/plugin-kit": "^0.1.0", "@eslint/plugin-kit": "^0.2.0",
"@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/module-importer": "^1.0.1",
"@humanwhocodes/retry": "^0.3.0", "@humanwhocodes/retry": "^0.3.0",
"@nodelib/fs.walk": "^1.2.8", "@nodelib/fs.walk": "^1.2.8",
@@ -5497,9 +5497,9 @@
"integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw=="
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "5.4.6", "version": "5.4.7",
"resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.6.tgz", "resolved": "https://registry.npmmirror.com/vite/-/vite-5.4.7.tgz",
"integrity": "sha512-IeL5f8OO5nylsgzd9tq4qD2QqI0k2CQLGrWD0rCN0EQJZpBK5vJAx0I+GDkMOXxQX/OfFHMuLIx6ddAxGX/k+Q==", "integrity": "sha512-5l2zxqMEPVENgvzTuBpHer2awaetimj2BGkhBPdnwKbPNOlHsODU+oiazEZzLK7KhAnOrO+XGYJYn4ZlUhDtDQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -5557,16 +5557,16 @@
} }
}, },
"node_modules/vue": { "node_modules/vue": {
"version": "3.5.6", "version": "3.5.8",
"resolved": "https://registry.npmmirror.com/vue/-/vue-3.5.6.tgz", "resolved": "https://registry.npmmirror.com/vue/-/vue-3.5.8.tgz",
"integrity": "sha512-zv+20E2VIYbcJOzJPUWp03NOGFhMmpCKOfSxVTmCYyYFFko48H9tmuQFzYj7tu4qX1AeXlp9DmhIP89/sSxxhw==", "integrity": "sha512-hvuvuCy51nP/1fSRvrrIqTLSvrSyz2Pq+KQ8S8SXCxTWVE0nMaOnSDnSOxV1eYmGfvK7mqiwvd1C59CEEz7dAQ==",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@vue/compiler-dom": "3.5.6", "@vue/compiler-dom": "3.5.8",
"@vue/compiler-sfc": "3.5.6", "@vue/compiler-sfc": "3.5.8",
"@vue/runtime-dom": "3.5.6", "@vue/runtime-dom": "3.5.8",
"@vue/server-renderer": "3.5.6", "@vue/server-renderer": "3.5.8",
"@vue/shared": "3.5.6" "@vue/shared": "3.5.8"
}, },
"peerDependencies": { "peerDependencies": {
"typescript": "*" "typescript": "*"

View File

@@ -29,7 +29,7 @@
"postcss-import": "^16.1.0", "postcss-import": "^16.1.0",
"qs": "^6.13.0", "qs": "^6.13.0",
"tinymce": "^7.3.0", "tinymce": "^7.3.0",
"vue": "^3.5.6", "vue": "^3.5.8",
"vue-clipboard3": "^2.0.0", "vue-clipboard3": "^2.0.0",
"vue-color-kit": "^1.0.6", "vue-color-kit": "^1.0.6",
"vue-echarts": "^7.0.3", "vue-echarts": "^7.0.3",
@@ -46,8 +46,8 @@
"@vue/babel-plugin-jsx": "^1.2.5", "@vue/babel-plugin-jsx": "^1.2.5",
"autoprefixer": "^10.4.20", "autoprefixer": "^10.4.20",
"browserslist": "^4.23.0", "browserslist": "^4.23.0",
"caniuse-lite": "^1.0.30001662", "caniuse-lite": "^1.0.30001663",
"eslint": "^9.10.0", "eslint": "^9.11.0",
"eslint-plugin-vue": "^9.28.0", "eslint-plugin-vue": "^9.28.0",
"less": "^4.2.0", "less": "^4.2.0",
"less-loader": "^12.2.0", "less-loader": "^12.2.0",
@@ -56,6 +56,6 @@
"rollup-plugin-visualizer": "^5.12.0", "rollup-plugin-visualizer": "^5.12.0",
"tailwindcss": "^3.4.12", "tailwindcss": "^3.4.12",
"typescript": "^5.6.2", "typescript": "^5.6.2",
"vite": "^5.4.6" "vite": "^5.4.7"
} }
} }

View File

@@ -12,6 +12,17 @@ export class FragApi {
params params
}) })
} }
/**
* 根据用户填写新增文档片段
* @returns 新增是否成功
*/
static add(data: IFragUpdateObject) {
return request({
url: "system/userField/add",
method: "post",
data
})
}
/** /**
* 根据fragment的对象更新数据库 * 根据fragment的对象更新数据库
* @returns 是否更新成功 * @returns 是否更新成功

View File

@@ -57,8 +57,8 @@ const props = defineProps({
type: [String, Array], type: [String, Array],
// 如果要取消粘贴只粘贴文本需要用户加格式请加上pastetext // 如果要取消粘贴只粘贴文本需要用户加格式请加上pastetext
default: default:
"code undo redo restoredraft | paste | bold | alignleft alignjustify indent formatpainter | \ "code undo redo restoredraft | paste | bold | aligncenter alignleft alignjustify indent | \
styleselect formatselect fontselect fontsizeselect | bullist numlist | subscript superscript removeformat" styleselect formatselect fontselect fontsizeselect | bullist numlist | removeformat"
} }
}) })

View File

@@ -38,6 +38,7 @@
> >
<template #extra> <template #extra>
<a-space> <a-space>
<!-- 修改源码新增复制该项新增 -->
<a-tooltip content="复制该项添加" v-if="!(props.component.hideAdd ?? false)"> <a-tooltip content="复制该项添加" v-if="!(props.component.hideAdd ?? false)">
<a-button <a-button
@click.stop="addItem(item)" @click.stop="addItem(item)"
@@ -218,10 +219,12 @@ if (props.component.type == "table") {
} }
const addItem = async (data = {}) => { const addItem = async (data = {}) => {
// 修改源码:深度复制
let newData = cloneDeep(data)
let index = formModel.value[props.component.dataIndex].length let index = formModel.value[props.component.dataIndex].length
viewFormList.value[index] = cloneDeep(formList) viewFormList.value[index] = cloneDeep(formList)
rv("onAdd", { formList: viewFormList.value[index], data, index }) rv("onAdd", { formList: viewFormList.value[index], newData, index }) // 修改源码深度复制data->newData
formModel.value[props.component.dataIndex].push(data) formModel.value[props.component.dataIndex].push(newData) // 修改源码深度复制data->newData
} }
const deleteItem = async (index) => { const deleteItem = async (index) => {

View File

@@ -9,7 +9,6 @@
<script lang="jsx" setup> <script lang="jsx" setup>
import { ref } from "vue" import { ref } from "vue"
import { Message } from "@arco-design/web-vue"
import abbreviationApi from "@/api/system/abbreviation" import abbreviationApi from "@/api/system/abbreviation"
const crudRef = ref() const crudRef = ref()

View File

@@ -0,0 +1,111 @@
import { useRoute } from "vue-router"
import { ref } from "vue"
import { FragApi } from "@/api/system/fragment"
import { ProductFileEnum } from "@/utils/enums/productTypes"
import type { IDictData } from "@/utils/types/CommonType"
import { IFragSearchCondition } from "@/api/system/types/fragmentTypes"
const useCrudOption = () => {
// global
const route = useRoute()
const crudRef = ref()
// 产品文档类型写死7种
const productFileType: IDictData<ProductFileEnum>[] = Object.keys(ProductFileEnum).map((it, index) => ({
label: ProductFileEnum[it],
value: index + 1
}))
// crud-option
const crudOptions = ref<object>({
api: FragApi.getFragList,
add: { show: true, api: FragApi.add },
edit: { show: true, api: FragApi.update },
delete: { show: true, api: FragApi.delete },
// 新增需要项目id
parameters: {
projectId: route.params.projectId as string
},
beforeRequest: (params: IFragSearchCondition) => {
// 添加项目id参数
params.projectId = route.params.projectId as string
},
afterDelete(response: any) {
crudRef.value.tableRef.selectAll(false)
},
showTools: false,
operationColumn: true,
operationColumnWidth: 180,
operationColumnAlign: "center",
bordered: { wrapper: true, cell: true },
resizable: false, // 不允许调整列宽
rowSelection: { showCheckedAll: true, checkStrictly: true },
isDbClickEdit: false,
searchColNumber: 2,
formOption: {
isFull: true,
layout: [
{
formType: "grid",
cols: [
{ span: 12, formList: [{ dataIndex: "name" }] },
{ span: 12, formList: [{ dataIndex: "belong_doc" }] }
]
}
]
}
})
const crudColumns = ref<any[]>([
{
title: "ID",
align: "center",
width: 50,
hide: true,
dataIndex: "id",
commonRules: [{ required: true, message: "ID必填" }],
validateTrigger: "blur"
},
{
title: "片段名称",
align: "center",
width: 180,
dataIndex: "name",
search: true,
commonRules: [{ required: true, message: "片段名称必填" }],
validateTrigger: "blur"
},
{
title: "所属文档",
align: "center",
width: 100,
dataIndex: "belong_doc",
formType: "select",
search: true,
commonRules: [{ required: true, message: "所属文档必选" }],
dict: { data: productFileType, translation: true }
},
{
title: "替换片段",
width: 100,
align: "center",
dataIndex: "is_main",
addDisplay: false,
editDisplay: false
},
{
title: "内容",
align: "center",
dataIndex: "content",
hide: true,
formType: "editor",
height: 550
}
])
return {
crudRef,
crudOptions,
crudColumns,
route
}
}
export default useCrudOption

View File

@@ -19,40 +19,32 @@
</template> </template>
<script setup lang="tsx"> <script setup lang="tsx">
import { computed, ComputedRef, ref } from "vue" import { computed, ComputedRef } from "vue"
import { useRoute } from "vue-router"
import PageHeader from "@/views/testmanage/components/PageHeader/index.vue" import PageHeader from "@/views/testmanage/components/PageHeader/index.vue"
import useFetchData from "@/hooks/fetchData" // apis - import
// apis
import { FragApi } from "@/api/system/fragment" import { FragApi } from "@/api/system/fragment"
import projectApi from "@/api/testmanage/project" import projectApi from "@/api/testmanage/project"
// types // types - import
import { ProductFileEnum } from "@/utils/enums/productTypes"
import type { IDictData } from "@/utils/types/CommonType"
import type { IPageHeaderProps } from "../components/PageHeader/types" import type { IPageHeaderProps } from "../components/PageHeader/types"
import type { IFragSearchCondition } from "@/api/system/types/fragmentTypes"
import { Message } from "@arco-design/web-vue" import { Message } from "@arco-design/web-vue"
// hooks-import
const route = useRoute() import useFetchData from "@/hooks/fetchData"
const crudRef = ref() import useCrudOption from "./hooks/crudOption"
// 产品文档类型写死7种 // 1.hook-crudOptions
const productFileType: IDictData<ProductFileEnum>[] = Object.keys(ProductFileEnum).map((it, index) => ({ const { crudRef, crudOptions, crudColumns, route } = useCrudOption()
label: ProductFileEnum[it], // 2.hook-获取单个项目信息
value: index + 1
}))
// hook-获取单个项目信息
const fetchData = async () => { const fetchData = async () => {
return projectApi.getProjectById(route.params.projectId) return projectApi.getProjectById(route.params.projectId)
} }
const { loadingData, isDataLoading } = useFetchData({}, fetchData) const { loadingData, isDataLoading } = useFetchData({}, fetchData)
// 给头部组件的计算属性 // 3.给头部组件的计算属性
const headerData: ComputedRef<IPageHeaderProps> = computed(() => { const headerData: ComputedRef<IPageHeaderProps> = computed(() => {
return { return {
title: loadingData.value.ident as string, title: loadingData.value.ident as string,
name: loadingData.value.name as string name: loadingData.value.name as string
} }
}) })
// 在表格切换is_main属性 // 4.noQuery - 请求头部数据
const beforeSwitchChange = (record: any) => { const beforeSwitchChange = (record: any) => {
return async function (newVal: boolean) { return async function (newVal: boolean) {
await FragApi.update(record.id, { await FragApi.update(record.id, {
@@ -63,86 +55,6 @@ const beforeSwitchChange = (record: any) => {
} }
} }
// ma-crud配置
const crudOptions = ref<object>({
api: FragApi.getFragList,
edit: { show: true, api: FragApi.update },
delete: { show: true, api: FragApi.delete },
beforeRequest: (params: IFragSearchCondition) => {
// 添加项目id参数
params.projectId = route.params.projectId as string
},
afterDelete(response: any) {
crudRef.value.tableRef.selectAll(false)
},
showTools: false,
operationColumn: true,
operationColumnWidth: 120,
operationColumnAlign: "center",
bordered: { wrapper: true, cell: true },
resizable: false, // 不允许调整列宽
rowSelection: { showCheckedAll: true, checkStrictly: true },
isDbClickEdit: false,
searchColNumber: 2,
formOption: {
isFull: true,
layout: [
{
formType: "grid",
cols: [
{ span: 12, formList: [{ dataIndex: "name" }] },
{ span: 12, formList: [{ dataIndex: "belong_doc" }] }
]
}
]
}
})
const crudColumns = ref<any[]>([
{
title: "ID",
align: "center",
width: 50,
hide: true,
dataIndex: "id",
commonRules: [{ required: true, message: "ID必填" }],
validateTrigger: "blur"
},
{
title: "片段名称",
align: "center",
width: 120,
dataIndex: "name",
search: true,
commonRules: [{ required: true, message: "片段名称必填" }],
validateTrigger: "blur"
},
{
title: "所属文档",
align: "center",
width: 100,
dataIndex: "belong_doc",
formType: "select",
search: true,
commonRules: [{ required: true, message: "所属文档必选" }],
dict: { data: productFileType, translation: true }
},
{
title: "替换片段",
align: "center",
dataIndex: "is_main",
addDisplay: false,
editDisplay: false
},
{
title: "内容",
align: "center",
dataIndex: "content",
hide: true,
formType: "editor",
height: 550
}
])
defineOptions({ defineOptions({
name: "projFragment" name: "projFragment"
}) })

File diff suppressed because one or more lines are too long