Files
jshERP/jshERP-web/src/views/system/UnitList.vue
2023-09-22 00:33:42 +08:00

164 lines
5.9 KiB
Java

<template>
<a-row :gutter="24">
<a-col :md="24">
<a-card :style="cardStyle" :bordered="false">
<!-- 查询区域 -->
<div class="table-page-search-wrapper">
<!-- 搜索区域 -->
<a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24">
<a-col :md="6" :sm="24">
<a-form-item label="计量单位" :labelCol="labelCol" :wrapperCol="wrapperCol">
<a-input placeholder="请输入计量单位查询" v-model="queryParam.name"></a-input>
</a-form-item>
</a-col>
<span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
<a-col :md="6" :sm="24">
<a-button type="primary" @click="searchQuery">查询</a-button>
<a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
</a-col>
</span>
</a-row>
</a-form>
</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 v-if="btnEnableList.indexOf(1)>-1" @click="batchDel" icon="delete">删除</a-button>
<a-button v-if="btnEnableList.indexOf(1)>-1" @click="batchSetStatus(true)" icon="check-square">启用</a-button>
<a-button v-if="btnEnableList.indexOf(1)>-1" @click="batchSetStatus(false)" icon="close-square">禁用</a-button>
</div>
<!-- table区域-begin -->
<div>
<a-table
ref="table"
size="middle"
bordered
rowKey="id"
:columns="columns"
:dataSource="dataSource"
:pagination="ipagination"
:scroll="scroll"
:loading="loading"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@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>删除</a>
</a-popconfirm>
</span>
<!-- 状态渲染模板 -->
<template slot="customRenderFlag" slot-scope="enabled">
<a-tag v-if="enabled" color="green">启用</a-tag>
<a-tag v-if="!enabled" color="orange">禁用</a-tag>
</template>
</a-table>
</div>
<!-- table区域-end -->
<!-- 表单区域 -->
<unit-modal ref="modalForm" @ok="modalFormOk"></unit-modal>
</a-card>
</a-col>
</a-row>
</template>
<!-- b y 7 5 2 7 1 8 9 2 0 -->
<script>
import UnitModal from './modules/UnitModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JDate from '@/components/jeecg/JDate'
export default {
name: "UnitList",
mixins:[JeecgListMixin],
components: {
UnitModal,
JDate
},
data () {
return {
labelCol: {
span: 5
},
wrapperCol: {
span: 18,
offset: 1
},
// 查询条件
queryParam: {name:'',type:''},
// 表头
columns: [
{
title: '#',
dataIndex: '',
key:'rowIndex',
width:40,
align:"center",
customRender:function (t,r,index) {
return parseInt(index)+1;
}
},
{
title: '操作',
dataIndex: 'action',
width:100,
align:"center",
scopedSlots: { customRender: 'action' },
},
{ title: '计量单位', align:"left", dataIndex: 'name', width:200 },
{ title: '基本单位', align:"left", dataIndex: 'basicUnit', width:80 },
{ title: '副单位', align:"left", dataIndex: 'otherUnit', width:100,
customRender:function (t,r,index) {
if (r) {
return r.otherUnit + '=' + r.ratio + r.basicUnit;
}
}
},
{ title: '副单位2', align:"left", dataIndex: 'otherUnitTwo', width:100,
customRender:function (t,r,index) {
if (r) {
if(r.otherUnitTwo) {
return r.otherUnitTwo + '=' + r.ratioTwo + r.basicUnit;
}
}
}
},
{ title: '副单位3', align:"left", dataIndex: 'otherUnitThree', width:100,
customRender:function (t,r,index) {
if (r) {
if(r.otherUnitThree) {
return r.otherUnitThree + '=' + r.ratioThree + r.basicUnit;
}
}
}
},
{ title: '状态',dataIndex: 'enabled',width:60,align:"center",
scopedSlots: { customRender: 'customRenderFlag' }
}
],
url: {
list: "/unit/list",
delete: "/unit/delete",
deleteBatch: "/unit/deleteBatch",
batchSetStatusUrl: "/unit/batchSetStatus"
}
}
},
computed: {
},
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>
<style scoped>
@import '~@assets/less/common.less'
</style>