Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system-vue
Conflicts: src/utils/dict.js
This commit is contained in:
commit
c3b05de34b
60
src/api/system/category.js
Normal file
60
src/api/system/category.js
Normal file
@ -0,0 +1,60 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询部门列表
|
||||
export function listCategory(query) {
|
||||
return request({
|
||||
url: '/system/category/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询部门列表(排除节点)
|
||||
export function listCategoryExcludeChild(categoryId) {
|
||||
return request({
|
||||
url: '/system/category/list/exclude/' + categoryId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 查询部门详细
|
||||
export function getCategory(categoryId) {
|
||||
return request({
|
||||
url: '/system/category/get?id=' + categoryId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 获取部门精简信息列表
|
||||
export function listSimpleCategorys() {
|
||||
return request({
|
||||
url: '/system/category/list-all-simple',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增部门
|
||||
export function addCategory(data) {
|
||||
return request({
|
||||
url: '/system/category/create',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改部门
|
||||
export function updateCategory(data) {
|
||||
return request({
|
||||
url: '/system/category/update',
|
||||
method: 'put',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除部门
|
||||
export function delCategory(id) {
|
||||
return request({
|
||||
url: '/system/category/delete?id=' + id,
|
||||
method: 'delete'
|
||||
})
|
||||
}
|
@ -106,6 +106,8 @@ export const DICT_TYPE = {
|
||||
DICT_BRAND_TYPE : 'brand_type',
|
||||
//标签样式
|
||||
DICT_BASE_LABEL_TYPE : 'base_label_type',
|
||||
//业务分类
|
||||
DICT_BASE_LABEL_BUSI_TYPE : 'label_busi_type',
|
||||
|
||||
// ------- 企业管理模块 -------
|
||||
// 员工学历
|
||||
|
@ -137,16 +137,28 @@
|
||||
</el-table>
|
||||
</el-collapse-item>
|
||||
<!--附件-->
|
||||
<!-- <el-collapse-item title="附件" name="3">-->
|
||||
<!-- <el-row>-->
|
||||
<!-- <el-col>-->
|
||||
<!-- <el-form-item label="身份证照片">-->
|
||||
<!-- <ImageUpload v-model="formData.idCardImage"/>-->
|
||||
<!-- </el-form-item>-->
|
||||
<!-- </el-col>-->
|
||||
<!-- </el-row>-->
|
||||
<!-- </el-collapse-item>-->
|
||||
<el-collapse-item v-if="formData.typeCode !=='03'" title="身份证件信息" name="3">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item>
|
||||
<ImageUpload v-model="formData.idCardImage"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-collapse-item>
|
||||
|
||||
<el-collapse-item v-if="formData.typeCode =='03'" title="政企客户资料" name="3">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item>
|
||||
<FileUpload v-model="formData.idCardImage"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-collapse-item>
|
||||
|
||||
</el-collapse>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm" :disabled="formLoading">确 定</el-button>
|
||||
@ -160,6 +172,7 @@
|
||||
import * as CustomerMainApi from '@/api/base/customer';
|
||||
import { getServicePackageList} from "@/api/system/servicePackage";
|
||||
import ImageUpload from '@/components/ImageUpload';
|
||||
import FileUpload from '@/components/FileUpload';
|
||||
import Editor from '@/components/Editor';
|
||||
import {getDictDatas, DICT_TYPE} from '@/utils/dict'
|
||||
|
||||
@ -168,6 +181,7 @@ export default {
|
||||
components: {
|
||||
ImageUpload,
|
||||
Editor,
|
||||
FileUpload
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@ -294,6 +308,8 @@ export default {
|
||||
this.dialogVisible = true;
|
||||
this.typeCode = '04'
|
||||
this.deptCode = row.deptCode
|
||||
console.log(row)
|
||||
console.log(this.deptCode)
|
||||
this.reset();
|
||||
this.dialogTitle = row.cusName;
|
||||
},
|
||||
|
@ -79,7 +79,7 @@
|
||||
<el-table-column width="200" label="客户名称" align="center" prop="cusName"/>
|
||||
<el-table-column width="110" label="联系方式" align="center" prop="phoneNumber"/>
|
||||
<el-table-column width="230" label="服务内容" align="left" prop="serContents"/>
|
||||
<el-table-column width="300" label="地址" align="left" prop="address"/>
|
||||
<el-table-column label="地址" align="left" prop="address"/>
|
||||
<el-table-column label="最近业务办理时间" align="center" prop="nearDoTime" width="180">
|
||||
<template v-slot="scope">
|
||||
<span>{{ parseTime(scope.row.nearDoTime) }}</span>
|
||||
|
@ -51,7 +51,7 @@
|
||||
<span>{{ parseTime(scope.row.birthday,'{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="300" label="住址" align="left" prop="address"/>
|
||||
<el-table-column label="住址" align="left" prop="address"/>
|
||||
<el-table-column width="80" label="客户来源" align="center" prop="dataFrom">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.DICT_CUS_DATA_FROM" :value="scope.row.dataFrom" />
|
||||
|
@ -46,7 +46,7 @@
|
||||
<span>{{ parseTime(scope.row.birthday,'{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="300" label="住址" align="left" prop="address"/>
|
||||
<el-table-column label="住址" align="left" prop="address"/>
|
||||
<el-table-column width="100" label="客户来源" align="center" prop="dataFrom">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.DICT_CUS_DATA_FROM" :value="scope.row.dataFrom" />
|
||||
|
@ -6,6 +6,12 @@
|
||||
<el-form-item label="标签名称" prop="labelName">
|
||||
<el-input v-model="formData.labelName" placeholder="请输入标签名称"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签分类" prop="type">
|
||||
<el-select v-model="formData.type" placeholder="请选择标签分类">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DICT_BASE_LABEL_BUSI_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签样式" prop="labelType">
|
||||
<el-select v-model="formData.labelType" placeholder="请选择标签样式">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DICT_BASE_LABEL_TYPE)"
|
||||
@ -44,6 +50,7 @@ export default {
|
||||
id: undefined,
|
||||
labelName: undefined,
|
||||
labelDesc: undefined,
|
||||
type: undefined,
|
||||
labelType: undefined
|
||||
},
|
||||
// 表单校验
|
||||
@ -51,6 +58,9 @@ export default {
|
||||
labelName: [
|
||||
{required: true, message: '请输入标签名称', trigger: 'blur'},
|
||||
],
|
||||
type: [
|
||||
{required: true, message: '请选择标签分类', trigger: 'blur'},
|
||||
],
|
||||
labelType: [
|
||||
{required: true, message: '请选择标签样式', trigger: 'blur'},
|
||||
],
|
||||
@ -104,6 +114,7 @@ export default {
|
||||
this.formData = {
|
||||
id: undefined,
|
||||
labelName: undefined,
|
||||
type: undefined,
|
||||
labelDesc: undefined,
|
||||
systemCode: undefined,
|
||||
};
|
||||
|
@ -5,6 +5,12 @@
|
||||
<el-form-item label="标签名称" prop="labelName">
|
||||
<el-input v-model="queryParams.labelName" placeholder="请输入标签名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="标签分类" prop="type">
|
||||
<el-select v-model="queryParams.type" placeholder="请选择标签分类" @keyup.enter.native="handleQuery">
|
||||
<el-option v-for="dict in this.getDictDatas(DICT_TYPE.DICT_BASE_LABEL_BUSI_TYPE)"
|
||||
:key="dict.value" :label="dict.label" :value="dict.value"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
@ -28,6 +34,11 @@
|
||||
<dict-tag :type="DICT_TYPE.DICT_BASE_LABEL_TYPE" :value="scope.row.labelType" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="分类" align="center" prop="labelType">
|
||||
<template v-slot="scope">
|
||||
<dict-tag :type="DICT_TYPE.DICT_BASE_LABEL_BUSI_TYPE" :value="scope.row.type" />
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="标签描述" align="center" prop="labelDesc"/>
|
||||
<el-table-column label="创建时间" align="center" prop="createTime" width="180">
|
||||
<template v-slot="scope">
|
||||
@ -85,6 +96,7 @@ export default {
|
||||
pageNo: 1,
|
||||
pageSize: 10,
|
||||
labelName: null,
|
||||
type:null,
|
||||
labelDesc: null,
|
||||
systemCode: null,
|
||||
createTime: [],
|
||||
|
244
src/views/system/category/index.vue
Normal file
244
src/views/system/category/index.vue
Normal file
@ -0,0 +1,244 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
|
||||
<el-form-item label="分类字典名称" prop="name">
|
||||
<el-input v-model="queryParams.name" placeholder="请输入分类字典名称" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="分类字典编码" prop="code">
|
||||
<el-input v-model="queryParams.code" placeholder="请输入分类字典编码" clearable @keyup.enter.native="handleQuery"/>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<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:category:create']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">展开/折叠</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-if="refreshTable" v-loading="loading" :data="categoryList" row-key="id" :default-expand-all="isExpandAll"
|
||||
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
|
||||
<el-table-column prop="name" label="分类字典名称" width="260"></el-table-column>
|
||||
<el-table-column prop="code" label="分类字典编码" width="260"></el-table-column>
|
||||
<el-table-column prop="remark" label="备注" width="260"></el-table-column>
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
|
||||
v-hasPermi="['system:category:update']">修改</el-button>
|
||||
<el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)"
|
||||
v-hasPermi="['system:category:create']">新增</el-button>
|
||||
<el-button v-if="scope.row.pid !== 0" size="mini" type="text" icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)" v-hasPermi="['system:category:delete']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<!-- 添加或修改分类字典对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="上级分类字典" prop="pid">
|
||||
<treeselect v-model="form.pid" :options="categoryOptions" :normalizer="normalizer" placeholder="选择上级分类字典" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="分类字典名称" prop="name">
|
||||
<el-input v-model="form.name" placeholder="请输入分类字典名称" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="分类字典编码" prop="code">
|
||||
<el-input v-model="form.code" placeholder="请输入分类字典编码" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="form.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCategory, getCategory, delCategory, addCategory, updateCategory } from "@/api/system/category";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
export default {
|
||||
name: "SystemCategory",
|
||||
components: { Treeselect },
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 表格树数据
|
||||
categoryList: [],
|
||||
// 分类字典树选项
|
||||
categoryOptions: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 是否展开,默认全部展开
|
||||
isExpandAll: true,
|
||||
// 重新渲染表格状态
|
||||
refreshTable: true,
|
||||
// 是否展开
|
||||
expand: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
name: undefined,
|
||||
code: undefined
|
||||
},
|
||||
// 表单参数
|
||||
form: {
|
||||
id: undefined,
|
||||
pid: undefined,
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
remark: undefined,
|
||||
},
|
||||
// 表单校验
|
||||
rules: {
|
||||
name: [
|
||||
{ required: true, message: "分类字典名称不能为空", trigger: "blur" }
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: "分类字典编码不能为空", trigger: "blur" }
|
||||
],
|
||||
},
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询分类字典列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listCategory(this.queryParams).then(response => {
|
||||
this.categoryList = this.handleTree(response.data, "id","pid","children","0");
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
/** 转换分类字典数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.name,
|
||||
children: node.children
|
||||
};
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
id: undefined,
|
||||
pid: undefined,
|
||||
name: undefined,
|
||||
code: undefined,
|
||||
remark: undefined,
|
||||
};
|
||||
this.resetForm("form");
|
||||
},
|
||||
/** 搜索按钮操作 */
|
||||
handleQuery() {
|
||||
this.getList();
|
||||
},
|
||||
/** 重置按钮操作 */
|
||||
resetQuery() {
|
||||
this.resetForm("queryForm");
|
||||
this.handleQuery();
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd(row) {
|
||||
this.reset();
|
||||
if (row !== undefined) {
|
||||
this.form.pid = row.id;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "添加分类字典";
|
||||
listCategory().then(response => {
|
||||
this.categoryOptions = this.handleTree(response.data, "id","pid","children","0");
|
||||
});
|
||||
},
|
||||
/** 展开/折叠操作 */
|
||||
toggleExpandAll() {
|
||||
this.refreshTable = false;
|
||||
this.isExpandAll = !this.isExpandAll;
|
||||
this.$nextTick(() => {
|
||||
this.refreshTable = true;
|
||||
});
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
getCategory(row.id).then(response => {
|
||||
this.form = response.data;
|
||||
if (this.form.pid === "0") { // 无父分类字典时,标记为 undefined,避免展示为 Unknown
|
||||
this.form.pid = undefined;
|
||||
}
|
||||
this.open = true;
|
||||
this.title = "修改分类字典";
|
||||
});
|
||||
listCategory(row.id).then(response => {
|
||||
this.categoryOptions = this.handleTree(response.data, "id","pid","children","0");
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm: function() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.id !== undefined) {
|
||||
updateCategory(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addCategory(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
this.$modal.confirm('是否确认删除名称为"' + row.name + '"的数据项?').then(function() {
|
||||
return delCategory(row.id);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user