Compare commits
3 Commits
eea3145365
...
4a2e668204
Author | SHA1 | Date |
---|---|---|
|
4a2e668204 | |
|
f99e7c1814 | |
|
9096722666 |
|
@ -1,21 +1,18 @@
|
||||||
<template>
|
<template>
|
||||||
<a-radio-group v-if="compType === CompTypeEnum.Radio" v-bind="attrs" v-model:value="state" @change="handleChangeRadio">
|
<a-radio-group v-if="compType === CompTypeEnum.Radio" v-bind="attrs" v-model:value="state"
|
||||||
|
@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">
|
||||||
<span :class="[useDicColor && item.color ? 'colorText' : '']" :style="{ backgroundColor: `${useDicColor && item.color}` }">
|
<span :class="[useDicColor && item.color ? 'colorText' : '']"
|
||||||
|
:style="{ backgroundColor: `${useDicColor && item.color}` }">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
</span>
|
</span>
|
||||||
</a-radio>
|
</a-radio>
|
||||||
</template>
|
</template>
|
||||||
</a-radio-group>
|
</a-radio-group>
|
||||||
|
|
||||||
<a-radio-group
|
<a-radio-group v-else-if="compType === CompTypeEnum.RadioButton" v-bind="attrs" v-model:value="state"
|
||||||
v-else-if="compType === CompTypeEnum.RadioButton"
|
buttonStyle="solid" @change="handleChangeRadio">
|
||||||
v-bind="attrs"
|
|
||||||
v-model:value="state"
|
|
||||||
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">
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
|
@ -30,24 +27,13 @@
|
||||||
<LoadingOutlined />
|
<LoadingOutlined />
|
||||||
</template>
|
</template>
|
||||||
</a-input>
|
</a-input>
|
||||||
<a-select
|
<a-select v-else :placeholder="placeholder" v-bind="attrs" v-model:value="state" :filterOption="handleFilterOption"
|
||||||
v-else
|
:getPopupContainer="getPopupContainer" :style="style" @change="handleChange">
|
||||||
:placeholder="placeholder"
|
|
||||||
v-bind="attrs"
|
|
||||||
v-model:value="state"
|
|
||||||
:filterOption="handleFilterOption"
|
|
||||||
: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">
|
<a-select-option :value="item.value" :disabled="item.disabled">
|
||||||
<span
|
<span :class="[useDicColor && item.color ? 'colorText' : '']"
|
||||||
: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>
|
</span>
|
||||||
</a-select-option>
|
</a-select-option>
|
||||||
|
@ -56,182 +42,184 @@
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { defineComponent, PropType, ref, reactive, watchEffect, computed, unref, watch, onMounted, nextTick } from 'vue';
|
import { defineComponent, PropType, ref, reactive, watchEffect, computed, unref, watch, onMounted, nextTick } 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 { initDictOptions } from '/@/utils/dict';
|
import { initDictOptions } from '/@/utils/dict';
|
||||||
import { get, omit } from 'lodash-es';
|
import { get, omit } from 'lodash-es';
|
||||||
import { useRuleFormItem } from '/@/hooks/component/useFormItem';
|
import { useRuleFormItem } from '/@/hooks/component/useFormItem';
|
||||||
import { CompTypeEnum } from '/@/enums/CompTypeEnum';
|
import { CompTypeEnum } from '/@/enums/CompTypeEnum';
|
||||||
import { LoadingOutlined } from '@ant-design/icons-vue';
|
import { LoadingOutlined } from '@ant-design/icons-vue';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
name: 'JDictSelectTag',
|
name: 'JDictSelectTag',
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
components: { LoadingOutlined },
|
components: { LoadingOutlined },
|
||||||
props: {
|
props: {
|
||||||
value: propTypes.oneOfType([propTypes.string, propTypes.number, propTypes.array]),
|
value: propTypes.oneOfType([propTypes.string, propTypes.number, propTypes.array]),
|
||||||
dictCode: propTypes.string,
|
dictCode: propTypes.string,
|
||||||
type: propTypes.string,
|
type: propTypes.string,
|
||||||
placeholder: propTypes.string,
|
placeholder: propTypes.string,
|
||||||
stringToNumber: propTypes.bool,
|
stringToNumber: propTypes.bool,
|
||||||
useDicColor: propTypes.bool.def(false),
|
useDicColor: propTypes.bool.def(false),
|
||||||
getPopupContainer: {
|
getPopupContainer: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: (node) => node?.parentNode,
|
default: (node) => node?.parentNode,
|
||||||
},
|
|
||||||
// 是否显示【请选择】选项
|
|
||||||
showChooseOption: propTypes.bool.def(true),
|
|
||||||
// 下拉项-online使用
|
|
||||||
options: {
|
|
||||||
type: Array,
|
|
||||||
default: [],
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
style: propTypes.any,
|
|
||||||
},
|
},
|
||||||
emits: ['options-change', 'change','update:value'],
|
// 是否显示【请选择】选项
|
||||||
setup(props, { emit, refs }) {
|
showChooseOption: propTypes.bool.def(true),
|
||||||
const dictOptions = ref<any[]>([]);
|
// 下拉项-online使用
|
||||||
const attrs = useAttrs();
|
options: {
|
||||||
const [state, , , formItemContext] = useRuleFormItem(props, 'value', 'change');
|
type: Array,
|
||||||
const getBindValue = Object.assign({}, unref(props), unref(attrs));
|
default: [],
|
||||||
// 是否正在加载回显数据
|
required: false,
|
||||||
const loadingEcho = ref<boolean>(false);
|
},
|
||||||
// 是否是首次加载回显,只有首次加载,才会显示 loading
|
style: propTypes.any,
|
||||||
let isFirstLoadEcho = true;
|
},
|
||||||
|
emits: ['options-change', 'change', 'update:value'],
|
||||||
|
setup(props, { emit, refs }) {
|
||||||
|
const dictOptions = ref<any[]>([]);
|
||||||
|
const attrs = useAttrs();
|
||||||
|
const [state, , , formItemContext] = useRuleFormItem(props, 'value', 'change');
|
||||||
|
const getBindValue = Object.assign({}, unref(props), unref(attrs));
|
||||||
|
// 是否正在加载回显数据
|
||||||
|
const loadingEcho = ref<boolean>(false);
|
||||||
|
// 是否是首次加载回显,只有首次加载,才会显示 loading
|
||||||
|
let isFirstLoadEcho = true;
|
||||||
|
|
||||||
//组件类型
|
//组件类型
|
||||||
const compType = computed(() => {
|
const compType = computed(() => {
|
||||||
return !props.type || props.type === 'list' ? 'select' : props.type;
|
return !props.type || props.type === 'list' ? 'select' : props.type;
|
||||||
});
|
});
|
||||||
/**
|
/**
|
||||||
* 监听字典code
|
* 监听字典code
|
||||||
*/
|
*/
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
if (props.dictCode) {
|
if (props.dictCode) {
|
||||||
|
loadingEcho.value = isFirstLoadEcho;
|
||||||
|
isFirstLoadEcho = false;
|
||||||
|
initDictData().finally(() => {
|
||||||
loadingEcho.value = isFirstLoadEcho;
|
loadingEcho.value = isFirstLoadEcho;
|
||||||
isFirstLoadEcho = false;
|
});
|
||||||
initDictData().finally(() => {
|
}
|
||||||
loadingEcho.value = isFirstLoadEcho;
|
//update-begin-author:taoyan date: 如果没有提供dictCode 可以走options的配置--
|
||||||
|
if (!props.dictCode) {
|
||||||
|
dictOptions.value = props.options;
|
||||||
|
}
|
||||||
|
//update-end-author:taoyan date: 如果没有提供dictCode 可以走options的配置--
|
||||||
|
});
|
||||||
|
|
||||||
|
//update-begin-author:taoyan date:20220404 for: 使用useRuleFormItem定义的value,会有一个问题,如果不是操作设置的值而是代码设置的控件值而不能触发change事件
|
||||||
|
// 此处添加空值的change事件,即当组件调用地代码设置value为''也能触发change事件
|
||||||
|
watch(
|
||||||
|
() => props.value,
|
||||||
|
() => {
|
||||||
|
if (props.value === '') {
|
||||||
|
emit('change', '');
|
||||||
|
nextTick(() => formItemContext.onFieldChange());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
//update-end-author:taoyan date:20220404 for: 使用useRuleFormItem定义的value,会有一个问题,如果不是操作设置的值而是代码设置的控件值而不能触发change事件
|
||||||
|
|
||||||
|
async function initDictData() {
|
||||||
|
let { dictCode, stringToNumber } = props;
|
||||||
|
//根据字典Code, 初始化字典数组
|
||||||
|
const dictData = await initDictOptions(dictCode);
|
||||||
|
dictOptions.value = dictData.reduce((prev, next) => {
|
||||||
|
if (next) {
|
||||||
|
console.log(next['status'] == 1)
|
||||||
|
const value = next['value'];
|
||||||
|
prev.push({
|
||||||
|
label: next['text'] || next['label'],
|
||||||
|
value: stringToNumber ? +value : value,
|
||||||
|
disabled:next['status'] != 0,
|
||||||
|
color: next['color'],
|
||||||
|
...omit(next, ['text', 'value', 'color']),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
//update-begin-author:taoyan date: 如果没有提供dictCode 可以走options的配置--
|
return prev;
|
||||||
if (!props.dictCode) {
|
}, []);
|
||||||
dictOptions.value = props.options;
|
}
|
||||||
|
|
||||||
|
function handleChange(e) {
|
||||||
|
const { mode } = unref<Recordable>(getBindValue);
|
||||||
|
let changeValue: any;
|
||||||
|
// 兼容多选模式
|
||||||
|
|
||||||
|
//update-begin---author:wangshuai ---date:20230216 for:[QQYUN-4290]公文发文:选择机关代字报错,是因为值改变触发了change事件三次,导致数据发生改变------------
|
||||||
|
//采用一个值,不然的话state值变换触发多个change
|
||||||
|
if (mode === 'multiple') {
|
||||||
|
changeValue = e?.target?.value ?? e;
|
||||||
|
// 过滤掉空值
|
||||||
|
if (changeValue == null || changeValue === '') {
|
||||||
|
changeValue = [];
|
||||||
}
|
}
|
||||||
//update-end-author:taoyan date: 如果没有提供dictCode 可以走options的配置--
|
if (Array.isArray(changeValue)) {
|
||||||
});
|
changeValue = changeValue.filter((item) => item != null && item !== '');
|
||||||
|
|
||||||
//update-begin-author:taoyan date:20220404 for: 使用useRuleFormItem定义的value,会有一个问题,如果不是操作设置的值而是代码设置的控件值而不能触发change事件
|
|
||||||
// 此处添加空值的change事件,即当组件调用地代码设置value为''也能触发change事件
|
|
||||||
watch(
|
|
||||||
() => props.value,
|
|
||||||
() => {
|
|
||||||
if (props.value === '') {
|
|
||||||
emit('change', '');
|
|
||||||
nextTick(() => formItemContext.onFieldChange());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
} else {
|
||||||
//update-end-author:taoyan date:20220404 for: 使用useRuleFormItem定义的value,会有一个问题,如果不是操作设置的值而是代码设置的控件值而不能触发change事件
|
changeValue = e?.target?.value ?? e;
|
||||||
|
|
||||||
async function initDictData() {
|
|
||||||
let { dictCode, stringToNumber } = props;
|
|
||||||
//根据字典Code, 初始化字典数组
|
|
||||||
const dictData = await initDictOptions(dictCode);
|
|
||||||
dictOptions.value = dictData.reduce((prev, next) => {
|
|
||||||
if (next) {
|
|
||||||
const value = next['value'];
|
|
||||||
prev.push({
|
|
||||||
label: next['text'] || next['label'],
|
|
||||||
value: stringToNumber ? +value : value,
|
|
||||||
color: next['color'],
|
|
||||||
...omit(next, ['text', 'value', 'color']),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return prev;
|
|
||||||
}, []);
|
|
||||||
}
|
}
|
||||||
|
state.value = changeValue;
|
||||||
|
|
||||||
function handleChange(e) {
|
//update-begin---author:wangshuai ---date:20230403 for:【issues/4507】JDictSelectTag组件使用时,浏览器给出警告提示:Expected Function, got Array------------
|
||||||
const { mode } = unref<Recordable>(getBindValue);
|
emit('update:value', changeValue)
|
||||||
let changeValue:any;
|
//update-end---author:wangshuai ---date:20230403 for:【issues/4507】JDictSelectTag组件使用时,浏览器给出警告提示:Expected Function, got Array述------------
|
||||||
// 兼容多选模式
|
//update-end---author:wangshuai ---date:20230216 for:[QQYUN-4290]公文发文:选择机关代字报错,是因为值改变触发了change事件三次,导致数据发生改变------------
|
||||||
|
|
||||||
//update-begin---author:wangshuai ---date:20230216 for:[QQYUN-4290]公文发文:选择机关代字报错,是因为值改变触发了change事件三次,导致数据发生改变------------
|
// nextTick(() => formItemContext.onFieldChange());
|
||||||
//采用一个值,不然的话state值变换触发多个change
|
}
|
||||||
if (mode === 'multiple') {
|
|
||||||
changeValue = e?.target?.value ?? e;
|
/** 单选radio的值变化事件 */
|
||||||
// 过滤掉空值
|
function handleChangeRadio(e) {
|
||||||
if (changeValue == null || changeValue === '') {
|
state.value = e?.target?.value ?? e;
|
||||||
changeValue = [];
|
//update-begin---author:wangshuai ---date:20230504 for:【issues/506】JDictSelectTag 组件 type="radio" 没有返回值------------
|
||||||
}
|
emit('update:value', e?.target?.value ?? e)
|
||||||
if (Array.isArray(changeValue)) {
|
//update-end---author:wangshuai ---date:20230504 for:【issues/506】JDictSelectTag 组件 type="radio" 没有返回值------------
|
||||||
changeValue = changeValue.filter((item) => item != null && item !== '');
|
}
|
||||||
}
|
|
||||||
} else {
|
/** 用于搜索下拉框中的内容 */
|
||||||
changeValue = e?.target?.value ?? e;
|
function handleFilterOption(input, option) {
|
||||||
|
// update-begin--author:liaozhiyang---date:20230914---for:【QQYUN-6514】 配置的时候,Y轴不能输入多个字段了,控制台报错
|
||||||
|
if (typeof option.children === 'function') {
|
||||||
|
// 在 label 中搜索
|
||||||
|
let labelIf = option.children()[0]?.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||||
|
if (labelIf) {
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
state.value = changeValue;
|
|
||||||
|
|
||||||
//update-begin---author:wangshuai ---date:20230403 for:【issues/4507】JDictSelectTag组件使用时,浏览器给出警告提示:Expected Function, got Array------------
|
|
||||||
emit('update:value',changeValue)
|
|
||||||
//update-end---author:wangshuai ---date:20230403 for:【issues/4507】JDictSelectTag组件使用时,浏览器给出警告提示:Expected Function, got Array述------------
|
|
||||||
//update-end---author:wangshuai ---date:20230216 for:[QQYUN-4290]公文发文:选择机关代字报错,是因为值改变触发了change事件三次,导致数据发生改变------------
|
|
||||||
|
|
||||||
// nextTick(() => formItemContext.onFieldChange());
|
|
||||||
}
|
}
|
||||||
|
// update-end--author:liaozhiyang---date:20230914---for:【QQYUN-6514】 配置的时候,Y轴不能输入多个字段了,控制台报错
|
||||||
|
// 在 value 中搜索
|
||||||
|
return (option.value || '').toString().toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
/** 单选radio的值变化事件 */
|
return {
|
||||||
function handleChangeRadio(e) {
|
state,
|
||||||
state.value = e?.target?.value ?? e;
|
compType,
|
||||||
//update-begin---author:wangshuai ---date:20230504 for:【issues/506】JDictSelectTag 组件 type="radio" 没有返回值------------
|
attrs,
|
||||||
emit('update:value',e?.target?.value ?? e)
|
loadingEcho,
|
||||||
//update-end---author:wangshuai ---date:20230504 for:【issues/506】JDictSelectTag 组件 type="radio" 没有返回值------------
|
getBindValue,
|
||||||
}
|
dictOptions,
|
||||||
|
CompTypeEnum,
|
||||||
/** 用于搜索下拉框中的内容 */
|
handleChange,
|
||||||
function handleFilterOption(input, option) {
|
handleChangeRadio,
|
||||||
// update-begin--author:liaozhiyang---date:20230914---for:【QQYUN-6514】 配置的时候,Y轴不能输入多个字段了,控制台报错
|
handleFilterOption,
|
||||||
if (typeof option.children === 'function') {
|
};
|
||||||
// 在 label 中搜索
|
},
|
||||||
let labelIf = option.children()[0]?.children.toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
});
|
||||||
if (labelIf) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// update-end--author:liaozhiyang---date:20230914---for:【QQYUN-6514】 配置的时候,Y轴不能输入多个字段了,控制台报错
|
|
||||||
// 在 value 中搜索
|
|
||||||
return (option.value || '').toString().toLowerCase().indexOf(input.toLowerCase()) >= 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
state,
|
|
||||||
compType,
|
|
||||||
attrs,
|
|
||||||
loadingEcho,
|
|
||||||
getBindValue,
|
|
||||||
dictOptions,
|
|
||||||
CompTypeEnum,
|
|
||||||
handleChange,
|
|
||||||
handleChangeRadio,
|
|
||||||
handleFilterOption,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
// 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>
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from "/@/hooks/web/useMessage";
|
||||||
|
|
||||||
|
const { createConfirm } = useMessage();
|
||||||
|
|
||||||
|
enum Api {
|
||||||
|
list = '/directiveTag/directiveTag/list',
|
||||||
|
save='/directiveTag/directiveTag/add',
|
||||||
|
edit='/directiveTag/directiveTag/edit',
|
||||||
|
deleteOne = '/directiveTag/directiveTag/delete',
|
||||||
|
deleteBatch = '/directiveTag/directiveTag/deleteBatch',
|
||||||
|
importExcel = '/directiveTag/directiveTag/importExcel',
|
||||||
|
exportXls = '/directiveTag/directiveTag/exportXls',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出api
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const getExportUrl = Api.exportXls;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导入api
|
||||||
|
*/
|
||||||
|
export const getImportUrl = Api.importExcel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列表接口
|
||||||
|
* @param params
|
||||||
|
*/
|
||||||
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除单个
|
||||||
|
* @param params
|
||||||
|
* @param handleSuccess
|
||||||
|
*/
|
||||||
|
export const deleteOne = (params,handleSuccess) => {
|
||||||
|
return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除
|
||||||
|
* @param params
|
||||||
|
* @param handleSuccess
|
||||||
|
*/
|
||||||
|
export const batchDelete = (params, handleSuccess) => {
|
||||||
|
createConfirm({
|
||||||
|
iconType: 'warning',
|
||||||
|
title: '确认删除',
|
||||||
|
content: '是否删除选中数据',
|
||||||
|
okText: '确认',
|
||||||
|
cancelText: '取消',
|
||||||
|
onOk: () => {
|
||||||
|
return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
|
||||||
|
handleSuccess();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存或者更新
|
||||||
|
* @param params
|
||||||
|
* @param isUpdate
|
||||||
|
*/
|
||||||
|
export const saveOrUpdate = (params, isUpdate) => {
|
||||||
|
let url = isUpdate ? Api.edit : Api.save;
|
||||||
|
return defHttp.post({ url: url, params }, { isTransformResponse: false });
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
import {BasicColumn} from '/@/components/Table';
|
||||||
|
import {FormSchema} from '/@/components/Table';
|
||||||
|
import { rules} from '/@/utils/helper/validator';
|
||||||
|
import { render } from '/@/utils/common/renderUtils';
|
||||||
|
import { getWeekMonthQuarterYear } from '/@/utils';
|
||||||
|
//列表数据
|
||||||
|
export const columns: BasicColumn[] = [
|
||||||
|
{
|
||||||
|
title: '标签名称',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'tagName'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '排序',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'sort'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '是否启用',
|
||||||
|
align: "center",
|
||||||
|
dataIndex: 'izEnabled_dictText'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
// 高级查询数据
|
||||||
|
export const superQuerySchema = {
|
||||||
|
tagName: {title: '标签名称',order: 0,view: 'text', type: 'string',},
|
||||||
|
sort: {title: '排序',order: 1,view: 'number', type: 'number',},
|
||||||
|
izEnabled: {title: '是否启用',order: 2,view: 'radio', type: 'string',dictCode: 'iz_enabled',},
|
||||||
|
};
|
|
@ -0,0 +1,278 @@
|
||||||
|
<template>
|
||||||
|
<div class="p-2">
|
||||||
|
<!--查询区域-->
|
||||||
|
<div class="jeecg-basic-table-form-container">
|
||||||
|
<a-form ref="formRef" @keyup.enter.native="searchQuery" :model="queryParam" :label-col="labelCol"
|
||||||
|
:wrapper-col="wrapperCol">
|
||||||
|
<a-row :gutter="24">
|
||||||
|
<a-col :lg="6">
|
||||||
|
<a-form-item name="tagName">
|
||||||
|
<template #label><span title="标签名称">标签名称</span></template>
|
||||||
|
<JInput v-model:value="queryParam.tagName" allowClear placeholder="请输入标签名称" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :lg="6">
|
||||||
|
<a-form-item name="izEnabled">
|
||||||
|
<template #label><span title="是否启用">是否启用</span></template>
|
||||||
|
<j-dict-select-tag type='list' v-model:value="queryParam.izEnabled" dictCode="iz_enabled"
|
||||||
|
placeholder="请选择是否启用" allowClear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :xl="6" :lg="7" :md="8" :sm="24">
|
||||||
|
<span style="float: left; overflow: hidden" class="table-page-search-submitButtons">
|
||||||
|
<a-col :lg="6">
|
||||||
|
<a-button type="primary" preIcon="ant-design:search-outlined" @click="searchQuery">查询</a-button>
|
||||||
|
<a-button type="primary" preIcon="ant-design:reload-outlined" @click="searchReset"
|
||||||
|
style="margin-left: 8px">重置</a-button>
|
||||||
|
<!-- <a @click="toggleSearchStatus = !toggleSearchStatus" style="margin-left: 8px">
|
||||||
|
{{ toggleSearchStatus ? '收起' : '展开' }}
|
||||||
|
<Icon :icon="toggleSearchStatus ? 'ant-design:up-outlined' : 'ant-design:down-outlined'" />
|
||||||
|
</a> -->
|
||||||
|
</a-col>
|
||||||
|
</span>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</div>
|
||||||
|
<!--引用表格-->
|
||||||
|
<BasicTable @register="registerTable" :rowSelection="rowSelection">
|
||||||
|
<!--插槽:table标题-->
|
||||||
|
<template #tableTitle>
|
||||||
|
<a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
|
||||||
|
<!-- <a-button type="primary" preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||||
|
<j-upload-button type="primary" preIcon="ant-design:import-outlined" @click="onImportXls">导入</j-upload-button> -->
|
||||||
|
<a-dropdown v-if="selectedRowKeys.length > 0">
|
||||||
|
<template #overlay>
|
||||||
|
<a-menu>
|
||||||
|
<a-menu-item key="1" @click="batchHandleDelete">
|
||||||
|
<Icon icon="ant-design:delete-outlined"></Icon>
|
||||||
|
删除
|
||||||
|
</a-menu-item>
|
||||||
|
</a-menu>
|
||||||
|
</template>
|
||||||
|
<a-button>批量操作
|
||||||
|
<Icon icon="mdi:chevron-down"></Icon>
|
||||||
|
</a-button>
|
||||||
|
</a-dropdown>
|
||||||
|
<!-- 高级查询 -->
|
||||||
|
<!-- <super-query :config="superQueryConfig" @search="handleSuperQuery" /> -->
|
||||||
|
</template>
|
||||||
|
<!--操作栏-->
|
||||||
|
<template #action="{ record }">
|
||||||
|
<TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
|
||||||
|
</template>
|
||||||
|
<template v-slot:bodyCell="{ column, record, index, text }">
|
||||||
|
</template>
|
||||||
|
</BasicTable>
|
||||||
|
<!-- 表单区域 -->
|
||||||
|
<DirectiveTagModal ref="registerModal" @success="handleSuccess"></DirectiveTagModal>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" name="directiveTag-directiveTag" setup>
|
||||||
|
import { ref, reactive } from 'vue';
|
||||||
|
import { BasicTable, useTable, TableAction } from '/@/components/Table';
|
||||||
|
import { useListPage } from '/@/hooks/system/useListPage';
|
||||||
|
import { columns, superQuerySchema } from './DirectiveTag.data';
|
||||||
|
import { list, deleteOne, batchDelete, getImportUrl, getExportUrl } from './DirectiveTag.api';
|
||||||
|
import { downloadFile } from '/@/utils/common/renderUtils';
|
||||||
|
import DirectiveTagModal from './components/DirectiveTagModal.vue'
|
||||||
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
|
import JSelectMultiple from '/@/components/Form/src/jeecg/components/JSelectMultiple.vue';
|
||||||
|
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
|
||||||
|
|
||||||
|
const formRef = ref();
|
||||||
|
const queryParam = reactive<any>({});
|
||||||
|
const toggleSearchStatus = ref<boolean>(false);
|
||||||
|
const registerModal = ref();
|
||||||
|
const userStore = useUserStore();
|
||||||
|
//注册table数据
|
||||||
|
const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
|
tableProps: {
|
||||||
|
title: '指令标签',
|
||||||
|
api: list,
|
||||||
|
columns,
|
||||||
|
canResize: false,
|
||||||
|
useSearchForm: false,
|
||||||
|
pagination: {
|
||||||
|
current: 1,
|
||||||
|
pageSize: 50,
|
||||||
|
pageSizeOptions: ['50', '70', '100'],
|
||||||
|
},
|
||||||
|
actionColumn: {
|
||||||
|
width: 160,
|
||||||
|
fixed: 'right',
|
||||||
|
},
|
||||||
|
beforeFetch: async (params) => {
|
||||||
|
params.column = 'sort'
|
||||||
|
params.order = 'asc'
|
||||||
|
return Object.assign(params, queryParam);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
exportConfig: {
|
||||||
|
name: "指令标签",
|
||||||
|
url: getExportUrl,
|
||||||
|
params: queryParam,
|
||||||
|
},
|
||||||
|
importConfig: {
|
||||||
|
url: getImportUrl,
|
||||||
|
success: handleSuccess
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const [registerTable, { reload, collapseAll, updateTableDataRecord, findTableDataRecord, getDataSource }, { rowSelection, selectedRowKeys }] = tableContext;
|
||||||
|
const labelCol = reactive({
|
||||||
|
xs: 24,
|
||||||
|
sm: 4,
|
||||||
|
xl: 8,
|
||||||
|
xxl: 8
|
||||||
|
});
|
||||||
|
const wrapperCol = reactive({
|
||||||
|
xs: 24,
|
||||||
|
sm: 20,
|
||||||
|
xl: 16,
|
||||||
|
xxl: 16
|
||||||
|
});
|
||||||
|
|
||||||
|
// 高级查询配置
|
||||||
|
const superQueryConfig = reactive(superQuerySchema);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高级查询事件
|
||||||
|
*/
|
||||||
|
function handleSuperQuery(params) {
|
||||||
|
Object.keys(params).map((k) => {
|
||||||
|
queryParam[k] = params[k];
|
||||||
|
});
|
||||||
|
searchQuery();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增事件
|
||||||
|
*/
|
||||||
|
function handleAdd() {
|
||||||
|
registerModal.value.disableSubmit = false;
|
||||||
|
registerModal.value.add();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑事件
|
||||||
|
*/
|
||||||
|
function handleEdit(record: Recordable) {
|
||||||
|
registerModal.value.disableSubmit = false;
|
||||||
|
registerModal.value.edit(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 详情
|
||||||
|
*/
|
||||||
|
function handleDetail(record: Recordable) {
|
||||||
|
registerModal.value.disableSubmit = true;
|
||||||
|
registerModal.value.edit(record);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除事件
|
||||||
|
*/
|
||||||
|
async function handleDelete(record) {
|
||||||
|
await deleteOne({ id: record.id }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除事件
|
||||||
|
*/
|
||||||
|
async function batchHandleDelete() {
|
||||||
|
await batchDelete({ ids: selectedRowKeys.value }, handleSuccess);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 成功回调
|
||||||
|
*/
|
||||||
|
function handleSuccess() {
|
||||||
|
(selectedRowKeys.value = []) && reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作栏
|
||||||
|
*/
|
||||||
|
function getTableAction(record) {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '编辑',
|
||||||
|
onClick: handleEdit.bind(null, record)
|
||||||
|
}, {
|
||||||
|
label: '详情',
|
||||||
|
onClick: handleDetail.bind(null, record),
|
||||||
|
}, {
|
||||||
|
label: '删除',
|
||||||
|
popConfirm: {
|
||||||
|
title: '是否确认删除',
|
||||||
|
confirm: handleDelete.bind(null, record),
|
||||||
|
placement: 'topLeft',
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉操作栏
|
||||||
|
*/
|
||||||
|
function getDropDownAction(record) {
|
||||||
|
return [
|
||||||
|
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询
|
||||||
|
*/
|
||||||
|
function searchQuery() {
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置
|
||||||
|
*/
|
||||||
|
function searchReset() {
|
||||||
|
formRef.value.resetFields();
|
||||||
|
selectedRowKeys.value = [];
|
||||||
|
//刷新数据
|
||||||
|
reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.jeecg-basic-table-form-container {
|
||||||
|
padding: 0;
|
||||||
|
|
||||||
|
.table-page-search-submitButtons {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 24px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.query-group-cust {
|
||||||
|
min-width: 100px !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.query-group-split-cust {
|
||||||
|
width: 30px;
|
||||||
|
display: inline-block;
|
||||||
|
text-align: center
|
||||||
|
}
|
||||||
|
|
||||||
|
.ant-form-item:not(.ant-form-item-with-help) {
|
||||||
|
margin-bottom: 16px;
|
||||||
|
height: 32px;
|
||||||
|
}
|
||||||
|
|
||||||
|
:deep(.ant-picker),
|
||||||
|
:deep(.ant-input-number) {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,161 @@
|
||||||
|
<template>
|
||||||
|
<a-spin :spinning="confirmLoading">
|
||||||
|
<JFormContainer :disabled="disabled">
|
||||||
|
<template #detail>
|
||||||
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol" name="DirectiveTagForm">
|
||||||
|
<a-row>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="标签名称" v-bind="validateInfos.tagName" id="DirectiveTagForm-tagName" name="tagName">
|
||||||
|
<a-input v-model:value="formData.tagName" placeholder="请输入标签名称" allow-clear ></a-input>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="排序" v-bind="validateInfos.sort" id="DirectiveTagForm-sort" name="sort">
|
||||||
|
<a-input-number v-model:value="formData.sort" placeholder="请输入排序" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="24">
|
||||||
|
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="DirectiveTagForm-izEnabled" name="izEnabled">
|
||||||
|
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled" placeholder="请选择是否启用" allow-clear />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
</a-row>
|
||||||
|
</a-form>
|
||||||
|
</template>
|
||||||
|
</JFormContainer>
|
||||||
|
</a-spin>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted } from 'vue';
|
||||||
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
|
import { getValueType } from '/@/utils';
|
||||||
|
import { saveOrUpdate } from '../DirectiveTag.api';
|
||||||
|
import { Form } from 'ant-design-vue';
|
||||||
|
import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
|
||||||
|
const props = defineProps({
|
||||||
|
formDisabled: { type: Boolean, default: false },
|
||||||
|
formData: { type: Object, default: () => ({})},
|
||||||
|
formBpm: { type: Boolean, default: true }
|
||||||
|
});
|
||||||
|
const formRef = ref();
|
||||||
|
const useForm = Form.useForm;
|
||||||
|
const emit = defineEmits(['register', 'ok']);
|
||||||
|
const formData = reactive<Record<string, any>>({
|
||||||
|
id: '',
|
||||||
|
tagName: '',
|
||||||
|
sort: 99,
|
||||||
|
izEnabled: '0',
|
||||||
|
});
|
||||||
|
const { createMessage } = useMessage();
|
||||||
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
||||||
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||||
|
const confirmLoading = ref<boolean>(false);
|
||||||
|
//表单验证
|
||||||
|
const validatorRules = reactive({
|
||||||
|
tagName: [{ required: true, message: '请输入标签名称!'},],
|
||||||
|
sort: [{ required: true, message: '请输入排序!'}, { pattern: /^\d+$/, message: '请输入正整数!'},],
|
||||||
|
izEnabled: [{ required: true, message: '请选择是否启用!'},],
|
||||||
|
});
|
||||||
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||||
|
|
||||||
|
// 表单禁用
|
||||||
|
const disabled = computed(()=>{
|
||||||
|
if(props.formBpm === true){
|
||||||
|
if(props.formData.disabled === false){
|
||||||
|
return false;
|
||||||
|
}else{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return props.formDisabled;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
function add() {
|
||||||
|
edit({});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
*/
|
||||||
|
function edit(record) {
|
||||||
|
nextTick(() => {
|
||||||
|
resetFields();
|
||||||
|
const tmpData = {};
|
||||||
|
Object.keys(formData).forEach((key) => {
|
||||||
|
if(record.hasOwnProperty(key)){
|
||||||
|
tmpData[key] = record[key]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
//赋值
|
||||||
|
Object.assign(formData, tmpData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 提交数据
|
||||||
|
*/
|
||||||
|
async function submitForm() {
|
||||||
|
try {
|
||||||
|
// 触发表单验证
|
||||||
|
await validate();
|
||||||
|
} catch ({ errorFields }) {
|
||||||
|
if (errorFields) {
|
||||||
|
const firstField = errorFields[0];
|
||||||
|
if (firstField) {
|
||||||
|
formRef.value.scrollToField(firstField.name, { behavior: 'smooth', block: 'center' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Promise.reject(errorFields);
|
||||||
|
}
|
||||||
|
confirmLoading.value = true;
|
||||||
|
const isUpdate = ref<boolean>(false);
|
||||||
|
//时间格式化
|
||||||
|
let model = formData;
|
||||||
|
if (model.id) {
|
||||||
|
isUpdate.value = true;
|
||||||
|
}
|
||||||
|
//循环数据
|
||||||
|
for (let data in model) {
|
||||||
|
//如果该数据是数组并且是字符串类型
|
||||||
|
if (model[data] instanceof Array) {
|
||||||
|
let valueType = getValueType(formRef.value.getProps, data);
|
||||||
|
//如果是字符串类型的需要变成以逗号分割的字符串
|
||||||
|
if (valueType === 'string') {
|
||||||
|
model[data] = model[data].join(',');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await saveOrUpdate(model, isUpdate.value)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.success) {
|
||||||
|
createMessage.success(res.message);
|
||||||
|
emit('ok');
|
||||||
|
} else {
|
||||||
|
createMessage.warning(res.message);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
confirmLoading.value = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
submitForm,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less" scoped>
|
||||||
|
.antd-modal-form {
|
||||||
|
padding: 14px;
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,77 @@
|
||||||
|
<template>
|
||||||
|
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭">
|
||||||
|
<DirectiveTagForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></DirectiveTagForm>
|
||||||
|
</j-modal>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, nextTick, defineExpose } from 'vue';
|
||||||
|
import DirectiveTagForm from './DirectiveTagForm.vue'
|
||||||
|
import JModal from '/@/components/Modal/src/JModal/JModal.vue';
|
||||||
|
|
||||||
|
const title = ref<string>('');
|
||||||
|
const width = ref<number>(800);
|
||||||
|
const visible = ref<boolean>(false);
|
||||||
|
const disableSubmit = ref<boolean>(false);
|
||||||
|
const registerForm = ref();
|
||||||
|
const emit = defineEmits(['register', 'success']);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增
|
||||||
|
*/
|
||||||
|
function add() {
|
||||||
|
title.value = '新增';
|
||||||
|
visible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.add();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编辑
|
||||||
|
* @param record
|
||||||
|
*/
|
||||||
|
function edit(record) {
|
||||||
|
title.value = disableSubmit.value ? '详情' : '编辑';
|
||||||
|
visible.value = true;
|
||||||
|
nextTick(() => {
|
||||||
|
registerForm.value.edit(record);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 确定按钮点击事件
|
||||||
|
*/
|
||||||
|
function handleOk() {
|
||||||
|
registerForm.value.submitForm();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* form保存回调事件
|
||||||
|
*/
|
||||||
|
function submitCallback() {
|
||||||
|
handleCancel();
|
||||||
|
emit('success');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取消按钮回调事件
|
||||||
|
*/
|
||||||
|
function handleCancel() {
|
||||||
|
visible.value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
add,
|
||||||
|
edit,
|
||||||
|
disableSubmit,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="less">
|
||||||
|
/**隐藏样式-modal确定按钮 */
|
||||||
|
.jee-hidden {
|
||||||
|
display: none !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<style lang="less" scoped></style>
|
|
@ -95,7 +95,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
canResize: false,
|
canResize: false,
|
||||||
useSearchForm: false,
|
useSearchForm: false,
|
||||||
actionColumn: {
|
actionColumn: {
|
||||||
width: 120,
|
width: 160,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
},
|
},
|
||||||
beforeFetch: async (params) => {
|
beforeFetch: async (params) => {
|
||||||
|
@ -195,6 +195,18 @@ function getTableAction(record) {
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
onClick: handleEdit.bind(null, record)
|
onClick: handleEdit.bind(null, record)
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: '详情',
|
||||||
|
onClick: handleDetail.bind(null, record),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '删除',
|
||||||
|
popConfirm: {
|
||||||
|
title: '是否确认删除',
|
||||||
|
confirm: handleDelete.bind(null, record),
|
||||||
|
placement: 'topLeft',
|
||||||
|
}
|
||||||
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -203,17 +215,7 @@ function getTableAction(record) {
|
||||||
*/
|
*/
|
||||||
function getDropDownAction(record) {
|
function getDropDownAction(record) {
|
||||||
return [
|
return [
|
||||||
{
|
|
||||||
label: '详情',
|
|
||||||
onClick: handleDetail.bind(null, record),
|
|
||||||
}, {
|
|
||||||
label: '删除',
|
|
||||||
popConfirm: {
|
|
||||||
title: '是否确认删除',
|
|
||||||
confirm: handleDelete.bind(null, record),
|
|
||||||
placement: 'topLeft',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ const confirmLoading = ref<boolean>(false);
|
||||||
//表单验证
|
//表单验证
|
||||||
const validatorRules = reactive({
|
const validatorRules = reactive({
|
||||||
categoryName: [{ required: true, message: '请输入服务类别名称!' },],
|
categoryName: [{ required: true, message: '请输入服务类别名称!' },],
|
||||||
sort: [{ required: true, message: '请输入排序!' }, { pattern: /^-?\d+$/, message: '请输入整数!' },],
|
sort: [{ required: true, message: '请输入排序!'}, { pattern: /^\d+$/, message: '请输入正整数!'},],
|
||||||
izEnabled: [{ required: true, message: '请选择是否启用!' },],
|
izEnabled: [{ required: true, message: '请选择是否启用!' },],
|
||||||
});
|
});
|
||||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||||
|
|
|
@ -26,7 +26,7 @@ export const columns: BasicColumn[] = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '指令标签',
|
title: '分类标签',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
dataIndex: 'instructionTagId_dictText',
|
dataIndex: 'instructionTagId_dictText',
|
||||||
width: 100,
|
width: 100,
|
||||||
|
@ -133,9 +133,9 @@ export const columns: BasicColumn[] = [
|
||||||
|
|
||||||
// 高级查询数据
|
// 高级查询数据
|
||||||
export const superQuerySchema = {
|
export const superQuerySchema = {
|
||||||
categoryId: { title: '服务类别id', order: 0, view: 'list', type: 'string', dictCode: '' },
|
categoryId: { title: '服务类别', order: 0, view: 'list', type: 'string', dictCode: '' },
|
||||||
typeId: { title: '服务类型id', order: 1, view: 'list', type: 'string', dictCode: '' },
|
typeId: { title: '服务类型', order: 1, view: 'list', type: 'string', dictCode: '' },
|
||||||
instructionTagId: { title: '指令标签id', order: 2, view: 'list', type: 'string', dictCode: 'instruction_tag' },
|
instructionTagId: { title: '分类标签', order: 2, view: 'list', type: 'string', dictCode: 'instruction_tag' },
|
||||||
directiveName: { title: '服务指令名称', order: 3, view: 'text', type: 'string' },
|
directiveName: { title: '服务指令名称', order: 3, view: 'text', type: 'string' },
|
||||||
tollPrice: { title: '收费价格', order: 4, view: 'number', type: 'number' },
|
tollPrice: { title: '收费价格', order: 4, view: 'number', type: 'number' },
|
||||||
comPrice: { title: '提成价格', order: 5, view: 'number', type: 'number' },
|
comPrice: { title: '提成价格', order: 5, view: 'number', type: 'number' },
|
||||||
|
|
|
@ -9,30 +9,30 @@
|
||||||
<a-form-item name="categoryId">
|
<a-form-item name="categoryId">
|
||||||
<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 and iz_enabled = 0`"
|
:dictCode="`config_service_category,category_name,id,del_flag = 0 order by sort asc`"
|
||||||
placeholder="请选择服务类别" allow-clear />
|
placeholder="请选择服务类别" allow-clear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
<a-form-item name="typeId">
|
<a-form-item name="typeId">
|
||||||
<template #label><span title="服务类型id">服务类型</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 and iz_enabled = 0`" placeholder="请选择服务类型"
|
:dictCode="`config_service_type,type_name,id,del_flag = 0 order by sort asc`" placeholder="请选择服务类型"
|
||||||
allowClear />
|
allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<template v-if="toggleSearchStatus">
|
<template v-if="toggleSearchStatus">
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
<a-form-item name="instructionTagId">
|
<a-form-item name="instructionTagId">
|
||||||
<template #label><span title="指令标签id">指令标签</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 />
|
placeholder="请选择指令标签" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :lg="6">
|
<a-col :lg="6">
|
||||||
<a-form-item name="directiveName">
|
<a-form-item name="directiveName">
|
||||||
<template #label><span title="服务指令名称">服务指令</span></template>
|
<template #label><span title="服务指令">服务指令</span></template>
|
||||||
<JInput v-model:value="queryParam.directiveName" placeholder="请输入服务指令名称" />
|
<JInput v-model:value="queryParam.directiveName" placeholder="请输入服务指令名称" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<!-- <a-col :lg="6">
|
<!-- <a-col :lg="6">
|
||||||
|
@ -79,7 +79,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="请选择是否启用" />
|
placeholder="请选择是否启用" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
</template>
|
</template>
|
||||||
|
@ -104,11 +104,13 @@
|
||||||
<!--插槽:table标题-->
|
<!--插槽:table标题-->
|
||||||
<template #tableTitle>
|
<template #tableTitle>
|
||||||
<a-button type="primary" v-auth="'serviceDirective:config_service_directive:add'" @click="handleCategory"
|
<a-button type="primary" v-auth="'serviceDirective:config_service_directive:add'" @click="handleCategory"
|
||||||
preIcon="ant-design:plus-outlined"> 服务类别</a-button>
|
preIcon="tabler:settings">配置服务类别</a-button>
|
||||||
<a-button type="primary" v-auth="'serviceDirective:config_service_directive:add'" @click="handleType"
|
<a-button type="primary" v-auth="'serviceDirective:config_service_directive:add'" @click="handleType"
|
||||||
preIcon="ant-design:plus-outlined"> 服务类型</a-button>
|
preIcon="tabler:settings">配置服务类型</a-button>
|
||||||
|
<a-button type="primary" v-auth="'serviceDirective:config_service_directive:add'" @click="handleTag"
|
||||||
|
preIcon="tabler:settings">配置指令标签</a-button>
|
||||||
<a-button type="primary" v-auth="'serviceDirective:config_service_directive:add'" @click="handleAdd"
|
<a-button type="primary" v-auth="'serviceDirective:config_service_directive:add'" @click="handleAdd"
|
||||||
preIcon="ant-design:plus-outlined"> 新增</a-button>
|
preIcon="ant-design:plus-outlined">新增</a-button>
|
||||||
<!-- <a-button type="primary" v-auth="'serviceDirective:config_service_directive:exportXls'"
|
<!-- <a-button type="primary" v-auth="'serviceDirective:config_service_directive:exportXls'"
|
||||||
preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
preIcon="ant-design:export-outlined" @click="onExportXls"> 导出</a-button>
|
||||||
<j-upload-button type="primary" v-auth="'serviceDirective:config_service_directive:importExcel'"
|
<j-upload-button type="primary" v-auth="'serviceDirective:config_service_directive:importExcel'"
|
||||||
|
@ -167,6 +169,14 @@
|
||||||
</template>
|
</template>
|
||||||
<ConfigServiceTypeList v-if="typeOpen"></ConfigServiceTypeList>
|
<ConfigServiceTypeList v-if="typeOpen"></ConfigServiceTypeList>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
|
|
||||||
|
<!-- 指令标签 -->
|
||||||
|
<a-drawer title="指令标签" width="60vw" :open="tagOpen" @close="onTagClose">
|
||||||
|
<template #footer>
|
||||||
|
<a-button type="primary" @click="onTagClose" style="float: right;">关闭</a-button>
|
||||||
|
</template>
|
||||||
|
<DirectiveTagList v-if="tagOpen"></DirectiveTagList>
|
||||||
|
</a-drawer>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" name="serviceDirective-configServiceDirective" setup>
|
<script lang="ts" name="serviceDirective-configServiceDirective" setup>
|
||||||
|
@ -180,10 +190,11 @@ import ConfigServiceDirectiveModal from './components/ConfigServiceDirectiveModa
|
||||||
import { useUserStore } from '/@/store/modules/user';
|
import { useUserStore } from '/@/store/modules/user';
|
||||||
import JRangeNumber from "/@/components/Form/src/jeecg/components/JRangeNumber.vue";
|
import JRangeNumber from "/@/components/Form/src/jeecg/components/JRangeNumber.vue";
|
||||||
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
|
import JInput from "/@/components/Form/src/jeecg/components/JInput.vue";
|
||||||
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
import { cloneDeep } from "lodash-es";
|
import { cloneDeep } from "lodash-es";
|
||||||
import ConfigServiceCategoryList from '../serviceCategory/ConfigServiceCategoryList.vue';
|
import ConfigServiceCategoryList from '../serviceCategory/ConfigServiceCategoryList.vue';
|
||||||
import ConfigServiceTypeList from '../serviceType/ConfigServiceTypeList.vue';
|
import ConfigServiceTypeList from '../serviceType/ConfigServiceTypeList.vue';
|
||||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
import DirectiveTagList from '../directiveTag/DirectiveTagList.vue';
|
||||||
|
|
||||||
const formRef = ref();
|
const formRef = ref();
|
||||||
const queryParam = reactive<any>({});
|
const queryParam = reactive<any>({});
|
||||||
|
@ -199,7 +210,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
canResize: false,
|
canResize: false,
|
||||||
useSearchForm: false,
|
useSearchForm: false,
|
||||||
actionColumn: {
|
actionColumn: {
|
||||||
width: 120,
|
width: 160,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
},
|
},
|
||||||
beforeFetch: async (params) => {
|
beforeFetch: async (params) => {
|
||||||
|
@ -236,6 +247,7 @@ const superQueryConfig = reactive(superQuerySchema);
|
||||||
|
|
||||||
const categoryOpen = ref(false)//服务类别抽屉
|
const categoryOpen = ref(false)//服务类别抽屉
|
||||||
const typeOpen = ref(false)//服务类型抽屉
|
const typeOpen = ref(false)//服务类型抽屉
|
||||||
|
const tagOpen = ref(false)//指令标签抽屉
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 高级查询事件
|
* 高级查询事件
|
||||||
|
@ -301,16 +313,7 @@ function getTableAction(record) {
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
onClick: handleEdit.bind(null, record),
|
onClick: handleEdit.bind(null, record),
|
||||||
auth: 'serviceDirective:config_service_directive:edit'
|
auth: 'serviceDirective:config_service_directive:edit'
|
||||||
},
|
}, {
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下拉操作栏
|
|
||||||
*/
|
|
||||||
function getDropDownAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '详情',
|
label: '详情',
|
||||||
onClick: handleDetail.bind(null, record),
|
onClick: handleDetail.bind(null, record),
|
||||||
}, {
|
}, {
|
||||||
|
@ -322,6 +325,15 @@ function getDropDownAction(record) {
|
||||||
},
|
},
|
||||||
auth: 'serviceDirective:config_service_directive:delete'
|
auth: 'serviceDirective:config_service_directive:delete'
|
||||||
}
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉操作栏
|
||||||
|
*/
|
||||||
|
function getDropDownAction(record) {
|
||||||
|
return [
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -378,7 +390,10 @@ function handleCategory() {
|
||||||
function handleType() {
|
function handleType() {
|
||||||
typeOpen.value = true
|
typeOpen.value = true
|
||||||
}
|
}
|
||||||
|
//指令标签抽屉打开
|
||||||
|
function handleTag() {
|
||||||
|
tagOpen.value = true
|
||||||
|
}
|
||||||
//服务类别抽屉关闭
|
//服务类别抽屉关闭
|
||||||
function onCategoryClose() {
|
function onCategoryClose() {
|
||||||
categoryOpen.value = false
|
categoryOpen.value = false
|
||||||
|
@ -388,7 +403,10 @@ function onCategoryClose() {
|
||||||
function onTypeClose() {
|
function onTypeClose() {
|
||||||
typeOpen.value = false
|
typeOpen.value = false
|
||||||
}
|
}
|
||||||
|
//指令标签抽屉关闭
|
||||||
|
function onTagClose() {
|
||||||
|
tagOpen.value = false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|
|
@ -5,93 +5,105 @@
|
||||||
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
|
<a-form ref="formRef" class="antd-modal-form" :labelCol="labelCol" :wrapperCol="wrapperCol"
|
||||||
name="ConfigServiceDirectiveForm">
|
name="ConfigServiceDirectiveForm">
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="服务类别" v-bind="validateInfos.categoryId" id="ConfigServiceDirectiveForm-categoryId"
|
<a-form-item label="服务类别" v-bind="validateInfos.categoryId" id="ConfigServiceDirectiveForm-categoryId"
|
||||||
name="categoryId">
|
name="categoryId">
|
||||||
<j-dict-select-tag type="list" v-model:value="formData.categoryId"
|
<j-dict-select-tag type="list" v-model:value="formData.categoryId"
|
||||||
:dictCode="`config_service_category,category_name,id,del_flag = 0 and iz_enabled = 0`"
|
:dictCode="`config_service_category,category_name,id,del_flag = 0 order by sort asc`"
|
||||||
placeholder="请选择服务类别" allow-clear />
|
placeholder="请选择服务类别" allow-clear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="服务类型" v-bind="validateInfos.typeId" id="ConfigServiceDirectiveForm-typeId"
|
<a-form-item label="服务类型" v-bind="validateInfos.typeId" id="ConfigServiceDirectiveForm-typeId"
|
||||||
name="typeId">
|
name="typeId">
|
||||||
<j-dict-select-tag type="list" v-model:value="formData.typeId"
|
<j-dict-select-tag type="list" v-model:value="formData.typeId"
|
||||||
:dictCode="`config_service_type,type_name,id,del_flag = 0 and iz_enabled = 0`" placeholder="请选择服务类型"
|
:dictCode="`config_service_type,type_name,id,del_flag = 0 order by sort asc`" placeholder="请选择服务类型"
|
||||||
allowClear />
|
allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="指令标签" v-bind="validateInfos.instructionTagId"
|
<a-form-item label="分类标签" v-bind="validateInfos.instructionTagId"
|
||||||
id="ConfigServiceDirectiveForm-instructionTagId" name="instructionTagId">
|
id="ConfigServiceDirectiveForm-instructionTagId" name="instructionTagId">
|
||||||
<j-dict-select-tag v-model:value="formData.instructionTagId" dictCode="instruction_tag"
|
<j-dict-select-tag v-model:value="formData.instructionTagId" dictCode="instruction_tag"
|
||||||
placeholder="请选择指令标签" allowClear />
|
placeholder="请选择分类标签" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="服务指令名称" v-bind="validateInfos.directiveName"
|
<a-form-item label="服务指令名称" v-bind="validateInfos.directiveName"
|
||||||
id="ConfigServiceDirectiveForm-directiveName" name="directiveName">
|
id="ConfigServiceDirectiveForm-directiveName" name="directiveName">
|
||||||
<a-input v-model:value="formData.directiveName" placeholder="请输入服务指令名称" allow-clear></a-input>
|
<a-input v-model:value="formData.directiveName" placeholder="请输入服务指令名称" allow-clear></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="收费价格" v-bind="validateInfos.tollPrice" id="ConfigServiceDirectiveForm-tollPrice"
|
<a-form-item label="收费价格" v-bind="validateInfos.tollPrice" id="ConfigServiceDirectiveForm-tollPrice"
|
||||||
name="tollPrice">
|
name="tollPrice">
|
||||||
<a-input-number v-model:value="formData.tollPrice" placeholder="请输入收费价格" style="width: 100%" />
|
<a-input-number v-model:value="formData.tollPrice" placeholder="请输入收费价格" style="width: 100%" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="提成价格" v-bind="validateInfos.comPrice" id="ConfigServiceDirectiveForm-comPrice"
|
<a-form-item label="提成价格" v-bind="validateInfos.comPrice" id="ConfigServiceDirectiveForm-comPrice"
|
||||||
name="comPrice">
|
name="comPrice">
|
||||||
<a-input-number v-model:value="formData.comPrice" placeholder="请输入提成价格" style="width: 100%" />
|
<a-input-number v-model:value="formData.comPrice" placeholder="请输入提成价格" style="width: 100%" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="医保报销" v-bind="validateInfos.izReimbursement"
|
<a-form-item label="医保报销" v-bind="validateInfos.izReimbursement"
|
||||||
id="ConfigServiceDirectiveForm-izReimbursement" name="izReimbursement">
|
id="ConfigServiceDirectiveForm-izReimbursement" name="izReimbursement">
|
||||||
<j-dict-select-tag type='radio' v-model:value="formData.izReimbursement" dictCode="med_ins_reimb"
|
<j-dict-select-tag type='radio' v-model:value="formData.izReimbursement" dictCode="med_ins_reimb"
|
||||||
allowClear />
|
allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="机构优惠" v-bind="validateInfos.izPreferential"
|
<a-form-item label="机构优惠" v-bind="validateInfos.izPreferential"
|
||||||
id="ConfigServiceDirectiveForm-izPreferential" name="izPreferential">
|
id="ConfigServiceDirectiveForm-izPreferential" name="izPreferential">
|
||||||
<j-dict-select-tag type='radio' v-model:value="formData.izPreferential"
|
<j-dict-select-tag type='radio' v-model:value="formData.izPreferential"
|
||||||
dictCode="institutional_discount" allowClear />
|
dictCode="institutional_discount" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="收费频次" v-bind="validateInfos.chargingFrequency"
|
<a-form-item label="收费频次" v-bind="validateInfos.chargingFrequency"
|
||||||
id="ConfigServiceDirectiveForm-chargingFrequency" name="chargingFrequency">
|
id="ConfigServiceDirectiveForm-chargingFrequency" name="chargingFrequency">
|
||||||
<j-dict-select-tag type="list" v-model:value="formData.chargingFrequency" dictCode="billing_frequency"
|
<j-dict-select-tag type="list" v-model:value="formData.chargingFrequency" dictCode="billing_frequency"
|
||||||
placeholder="请选择收费频次" allowClear />
|
placeholder="请选择收费频次" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="周期类型" v-bind="validateInfos.cycleType" id="ConfigServiceDirectiveForm-cycleType"
|
<a-form-item label="周期类型" v-bind="validateInfos.cycleType" id="ConfigServiceDirectiveForm-cycleType"
|
||||||
name="cycleType">
|
name="cycleType">
|
||||||
<j-dict-select-tag type="list" v-model:value="formData.cycleType" dictCode="period_type"
|
<j-dict-select-tag type="list" v-model:value="formData.cycleType" dictCode="period_type"
|
||||||
placeholder="请选择周期类型" allowClear />
|
placeholder="请选择周期类型" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="排序" v-bind="validateInfos.sort" id="ConfigServiceDirectiveForm-sort" name="sort">
|
|
||||||
<a-input-number v-model:value="formData.sort" placeholder="请输入排序" style="width: 100%" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item label="服务说明" v-bind="validateInfos.serviceContent"
|
|
||||||
id="ConfigServiceDirectiveForm-serviceContent" name="serviceContent">
|
|
||||||
<a-textarea v-model:value="formData.serviceContent" :rows="4" placeholder="请输入服务说明" />
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item label="服务时长(分钟)" v-bind="validateInfos.serviceDuration"
|
<a-form-item label="服务时长(分钟)" v-bind="validateInfos.serviceDuration"
|
||||||
id="ConfigServiceDirectiveForm-serviceDuration" name="serviceDuration">
|
id="ConfigServiceDirectiveForm-serviceDuration" name="serviceDuration">
|
||||||
<a-input v-model:value="formData.serviceDuration" placeholder="请输入服务时长(分钟)" allow-clear></a-input>
|
<a-input v-model:value="formData.serviceDuration" placeholder="请输入服务时长(分钟)" allow-clear></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
|
<a-form-item label="服务说明" v-bind="validateInfos.serviceContent"
|
||||||
|
id="ConfigServiceDirectiveForm-serviceContent" name="serviceContent">
|
||||||
|
<a-textarea v-model:value="formData.serviceContent" :rows="1" placeholder="请输入服务说明" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="语音文件" v-bind="validateInfos.mp3File" id="ConfigServiceDirectiveForm-mp3File"
|
||||||
|
name="mp3File">
|
||||||
|
<j-upload v-model:value="formData.mp3File" accept="audio/*"></j-upload>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="视频文件" v-bind="validateInfos.mp4File" id="ConfigServiceDirectiveForm-mp4File"
|
||||||
|
name="mp4File">
|
||||||
|
<j-upload v-model:value="formData.mp4File" accept="video/*"></j-upload>
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
|
<a-form-item label="排序" v-bind="validateInfos.sort" id="ConfigServiceDirectiveForm-sort" name="sort">
|
||||||
|
<a-input-number v-model:value="formData.sort" placeholder="请输入排序" style="width: 100%" />
|
||||||
|
</a-form-item>
|
||||||
|
</a-col>
|
||||||
|
<a-col :span="12">
|
||||||
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="ConfigServiceDirectiveForm-izEnabled"
|
<a-form-item label="是否启用" v-bind="validateInfos.izEnabled" id="ConfigServiceDirectiveForm-izEnabled"
|
||||||
name="izEnabled">
|
name="izEnabled">
|
||||||
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled"
|
<j-dict-select-tag type='radio' v-model:value="formData.izEnabled" dictCode="iz_enabled"
|
||||||
|
@ -99,37 +111,32 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="24">
|
||||||
<a-form-item label="语音文件" v-bind="validateInfos.mp3File" id="ConfigServiceDirectiveForm-mp3File"
|
<a-form-item label="指令标签" v-bind="validateInfos.typeId" id="ConfigServiceDirectiveForm-typeId" :labelCol="labelCol2" :wrapperCol="wrapperCol2"
|
||||||
name="mp3File">
|
name="typeId">
|
||||||
<j-upload v-model:value="formData.mp3File" accept="audio/*"></j-upload>
|
<JCheckbox v-model:value="formData.tags"
|
||||||
|
:dictCode="`config_directive_tag,tag_name,id,del_flag = 0 order by sort asc`" />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="视频文件" v-bind="validateInfos.mp4File" id="ConfigServiceDirectiveForm-mp4File"
|
|
||||||
name="mp4File">
|
|
||||||
<j-upload v-model:value="formData.mp4File" accept="video/*"></j-upload>
|
|
||||||
</a-form-item>
|
|
||||||
</a-col>
|
|
||||||
<a-col :span="24">
|
|
||||||
<a-form-item label="创建人" v-bind="validateInfos.createBy" id="ConfigServiceDirectiveForm-createBy"
|
<a-form-item label="创建人" v-bind="validateInfos.createBy" id="ConfigServiceDirectiveForm-createBy"
|
||||||
name="createBy">
|
name="createBy">
|
||||||
<a-input v-model:value="formData.createBy" placeholder="请输入创建人" disabled allow-clear></a-input>
|
<a-input v-model:value="formData.createBy" placeholder="请输入创建人" disabled allow-clear></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="创建日期" v-bind="validateInfos.createTime" id="ConfigServiceDirectiveForm-createTime"
|
<a-form-item label="创建日期" v-bind="validateInfos.createTime" id="ConfigServiceDirectiveForm-createTime"
|
||||||
name="createTime">
|
name="createTime">
|
||||||
<a-date-picker placeholder="请选择创建日期" v-model:value="formData.createTime" showTime
|
<a-date-picker placeholder="请选择创建日期" v-model:value="formData.createTime" showTime
|
||||||
value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled allow-clear />
|
value-format="YYYY-MM-DD HH:mm:ss" style="width: 100%" disabled allow-clear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="更新人" v-bind="validateInfos.updateBy" id="ConfigServiceDirectiveForm-updateBy"
|
<a-form-item label="更新人" v-bind="validateInfos.updateBy" id="ConfigServiceDirectiveForm-updateBy"
|
||||||
name="updateBy">
|
name="updateBy">
|
||||||
<a-input v-model:value="formData.updateBy" placeholder="请输入更新人" disabled allow-clear></a-input>
|
<a-input v-model:value="formData.updateBy" placeholder="请输入更新人" disabled allow-clear></a-input>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
<a-col :span="24">
|
<a-col :span="12">
|
||||||
<a-form-item label="更新日期" v-bind="validateInfos.updateTime" id="ConfigServiceDirectiveForm-updateTime"
|
<a-form-item label="更新日期" v-bind="validateInfos.updateTime" id="ConfigServiceDirectiveForm-updateTime"
|
||||||
name="updateTime">
|
name="updateTime">
|
||||||
<a-date-picker placeholder="请选择更新日期" v-model:value="formData.updateTime" showTime
|
<a-date-picker placeholder="请选择更新日期" v-model:value="formData.updateTime" showTime
|
||||||
|
@ -148,6 +155,7 @@ import { ref, reactive, defineExpose, nextTick, defineProps, computed, onMounted
|
||||||
import { defHttp } from '/@/utils/http/axios';
|
import { defHttp } from '/@/utils/http/axios';
|
||||||
import { useMessage } from '/@/hooks/web/useMessage';
|
import { useMessage } from '/@/hooks/web/useMessage';
|
||||||
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
import JDictSelectTag from '/@/components/Form/src/jeecg/components/JDictSelectTag.vue';
|
||||||
|
import { JCheckbox } from '/@/components/Form';
|
||||||
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
|
import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
|
||||||
import { getValueType } from '/@/utils';
|
import { getValueType } from '/@/utils';
|
||||||
import { saveOrUpdate } from '../ConfigServiceDirective.api';
|
import { saveOrUpdate } from '../ConfigServiceDirective.api';
|
||||||
|
@ -185,14 +193,16 @@ const formData = reactive<Record<string, any>>({
|
||||||
mp4File: '',
|
mp4File: '',
|
||||||
});
|
});
|
||||||
const { createMessage } = useMessage();
|
const { createMessage } = useMessage();
|
||||||
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 5 } });
|
const labelCol = ref<any>({ xs: { span: 24 }, sm: { span: 6 } });
|
||||||
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
const wrapperCol = ref<any>({ xs: { span: 24 }, sm: { span: 16 } });
|
||||||
|
const labelCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 3 } });
|
||||||
|
const wrapperCol2 = ref<any>({ xs: { span: 24 }, sm: { span: 20 } });
|
||||||
const confirmLoading = ref<boolean>(false);
|
const confirmLoading = ref<boolean>(false);
|
||||||
//表单验证
|
//表单验证
|
||||||
const validatorRules = reactive({
|
const validatorRules = reactive({
|
||||||
categoryId: [{ required: true, message: '请选择服务类别!' },],
|
categoryId: [{ required: true, message: '请选择服务类别!' },],
|
||||||
typeId: [{ required: true, message: '请选择服务类型!' },],
|
typeId: [{ required: true, message: '请选择服务类型!' },],
|
||||||
instructionTagId: [{ required: true, message: '请选择指令标签!' },],
|
instructionTagId: [{ required: true, message: '请选择分类标签!' },],
|
||||||
directiveName: [{ required: true, message: '请输入服务指令名称!' },],
|
directiveName: [{ required: true, message: '请输入服务指令名称!' },],
|
||||||
tollPrice: [{ required: true, message: '请输入收费价格!' }, { pattern: /^(([0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!' },],
|
tollPrice: [{ required: true, message: '请输入收费价格!' }, { pattern: /^(([0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!' },],
|
||||||
comPrice: [{ required: false }, { pattern: /^(([0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!' },],
|
comPrice: [{ required: false }, { pattern: /^(([0-9]*)|([0]\.\d{0,2}|[1-9][0-9]*\.\d{0,2}))$/, message: '请输入正确的金额!' },],
|
||||||
|
@ -200,12 +210,11 @@ const validatorRules = reactive({
|
||||||
izPreferential: [{ required: true, message: '请选择是否参与机构优惠!' },],
|
izPreferential: [{ required: true, message: '请选择是否参与机构优惠!' },],
|
||||||
chargingFrequency: [{ required: true, message: '请选择收费频次!' },],
|
chargingFrequency: [{ required: true, message: '请选择收费频次!' },],
|
||||||
cycleType: [{ required: true, message: '请选择周期类型!' },],
|
cycleType: [{ required: true, message: '请选择周期类型!' },],
|
||||||
sort: [{ required: true, message: '请输入排序!' },],
|
sort: [{ required: true, message: '请输入排序!' }, { pattern: /^\d+$/, message: '请输入正整数!' },],
|
||||||
serviceDuration: [{ required: true, message: '请输入服务时长(分钟)!' }, { pattern: /^-?\d+$/, message: '请输入整数!' },],
|
serviceDuration: [{ required: true, message: '请输入服务时长(分钟)!' }, { pattern: /^\d+$/, message: '请输入正整数!' },],
|
||||||
izEnabled: [{ required: true, message: '请选择是否启用!' },],
|
izEnabled: [{ required: true, message: '请选择是否启用!' },],
|
||||||
});
|
});
|
||||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||||
|
|
||||||
// 表单禁用
|
// 表单禁用
|
||||||
const disabled = computed(() => {
|
const disabled = computed(() => {
|
||||||
if (props.formBpm === true) {
|
if (props.formBpm === true) {
|
||||||
|
@ -230,6 +239,7 @@ function add() {
|
||||||
* 编辑
|
* 编辑
|
||||||
*/
|
*/
|
||||||
function edit(record) {
|
function edit(record) {
|
||||||
|
formData.tags = ''
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
resetFields();
|
resetFields();
|
||||||
const tmpData = {};
|
const tmpData = {};
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<j-modal :title="title" :width="width" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭" :maskClosable="false">
|
<j-modal :title="title" width="70vw" :visible="visible" @ok="handleOk" :okButtonProps="{ class: { 'jee-hidden': disableSubmit } }" @cancel="handleCancel" cancelText="关闭" :maskClosable="false">
|
||||||
<ConfigServiceDirectiveForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ConfigServiceDirectiveForm>
|
<ConfigServiceDirectiveForm ref="registerForm" @ok="submitCallback" :formDisabled="disableSubmit" :formBpm="false"></ConfigServiceDirectiveForm>
|
||||||
</j-modal>
|
</j-modal>
|
||||||
</template>
|
</template>
|
||||||
|
@ -11,7 +11,6 @@
|
||||||
import { array } from 'vue-types';
|
import { array } from 'vue-types';
|
||||||
|
|
||||||
const title = ref<string>('');
|
const title = ref<string>('');
|
||||||
const width = ref<number>(800);
|
|
||||||
const visible = ref<boolean>(false);
|
const visible = ref<boolean>(false);
|
||||||
const disableSubmit = ref<boolean>(false);
|
const disableSubmit = ref<boolean>(false);
|
||||||
const registerForm = ref();
|
const registerForm = ref();
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<a-form-item name="categoryId">
|
<a-form-item name="categoryId">
|
||||||
<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 and iz_enabled = 0`"
|
:dictCode="`config_service_category,category_name,id,del_flag = 0 order by sort asc`"
|
||||||
placeholder="请选择服务类别" allowClear />
|
placeholder="请选择服务类别" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -106,7 +106,7 @@ const { prefixCls, tableContext, onExportXls, onImportXls } = useListPage({
|
||||||
canResize: false,
|
canResize: false,
|
||||||
useSearchForm: false,
|
useSearchForm: false,
|
||||||
actionColumn: {
|
actionColumn: {
|
||||||
width: 120,
|
width: 160,
|
||||||
fixed: 'right',
|
fixed: 'right',
|
||||||
},
|
},
|
||||||
beforeFetch: async (params) => {
|
beforeFetch: async (params) => {
|
||||||
|
@ -205,16 +205,7 @@ function getTableAction(record) {
|
||||||
{
|
{
|
||||||
label: '编辑',
|
label: '编辑',
|
||||||
onClick: handleEdit.bind(null, record)
|
onClick: handleEdit.bind(null, record)
|
||||||
},
|
}, {
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 下拉操作栏
|
|
||||||
*/
|
|
||||||
function getDropDownAction(record) {
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
label: '详情',
|
label: '详情',
|
||||||
onClick: handleDetail.bind(null, record),
|
onClick: handleDetail.bind(null, record),
|
||||||
}, {
|
}, {
|
||||||
|
@ -225,6 +216,15 @@ function getDropDownAction(record) {
|
||||||
placement: 'topLeft',
|
placement: 'topLeft',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下拉操作栏
|
||||||
|
*/
|
||||||
|
function getDropDownAction(record) {
|
||||||
|
return [
|
||||||
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<a-form-item label="服务类别" v-bind="validateInfos.categoryId" id="ConfigServiceTypeForm-categoryId"
|
<a-form-item label="服务类别" v-bind="validateInfos.categoryId" id="ConfigServiceTypeForm-categoryId"
|
||||||
name="categoryId">
|
name="categoryId">
|
||||||
<j-dict-select-tag type='list' v-model:value="formData.categoryId"
|
<j-dict-select-tag type='list' v-model:value="formData.categoryId"
|
||||||
:dictCode="`config_service_category,category_name,id,del_flag = 0 and iz_enabled = 0`"
|
:dictCode="`config_service_category,category_name,id,del_flag = 0 order by sort asc`"
|
||||||
placeholder="请选择服务类别" allowClear />
|
placeholder="请选择服务类别" allowClear />
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-col>
|
</a-col>
|
||||||
|
@ -71,7 +71,7 @@ const confirmLoading = ref<boolean>(false);
|
||||||
const validatorRules = reactive({
|
const validatorRules = reactive({
|
||||||
categoryId: [{ required: true, message: '请选择服务类别!' },],
|
categoryId: [{ required: true, message: '请选择服务类别!' },],
|
||||||
typeName: [{ required: true, message: '请输入服务类型名称!' },],
|
typeName: [{ required: true, message: '请输入服务类型名称!' },],
|
||||||
sort: [{ required: true, message: '请输入排序!' },],
|
sort: [{ required: true, message: '请输入排序!'}, { pattern: /^\d+$/, message: '请输入正整数!'},],
|
||||||
izEnabled: [{ required: true, message: '请选择是否启用!' },],
|
izEnabled: [{ required: true, message: '请选择是否启用!' },],
|
||||||
});
|
});
|
||||||
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
const { resetFields, validate, validateInfos } = useForm(formData, validatorRules, { immediate: false });
|
||||||
|
|
|
@ -127,7 +127,7 @@
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
function getRowClassName(record) {
|
function getRowClassName(record) {
|
||||||
return record.status == 0 ? prefixCls : '';
|
return record.status == 1 ? prefixCls : '';
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<style scoped lang="less">
|
<style scoped lang="less">
|
||||||
|
|
|
@ -192,7 +192,7 @@ export const itemFormSchema: FormSchema[] = [
|
||||||
{
|
{
|
||||||
field: 'status',
|
field: 'status',
|
||||||
label: '是否启用',
|
label: '是否启用',
|
||||||
defaultValue: 1,
|
defaultValue: 0,
|
||||||
component: 'JDictSelectTag',
|
component: 'JDictSelectTag',
|
||||||
componentProps: {
|
componentProps: {
|
||||||
type: 'radioButton',
|
type: 'radioButton',
|
||||||
|
|
Loading…
Reference in New Issue