功能优化:商品选择、按钮展示

This commit is contained in:
季圣华
2021-05-31 23:39:35 +08:00
parent 84682eef9f
commit 21633c673f
8 changed files with 82 additions and 21 deletions

View File

@@ -55,6 +55,7 @@
:pagination="ipagination" :pagination="ipagination"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type: getType}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type: getType}"
:loading="loading" :loading="loading"
:customRow="rowAction"
@change="handleTableChange"> @change="handleTableChange">
</a-table> </a-table>
</div> </div>
@@ -108,8 +109,8 @@
title: '选择商品', title: '选择商品',
ipagination: { ipagination: {
current: 1, current: 1,
pageSize: 5, pageSize: 10,
pageSizeOptions: ['5', '10', '20', '30'], pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => { showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条' return range[0] + '-' + range[1] + ' 共' + total + '条'
}, },
@@ -275,6 +276,23 @@
}, },
modalFormOk() { modalFormOk() {
this.loadData(); this.loadData();
},
rowAction(record, index) {
return {
on: {
click: () => {
let arr = []
arr.push(record.id)
this.selectedRowKeys = arr
},
dblclick: () => {
let arr = []
arr.push(record.id)
this.selectedRowKeys = arr
this.handleSubmit()
}
}
}
} }
} }
} }

View File

@@ -39,6 +39,7 @@
:pagination="ipagination" :pagination="ipagination"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type: getType}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type: getType}"
:loading="loading" :loading="loading"
:customRow="rowAction"
@change="handleTableChange"> @change="handleTableChange">
</a-table> </a-table>
</div> </div>
@@ -223,6 +224,23 @@
}, },
modalFormOk() { modalFormOk() {
this.loadData(); this.loadData();
},
rowAction(record, index) {
return {
on: {
click: () => {
let arr = []
arr.push(record.id)
this.selectedRowKeys = arr
},
dblclick: () => {
let arr = []
arr.push(record.id)
this.selectedRowKeys = arr
this.handleSubmit()
}
}
}
} }
} }
} }

View File

@@ -18,7 +18,8 @@
:dataSource="dataSource" :dataSource="dataSource"
:pagination="ipagination" :pagination="ipagination"
:loading="loading" :loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: getType}"> :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: getType}"
:customRow="rowAction">
</a-table> </a-table>
<!-- table区域-end --> <!-- table区域-end -->
</a-modal> </a-modal>
@@ -117,6 +118,23 @@
} }
} }
this.selectBillIds = billIds.substring(1); this.selectBillIds = billIds.substring(1);
},
rowAction(record, index) {
return {
on: {
click: () => {
let arr = []
arr.push(record.id)
this.selectedRowKeys = arr
},
dblclick: () => {
let arr = []
arr.push(record.id)
this.selectedRowKeys = arr
this.handleOk()
}
}
}
} }
} }
} }

View File

@@ -225,6 +225,14 @@
} }
} }
}) })
},
handleEdit: function (record) {
this.$refs.modalForm.edit(record);
this.$refs.modalForm.title = "编辑";
this.$refs.modalForm.disableSubmit = false;
if(this.btnEnableList.indexOf(1)===-1) {
this.$refs.modalForm.isReadOnly = true
}
} }
} }
} }

View File

@@ -9,6 +9,11 @@
cancelText="关闭" cancelText="关闭"
wrapClassName="ant-modal-cust-warp" wrapClassName="ant-modal-cust-warp"
style="top:5%;height: 100%;overflow-y: hidden"> style="top:5%;height: 100%;overflow-y: hidden">
<template slot="footer">
<a-button key="back" v-if="isReadOnly" @click="handleCancel">
关闭
</a-button>
</template>
<a-spin :spinning="confirmLoading"> <a-spin :spinning="confirmLoading">
<a-form :form="form"> <a-form :form="form">
<a-tabs default-active-key="1"> <a-tabs default-active-key="1">
@@ -163,6 +168,7 @@
manyUnitStatus: true, manyUnitStatus: true,
unitChecked: false, unitChecked: false,
model: {}, model: {},
isReadOnly: false,
labelCol: { labelCol: {
xs: { span: 24 }, xs: { span: 24 },
sm: { span: 8 }, sm: { span: 8 },

View File

@@ -21,10 +21,10 @@
</div> </div>
<!-- 操作按钮区域 --> <!-- 操作按钮区域 -->
<div class="table-operator" style="margin-top: 5px"> <div class="table-operator" style="margin-top: 5px">
<a-button v-if="btnEnableList.indexOf(1)>-1" @click="handleAdd" type="primary" icon="plus">新增</a-button> <a-button @click="handleAdd" type="primary" icon="plus">新增</a-button>
<a-dropdown v-if="selectedRowKeys.length > 0"> <a-dropdown v-if="selectedRowKeys.length > 0">
<a-menu slot="overlay"> <a-menu slot="overlay">
<a-menu-item key="1" v-if="btnEnableList.indexOf(1)>-1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item> <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>
</a-menu> </a-menu>
<a-button style="margin-left: 8px"> <a-button style="margin-left: 8px">
批量操作 <a-icon type="down" /> 批量操作 <a-icon type="down" />
@@ -46,8 +46,8 @@
@change="handleTableChange"> @change="handleTableChange">
<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 v-if="btnEnableList.indexOf(1)>-1" type="vertical" /> <a-divider type="vertical" />
<a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a> <a>删除</a>
</a-popconfirm> </a-popconfirm>
</span> </span>
@@ -119,14 +119,7 @@
}, },
methods: { methods: {
handleEdit: function (record) {
this.$refs.modalForm.edit(record);
this.$refs.modalForm.title = "编辑";
this.$refs.modalForm.disableSubmit = false;
if(this.btnEnableList.indexOf(1)===-1) {
this.$refs.modalForm.isReadOnly = true
}
}
} }
} }
</script> </script>

View File

@@ -45,10 +45,10 @@
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange"> @change="handleTableChange">
<span slot="action" slot-scope="text, record"> <span slot="action" slot-scope="text, record">
<a v-if="btnEnableList.indexOf(1)>-1" @click="handleSetFunction(record)">分配功能</a> <a @click="handleSetFunction(record)">分配功能</a>
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" /> <a-divider type="vertical" />
<a v-if="btnEnableList.indexOf(1)>-1" @click="handleSetPushBtn(record.id)">分配按钮</a> <a @click="handleSetPushBtn(record.id)">分配按钮</a>
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" /> <a-divider type="vertical" />
<a @click="handleEdit(record)">编辑</a> <a @click="handleEdit(record)">编辑</a>
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" /> <a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" />
<a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定删除吗?" @confirm="() => handleDelete(record.id)">

View File

@@ -59,8 +59,8 @@
<a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定删除吗?" @confirm="() => handleDelete(record.id)"> <a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a> <a>删除</a>
</a-popconfirm> </a-popconfirm>
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical"/> <a-divider type="vertical"/>
<a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定重置密码为123456吗?" @confirm="() => handleReset(record.id)"> <a-popconfirm title="确定重置密码为123456吗?" @confirm="() => handleReset(record.id)">
<a>重置密码</a> <a>重置密码</a>
</a-popconfirm> </a-popconfirm>
</span> </span>