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

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

@ -5,53 +5,53 @@
<a-row> <a-row>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nums"> <a-form-model-item label="编号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="nums">
<a-input v-model="model.nums" placeholder="请输入编号" ></a-input> <!-- <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-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="24"> <!--关联服装款式表 zy_cloths_style 关联列名称 传值id-->
<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>-->
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="款式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="styleId"> <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-form-model-item>
</a-col> </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-col :span="24">
<a-form-model-item label="型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stylemodelId"> <a-form-model-item label="款式型号" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="stylemodelId">
<a-input v-model="model.stylemodelId" placeholder="请输入型号" ></a-input> <!-- <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-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="24">
<a-form-model-item label="图片" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="url"> <!--<j-dict-select-tag v-model="model.modelSample" placeholder="请选择模块样板"-->
<j-image-upload isMultiple v-model="model.url" ></j-image-upload> <!-- dict-code="zy_module_sample, module_name, id"></j-dict-select-tag>-->
</a-form-model-item> <!-- <j-search-select-tag v-model="model.modelSample" dict="zy_module_sample" dictText="module_name", dictCode="id" />-->
</a-col>--> <!-- </a-form-model-item>-->
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="模块样板" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="modelSample"> <a-form-model-item label="用户名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId">
<!-- <j-image-upload isMultiple v-model="model.url" ></j-image-upload>--> <!-- <a-input v-model="model.userId" placeholder="请输入用户名"></a-input>-->
<!-- <a-input v-model="model.modelSample" placeholder="请输入模块样板" ></a-input>--> <j-dict-select-tag v-model="model.userId" placeholder="请输入用户名"
<j-dict-select-tag v-model="model.modelSample" placeholder="请选择模块样板" dict-code="sys_user,username,username"></j-dict-select-tag>
dictCode="zy_module_sample,module_name,id"/>
<!-- <j-search-select-tag v-model="model.modelSample" dict="zy_module_sample" dictText="module_name", dictCode="id" />-->
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<a-col :span="24"> <a-col :span="24">
<a-form-model-item label="用户名" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="userId"> <a-form-model-item label="描述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="descr">
<a-input v-model="model.userId" placeholder="请输入用户名" ></a-input> <a-textarea v-model="model.descr" placeholder="请输入描述"></a-textarea>
</a-form-model-item> </a-form-model-item>
</a-col> </a-col>
<!-- <a-col :span="24">
<a-form-model-item label="用户类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="type"> <a-col :span="24">
<a-input v-model="model.type" placeholder="请输入用户类型" ></a-input> <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-form-model-item>
</a-col>--> </a-col>
</a-row> </a-row>
</a-form-model> </a-form-model>
</j-form-container> </j-form-container>
@ -60,81 +60,121 @@
<script> <script>
import { httpAction, getAction } from '@/api/manage' import {httpAction, getAction} from '@/api/manage'
import { validateDuplicateValue } from '@/utils/util' import {validateDuplicateValue} from '@/utils/util'
export default { export default {
name: 'ZyClothSampleForm', name: 'ZyClothSampleForm',
components: { components: {},
},
props: { props: {
// //
disabled: { disabled: {
type: Boolean, type: Boolean,
default: false, default: false,
required: false required: false
}
}, },
data () { superFieldList: [], // table
return {
model:{
}, },
data() {
return {
nums: '',
selectedKey: '', // id
typeid: '', // ,
serialNumber: '', //
model: {},
labelCol: { labelCol: {
xs: { span: 24 }, xs: {span: 24},
sm: { span: 5 }, sm: {span: 5},
}, },
wrapperCol: { wrapperCol: {
xs: { span: 24 }, xs: {span: 24},
sm: { span: 16 }, sm: {span: 16},
}, },
confirmLoading: false, confirmLoading: false,
/*效验规则*/
validatorRules: { 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: { url: {
add: "/zyclothsample/zyClothSample/add", add: "/zyclothsample/zyClothSample/add",
edit: "/zyclothsample/zyClothSample/edit", edit: "/zyclothsample/zyClothSample/edit",
queryById: "/zyclothsample/zyClothSample/queryById" queryById: "/zyclothsample/zyClothSample/queryById",
} }
} }
}, },
computed: { computed: {
formDisabled(){ formDisabled() {
return this.disabled return this.disabled;
}, }
}, },
created () { created() {
//model //model
this.modelDefault = JSON.parse(JSON.stringify(this.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: { methods: {
add () { add() {
this.edit(this.modelDefault); this.edit(this.modelDefault);
}, },
edit (record) { //
// select
handleSelect(selectedKeys) {
this.selectedKey = selectedKeys;
},
// change
handletypeSelect(selectedKeys) {
this.type = selectedKeys;
},
edit(record) {
this.model = Object.assign({}, record); this.model = Object.assign({}, record);
this.visible = true; this.visible = true;
}, }
submitForm () { ,
submitForm() {
const that = this; const that = this;
// //
this.$refs.form.validate(valid => { this.$refs.form.validate(valid => {
if (valid) { if (valid) {
that.confirmLoading = true; that.confirmLoading = true;
let httpurl = ''; let httpurl = '';
let method = ''; let method = '';
if(!this.model.id){ if (!this.model.id) {
httpurl+=this.url.add; httpurl += this.url.add;
method = 'post'; method = 'post';
}else{ } else {
httpurl+=this.url.edit; httpurl += this.url.edit;
method = 'put'; method = 'put';
} }
httpAction(httpurl,this.model,method).then((res)=>{ httpAction(httpurl, this.model, method).then((res) => {
if(res.success){ if (res.success) {
that.$message.success(res.message); that.$message.success(res.message);
that.$emit('ok'); that.$emit('ok');
}else{ } else {
that.$message.warning(res.message); that.$message.warning(res.message);
} }
}).finally(() => { }).finally(() => {
@ -143,7 +183,8 @@
} }
}) })
},
} }
,
} }
}
</script> </script>

@ -82,6 +82,11 @@ public class ZyClothSampleController extends JeecgController<ZyClothSample, IZyC
@ApiOperation(value="成衣样板-添加", notes="成衣样板-添加") @ApiOperation(value="成衣样板-添加", notes="成衣样板-添加")
@PostMapping(value = "/add") @PostMapping(value = "/add")
public Result<?> add(@RequestBody ZyClothSample zyClothSample) { public Result<?> add(@RequestBody ZyClothSample zyClothSample) {
/*if (zyClothSample.getStyleId()==null){
return Result.error("款式不能为空");
}
if (zyClothSample.getModelSample()==null)
return Result.error("模块样板不能为空");*/
zyClothSampleService.save(zyClothSample); zyClothSampleService.save(zyClothSample);
return Result.OK("添加成功!"); return Result.OK("添加成功!");
} }
@ -96,8 +101,20 @@ public class ZyClothSampleController extends JeecgController<ZyClothSample, IZyC
@ApiOperation(value="成衣样板-编辑", notes="成衣样板-编辑") @ApiOperation(value="成衣样板-编辑", notes="成衣样板-编辑")
@PutMapping(value = "/edit") @PutMapping(value = "/edit")
public Result<?> edit(@RequestBody ZyClothSample zyClothSample) { 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); 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.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@ -38,13 +39,20 @@ public class ZyClothSample implements Serializable {
@Excel(name = "编号", width = 15) @Excel(name = "编号", width = 15)
@ApiModelProperty(value = "编号") @ApiModelProperty(value = "编号")
private String nums; private String nums;
/**款式*/
/**
* 款式
* 关联服装款式表 zy_cloths_style
* 把数据id转换成style_names 因为前端一些问题 这里已不在需要
*/
@Excel(name = "款式", width = 15) @Excel(name = "款式", width = 15)
@ApiModelProperty(value = "款式") @ApiModelProperty(value = "款式")
//@Dict(dicCode = "id",dictTable = "zy_cloths_style",dicText = "style_names")
private String styleId; private String styleId;
/**型号*/ /**型号*/
@Excel(name = "型号", width = 15) @Excel(name = "型号", width = 15)
@ApiModelProperty(value = "型号") @ApiModelProperty(value = "型号")
@Dict(dicCode = "modenumber", dictTable = "", dicText = "")
private String stylemodelId; private String stylemodelId;
/**管理模块样板*/ /**管理模块样板*/
@ -56,6 +64,7 @@ public class ZyClothSample implements Serializable {
@Excel(name = "模块样板", width = 15) @Excel(name = "模块样板", width = 15)
@ApiModelProperty(value = "模块样板") @ApiModelProperty(value = "模块样板")
@Dict(dicCode = "id",dictTable = "zy_module_sample",dicText = "module_name") @Dict(dicCode = "id",dictTable = "zy_module_sample",dicText = "module_name")
//@NotBlank(message = "模块样板不能为空")
private String modelSample; private String modelSample;
/**用户*/ /**用户*/
@Excel(name = "用户", width = 15) @Excel(name = "用户", width = 15)
@ -66,7 +75,14 @@ public class ZyClothSample implements Serializable {
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建日期") @ApiModelProperty(value = "创建日期")
private Date createTime; 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) @Excel(name = "成衣名称", width = 15)

Loading…
Cancel
Save