1
This commit is contained in:
parent
f0da151f3c
commit
7a74264ff2
@ -1,88 +1,24 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<span>
|
||||||
<template v-for="(item, index) in options">
|
<template v-for="(dict, index) in this.getDictDatas2(type, value)">
|
||||||
<template v-if="values.includes(item.value)">
|
<!-- 默认样式 -->
|
||||||
<span
|
<span v-if="dict.colorType === 'default' || dict.colorType === '' || dict.colorType === undefined" :key="dict.value" :index="index"
|
||||||
v-if="item.listClass == 'default' || item.listClass == ''"
|
:class="dict.cssClass">{{ dict.label }}</span>
|
||||||
:key="item.value"
|
<!-- Tag 样式 -->
|
||||||
:index="index"
|
<el-tag v-else :disable-transitions="true" :key="dict.value" :index="index" :type="dict.colorType" :class="dict.cssClass">
|
||||||
:class="item.cssClass"
|
{{ dict.label }}
|
||||||
>{{ item.label + " " }}</span
|
</el-tag>
|
||||||
>
|
|
||||||
<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>
|
||||||
<template v-if="unmatch && showValue">
|
</span>
|
||||||
{{ unmatchArray | handleArray }}
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
name: "DictTag",
|
name: "DictTag",
|
||||||
props: {
|
props: {
|
||||||
options: {
|
type: String,
|
||||||
type: Array,
|
value: [Number, String, Boolean, 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>
|
</script>
|
||||||
<style scoped>
|
<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 { getDicts } from '@/api/system/dict/data.js'
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import {parseTime} from "../../../../utils/ruoyi";
|
import {parseTime} from "../../../../utils/ruoyi";
|
||||||
|
import DictTag from "@/components/DictTagOld/index.vue";
|
||||||
export default {
|
export default {
|
||||||
name: "News",
|
name: "News",
|
||||||
|
components:{DictTag},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
inspection_new_type: [],
|
inspection_new_type: [],
|
||||||
|
@ -270,9 +270,11 @@
|
|||||||
import {fjPartners, listMallPartners,} from "../inspection/api/Partner";
|
import {fjPartners, listMallPartners,} from "../inspection/api/Partner";
|
||||||
import { tijiaoshenhe, homeGoods, listInspectionGoods, getInspectionGoods, delInspectionGoods, addInspectionGoods, updateInspectionGoods } from "./api/inspectionGoods";
|
import { tijiaoshenhe, homeGoods, listInspectionGoods, getInspectionGoods, delInspectionGoods, addInspectionGoods, updateInspectionGoods } from "./api/inspectionGoods";
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
import DictTag from "@/components/DictTagOld/index.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "InspectionGoods",
|
name: "InspectionGoods",
|
||||||
|
components:{DictTag},
|
||||||
dicts: ['is_special', 'yes_no'],
|
dicts: ['is_special', 'yes_no'],
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
|
@ -281,9 +281,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { listInsuranceOrder, getInsuranceOrder, delInsuranceOrder, addInsuranceOrder, updateInsuranceOrder } from "@/api/system/insuranceOrder";
|
import { listInsuranceOrder, getInsuranceOrder, delInsuranceOrder, addInsuranceOrder, updateInsuranceOrder } from "@/api/system/insuranceOrder";
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
import DictTag from "@/components/DictTagOld/index.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "InsuranceOrder",
|
name: "InsuranceOrder",
|
||||||
|
components:{DictTag},
|
||||||
dicts: ['comment_star', 'order_status'],
|
dicts: ['comment_star', 'order_status'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -301,9 +301,11 @@
|
|||||||
<script>
|
<script>
|
||||||
import { listCustomerInfo, getCustomerInfo, delCustomerInfo, addCustomerInfo, updateCustomerInfo } from "./api/customer";
|
import { listCustomerInfo, getCustomerInfo, delCustomerInfo, addCustomerInfo, updateCustomerInfo } from "./api/customer";
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
import DictTag from '@/components/DictTagOld/index.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "CustomerInfo",
|
name: "CustomerInfo",
|
||||||
|
components:{DictTag},
|
||||||
dicts: ['sys_user_sex','jcz_role'],
|
dicts: ['sys_user_sex','jcz_role'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -285,9 +285,11 @@
|
|||||||
import print from 'vue-print-nb'
|
import print from 'vue-print-nb'
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
import DictTag from "@/components/DictTagOld/index.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Info",
|
name: "Info",
|
||||||
|
components:{DictTag},
|
||||||
dicts: ['customer_source','pay_type','car_status','car_use_nature','inspection_use_role'],
|
dicts: ['customer_source','pay_type','car_status','car_use_nature','inspection_use_role'],
|
||||||
directives: {
|
directives: {
|
||||||
print
|
print
|
||||||
|
@ -192,8 +192,10 @@
|
|||||||
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "./api/ordermanagement";
|
import { listInfo, getInfo, delInfo, addInfo, updateInfo } from "./api/ordermanagement";
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
import DictTag from "@/components/DictTagOld/index.vue";
|
||||||
export default {
|
export default {
|
||||||
name: "Info",
|
name: "Info",
|
||||||
|
components:{DictTag},
|
||||||
dicts: ['order_status', 'all_order_type'],
|
dicts: ['order_status', 'all_order_type'],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -278,10 +278,11 @@
|
|||||||
import {editSkuPrice,shangxiajia,categoryList,goodsDetail, shopInfo, tijiaoshenhe, homeGoods, listInspectionGoods, getInspectionGoods, delInspectionGoods, addInspectionGoods, updateInspectionGoods } from "./api/shopadministration.js";
|
import {editSkuPrice,shangxiajia,categoryList,goodsDetail, shopInfo, tijiaoshenhe, homeGoods, listInspectionGoods, getInspectionGoods, delInspectionGoods, addInspectionGoods, updateInspectionGoods } from "./api/shopadministration.js";
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
import Editor from "@/components/Editor/index.vue";
|
import Editor from "@/components/Editor/index.vue";
|
||||||
|
import DictTag from "@/components/DictTagOld/index.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "InspectionGoods",
|
name: "InspectionGoods",
|
||||||
components: {Editor},
|
components: {Editor,DictTag},
|
||||||
dicts: ['is_special', 'yes_no'],
|
dicts: ['is_special', 'yes_no'],
|
||||||
data() {
|
data() {
|
||||||
|
|
||||||
|
@ -357,6 +357,7 @@
|
|||||||
import print from 'vue-print-nb'
|
import print from 'vue-print-nb'
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
import request from "@/utils/request";
|
import request from "@/utils/request";
|
||||||
|
import DictTag from "@/components/DictTagOld/index.vue";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Info",
|
name: "Info",
|
||||||
@ -364,6 +365,7 @@
|
|||||||
directives: {
|
directives: {
|
||||||
print
|
print
|
||||||
},
|
},
|
||||||
|
components:{DictTag},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
moneyData:{
|
moneyData:{
|
||||||
|
Loading…
Reference in New Issue
Block a user