调整j-dict-select-tag组件:增加 :ignoreDisabled="true" 加上后停用的选项变为可选且提示“已停用”
调整JCheckbox组件:停用的选项 如果已被勾选 则可取消勾选 取消后变为不可选
This commit is contained in:
parent
4a2e668204
commit
fa204c8c01
|
@ -1,128 +1,130 @@
|
||||||
<template>
|
<template>
|
||||||
<a-checkbox-group v-bind="attrs" v-model:value="checkboxArray" :options="checkOptions" @change="handleChange">
|
<a-checkbox-group v-bind="attrs" v-model:value="checkboxArray" :options="checkOptions" @change="handleChange">
|
||||||
<template #label="{label, value}">
|
<template #label="{ label, value }">
|
||||||
<span :class="[useDicColor && getDicColor(value) ? 'colorText' : '']" :style="{ backgroundColor: `${getDicColor(value)}` }">{{ label }}</span>
|
<span :class="[useDicColor && getDicColor(value) ? 'colorText' : '']"
|
||||||
|
:style="{ backgroundColor: `${getDicColor(value)}` }">{{ label }}</span>
|
||||||
</template>
|
</template>
|
||||||
</a-checkbox-group>
|
</a-checkbox-group>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, computed, watch, watchEffect, ref, unref } from 'vue';
|
import { defineComponent, computed, watch, watchEffect, ref, unref } from 'vue';
|
||||||
import { propTypes } from '/@/utils/propTypes';
|
import { propTypes } from '/@/utils/propTypes';
|
||||||
import { useAttrs } from '/@/hooks/core/useAttrs';
|
import { useAttrs } from '/@/hooks/core/useAttrs';
|
||||||
import {getDictItems} from "@/api/common/api";
|
import { getDictItems } from "@/api/common/api";
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'JCheckbox',
|
name: 'JCheckbox',
|
||||||
props: {
|
props: {
|
||||||
value:propTypes.oneOfType([propTypes.string, propTypes.number]),
|
value: propTypes.oneOfType([propTypes.string, propTypes.number]),
|
||||||
dictCode: propTypes.string,
|
dictCode: propTypes.string,
|
||||||
useDicColor: propTypes.bool.def(false),
|
useDicColor: propTypes.bool.def(false),
|
||||||
options: {
|
options: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => [],
|
default: () => [],
|
||||||
},
|
|
||||||
},
|
},
|
||||||
emits: ['change', 'update:value'],
|
},
|
||||||
setup(props, { emit }) {
|
emits: ['change', 'update:value'],
|
||||||
const attrs = useAttrs();
|
setup(props, { emit }) {
|
||||||
//checkbox选项
|
const attrs = useAttrs();
|
||||||
const checkOptions = ref<any[]>([]);
|
//checkbox选项
|
||||||
//checkbox数值
|
const checkOptions = ref<any[]>([]);
|
||||||
const checkboxArray = ref<any[]>([]);
|
//checkbox数值
|
||||||
/**
|
const checkboxArray = ref<any[]>([]);
|
||||||
* 监听value
|
/**
|
||||||
*/
|
* 监听value
|
||||||
watchEffect(() => {
|
*/
|
||||||
//update-begin-author:taoyan date:2022-7-4 for:issues/I5E7YX AUTO在线表单进入功能测试之后一直卡在功能测试界面
|
watchEffect(() => {
|
||||||
let temp = props.value;
|
//update-begin-author:taoyan date:2022-7-4 for:issues/I5E7YX AUTO在线表单进入功能测试之后一直卡在功能测试界面
|
||||||
if(!temp && temp!==0){
|
let temp = props.value;
|
||||||
checkboxArray.value = []
|
if (!temp && temp !== 0) {
|
||||||
}else{
|
checkboxArray.value = []
|
||||||
temp = temp + '';
|
} else {
|
||||||
checkboxArray.value = temp.split(',')
|
temp = temp + '';
|
||||||
|
checkboxArray.value = temp.split(',')
|
||||||
|
}
|
||||||
|
//update-end-author:taoyan date:2022-7-4 for:issues/I5E7YX AUTO在线表单进入功能测试之后一直卡在功能测试界面
|
||||||
|
//update-begin-author:taoyan date:20220401 for: 调用表单的 resetFields不会清空当前信息,界面显示上一次的数据
|
||||||
|
if (props.value === '' || props.value === undefined) {
|
||||||
|
checkboxArray.value = [];
|
||||||
|
}
|
||||||
|
//update-end-author:taoyan date:20220401 for: 调用表单的 resetFields不会清空当前信息,界面显示上一次的数据
|
||||||
|
});
|
||||||
|
/**
|
||||||
|
* 监听字典code
|
||||||
|
*/
|
||||||
|
watchEffect(() => {
|
||||||
|
props && initOptions();
|
||||||
|
checkboxArray.value && loadDictOptions()
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化选项
|
||||||
|
*/
|
||||||
|
async function initOptions() {
|
||||||
|
//根据options, 初始化选项
|
||||||
|
if (props.options && props.options.length > 0) {
|
||||||
|
checkOptions.value = props.options;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//根据字典Code, 初始化选项
|
||||||
|
if (props.dictCode) {
|
||||||
|
loadDictOptions()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 根据字典code查询字典项
|
||||||
|
function loadDictOptions() {
|
||||||
|
//update-begin-author:taoyan date:2022-6-21 for: 字典数据请求前将参数编码处理,但是不能直接编码,因为可能之前已经编码过了
|
||||||
|
let temp = props.dictCode || '';
|
||||||
|
if (temp.indexOf(',') > 0 && temp.indexOf(' ') > 0) {
|
||||||
|
// 编码后 是不包含空格的
|
||||||
|
temp = encodeURI(temp);
|
||||||
|
}
|
||||||
|
//update-end-author:taoyan date:2022-6-21 for: 字典数据请求前将参数编码处理,但是不能直接编码,因为可能之前已经编码过了
|
||||||
|
getDictItems(temp).then((res) => {
|
||||||
|
if (res) {
|
||||||
|
checkOptions.value = res.map((item) => ({ value: item.value, label: item.text, disabled: item.status != 0 && !checkboxArray.value.includes(item.value), color: item.color }));
|
||||||
|
//console.info('res', dictOptions.value);
|
||||||
|
} else {
|
||||||
|
console.error('getDictItems error: : ', res);
|
||||||
|
checkOptions.value = [];
|
||||||
}
|
}
|
||||||
//update-end-author:taoyan date:2022-7-4 for:issues/I5E7YX AUTO在线表单进入功能测试之后一直卡在功能测试界面
|
|
||||||
//update-begin-author:taoyan date:20220401 for: 调用表单的 resetFields不会清空当前信息,界面显示上一次的数据
|
|
||||||
if (props.value === '' || props.value === undefined) {
|
|
||||||
checkboxArray.value = [];
|
|
||||||
}
|
|
||||||
//update-end-author:taoyan date:20220401 for: 调用表单的 resetFields不会清空当前信息,界面显示上一次的数据
|
|
||||||
});
|
|
||||||
/**
|
|
||||||
* 监听字典code
|
|
||||||
*/
|
|
||||||
watchEffect(() => {
|
|
||||||
props && initOptions();
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化选项
|
* change事件
|
||||||
*/
|
* @param $event
|
||||||
async function initOptions() {
|
*/
|
||||||
//根据options, 初始化选项
|
function handleChange($event) {
|
||||||
if (props.options && props.options.length > 0) {
|
emit('update:value', $event.join(','));
|
||||||
checkOptions.value = props.options;
|
emit('change', $event.join(','));
|
||||||
return;
|
}
|
||||||
}
|
const getDicColor = (value) => {
|
||||||
//根据字典Code, 初始化选项
|
if (props.useDicColor) {
|
||||||
if (props.dictCode) {
|
const findItem = checkOptions.value.find((item) => item.value == value);
|
||||||
loadDictOptions()
|
if (findItem) {
|
||||||
|
return findItem.color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
// 根据字典code查询字典项
|
};
|
||||||
function loadDictOptions() {
|
return { checkboxArray, checkOptions, attrs, handleChange, getDicColor };
|
||||||
//update-begin-author:taoyan date:2022-6-21 for: 字典数据请求前将参数编码处理,但是不能直接编码,因为可能之前已经编码过了
|
},
|
||||||
let temp = props.dictCode || '';
|
});
|
||||||
if (temp.indexOf(',') > 0 && temp.indexOf(' ') > 0) {
|
|
||||||
// 编码后 是不包含空格的
|
|
||||||
temp = encodeURI(temp);
|
|
||||||
}
|
|
||||||
//update-end-author:taoyan date:2022-6-21 for: 字典数据请求前将参数编码处理,但是不能直接编码,因为可能之前已经编码过了
|
|
||||||
getDictItems(temp).then((res) => {
|
|
||||||
if (res) {
|
|
||||||
checkOptions.value = res.map((item) => ({value: item.value, label: item.text, color: item.color}));
|
|
||||||
//console.info('res', dictOptions.value);
|
|
||||||
} else {
|
|
||||||
console.error('getDictItems error: : ', res);
|
|
||||||
checkOptions.value = [];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* change事件
|
|
||||||
* @param $event
|
|
||||||
*/
|
|
||||||
function handleChange($event) {
|
|
||||||
emit('update:value', $event.join(','));
|
|
||||||
emit('change', $event.join(','));
|
|
||||||
}
|
|
||||||
const getDicColor = (value) => {
|
|
||||||
if (props.useDicColor) {
|
|
||||||
const findItem = checkOptions.value.find((item) => item.value == value);
|
|
||||||
if (findItem) {
|
|
||||||
return findItem.color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
};
|
|
||||||
return { checkboxArray, checkOptions, attrs, handleChange, getDicColor };
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
// update-begin--author:liaozhiyang---date:20230110---for:【QQYUN-7799】字典组件(原生组件除外)加上颜色配置
|
// update-begin--author:liaozhiyang---date:20230110---for:【QQYUN-7799】字典组件(原生组件除外)加上颜色配置
|
||||||
.colorText {
|
.colorText {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
line-height: 20px;
|
line-height: 20px;
|
||||||
padding: 0 6px;
|
padding: 0 6px;
|
||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
background-color: red;
|
background-color: red;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
}
|
}
|
||||||
// update-begin--author:liaozhiyang---date:20230110---for:【QQYUN-7799】字典组件(原生组件除外)加上颜色配置
|
|
||||||
</style>
|
// update-begin--author:liaozhiyang---date:20230110---for:【QQYUN-7799】字典组件(原生组件除外)加上颜色配置</style>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<a-radio-group v-if="compType === CompTypeEnum.Radio" v-bind="attrs" v-model:value="state"
|
<a-radio-group v-if="compType === CompTypeEnum.Radio" v-bind="attrs" v-model:value="state"
|
||||||
@change="handleChangeRadio">
|
@change="handleChangeRadio">
|
||||||
<template v-for="item in dictOptions" :key="`${item.value}`">
|
<template v-for="item in dictOptions" :key="`${item.value}`">
|
||||||
<a-radio :value="item.value">
|
<a-radio :value="item.value" :disabled="item.disabled">
|
||||||
<span :class="[useDicColor && item.color ? 'colorText' : '']"
|
<span :class="[useDicColor && item.color ? 'colorText' : '']"
|
||||||
:style="{ backgroundColor: `${useDicColor && item.color}` }">
|
:style="{ backgroundColor: `${useDicColor && item.color}` }">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
<a-radio-group v-else-if="compType === CompTypeEnum.RadioButton" v-bind="attrs" v-model:value="state"
|
<a-radio-group v-else-if="compType === CompTypeEnum.RadioButton" v-bind="attrs" v-model:value="state"
|
||||||
buttonStyle="solid" @change="handleChangeRadio">
|
buttonStyle="solid" @change="handleChangeRadio">
|
||||||
<template v-for="item in dictOptions" :key="`${item.value}`">
|
<template v-for="item in dictOptions" :key="`${item.value}`">
|
||||||
<a-radio-button :value="item.value">
|
<a-radio-button :value="item.value" :disabled="item.disabled">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</a-radio-button>
|
</a-radio-button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -31,10 +31,10 @@
|
||||||
:getPopupContainer="getPopupContainer" :style="style" @change="handleChange">
|
:getPopupContainer="getPopupContainer" :style="style" @change="handleChange">
|
||||||
<a-select-option v-if="showChooseOption" :value="null">请选择…</a-select-option>
|
<a-select-option v-if="showChooseOption" :value="null">请选择…</a-select-option>
|
||||||
<template v-for="item in dictOptions" :key="`${item.value}`">
|
<template v-for="item in dictOptions" :key="`${item.value}`">
|
||||||
<a-select-option :value="item.value" :disabled="item.disabled">
|
<a-select-option :value="item.value" :disabled="!ignoreDisabled && item.disabled">
|
||||||
<span :class="[useDicColor && item.color ? 'colorText' : '']"
|
<span :class="[useDicColor && item.color ? 'colorText' : '']"
|
||||||
:style="{ backgroundColor: `${useDicColor && item.color}` }" :title="item.label">
|
:style="{ backgroundColor: `${useDicColor && item.color}` }" :title="item.label">
|
||||||
{{ item.label }}
|
{{ item.label }}<span style="color:rgb(255 39 39);">{{ ignoreDisabled && item.disabled ? '(已停用)' : '' }}</span>
|
||||||
</span>
|
</span>
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
</template>
|
</template>
|
||||||
|
@ -75,6 +75,7 @@ export default defineComponent({
|
||||||
required: false,
|
required: false,
|
||||||
},
|
},
|
||||||
style: propTypes.any,
|
style: propTypes.any,
|
||||||
|
ignoreDisabled: propTypes.bool.def(false),
|
||||||
},
|
},
|
||||||
emits: ['options-change', 'change', 'update:value'],
|
emits: ['options-change', 'change', 'update:value'],
|
||||||
setup(props, { emit, refs }) {
|
setup(props, { emit, refs }) {
|
||||||
|
@ -133,7 +134,7 @@ export default defineComponent({
|
||||||
prev.push({
|
prev.push({
|
||||||
label: next['text'] || next['label'],
|
label: next['text'] || next['label'],
|
||||||
value: stringToNumber ? +value : value,
|
value: stringToNumber ? +value : value,
|
||||||
disabled:next['status'] != 0,
|
disabled: next['status'] != 0,
|
||||||
color: next['color'],
|
color: next['color'],
|
||||||
...omit(next, ['text', 'value', 'color']),
|
...omit(next, ['text', 'value', 'color']),
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<a-form-item name="izEnabled">
|
<a-form-item name="izEnabled">
|
||||||
<template #label><span title="是否启用">是否启用</span></template>
|
<template #label><span title="是否启用">是否启用</span></template>
|
||||||
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="iz_enabled"
|
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="iz_enabled"
|
||||||
placeholder="请选择是否启用" allowClear />
|
:ignoreDisabled="true" placeholder="请选择是否启用" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
<a-form-item name="izEnabled">
|
<a-form-item name="izEnabled">
|
||||||
<template #label><span title="是否启用">是否启用</span></template>
|
<template #label><span title="是否启用">是否启用</span></template>
|
||||||
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="iz_enabled"
|
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="iz_enabled"
|
||||||
placeholder="请选择是否启用" allowClear />
|
:ignoreDisabled="true" placeholder="请选择是否启用" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<template #label><span title="服务类别">服务类别</span></template>
|
<template #label><span title="服务类别">服务类别</span></template>
|
||||||
<j-dict-select-tag type="list" v-model:value="queryParam.categoryId"
|
<j-dict-select-tag type="list" v-model:value="queryParam.categoryId"
|
||||||
:dictCode="`config_service_category,category_name,id,del_flag = 0 order by sort asc`"
|
:dictCode="`config_service_category,category_name,id,del_flag = 0 order by sort asc`"
|
||||||
placeholder="请选择服务类别" allow-clear />
|
:ignoreDisabled="true" placeholder="请选择服务类别" allow-clear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<template #label><span title="服务类型">服务类型</span></template>
|
<template #label><span title="服务类型">服务类型</span></template>
|
||||||
<j-dict-select-tag type="list" v-model:value="queryParam.typeId"
|
<j-dict-select-tag type="list" v-model:value="queryParam.typeId"
|
||||||
:dictCode="`config_service_type,type_name,id,del_flag = 0 order by sort asc`" placeholder="请选择服务类型"
|
:dictCode="`config_service_type,type_name,id,del_flag = 0 order by sort asc`" placeholder="请选择服务类型"
|
||||||
allowClear />
|
:ignoreDisabled="true" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<template v-if="toggleSearchStatus">
|
<template v-if="toggleSearchStatus">
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<a-form-item name="instructionTagId">
|
<a-form-item name="instructionTagId">
|
||||||
<template #label><span title="指令标签">指令标签</span></template>
|
<template #label><span title="指令标签">指令标签</span></template>
|
||||||
<j-dict-select-tag v-model:value="queryParam.instructionTagId" dictCode="instruction_tag"
|
<j-dict-select-tag v-model:value="queryParam.instructionTagId" dictCode="instruction_tag"
|
||||||
placeholder="请选择指令标签" allowClear />
|
:ignoreDisabled="true" placeholder="请选择指令标签" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
|
@ -51,34 +51,34 @@
|
||||||
<a-form-item name="izReimbursement">
|
<a-form-item name="izReimbursement">
|
||||||
<template #label><span title="医保报销">医保报销</span></template>
|
<template #label><span title="医保报销">医保报销</span></template>
|
||||||
<j-dict-select-tag type='list' v-model:value="queryParam.izReimbursement" dictCode="med_ins_reimb"
|
<j-dict-select-tag type='list' v-model:value="queryParam.izReimbursement" dictCode="med_ins_reimb"
|
||||||
placeholder="请选择医保报销" allowClear />
|
:ignoreDisabled="true" placeholder="请选择医保报销" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
<a-form-item name="izPreferential">
|
<a-form-item name="izPreferential">
|
||||||
<template #label><span title="机构优惠">机构优惠</span></template>
|
<template #label><span title="机构优惠">机构优惠</span></template>
|
||||||
<j-dict-select-tag type='list' v-model:value="queryParam.izPreferential"
|
<j-dict-select-tag type='list' v-model:value="queryParam.izPreferential"
|
||||||
dictCode="institutional_discount" placeholder="请选择机构优惠" allowClear />
|
dictCode="institutional_discount" :ignoreDisabled="true" placeholder="请选择机构优惠" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
<a-form-item name="chargingFrequency">
|
<a-form-item name="chargingFrequency">
|
||||||
<template #label><span title="收费频次">收费频次</span></template>
|
<template #label><span title="收费频次">收费频次</span></template>
|
||||||
<j-dict-select-tag type="list" v-model:value="queryParam.chargingFrequency" dictCode="billing_frequency"
|
<j-dict-select-tag type="list" v-model:value="queryParam.chargingFrequency" dictCode="billing_frequency" :ignoreDisabled="true"
|
||||||
placeholder="请选择收费频次" allowClear />
|
placeholder="请选择收费频次" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
<a-form-item name="cycleType">
|
<a-form-item name="cycleType">
|
||||||
<template #label><span title="周期类型">周期类型</span></template>
|
<template #label><span title="周期类型">周期类型</span></template>
|
||||||
<j-dict-select-tag type="list" v-model:value="queryParam.cycleType" dictCode="period_type"
|
<j-dict-select-tag type="list" v-model:value="queryParam.cycleType" dictCode="period_type" :ignoreDisabled="true"
|
||||||
placeholder="请选择周期类型" allowClear />
|
placeholder="请选择周期类型" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
<a-form-item name="izEnabled">
|
<a-form-item name="izEnabled">
|
||||||
<template #label><span title="是否启用">是否启用</span></template>
|
<template #label><span title="是否启用">是否启用</span></template>
|
||||||
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="iz_enabled"
|
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="iz_enabled" :ignoreDisabled="true"
|
||||||
placeholder="请选择是否启用" allowClear />
|
placeholder="请选择是否启用" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<template #label><span title="服务类别">服务类别</span></template>
|
<template #label><span title="服务类别">服务类别</span></template>
|
||||||
<j-dict-select-tag type='list' v-model:value="queryParam.categoryId"
|
<j-dict-select-tag type='list' v-model:value="queryParam.categoryId"
|
||||||
:dictCode="`config_service_category,category_name,id,del_flag = 0 order by sort asc`"
|
:dictCode="`config_service_category,category_name,id,del_flag = 0 order by sort asc`"
|
||||||
placeholder="请选择服务类别" allowClear />
|
:ignoreDisabled="true" placeholder="请选择服务类别" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
<a-form-item name="izEnabled">
|
<a-form-item name="izEnabled">
|
||||||
<template #label><span title="是否启用">是否启用</span></template>
|
<template #label><span title="是否启用">是否启用</span></template>
|
||||||
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="iz_enabled"
|
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="iz_enabled"
|
||||||
placeholder="请选择是否启用" allowClear />
|
:ignoreDisabled="true" placeholder="请选择是否启用" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -18,8 +18,7 @@
|
||||||
</a-menu-item>
|
</a-menu-item>
|
||||||
</a-menu>
|
</a-menu>
|
||||||
</template>
|
</template>
|
||||||
<a-button
|
<a-button>批量操作
|
||||||
>批量操作
|
|
||||||
<Icon icon="ant-design:down-outlined"></Icon>
|
<Icon icon="ant-design:down-outlined"></Icon>
|
||||||
</a-button>
|
</a-button>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
|
@ -38,160 +37,160 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="system-dict" setup>
|
<script lang="ts" name="system-dict" setup>
|
||||||
//ts语法
|
//ts语法
|
||||||
import { ref, computed, unref } from 'vue';
|
import { ref, computed, unref } from 'vue';
|
||||||
import { BasicTable, TableAction } from '/src/components/Table';
|
import { BasicTable, TableAction } from '/src/components/Table';
|
||||||
import { useDrawer } from '/src/components/Drawer';
|
import { useDrawer } from '/src/components/Drawer';
|
||||||
import { useModal } from '/src/components/Modal';
|
import { useModal } from '/src/components/Modal';
|
||||||
import DictItemList from './components/DictItemList.vue';
|
import DictItemList from './components/DictItemList.vue';
|
||||||
import DictModal from './components/DictModal.vue';
|
import DictModal from './components/DictModal.vue';
|
||||||
import DictRecycleBinModal from './components/DictRecycleBinModal.vue';
|
import DictRecycleBinModal from './components/DictRecycleBinModal.vue';
|
||||||
import { useMessage } from '/src/hooks/web/useMessage';
|
import { useMessage } from '/src/hooks/web/useMessage';
|
||||||
import { removeAuthCache, setAuthCache } from '/src/utils/auth';
|
import { removeAuthCache, setAuthCache } from '/src/utils/auth';
|
||||||
import { columns, searchFormSchema } from './dict.data';
|
import { columns, searchFormSchema } from './dict.data';
|
||||||
import { list, deleteDict, batchDeleteDict, getExportUrl, getImportUrl, refreshCache, queryAllDictItems } from './dict.api';
|
import { list, deleteDict, batchDeleteDict, getExportUrl, getImportUrl, refreshCache, queryAllDictItems } from './dict.api';
|
||||||
import { DB_DICT_DATA_KEY } from '/src/enums/cacheEnum';
|
import { DB_DICT_DATA_KEY } from '/src/enums/cacheEnum';
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
|
|
||||||
const { createMessage } = useMessage();
|
const { createMessage } = useMessage();
|
||||||
//字典model
|
//字典model
|
||||||
const [registerModal, { openModal }] = useModal();
|
const [registerModal, { openModal }] = useModal();
|
||||||
//字典配置drawer
|
//字典配置drawer
|
||||||
const [registerDrawer, { openDrawer }] = useDrawer();
|
const [registerDrawer, { openDrawer }] = useDrawer();
|
||||||
import { useListPage } from '/@/hooks/system/useListPage';
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
|
|
||||||
//回收站model
|
//回收站model
|
||||||
const [registerModal1, { openModal: openRecycleModal }] = useModal();
|
const [registerModal1, { openModal: openRecycleModal }] = useModal();
|
||||||
|
|
||||||
// 列表页面公共参数、方法
|
// 列表页面公共参数、方法
|
||||||
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
designScope: 'dict-template',
|
designScope: 'dict-template',
|
||||||
tableProps: {
|
tableProps: {
|
||||||
title: '数据字典',
|
title: '数据字典',
|
||||||
api: list,
|
api: list,
|
||||||
columns: columns,
|
columns: columns,
|
||||||
formConfig: {
|
formConfig: {
|
||||||
schemas: searchFormSchema,
|
schemas: searchFormSchema,
|
||||||
},
|
|
||||||
actionColumn: {
|
|
||||||
width: 240,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
//update-begin---author:wangshuai ---date:20220616 for:[issues/I5AMDD]导入/导出功能,操作后提示没有传递 export.url/import.url 参数------------
|
actionColumn: {
|
||||||
exportConfig: {
|
width: 240,
|
||||||
name: '数据字典列表',
|
|
||||||
url: getExportUrl,
|
|
||||||
},
|
},
|
||||||
importConfig: {
|
},
|
||||||
url: getImportUrl,
|
//update-begin---author:wangshuai ---date:20220616 for:[issues/I5AMDD]导入/导出功能,操作后提示没有传递 export.url/import.url 参数------------
|
||||||
},
|
exportConfig: {
|
||||||
//update-end---author:wangshuai ---date:20220616 for:[issues/I5AMDD]导入/导出功能,操作后提示没有传递 export.url/import.url 参数--------------
|
name: '数据字典列表',
|
||||||
|
url: getExportUrl,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
},
|
||||||
|
//update-end---author:wangshuai ---date:20220616 for:[issues/I5AMDD]导入/导出功能,操作后提示没有传递 export.url/import.url 参数--------------
|
||||||
|
});
|
||||||
|
|
||||||
|
//注册table数据
|
||||||
|
const [registerTable, { reload, updateTableDataRecord }, { rowSelection, selectedRowKeys, selectedRows }] = tableContext;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增事件
|
||||||
|
*/
|
||||||
|
function handleCreate() {
|
||||||
|
openModal(true, {
|
||||||
|
isUpdate: false,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
//注册table数据
|
/**
|
||||||
const [registerTable, { reload, updateTableDataRecord }, { rowSelection, selectedRowKeys, selectedRows }] = tableContext;
|
* 编辑事件
|
||||||
|
*/
|
||||||
/**
|
async function handleEdit(record: Recordable) {
|
||||||
* 新增事件
|
openModal(true, {
|
||||||
*/
|
record,
|
||||||
function handleCreate() {
|
isUpdate: true,
|
||||||
openModal(true, {
|
});
|
||||||
isUpdate: false,
|
}
|
||||||
});
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
async function handleDetail(record) {
|
||||||
|
openModal(true, {
|
||||||
|
record,
|
||||||
|
isUpdate: true,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除事件
|
||||||
|
*/
|
||||||
|
async function handleDelete(record) {
|
||||||
|
await deleteDict({ id: record.id }, reload);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 批量删除事件
|
||||||
|
*/
|
||||||
|
async function batchHandleDelete() {
|
||||||
|
await batchDeleteDict({ ids: selectedRowKeys.value }, () => {
|
||||||
|
// update-begin--author:liaozhiyang---date:20240701---for:【TV360X-1665】数据字典批量删除后选中也清空
|
||||||
|
reload();
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
selectedRows.value = [];
|
||||||
|
// update-end--author:liaozhiyang---date:20240701---for:【TV360X-1665】数据字典批量删除后选中也清空
|
||||||
|
});
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 成功回调
|
||||||
|
*/
|
||||||
|
function handleSuccess({ isUpdate, values }) {
|
||||||
|
if (isUpdate) {
|
||||||
|
updateTableDataRecord(values.id, values);
|
||||||
|
} else {
|
||||||
|
reload();
|
||||||
}
|
}
|
||||||
/**
|
}
|
||||||
* 编辑事件
|
/**
|
||||||
*/
|
* 刷新缓存
|
||||||
async function handleEdit(record: Recordable) {
|
*/
|
||||||
openModal(true, {
|
async function handlerRefreshCache() {
|
||||||
record,
|
const result = await refreshCache();
|
||||||
isUpdate: true,
|
if (result.success) {
|
||||||
});
|
const res = await queryAllDictItems();
|
||||||
|
removeAuthCache(DB_DICT_DATA_KEY);
|
||||||
|
// update-begin--author:liaozhiyang---date:20230908---for:【QQYUN-6417】生产环境字典慢的问题
|
||||||
|
const userStore = useUserStore();
|
||||||
|
userStore.setAllDictItems(res.result);
|
||||||
|
// update-end--author:liaozhiyang---date:20230908---for:【QQYUN-6417】生产环境字典慢的问题
|
||||||
|
createMessage.success('刷新缓存完成!');
|
||||||
|
} else {
|
||||||
|
createMessage.error('刷新缓存失败!');
|
||||||
}
|
}
|
||||||
/**
|
}
|
||||||
* 详情
|
/**
|
||||||
*/
|
* 字典配置
|
||||||
async function handleDetail(record) {
|
*/
|
||||||
openModal(true, {
|
function handleItem(record) {
|
||||||
record,
|
openDrawer(true, {
|
||||||
isUpdate: true,
|
id: record.id,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 删除事件
|
* 操作栏
|
||||||
*/
|
*/
|
||||||
async function handleDelete(record) {
|
function getTableAction(record) {
|
||||||
await deleteDict({ id: record.id }, reload);
|
return [
|
||||||
}
|
{
|
||||||
/**
|
label: '编辑',
|
||||||
* 批量删除事件
|
onClick: handleEdit.bind(null, record),
|
||||||
*/
|
},
|
||||||
async function batchHandleDelete() {
|
{
|
||||||
await batchDeleteDict({ ids: selectedRowKeys.value }, () => {
|
label: '字典配置',
|
||||||
// update-begin--author:liaozhiyang---date:20240701---for:【TV360X-1665】数据字典批量删除后选中也清空
|
onClick: handleItem.bind(null, record),
|
||||||
reload();
|
},
|
||||||
selectedRowKeys.value = [];
|
{
|
||||||
selectedRows.value = [];
|
label: '删除',
|
||||||
// update-end--author:liaozhiyang---date:20240701---for:【TV360X-1665】数据字典批量删除后选中也清空
|
popConfirm: {
|
||||||
});
|
title: '确定删除吗?',
|
||||||
}
|
confirm: handleDelete.bind(null, record),
|
||||||
/**
|
|
||||||
* 成功回调
|
|
||||||
*/
|
|
||||||
function handleSuccess({ isUpdate, values }) {
|
|
||||||
if (isUpdate) {
|
|
||||||
updateTableDataRecord(values.id, values);
|
|
||||||
} else {
|
|
||||||
reload();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 刷新缓存
|
|
||||||
*/
|
|
||||||
async function handlerRefreshCache() {
|
|
||||||
const result = await refreshCache();
|
|
||||||
if (result.success) {
|
|
||||||
const res = await queryAllDictItems();
|
|
||||||
removeAuthCache(DB_DICT_DATA_KEY);
|
|
||||||
// update-begin--author:liaozhiyang---date:20230908---for:【QQYUN-6417】生产环境字典慢的问题
|
|
||||||
const userStore = useUserStore();
|
|
||||||
userStore.setAllDictItems(res.result);
|
|
||||||
// update-end--author:liaozhiyang---date:20230908---for:【QQYUN-6417】生产环境字典慢的问题
|
|
||||||
createMessage.success('刷新缓存完成!');
|
|
||||||
} else {
|
|
||||||
createMessage.error('刷新缓存失败!');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 字典配置
|
|
||||||
*/
|
|
||||||
function handleItem(record) {
|
|
||||||
openDrawer(true, {
|
|
||||||
id: record.id,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* 操作栏
|
|
||||||
*/
|
|
||||||
function getTableAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '编辑',
|
|
||||||
onClick: handleEdit.bind(null, record),
|
|
||||||
},
|
},
|
||||||
{
|
},
|
||||||
label: '字典配置',
|
];
|
||||||
onClick: handleItem.bind(null, record),
|
}
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '删除',
|
|
||||||
popConfirm: {
|
|
||||||
title: '确定删除吗?',
|
|
||||||
confirm: handleDelete.bind(null, record),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped></style>
|
<style scoped></style>
|
||||||
|
|
Loading…
Reference in New Issue