From 7495adc53e5fdbaf84442867f610a65dd87584a0 Mon Sep 17 00:00:00 2001 From: zxx <47968546@163.com> Date: Tue, 19 Mar 2024 17:35:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 1 + src/application/mk/basic-pages/edit.vue | 36 ++- src/components/zk/input/Cascader.vue | 59 ++++ src/components/zk/input/Checkbox.vue | 14 + src/components/zk/input/Transfer.vue | 131 ++++++++ src/components/zk/zkTableList.md | 18 +- .../Middle/transport/Custom/Custom/Edit.vue | 55 ++-- .../Middle/transport/Custom/Custom/List.vue | 10 +- .../MaintenanceGiornaleLog/Edit.vue | 4 +- .../OilConsumption/OilConsumption/Edit.vue | 4 +- .../Middle/transport/Truck/Truck/Detail.vue | 16 +- .../Middle/transport/Truck/Truck/Edit.vue | 13 +- .../Middle/transport/Truck/Truck/List.vue | 17 +- .../Middle/transport/Truck/Truck/Update.vue | 297 ++++++++++++++++++ .../transport/Truck/Truck/zkTableList.vue | 288 +++++++++++++++++ src/utils/i18n.js | 70 ++--- 16 files changed, 928 insertions(+), 105 deletions(-) create mode 100644 src/components/zk/input/Cascader.vue create mode 100644 src/components/zk/input/Checkbox.vue create mode 100644 src/components/zk/input/Transfer.vue create mode 100644 src/pages/Middle/transport/Truck/Truck/Update.vue create mode 100644 src/pages/Middle/transport/Truck/Truck/zkTableList.vue diff --git a/package.json b/package.json index a009f69..4e7f72f 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ }, "dependencies": { "@antv/data-set": "^0.11.4", + "@form-create/ant-design-vue": "^2.5.34", "animate.css": "^4.1.0", "ant-design-vue": "^1.7.2", "axios": "^0.19.2", diff --git a/src/application/mk/basic-pages/edit.vue b/src/application/mk/basic-pages/edit.vue index 2759424..5010dfb 100644 --- a/src/application/mk/basic-pages/edit.vue +++ b/src/application/mk/basic-pages/edit.vue @@ -1,9 +1,14 @@ @@ -28,8 +31,7 @@ export default { options: { type: Object }, - dataId: { - } + dataId: {} }, @@ -43,8 +45,7 @@ export default { }; }, - computed: { - }, + computed: {}, created() { @@ -73,13 +74,13 @@ export default { // 打开列表页面 this.$openPage(this.options.listPageUrl) } else { - this.$emit("callback", { success: true }); + this.$emit("callback", {success: true}); } }, // 保存 - save({ afterSave }) { + save({afterSave}) { let _this = this; @@ -98,7 +99,11 @@ export default { // postdata = { MesUnit: postdata } } // 格式化提交的数据 - this.$mk.formatFormData({ data: postdata, rules: this.options.formOptions.items ,igFields : this.options.saveIgFields }); + this.$mk.formatFormData({ + data: postdata, + rules: this.options.formOptions.items, + igFields: this.options.saveIgFields + }); // 提交数据 @@ -114,7 +119,7 @@ export default { if (a.code == 200) { this.$mk.success("保存成功"); - this.$emit("afterSave", { data: postdata }); + this.$emit("afterSave", {data: postdata}); if (!this.isEdit) { // 如果是新增模式,关闭当前页面 if (this.options.action_afterSave == "confirm") { @@ -150,7 +155,7 @@ export default { // 验证表单 - this.$mk.validateForm({ form: this.$refs.xForm }).then(() => { // 验证表单 + this.$mk.validateForm({form: this.$refs.xForm}).then(() => { // 验证表单 save(); // 提交保存 }).catch(count => { // 验证失败 this.$mk.error(`存在${count}项错误,请检查`); @@ -170,8 +175,7 @@ export default { } }, // 监听属性 - watch: { - } + watch: {} }; diff --git a/src/components/zk/input/Cascader.vue b/src/components/zk/input/Cascader.vue new file mode 100644 index 0000000..5f1fbab --- /dev/null +++ b/src/components/zk/input/Cascader.vue @@ -0,0 +1,59 @@ + + diff --git a/src/components/zk/input/Checkbox.vue b/src/components/zk/input/Checkbox.vue new file mode 100644 index 0000000..46d5abe --- /dev/null +++ b/src/components/zk/input/Checkbox.vue @@ -0,0 +1,14 @@ + + diff --git a/src/components/zk/input/Transfer.vue b/src/components/zk/input/Transfer.vue new file mode 100644 index 0000000..924b995 --- /dev/null +++ b/src/components/zk/input/Transfer.vue @@ -0,0 +1,131 @@ + + diff --git a/src/components/zk/zkTableList.md b/src/components/zk/zkTableList.md index 0529b27..05f27dd 100644 --- a/src/components/zk/zkTableList.md +++ b/src/components/zk/zkTableList.md @@ -1,13 +1,13 @@ diff --git a/src/pages/Middle/transport/Custom/Custom/Edit.vue b/src/pages/Middle/transport/Custom/Custom/Edit.vue index bf30ad4..8493232 100644 --- a/src/pages/Middle/transport/Custom/Custom/Edit.vue +++ b/src/pages/Middle/transport/Custom/Custom/Edit.vue @@ -1,5 +1,5 @@ + \ No newline at end of file diff --git a/src/pages/Middle/transport/Truck/Truck/zkTableList.vue b/src/pages/Middle/transport/Truck/Truck/zkTableList.vue new file mode 100644 index 0000000..e17a07b --- /dev/null +++ b/src/pages/Middle/transport/Truck/Truck/zkTableList.vue @@ -0,0 +1,288 @@ + + + \ No newline at end of file diff --git a/src/utils/i18n.js b/src/utils/i18n.js index 919f174..163bd43 100644 --- a/src/utils/i18n.js +++ b/src/utils/i18n.js @@ -11,13 +11,13 @@ import {getI18nKey} from '@/utils/routerUtil' // 引入路由工具 * @returns {VueI18n} */ function initI18n(locale, fallback) { // 初始化 i18n - Vue.use(VueI18n) // 使用 vue-i18n - let i18nOptions = { // i18n 配置 - locale, // 本地化语言 - fallbackLocale: fallback, // 回退语言 - silentFallbackWarn: true, // 回退语言警告 - } - return new VueI18n(i18nOptions) // 创建 i18n 实例 + Vue.use(VueI18n) // 使用 vue-i18n + let i18nOptions = { // i18n 配置 + locale, // 本地化语言 + fallbackLocale: fallback, // 回退语言 + silentFallbackWarn: true, // 回退语言警告 + } + return new VueI18n(i18nOptions) // 创建 i18n 实例 } /** @@ -28,15 +28,15 @@ function initI18n(locale, fallback) { // 初始化 i18n * @returns {*} */ function generateI18n(lang, routes, valueKey) { // 生成 i18n - routes.forEach(route => { // 遍历路由 - let keys = getI18nKey(route.fullPath).split('.') // 获取 i18n key - let value = valueKey === 'path' ? route[valueKey].split('/').filter(item => !item.startsWith(':') && item != '').join('.') : route[valueKey] // 获取 i18n valueKey 对应的值 - lang.assignProps(keys, value) // 给 lang 对象注入属性 - if (route.children) { // 如果有子路由 - generateI18n(lang, route.children, valueKey) // 递归 - } - }) - return lang + routes.forEach(route => { // 遍历路由 + let keys = getI18nKey(route.fullPath).split('.') // 获取 i18n key + let value = valueKey === 'path' ? route[valueKey].split('/').filter(item => !item.startsWith(':') && item !== '').join('.') : route[valueKey] // 获取 i18n valueKey 对应的值 + lang.assignProps(keys, value) // 给 lang 对象注入属性 + if (route.children) { // 如果有子路由 + generateI18n(lang, route.children, valueKey) // 递归 + } + }) + return lang } /** @@ -45,13 +45,13 @@ function generateI18n(lang, routes, valueKey) { // 生成 i18n * @param parentPath */ function formatFullPath(routes, parentPath = '') { // 格式化 fullPath - routes.forEach(route => { // 遍历路由 - let isFullPath = route.path.substring(0, 1) === '/' // 判断是否是全路径 - route.fullPath = isFullPath ? route.path : (parentPath === '/' ? parentPath + route.path : parentPath + '/' + route.path) // 生成 fullPath - if (route.children) { // 如果有子路由 - formatFullPath(route.children, route.fullPath) // 递归 - } - }) + routes.forEach(route => { // 遍历路由 + let isFullPath = route.path.substring(0, 1) === '/' // 判断是否是全路径 + route.fullPath = isFullPath ? route.path : (parentPath === '/' ? parentPath + route.path : parentPath + '/' + route.path) // 生成 fullPath + if (route.children) { // 如果有子路由 + formatFullPath(route.children, route.fullPath) // 递归 + } + }) } /** @@ -60,19 +60,19 @@ function formatFullPath(routes, parentPath = '') { // 格式化 fullPath * @param routes */ function mergeI18nFromRoutes(i18n, routes) { // 从路由提取国际化数据 - formatFullPath(routes) // 格式化 fullPath - const CN = generateI18n(new Object(), routes, 'name') // 生成中文国际化 - const US = generateI18n(new Object(), routes, 'path') // 生成英文国际化 - i18n.mergeLocaleMessage('CN', CN) // 合并中文国际化 - i18n.mergeLocaleMessage('US', US) // 合并英文国际化 - const messages = routesI18n.messages // 获取路由国际化 - Object.keys(messages).forEach(lang => { // 遍历路由国际化 - i18n.mergeLocaleMessage(lang, messages[lang]) // 合并路由国际化 - }) + formatFullPath(routes) // 格式化 fullPath + const CN = generateI18n({}, routes, 'name') // 生成中文国际化 + const US = generateI18n({}, routes, 'path') // 生成英文国际化 + i18n.mergeLocaleMessage('CN', CN) // 合并中文国际化 + i18n.mergeLocaleMessage('US', US) // 合并英文国际化 + const messages = routesI18n.messages // 获取路由国际化 + Object.keys(messages).forEach(lang => { // 遍历路由国际化 + i18n.mergeLocaleMessage(lang, messages[lang]) // 合并路由国际化 + }) } export { // 导出 - initI18n, // 初始化 i18n 国际化 - mergeI18nFromRoutes, // 从路由提取国际化数据 - formatFullPath // 格式化 fullPath + initI18n, // 初始化 i18n 国际化 + mergeI18nFromRoutes, // 从路由提取国际化数据 + formatFullPath // 格式化 fullPath }