2022-09-22-完善成衣样板的添加编辑

zhc4dev
赵玉瑞 2 years ago
parent 1a8e103797
commit c9334541a7
  1. 88
      ant-design-vue-jeecg/src/views/zyclothsample/ZyClothSampleList.vue
  2. 123
      ant-design-vue-jeecg/src/views/zyclothsample/modules/ZyClothSampleForm.vue
  3. 19
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zyclothsample/controller/ZyClothSampleController.java
  4. 20
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/zyclothsample/entity/ZyClothSample.java

@ -11,8 +11,8 @@
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
<a-form-item label="成衣名称">
<a-input placeholder="请输入成衣名称" v-model="queryParam.clothName"></a-input>
<a-form-item label="款式">
<a-input placeholder="请输入款式" v-model="queryParam.styleId"></a-input>
</a-form-item>
</a-col>
<a-col :xl="6" :lg="7" :md="8" :sm="24">
@ -108,6 +108,11 @@
</a-button>
</template>
// TODO:
<span slot="action1" slot-scope="text, record">
<a @click="jumpPage(record)">模块样板</a>
</span>
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider type="vertical"/>
@ -115,6 +120,7 @@
<!-- <a @click="fuzhi(record)">复制</a>-->
<!-- <a-divider type="vertical" />-->
<!-- <a @click="handleDetail(record.id)">详情</a>-->
<a @click="handleDetail(record)">详情</a>
<a-divider type="vertical"/>
@ -132,7 +138,6 @@
<a-menu-item>
&lt;!&ndash;<a @click="handleDetail(record)">详情</a>&ndash;&gt;
<a @click="openDetail(record.id)">详情</a>
</a-menu-item>
<a-menu-item>
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
@ -146,7 +151,7 @@
</a-table>
</div>
<ZyClothSampleDetail ref="ZyClothSampleDetail"></ZyClothSampleDetail>
<zy-cloth-sample-modal ref="modalForm" @ok="modalFormOk"></zy-cloth-sample-modal>
<zy-cloth-sample-modal ref="modalForm" @ok="modalFormOk" v-bind="superFieldList"></zy-cloth-sample-modal>
</a-card>
</template>
@ -188,23 +193,27 @@ export default {
{
title: '款式',
align: "center",
dataIndex: 'styleId'
dataIndex: 'styleId',
},
{
title: '型号',
align: "center",
dataIndex: 'stylemodelId'
},
/*{
title: '模块样板',
align: "center",
dataIndex: 'modelSample'
},*/
{
title: '模块样板',
align: "center",
dataIndex: 'modelSample_dictText'
dataIndex: 'stylemodelId_dictText',
//dictCode: 'modenumber',
},
// {
// title: '',
// align: "center",
// dataIndex: 'modelSample_dictText'
// },
// {
// title: '',
// dataIndex: 'action1',
// align: "center",
// fixed: "right",
// width: 110,
// scopedSlots: {customRender: 'action1'}
// },
{
title: '用户名',
align: "center",
@ -216,27 +225,21 @@ export default {
dataIndex: 'createTime'
},
/*{
title: '成衣名称',
align: "center",
dataIndex: 'clothName'
},*/
/*{
title: '描述',
align: "center",
dataIndex: 'descr'
},*/
/*{
title: '图片',
align: "center",
dataIndex: 'url',
scopedSlots: {customRender: 'imgSlot'}
},*/
/*{
title: '用户类型',
{
title: '管理模块',
dataIndex: 'action1',
align: "center",
dataIndex: 'type'
},*/
fixed: "right",
width: 110,
scopedSlots: {customRender: 'action1'}
},
{
title: '操作',
@ -249,6 +252,7 @@ export default {
],
url: {
list: "/zyclothsample/zyClothSample/list",
edit: "/zyclothsample/zyClothSample/edit",
delete: "/zyclothsample/zyClothSample/delete",
deleteBatch: "/zyclothsample/zyClothSample/deleteBatch",
exportXlsUrl: "/zyclothsample/zyClothSample/exportXls",
@ -261,7 +265,8 @@ export default {
},
created() {
this.getSuperFieldList();
},
}
,
computed: {
importExcelUrl: function () {
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
@ -270,27 +275,42 @@ export default {
methods: {
initDictConfig() {
},
jumpPage(record) {
this.$router.push({
path: '/src/views/sample/ZyModuleSampleList',
// query: { //
// 'id': record.id,
// }
});
},
lookFile(fileUrl) {
let file = window._CONFIG['domianURL'] + "/sys/common/static/" + fileUrl
let Base64 = require('js-base64').Base64;
let url = window._CONFIG['onlinePreviewDomainURL'] + '/onlinePreview?url=' + encodeURIComponent(Base64.encode(file))
window.open(url);
},
}
,
getSuperFieldList() {
let fieldList = [];
fieldList.push({type: 'string', value: 'nums', text: '编号', dictCode:''})
fieldList.push({type: 'string', value: 'styleId', text: '款式', dictCode:''})
fieldList.push({type: 'string', value: 'stylemodelId', text: '型号', dictCode: ''})
fieldList.push({type: 'string', value: 'stylemodelId', text: '型号', dictCode: 'modenumber'})
fieldList.push({type: 'string', value: 'modelSample', text: '模块样板', dictCode: ''})
fieldList.push({type: 'string', value: 'userId', text: '用户名', dictCode: ''})
fieldList.push({type: 'string', value: 'createTime', text: '创建时间', dictCode: ''})
this.superFieldList = fieldList
},
}
,
openDetail(id) {
this.$refs.ZyClothSampleDetail.showModal(id)
// this.$children[0].showModal(id)
}
,
// handleDetail(id){
// this.$refs.ZyClothSampleDetail.showModal(id)
// }
}
}
</script>

@ -5,53 +5,53 @@
<a-row>
<a-col :span="24">
<a-form-model-item label="编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nums">
<!-- <a-input v-model="model.nums || this.nums" placeholder="请输入编号"></a-input>-->
<a-input v-model="model.nums" placeholder="请输入编号"></a-input>
</a-form-model-item>
</a-col>
<!-- <a-col :span="24">
<a-form-model-item label="成衣名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="clothName">
<a-input v-model="model.clothName" placeholder="请输入成衣名称" ></a-input>
</a-form-model-item>
</a-col>-->
<!--关联服装款式表 zy_cloths_style 关联列名称 传值id-->
<a-col :span="24">
<a-form-model-item label="款式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="styleId">
<a-input v-model="model.styleId" placeholder="请输入款式" ></a-input>
<j-dict-select-tag v-model="model.styleId" placeholder="请输入款式"
dict-code="zy_cloths_style,style_names,style_names"></j-dict-select-tag>
</a-form-model-item>
</a-col>
<!-- <a-col :span="24">
<a-form-model-item label="描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="descr">
<a-input v-model="model.descr" placeholder="请输入描述" ></a-input>
</a-form-model-item>
</a-col>-->
<a-col :span="24">
<a-form-model-item label="型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stylemodelId">
<a-input v-model="model.stylemodelId" placeholder="请输入型号" ></a-input>
<a-form-model-item label="款式型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stylemodelId">
<!-- <a-input v-model="model.stylemodelId" placeholder="请输入款式型号" @change="(vaule) => handletypeSelect(value)"></a-input>-->
<!-- <j-dict-select-tag v-model="model.stylemodelId" placeholder="请输入款式型号"-->
<!-- dict-code="zy_style_model,model_number,model_number"></j-dict-select-tag>-->
<j-dict-select-tag v-model="model.stylemodelId" placeholder="请选择款式型号"
dictCode="modenumber"></j-dict-select-tag>
</a-form-model-item>
</a-col>
<!-- <a-col :span="24">
<a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url">
<j-image-upload isMultiple v-model="model.url" ></j-image-upload>
</a-form-model-item>
</a-col>-->
<a-col :span="24">
<a-form-model-item label="模块样板" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="modelSample">
<!-- <j-image-upload isMultiple v-model="model.url" ></j-image-upload>-->
<!-- <a-input v-model="model.modelSample" placeholder="请输入模块样板" ></a-input>-->
<j-dict-select-tag v-model="model.modelSample" placeholder="请选择模块样板"
dictCode="zy_module_sample,module_name,id"/>
<!--<j-dict-select-tag v-model="model.modelSample" placeholder="请选择模块样板"-->
<!-- dict-code="zy_module_sample, module_name, id"></j-dict-select-tag>-->
<!-- <j-search-select-tag v-model="model.modelSample" dict="zy_module_sample" dictText="module_name", dictCode="id" />-->
<!-- </a-form-model-item>-->
<a-col :span="24">
<a-form-model-item label="用户名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId">
<!-- <a-input v-model="model.userId" placeholder="请输入用户名"></a-input>-->
<j-dict-select-tag v-model="model.userId" placeholder="请输入用户名"
dict-code="sys_user,username,username"></j-dict-select-tag>
</a-form-model-item>
</a-col>
<a-col :span="24">
<a-form-model-item label="用户名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId">
<a-input v-model="model.userId" placeholder="请输入用户名" ></a-input>
<a-form-model-item label="描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="descr">
<a-textarea v-model="model.descr" placeholder="请输入描述"></a-textarea>
</a-form-model-item>
</a-col>
<!-- <a-col :span="24">
<a-form-model-item label="用户类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type">
<a-input v-model="model.type" placeholder="请输入用户类型" ></a-input>
<a-col :span="24">
<a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url">
<j-image-upload isMultiple v-model="model.url"></j-image-upload>
</a-form-model-item>
</a-col>-->
</a-col>
</a-row>
</a-form-model>
</j-form-container>
@ -65,20 +65,23 @@
export default {
name: 'ZyClothSampleForm',
components: {
},
components: {},
props: {
//
disabled: {
type: Boolean,
default: false,
required: false
}
},
superFieldList: [], // table
},
data() {
return {
model:{
},
nums: '',
selectedKey: '', // id
typeid: '', // ,
serialNumber: '', //
model: {},
labelCol: {
xs: {span: 24},
sm: {span: 5},
@ -88,35 +91,72 @@
sm: {span: 16},
},
confirmLoading: false,
/*效验规则*/
validatorRules: {
nums: [
//{pattern: /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{4}$/, message: '4wei'},
{ required:true, message: '编号不能为空'},
{ pattern: /^[0-9A-Za-z]{0,10}$/, message: '编号太长'},
//{pattern: /^(?=.*([0-9a-zA-Z]){5}).[A-Za-z0-9]+$/, message: ''},
],
styleId: [
{required: true, message: '款式不能为空'},
],
stylemodelId: [
{required: true, message: '款式型号不能为空'},
],
userId: [
{required: true, message: '用户名不能为空'},// required:false
//{ pattern: /^\d{6,16}$/, message: '616!'}
],
descr: [
{pattern: /^[0-9A-Za-z\u4e00-\u9fa5]{0,200}$/, message: '文本长度过长'},
]
},
url: {
add: "/zyclothsample/zyClothSample/add",
edit: "/zyclothsample/zyClothSample/edit",
queryById: "/zyclothsample/zyClothSample/queryById"
queryById: "/zyclothsample/zyClothSample/queryById",
}
}
},
computed: {
formDisabled() {
return this.disabled
},
return this.disabled;
}
},
created() {
//model
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
mounted() {
// TODO: -
const str = `${this.selectedKey}${this.typeid}${''}`;
// const str = undefined;
str ? this.nums = str : this.nums = this.nums;
console.log(this.props, 'superFieldList')
},
methods: {
add() {
this.edit(this.modelDefault);
},
//
// select
handleSelect(selectedKeys) {
this.selectedKey = selectedKeys;
},
// change
handletypeSelect(selectedKeys) {
this.type = selectedKeys;
},
edit(record) {
this.model = Object.assign({}, record);
this.visible = true;
},
}
,
submitForm() {
const that = this;
//
this.$refs.form.validate(valid => {
if (valid) {
@ -143,7 +183,8 @@
}
})
},
}
,
}
}
</script>

@ -82,6 +82,11 @@ public class ZyClothSampleController extends JeecgController<ZyClothSample, IZyC
@ApiOperation(value="成衣样板-添加", notes="成衣样板-添加")
@PostMapping(value = "/add")
public Result<?> add(@RequestBody ZyClothSample zyClothSample) {
/*if (zyClothSample.getStyleId()==null){
return Result.error("款式不能为空");
}
if (zyClothSample.getModelSample()==null)
return Result.error("模块样板不能为空");*/
zyClothSampleService.save(zyClothSample);
return Result.OK("添加成功!");
}
@ -96,8 +101,20 @@ public class ZyClothSampleController extends JeecgController<ZyClothSample, IZyC
@ApiOperation(value="成衣样板-编辑", notes="成衣样板-编辑")
@PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ZyClothSample zyClothSample) {
//查询所有
List<ZyClothSample> zyClothSampleList = zyClothSampleService.list();
//查询编辑行的数据
ZyClothSample clothSample = zyClothSampleService.getById(zyClothSample.getId());
//移除编辑行数据
zyClothSampleList.remove(clothSample);
//将编辑行数据与其它数据比较 如果重复 报错
for (ZyClothSample cloth: zyClothSampleList) {
if (cloth.getNums().equals(zyClothSample.getNums())){
return Result.error("编号重复,请重新输入");
}
}
zyClothSampleService.updateById(zyClothSample);
return Result.OK("编辑成功!");
return Result.OK("编辑成功");
}
/**

@ -13,6 +13,7 @@ import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;
@ -38,13 +39,20 @@ public class ZyClothSample implements Serializable {
@Excel(name = "编号", width = 15)
@ApiModelProperty(value = "编号")
private String nums;
/**款式*/
/**
* 款式
* 关联服装款式表 zy_cloths_style
* 把数据id转换成style_names 因为前端一些问题 这里已不在需要
*/
@Excel(name = "款式", width = 15)
@ApiModelProperty(value = "款式")
//@Dict(dicCode = "id",dictTable = "zy_cloths_style",dicText = "style_names")
private String styleId;
/**型号*/
@Excel(name = "型号", width = 15)
@ApiModelProperty(value = "型号")
@Dict(dicCode = "modenumber", dictTable = "", dicText = "")
private String stylemodelId;
/**管理模块样板*/
@ -56,6 +64,7 @@ public class ZyClothSample implements Serializable {
@Excel(name = "模块样板", width = 15)
@ApiModelProperty(value = "模块样板")
@Dict(dicCode = "id",dictTable = "zy_module_sample",dicText = "module_name")
//@NotBlank(message = "模块样板不能为空")
private String modelSample;
/**用户*/
@Excel(name = "用户", width = 15)
@ -66,7 +75,14 @@ public class ZyClothSample implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期")
private Date createTime;
/**更新人*/
@ApiModelProperty(value = "更新人")
private java.lang.String updateBy;
/**更新日期*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "更新日期")
private java.util.Date updateTime;
/**成衣名称*/
@Excel(name = "成衣名称", width = 15)

Loading…
Cancel
Save