Browse Source

样式提取、增加展示示例

pull/137/head
zq 7 days ago
parent
commit
551a647439
  1. 13
      src/components/GroupFormBtns.vue
  2. 194
      src/components/GuipInput.vue
  3. 98
      src/components/GuipRadio.vue
  4. 124
      src/components/GuipSelect.vue
  5. 18
      src/main.js
  6. 332
      src/style/theme/common.scss
  7. 79
      src/utils/common.js
  8. 61
      src/views/elementGroups.vue

13
src/components/GroupFormBtns.vue

@ -1,9 +1,7 @@
<template> <template>
<div class="btns-wrap flex"> <div class="btns-wrap flex" :class="flex == 'start' ? 'flex-start' :''">
<GuipButton type="ignore" @click="cancelClick">取消</GuipButton> <GuipButton type="ignore" @click="cancelClick">{{cancelText || '取消'}}</GuipButton>
<GuipButton type="primary" @click="confirmClick">保存</GuipButton> <GuipButton type="primary" @click="confirmClick">{{confirmText ||'保存'}}</GuipButton>
</div> </div>
</template> </template>
<script> <script>
@ -11,7 +9,7 @@ import GuipButton from '@/components/GuipButton.vue';
export default { export default {
name: '', name: '',
props: [''], props: ['cancelText','confirmText','flex'],
components: { components: {
GuipButton GuipButton
}, },
@ -35,4 +33,7 @@ export default {
margin-top: 24px; margin-top: 24px;
justify-content: flex-end; justify-content: flex-end;
} }
.flex-start{
justify-content: flex-start;
}
</style> </style>

194
src/components/GuipInput.vue

@ -1,44 +1,104 @@
<template> <template>
<el-form-item :style="{ ...styleObject}" :required="required" <el-form-item
:class="[{ 'column': column }, { 'w510': addClass == 'w510' }, { 'w388': addClass == 'w388' }, 'form-item']" :label="label" :style="{ ...styleObject}"
:prop="prop" :rules="rules" > :required="required"
:class="[
{ 'column': column },
{ 'w510': addClass == 'w510' },
{ 'w388': addClass == 'w388' },
{ 'client-form-flex': clientFormFlex },
'form-item'
]"
:label="clientFormFlex ? '' : label"
:prop="prop"
:rules="rules"
>
<p v-if="desc" class="desc_right">{{ desc }}</p> <p v-if="desc" class="desc_right">{{ desc }}</p>
<el-input :type="type" v-bind="$attrs" :placeholder="placeholder1" :disabled="disabled" :maxlength="maxlength1"
:style="{ width: width, height: height }" :value="inputValue" :minLength="minLength1" :show-word-limit="showWordLimit"
@input="$emit('input', $event)" @keydown="handleKeydown" @change="$emit('change', $event)"
@blur="$emit('blur', inputValue)" @focus="$emit('focus', inputValue)" >
<!-- 自定义前面小图标 -->
<template v-slot:prepend>
<slot name="prependshow"></slot>
</template>
<template v-slot:prefix>
<slot name="prefix"></slot>
</template>
<!-- 清除小图标 -->
<template v-slot:suffix>
<slot name="suffix"></slot>
</template>
<template v-slot:append>
<slot name="appendshow"></slot>
</template>
<!-- :error="errorMessage" show-message --> <!-- 统一的输入框渲染 -->
<div :class="clientFormFlex ? 'client-form-flex-wrapper' : ''" style="width:100%">
<!-- 特殊样式布局的标签 -->
<div v-if="clientFormFlex" class="flex-label">
<div class="label-text">{{ clientFormLabel || label }}</div>
<span class="colon"></span>
</div>
<!-- <i slot="suffix" v-if="empty" class="el-icon-close" @click="handleClear">h</i> --> <!-- 输入框容器 -->
<!-- <el-button slot="append" v-if="hasBtn" type="primary" @click="$emit('enter',value)">搜索</el-button> --> <div :class="clientFormFlex ? 'flex-input' : ''">
</el-input> <el-input
<!-- 单位 --> ref="inputRef"
<span class="unit" v-if="unit">{{ unit }}</span> :type="type"
v-bind="$attrs"
:placeholder="placeholder1"
:disabled="disabled"
:maxlength="maxlength1"
:style="{ width: width, height: height }"
:value="inputValue"
:minLength="minLength1"
:show-word-limit="showWordLimit"
@input="$emit('input', $event)"
@keydown="handleKeydown"
@change="$emit('change', $event)"
@blur="$emit('blur', inputValue)"
@focus="$emit('focus', inputValue)"
>
<template v-slot:prepend>
<slot name="prependshow"></slot>
</template>
<template v-slot:prefix>
<slot name="prefix"></slot>
</template>
<template v-slot:suffix>
<slot name="suffix"></slot>
</template>
<template v-slot:append>
<slot name="appendshow"></slot>
</template>
</el-input>
<!-- 单位 -->
<span class="unit" v-if="unit">{{ unit }}</span>
</div>
</div>
</el-form-item> </el-form-item>
</template> </template>
<script> <script>
export default { export default {
name: 'GuipInput', name: 'GuipInput',
props: ['value', 'styleObject', 'disabled', 'defaultValue', 'placeholder','required', props: {
'maxlength', 'minLength', 'clear', 'width', 'height', 'showWordLimit', value: [String, Number],
'label', 'type', 'prop', 'rules', 'column', 'addClass', 'desc', 'unit'], styleObject: Object,
disabled: Boolean,
defaultValue: [String, Number],
placeholder: String,
required: Boolean,
maxlength: [String, Number],
minLength: [String, Number],
clear: Boolean,
width: String,
height: String,
showWordLimit: Boolean,
label: String,
type: {
type: String,
default: 'text'
},
prop: String,
rules: [Object, Array],
column: Boolean,
addClass: String,
desc: String,
unit: String,
//
clientFormFlex: {
type: Boolean,
default: false
},
//
clientFormLabel: {
type: String,
default: ''
}
},
data() { data() {
return { return {
inputValue: this.value || this.defaultValue, inputValue: this.value || this.defaultValue,
@ -51,35 +111,23 @@ export default {
placeholder1: '' placeholder1: ''
} }
}, },
watch: { // value prop 便 inputValue watch: {
// defaultValue(newVal) {
// console.log(newVal,'newVal');
// this.inputValue = newVal;
// },
value(newVal) { value(newVal) {
this.inputValue = newVal; this.inputValue = newVal;
}, },
defaultValue(newVal) { defaultValue(newVal) {
// valuedefaultValue
if (!this.value && newVal !== this.inputValue) { if (!this.value && newVal !== this.inputValue) {
this.inputValue = newVal; this.inputValue = newVal;
} }
} }
}, },
created() { created() {
//
// if (this.defaultValue != null) {
// this.inputValue = this.defaultValue;
// }
//
if (this.placeholder) { if (this.placeholder) {
this.placeholder1 = this.placeholder; this.placeholder1 = this.placeholder;
} }
//
if (this.maxlength) { if (this.maxlength) {
this.maxlength1 = this.maxlength; this.maxlength1 = this.maxlength;
} }
//
if (this.minLength) { if (this.minLength) {
this.minLength1 = this.minLength; this.minLength1 = this.minLength;
} }
@ -94,76 +142,24 @@ export default {
item.onmouseout = function () { item.onmouseout = function () {
item.classList.remove("hoverclass") item.classList.remove("hoverclass")
} }
// item.addEventListener('mouseover',function(){
// console.log('');
// item.classList.add("hoverclass")
// })
// item.addEventListener('mouseoout',function(){
// console.log('');
// item.classList.remove("hoverclass")
// })
// item.addEventListener('mouseoenter',function(){
// console.log('---');
// item.classList.add("hoverclass")
// })
// item.addEventListener('mouseoleave',function(){
// console.log('');
// item.classList.remove("hoverclass")
// })
}) })
// console.log(el,'====9999');
// if(els&& this.styleObject){
// for(var key in this.styleObject){
// els.style[key] = this.styleObject[key]
// }
// }
}) })
}, },
methods: { methods: {
// input
// changeInput(event){
// this.$emit('input', event);
// }
// handleClear(){
// console.log('---');
// this.$emit('clear', '')
// }
handleKeydown(e) { handleKeydown(e) {
console.log(e); console.log(e);
// if (e.key === '1') { e.preventDefault();
e.preventDefault(); //
// }
}, },
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.unit { .unit {
position: absolute; position: absolute;
right: 12px; right: 12px;
/* 根据需要调整位置 */
top: 50%; top: 50%;
transform: translateY(-50%); transform: translateY(-50%);
pointer-events: none; pointer-events: none;
/* 防止单位文本影响输入框的点击事件 */
} }
// .custom-form-item {
// ::v-deep .el-form-item__content {
// display: flex;
// flex-direction: column;
// align-items: flex-start;
// }
// .input-wrapper {
// position: relative;
// width: 100%;
// }
// ::v-deep .el-form-item__error {
// position: relative;
// margin-top: 4px;
// padding-top: 0;
// line-height: 1;
// }
// }
</style> </style>

98
src/components/GuipRadio.vue

@ -1,12 +1,42 @@
<template> <template>
<el-form-item :class="[{ 'column': column }, 'form-item']" :label="label" :prop="prop" :rules="rules" <el-form-item
:required="required"> :class="[
<el-radio-group v-model="selectedValue" v-bind="$attrs" @change="handleChange"> { 'column': column },
<el-radio v-for="(optionValue, optionKey) in normalizedOptions" :key="optionKey" { 'client-form-flex': clientFormFlex },
:label="getValue(optionValue)" :disabled="isDisabled(optionValue[valueKey])"> 'form-item'
{{ getLabel(optionValue) }} ]"
</el-radio> :label="clientFormFlex ? '' : label"
</el-radio-group> :prop="prop"
:rules="rules"
:required="required"
>
<!-- 统一的单选组渲染 -->
<div :class="clientFormFlex ? 'client-form-flex-wrapper' : ''" style="width:100%">
<!-- 特殊样式布局的标签 -->
<div v-if="clientFormFlex" class="flex-label">
<div class="label-text">{{ clientFormLabel || label }}</div>
<span class="colon"></span>
</div>
<!-- 单选组容器 -->
<div :class="clientFormFlex ? 'flex-input' : ''">
<el-radio-group
v-model="selectedValue"
v-bind="$attrs"
@change="handleChange"
class="radio-group-wrapper"
>
<el-radio
v-for="(optionValue, optionKey) in normalizedOptions"
:key="optionKey"
:label="getValue(optionValue)"
:disabled="isDisabled(optionValue[valueKey])"
>
{{ getLabel(optionValue) }}
</el-radio>
</el-radio-group>
</div>
</div>
</el-form-item> </el-form-item>
</template> </template>
@ -33,7 +63,6 @@ export default {
// 3.null // 3.null
// 4. // 4.
options: { options: {
// type: [Array, Object],
default: () => null, default: () => null,
validator: (value) => { validator: (value) => {
// null // null
@ -82,13 +111,23 @@ export default {
disabledKeys: { disabledKeys: {
type: Array, type: Array,
default: () => [] default: () => []
},
//
clientFormFlex: {
type: Boolean,
default: false
},
//
clientFormLabel: {
type: String,
default: ''
} }
}, },
computed: { computed: {
// //
normalizedOptions() { normalizedOptions() {
// nullundefined // nullundefined
if (this.options == null || !this.options) { if (this.options == null || !this.options) {
return []; return [];
} }
@ -129,12 +168,10 @@ export default {
}, },
getLabel(option) { getLabel(option) {
if (this.formatter) return this.formatter(option); if (this.formatter) return this.formatter(option);
// //
if (typeof option === 'object' && 'key' in option && 'value' in option) { if (typeof option === 'object' && 'key' in option && 'value' in option) {
return option.value; return option.value;
} }
// //
const isSelected = this.getValue(option) === this.selectedValue; const isSelected = this.getValue(option) === this.selectedValue;
@ -142,7 +179,6 @@ export default {
if (isSelected && option[this.selectedLabelKey]) { if (isSelected && option[this.selectedLabelKey]) {
return option[this.selectedLabelKey]; return option[this.selectedLabelKey];
} }
// labelKey // labelKey
if (typeof option === 'object' && this.labelKey in option) { if (typeof option === 'object' && this.labelKey in option) {
return option[this.labelKey]; return option[this.labelKey];
@ -154,7 +190,6 @@ export default {
if (typeof option === 'object' && 'key' in option && 'value' in option) { if (typeof option === 'object' && 'key' in option && 'value' in option) {
return option.key; return option.key;
} }
// valueKey // valueKey
if (typeof option === 'object' && this.valueKey in option) { if (typeof option === 'object' && this.valueKey in option) {
return option[this.valueKey]; return option[this.valueKey];
@ -169,39 +204,18 @@ export default {
}; };
</script> </script>
<style scoped> <style scoped lang="scss">
/* 自定义样式 */ /* 原有样式 */
.el-radio-group { .radio-group-wrapper {
margin: 10px 0; margin: 10px 0;
display: flex; display: flex;
justify-content: flex-start; justify-content: flex-start;
gap: 20px 24px; gap: 20px 24px;
flex-wrap: wrap; flex-wrap: wrap;
}
.custom-form-item {
::v-deep .el-form-item__content {
display: flex;
flex-direction: column;
align-items: flex-start;
min-height: auto; /* 允许高度自由扩展 */
}
/* 错误提示样式调整 */
::v-deep .el-form-item__error {
position: relative; /* 改为相对定位 */
margin-top: 4px; /* 与单选框组保持间距 */
padding-top: 0;
line-height: 1.5;
white-space: normal; /* 允许错误信息换行 */
}
/* 单选框组布局调整 */ //
.el-radio-group { .client-form-flex & {
margin: 10px 0; flex: 1;
display: flex;
flex-wrap: wrap;
gap: 20px 24px;
width: 100%; /* 确保宽度填满 */
} }
} }
</style> </style>

124
src/components/GuipSelect.vue

@ -1,14 +1,49 @@
<template> <template>
<el-form-item :style="{ ...style, height: height, ...styleObject }" :required="required" <el-form-item
:class="[{ 'column': column }, { 'w510': addClass == 'w510' }, { 'w388': addClass == 'w388' }, 'form-item']" :style="{ ...style, height: height, ...styleObject }"
:label="label" :prop="prop" :rules="rules"> :required="required"
:class="[
{ 'column': column },
{ 'w510': addClass == 'w510' },
{ 'w388': addClass == 'w388' },
{ 'client-form-flex': clientFormFlex },
'form-item'
]"
:label="clientFormFlex ? '' : label"
:prop="prop"
:rules="rules"
>
<p v-if="desc" class="desc_right">{{ desc }}</p> <p v-if="desc" class="desc_right">{{ desc }}</p>
<el-select :style="{ width: width }" :placeholder="placeholder1" @change="handleChange" v-model="selectedValue"
v-bind="$attrs"> <!-- 统一的选择框渲染 -->
<el-option v-for="item in processedOptions" :key="getItemValue(item)" :label="getItemLabel(item)" <div :class="clientFormFlex ? 'client-form-flex-wrapper' : ''" style="width:100%">
:disabled="item.disabled" :value="getItemValue(item)"> <!-- 特殊样式布局的标签 -->
</el-option> <div v-if="clientFormFlex" class="flex-label">
</el-select> <div class="label-text">{{ clientFormLabel || label }}</div>
<span class="colon"></span>
</div>
<!-- 选择框容器 -->
<div :class="clientFormFlex ? 'flex-input' : ''">
<el-select
ref="selectRef"
:style="{ width: width }"
:placeholder="placeholder1"
@change="handleChange"
v-model="selectedValue"
v-bind="$attrs"
>
<el-option
v-for="item in processedOptions"
:key="getItemValue(item)"
:label="getItemLabel(item)"
:disabled="item.disabled"
:value="getItemValue(item)"
>
</el-option>
</el-select>
</div>
</div>
</el-form-item> </el-form-item>
</template> </template>
@ -18,7 +53,7 @@ export default {
props: { props: {
value: [String, Number, Array], value: [String, Number, Array],
options: { options: {
type: [Array,Object], type: [Array, Object],
default: () => [] default: () => []
}, },
// //
@ -30,7 +65,7 @@ export default {
type: String, type: String,
default: 'label' default: 'label'
}, },
// //
extraItem: { extraItem: {
type: Object, type: Object,
default: null default: null
@ -48,7 +83,17 @@ export default {
rules: [Object, Array], rules: [Object, Array],
column: Boolean, column: Boolean,
addClass: String, addClass: String,
desc: String desc: String,
//
clientFormFlex: {
type: Boolean,
default: false
},
//
clientFormLabel: {
type: String,
default: ''
}
}, },
data() { data() {
return { return {
@ -60,13 +105,12 @@ export default {
computed: { computed: {
processedOptions() { processedOptions() {
// options // options
// let options = [1,5,3] || [];
let newOptions = null
let options = this.options || []; let options = this.options || [];
// [1,12,22]
// [1,12,22]
if (Array.isArray(options) && options.length > 0 && options.every(item => typeof item !== 'object')) { if (Array.isArray(options) && options.length > 0 && options.every(item => typeof item !== 'object')) {
newOptions = options.map((item, index) => ({ options = options.map(item => ({
[this.valueKey]: index, [this.valueKey]: item,
[this.labelKey]: item [this.labelKey]: item
})); }));
} }
@ -78,18 +122,25 @@ export default {
[this.labelKey]: options[key] [this.labelKey]: options[key]
})); }));
} }
// options
if (!Array.isArray(options)) {
options = [];
}
// extraItemoptions // extraItemoptions
if (this.extraItem && Object.keys(this.extraItem).length > 0) { if (this.extraItem && Object.keys(this.extraItem).length > 0) {
newOptions = [ options = [
{ {
[this.labelKey]: this.extraItem.label || '', [this.labelKey]: this.extraItem.label || '',
[this.valueKey]: this.extraItem.value || '', [this.valueKey]: this.extraItem.value || '',
disabled: this.extraItem.disabled || false disabled: this.extraItem.disabled || false
}, },
...newOptions ...options
]; ];
} }
return newOptions;
return options;
} }
}, },
watch: { watch: {
@ -110,21 +161,15 @@ export default {
if (this.value !== undefined && this.value !== null) { if (this.value !== undefined && this.value !== null) {
this.selectedValue = this.value this.selectedValue = this.value
} }
// //
if (this.placeholder) { if (this.placeholder) {
this.placeholder1 = this.placeholder this.placeholder1 = this.placeholder
} }
this.$nextTick(() => {
let els = document.querySelectorAll('.el-input');
els.forEach(item => {
item.onmouseover = function () {
item.classList.add("hoverclass")
}
item.onmouseout = function () {
item.classList.remove("hoverclass")
}
}) //
this.$nextTick(() => {
this.addHoverEffect();
}) })
}, },
methods: { methods: {
@ -132,13 +177,29 @@ export default {
getItemValue(item) { getItemValue(item) {
return item[this.valueKey] return item[this.valueKey]
}, },
// label // label
getItemLabel(item) { getItemLabel(item) {
return item[this.labelKey] return item[this.labelKey]
}, },
//
handleChange(value) { handleChange(value) {
this.$emit('input', value) this.$emit('input', value)
this.$emit('change', value) this.$emit('change', value)
},
//
addHoverEffect() {
const els = document.querySelectorAll('.el-input');
els.forEach(item => {
item.onmouseover = function () {
item.classList.add("hoverclass")
}
item.onmouseout = function () {
item.classList.remove("hoverclass")
}
})
} }
} }
} }
@ -164,5 +225,4 @@ export default {
// .el-select { // .el-select {
// width: 100%; // width: 100%;
// } // }
// } // }</style>
</style>

18
src/main.js

@ -19,6 +19,8 @@ import clipboard from '@/utils/dirClipBoard';
import { modernCopyToClipboard } from '@/utils/clipboard'; import { modernCopyToClipboard } from '@/utils/clipboard';
//登陆 //登陆
import { autoLoginByToken } from '@/utils/login' import { autoLoginByToken } from '@/utils/login'
import {stateFormat,formatNumber} from "@/utils/common";
import PositionMessage from './utils/tooltip' import PositionMessage from './utils/tooltip'
function filterByPermission(data, targetPermission) { function filterByPermission(data, targetPermission) {
@ -46,22 +48,6 @@ function filterByPermission(data, targetPermission) {
return newItem; return newItem;
}); });
} }
//金额千分符 会在整数后添加两个0 --适用于直接显示的
function stateFormat(row, column, cellValue) {
if (cellValue) {
return Number(cellValue)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
return $1 + ",";
})
.replace(/\.$/, "");
}
}
//金额千分符 自定义渲染表格内容情况下,调用此方法
function formatNumber(value) {
if (value === null || value === undefined) return '';
return Number(value).toLocaleString();
}
Vue.prototype.$routerBaseApi = 'http://admin.pengda.checkcopy.com'; Vue.prototype.$routerBaseApi = 'http://admin.pengda.checkcopy.com';
// 复制 // 复制
Vue.prototype.$copy = modernCopyToClipboard; Vue.prototype.$copy = modernCopyToClipboard;

332
src/style/theme/common.scss

@ -317,7 +317,7 @@ body {
.borderNone { .borderNone {
border: none !important; border: none !important;
} }
// 非论易排项目的样式
.flex-common { .flex-common {
padding: 32px 36px; padding: 32px 36px;
background-color: #fff; background-color: #fff;
@ -470,8 +470,21 @@ body {
} }
} }
.el-button--often {
color: #006AFF;
background: #F2F7FF;
border: 1px solid transparent;
// &:hover {
// color: #006AFF;
// background: #F2F7FF;
// border: 1px solid #006AFF;
// }
}
.el-button--text, .el-button--text,
.el-button--grey { .el-button--grey,
.el-button--warn {
padding: 0; padding: 0;
color: #006AFF; color: #006AFF;
width: auto !important; width: auto !important;
@ -493,6 +506,15 @@ body {
} }
} }
.el-button--warn {
color: #FF4D4F;
&:hover {
color: #006AFF;
opacity: 1;
}
}
.el-button--ignore { .el-button--ignore {
color: #626573; color: #626573;
background: #FFFFFF; background: #FFFFFF;
@ -517,7 +539,6 @@ body {
// border: 1px solid #006AFF; // border: 1px solid #006AFF;
// color: #006AFF; // color: #006AFF;
// } // }
// .el-button--primary, // .el-button--primary,
// .el-button--success, // .el-button--success,
// .el-button--info, // .el-button--info,
@ -525,45 +546,37 @@ body {
// .el-button--danger { // .el-button--danger {
// color: #fff !important; // color: #fff !important;
// } // }
// .el-button--medium { // .el-button--medium {
// //中等按钮 // //中等按钮
// width: 97px; // width: 97px;
// height: 33px; // height: 33px;
// font-size: 14px; // font-size: 14px;
// line-height: 14px; // line-height: 14px;
// span { // span {
// height: 14px; // height: 14px;
// } // }
// } // }
// .el-button--small { // .el-button--small {
// //小的按钮 // //小的按钮
// width: 80px; // width: 80px;
// height: 32px; // height: 32px;
// font-size: 12px; // font-size: 12px;
// } // }
// .el-button--mini { // .el-button--mini {
// //迷你按钮 // //迷你按钮
// width: 80px; // width: 80px;
// height: 28px; // height: 28px;
// font-size: 12px; // font-size: 12px;
// } // }
// .el-button--reverseMild { // .el-button--reverseMild {
// background: #E8F0FE; // background: #E8F0FE;
// color: #006AFF; // color: #006AFF;
// border: none; // border: none;
// } // }
// .el-button--reverseMild:hover { // .el-button--reverseMild:hover {
// border-color: #F2F7FF !important; // border-color: #F2F7FF !important;
// background-color: #F2F7FF !important; // background-color: #F2F7FF !important;
// } // }
// .el-button--reverseMild.is-disabled, // .el-button--reverseMild.is-disabled,
// .el-button--reverseMild.is-disabled:hover { // .el-button--reverseMild.is-disabled:hover {
// color: #006AFF; // color: #006AFF;
@ -571,14 +584,12 @@ body {
// background-color: #E8F0FE; // background-color: #E8F0FE;
// opacity: .7; // opacity: .7;
// } // }
// .el-button--mild.is-disabled, // .el-button--mild.is-disabled,
// .el-button--mild.is-disabled:hover { // .el-button--mild.is-disabled:hover {
// color: #006AFF; // color: #006AFF;
// opacity: .7; // opacity: .7;
// border-color: #006AFF; // border-color: #006AFF;
// } // }
/* button==== end */ /* button==== end */
// radio ---start // radio ---start
@ -598,7 +609,6 @@ body {
} }
// radio ---end // radio ---end
// input ---start // input ---start
.el-input { .el-input {
border-radius: 2px; border-radius: 2px;
@ -677,7 +687,6 @@ body {
// input ---end // input ---end
// select start // select start
.el-select { .el-select {
width: 100%; width: 100%;
@ -709,7 +718,6 @@ body {
} }
// select end // select end
// textarea start // textarea start
.el-textarea__inner { .el-textarea__inner {
padding: 10px 12px; padding: 10px 12px;
@ -729,7 +737,6 @@ body {
// textarea end // textarea end
.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-wrap>.el-form-item__label:before,
.el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before { .el-form-item.is-required:not(.is-no-asterisk)>.el-form-item__label:before {
content: ''; content: '';
@ -797,6 +804,8 @@ body {
flex: 1; flex: 1;
line-height: normal; line-height: normal;
position: relative; position: relative;
display: flex;
justify-content: flex-start;
.desc_right { .desc_right {
position: absolute; position: absolute;
@ -911,6 +920,9 @@ body {
td { td {
font-size: 13px !important; font-size: 13px !important;
} }
.status-item{
font-size: 13px !important;
}
} }
// body{ // body{
@ -943,6 +955,9 @@ body {
td { td {
font-size: 12px !important; font-size: 12px !important;
} }
.status-item{
font-size: 12px !important;
}
} }
.tableHeaderSelect .el-input__inner { .tableHeaderSelect .el-input__inner {
@ -968,6 +983,9 @@ body {
td { td {
font-size: 14px !important; font-size: 14px !important;
} }
.status-item{
font-size: 14px !important;
}
} }
.cell-content { .cell-content {
@ -1068,7 +1086,6 @@ body {
} }
// table end // table end
.el-pagination { .el-pagination {
margin-top: 16px; margin-top: 16px;
display: flex; display: flex;
@ -1134,7 +1151,6 @@ body {
} }
// dialog--end // dialog--end
// switch --start // switch --start
// .el-switch__core{ // .el-switch__core{
// background-color: #00C261; // background-color: #00C261;
@ -1143,7 +1159,6 @@ body {
// background-color: #BABDC2; // background-color: #BABDC2;
// } // }
// switch --end // switch --end
// 弹出气泡框 // 弹出气泡框
.el-popover { .el-popover {
padding: 32px; padding: 32px;
@ -1219,3 +1234,280 @@ body {
margin-bottom: 4px; margin-bottom: 4px;
} }
} }
.before_h_title{
font-size: 14px;
font-weight: bold;
line-height: normal;
letter-spacing: normal;
color: #333333;
display: flex;
align-items: center;
text-align: left;
&::before{
content: '';
background: #3F62F6;
display: inline-block;
margin-right: 9px;
width: 6px;
height: 16px;
border-radius: 12px;
}
.desc{
font-size: 12px;
font-weight: normal;
color: #626573;
margin-left: 8px;
}
}
// 上传按钮样式
.qqCode-wrap {
display: grid;
justify-items: start;
}
.avatar-desc {
margin-top: 8px;
font-family: Inter;
font-size: 12px;
font-weight: normal;
line-height: 20px;
letter-spacing: normal;
font-variation-settings: "wght" 400;
color: var(--el-color-text-regular);
}
.avatar-uploader{
.upload-button {
border-radius: 4px;
background: #F2F3F5;
box-sizing: border-box;
border: 1px solid #BABDC2;
}
.bgImg{
width: 20px;
height: 16px;
margin-right: 6px;
background-image: url(@/assets/site/uploadIcon.svg);
}
&:hover{
.bgImg{
background-image: url(@/assets/site/uploadIcon_light.svg);
}
}
}
// 页面底部操作按钮样式 单个的
.save-button{
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background: #fff;
box-shadow: 0 4px 16px 0 rgba(17, 55, 143, 0.12);
display: flex;
align-items: center;
justify-content: center;
padding: 16px 0;
z-index: 9;
}
// 论易排版样式 会覆盖原有样式
.client_flex-common{
padding: 24px 32px;
}
.client-form-flex {
// 隐藏原有的el-form-item标签
::v-deep .el-form-item__label {
display: none;
}
::v-deep .el-form-item__content {
margin-left: 0 !important;
display: flex;
align-items: center;
}
.client-form-flex-wrapper {
display: flex;
align-items: center;
width: 100%;
.flex-input {
flex: 1;
position: relative;
display: flex;
justify-content: flex-start;
::v-deep .el-select {
width: 100%;
}
::v-deep .el-input {
width: 100%;
}
::v-deep .el-radio-group {
margin: 0; /* 移除原有margin */
display: flex;
flex-wrap: wrap;
gap: 20px 24px;
width: 100%;
}
}
}
}
// 这种表现样式 目前应用的有input select radio
.flex-label {
display: flex;
align-items: center;
margin-right: 12px;
height: 32px;
flex-shrink: 0;
.label-text {
display: block;
color: #333;
width: 56px;
text-align: justify;
text-align-last: justify;
line-height: 1;
}
.colon {
margin-left: 4px;
line-height: 1;
}
}
// 不同状态颜色 / 小标签 -- 待测试其余使用的页面是否生效
.status-item {
height: 22px;
display: flex;
justify-content: center;
align-items: center;
padding: 2px 10px;
border-radius: 4px;
font-size: 14px;
font-weight: normal;
line-height: 22px;
text-align: center;
letter-spacing: 0.08em;
box-sizing: border-box;
}
.divgreen {
background: rgba(239, 255, 224, 0.5);
border: 1px solid rgba(0, 194, 97, 0.6);
}
.fontgreen {
color: #0DAF49;
}
.divblue {
background: #F2F7FF;
border: 1px solid #BFDAFF;
}
.fontblue {
color: #006AFF;
}
.divred {
background: #FFF1F0;
border: 1px solid #FFA39E;
}
.fontred {
color: #FF4D4F;
}
.divgray {
background: #F6F7FA;
border: 1px solid #DFE2E6;
}
.fontgray {
color: #626573;
}
.divorange {
background: #FFFBF2;
border: 1px solid rgba(251, 131, 45, 0.38);
}
.fontorange {
color: #FB832D;
}
.divpurple {
background: #F9F2FF;
border: 1px solid rgba(126, 118, 253, 0.28);
}
.fontpurple {
color: #6258FF;
}
// end
// 卡片选择及默认样式 start
.wallet-item{
display: flex;
flex-direction: column;
text-align: left;
padding: 16px 14px;
width: 282px;
height: 96px;
letter-spacing: 0.08em;
border-radius: 8px;
background: rgba(255, 255, 255, 0.47);
box-sizing: border-box;
border: 1px solid #DFE2E6;
.desc{
font-size: 12px;
color: #626573;
letter-spacing: 0.08em;
}
.wallet-name{
color: #1E2226;
font-size: 14px;
font-weight: bold;
margin-bottom: 12px;
}
.wallet-num{
font-size: 12px;
color: #626573;
padding: 0 2px;
display: flex;
align-items: baseline;
}
.wallet-price{
font-size: 22px;
font-weight: bold;
color: #626573;
}
}
.wallet-item-active{
position: relative;
background: #F2F7FF;
border-color: #006AFF;
.tem-active{
position: absolute;
right: 0;
top: 0;
width: 30px;
height: 30px;
}
.wallet-name{
color: #006AFF;
}
}
// 卡片选择及默认样式 end

79
src/utils/common.js

@ -2,31 +2,82 @@
export function setHighActive(dom) { export function setHighActive(dom) {
const ele = document.getElementById(dom) const ele = document.getElementById(dom)
ele.classList.add('ceshi') ele.classList.add('ceshi')
ele.scrollIntoView({behavior:'smooth',block:'start'}) ele.scrollIntoView({
setTimeout(()=>{ behavior: 'smooth',
block: 'start'
})
setTimeout(() => {
ele.classList.remove('ceshi') ele.classList.remove('ceshi')
},1000) }, 1000)
} }
export function getServicePriceDesc(price, price_unit, unit_num, unit_name) { export function getServicePriceDesc(price, price_unit, unit_num, unit_name) {
let unit = 0; let unit = 0;
let unit_str = ""; let unit_str = "";
if (unit_num == 1) return price + price_unit +'/'+unit_name; if (unit_num == 1) return price + price_unit + '/' + unit_name;
if (unit_num/10000 < 10) { if (unit_num / 10000 < 10) {
unit = Math.ceil(unit_num/10000); unit = Math.ceil(unit_num / 10000);
unit_str = unit == 1 ? '万' : unit+'万'; unit_str = unit == 1 ? '万' : unit + '万';
} }
if (unit_num/1000 < 10) { if (unit_num / 1000 < 10) {
unit = Math.ceil(unit_num/1000); unit = Math.ceil(unit_num / 1000);
unit_str = unit == 1 ? '千' : unit+'千'; unit_str = unit == 1 ? '千' : unit + '千';
} }
if (unit_num/100 < 10) { if (unit_num / 100 < 10) {
unit = Math.ceil(unit_num/100); unit = Math.ceil(unit_num / 100);
unit_str = unit == 1 ? '百' : unit+'百'; unit_str = unit == 1 ? '百' : unit + '百';
} }
return price + price_unit + "/" +unit_str + unit_name; return price + price_unit + "/" + unit_str + unit_name;
} }
/**
* 获取格式化的日期字符串
* @param {string} format - 日期格式可选值'YYYY-MM-DD', 'YYYY-MM', 'YYYY', 'HH:mm:ss'
* @returns {string} 格式化后的日期字符串
*
// 使用示例
// console.log(getFormattedDate('YYYY')); // 2024
// console.log(getFormattedDate('YYYY-MM')); // 2024-01
// console.log(getFormattedDate('YYYY-MM-DD')); // 2024-01-15
*/
export const getFormattedDate = (format = 'YYYY-MM-DD') => {
const now = new Date();
const year = now.getFullYear();
const month = String(now.getMonth() + 1).padStart(2, '0');
const day = String(now.getDate()).padStart(2, '0');
const hour = String(now.getHours()).padStart(2, '0');
const minute = String(now.getMinutes()).padStart(2, '0');
const second = String(now.getSeconds()).padStart(2, '0');
const formats = {
'YYYY': year,
'YYYY-MM': `${year}-${month}`,
'YYYY-MM-DD': `${year}-${month}-${day}`,
'HH:mm:ss': `${hour}:${minute}:${second}`,
'YYYY-MM-DD HH:mm:ss': `${year}-${month}-${day} ${hour}:${minute}:${second}`,
'YYYY/MM/DD': `${year}/${month}/${day}`,
'YYYY年MM月DD日': `${year}${month}${day}`,
};
return formats[format] || formats['YYYY-MM-DD'];
};
//金额千分符 会在整数后添加两个0 --适用于直接显示的
export function stateFormat(row, column, cellValue) {
if (cellValue) {
return Number(cellValue)
.toFixed(2)
.replace(/(\d)(?=(\d{3})+\.)/g, ($0, $1) => {
return $1 + ",";
})
.replace(/\.$/, "");
}
}
//金额千分符 自定义渲染表格内容情况下,调用此方法
export function formatNumber(value) {
if (value === null || value === undefined) return '';
return Number(value).toLocaleString();
}

61
src/views/elementGroups.vue

@ -27,8 +27,6 @@
</template> </template>
</PromptText> </PromptText>
<div class="ele-item"> <div class="ele-item">
<label for="">实时预览外层嵌套</label> <label for="">实时预览外层嵌套</label>
<!-- 默认 显示电脑端手机端 --> <!-- 默认 显示电脑端手机端 -->
@ -43,6 +41,27 @@
</template> </template>
</DevicePreview> </DevicePreview>
</div> </div>
<div class="ele-item gap12">
<label for="">不同状态</label>
<div class="status-item divgreen"><span class="fontgreen">状态标签</span></div>
<div class="status-item divorange"><span class="fontorange">状态标签</span></div>
<div class="status-item divgray"><span class="fontgray">状态标签</span></div>
<div class="status-item divred"><span class="fontred">状态标签</span></div>
<div class="status-item divblue"><span class="fontblue">状态标签</span></div>
</div>
<div class="ele-item gap12">
<label for="">卡片默认及选中样式</label>
<div class="wallet-item point " >
<img src="@/assets/site/tem-active.svg" class="tem-active" alt="" v-if="false">
<div class="wallet-name">这是默认</div>
<div class="desc">小文案小文案小文案小文案小文案</div>
</div>
<div class="wallet-item point wallet-item-active" >
<img src="@/assets/site/tem-active.svg" class="tem-active" alt="">
<div class="wallet-name">这是选中</div>
<div class="desc">小文案小文案小文案小文案小文案</div>
</div>
</div>
<!-- ele-item 为类名的这种div label h3 仅在此页面进行布局使用复制时无需复制此元素 --> <!-- ele-item 为类名的这种div label h3 仅在此页面进行布局使用复制时无需复制此元素 -->
<el-form :model="form" :rules="rules" class="el-row demo-ruleForm" ref="formRef"> <el-form :model="form" :rules="rules" class="el-row demo-ruleForm" ref="formRef">
@ -244,7 +263,26 @@
</GuipInput> </GuipInput>
<!-- <el-input placeholder="oieuwroieuwi" style="width:400px;height:60px"></el-input> --> <!-- <el-input placeholder="oieuwroieuwi" style="width:400px;height:60px"></el-input> -->
</div> </div>
<div class="ele-item gap12">
<label for="">带间隔的label:</label>
<div class="column">
<div class="flex mb12">
<div class="flex-label">
<div class="label-text">名称</div>
<span class="colon"></span>
</div>
<p class="desc">说明类名是固定的</p>
</div>
<GuipInput ref="GuipInput" :column="true" v-model="form.input1" width="200px" height="30px"
placeholder="label有间隔的" label="输入框" :client-form-flex="true"/>
<GuipSelect ref="GuipSelect" :column="true" v-model="form.input1" width="200px" height="30px"
placeholder="label有间隔的" label="下拉框" :client-form-flex="true"/>
<GuipRadio v-model="form.language" :options="languageOptions1" label="单选" prop="language" selectedLabelKey="selectedLabel"
@change="radioChange" label-key="name" :disabledKeys="['1']" :client-form-flex="true"
value-key="id" />
</div>
</div>
<div class="ele-item"> <div class="ele-item">
<label for="">单选框</label> <label for="">单选框</label>
<el-radio v-model="radio1" :label="1">选项一</el-radio> <el-radio v-model="radio1" :label="1">选项一</el-radio>
@ -276,23 +314,29 @@
<GuipButton disabled>按钮</GuipButton> <GuipButton disabled>按钮</GuipButton>
</div> </div>
<div class="ele-item"> <div class="ele-item">
<label for="">弱按钮</label> <label for="">ignore</label>
<GuipButton type="ignore">按钮</GuipButton> <GuipButton type="ignore">按钮</GuipButton>
<GuipButton type="ignore" loading>按钮</GuipButton> <GuipButton type="ignore" loading>按钮</GuipButton>
<GuipButton type="ignore" disabled>按钮</GuipButton> <GuipButton type="ignore" disabled>按钮</GuipButton>
</div> </div>
<div class="ele-item"> <div class="ele-item">
<label for="">中按钮</label> <label for="">system</label>
<GuipButton type="system">按钮</GuipButton> <GuipButton type="system">按钮</GuipButton>
<GuipButton type="system" loading>按钮</GuipButton> <GuipButton type="system" loading>按钮</GuipButton>
<GuipButton type="system" disabled>按钮</GuipButton> <GuipButton type="system" disabled>按钮</GuipButton>
</div> </div>
<div class="ele-item"> <div class="ele-item">
<label for="">often</label>
<GuipButton type="often">按钮</GuipButton>
<GuipButton type="often" loading>按钮</GuipButton>
<GuipButton type="often" disabled>按钮</GuipButton>
</div>
<div class="ele-item">
<label for="">文字按钮</label> <label for="">文字按钮</label>
<GuipButton type="text">强引导</GuipButton> <GuipButton type="text">强引导</GuipButton>
<GuipButton type="grey">弱引导</GuipButton> <GuipButton type="grey">弱引导</GuipButton>
</div> </div>
<div class="ele-item"> <div class="ele-item gap12">
<label for="">独特按钮可以自定义划过时 图标图片文字颜色</label> <label for="">独特按钮可以自定义划过时 图标图片文字颜色</label>
<hover-button button-text="默认样式" :default-icon="require('../assets/upLoad_grey.svg')" <hover-button button-text="默认样式" :default-icon="require('../assets/upLoad_grey.svg')"
:hover-icon="require('../assets/upLoad_active.svg')" default-text-color="#23242B" :hover-icon="require('../assets/upLoad_active.svg')" default-text-color="#23242B"
@ -374,8 +418,10 @@
<!-- <b slot="formLeft">自定义左侧</b> --> <!-- <b slot="formLeft">自定义左侧</b> -->
<span class="desc" slot="formRight"><a href="https://www.baidu.com/">跳转一下</a> 自定义右侧</span> <span class="desc" slot="formRight"><a href="https://www.baidu.com/">跳转一下</a> 自定义右侧</span>
<!-- 自定义下方内容 --> <!-- 自定义下方内容 -->
<GuipInput slot="formDom" ref="GuipInput" column="column" v-model="form.age" prop="age" <!-- <GuipInput slot="formDom" ref="GuipInput" column="column" v-model="form.age" prop="age"
placeholder="请输入" /> placeholder="请输入" /> -->
<GuipSelect slot="formDom" v-model="form.card" clearable @change="selectChangeTest"
prop="card" :options="['麻辣烫','提拉米苏']" />
</GuipFormItem> </GuipFormItem>
</div> </div>
@ -1357,6 +1403,7 @@ export default {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: flex-start;
flex-wrap: wrap;
margin: 20px 0 30px; margin: 20px 0 30px;
label { label {

Loading…
Cancel
Save