|
@@ -8,10 +8,10 @@
|
|
|
-->
|
|
|
|
|
|
<template>
|
|
|
- <main class="add-dialog">
|
|
|
- <dg-row class="property-wapper" :gutter="10">
|
|
|
- <!-- 机构列表 -->
|
|
|
- <!-- <dg-col :span="8" class="property-wapper__left">
|
|
|
+ <main class="add-dialog">
|
|
|
+ <dg-row class="property-wapper" :gutter="10">
|
|
|
+ <!-- 机构列表 -->
|
|
|
+ <!-- <dg-col :span="8" class="property-wapper__left">
|
|
|
<dg-card class="box-card">
|
|
|
<org-tree
|
|
|
ref="tree"
|
|
@@ -24,189 +24,196 @@
|
|
|
></org-tree>
|
|
|
</dg-card>
|
|
|
</dg-col> -->
|
|
|
- <!-- -->
|
|
|
- <dg-col :span="24">
|
|
|
- <el-form ref="form" label-suffix=":" inline>
|
|
|
- <el-form-item label="功能名称" v-if="type == 'function'">
|
|
|
- <el-input clearable placeholder="请输入功能名称" v-model="form.applyName.value"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="应用系统名称" v-if="type == 'application'">
|
|
|
- <el-input clearable placeholder="请输入应用系统名称" v-model="form.applyName.value"></el-input>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item>
|
|
|
- <dg-button type="primary" icon="el-icon-search" @click="handleSearch">查询</dg-button>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <dg-table
|
|
|
- ref="table"
|
|
|
- :url="tableUrl"
|
|
|
- :condition="form"
|
|
|
- border
|
|
|
- row-key="id"
|
|
|
- :before-quest="beforeQuest"
|
|
|
- @select="handleSelect"
|
|
|
- @select-all="handleCheckAll"
|
|
|
- v-if="type !== 'service'"
|
|
|
- >
|
|
|
- <dg-table-column type="selection" reserve-selection width="55" />
|
|
|
- <template v-for="(item, indexs) in cardAgencylist">
|
|
|
- <dg-table-column :key="indexs" v-bind="item" align="center"> </dg-table-column>
|
|
|
- </template>
|
|
|
- </dg-table>
|
|
|
- </dg-col>
|
|
|
- </dg-row>
|
|
|
- <div v-footer>
|
|
|
- <dg-button @click="handleClose">取消</dg-button>
|
|
|
- <dg-button type="primary" @click="handleSave">添加</dg-button>
|
|
|
- </div>
|
|
|
- </main>
|
|
|
+ <!-- -->
|
|
|
+ <dg-col :span="24">
|
|
|
+ <el-form ref="form" label-suffix=":" inline>
|
|
|
+ <el-form-item label="功能名称" v-if="type == 'function'">
|
|
|
+ <el-input clearable placeholder="请输入功能名称" v-model="form.applyName.value"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="应用系统名称" v-if="type == 'application'">
|
|
|
+ <el-input clearable placeholder="请输入应用系统名称" v-model="form.applyName.value"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <dg-button type="primary" icon="el-icon-search" @click="handleSearch">查询</dg-button>
|
|
|
+ <dg-button :icon="'重置' | optIcon" @click="handleReset">重置</dg-button>
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
+ <dg-table
|
|
|
+ ref="table"
|
|
|
+ :url="tableUrl"
|
|
|
+ :condition="form"
|
|
|
+ border
|
|
|
+ row-key="id"
|
|
|
+ :before-quest="beforeQuest"
|
|
|
+ @select="handleSelect"
|
|
|
+ @select-all="handleCheckAll"
|
|
|
+ v-if="type !== 'service'"
|
|
|
+ >
|
|
|
+ <dg-table-column type="selection" reserve-selection width="55" />
|
|
|
+ <template v-for="(item, indexs) in cardAgencylist">
|
|
|
+ <dg-table-column :key="indexs" v-bind="item" align="center"> </dg-table-column>
|
|
|
+ </template>
|
|
|
+ </dg-table>
|
|
|
+ </dg-col>
|
|
|
+ </dg-row>
|
|
|
+ <div v-footer>
|
|
|
+ <dg-button @click="handleClose">取消</dg-button>
|
|
|
+ <dg-button type="primary" @click="handleSave">保存</dg-button>
|
|
|
+ </div>
|
|
|
+ </main>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { appRestApi } from "@/api/application";
|
|
|
-import { cardAgencylist, cardFunctionList } from "../../auth-subject-manage/DataConfig";
|
|
|
-import orgTree from "@/pages/common/tree";
|
|
|
-import { addRelateApp, getRelateIds } from "@/api/data-auth";
|
|
|
-import _ from "lodash";
|
|
|
+import { appRestApi } from '@/api/application';
|
|
|
+import { cardAgencylist, cardFunctionList } from '../../auth-subject-manage/DataConfig';
|
|
|
+import { addRelateApp, getRelateIds } from '@/api/data-auth';
|
|
|
+import _ from 'lodash';
|
|
|
export default {
|
|
|
- name: "add-dialog", // 组件名称
|
|
|
- props: {
|
|
|
- // 接收父组件的数据
|
|
|
- type: {
|
|
|
- type: String,
|
|
|
- default: "application"
|
|
|
- },
|
|
|
- parentNode: Object
|
|
|
+ name: 'add-dialog', // 组件名称
|
|
|
+ props: {
|
|
|
+ // 接收父组件的数据
|
|
|
+ type: {
|
|
|
+ type: String,
|
|
|
+ default: 'application'
|
|
|
},
|
|
|
- data() {
|
|
|
- // 组件内部参数
|
|
|
- return {
|
|
|
- // 参数名称及默认值
|
|
|
- cardFunctionList,
|
|
|
- cardAgencylist,
|
|
|
- form: {
|
|
|
- applyName: {
|
|
|
- value: "",
|
|
|
- op: "like"
|
|
|
- }
|
|
|
- },
|
|
|
- tableUrl: appRestApi.table,
|
|
|
- otherParams: {
|
|
|
- attrBelongType: this.parentNode.attrBelongType,
|
|
|
- attrId: this.parentNode.id,
|
|
|
- attrType: "OBJ"
|
|
|
- }
|
|
|
- };
|
|
|
+ parentNode: Object
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ // 组件内部参数
|
|
|
+ return {
|
|
|
+ // 参数名称及默认值
|
|
|
+ cardFunctionList,
|
|
|
+ cardAgencylist,
|
|
|
+ form: {
|
|
|
+ applyName: {
|
|
|
+ value: '',
|
|
|
+ op: 'like'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ tableUrl: appRestApi.table,
|
|
|
+ otherParams: {
|
|
|
+ attrBelongType: this.parentNode.attrBelongType,
|
|
|
+ attrId: this.parentNode.id,
|
|
|
+ attrType: 'OBJ'
|
|
|
+ }
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {}, // 计算属性
|
|
|
+ watch: {}, // 侦听器(扩展的计算属性)
|
|
|
+ components: {}, // 注册局部组件
|
|
|
+ methods: {
|
|
|
+ /**
|
|
|
+ * @description: 获取机构节点
|
|
|
+ * @param {*} node
|
|
|
+ */
|
|
|
+ handleGetNode(node) {
|
|
|
+ this.subId = node.code;
|
|
|
+ this.key++;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @description:重置
|
|
|
+ */
|
|
|
+ handleReset() {
|
|
|
+ for (const key in this.form) {
|
|
|
+ this.form[key].value = '';
|
|
|
+ }
|
|
|
},
|
|
|
- computed: {}, // 计算属性
|
|
|
- watch: {}, // 侦听器(扩展的计算属性)
|
|
|
- components: { orgTree }, // 注册局部组件
|
|
|
- methods: {
|
|
|
- /**
|
|
|
- * @description: 获取机构节点
|
|
|
- * @param {*} node
|
|
|
- */
|
|
|
- handleGetNode(node) {
|
|
|
- this.subId = node.code;
|
|
|
- this.key++;
|
|
|
- },
|
|
|
- /**
|
|
|
- * @description:查询
|
|
|
- */
|
|
|
- handleSearch() {
|
|
|
- this.$refs.table.searchForm();
|
|
|
- },
|
|
|
- /**
|
|
|
- * 进入页面默认选中设置
|
|
|
- */
|
|
|
- beforeQuest(res) {
|
|
|
- const { content, totalElements } = res.data;
|
|
|
- this.currentPageContent = content;
|
|
|
- if (this.newChooseArr.length > 0) {
|
|
|
- let rowKeys = [];
|
|
|
- for (let j = 0; j < content.length; j++) {
|
|
|
- const cItem = content[j];
|
|
|
- const index = this.newChooseArr.findIndex((item) => (item.id || item) == cItem.id);
|
|
|
- if (index > -1) {
|
|
|
- rowKeys.push(this.newChooseArr[index].id || this.newChooseArr[index]);
|
|
|
- }
|
|
|
- }
|
|
|
- setTimeout(() => {
|
|
|
- this.$refs.table.setCheck(rowKeys);
|
|
|
- }, 500);
|
|
|
- }
|
|
|
+ /**
|
|
|
+ * @description:查询
|
|
|
+ */
|
|
|
+ handleSearch() {
|
|
|
+ this.$refs.table.searchForm();
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 进入页面默认选中设置
|
|
|
+ */
|
|
|
+ beforeQuest(res) {
|
|
|
+ const { content, totalElements } = res.data;
|
|
|
+ this.currentPageContent = content;
|
|
|
+ if (this.newChooseArr.length > 0) {
|
|
|
+ let rowKeys = [];
|
|
|
+ for (let j = 0; j < content.length; j++) {
|
|
|
+ const cItem = content[j];
|
|
|
+ const index = this.newChooseArr.findIndex((item) => (item.id || item) == cItem.id);
|
|
|
+ if (index > -1) {
|
|
|
+ rowKeys.push(this.newChooseArr[index].id || this.newChooseArr[index]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ setTimeout(() => {
|
|
|
+ this.$refs.table.setCheck(rowKeys);
|
|
|
+ }, 500);
|
|
|
+ }
|
|
|
|
|
|
- const result = {
|
|
|
- data: {
|
|
|
- content,
|
|
|
- totalElements
|
|
|
- }
|
|
|
- };
|
|
|
- return result;
|
|
|
- },
|
|
|
- /**
|
|
|
- * 选中某条数据
|
|
|
- */
|
|
|
- handleSelect(selection, row) {
|
|
|
- let copyAttr = _.cloneDeep(this.newChooseArr);
|
|
|
- const index = this.newChooseArr.findIndex((item) => (item.id || item) == row.id);
|
|
|
- if (index > -1) {
|
|
|
- copyAttr.splice(index, 1);
|
|
|
- } else {
|
|
|
- copyAttr.push(row);
|
|
|
- }
|
|
|
- this.newChooseArr = copyAttr;
|
|
|
- console.log(this.newChooseArr);
|
|
|
- },
|
|
|
- /**
|
|
|
- * 选中/取消选中
|
|
|
- */
|
|
|
- handleCheckAll(selection) {
|
|
|
- const checked = selection.length == 0 ? false : true;
|
|
|
- this.currentPageContent.forEach((row) => {
|
|
|
- // this.handleSelect([], element);
|
|
|
- let copyAttr = _.cloneDeep(this.newChooseArr);
|
|
|
- const index = this.newChooseArr.findIndex((item) => (item.id || item) == row.id);
|
|
|
- if (checked) {
|
|
|
- if (index < 0) {
|
|
|
- copyAttr.push(row);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (index > -1) {
|
|
|
- copyAttr.splice(index, 1);
|
|
|
- }
|
|
|
- }
|
|
|
- this.newChooseArr = copyAttr;
|
|
|
- });
|
|
|
- console.log(this.newChooseArr);
|
|
|
- },
|
|
|
- /**
|
|
|
- * 关闭
|
|
|
- */
|
|
|
- handleClose() {
|
|
|
- this.$emit("close");
|
|
|
- },
|
|
|
- /**
|
|
|
- * 添加
|
|
|
- */
|
|
|
- handleSave() {
|
|
|
- const params = {
|
|
|
- ...this.otherParams,
|
|
|
- relIds: this.newChooseArr.map((item) => item.id || item)
|
|
|
- };
|
|
|
- addRelateApp(params).then((res) => {
|
|
|
- this.$message.success("保存成功");
|
|
|
- this.$emit("success");
|
|
|
- });
|
|
|
+ const result = {
|
|
|
+ data: {
|
|
|
+ content,
|
|
|
+ totalElements
|
|
|
+ }
|
|
|
+ };
|
|
|
+ return result;
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 选中某条数据
|
|
|
+ */
|
|
|
+ handleSelect(selection, row) {
|
|
|
+ let copyAttr = _.cloneDeep(this.newChooseArr);
|
|
|
+ const index = this.newChooseArr.findIndex((item) => (item.id || item) == row.id);
|
|
|
+ if (index > -1) {
|
|
|
+ copyAttr.splice(index, 1);
|
|
|
+ } else {
|
|
|
+ copyAttr.push(row);
|
|
|
+ }
|
|
|
+ this.newChooseArr = copyAttr;
|
|
|
+ console.log(this.newChooseArr);
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * 选中/取消选中
|
|
|
+ */
|
|
|
+ handleCheckAll(selection) {
|
|
|
+ const checked = selection.length == 0 ? false : true;
|
|
|
+ this.currentPageContent.forEach((row) => {
|
|
|
+ // this.handleSelect([], element);
|
|
|
+ let copyAttr = _.cloneDeep(this.newChooseArr);
|
|
|
+ const index = this.newChooseArr.findIndex((item) => (item.id || item) == row.id);
|
|
|
+ if (checked) {
|
|
|
+ if (index < 0) {
|
|
|
+ copyAttr.push(row);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (index > -1) {
|
|
|
+ copyAttr.splice(index, 1);
|
|
|
+ }
|
|
|
}
|
|
|
+ this.newChooseArr = copyAttr;
|
|
|
+ });
|
|
|
+ console.log(this.newChooseArr);
|
|
|
},
|
|
|
- created() {
|
|
|
- getRelateIds(this.otherParams).then((res) => {
|
|
|
- this.newChooseArr = res.data.content;
|
|
|
- });
|
|
|
+ /**
|
|
|
+ * 关闭
|
|
|
+ */
|
|
|
+ handleClose() {
|
|
|
+ this.$emit('close');
|
|
|
},
|
|
|
- mounted() {
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ */
|
|
|
+ handleSave() {
|
|
|
+ const params = {
|
|
|
+ ...this.otherParams,
|
|
|
+ relIds: this.newChooseArr.map((item) => item.id || item)
|
|
|
+ };
|
|
|
+ addRelateApp(params).then((res) => {
|
|
|
+ this.$message.success('保存成功');
|
|
|
+ this.$emit('success');
|
|
|
+ });
|
|
|
}
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ getRelateIds(this.otherParams).then((res) => {
|
|
|
+ this.newChooseArr = res.data.content;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ mounted() {}
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped></style>
|