Pre Merge pull request !64 from 大熊/master

This commit is contained in:
大熊 2025-04-03 14:30:24 +00:00 committed by Gitee
commit bb4f2be5cf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
24 changed files with 219 additions and 125 deletions

View File

@ -33,7 +33,6 @@ import org.springframework.stereotype.Service;
import java.io.File; import java.io.File;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.StringWriter; import java.io.StringWriter;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -159,7 +158,7 @@ public class CodeGeneratorTemplateService {
CodeDelete deleteInfo = JSON.parseObject(codeGeneratorConfigEntity.getDeleteInfo(), CodeDelete.class); CodeDelete deleteInfo = JSON.parseObject(codeGeneratorConfigEntity.getDeleteInfo(), CodeDelete.class);
List<CodeQueryField> queryFields = JSONArray.parseArray(codeGeneratorConfigEntity.getQueryFields(), CodeQueryField.class); List<CodeQueryField> queryFields = JSONArray.parseArray(codeGeneratorConfigEntity.getQueryFields(), CodeQueryField.class);
List<CodeTableField> tableFields = JSONArray.parseArray(codeGeneratorConfigEntity.getTableFields(), CodeTableField.class); List<CodeTableField> tableFields = JSONArray.parseArray(codeGeneratorConfigEntity.getTableFields(), CodeTableField.class);
tableFields.stream().forEach(e -> e.setWidth(e.getWidth() == null ? 0 : e.getWidth())); tableFields.forEach(e -> e.setWidth(e.getWidth() == null ? 0 : e.getWidth()));
CodeGeneratorConfigForm form = CodeGeneratorConfigForm.builder().basic(basic).fields(fields).insertAndUpdate(insertAndUpdate).deleteInfo(deleteInfo).queryFields(queryFields).tableFields(tableFields).deleteInfo(deleteInfo).build(); CodeGeneratorConfigForm form = CodeGeneratorConfigForm.builder().basic(basic).fields(fields).insertAndUpdate(insertAndUpdate).deleteInfo(deleteInfo).queryFields(queryFields).tableFields(tableFields).deleteInfo(deleteInfo).build();
form.setTableName(tableName); form.setTableName(tableName);

View File

@ -64,8 +64,7 @@ public abstract class CodeGenerateBaseVariableService {
return null; return null;
} }
return fields.stream().filter(e -> columnName.equals(e.getColumnName())) return fields.stream().filter(e -> SmartStringUtil.equals(columnName, e.getColumnName())).findFirst().orElse(null);
.findFirst().get();
} }
@ -89,7 +88,7 @@ public abstract class CodeGenerateBaseVariableService {
} }
CodeInsertAndUpdateField field = first.get(); CodeInsertAndUpdateField field = first.get();
return SmartStringUtil.equals(field.getFrontComponent(), CodeFrontComponentEnum.FILE_UPLOAD.getValue()); return CodeFrontComponentEnum.FILE_UPLOAD.equalsValue(field.getFrontComponent());
} }
/** /**
@ -114,8 +113,7 @@ public abstract class CodeGenerateBaseVariableService {
return null; return null;
} }
Optional<CodeField> first = fields.stream().filter(e -> columnName.equals(e.getColumnName())).findFirst(); return fields.stream().filter(e -> columnName.equals(e.getColumnName())).findFirst().orElse(null);
return first.orElse(null);
} }
/** /**

View File

@ -67,6 +67,7 @@ public class FormVariableService extends CodeGenerateBaseVariableService {
if (CodeFrontComponentEnum.DICT_SELECT.equalsValue(field.getFrontComponent())) { if (CodeFrontComponentEnum.DICT_SELECT.equalsValue(field.getFrontComponent())) {
frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';"); frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';");
frontImportSet.add("import { DICT_CODE_ENUM } from '/@/constants/support/dict-const.js';");
} }
if (CodeFrontComponentEnum.FILE_UPLOAD.equalsValue(field.getFrontComponent())) { if (CodeFrontComponentEnum.FILE_UPLOAD.equalsValue(field.getFrontComponent())) {

View File

@ -2,13 +2,18 @@ package net.lab1024.sa.base.module.support.codegenerator.service.variable.front;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
import net.lab1024.sa.base.common.util.SmartStringUtil;
import net.lab1024.sa.base.module.support.codegenerator.constant.CodeFrontComponentEnum;
import net.lab1024.sa.base.module.support.codegenerator.constant.CodeQueryFieldQueryTypeEnum; import net.lab1024.sa.base.module.support.codegenerator.constant.CodeQueryFieldQueryTypeEnum;
import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm; import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeField; import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeField;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeInsertAndUpdateField;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeQueryField; import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeQueryField;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeTableField;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.CodeGenerateBaseVariableService; import net.lab1024.sa.base.module.support.codegenerator.service.variable.CodeGenerateBaseVariableService;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @Author 1024创新实验室-主任:卓大 * @Author 1024创新实验室-主任:卓大
@ -29,34 +34,74 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
public Map<String, Object> getInjectVariablesMap(CodeGeneratorConfigForm form) { public Map<String, Object> getInjectVariablesMap(CodeGeneratorConfigForm form) {
Map<String, Object> variablesMap = new HashMap<>(); Map<String, Object> variablesMap = new HashMap<>();
List<Map<String, Object>> variableList = new ArrayList<>();
List<CodeQueryField> queryFields = form.getQueryFields();
HashSet<String> frontImportSet = new HashSet<>(); HashSet<String> frontImportSet = new HashSet<>();
frontImportSet.add("import " + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, form.getBasic().getModuleName()) + "Form from './" + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, form.getBasic().getModuleName()) + "-form.vue';"); frontImportSet.add("import " + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, form.getBasic().getModuleName()) + "Form from './" + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, form.getBasic().getModuleName()) + "-form.vue';");
// 查询参数
List<Map<String, Object>> queryVariable = new ArrayList<>();
List<CodeQueryField> queryFields = form.getQueryFields();
for (CodeQueryField queryField : queryFields) { for (CodeQueryField queryField : queryFields) {
Map<String, Object> objectMap = BeanUtil.beanToMap(queryField); Map<String, Object> objectMap = BeanUtil.beanToMap(queryField);
CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form); CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form);
objectMap.put("frontEnumName", codeField.getEnumName());
objectMap.put("dict", codeField.getDict());
if(CodeQueryFieldQueryTypeEnum.ENUM.equalsValue(queryField.getQueryTypeEnum())){ if (CodeQueryFieldQueryTypeEnum.ENUM.equalsValue(queryField.getQueryTypeEnum())) {
objectMap.put("frontEnumName", codeField.getEnumName());
frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';"); frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';");
} }
if(CodeQueryFieldQueryTypeEnum.DICT.equalsValue(queryField.getQueryTypeEnum())){ if (CodeQueryFieldQueryTypeEnum.DICT.equalsValue(queryField.getQueryTypeEnum())) {
objectMap.put("dict", codeField.getDict());
frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';"); frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';");
} }
if(CodeQueryFieldQueryTypeEnum.DATE_RANGE.equalsValue(queryField.getQueryTypeEnum())){ if (CodeQueryFieldQueryTypeEnum.DATE_RANGE.equalsValue(queryField.getQueryTypeEnum())) {
frontImportSet.add("import { defaultTimeRanges } from '/@/lib/default-time-ranges';"); frontImportSet.add("import { defaultTimeRanges } from '/@/lib/default-time-ranges';");
} }
variableList.add(objectMap); queryVariable.add(objectMap);
} }
variablesMap.put("queryFields",variableList);
variablesMap.put("frontImportList",new ArrayList<>(frontImportSet)); // 表格列表
List<Map<String, Object>> listVariable = new ArrayList<>();
// 过滤掉不显示的字段
List<CodeTableField> tableFields = form.getTableFields().stream().filter(CodeTableField::getShowFlag).collect(Collectors.toList());
for (CodeTableField tableField : tableFields) {
Map<String, Object> objectMap = BeanUtil.beanToMap(tableField);
objectMap.put("fieldName", tableField.getFieldName());
CodeField codeField = getCodeFieldByColumnName(tableField.getColumnName(), form);
if (codeField == null) {
continue;
}
// 是否存在字典
if (SmartStringUtil.isNotBlank(codeField.getDict())) {
objectMap.put("dict", codeField.getDict());
frontImportSet.add("import { DICT_CODE_ENUM } from '/@/constants/support/dict-const.js';");
frontImportSet.add("import DictLabel from '/@/components/support/dict-label/index.vue';");
}
CodeInsertAndUpdateField codeInsertAndUpdateField = form.getInsertAndUpdate().getFieldList().stream().filter(e -> SmartStringUtil.equals(tableField.getColumnName(), e.getColumnName())).findFirst().orElse(null);
if (codeInsertAndUpdateField == null) {
continue;
}
// 是否存在上传组件
if (CodeFrontComponentEnum.FILE_UPLOAD.equalsValue(codeInsertAndUpdateField.getFrontComponent())) {
objectMap.put("frontComponent", codeInsertAndUpdateField.getFrontComponent());
frontImportSet.add("import FilePreview from '/@/components/support/file-preview/index.vue';");
}
listVariable.add(objectMap);
}
variablesMap.put("queryFields", queryVariable);
variablesMap.put("listFields", listVariable);
variablesMap.put("frontImportList", new ArrayList<>(frontImportSet));
return variablesMap; return variablesMap;
} }
} }

View File

@ -9,14 +9,14 @@ VALUES ( '${basic.description}', 2, 0, '/${name.lowerHyphenCamel}/list', '/busin
SET @parent_id = NULL; SET @parent_id = NULL;
SELECT t_menu.menu_id INTO @parent_id FROM t_menu WHERE t_menu.menu_name = '${basic.description}'; SELECT t_menu.menu_id INTO @parent_id FROM t_menu WHERE t_menu.menu_name = '${basic.description}';
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id ) INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '查询', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:query', 1, @parent_id, 1 ); VALUES ( '查询', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:query', '${name.lowerCamel}:query', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id ) INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '添加', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:add', 1, @parent_id, 1 ); VALUES ( '添加', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:add', '${name.lowerCamel}:add', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id ) INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '更新', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:update', 1, @parent_id, 1 ); VALUES ( '更新', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:update', '${name.lowerCamel}:update', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id ) INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '删除', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:delete', 1, @parent_id, 1 ); VALUES ( '删除', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:delete', '${name.lowerCamel}:delete', @parent_id, 1 );

View File

@ -43,12 +43,12 @@
#end #end
#if($field.frontComponent == "SmartEnumSelect") #if($field.frontComponent == "SmartEnumSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}"> <a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enumName="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/> <SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enum-name="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
</a-form-item> </a-form-item>
#end #end
#if($field.frontComponent == "DictSelect") #if($field.frontComponent == "DictSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}"> <a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<DictSelect width="100%" v-model:value="form.${field.fieldName}" dictCode="$!{field.dict}" placeholder="$!{field.label}"/> <DictSelect width="100%" v-model:value="form.${field.fieldName}" dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="$!{field.label}"/>
</a-form-item> </a-form-item>
#end #end
#if($field.frontComponent == "Date") #if($field.frontComponent == "Date")
@ -101,12 +101,12 @@
#end #end
#if($field.frontComponent == "SmartEnumSelect") #if($field.frontComponent == "SmartEnumSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}"> <a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enumName="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/> <SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enum-name="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
</a-form-item> </a-form-item>
#end #end
#if($field.frontComponent == "DictSelect") #if($field.frontComponent == "DictSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}"> <a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<DictSelect width="100%" v-model:value="form.${field.fieldName}" dictCode="$!{field.dict}" placeholder="$!{field.label}"/> <DictSelect width="100%" v-model:value="form.${field.fieldName}" dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="$!{field.label}"/>
</a-form-item> </a-form-item>
#end #end
#if($field.frontComponent == "Date") #if($field.frontComponent == "Date")

View File

@ -22,12 +22,12 @@
#end #end
#if($field.queryTypeEnum == "Dict") #if($field.queryTypeEnum == "Dict")
<a-form-item label="${field.label}" class="smart-query-form-item"> <a-form-item label="${field.label}" class="smart-query-form-item">
<DictSelect dictCode="$!{field.dict}" placeholder="${field.label}" v-model:value="queryForm.${field.fieldName}" width="${field.width}" /> <DictSelect dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="${field.label}" v-model:value="queryForm.${field.fieldName}" width="${field.width}" />
</a-form-item> </a-form-item>
#end #end
#if($field.queryTypeEnum == "Enum") #if($field.queryTypeEnum == "Enum")
<a-form-item label="$codeGeneratorTool.removeEnumDesc(${field.label})" class="smart-query-form-item"> <a-form-item label="$codeGeneratorTool.removeEnumDesc(${field.label})" class="smart-query-form-item">
<SmartEnumSelect width="${field.width}" v-model:value="queryForm.${field.fieldName}" enumName="$!{field.frontEnumName}" placeholder="$codeGeneratorTool.removeEnumDesc(${field.label})"/> <SmartEnumSelect width="${field.width}" v-model:value="queryForm.${field.fieldName}" enum-name="$!{field.frontEnumName}" placeholder="$codeGeneratorTool.removeEnumDesc(${field.label})"/>
</a-form-item> </a-form-item>
#end #end
#if($field.queryTypeEnum == "Date") #if($field.queryTypeEnum == "Date")
@ -101,18 +101,20 @@
> >
<template #bodyCell="{ text, record, column }"> <template #bodyCell="{ text, record, column }">
<!-- 有图片预览时 注释解开并把下面的'picture'修改成自己的图片字段名即可 --> #foreach ($field in $listFields)
<!-- <template v-if="column.dataIndex === 'picture'"> #if($field.frontComponent == "FileUpload")
<FilePreview :fileList="text" type="picture" /> <template v-if="column.dataIndex === '$field.fieldName'">
</template> --> <FilePreview :file-list="text" type="picture" />
</template>
<!-- 使用字典时 注释解开并把下面的'dict'修改成自己的字典字段名即可 有多个字典字段就复制多份同理修改 不然不显示字典 --> #end
<!-- 方便修改tag的颜色 orange green purple success processing error default warning --> #end
<!-- <template v-if="column.dataIndex === 'dict'"> #foreach ($field in $listFields)
<a-tag color="cyan"> #if($field.dict)
{{ text && text.length > 0 ? text.map((e) => e.valueName).join(',') : '暂无' }} <template v-if="column.dataIndex === '$!{field.fieldName}'">
</a-tag> <DictLabel :dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" :data-value="text" />
</template> --> </template>
#end
#end
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate"> <div class="smart-table-operate">
@ -159,7 +161,6 @@
#foreach ($import in $frontImportList) #foreach ($import in $frontImportList)
$!{import} $!{import}
#end #end
//import FilePreview from '/@/components/support/file-preview/index.vue'; // 图片预览组件
// ---------------------------- 表格列 ---------------------------- // ---------------------------- 表格列 ----------------------------

View File

@ -9,8 +9,7 @@
and table_name = #{tableName} and table_name = #{tableName}
</select> </select>
<select id="selectTableColumn" <select id="selectTableColumn" resultType="net.lab1024.sa.base.module.support.codegenerator.domain.vo.TableColumnVO">
resultType="net.lab1024.sa.base.module.support.codegenerator.domain.vo.TableColumnVO">
select * select *
from information_schema.columns from information_schema.columns
where table_schema = (select database()) where table_schema = (select database())
@ -18,19 +17,18 @@
order by ordinal_position order by ordinal_position
</select> </select>
<select id="queryTableList" <select id="queryTableList" resultType="net.lab1024.sa.base.module.support.codegenerator.domain.vo.TableVO">
resultType="net.lab1024.sa.base.module.support.codegenerator.domain.vo.TableVO">
select select
tables.table_name, `tables`.table_name,
tables.table_comment, `tables`.table_comment,
tables.create_time, `tables`.create_time,
tables.update_time, `tables`.update_time,
t_code_generator_config.update_time configTime t_code_generator_config.update_time configTime
from information_schema.tables tables from information_schema.tables `tables`
left join t_code_generator_config on tables.table_name = t_code_generator_config.table_name left join t_code_generator_config on `tables`.table_name = t_code_generator_config.table_name
where tables.table_schema = (select database()) where `tables`.table_schema = (select database())
<if test="queryForm.tableNameKeywords != null and queryForm.tableNameKeywords != ''"> <if test="queryForm.tableNameKeywords != null and queryForm.tableNameKeywords != ''">
AND INSTR(tables.table_name,#{queryForm.tableNameKeywords}) AND INSTR(`tables`.table_name,#{queryForm.tableNameKeywords})
</if> </if>
</select> </select>
</mapper> </mapper>

View File

@ -158,7 +158,7 @@ public class CodeGeneratorTemplateService {
CodeDelete deleteInfo = JSON.parseObject(codeGeneratorConfigEntity.getDeleteInfo(), CodeDelete.class); CodeDelete deleteInfo = JSON.parseObject(codeGeneratorConfigEntity.getDeleteInfo(), CodeDelete.class);
List<CodeQueryField> queryFields = JSONArray.parseArray(codeGeneratorConfigEntity.getQueryFields(), CodeQueryField.class); List<CodeQueryField> queryFields = JSONArray.parseArray(codeGeneratorConfigEntity.getQueryFields(), CodeQueryField.class);
List<CodeTableField> tableFields = JSONArray.parseArray(codeGeneratorConfigEntity.getTableFields(), CodeTableField.class); List<CodeTableField> tableFields = JSONArray.parseArray(codeGeneratorConfigEntity.getTableFields(), CodeTableField.class);
tableFields.stream().forEach(e -> e.setWidth(e.getWidth() == null ? 0 : e.getWidth())); tableFields.forEach(e -> e.setWidth(e.getWidth() == null ? 0 : e.getWidth()));
CodeGeneratorConfigForm form = CodeGeneratorConfigForm.builder().basic(basic).fields(fields).insertAndUpdate(insertAndUpdate).deleteInfo(deleteInfo).queryFields(queryFields).tableFields(tableFields).deleteInfo(deleteInfo).build(); CodeGeneratorConfigForm form = CodeGeneratorConfigForm.builder().basic(basic).fields(fields).insertAndUpdate(insertAndUpdate).deleteInfo(deleteInfo).queryFields(queryFields).tableFields(tableFields).deleteInfo(deleteInfo).build();
form.setTableName(tableName); form.setTableName(tableName);

View File

@ -64,8 +64,7 @@ public abstract class CodeGenerateBaseVariableService {
return null; return null;
} }
return fields.stream().filter(e -> columnName.equals(e.getColumnName())) return fields.stream().filter(e -> SmartStringUtil.equals(columnName, e.getColumnName())).findFirst().orElse(null);
.findFirst().get();
} }
@ -89,7 +88,7 @@ public abstract class CodeGenerateBaseVariableService {
} }
CodeInsertAndUpdateField field = first.get(); CodeInsertAndUpdateField field = first.get();
return SmartStringUtil.equals(field.getFrontComponent(), CodeFrontComponentEnum.FILE_UPLOAD.getValue()); return CodeFrontComponentEnum.FILE_UPLOAD.equalsValue(field.getFrontComponent());
} }
/** /**
@ -114,8 +113,7 @@ public abstract class CodeGenerateBaseVariableService {
return null; return null;
} }
Optional<CodeField> first = fields.stream().filter(e -> columnName.equals(e.getColumnName())).findFirst(); return fields.stream().filter(e -> columnName.equals(e.getColumnName())).findFirst().orElse(null);
return first.orElse(null);
} }
/** /**

View File

@ -67,6 +67,7 @@ public class FormVariableService extends CodeGenerateBaseVariableService {
if (CodeFrontComponentEnum.DICT_SELECT.equalsValue(field.getFrontComponent())) { if (CodeFrontComponentEnum.DICT_SELECT.equalsValue(field.getFrontComponent())) {
frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';"); frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';");
frontImportSet.add("import { DICT_CODE_ENUM } from '/@/constants/support/dict-const.js';");
} }
if (CodeFrontComponentEnum.FILE_UPLOAD.equalsValue(field.getFrontComponent())) { if (CodeFrontComponentEnum.FILE_UPLOAD.equalsValue(field.getFrontComponent())) {

View File

@ -2,13 +2,18 @@ package net.lab1024.sa.base.module.support.codegenerator.service.variable.front;
import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.bean.BeanUtil;
import com.google.common.base.CaseFormat; import com.google.common.base.CaseFormat;
import net.lab1024.sa.base.common.util.SmartStringUtil;
import net.lab1024.sa.base.module.support.codegenerator.constant.CodeFrontComponentEnum;
import net.lab1024.sa.base.module.support.codegenerator.constant.CodeQueryFieldQueryTypeEnum; import net.lab1024.sa.base.module.support.codegenerator.constant.CodeQueryFieldQueryTypeEnum;
import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm; import net.lab1024.sa.base.module.support.codegenerator.domain.form.CodeGeneratorConfigForm;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeField; import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeField;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeInsertAndUpdateField;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeQueryField; import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeQueryField;
import net.lab1024.sa.base.module.support.codegenerator.domain.model.CodeTableField;
import net.lab1024.sa.base.module.support.codegenerator.service.variable.CodeGenerateBaseVariableService; import net.lab1024.sa.base.module.support.codegenerator.service.variable.CodeGenerateBaseVariableService;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @Author 1024创新实验室-主任:卓大 * @Author 1024创新实验室-主任:卓大
@ -29,34 +34,74 @@ public class ListVariableService extends CodeGenerateBaseVariableService {
public Map<String, Object> getInjectVariablesMap(CodeGeneratorConfigForm form) { public Map<String, Object> getInjectVariablesMap(CodeGeneratorConfigForm form) {
Map<String, Object> variablesMap = new HashMap<>(); Map<String, Object> variablesMap = new HashMap<>();
List<Map<String, Object>> variableList = new ArrayList<>();
List<CodeQueryField> queryFields = form.getQueryFields();
HashSet<String> frontImportSet = new HashSet<>(); HashSet<String> frontImportSet = new HashSet<>();
frontImportSet.add("import " + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, form.getBasic().getModuleName()) + "Form from './" + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, form.getBasic().getModuleName()) + "-form.vue';"); frontImportSet.add("import " + CaseFormat.LOWER_CAMEL.to(CaseFormat.UPPER_CAMEL, form.getBasic().getModuleName()) + "Form from './" + CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, form.getBasic().getModuleName()) + "-form.vue';");
// 查询参数
List<Map<String, Object>> queryVariable = new ArrayList<>();
List<CodeQueryField> queryFields = form.getQueryFields();
for (CodeQueryField queryField : queryFields) { for (CodeQueryField queryField : queryFields) {
Map<String, Object> objectMap = BeanUtil.beanToMap(queryField); Map<String, Object> objectMap = BeanUtil.beanToMap(queryField);
CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form); CodeField codeField = getCodeFieldByColumnName(queryField.getColumnNameList().get(0), form);
objectMap.put("frontEnumName", codeField.getEnumName());
objectMap.put("dict", codeField.getDict());
if(CodeQueryFieldQueryTypeEnum.ENUM.equalsValue(queryField.getQueryTypeEnum())){ if (CodeQueryFieldQueryTypeEnum.ENUM.equalsValue(queryField.getQueryTypeEnum())) {
objectMap.put("frontEnumName", codeField.getEnumName());
frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';"); frontImportSet.add("import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';");
} }
if(CodeQueryFieldQueryTypeEnum.DICT.equalsValue(queryField.getQueryTypeEnum())){ if (CodeQueryFieldQueryTypeEnum.DICT.equalsValue(queryField.getQueryTypeEnum())) {
objectMap.put("dict", codeField.getDict());
frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';"); frontImportSet.add("import DictSelect from '/@/components/support/dict-select/index.vue';");
} }
if(CodeQueryFieldQueryTypeEnum.DATE_RANGE.equalsValue(queryField.getQueryTypeEnum())){ if (CodeQueryFieldQueryTypeEnum.DATE_RANGE.equalsValue(queryField.getQueryTypeEnum())) {
frontImportSet.add("import { defaultTimeRanges } from '/@/lib/default-time-ranges';"); frontImportSet.add("import { defaultTimeRanges } from '/@/lib/default-time-ranges';");
} }
variableList.add(objectMap); queryVariable.add(objectMap);
} }
variablesMap.put("queryFields",variableList);
variablesMap.put("frontImportList",new ArrayList<>(frontImportSet)); // 表格列表
List<Map<String, Object>> listVariable = new ArrayList<>();
// 过滤掉不显示的字段
List<CodeTableField> tableFields = form.getTableFields().stream().filter(CodeTableField::getShowFlag).collect(Collectors.toList());
for (CodeTableField tableField : tableFields) {
Map<String, Object> objectMap = BeanUtil.beanToMap(tableField);
objectMap.put("fieldName", tableField.getFieldName());
CodeField codeField = getCodeFieldByColumnName(tableField.getColumnName(), form);
if (codeField == null) {
continue;
}
// 是否存在字典
if (SmartStringUtil.isNotBlank(codeField.getDict())) {
objectMap.put("dict", codeField.getDict());
frontImportSet.add("import { DICT_CODE_ENUM } from '/@/constants/support/dict-const.js';");
frontImportSet.add("import DictLabel from '/@/components/support/dict-label/index.vue';");
}
CodeInsertAndUpdateField codeInsertAndUpdateField = form.getInsertAndUpdate().getFieldList().stream().filter(e -> SmartStringUtil.equals(tableField.getColumnName(), e.getColumnName())).findFirst().orElse(null);
if (codeInsertAndUpdateField == null) {
continue;
}
// 是否存在上传组件
if (CodeFrontComponentEnum.FILE_UPLOAD.equalsValue(codeInsertAndUpdateField.getFrontComponent())) {
objectMap.put("frontComponent", codeInsertAndUpdateField.getFrontComponent());
frontImportSet.add("import FilePreview from '/@/components/support/file-preview/index.vue';");
}
listVariable.add(objectMap);
}
variablesMap.put("queryFields", queryVariable);
variablesMap.put("listFields", listVariable);
variablesMap.put("frontImportList", new ArrayList<>(frontImportSet));
return variablesMap; return variablesMap;
} }
} }

View File

@ -9,14 +9,14 @@ VALUES ( '${basic.description}', 2, 0, '/${name.lowerHyphenCamel}/list', '/busin
SET @parent_id = NULL; SET @parent_id = NULL;
SELECT t_menu.menu_id INTO @parent_id FROM t_menu WHERE t_menu.menu_name = '${basic.description}'; SELECT t_menu.menu_id INTO @parent_id FROM t_menu WHERE t_menu.menu_name = '${basic.description}';
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id ) INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '查询', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:query', 1, @parent_id, 1 ); VALUES ( '查询', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:query', '${name.lowerCamel}:query', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id ) INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '添加', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:add', 1, @parent_id, 1 ); VALUES ( '添加', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:add', '${name.lowerCamel}:add', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id ) INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '更新', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:update', 1, @parent_id, 1 ); VALUES ( '更新', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:update', '${name.lowerCamel}:update', @parent_id, 1 );
INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, api_perms, perms_type, context_menu_id, create_user_id ) INSERT INTO t_menu ( menu_name, menu_type, parent_id, frame_flag, cache_flag, visible_flag, disabled_flag, perms_type, api_perms, web_perms, context_menu_id, create_user_id )
VALUES ( '删除', 3, @parent_id, false, true, true, false, '${name.lowerCamel}:delete', 1, @parent_id, 1 ); VALUES ( '删除', 3, @parent_id, false, false, true, false, 1, '${name.lowerCamel}:delete', '${name.lowerCamel}:delete', @parent_id, 1 );

View File

@ -43,12 +43,12 @@
#end #end
#if($field.frontComponent == "SmartEnumSelect") #if($field.frontComponent == "SmartEnumSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}"> <a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enumName="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/> <SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enum-name="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
</a-form-item> </a-form-item>
#end #end
#if($field.frontComponent == "DictSelect") #if($field.frontComponent == "DictSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}"> <a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<DictSelect width="100%" v-model:value="form.${field.fieldName}" dictCode="$!{field.dict}" placeholder="$!{field.label}"/> <DictSelect width="100%" v-model:value="form.${field.fieldName}" dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="$!{field.label}"/>
</a-form-item> </a-form-item>
#end #end
#if($field.frontComponent == "Date") #if($field.frontComponent == "Date")
@ -101,12 +101,12 @@
#end #end
#if($field.frontComponent == "SmartEnumSelect") #if($field.frontComponent == "SmartEnumSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}"> <a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enumName="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/> <SmartEnumSelect width="100%" v-model:value="form.${field.fieldName}" enum-name="$!{field.upperUnderscoreEnum}" placeholder="$codeGeneratorTool.removeEnumDesc($!{field.label})"/>
</a-form-item> </a-form-item>
#end #end
#if($field.frontComponent == "DictSelect") #if($field.frontComponent == "DictSelect")
<a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}"> <a-form-item label="$codeGeneratorTool.removeEnumDesc($!{field.label})" name="${field.fieldName}">
<DictSelect width="100%" v-model:value="form.${field.fieldName}" dictCode="$!{field.dict}" placeholder="$!{field.label}"/> <DictSelect width="100%" v-model:value="form.${field.fieldName}" dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="$!{field.label}"/>
</a-form-item> </a-form-item>
#end #end
#if($field.frontComponent == "Date") #if($field.frontComponent == "Date")

View File

@ -22,12 +22,12 @@
#end #end
#if($field.queryTypeEnum == "Dict") #if($field.queryTypeEnum == "Dict")
<a-form-item label="${field.label}" class="smart-query-form-item"> <a-form-item label="${field.label}" class="smart-query-form-item">
<DictSelect dictCode="$!{field.dict}" placeholder="${field.label}" v-model:value="queryForm.${field.fieldName}" width="${field.width}" /> <DictSelect dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" placeholder="${field.label}" v-model:value="queryForm.${field.fieldName}" width="${field.width}" />
</a-form-item> </a-form-item>
#end #end
#if($field.queryTypeEnum == "Enum") #if($field.queryTypeEnum == "Enum")
<a-form-item label="$codeGeneratorTool.removeEnumDesc(${field.label})" class="smart-query-form-item"> <a-form-item label="$codeGeneratorTool.removeEnumDesc(${field.label})" class="smart-query-form-item">
<SmartEnumSelect width="${field.width}" v-model:value="queryForm.${field.fieldName}" enumName="$!{field.frontEnumName}" placeholder="$codeGeneratorTool.removeEnumDesc(${field.label})"/> <SmartEnumSelect width="${field.width}" v-model:value="queryForm.${field.fieldName}" enum-name="$!{field.frontEnumName}" placeholder="$codeGeneratorTool.removeEnumDesc(${field.label})"/>
</a-form-item> </a-form-item>
#end #end
#if($field.queryTypeEnum == "Date") #if($field.queryTypeEnum == "Date")
@ -101,18 +101,20 @@
> >
<template #bodyCell="{ text, record, column }"> <template #bodyCell="{ text, record, column }">
<!-- 有图片预览时 注释解开并把下面的'picture'修改成自己的图片字段名即可 --> #foreach ($field in $listFields)
<!-- <template v-if="column.dataIndex === 'picture'"> #if($field.frontComponent == "FileUpload")
<FilePreview :fileList="text" type="picture" /> <template v-if="column.dataIndex === '$field.fieldName'">
</template> --> <FilePreview :file-list="text" type="picture" />
</template>
<!-- 使用字典时 注释解开并把下面的'dict'修改成自己的字典字段名即可 有多个字典字段就复制多份同理修改 不然不显示字典 --> #end
<!-- 方便修改tag的颜色 orange green purple success processing error default warning --> #end
<!-- <template v-if="column.dataIndex === 'dict'"> #foreach ($field in $listFields)
<a-tag color="cyan"> #if($field.dict)
{{ text && text.length > 0 ? text.map((e) => e.valueName).join(',') : '暂无' }} <template v-if="column.dataIndex === '$!{field.fieldName}'">
</a-tag> <DictLabel :dict-code="DICT_CODE_ENUM.$!{field.dict} || '$!{field.dict}'" :data-value="text" />
</template> --> </template>
#end
#end
<template v-if="column.dataIndex === 'action'"> <template v-if="column.dataIndex === 'action'">
<div class="smart-table-operate"> <div class="smart-table-operate">
@ -159,7 +161,6 @@
#foreach ($import in $frontImportList) #foreach ($import in $frontImportList)
$!{import} $!{import}
#end #end
//import FilePreview from '/@/components/support/file-preview/index.vue'; // 图片预览组件
// ---------------------------- 表格列 ---------------------------- // ---------------------------- 表格列 ----------------------------

View File

@ -9,8 +9,7 @@
and table_name = #{tableName} and table_name = #{tableName}
</select> </select>
<select id="selectTableColumn" <select id="selectTableColumn" resultType="net.lab1024.sa.base.module.support.codegenerator.domain.vo.TableColumnVO">
resultType="net.lab1024.sa.base.module.support.codegenerator.domain.vo.TableColumnVO">
select * select *
from information_schema.columns from information_schema.columns
where table_schema = (select database()) where table_schema = (select database())
@ -18,19 +17,18 @@
order by ordinal_position order by ordinal_position
</select> </select>
<select id="queryTableList" <select id="queryTableList" resultType="net.lab1024.sa.base.module.support.codegenerator.domain.vo.TableVO">
resultType="net.lab1024.sa.base.module.support.codegenerator.domain.vo.TableVO">
select select
tables.table_name, `tables`.table_name,
tables.table_comment, `tables`.table_comment,
tables.create_time, `tables`.create_time,
tables.update_time, `tables`.update_time,
t_code_generator_config.update_time configTime t_code_generator_config.update_time configTime
from information_schema.tables tables from information_schema.tables `tables`
left join t_code_generator_config on tables.table_name = t_code_generator_config.table_name left join t_code_generator_config on `tables`.table_name = t_code_generator_config.table_name
where tables.table_schema = (select database()) where `tables`.table_schema = (select database())
<if test="queryForm.tableNameKeywords != null and queryForm.tableNameKeywords != ''"> <if test="queryForm.tableNameKeywords != null and queryForm.tableNameKeywords != ''">
AND INSTR(tables.table_name,#{queryForm.tableNameKeywords}) AND INSTR(`tables`.table_name,#{queryForm.tableNameKeywords})
</if> </if>
</select> </select>
</mapper> </mapper>

View File

@ -25,7 +25,7 @@
</a-form-item> </a-form-item>
<a-form-item label="产地" name="place" class="smart-query-form-item"> <a-form-item label="产地" name="place" class="smart-query-form-item">
<DictSelect :dictCode="DICT_CODE_ENUM.GOODS_PLACE" v-model:value="queryForm.place" width="120px" /> <DictSelect :dict-code="DICT_CODE_ENUM.GOODS_PLACE" v-model:value="queryForm.place" width="120px" />
</a-form-item> </a-form-item>
<a-form-item label="商品状态" name="goodsStatus" class="smart-query-form-item"> <a-form-item label="商品状态" name="goodsStatus" class="smart-query-form-item">
@ -93,7 +93,7 @@
</a-button> </a-button>
</div> </div>
<div class="smart-table-setting-block"> <div class="smart-table-setting-block">
<TableOperator v-model="columns" :tableId="TABLE_ID_CONST.BUSINESS.ERP.GOODS" :refresh="queryData"/> <TableOperator v-model="columns" :tableId="TABLE_ID_CONST.BUSINESS.ERP.GOODS" :refresh="queryData" />
</div> </div>
</a-row> </a-row>
<!---------- 表格操作行 end -----------> <!---------- 表格操作行 end ----------->
@ -120,7 +120,7 @@
{{ text }} {{ text }}
</template> </template>
<template v-if="column.dataIndex === 'place'"> <template v-if="column.dataIndex === 'place'">
<DictLabel :dict-code="DICT_CODE_ENUM.GOODS_PLACE" :dataValue="text" /> <DictLabel :dict-code="DICT_CODE_ENUM.GOODS_PLACE" :data-value="text" />
</template> </template>
<template v-if="column.dataIndex === 'remark'"> <template v-if="column.dataIndex === 'remark'">
<span>{{ text ? text : '' }}</span> <span>{{ text ? text : '' }}</span>
@ -199,7 +199,6 @@
import { smartSentry } from '/@/lib/smart-sentry'; import { smartSentry } from '/@/lib/smart-sentry';
import TableOperator from '/@/components/support/table-operator/index.vue'; import TableOperator from '/@/components/support/table-operator/index.vue';
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const'; import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
import { GOODS_STATUS_ENUM } from '/@/constants/business/erp/goods-const';
import DictSelect from '/@/components/support/dict-select/index.vue'; import DictSelect from '/@/components/support/dict-select/index.vue';
import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue'; import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';
import _ from 'lodash'; import _ from 'lodash';
@ -235,7 +234,6 @@
title: '商品状态', title: '商品状态',
dataIndex: 'goodsStatus', dataIndex: 'goodsStatus',
resizable: true, resizable: true,
sorter: true,
filterOptions: { filterOptions: {
type: 'enum-select', type: 'enum-select',
enumName: 'GOODS_STATUS_ENUM', enumName: 'GOODS_STATUS_ENUM',
@ -248,7 +246,7 @@
resizable: true, resizable: true,
filterOptions: { filterOptions: {
type: 'dict-select', type: 'dict-select',
dictCode: DICT_CODE_ENUM.GOODS_PLACE, dictCode: DICT_CODE_ENUM.GOODS_PLACE || 'GOODS_PLACE',
}, },
width: 150, width: 150,
}, },

View File

@ -39,7 +39,16 @@
<TableOperator class="smart-margin-bottom5" v-model="columns" :tableId="TABLE_ID_CONST.SUPPORT.CONFIG" :refresh="ajaxQuery" /> <TableOperator class="smart-margin-bottom5" v-model="columns" :tableId="TABLE_ID_CONST.SUPPORT.CONFIG" :refresh="ajaxQuery" />
</a-row> </a-row>
<a-table size="small" :loading="tableLoading" bordered :dataSource="tableData" :columns="columns" rowKey="configId" :pagination="false"> <a-table
size="small"
:scroll="{ x: 1000 }"
:loading="tableLoading"
bordered
:dataSource="tableData"
:columns="columns"
rowKey="configId"
:pagination="false"
>
<template #bodyCell="{ record, index, column }"> <template #bodyCell="{ record, index, column }">
<template v-if="column.dataIndex === 'seq'"> <template v-if="column.dataIndex === 'seq'">
{{ index + 1 }} {{ index + 1 }}

View File

@ -59,6 +59,7 @@
<a-table <a-table
size="small" size="small"
:scroll="{ x: 1000 }"
bordered bordered
class="smart-margin-top10" class="smart-margin-top10"
:dataSource="tableData" :dataSource="tableData"

View File

@ -88,6 +88,7 @@
<a-table <a-table
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
size="small" size="small"
:scroll="{ x: 1000 }"
:defaultExpandAllRows="true" :defaultExpandAllRows="true"
:dataSource="tableData" :dataSource="tableData"
bordered bordered

View File

@ -120,7 +120,7 @@
{{ text }} {{ text }}
</template> </template>
<template v-if="column.dataIndex === 'place'"> <template v-if="column.dataIndex === 'place'">
<DictLabel :dict-code="DICT_CODE_ENUM.GOODS_PLACE" :dataValue="text" /> <DictLabel :dict-code="DICT_CODE_ENUM.GOODS_PLACE" :data-value="text" />
</template> </template>
<template v-if="column.dataIndex === 'remark'"> <template v-if="column.dataIndex === 'remark'">
<span>{{ text ? text : '' }}</span> <span>{{ text ? text : '' }}</span>
@ -199,7 +199,6 @@
import { smartSentry } from '/@/lib/smart-sentry'; import { smartSentry } from '/@/lib/smart-sentry';
import TableOperator from '/@/components/support/table-operator/index.vue'; import TableOperator from '/@/components/support/table-operator/index.vue';
import { TABLE_ID_CONST } from '/@/constants/support/table-id-const'; import { TABLE_ID_CONST } from '/@/constants/support/table-id-const';
import { GOODS_STATUS_ENUM } from '/@/constants/business/erp/goods-const';
import DictSelect from '/@/components/support/dict-select/index.vue'; import DictSelect from '/@/components/support/dict-select/index.vue';
import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue'; import SmartEnumSelect from '/@/components/framework/smart-enum-select/index.vue';
import _ from 'lodash'; import _ from 'lodash';
@ -235,7 +234,6 @@
title: '商品状态', title: '商品状态',
dataIndex: 'goodsStatus', dataIndex: 'goodsStatus',
resizable: true, resizable: true,
sorter: true,
filterOptions: { filterOptions: {
type: 'enum-select', type: 'enum-select',
enumName: 'GOODS_STATUS_ENUM', enumName: 'GOODS_STATUS_ENUM',

View File

@ -39,7 +39,7 @@
<TableOperator class="smart-margin-bottom5" v-model="columns" :tableId="TABLE_ID_CONST.SUPPORT.CONFIG" :refresh="ajaxQuery" /> <TableOperator class="smart-margin-bottom5" v-model="columns" :tableId="TABLE_ID_CONST.SUPPORT.CONFIG" :refresh="ajaxQuery" />
</a-row> </a-row>
<a-table size="small" :loading="tableLoading" bordered :dataSource="tableData" :columns="columns" rowKey="configId" :pagination="false"> <a-table size="small" :scroll="{ x: 1000 }" :loading="tableLoading" bordered :dataSource="tableData" :columns="columns" rowKey="configId" :pagination="false">
<template #bodyCell="{ record, index, column }"> <template #bodyCell="{ record, index, column }">
<template v-if="column.dataIndex === 'seq'"> <template v-if="column.dataIndex === 'seq'">
{{ index + 1 }} {{ index + 1 }}

View File

@ -59,6 +59,7 @@
<a-table <a-table
size="small" size="small"
:scroll="{ x: 1000 }"
bordered bordered
class="smart-margin-top10" class="smart-margin-top10"
:dataSource="tableData" :dataSource="tableData"

View File

@ -88,6 +88,7 @@
<a-table <a-table
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
size="small" size="small"
:scroll="{ x: 1000 }"
:defaultExpandAllRows="true" :defaultExpandAllRows="true"
:dataSource="tableData" :dataSource="tableData"
bordered bordered