|
|
@@ -19,7 +19,7 @@
|
|
|
<el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleQuery">查找</el-button>
|
|
|
<el-button class="filter-item" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
|
|
<el-button class="filter-item" type="primary" icon="el-icon-plus" @click="handleAdd">添加</el-button>
|
|
|
- <el-button class="filter-item" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
|
|
|
+ <el-button class="filter-item" v-waves icon="el-icon-download" @click="handleDownLoad">导出</el-button>
|
|
|
<el-button class="filter-item" type="info" icon="el-icon-sort" @click="toggleExpandAll">展开/折叠</el-button>
|
|
|
|
|
|
</div>
|
|
|
@@ -34,7 +34,7 @@
|
|
|
>
|
|
|
<el-table-column prop="categoryCode" label="类型编号" align="center"></el-table-column>
|
|
|
<el-table-column prop="categoryName" label="类型名称" min-width="180px"></el-table-column>
|
|
|
- <!-- <el-table-column prop="categoryParentId" label="备注" align="center"></el-table-column> -->
|
|
|
+ <!-- <el-table-column prop="parentId" label="备注" align="center"></el-table-column> -->
|
|
|
<el-table-column label="创建时间" align="center" prop="createDate">
|
|
|
</el-table-column>
|
|
|
<el-table-column label="操作" align="center" min-width="110px">
|
|
|
@@ -50,7 +50,7 @@
|
|
|
@click="handleAdd(scope.row)"
|
|
|
>添加</el-button>
|
|
|
<el-button
|
|
|
- v-if="scope.row.categoryParentId != 0"
|
|
|
+ v-if="!scope.row.children"
|
|
|
size="small"
|
|
|
type="danger"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
@@ -63,16 +63,16 @@
|
|
|
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
<el-row>
|
|
|
- <el-col :span="24" v-if="form.categoryParentId">
|
|
|
- <el-form-item label="上级名称" prop="categoryParentId">
|
|
|
- <treeselect default-expand-all v-model="form.categoryParentId" @select="departTreeSelected" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级类型" />
|
|
|
+ <el-col :span="24" v-if="isShowParent">
|
|
|
+ <el-form-item label="上级名称" prop="parentId">
|
|
|
+ <treeselect v-model="form.parentId" @select="departTreeSelected" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级类型" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-row>
|
|
|
- <el-col :span="24" v-if="form.categoryParentId">
|
|
|
- <el-form-item label="上级编号" prop="categoryParentId">
|
|
|
- <el-input v-model="form.categoryParentId" readonly />
|
|
|
+ <el-col :span="24" v-if="isShowParent">
|
|
|
+ <el-form-item label="上级编号" prop="categoryParentCode">
|
|
|
+ <el-input v-model="form.categoryParentCode" readonly />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -109,6 +109,7 @@
|
|
|
directives: { waves },
|
|
|
data() {
|
|
|
return {
|
|
|
+ isShowParent:false,
|
|
|
downloadLoading: false,
|
|
|
// 遮罩层
|
|
|
loading: true,
|
|
|
@@ -133,7 +134,7 @@
|
|
|
form: {},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
- categoryParentId: [
|
|
|
+ parentId: [
|
|
|
{ required: true, message: "上级类型不能为空", trigger: "blur" }
|
|
|
],
|
|
|
categoryParentCode: [
|
|
|
@@ -158,7 +159,7 @@
|
|
|
this.form.categoryParentCode = node.categoryCode;
|
|
|
},
|
|
|
handleDownLoad(){
|
|
|
- window.location.href = process.env.BASE_API + '/product-category/export/category?categoryCode=' + this.listQuery.categoryCode + '&categoryName=' + this.listQuery.categoryName;
|
|
|
+ window.location.href = process.env.BASE_API + '/product-category/export/category?categoryCode=' + this.listQuery.categoryCode + '&categoryName=' + this.listQuery.categoryCode;
|
|
|
},
|
|
|
/** 查询类别列表 */
|
|
|
getList() {
|
|
|
@@ -189,14 +190,10 @@
|
|
|
reset() {
|
|
|
this.form = {
|
|
|
id: undefined,
|
|
|
- categoryParentId: undefined,
|
|
|
+ parentId: undefined,
|
|
|
+ categoryParentCode:undefined,
|
|
|
categoryName: undefined,
|
|
|
categoryCode: undefined,
|
|
|
- categoryParentId:undefined,
|
|
|
- leader: undefined,
|
|
|
- phone: undefined,
|
|
|
- email: undefined,
|
|
|
- status: "0"
|
|
|
};
|
|
|
this.resetForm("form");
|
|
|
},
|
|
|
@@ -215,8 +212,11 @@
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd(row) {
|
|
|
this.reset();
|
|
|
+ this.isShowParent = false;
|
|
|
if (row.id) {
|
|
|
- this.form.categoryParentId = row.id;
|
|
|
+ this.isShowParent = true;
|
|
|
+ this.form.parentId = row.id;
|
|
|
+ this.form.categoryParentCode = row.categoryCode;
|
|
|
}
|
|
|
this.open = true;
|
|
|
this.title = "添加类别";
|
|
|
@@ -235,19 +235,28 @@
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
this.reset();
|
|
|
+ this.isShowParent = false;
|
|
|
getDept({id:row.id}).then(response => {
|
|
|
- this.form = response.data.data;
|
|
|
+ let data = response.data.data;
|
|
|
+ this.form = data;
|
|
|
+ if (data.categoryParentId) {
|
|
|
+ this.isShowParent = true;
|
|
|
+ }
|
|
|
this.open = true;
|
|
|
this.title = "修改类别";
|
|
|
- listDeptExcludeChild({id:row.id}).then(response => {
|
|
|
+ listDept().then(response => {
|
|
|
this.deptOptions = this.handleTree(response.data.data, "id");
|
|
|
- if (this.deptOptions.length == 0) {
|
|
|
- const noResultsOptions = { id: this.form.categoryParentId, children: [] };
|
|
|
- // const noResultsOptions = { id: this.form.categoryParentId, categoryName: this.form.parentName, children: [] };
|
|
|
- this.deptOptions.push(noResultsOptions);
|
|
|
- }
|
|
|
});
|
|
|
+ // listDeptExcludeChild({id:row.id}).then(response => {
|
|
|
+ // this.deptOptions = this.handleTree(response.data.data, "id");
|
|
|
+ // if (this.deptOptions.length == 0) {
|
|
|
+ // const noResultsOptions = { id: this.form.parentId, children: [] };
|
|
|
+ // // const noResultsOptions = { id: this.form.parentId, categoryName: this.form.parentName, children: [] };
|
|
|
+ // this.deptOptions.push(noResultsOptions);
|
|
|
+ // }
|
|
|
+ // });
|
|
|
});
|
|
|
+
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm: function() {
|
|
|
@@ -281,6 +290,7 @@
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
+ console.log(row);
|
|
|
this.$confirm('是否确认删除名称为"' + row.categoryName + '"的数据项?', "提示", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|