From d552260e5b6a350b1721552e1b6f7472079311fb Mon Sep 17 00:00:00 2001 From: ssc <273702440@qq.com> Date: Sun, 7 May 2023 10:39:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=A6=E6=83=85=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E4=B8=BB=E9=A2=98=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/plugin/workflow/form-theme.js | 50 ++ .../plugin/workflow/design/form-theme.vue | 455 ++++++++++++++++++ src/views/plugin/workflow/mixins/ex-form.js | 2 +- src/views/plugin/workflow/mixins/theme.js | 37 +- .../workflow/process/components/detail.vue | 7 +- .../process/external/Leave/detail.vue | 3 +- src/views/plugin/workflow/styles/theme.scss | 82 ++++ .../plugin/workflow/styles/theme/blue.scss | 63 --- .../plugin/workflow/styles/theme/border.scss | 47 -- .../plugin/workflow/styles/theme/default.scss | 134 ------ 10 files changed, 620 insertions(+), 260 deletions(-) create mode 100644 src/api/plugin/workflow/form-theme.js create mode 100644 src/views/plugin/workflow/design/form-theme.vue create mode 100644 src/views/plugin/workflow/styles/theme.scss delete mode 100644 src/views/plugin/workflow/styles/theme/blue.scss delete mode 100644 src/views/plugin/workflow/styles/theme/border.scss delete mode 100644 src/views/plugin/workflow/styles/theme/default.scss diff --git a/src/api/plugin/workflow/form-theme.js b/src/api/plugin/workflow/form-theme.js new file mode 100644 index 0000000..0c9dcb0 --- /dev/null +++ b/src/api/plugin/workflow/form-theme.js @@ -0,0 +1,50 @@ +import request from '@/router/axios'; + +const prefix = '/api/blade-workflow/design/form/theme' + +export const getList = (current, size, params) => { + return request({ + url: `${prefix}/list`, + method: 'get', + params: { + ...params, + current, + size, + } + }) +} + +export const getDetail = (params) => { + return request({ + url: `${prefix}/detail`, + method: 'get', + params + }) +} + +export const remove = (ids) => { + return request({ + url: `${prefix}/remove`, + method: 'post', + params: { + ids, + } + }) +} + +export const add = (row) => { + return request({ + url: `${prefix}/submit`, + method: 'post', + data: row + }) +} + +export const update = (row) => { + return request({ + url: `${prefix}/update`, + method: 'post', + data: row + }) +} + diff --git a/src/views/plugin/workflow/design/form-theme.vue b/src/views/plugin/workflow/design/form-theme.vue new file mode 100644 index 0000000..cf93b5b --- /dev/null +++ b/src/views/plugin/workflow/design/form-theme.vue @@ -0,0 +1,455 @@ + + + + + diff --git a/src/views/plugin/workflow/mixins/ex-form.js b/src/views/plugin/workflow/mixins/ex-form.js index 3ee7091..4bcff6b 100644 --- a/src/views/plugin/workflow/mixins/ex-form.js +++ b/src/views/plugin/workflow/mixins/ex-form.js @@ -99,7 +99,7 @@ export default { // event.forEach(e => delete col[e]) } if (col.type == 'dynamic') { // 处理子表单 - col.children.column = _this.filterAvueColumn(col.children.column, taskForm).column + col.children.column = _this.filterAvueColumn(col.children.column, taskForm, isExForm).column } if (col.rules && col.pattern) { // 处理正则 col.rules.forEach(c => { diff --git a/src/views/plugin/workflow/mixins/theme.js b/src/views/plugin/workflow/mixins/theme.js index 7fc8a1f..45924fa 100644 --- a/src/views/plugin/workflow/mixins/theme.js +++ b/src/views/plugin/workflow/mixins/theme.js @@ -1,20 +1,14 @@ +import { getList } from '@/api/plugin/workflow/form-theme.js' export default { data() { return { theme: '', - themeList: [{ - label: '默认', - value: 'default' - }, { - label: '边框', - value: 'border' - }, { - label: '蓝色', - value: 'blue' - }] + themeList: [], + themeCustomStyle: {}, } }, created() { + this.initTheme() const theme = localStorage.getItem("wf-form-theme") if (theme || theme == '') this.theme = theme || 'default' else this.theme = 'default' @@ -23,11 +17,30 @@ export default { theme: { handler(val) { if (val) { - import(`../styles/theme/${val}.scss`) + import(`../styles/theme.scss`) localStorage.setItem('wf-form-theme', val) + this.setThemeStyle() } }, immediate: true }, }, -} \ No newline at end of file + methods: { + initTheme() { + getList(1, -1).then(res => { + this.themeList = res.data.data.records + this.themeList.forEach(e => { + e.label = e.name + e.value = e.themeKey + }) + this.setThemeStyle() + }); + }, + setThemeStyle() { + let obj = this.themeList.find(item => item.themeKey == this.theme) + for (let i in obj) { + this.themeCustomStyle[`--${i}`] = obj[i] + } + }, + }, +} diff --git a/src/views/plugin/workflow/process/components/detail.vue b/src/views/plugin/workflow/process/components/detail.vue index 35cb5b9..b146fa2 100644 --- a/src/views/plugin/workflow/process/components/detail.vue +++ b/src/views/plugin/workflow/process/components/detail.vue @@ -11,7 +11,8 @@ 主题: + :dic="themeList" + @change="setThemeStyle"> @@ -20,15 +21,17 @@ name="first">
+ :class="process.status != 'todo' ? `wf-theme-custom`: ''">
+ :class="process.status != 'todo' ? `wf-theme-custom`: ''"> .el-form-item__content { + border-left: var(--borderWidth) solid var(--borderColor) !important; + } + + .el-table__row .el-form-item__content { + border-left: none !important; + } + + .avue-form__row { + margin-bottom: 0px !important; + } + + .el-form-item { + margin-bottom: 0px !important; + background: var(--labelBg); + } + + .el-col>.el-form-item>.el-form-item__label { + // width: var(--labelWidth) !important; + color: var(--labelColor); + font-size: var(--labelFontSize); + text-align: center !important; + } + + .el-col>.el-form-item>.el-form-item__content { + // margin-left: var(--labelWidth) !important; + background-color: var(--valueBg, #fff) + } + + .el-radio.is-disabled .el-radio__label, + .el-checkbox.is-disabled .el-checkbox__label, + .el-input.is-disabled .el-input__inner, + .el-range-editor.is-disabled, + .el-range-editor.is-disabled input, + .el-textarea.is-disabled .el-textarea__inner { + color: var(--valueColor) !important; + -webkit-text-fill-color: var(--valueColor) !important; + font-size: var(--valueFontSize); + border: var(--borderWidth) solid transparent; + background: #fff; + background-color: #fff; + } + + .el-input-number.is-disabled .el-input-number__decrease, + .el-input-number.is-disabled .el-input-number__increase { + display: none; + } + + .el-rate { + line-height: 2.5; + } + + .avue-dynamic, + .avue-ueditor { + margin-left: -20px; + } + } +} \ No newline at end of file diff --git a/src/views/plugin/workflow/styles/theme/blue.scss b/src/views/plugin/workflow/styles/theme/blue.scss deleted file mode 100644 index c42b03b..0000000 --- a/src/views/plugin/workflow/styles/theme/blue.scss +++ /dev/null @@ -1,63 +0,0 @@ -// form - border -.wf-theme-blue { - //google chrome explore - -webkit-print-color-adjust: exact; - //firefox explore - -moz-print-color-adjust: exact; - color-adjust: exact; - - .avue--detail { - - .avue-form__group, - .avue-form__row { - border: 1px solid #cbdcf0 !important; - } - - .el-col { - border: none; - } - - .el-col:nth-child(1) { - border-top: 1px solid #cbdcf0 !important; - } - - .el-row { - border: none; - } - - .el-form-item>.el-form-item__content { - border-left: 1px solid #cbdcf0 !important; - } - - .el-table__row .el-form-item__content { - border-left: none !important; - } - - .avue-form__row { - margin-bottom: 0px !important; - } - - .el-form-item { - margin-bottom: 0px !important; - background: #eef6ff !important; - } - - .el-form-item__label { - color: #01418a !important; - text-align: center !important; - } - - .el-input.is-disabled .el-input__inner, - .el-range-editor.is-disabled, - .el-textarea.is-disabled .el-textarea__inner { - border: 1px solid transparent; - background: #fff; - background-color: #fff; - } - - .el-input-number.is-disabled .el-input-number__decrease, - .el-input-number.is-disabled .el-input-number__increase { - display: none; - } - } -} diff --git a/src/views/plugin/workflow/styles/theme/border.scss b/src/views/plugin/workflow/styles/theme/border.scss deleted file mode 100644 index 040fff9..0000000 --- a/src/views/plugin/workflow/styles/theme/border.scss +++ /dev/null @@ -1,47 +0,0 @@ -// form - border -.wf-theme-border { - //google chrome explore - -webkit-print-color-adjust: exact; - //firefox explore - -moz-print-color-adjust: exact; - color-adjust: exact; - - .avue--detail { - .avue-form__group, - .avue-form__row { - border: 1px solid #333 !important; - } - .el-form-item > .el-form-item__content { - border-left: 2px solid #333 !important; - } - - .el-table__row .el-form-item__content { - border-left: none !important; - } - - .avue-form__row { - margin-bottom: 0px !important; - } - - .el-form-item { - margin-bottom: 0px !important; - } - - .el-form-item__label { - text-align: center !important; - } - - .el-input.is-disabled .el-input__inner, - .el-range-editor.is-disabled, - .el-textarea.is-disabled .el-textarea__inner { - border: 1px solid transparent; - background: #fff; - background-color: #fff; - } - - .el-input-number.is-disabled .el-input-number__decrease, - .el-input-number.is-disabled .el-input-number__increase { - display: none; - } - } -} diff --git a/src/views/plugin/workflow/styles/theme/default.scss b/src/views/plugin/workflow/styles/theme/default.scss deleted file mode 100644 index 897dbf0..0000000 --- a/src/views/plugin/workflow/styles/theme/default.scss +++ /dev/null @@ -1,134 +0,0 @@ -.wf-theme-default { - //google chrome explore - -webkit-print-color-adjust: exact; - //firefox explore - -moz-print-color-adjust: exact; - color-adjust: exact; - - .avue--detail { - .el-col { - margin-bottom: 0 !important; - } - .hover-row td { - background-color: #fff !important; - } - .avue-group__header { - padding-left: 10px; - } - .el-collapse-item__header { - margin-bottom: 0; - } - .el-input.is-disabled .el-input__inner, - .el-textarea.is-disabled .el-textarea__inner, - .el-range-editor.is-disabled, - .el-range-editor.is-disabled input { - color: #606266; - background-color: #fff; - padding-left: 0; - cursor: default; - } - .el-input-number__decrease, - .el-input-number__increase { - display: none; - } - .el-input-group__append, - .el-input-group__prepend { - background-color: transparent; - border: none; - } - .el-input__suffix { - display: none; - } - .el-input__inner, - .el-textarea__inner { - border: none; - &::-webkit-input-placeholder { - color: transparent !important; - } - &::-moz-placeholder { - color: transparent !important; - } - &::-moz-placeholder { - color: transparent !important; - } - &::-ms-input-placeholder { - color: transparent !important; - } - &::-ms-input-placeholder { - color: transparent !important; - } - } - .avue-checkbox__all { - display: none; - } - .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner { - background-color: #409eff; - border-color: #409eff; - } - .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after { - border-color: #fff; - } - .el-radio__input.is-disabled.is-checked .el-radio__inner { - background-color: #409eff; - border-color: #409eff; - } - .el-radio__input.is-disabled.is-checked .el-radio__inner::after { - background-color: #fff; - } - .el-checkbox__input.is-disabled + span.el-checkbox__label, - .el-radio__input.is-disabled + span.el-radio__label { - color: #606266; - } - .el-form-item.is-required:not(.is-no-asterisk) - .el-form-item__label-wrap - > .el-form-item__label:before, - .el-form-item.is-required:not(.is-no-asterisk) - > .el-form-item__label:before { - display: none; - } - .el-row { - border-top: 1px solid #ebeef5; - border-left: 1px solid #ebeef5; - } - .el-col { - padding: 0 !important; - border-bottom: 1px solid #ebeef5; - border-right: 1px solid #ebeef5; - } - .el-form-item { - margin: 0; - background: #fafafa; - } - .el-form-item__label, - .el-form-item__content { - padding: 2px 0; - } - .el-form-item__label { - padding: 0 10px; - color: #909399; - box-sizing: border-box; - } - .el-tag { - margin-left: 0 !important; - margin-right: 6px !important; - } - .el-form-item__content { - border-left: 1px solid #ebeef5; - padding-left: 20px; - box-sizing: border-box; - background-color: #fff; - } - &__column { - .el-form-item { - background-color: #fff; - } - .el-form-item__label { - padding-right: 12px; - } - .el-form-item__content { - padding-left: 0; - border-left: none; - } - } - } -}