Compare commits
2 Commits
556bcb5320
...
6afa3f267e
Author | SHA1 | Date | |
---|---|---|---|
|
6afa3f267e | ||
|
7a74264ff2 |
@ -1,88 +1,24 @@
|
||||
<template>
|
||||
<div>
|
||||
<template v-for="(item, index) in options">
|
||||
<template v-if="values.includes(item.value)">
|
||||
<span
|
||||
v-if="item.listClass == 'default' || item.listClass == ''"
|
||||
:key="item.value"
|
||||
:index="index"
|
||||
:class="item.cssClass"
|
||||
>{{ item.label + " " }}</span
|
||||
>
|
||||
<el-tag
|
||||
v-else
|
||||
:disable-transitions="true"
|
||||
:key="item.value"
|
||||
:index="index"
|
||||
:type="item.listClass == 'primary' ? '' : item.listClass"
|
||||
:class="item.cssClass"
|
||||
>
|
||||
{{ item.label + " " }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<span>
|
||||
<template v-for="(dict, index) in this.getDictDatas2(type, value)">
|
||||
<!-- 默认样式 -->
|
||||
<span v-if="dict.colorType === 'default' || dict.colorType === '' || dict.colorType === undefined" :key="dict.value" :index="index"
|
||||
:class="dict.cssClass">{{ dict.label }}</span>
|
||||
<!-- Tag 样式 -->
|
||||
<el-tag v-else :disable-transitions="true" :key="dict.value" :index="index" :type="dict.colorType" :class="dict.cssClass">
|
||||
{{ dict.label }}
|
||||
</el-tag>
|
||||
</template>
|
||||
<template v-if="unmatch && showValue">
|
||||
{{ unmatchArray | handleArray }}
|
||||
</template>
|
||||
</div>
|
||||
</span>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "DictTag",
|
||||
props: {
|
||||
options: {
|
||||
type: Array,
|
||||
default: null,
|
||||
},
|
||||
value: [Number, String, Array],
|
||||
// 当未找到匹配的数据时,显示value
|
||||
showValue: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
}
|
||||
type: String,
|
||||
value: [Number, String, Boolean, Array],
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
unmatchArray: [], // 记录未匹配的项
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
values() {
|
||||
if (this.value !== null && typeof this.value !== "undefined") {
|
||||
return Array.isArray(this.value) ? this.value : [String(this.value)];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
unmatch() {
|
||||
this.unmatchArray = [];
|
||||
if (this.value !== null && typeof this.value !== "undefined") {
|
||||
// 传入值为非数组
|
||||
if (!Array.isArray(this.value)) {
|
||||
if (this.options.some((v) => v.value == this.value)) return false;
|
||||
this.unmatchArray.push(this.value);
|
||||
return true;
|
||||
}
|
||||
// 传入值为Array
|
||||
this.value.forEach((item) => {
|
||||
if (!this.options.some((v) => v.value == item))
|
||||
this.unmatchArray.push(item);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
// 没有value不显示
|
||||
return false;
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
handleArray(array) {
|
||||
if (array.length === 0) return "";
|
||||
return array.reduce((pre, cur) => {
|
||||
return pre + " " + cur;
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
|
92
src/components/DictTagOld/index.vue
Normal file
92
src/components/DictTagOld/index.vue
Normal file
@ -0,0 +1,92 @@
|
||||
<template>
|
||||
<div>
|
||||
<template v-for="(item, index) in options">
|
||||
<template v-if="values.includes(item.value)">
|
||||
<span
|
||||
v-if="item.listClass == 'default' || item.listClass == ''"
|
||||
:key="item.value"
|
||||
:index="index"
|
||||
:class="item.cssClass"
|
||||
>{{ item.label + " " }}</span
|
||||
>
|
||||
<el-tag
|
||||
v-else
|
||||
:disable-transitions="true"
|
||||
:key="item.value"
|
||||
:index="index"
|
||||
:type="item.listClass == 'primary' ? '' : item.listClass"
|
||||
:class="item.cssClass"
|
||||
>
|
||||
{{ item.label + " " }}
|
||||
</el-tag>
|
||||
</template>
|
||||
</template>
|
||||
<template v-if="unmatch && showValue">
|
||||
{{ unmatchArray | handleArray }}
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "DictTag",
|
||||
props: {
|
||||
options: {
|
||||
type: Array,
|
||||
default: null,
|
||||
},
|
||||
value: [Number, String, Array],
|
||||
// 当未找到匹配的数据时,显示value
|
||||
showValue: {
|
||||
type: Boolean,
|
||||
default: true,
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
unmatchArray: [], // 记录未匹配的项
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
values() {
|
||||
if (this.value !== null && typeof this.value !== "undefined") {
|
||||
return Array.isArray(this.value) ? this.value : [String(this.value)];
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
unmatch() {
|
||||
this.unmatchArray = [];
|
||||
if (this.value !== null && typeof this.value !== "undefined") {
|
||||
// 传入值为非数组
|
||||
if (!Array.isArray(this.value)) {
|
||||
if (this.options.some((v) => v.value == this.value)) return false;
|
||||
this.unmatchArray.push(this.value);
|
||||
return true;
|
||||
}
|
||||
// 传入值为Array
|
||||
this.value.forEach((item) => {
|
||||
if (!this.options.some((v) => v.value == item))
|
||||
this.unmatchArray.push(item);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
// 没有value不显示
|
||||
return false;
|
||||
},
|
||||
},
|
||||
filters: {
|
||||
handleArray(array) {
|
||||
if (array.length === 0) return "";
|
||||
return array.reduce((pre, cur) => {
|
||||
return pre + " " + cur;
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.el-tag + .el-tag {
|
||||
margin-left: 10px;
|
||||
}
|
||||
</style>
|
@ -149,8 +149,10 @@
|
||||
import { getDicts } from '@/api/system/dict/data.js'
|
||||
import request from "@/utils/request";
|
||||
import {parseTime} from "../../../../utils/ruoyi";
|
||||
import DictTag from "@/components/DictTagOld/index.vue";
|
||||
export default {
|
||||
name: "News",
|
||||
components:{DictTag},
|
||||
data() {
|
||||
return {
|
||||
inspection_new_type: [],
|
||||
|
@ -270,9 +270,11 @@
|
||||
import {fjPartners, listMallPartners,} from "../inspection/api/Partner";
|
||||
import { tijiaoshenhe, homeGoods, listInspectionGoods, getInspectionGoods, delInspectionGoods, addInspectionGoods, updateInspectionGoods } from "./api/inspectionGoods";
|
||||
import request from "@/utils/request";
|
||||
import DictTag from "@/components/DictTagOld/index.vue";
|
||||
|
||||
export default {
|
||||
name: "InspectionGoods",
|
||||
components:{DictTag},
|
||||
dicts: ['is_special', 'yes_no'],
|
||||
data() {
|
||||
|
||||
|
@ -281,9 +281,11 @@
|
||||
<script>
|
||||
import { listInsuranceOrder, getInsuranceOrder, delInsuranceOrder, addInsuranceOrder, updateInsuranceOrder } from "@/api/system/insuranceOrder";
|
||||
import request from "@/utils/request";
|
||||
import DictTag from "@/components/DictTagOld/index.vue";
|
||||
|
||||
export default {
|
||||
name: "InsuranceOrder",
|
||||
components:{DictTag},
|
||||
dicts: ['comment_star', 'order_status'],
|
||||
data() {
|
||||
return {
|
||||
|
@ -301,9 +301,11 @@
|
||||
<script>
|
||||
import { listCustomerInfo, getCustomerInfo, delCustomerInfo, addCustomerInfo, updateCustomerInfo } from "./api/customer";
|
||||
import request from "@/utils/request";
|
||||
import DictTag from '@/components/DictTagOld/index.vue'
|
||||
|
||||
export default {
|
||||
name: "CustomerInfo",
|
||||
components:{DictTag},
|
||||
dicts: ['sys_user_sex','jcz_role'],
|
||||
data() {
|
||||
return {
|
||||
|
@ -285,9 +285,11 @@
|
||||
import print from 'vue-print-nb'
|
||||
import moment from 'moment';
|
||||
import request from "@/utils/request";
|
||||
import DictTag from "@/components/DictTagOld/index.vue";
|
||||
|
||||
export default {
|
||||
name: "Info",
|
||||
components:{DictTag},
|
||||
dicts: ['customer_source','pay_type','car_status','car_use_nature','inspection_use_role'],
|
||||
directives: {
|
||||
print
|
||||
|
@ -192,8 +192,10 @@
|
||||
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "./api/ordermanagement";
|
||||
import moment from 'moment';
|
||||
import request from "@/utils/request";
|
||||
import DictTag from "@/components/DictTagOld/index.vue";
|
||||
export default {
|
||||
name: "Info",
|
||||
components:{DictTag},
|
||||
dicts: ['order_status', 'all_order_type'],
|
||||
data() {
|
||||
return {
|
||||
|
@ -278,10 +278,11 @@
|
||||
import {editSkuPrice,shangxiajia,categoryList,goodsDetail, shopInfo, tijiaoshenhe, homeGoods, listInspectionGoods, getInspectionGoods, delInspectionGoods, addInspectionGoods, updateInspectionGoods } from "./api/shopadministration.js";
|
||||
import request from "@/utils/request";
|
||||
import Editor from "@/components/Editor/index.vue";
|
||||
import DictTag from "@/components/DictTagOld/index.vue";
|
||||
|
||||
export default {
|
||||
name: "InspectionGoods",
|
||||
components: {Editor},
|
||||
components: {Editor,DictTag},
|
||||
dicts: ['is_special', 'yes_no'],
|
||||
data() {
|
||||
|
||||
|
@ -357,6 +357,7 @@
|
||||
import print from 'vue-print-nb'
|
||||
import moment from 'moment';
|
||||
import request from "@/utils/request";
|
||||
import DictTag from "@/components/DictTagOld/index.vue";
|
||||
|
||||
export default {
|
||||
name: "Info",
|
||||
@ -364,6 +365,7 @@
|
||||
directives: {
|
||||
print
|
||||
},
|
||||
components:{DictTag},
|
||||
data() {
|
||||
return {
|
||||
moneyData:{
|
||||
|
Loading…
Reference in New Issue
Block a user