|
@@ -1,6 +1,12 @@
|
|
|
<template>
|
|
|
<div class="app-container">
|
|
|
- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
|
|
|
+ <el-form
|
|
|
+ :model="queryParams"
|
|
|
+ ref="queryForm"
|
|
|
+ :inline="true"
|
|
|
+ v-show="showSearch"
|
|
|
+ label-width="68px"
|
|
|
+ >
|
|
|
<el-form-item label="分类名称" prop="productName">
|
|
|
<el-input
|
|
|
v-model="queryParams.productName"
|
|
@@ -10,15 +16,24 @@
|
|
|
@keyup.enter.native="handleQuery"
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="父节点" prop="pid">
|
|
|
- <el-input
|
|
|
- v-model="queryParams.pid"
|
|
|
- placeholder="请输入父节点"
|
|
|
- clearable
|
|
|
- size="small"
|
|
|
- @keyup.enter.native="handleQuery"
|
|
|
- />
|
|
|
- </el-form-item>
|
|
|
+ <el-form-item label="父节点" prop="pid">
|
|
|
+ <el-select
|
|
|
+ v-model="queryParams.pid"
|
|
|
+ placeholder="请输入父节点"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ label="无"
|
|
|
+ value="0"
|
|
|
+ ></el-option>
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in infoListFa"
|
|
|
+ :key="index"
|
|
|
+ :label="item.productName"
|
|
|
+ :value="item.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="分类描述" prop="describe">
|
|
|
<el-input
|
|
|
v-model="queryParams.describe"
|
|
@@ -29,8 +44,16 @@
|
|
|
/>
|
|
|
</el-form-item>
|
|
|
<el-form-item>
|
|
|
- <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
|
|
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
|
|
+ <el-button
|
|
|
+ type="cyan"
|
|
|
+ icon="el-icon-search"
|
|
|
+ size="mini"
|
|
|
+ @click="handleQuery"
|
|
|
+ >搜索</el-button
|
|
|
+ >
|
|
|
+ <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
|
|
|
+ >重置</el-button
|
|
|
+ >
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
|
|
@@ -42,7 +65,8 @@
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
|
v-hasPermi="['product:info:add']"
|
|
|
- >新增</el-button>
|
|
|
+ >新增</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -52,7 +76,8 @@
|
|
|
:disabled="single"
|
|
|
@click="handleUpdate"
|
|
|
v-hasPermi="['product:info:edit']"
|
|
|
- >修改</el-button>
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -62,7 +87,8 @@
|
|
|
:disabled="multiple"
|
|
|
@click="handleDelete"
|
|
|
v-hasPermi="['product:info:remove']"
|
|
|
- >删除</el-button>
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
<el-col :span="1.5">
|
|
|
<el-button
|
|
@@ -71,19 +97,33 @@
|
|
|
size="mini"
|
|
|
@click="handleExport"
|
|
|
v-hasPermi="['product:info:export']"
|
|
|
- >导出</el-button>
|
|
|
+ >导出</el-button
|
|
|
+ >
|
|
|
</el-col>
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ <right-toolbar
|
|
|
+ :showSearch.sync="showSearch"
|
|
|
+ @queryTable="getList"
|
|
|
+ ></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
- <el-table v-loading="loading" :data="infoList" @selection-change="handleSelectionChange">
|
|
|
+ <el-table
|
|
|
+ v-loading="loading"
|
|
|
+ :data="infoList"
|
|
|
+ @selection-change="handleSelectionChange"
|
|
|
+ >
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="主键" align="center" prop="id" />
|
|
|
<el-table-column label="分类名称" align="center" prop="productName" />
|
|
|
<el-table-column label="父节点" align="center" prop="pid" />
|
|
|
<el-table-column label="分类描述" align="center" prop="describe" />
|
|
|
<el-table-column label="状态" align="center" prop="status" />
|
|
|
- <el-table-column fixed='right' width="150" label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
+ <el-table-column
|
|
|
+ fixed="right"
|
|
|
+ width="150"
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ class-name="small-padding fixed-width"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
size="mini"
|
|
@@ -91,20 +131,22 @@
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['product:info:edit']"
|
|
|
- >修改</el-button>
|
|
|
+ >修改</el-button
|
|
|
+ >
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
v-hasPermi="['product:info:remove']"
|
|
|
- >删除</el-button>
|
|
|
+ >删除</el-button
|
|
|
+ >
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
|
|
|
<pagination
|
|
|
- v-show="total>0"
|
|
|
+ v-show="total > 0"
|
|
|
:total="total"
|
|
|
:page.sync="queryParams.pageNum"
|
|
|
:limit.sync="queryParams.pageSize"
|
|
@@ -118,10 +160,28 @@
|
|
|
<el-input v-model="form.productName" placeholder="请输入分类名称" />
|
|
|
</el-form-item>
|
|
|
<el-form-item label="父节点" prop="pid">
|
|
|
- <el-input v-model="form.pid" placeholder="请输入父节点" />
|
|
|
+ <el-select
|
|
|
+ v-model="form.pid"
|
|
|
+ placeholder="请输入父节点"
|
|
|
+ clearable
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ label="无"
|
|
|
+ value="0"
|
|
|
+ ></el-option>
|
|
|
+ <el-option
|
|
|
+ v-for="(item, index) in infoListFa"
|
|
|
+ :key="index"
|
|
|
+ :label="item.productName"
|
|
|
+ :value="item.id"
|
|
|
+ ></el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="分类描述,该分类名称的描述" prop="describe">
|
|
|
- <el-input v-model="form.describe" placeholder="请输入分类描述,该分类名称的描述" />
|
|
|
+ <el-form-item label="分类描述" prop="describe">
|
|
|
+ <el-input
|
|
|
+ v-model="form.describe"
|
|
|
+ placeholder="请输入分类描述,该分类名称的描述"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
@@ -133,7 +193,14 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo } from "@/api/product/info";
|
|
|
+import {
|
|
|
+ listInfo,
|
|
|
+ getInfo,
|
|
|
+ delInfo,
|
|
|
+ addInfo,
|
|
|
+ updateInfo,
|
|
|
+ exportInfo
|
|
|
+} from "@/api/product/info";
|
|
|
|
|
|
export default {
|
|
|
name: "Info",
|
|
@@ -153,6 +220,7 @@ export default {
|
|
|
total: 0,
|
|
|
// 品类表格数据
|
|
|
infoList: [],
|
|
|
+ infoListFa: [],
|
|
|
// 弹出层标题
|
|
|
title: "",
|
|
|
// 是否显示弹出层
|
|
@@ -167,8 +235,7 @@ export default {
|
|
|
|
|
|
describe: null,
|
|
|
|
|
|
- status: null,
|
|
|
-
|
|
|
+ status: null
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
@@ -179,9 +246,12 @@ export default {
|
|
|
],
|
|
|
|
|
|
status: [
|
|
|
- { required: true, message: "状态 0:有效(默认)、1:失效 不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
-
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: "状态 0:有效(默认)、1:失效 不能为空",
|
|
|
+ trigger: "blur"
|
|
|
+ }
|
|
|
+ ]
|
|
|
}
|
|
|
};
|
|
|
},
|
|
@@ -197,6 +267,11 @@ export default {
|
|
|
this.total = response.total;
|
|
|
this.loading = false;
|
|
|
});
|
|
|
+ listInfo({
|
|
|
+ pid: 0
|
|
|
+ }).then(response => {
|
|
|
+ this.infoListFa = response.rows;
|
|
|
+ });
|
|
|
},
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
@@ -218,8 +293,7 @@ export default {
|
|
|
|
|
|
updateTime: null,
|
|
|
|
|
|
- status: 0,
|
|
|
-
|
|
|
+ status: 0
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
@@ -235,9 +309,9 @@ export default {
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.id)
|
|
|
- this.single = selection.length!==1
|
|
|
- this.multiple = !selection.length
|
|
|
+ this.ids = selection.map(item => item.id);
|
|
|
+ this.single = selection.length !== 1;
|
|
|
+ this.multiple = !selection.length;
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
@@ -248,7 +322,7 @@ export default {
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
- const id = row.id || this.ids
|
|
|
+ const id = row.id || this.ids;
|
|
|
getInfo(id).then(response => {
|
|
|
this.form = response.data;
|
|
|
this.open = true;
|
|
@@ -279,28 +353,32 @@ export default {
|
|
|
handleDelete(row) {
|
|
|
const ids = row.id || this.ids;
|
|
|
this.$confirm('是否确认删除品类编号为"' + ids + '"的数据项?', "警告", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- }).then(function() {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(function() {
|
|
|
return delInfo(ids);
|
|
|
- }).then(() => {
|
|
|
+ })
|
|
|
+ .then(() => {
|
|
|
this.getList();
|
|
|
this.msgSuccess("删除成功");
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
|
const queryParams = this.queryParams;
|
|
|
- this.$confirm('是否确认导出所有品类数据项?', "警告", {
|
|
|
- confirmButtonText: "确定",
|
|
|
- cancelButtonText: "取消",
|
|
|
- type: "warning"
|
|
|
- }).then(function() {
|
|
|
+ this.$confirm("是否确认导出所有品类数据项?", "警告", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ })
|
|
|
+ .then(function() {
|
|
|
return exportInfo(queryParams);
|
|
|
- }).then(response => {
|
|
|
- this.download(response.data);
|
|
|
})
|
|
|
+ .then(response => {
|
|
|
+ this.download(response.data);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|