服装智能制造软件平台V3.0 http://182.92.169.222/hhxy/#/user/login
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

264 lines
9.3 KiB

<template>
<a-card :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
</a-row>
</a-form>
</div>
<!-- 查询区域-END -->
<!-- table区域-begin -->
<div>
<j-vxe-table
toolbar
:toolbarConfig="toolbarConfig"
row-number
row-selection
keep-source
async-remove
:height="340"
:loading="loading"
:columns="columns"
:dataSource="dataSource"
:pagination="pagination"
style="margin-top: 8px;"
@pageChange="handlePageChange"
@selectRowChange="handleSelectRowChange"
>
<template v-slot:action="props">
<a @click="submitForm(props)">保存</a>
<a-divider type="vertical"/>
<a-popconfirm title="确定删除吗?" @confirm="handleDelete(props.rowId)">
<a>删除</a>
</a-popconfirm>
</template>
</j-vxe-table>
</div>
<zy-style-model-modal ref="modalForm" @ok="modalFormOk"></zy-style-model-modal>
</a-card>
</template>
<script>
import '@/assets/less/TableExpand.less'
import { JVXETypes } from '@/components/jeecg/JVxeTable'
import { mixinDevice } from '@/utils/mixin'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import ZyStyleModelModal from './modules/ZyStyleModelModal'
import {deleteAction, getAction, postAction, putAction, postFormAction, httpAction} from "@api/manage";
import store from "@/store";
import { validateDuplicateValue } from '@/utils/util'
export default {
name: 'ZyStyleModelList',
mixins:[JeecgListMixin, mixinDevice],
components: {
ZyStyleModelModal
},
data () {
return {
description: 'zy_style_model管理页面',
// 表头
// 工具栏的按钮配置
toolbarConfig: {
// add 新增按钮;remove 删除按钮;clearSelection 清空选择按钮
btn: ['add']
},
validatorRules: {
styleId: [
{ required: true, message: '请选择服装类型!'},
],
},
// 是否正在加载
loading: false,
// 分页器参数
pagination: {
// 当前页码
current: 1,
// 每页的条数
pageSize: 10,
// 可切换的条数
pageSizeOptions: ['10', '20', '30', '100', '200'],
// 数据总数(目前并不知道真实的总数,所以先填写0,在后台查出来后再赋值)
total: 0,
},
// 选择的行
selectedRows: [],
// 数据源,控制表格的数据
dataSource: [],
columns: [
{
title: '款式',
width: '150px',
fixed: 'left',
key: 'styleId',
type: JVXETypes.select,
placeholder: '请输入${title}',
dictCode: 'zy_cloths_style,style_names,id',
validateRules: [{required: true, message: '${title}不能为空'}]
},
{
title:'是否默认尺码',
align:"center",
width: '150px',
key: 'isdefault',
type: JVXETypes.select,
dictCode: 'isdefault',
defaultValue : 0,
},
{key: 'modelNumber', title: '型号编码', dictCode: 'modenumber',width: '120px', type: JVXETypes.select},
{key: 'size', title: '码数', width: '100px',dictCode: 'size', type: JVXETypes.select},
{key: 'anumbers', title: '型', width: '100px',dictCode: 'xsize', type: JVXETypes.select},
{key: 'bnumbers', title: '号', width: '100px',dictCode: 'hsize', type: JVXETypes.select},
{key: 'collarLarge', title: '领大', width: '80px', type: JVXETypes.input},
{key: 'bust', title: '胸围', width: '80px', type: JVXETypes.input},
{key: 'sleeveLength', title: '袖长', width: '80px', type: JVXETypes.input},
{key: 'shslLength', title: '连肩袖长', width: '100px', type: JVXETypes.input},
{key: 'tsWidth', title: '总肩宽', width: '80px', type: JVXETypes.input},
{key: 'cuff', title: '袖口', width: '80px', type: JVXETypes.input},
{key: 'waistline', title: '腰围', width: '80px', type: JVXETypes.input},
{key: 'hem', title: '下摆', width: '80px', type: JVXETypes.input},
{
title: '操作',
key: 'action',
type: JVXETypes.slot,
fixed: 'right',
minWidth: '100px',
align: 'center',
slotName: 'action',
}
],
url: {
list: "/zystylemodel/zyStyleModel/list",
delete: "/zystylemodel/zyStyleModel/delete",
add: "/zystylemodel/zyStyleModel/add",
edit: "/zystylemodel/zyStyleModel/edit",
deleteBatch: "/zystylemodel/zyStyleModel/deleteBatch",
exportXlsUrl: "/zystylemodel/zyStyleModel/exportXls",
importExcelUrl: "zystylemodel/zyStyleModel/importExcel",
},
rowId:'',
dictOptions:{},
superFieldList:[],
}
},
created() {
this.loadData();
//备份model原始值
this.modelDefault = JSON.parse(JSON.stringify(this.model));
},
computed: {
importExcelUrl: function(){
return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
},
},
methods: {
handleDelete: function (id) {
if(!this.url.delete){
this.$message.error("请设置url.delete属性!")
return
}
var that = this;
deleteAction(that.url.delete, {id: id}).then((res) => {
if (res.success) {
//重新计算分页问题
that.reCalculatePage(1)
that.$message.success(res.message);
that.loadData();
} else {
that.$message.warning(res.message);
}
});
},
submitForm (props) {
this.model = Object.assign({}, props);
// console.log(props.rowId)
// console.log(this.model)
var str = props.rowId;
let httpurl = '';
let method = '';
if (str.search("row") != -1) {
httpurl += this.url.add;
method = 'post';
} else {
httpurl += this.url.edit;
method = 'put';
}
httpAction(httpurl, props.row, method).then((res) => {
if (res.success) {
this.$message.success(res.message);
this.$emit('ok');
} else {
this.$message.warning(res.message);
}
})
},
// 加载数据
loadData() {
// 封装查询条件
let formData = {
pageNo: this.pagination.current,
pageSize: this.pagination.pageSize
}
// 调用查询数据接口
this.loading = true
getAction(this.url.list, formData).then(res => {
if (res.success) {
// 后台查询回来的 total,数据总数量
this.pagination.total = res.result.total
// 将查询的数据赋值给 dataSource
this.dataSource = res.result.records
console.log(this.dataSource,'aaa')
// 重置选择
this.selectedRows = []
} else {
this.$error({title: '主表查询失败', content: res.message})
}
}).finally(() => {
// 这里是无论成功或失败都会执行的方法,在这里关闭loading
this.loading = false
})
},
// 当分页参数变化时触发的事件
handlePageChange(event) {
// 重新赋值
this.pagination.current = event.current
this.pagination.pageSize = event.pageSize
// 查询数据
this.loadData()
},
initDictConfig(){
},
getSuperFieldList(){
let fieldList=[];
fieldList.push({type:'string',value:'styleId',text:'款式id',dictCode:''})
fieldList.push({type:'int',value:'isdefault',text:'是否默认尺码',dictCode:''})
fieldList.push({type:'int',value:'modelNumber',text:'型号编码',dictCode:''})
fieldList.push({type:'int',value:'size',text:'码数',dictCode:''})
fieldList.push({type:'string',value:'anumbers',text:'型',dictCode:''})
fieldList.push({type:'string',value:'bnumbers',text:'号',dictCode:''})
fieldList.push({type:'double',value:'collarLarge',text:'领大',dictCode:''})
fieldList.push({type:'double',value:'bust',text:'胸围',dictCode:''})
fieldList.push({type:'double',value:'sleeveLength',text:'袖长',dictCode:''})
fieldList.push({type:'double',value:'shslLength',text:'连肩袖长',dictCode:''})
fieldList.push({type:'double',value:'tsWidth',text:'总肩宽',dictCode:''})
fieldList.push({type:'double',value:'cuff',text:'袖口',dictCode:''})
fieldList.push({type:'double',value:'waistline',text:'腰围',dictCode:''})
fieldList.push({type:'double',value:'hem',text:'下摆',dictCode:''})
this.superFieldList = fieldList
}
}
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>