|
|
@@ -0,0 +1,335 @@
|
|
|
+<template>
|
|
|
+ <div class="container" style="width: 99%; margin-top: 0px">
|
|
|
+ <!--布局容器-->
|
|
|
+ <el-container style="height: 100%" direction="vertical">
|
|
|
+ <el-main ref="elMain" style="padding: 0px">
|
|
|
+ <!-- 新增展开折叠 -->
|
|
|
+ <div style="margin-bottom: 20px; margin-top: 15px" class="flex a-start">
|
|
|
+ <el-button size="small" type="info" plain icon="el-icon-sort" @click="fold()">展开折叠</el-button>
|
|
|
+ <el-form :inline="true" class="demo-form-inline" size="small" style="margin-left: 30px">
|
|
|
+ <el-form-item label="机构编码:">
|
|
|
+ <el-input clearable v-model="peopledeptid" placeholder="请输入机构编码"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="来源:">
|
|
|
+ <el-select v-model="managementSource" placeholder="选择来源" clearable>
|
|
|
+ <el-option v-for="val in organizationSourceoptions" :key="val.dictValue"
|
|
|
+ :label="val.dictTag" :value="val.dictValue"></el-option>
|
|
|
+ </el-select>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" size="small" @click="managementSourceQuery">查询</el-button>
|
|
|
+ <el-button type="primary" size="small" @click="batchEditing">批量编辑</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <!-- 表格渲染 -->
|
|
|
+ <el-table height="600" row-key="id"
|
|
|
+ v-loading="loading" border :data="ztreeNodes"
|
|
|
+ :tree-props="{ children: 'children', hasChildren: 'hasChilkdren' }" :header-cell-style="{
|
|
|
+ background: '#F2F7FC',
|
|
|
+ fontWeight: '900',
|
|
|
+ color: '#606266',
|
|
|
+ }" size="small" ref="expandTable" @row-click="rowClick" @select="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="50" align="center" />
|
|
|
+ <el-table-column prop="name" label="部门管理" width="300">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="deptCount" label="部门数量" width="80" align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="id" label="ID" width="150" align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="comlevel" label="机构级别" :formatter="comlevelFormatter" align="center"
|
|
|
+ width="150"></el-table-column>
|
|
|
+ <el-table-column prop="comattribute" label="机构性质" :formatter="comattributeFormatter" align="center"
|
|
|
+ width="150">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="comtype" label="机构类型" :formatter="comtypeFormatter" align="center" width="150">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="managementSource" label="来源" align="center" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <span v-if="scope.row.managementSource == '1'">渠道</span>
|
|
|
+ <span v-if="scope.row.managementSource == '2'">个代</span>
|
|
|
+ <span v-if="scope.row.managementSource == '3'">服务</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column prop="address" label="机构地址" align="center">
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" fixed="right" align="center" width="150">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <KtButton v-if="scope.row.deptType=='D'" :size="'medium'" :type="'text'" :label="'编辑'"
|
|
|
+ @click.native.stop="handleEdit(scope.row)" @findPage="findSubDeptPage"></KtButton>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
+ </el-main>
|
|
|
+ </el-container>
|
|
|
+ <el-dialog :title="deptDialogTitle" width="20%" :visible.sync="deptDialogVisible" :close-on-click-modal="false"
|
|
|
+ v-dialogDrag @close="closeDeptDialog">
|
|
|
+ 选择报价单 : <el-select v-model="themeId" placeholder="请选择" size="small">
|
|
|
+ <el-option
|
|
|
+ v-for="item in themeIdOptions"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.quotationAbbr"
|
|
|
+ :value="item.id">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button size="small" @click="closeDeptDialog">{{
|
|
|
+ $t("action.cancel")
|
|
|
+ }}</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="deptSubmitForm()">{{
|
|
|
+ $t("action.comfirm")
|
|
|
+ }}</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script>
|
|
|
+import KtButton from "@/views/Core/KtButton"; //按钮权限组件
|
|
|
+import tree from "@/components/ztree.vue"; //机构树组件
|
|
|
+import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
|
|
|
+import CommonUtil from "@/utils/comutil.js";
|
|
|
+export default {
|
|
|
+ name: "Deptall",
|
|
|
+ components: {
|
|
|
+ KtButton,
|
|
|
+ tree,
|
|
|
+ KtCommonTable,
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ this.findTreeData(); // 获取左边机构树数据
|
|
|
+ //获取所有下拉框数据
|
|
|
+ this.getDictItems("comlevel");
|
|
|
+ this.getDictItems("comattribute");
|
|
|
+ this.getDictItems("comtype");
|
|
|
+ this.getDicType("organizationSource");
|
|
|
+ this.$api.menu.quotationList()
|
|
|
+ .then((res) => {
|
|
|
+ if(res.code==200){
|
|
|
+ this.themeIdOptions = res.data;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.$message.error(res.msg)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ mounted() {
|
|
|
+ this.filters.id = "9";
|
|
|
+ this.findSubDeptPage(); //初始化数据
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ themeId:'',
|
|
|
+ deptDialogTitle:'编辑',
|
|
|
+ themeIdOptions:[],
|
|
|
+ loading: false,
|
|
|
+ searchForm: {
|
|
|
+ classname: "",
|
|
|
+ status: "",
|
|
|
+ },
|
|
|
+ peopleid: "",
|
|
|
+ peopledeptid: "",
|
|
|
+ managementSource: "", //来源类型
|
|
|
+ filters: {
|
|
|
+ id: "",
|
|
|
+ },
|
|
|
+ pageRequest: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ },
|
|
|
+ pageResult: {},
|
|
|
+
|
|
|
+ //------------下拉框数据 begin-----------------
|
|
|
+ comleveloptions: [],
|
|
|
+ comattributeoptions: [],
|
|
|
+ comtypeoptions: [],
|
|
|
+ organizationSourceoptions: [],
|
|
|
+ dialogVisible: false,
|
|
|
+ deptDialogVisible: false,
|
|
|
+ isshow: false,
|
|
|
+ expanded: false, // 在这里定义了展开与否的标志
|
|
|
+ // 部门DialogEnd
|
|
|
+ ztreeNodes:[],
|
|
|
+ organizationId:''
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ //点击每一行的事件
|
|
|
+ rowClick(row, treeNode) {
|
|
|
+ //点每行展开折叠
|
|
|
+ row.expanded = !row.expanded;
|
|
|
+ this.$refs.expandTable.toggleRowExpansion(row, row.expanded);
|
|
|
+ //新增子公司、部门
|
|
|
+ this.currentTreeNode = row;
|
|
|
+ // this.currentTreeNode = treeNode;
|
|
|
+ this.filters.id = this.currentTreeNode.id;
|
|
|
+ this.findSubDeptPage();
|
|
|
+ },
|
|
|
+ //遍历表格数据
|
|
|
+ forTableData(arr, isExpand) {
|
|
|
+ arr.forEach((i) => {
|
|
|
+ this.$refs.expandTable.toggleRowExpansion(i, isExpand);
|
|
|
+ if (i.children) {
|
|
|
+ this.forTableData(i.children, isExpand);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ //展开收起树列表
|
|
|
+ fold() {
|
|
|
+ this.isshow = !this.isshow;
|
|
|
+ this.forTableData(this.ztreeNodes, this.isshow);
|
|
|
+ },
|
|
|
+
|
|
|
+ //--数据字典 begin --
|
|
|
+ getDictItems(typeName) {
|
|
|
+ this.$api.dict
|
|
|
+ .findByLableName(typeName)
|
|
|
+ .then((response) => {
|
|
|
+ this[typeName + "options"] = response.data; // 把获取到的数据赋给this.data
|
|
|
+ // this.ztreeNodes = this[typeName + "options"];
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ this[typeName + "options"] = [];
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getDicType(type) {
|
|
|
+ this.$api.insCompany.dicType(type).then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this[type + 'options'] = res.data.ddList;
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ },
|
|
|
+ findTreeData() {
|
|
|
+ // 获取机构树的数据
|
|
|
+ this.loading = true;
|
|
|
+ this.$api.dept.findDeptTree(this.peopledeptid, "").then((res) => {
|
|
|
+ this.ztreeNodes = res.data;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ managementSourceQuery() {
|
|
|
+ this.loading = true;
|
|
|
+ this.$api.dept
|
|
|
+ .findDeptTree(this.peopledeptid, this.managementSource)
|
|
|
+ .then((res) => {
|
|
|
+ this.ztreeNodes = res.data;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleCreated(ztreeObj) {
|
|
|
+ this.ztreeObj = ztreeObj;
|
|
|
+ // onCreated 中操作ztreeObj对象展开第一个节点
|
|
|
+ ztreeObj.expandNode(ztreeObj.getNodes()[0], true);
|
|
|
+ this.currentTreeNode = ztreeObj.getNodes()[0];
|
|
|
+ },
|
|
|
+ // 右边表格Start
|
|
|
+ findSubDeptPage: function (data) {
|
|
|
+ // 获取分页数据
|
|
|
+ if (!!data) {
|
|
|
+ this.pageRequest = data.pageRequest;
|
|
|
+ }
|
|
|
+ this.pageRequest.columnFilters = {
|
|
|
+ id: {
|
|
|
+ name: "id",
|
|
|
+ value: this.filters.id,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ this.$api.dept
|
|
|
+ .findSubDeptPage(this.pageRequest)
|
|
|
+ .then((res) => {
|
|
|
+ this.pageResult = res.data;
|
|
|
+ })
|
|
|
+ .then(data != null ? data.callback : "");
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+ //-- formatter begin--
|
|
|
+ comlevelFormatter(row, column) {
|
|
|
+ let comlevel = row.comlevel;
|
|
|
+ return CommonUtil.getDataName({
|
|
|
+ dataList: this.comleveloptions,
|
|
|
+ value: "value",
|
|
|
+ label: "label",
|
|
|
+ data: comlevel,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ comattributeFormatter(row, column) {
|
|
|
+ let comattribute = row.comattribute;
|
|
|
+ return CommonUtil.getDataName({
|
|
|
+ dataList: this.comattributeoptions,
|
|
|
+ value: "value",
|
|
|
+ label: "label",
|
|
|
+ data: comattribute,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ comtypeFormatter(row, column) {
|
|
|
+ let comtype = row.comtype;
|
|
|
+ return CommonUtil.getDataName({
|
|
|
+ dataList: this.comtypeoptions,
|
|
|
+ value: "value",
|
|
|
+ label: "label",
|
|
|
+ data: comtype,
|
|
|
+ });
|
|
|
+ },
|
|
|
+ handleSelectionChange(select, row) {
|
|
|
+ if (!row.children) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (this.$refs.expandTable.selection.includes(row)) {
|
|
|
+ this.checkRow(row.children, true); // 调用选中递归方法
|
|
|
+ } else {
|
|
|
+ this.checkRow(row.children, false);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ //选中递归
|
|
|
+ checkRow(data, bool) {
|
|
|
+ data.forEach((item) => {
|
|
|
+ this.$refs.expandTable.toggleRowSelection(item, bool);
|
|
|
+ if (item.children) {
|
|
|
+ this.checkRow(item.children, bool);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 编辑机构或部门
|
|
|
+ handleEdit(row) {
|
|
|
+ this.deptDialogTitle='编辑'
|
|
|
+ this.themeId=''
|
|
|
+ this.organizationId=row.id
|
|
|
+ this.deptDialogVisible=true
|
|
|
+ },
|
|
|
+ deptSubmitForm() {
|
|
|
+ let data={
|
|
|
+ organizationIds:this.deptDialogTitle=='编辑'?[this.organizationId]:this.$refs.expandTable.selection.map(e=>e.id),
|
|
|
+ themeId:this.themeId
|
|
|
+ }
|
|
|
+ this.$api.menu
|
|
|
+ .quotationBatch(data)
|
|
|
+ .then((res) => {
|
|
|
+ if(res.code==200){
|
|
|
+ this.deptDialogVisible=false
|
|
|
+ this.findSubDeptPage()
|
|
|
+ this.$message({ message: res.msg, type: "success" });
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.$message({ message: res.msg, type: "error" });
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ batchEditing(){
|
|
|
+ this.themeId=''
|
|
|
+ this.deptDialogTitle='批量编辑'
|
|
|
+ this.deptDialogVisible=true
|
|
|
+ },
|
|
|
+ //关闭部门弹框
|
|
|
+ closeDeptDialog() {
|
|
|
+ // this.$refs.deptDataForm.resetFields();
|
|
|
+ this.deptDialogVisible = false;
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped>
|
|
|
+
|
|
|
+</style>
|
|
|
+
|