优化商品模块,使其能自动加载扩展字段的别名

This commit is contained in:
jishenghua
2025-03-25 23:45:36 +08:00
parent ecfbd396af
commit 0a3ce706c5
7 changed files with 67 additions and 72 deletions

View File

@@ -3,25 +3,6 @@
<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="8">
<a-form-item label="名称" :labelCol="{span: 5}" :wrapperCol="{span: 18, offset: 1}">
<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>
<!-- table区域-begin -->
<div>
<a-table
@@ -37,11 +18,6 @@
<span slot="action" slot-scope="text, record">
<a @click="handleEdit(record)">编辑</a>
</span>
<!-- 状态渲染模板 -->
<template slot="customRenderFlag" slot-scope="enabled">
<a-tag v-if="enabled==1" color="green">启用</a-tag>
<a-tag v-if="enabled==0" color="orange">禁用</a-tag>
</template>
</a-table>
</div>
<!-- table区域-end -->
@@ -55,6 +31,8 @@
import MaterialPropertyModal from './modules/MaterialPropertyModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JDate from '@/components/jeecg/JDate'
import { getAction } from '@/api/manage'
import Vue from 'vue'
export default {
name: "MaterialPropertyList",
mixins:[JeecgListMixin],
@@ -88,16 +66,11 @@
{
title: '操作',
dataIndex: 'action',
width: 200,
width: 100,
align:"center",
scopedSlots: { customRender: 'action' },
},
{title: '名称', dataIndex: 'nativeName', width: 100},
{
title: '是否启用', dataIndex: 'enabled', width: 100, align: "center",
scopedSlots: { customRender: 'customRenderFlag' }
},
{title: '排序', dataIndex: 'sort', width: 100},
{title: '别名', dataIndex: 'anotherName', width: 100}
],
url: {
@@ -111,7 +84,23 @@
},
methods: {
loadData(arg) {
let params = this.getQueryParams() //查询条件
this.loading = true
getAction(this.url.list, params).then((res) => {
if (res.code===200) {
this.dataSource = res.data.rows
this.ipagination.total = res.data.total
Vue.ls.set('materialPropertyList', res.data.rows, 7 * 24 * 60 * 60 * 1000);
} else if(res.code===510){
this.$message.warning(res.data)
} else {
this.$message.warning(res.data.message)
}
this.loading = false
this.onClearSelected()
})
},
}
}
</script>