From 1e33e322ab5aa4a64f5bfa861d63ab966dd7d646 Mon Sep 17 00:00:00 2001 From: ssc <273702440@qq.com> Date: Sun, 7 May 2023 10:35:04 +0800 Subject: [PATCH] feat: detail mode form theme --- .../plugin/workflow/assets/styles/theme.scss | 82 ++++++++ .../workflow/assets/styles/theme/blue.scss | 63 ------ .../workflow/assets/styles/theme/border.scss | 47 ----- .../workflow/assets/styles/theme/default.scss | 161 ---------------- src/views/plugin/workflow/mixins/ex-form.js | 3 +- src/views/plugin/workflow/mixins/theme.js | 37 ++-- .../workflow/pages/design/form-theme.vue | 181 ++++++++++++++++-- .../workflow/pages/external/Leave/detail.vue | 6 +- .../workflow/pages/process/form/detail.vue | 20 +- 9 files changed, 281 insertions(+), 319 deletions(-) create mode 100644 src/views/plugin/workflow/assets/styles/theme.scss delete mode 100644 src/views/plugin/workflow/assets/styles/theme/blue.scss delete mode 100755 src/views/plugin/workflow/assets/styles/theme/border.scss delete mode 100755 src/views/plugin/workflow/assets/styles/theme/default.scss diff --git a/src/views/plugin/workflow/assets/styles/theme.scss b/src/views/plugin/workflow/assets/styles/theme.scss new file mode 100644 index 0000000..09113a5 --- /dev/null +++ b/src/views/plugin/workflow/assets/styles/theme.scss @@ -0,0 +1,82 @@ +.nf-theme-custom { + //google chrome explore + -webkit-print-color-adjust: exact; + //firefox explore + -moz-print-color-adjust: exact; + color-adjust: exact; + + .nf-form--detail { + .el-row { + border-top: var(--borderWidth) solid var(--borderColor); + border-left: var(--borderWidth) solid var(--borderColor); + } + + .el-col { + border-bottom: var(--borderWidth) solid var(--borderColor); + border-right: var(--borderWidth) solid var(--borderColor); + } + + .el-form-item__label { + // width: var(--labelWidth); + padding: 0 10px; + color: var(--labelColor); + font-size: var(--labelFontSize, 14px); + border-right: var(--borderWidth) solid var(--borderColor); + background-color: var(--labelBg); + box-sizing: border-box; + } + + .el-form-item__content { + box-sizing: border-box; + background-color: #fff; + } + + .hover-row td { + background-color: #fff !important; + } + + .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: var(--valueColor) !important; + -webkit-text-fill-color: var(--valueColor) !important; + font-size: var(--valueFontSize); + background-color: #fff; + cursor: default; + } + + .nf-checkbox__all, + .el-input__suffix, + .el-input-number__decrease, + .el-input-number__increase, + .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-input-group__append, + .el-input-group__prepend { + background-color: transparent; + border: none; + } + + .el-input__inner, + .el-textarea__inner { + border: none; + + &::-moz-placeholder, + &::-moz-placeholder, + &::-ms-input-placeholder, + &::-webkit-input-placeholder, + &::-ms-input-placeholder { + color: transparent !important; + } + } + + .el-tag { + margin-left: 0 !important; + margin-right: 6px !important; + } + } +} \ No newline at end of file diff --git a/src/views/plugin/workflow/assets/styles/theme/blue.scss b/src/views/plugin/workflow/assets/styles/theme/blue.scss deleted file mode 100644 index d2a03c4..0000000 --- a/src/views/plugin/workflow/assets/styles/theme/blue.scss +++ /dev/null @@ -1,63 +0,0 @@ -// form - border -.nf-theme-blue { - //google chrome explore - -webkit-print-color-adjust: exact; - //firefox explore - -moz-print-color-adjust: exact; - color-adjust: exact; - - .nf-form--detail { - - .nf-form__group, - .nf-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; - } - - .nf-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/assets/styles/theme/border.scss b/src/views/plugin/workflow/assets/styles/theme/border.scss deleted file mode 100755 index efe140e..0000000 --- a/src/views/plugin/workflow/assets/styles/theme/border.scss +++ /dev/null @@ -1,47 +0,0 @@ -// form - border -.nf-theme-border { - //google chrome explore - -webkit-print-color-adjust: exact; - //firefox explore - -moz-print-color-adjust: exact; - color-adjust: exact; - - .nf-form--detail { - .nf-form__group, - .nf-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; - } - - .nf-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/assets/styles/theme/default.scss b/src/views/plugin/workflow/assets/styles/theme/default.scss deleted file mode 100755 index 987834c..0000000 --- a/src/views/plugin/workflow/assets/styles/theme/default.scss +++ /dev/null @@ -1,161 +0,0 @@ -.nf-theme-default { - //google chrome explore - -webkit-print-color-adjust: exact; - //firefox explore - -moz-print-color-adjust: exact; - color-adjust: exact; - - .nf-form--detail { - .el-col { - margin-bottom: 0 !important; - } - - .hover-row td { - background-color: #fff !important; - } - - .nf-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; - } - } - - .nf-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; - } - } - } -} \ No newline at end of file diff --git a/src/views/plugin/workflow/mixins/ex-form.js b/src/views/plugin/workflow/mixins/ex-form.js index ca05a31..2eda517 100644 --- a/src/views/plugin/workflow/mixins/ex-form.js +++ b/src/views/plugin/workflow/mixins/ex-form.js @@ -130,7 +130,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 => { @@ -540,6 +540,7 @@ export default { }) } this.isPrintShow = true + console.log(this.option) setTimeout(() => { loading.close() // const watermarkText = this.userInfo.user_name + " " + this.userInfo.dept_name diff --git a/src/views/plugin/workflow/mixins/theme.js b/src/views/plugin/workflow/mixins/theme.js index 45f1b03..6db4b19 100755 --- a/src/views/plugin/workflow/mixins/theme.js +++ b/src/views/plugin/workflow/mixins/theme.js @@ -1,20 +1,14 @@ +import { getList } from '../api/design/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("nf-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(`../assets/styles/theme/${val}.scss`) + import(`../assets/styles/theme.scss`) localStorage.setItem('nf-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/pages/design/form-theme.vue b/src/views/plugin/workflow/pages/design/form-theme.vue index a2aa070..25a2127 100644 --- a/src/views/plugin/workflow/pages/design/form-theme.vue +++ b/src/views/plugin/workflow/pages/design/form-theme.vue @@ -26,20 +26,33 @@ type="danger" icon="el-icon-delete" plain - v-if="permission.wfFormTheme_delete" + v-if="permission.wf_form_theme_delete" @click="handleDelete" >删 除 + + + +
+ +
+