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

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"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type: getType}"
:loading="loading"
:customRow="rowAction"
@change="handleTableChange">
</a-table>
</div>
@@ -108,8 +109,8 @@
title: '选择商品',
ipagination: {
current: 1,
pageSize: 5,
pageSizeOptions: ['5', '10', '20', '30'],
pageSize: 10,
pageSizeOptions: ['10', '20', '30'],
showTotal: (total, range) => {
return range[0] + '-' + range[1] + ' 共' + total + '条'
},
@@ -275,6 +276,23 @@
},
modalFormOk() {
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"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange,type: getType}"
:loading="loading"
:customRow="rowAction"
@change="handleTableChange">
</a-table>
</div>
@@ -223,6 +224,23 @@
},
modalFormOk() {
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"
:pagination="ipagination"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: getType}">
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type: getType}"
:customRow="rowAction">
</a-table>
<!-- table区域-end -->
</a-modal>
@@ -117,6 +118,23 @@
}
}
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="关闭"
wrapClassName="ant-modal-cust-warp"
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-form :form="form">
<a-tabs default-active-key="1">
@@ -163,6 +168,7 @@
manyUnitStatus: true,
unitChecked: false,
model: {},
isReadOnly: false,
labelCol: {
xs: { span: 24 },
sm: { span: 8 },

View File

@@ -21,10 +21,10 @@
</div>
<!-- 操作按钮区域 -->
<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-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-button style="margin-left: 8px">
批量操作 <a-icon type="down" />
@@ -46,8 +46,8 @@
@change="handleTableChange">
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
<a-divider v-if="btnEnableList.indexOf(1)>-1" type="vertical" />
<a-popconfirm v-if="btnEnableList.indexOf(1)>-1" title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a-divider type="vertical" />
<a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
<a>删除</a>
</a-popconfirm>
</span>
@@ -119,14 +119,7 @@
},
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>

View File

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