12
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
import request from '@/utils/request'
|
import request from '@/utils/request'
|
||||||
var service_name = 'oil-mall'
|
var service_name = 'oil-mall'
|
||||||
export default {
|
export default {
|
||||||
|
classifySave(page) {
|
||||||
|
return request({
|
||||||
|
url: `/${service_name}/mallProductClassification/save`,
|
||||||
|
method: 'post',
|
||||||
|
data: page
|
||||||
|
})
|
||||||
|
},
|
||||||
classifyGetByPage(page) { // 分页查询
|
classifyGetByPage(page) { // 分页查询
|
||||||
return request({
|
return request({
|
||||||
url: `/${service_name}/mallProductClassification/getByPage`,
|
url: `/${service_name}/mallProductClassification/getByPage`,
|
||||||
@@ -35,6 +42,13 @@ delete(page) {
|
|||||||
data: page
|
data: page
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
classifyDelete(page) {
|
||||||
|
return request({
|
||||||
|
url: `/${service_name}/mallProductClassification/delete`,
|
||||||
|
method: 'post',
|
||||||
|
data: page
|
||||||
|
})
|
||||||
|
},
|
||||||
typeSave(page) {
|
typeSave(page) {
|
||||||
return request({
|
return request({
|
||||||
url: `/${service_name}/mallProductAttributesType/save`,
|
url: `/${service_name}/mallProductAttributesType/save`,
|
||||||
|
|||||||
@@ -1,47 +1,26 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<el-form ref="editPram" :model="editPram" label-width="130px">
|
<el-form ref="editPram" :model="editPram" label-width="130px">
|
||||||
<el-form-item
|
<el-form-item label="分类名称" prop="categoryName" :rules="[{ required: true, message: '请输入分类名称', trigger: ['blur', 'change'] }]">
|
||||||
label="分类名称"
|
<el-input v-model="editPram.categoryName" placeholder="分类名称" />
|
||||||
prop="name"
|
|
||||||
:rules="[{ required:true,message:'请输入分类名称',trigger:['blur','change'] }]"
|
|
||||||
>
|
|
||||||
<el-input v-model="editPram.name" placeholder="分类名称" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="URL">
|
<el-form-item v-if="editPram.parentCategoryName" label="父级" >
|
||||||
<el-input v-model="editPram.url" placeholder="URL" />
|
{{ editPram.parentCategoryName }}
|
||||||
</el-form-item> -->
|
|
||||||
<el-form-item label="父级" >
|
|
||||||
<el-cascader v-model="editPram.pid" :options="parentOptions" :props="categoryProps" style="width:100%" />
|
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="菜单图标" >
|
<el-form-item label="分类图标(180*180)">
|
||||||
<el-input placeholder="请选择菜单图标" v-model="editPram.extra">
|
|
||||||
<el-button slot="append" icon="el-icon-circle-plus-outline" @click="addIcon"></el-button>
|
|
||||||
</el-input>
|
|
||||||
</el-form-item> -->
|
|
||||||
<!-- <el-form-item label="分类图标(180*180)">
|
|
||||||
<div class="upLoadPicBox" @click="modalPicTap('1')">
|
<div class="upLoadPicBox" @click="modalPicTap('1')">
|
||||||
<div v-if="editPram.extra" class="pictrue">
|
<upload :photo="editPram.icon" @success="uploadSuccess" tip="图标尺寸为18*18比例,大小不能超过200KB,图片只能为jpg、png、gif格式"></upload>
|
||||||
<img :src="editPram.extra">
|
|
||||||
</div>
|
|
||||||
<div v-else class="upLoad">
|
|
||||||
<i class="el-icon-camera cameraIconfont" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</el-form-item> -->
|
</el-form-item>
|
||||||
<el-form-item label="排序">
|
<el-form-item label="排序">
|
||||||
<el-input-number v-model="editPram.sort" :min="0"/>
|
<el-input-number v-model="editPram.sort" :min="0" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态">
|
<el-form-item label="状态">
|
||||||
<el-switch v-model="editPram.status" active-text="显示"
|
<el-switch v-model="editPram.showFlag" active-text="显示" inactive-text="隐藏" :active-value="1"
|
||||||
inactive-text="隐藏" :active-value="true" :inactive-value="false" />
|
:inactive-value="2" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="扩展字段" >
|
|
||||||
<el-input v-model="editPram.extra" type="textarea" placeholder="扩展字段" />
|
|
||||||
</el-form-item> -->
|
|
||||||
<el-form-item>
|
<el-form-item>
|
||||||
<el-button type="primary" :loading="loadingBtn" @click="handlerSubmit('editPram')">确定</el-button>
|
<el-button type="primary" :loading="loadingBtn" @click="handlerSubmit">确定</el-button>
|
||||||
<el-button @click="close">取消</el-button>
|
<el-button @click="close">取消</el-button>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -49,50 +28,71 @@
|
|||||||
</template>
|
</template>
|
||||||
<!--创建和编辑公用一个组件-->
|
<!--创建和编辑公用一个组件-->
|
||||||
<script>
|
<script>
|
||||||
|
import upload from '@/components/Upload/index'
|
||||||
|
import productApi from '@/api/product/productAttr.js';
|
||||||
|
import { loadingFn } from "@/utils/validate"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
// name: "edit"
|
// name: "edit",
|
||||||
props: { },
|
components: { upload },
|
||||||
|
props: {
|
||||||
|
parentOptions: {
|
||||||
|
type: Array,
|
||||||
|
default: () => []
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
loadingBtn: false,
|
loadingBtn: false,
|
||||||
constants: [],
|
constants: [],
|
||||||
editPram: {
|
editPram: {
|
||||||
extra: null,
|
level: 1,
|
||||||
name: null,
|
icon:"",
|
||||||
pid: null,
|
showFlag: 1,
|
||||||
sort: 0,
|
categoryName: "",
|
||||||
status: true,
|
sort:1,
|
||||||
type: 1,
|
parentId:"",
|
||||||
url: null,
|
parentCategoryName:""
|
||||||
id: 0
|
|
||||||
},
|
},
|
||||||
categoryProps: {
|
categoryProps: {
|
||||||
value: 'id',
|
value: 'id',
|
||||||
label: 'name',
|
label: 'categoryName',
|
||||||
children: 'child',
|
children: 'children'
|
||||||
expandTrigger: 'hover',
|
}
|
||||||
checkStrictly: true,
|
|
||||||
emitPath: false
|
|
||||||
},
|
|
||||||
parentOptions: []
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// this.initEditData()
|
// this.initEditData()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
uploadSuccess(e, res) {
|
||||||
|
if (res.code == 20000) {
|
||||||
|
({ publicUrl: this.editPram.icon } = res.data);
|
||||||
|
}
|
||||||
|
},
|
||||||
// 点击图标
|
// 点击图标
|
||||||
addIcon() {},
|
addIcon() { },
|
||||||
// 点击商品图
|
// 点击商品图
|
||||||
modalPicTap (tit, num, i) {
|
modalPicTap(tit, num, i) {
|
||||||
},
|
},
|
||||||
close() {
|
close() {
|
||||||
|
this.$parent.$parent.editDialogConfig.visible=false;
|
||||||
},
|
},
|
||||||
initEditData() {
|
initEditData() {
|
||||||
},
|
},
|
||||||
addTreeListLabelForCasCard(arr, child) {
|
addTreeListLabelForCasCard(arr, child) {
|
||||||
},
|
},
|
||||||
handlerSubmit(formName) {
|
handlerSubmit() {
|
||||||
|
productApi.classifySave(this.editPram,).then((result) => {
|
||||||
|
if(result.code==20000){
|
||||||
|
this.$parent.$parent.editDialogConfig.visible=false;
|
||||||
|
this.$message.success("添加成功!");
|
||||||
|
this.$parent.$parent.handleCurrentChange();
|
||||||
|
|
||||||
|
}
|
||||||
|
}).catch((err) => {
|
||||||
|
|
||||||
|
});
|
||||||
},
|
},
|
||||||
handlerSaveOrUpdate(isSave) {
|
handlerSaveOrUpdate(isSave) {
|
||||||
}
|
}
|
||||||
@@ -101,5 +101,7 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
::v-deep .photo-container {
|
||||||
|
align-items: flex-start !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -7,13 +7,13 @@
|
|||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
:on-success="uploadSuccess"
|
:on-success="uploadSuccess"
|
||||||
:on-remove="removeUrl"
|
:on-remove="removeUrl"
|
||||||
:data="{'code':code}"
|
:data="{'code':code,'ossKey':'xingyou2','pathKey':'banner-group','encrypt':'PUBLIC'}"
|
||||||
>
|
>
|
||||||
<img v-if="photoUrl" :src="photoUrl" class="avatar">
|
<img v-if="photoUrl" :src="photoUrl" class="avatar">
|
||||||
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
<i v-else class="el-icon-plus avatar-uploader-icon" />
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<span class="upload-span">
|
<span class="upload-span">
|
||||||
<slot name="bottom">请上传图片</slot>
|
<slot name="bottom">{{ tip }}</slot>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -21,6 +21,10 @@
|
|||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
props: {
|
props: {
|
||||||
|
tip:{
|
||||||
|
type: String,
|
||||||
|
default: "请上传图片"
|
||||||
|
},
|
||||||
photo: { // 传参用的url
|
photo: { // 传参用的url
|
||||||
type: String,
|
type: String,
|
||||||
default: null
|
default: null
|
||||||
@@ -67,9 +71,9 @@ export default {
|
|||||||
this.$message.success(res.msg)
|
this.$message.success(res.msg)
|
||||||
this.photoUrl = res.data.url
|
this.photoUrl = res.data.url
|
||||||
if (this.isPrivate) {
|
if (this.isPrivate) {
|
||||||
this.$emit('success', this.res.path)
|
this.$emit('success', this.res.path,res)
|
||||||
} else {
|
} else {
|
||||||
this.$emit('success', this.photoUrl)
|
this.$emit('success', this.photoUrl,res)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.$message.error(res.msg)
|
this.$message.error(res.msg)
|
||||||
|
|||||||
@@ -28,18 +28,18 @@ export function checkN(string) {
|
|||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
export const Debounce = (fn, t) => {
|
export const Debounce = (fn, t) => {
|
||||||
const delay = t || 500
|
const delay = t || 500
|
||||||
let timer
|
let timer
|
||||||
return function() {
|
return function () {
|
||||||
const args = arguments
|
const args = arguments
|
||||||
if (timer) {
|
if (timer) {
|
||||||
clearTimeout(timer)
|
clearTimeout(timer)
|
||||||
}
|
}
|
||||||
timer = setTimeout(() => {
|
timer = setTimeout(() => {
|
||||||
timer = null
|
timer = null
|
||||||
fn.apply(this, args)
|
fn.apply(this, args)
|
||||||
}, delay)
|
}, delay)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param {string} string
|
* @param {string} string
|
||||||
@@ -152,16 +152,16 @@ export function isArray(arg) {
|
|||||||
}
|
}
|
||||||
export function isStrictPromise(value) {
|
export function isStrictPromise(value) {
|
||||||
return !!value
|
return !!value
|
||||||
&& typeof value === 'object'
|
&& typeof value === 'object'
|
||||||
&& typeof value.then === 'function'
|
&& typeof value.then === 'function'
|
||||||
&& typeof value.finally === 'function';
|
&& typeof value.finally === 'function';
|
||||||
}
|
}
|
||||||
export function loadingFn(_loading,callback) {
|
export function loadingFn(loading, callback) {
|
||||||
console.log(isStrictPromise(callback),_loading,'isStrictPromise(callback)')
|
this[loading] = true
|
||||||
_loading = true;
|
|
||||||
if (isStrictPromise(callback)) {
|
if (isStrictPromise(callback)) {
|
||||||
callback.finally(() => {
|
callback.finally(() => {
|
||||||
// _loading = false;
|
console.log("运行")
|
||||||
})
|
this[loading] = false
|
||||||
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -143,7 +143,6 @@ export default {
|
|||||||
return this.$message.warning('请至少添加一条商品规格!');
|
return this.$message.warning('请至少添加一条商品规格!');
|
||||||
}
|
}
|
||||||
this.modal_loading = true;
|
this.modal_loading = true;
|
||||||
console.log('this.formDynamic',this.model,this.formDynamic)
|
|
||||||
Promise.all([...this.formDynamic.spec.map(item => {
|
Promise.all([...this.formDynamic.spec.map(item => {
|
||||||
return productApi[this.model]({
|
return productApi[this.model]({
|
||||||
"attributeName": item.value,
|
"attributeName": item.value,
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ export default {
|
|||||||
},
|
},
|
||||||
edit(row) {
|
edit(row) {
|
||||||
let data = Object.assign({}, row, {
|
let data = Object.assign({}, row, {
|
||||||
name:this.selectAttrId.split("/")[1],
|
name: this.selectAttrId.split("/")[1] || "",
|
||||||
spec: [{
|
spec: [{
|
||||||
value: row.attributeName,
|
value: row.attributeName,
|
||||||
detail: row.attributeContent.split(",")
|
detail: row.attributeContent.split(",")
|
||||||
@@ -114,7 +114,12 @@ export default {
|
|||||||
this.$parent.$parent.addAttr('update');
|
this.$parent.$parent.addAttr('update');
|
||||||
},
|
},
|
||||||
init() {
|
init() {
|
||||||
if (this.selectAttrId) this.page.params.typeId = this.selectAttrId.split("/")[0] && this.getByPage();
|
if (this.selectAttrId && this.selectAttrId.indexOf("/") !== -1) {
|
||||||
|
this.page.params.typeId = this.selectAttrId.split("/")[0] || "";
|
||||||
|
this.getByPage();
|
||||||
|
} else {
|
||||||
|
this.$message.warning("初始化出错")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,38 +28,54 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-card> -->
|
</el-card> -->
|
||||||
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
<el-card :bordered="false" shadow="never" class="ivu-mt-16">
|
||||||
<el-button type="primary" class="bnt" @click="addClass">添加分类</el-button>
|
<el-button type="primary" class="bnt" @click="addClass(null)">添加分类</el-button>
|
||||||
<el-table class="mt14" :loading="loading" :data="tableData">
|
<el-table row-key="id" class="mt14" v-loading="loading" :tree-props="{ children: 'children' }" :data="tableData">
|
||||||
<el-table-column field="id" label="ID" tooltip width="80"></el-table-column>
|
<el-table-column prop="categoryNum" label="编号"></el-table-column>
|
||||||
<el-table-column field="cate_name" tree-node label="分类名称" min-width="250"></el-table-column>
|
<el-table-column prop="categoryName" label="分类名称"></el-table-column>
|
||||||
<el-table-column field="pic" label="分类图标" min-width="100">
|
<el-table-column prop="level" label="级别"></el-table-column>
|
||||||
<template v-slot="{ row }">
|
<el-table-column prop="icon" label="分类图标" min-width="100">
|
||||||
<div class="tabBox_img" v-viewer v-if="row.pic">
|
<template slot-scope="scope">
|
||||||
<img v-lazy="row.pic" />
|
<el-image style="width: 50px; height: 50px" :src="scope.row.icon" :preview-src-list="[scope.row.icon]">
|
||||||
</div>
|
</el-image>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column field="sort" label="排序" min-width="100" tooltip="true"></el-table-column>
|
<el-table-column prop="showFlag" label="是否显示">
|
||||||
<el-table-column field="is_show" label="状态" min-width="120">
|
<template slot-scope="scope">
|
||||||
<template v-slot="{ row }">
|
<el-switch active-value="1" inactive-value="0" v-model="scope.row.showFlag" active-color="#13ce66"
|
||||||
<el-switch class="defineSwitch" :active-value="1" :inactive-value="0" v-model="row.is_show"
|
inactive-color="#ff4949">
|
||||||
:value="row.is_show" @change="onchangeIsShow(row)" size="large" active-text="开启" inactive-text="关闭">
|
|
||||||
</el-switch>
|
</el-switch>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column field="date" label="操作" width="120" fixed="right">
|
<el-table-column prop="sort" label="排序" min-width="100" tooltip="true"></el-table-column>
|
||||||
<template v-slot="{ row, index }">
|
<el-table-column prop="date" label="操作" width="120" fixed="right">
|
||||||
<a @click="edit(row)">编辑</a>
|
<template slot-scope="scope">
|
||||||
<el-divider direction="vertical"></el-divider>
|
<el-dropdown>
|
||||||
<a @click="del(row, '删除商品分类', index)">删除</a>
|
<el-button type=text>设置<i class="el-icon-arrow-down el-icon--right"></i></el-button>
|
||||||
|
<el-dropdown-menu slot="dropdown">
|
||||||
|
<el-dropdown-item @click="edit(scope.row)">编辑</el-dropdown-item>
|
||||||
|
<el-dropdown-item v-if="scope.row.level == 1">
|
||||||
|
<span @click="addClass(scope.row)">新增下级</span>
|
||||||
|
</el-dropdown-item>
|
||||||
|
<el-dropdown-item v-if="scope.row.level == 1">查看下级 </el-dropdown-item>
|
||||||
|
</el-dropdown-menu>
|
||||||
|
</el-dropdown>
|
||||||
|
<el-button type=text>
|
||||||
|
</el-button>
|
||||||
|
<el-button @click="del(scope.row, scope)" type=text>删除</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
</el-card>
|
</el-card>
|
||||||
|
<div class="acea-row row-right page">
|
||||||
|
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||||
|
:current-page="page.currentPage" :page-sizes="[10, 15, 20, 30]" :page-size="page.pageSize"
|
||||||
|
layout="total, sizes, prev, pager, next, jumper" :total="page.totalCount" />
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 添加 编辑表单-->
|
<!-- 添加 编辑表单-->
|
||||||
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from>
|
<edit-from ref="edits" :FromData="FromData" @submitFail="userSearchs"></edit-from>
|
||||||
<el-dialog title="添加分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false">
|
<el-dialog title="添加分类" :visible.sync="editDialogConfig.visible" destroy-on-close :close-on-click-modal="false">
|
||||||
<edit />
|
<edit ref="edit" :parentOptions="tableData" />
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -68,7 +84,7 @@
|
|||||||
import edit from '@/components/Category/edit'
|
import edit from '@/components/Category/edit'
|
||||||
import editFrom from '../../../components/from/from';
|
import editFrom from '../../../components/from/from';
|
||||||
import productApi from '@/api/product/productAttr.js';
|
import productApi from '@/api/product/productAttr.js';
|
||||||
import {loadingFn} from "@/utils/validate"
|
import { loadingFn } from "@/utils/validate"
|
||||||
export default {
|
export default {
|
||||||
name: 'product_productClassify',
|
name: 'product_productClassify',
|
||||||
components: {
|
components: {
|
||||||
@@ -101,45 +117,58 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// this.goodsCategory();
|
this.getList();
|
||||||
// this.getList();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
handleCommand(e) {
|
||||||
|
|
||||||
|
},
|
||||||
|
handleSizeChange(val) {
|
||||||
|
this.page.pageSize = val
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
|
handleCurrentChange(val) {
|
||||||
|
this.page.currentPage = val
|
||||||
|
this.getList()
|
||||||
|
},
|
||||||
// 商品分类;
|
// 商品分类;
|
||||||
goodsCategory() {
|
goodsCategory() {
|
||||||
},
|
},
|
||||||
// 列表
|
// 列表
|
||||||
getList() {
|
getList() {
|
||||||
this.loading = true;
|
loadingFn.call(this, "loading", productApi.classifyGetByPage(this.page).then(res => {
|
||||||
// console.log(,'loadingFn')
|
if (res.code = 20000) ({ list: this.tableData = [], totalCount: this.page.totalCount = 0 } = res.data);
|
||||||
// loadingFn(this.loading,productApi.classifyGetByPage(this.page))
|
}));
|
||||||
// this.artFrom.is_show = this.artFrom.is_show || '';
|
|
||||||
// this.artFrom.pid = this.artFrom.pid || '';
|
|
||||||
// productListApi(this.artFrom)
|
|
||||||
// .then(async (res) => {
|
|
||||||
// let data = res.data;
|
|
||||||
// this.tableData = data.list;
|
|
||||||
// this.total = data.count;
|
|
||||||
// this.loading = false;
|
|
||||||
// })
|
|
||||||
// .catch((res) => {
|
|
||||||
// this.loading = false;
|
|
||||||
// this.$message.error(res.msg);
|
|
||||||
// });
|
|
||||||
// productApi.classifyGetByPage()
|
|
||||||
},
|
},
|
||||||
pageChange(index) {
|
pageChange(index) {
|
||||||
this.artFrom.page = index;
|
this.artFrom.page = index;
|
||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
// 添加
|
// 添加
|
||||||
addClass() {
|
addClass(parent = null) {
|
||||||
this.editDialogConfig.visible = true
|
this.editDialogConfig.visible = true;
|
||||||
// this.$modalForm(productCreateApi()).then(() => this.getList());
|
// this.$nextTick(()=>{
|
||||||
|
// this.$refs.edit.parent = parent;
|
||||||
|
// });
|
||||||
|
if (parent) {
|
||||||
|
let { categoryName, id } = parent;
|
||||||
|
this.$nextTick(() => {
|
||||||
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { parentCategoryName: categoryName, parentId: id, level: 2 });
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
// 编辑
|
// 编辑
|
||||||
edit(row) {
|
edit(row) {
|
||||||
// this.$modalForm(productEditApi(row.id)).then(() => this.getList());
|
console.log(row.level);
|
||||||
|
this.editDialogConfig.visible = true;
|
||||||
|
this.$nextTick(()=>{
|
||||||
|
let { level, icon, showFlag, categoryName, sort, parentId } = row;
|
||||||
|
if (row.level == 1) {
|
||||||
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag, categoryName, sort, parentId })
|
||||||
|
} else {
|
||||||
|
this.$refs.edit.editPram = Object.assign(this.$refs.edit.editPram, { level, icon, showFlag,parentCategoryName:this.tableData.find(item=>item==parentId).categoryName, categoryName, sort, parentId })
|
||||||
|
}
|
||||||
|
})
|
||||||
},
|
},
|
||||||
// 修改状态
|
// 修改状态
|
||||||
onchangeIsShow(row) {
|
onchangeIsShow(row) {
|
||||||
@@ -175,22 +204,21 @@ export default {
|
|||||||
this.getList();
|
this.getList();
|
||||||
},
|
},
|
||||||
// 删除
|
// 删除
|
||||||
del(row, tit, num) {
|
del(row, scope) {
|
||||||
let delfromData = {
|
console.log(scope)
|
||||||
title: tit,
|
this.$alert('请确定删除!', '提示', {
|
||||||
num: num,
|
confirmButtonText: '确定',
|
||||||
url: `product/category/${row.id}`,
|
callback: action => {
|
||||||
method: 'DELETE',
|
if (action == "confirm") {
|
||||||
ids: '',
|
loadingFn.call(this, "loading", productApi.classifyDelete(row).then(res => {
|
||||||
};
|
if (res.code = 20000) {
|
||||||
this.$modalSure(delfromData)
|
this.$message.success("操作成功!")
|
||||||
.then((res) => {
|
this.handleCurrentChange()
|
||||||
this.$message.success(res.msg);
|
}
|
||||||
this.getList();
|
}));
|
||||||
})
|
}
|
||||||
.catch((res) => {
|
}
|
||||||
this.$message.error(res.msg);
|
});
|
||||||
});
|
|
||||||
},
|
},
|
||||||
// 表格搜索
|
// 表格搜索
|
||||||
userSearchs() {
|
userSearchs() {
|
||||||
|
|||||||
Reference in New Issue
Block a user