feature(管理后台): 商品列表

This commit is contained in:
luowenfeng
2022-09-21 15:57:32 +08:00
parent f122c0c509
commit fdb2d7339f
8 changed files with 535 additions and 248 deletions

View File

@@ -24,7 +24,8 @@
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
v-hasPermi="['system:dict:create']">新增</el-button>
v-hasPermi="['system:dict:create']">新增
</el-button>
</el-col>
<!-- <el-col :span="1.5">
<el-button type="warning" icon="el-icon-download" size="mini" @click="handleExport" :loading="exportLoading"
@@ -33,15 +34,15 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="dataList" >
<el-table-column label="规格值id" align="center" prop="id" />
<el-table-column label="规格值" align="center" prop="name" />
<el-table v-loading="loading" :data="dataList">
<el-table-column label="规格值id" align="center" prop="id"/>
<el-table-column label="规格值" align="center" prop="name"/>
<el-table-column label="状态" align="center" prop="status">
<template slot-scope="scope">
<dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status"/>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true" />
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"/>
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.createTime) }}</span>
@@ -50,9 +51,11 @@
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
v-hasPermi="['system:dict:update']">修改</el-button>
v-hasPermi="['system:dict:update']">修改
</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['system:dict:delete']">删除</el-button>
v-hasPermi="['system:dict:delete']">删除
</el-button>
</template>
</el-table-column>
</el-table>
@@ -64,10 +67,10 @@
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="90px">
<el-form-item label="规格值编码">
<el-input v-model="form.propertyId" :disabled="true" />
<el-input v-model="form.propertyId" :disabled="true"/>
</el-form-item>
<el-form-item label="规格值" prop="name">
<el-input v-model="form.name" placeholder="请输入数据标签" />
<el-input v-model="form.name" placeholder="请输入数据标签"/>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-radio-group v-model="form.status">
@@ -89,8 +92,15 @@
</template>
<script>
import { getPropertyList, getPropertyValuePage, createPropertyValue, updatePropertyValue, getPropertyValue, deletePropertyValue } from '@/api/mall/product/property'
import { getProperty } from "@/api/mall/product/property";
import {
createPropertyValue,
deletePropertyValue,
getProperty,
getPropertyList,
getPropertyValue,
getPropertyValuePage,
updatePropertyValue
} from '@/api/mall/product/property'
export default {
name: "PropertyValue",
@@ -127,10 +137,10 @@ export default {
// 表单校验
rules: {
name: [
{ required: true, message: "规格值不能为空", trigger: "blur" }
{required: true, message: "规格值不能为空", trigger: "blur"}
],
status: [
{ required: true, message: "状态不能为空", trigger: "blur" }
{required: true, message: "状态不能为空", trigger: "blur"}
]
},
@@ -210,7 +220,7 @@ export default {
});
},
/** 提交按钮 */
submitForm: function() {
submitForm: function () {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id !== undefined) {
@@ -232,23 +242,25 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id;
this.$modal.confirm('是否确认删除字典编码为"' + ids + '"的数据项?').then(function() {
return deletePropertyValue(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
this.$modal.confirm('是否确认删除字典编码为"' + ids + '"的数据项?').then(function () {
return deletePropertyValue(ids);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {
});
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
this.exportLoading = true;
return exportData(queryParams);
}).then(response => {
this.$download.excel(response, '字典数据.xls');
this.exportLoading = false;
}).catch(() => {});
this.exportLoading = true;
return exportData(queryParams);
}).then(response => {
this.$download.excel(response, '字典数据.xls');
this.exportLoading = false;
}).catch(() => {
});
}
}
};