|
|
@@ -13,11 +13,33 @@
|
|
|
<el-button type="primary" size="small" @click="sumbit">确 定</el-button>
|
|
|
</span>
|
|
|
</el-dialog>
|
|
|
- <el-dialog title="授权机构" width="25%" :visible.sync="dialogVisible">
|
|
|
- <el-tree ref="tree" :data="treedata" accordion :props="defaultProps" show-checkbox node-key="id"
|
|
|
- :default-checked-keys="treekeys" @check-change="treechange"
|
|
|
- :default-expand-all="expandshow" class="stafftree">
|
|
|
- </el-tree>
|
|
|
+ <el-dialog title="授权机构" width="45%" :visible.sync="dialogVisible">
|
|
|
+ <el-row :gutter="20">
|
|
|
+ <el-col :span="12">
|
|
|
+ <div >
|
|
|
+ <span>工号:</span> <el-input clearable style="width: 220px;" placeholder="请输入工号" size="small" v-model="treeSeachId">
|
|
|
+ </el-input>
|
|
|
+ </div>
|
|
|
+ <div style="margin: 10px 0;">
|
|
|
+ <span>名称:</span><el-input clearable style="width: 220px;" size="small" placeholder="请输入六级机构名称" v-model="treeSeachname">
|
|
|
+ </el-input>
|
|
|
+ <el-button type="primary" size="small" @click="seachTree">搜索</el-button>
|
|
|
+ </div>
|
|
|
+ <div style="height: 480px;overflow-y: auto;">
|
|
|
+ <el-tree ref="tree" :data="treedata" accordion :props="defaultProps" show-checkbox node-key="id"
|
|
|
+ :default-checked-keys="treekeys" @check-change="treechange" :default-expand-all="expandshow"
|
|
|
+ class="stafftree">
|
|
|
+ </el-tree>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="11" :offset="1" style="height: 500px;overflow-y: auto;">
|
|
|
+ <h4>已选中机构名称</h4>
|
|
|
+ <div v-for="val in treedatatransfer" :key="val.id">
|
|
|
+ <p>{{ val }}</p>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button size="small" @click="dialogVisible = false">取 消</el-button>
|
|
|
<el-button type="primary" size="small" @click="sumbitInstitution">确 定</el-button>
|
|
|
@@ -32,8 +54,14 @@ import templateForm from "@/components/TemplateForm/index.vue";
|
|
|
export default {
|
|
|
name: "policyImport",
|
|
|
components: { templateTable, templateForm },
|
|
|
+ watch: {
|
|
|
+ filterText(val) {
|
|
|
+ this.$refs.tree.filter(val);
|
|
|
+ }
|
|
|
+ },
|
|
|
data() {
|
|
|
return {
|
|
|
+ treedatatransfer: [],
|
|
|
dept: [],
|
|
|
name: '',
|
|
|
dialogTitle: '新增',
|
|
|
@@ -75,7 +103,7 @@ export default {
|
|
|
type: "text"
|
|
|
},
|
|
|
{
|
|
|
- prop: "updateBy",
|
|
|
+ prop: "createBy",
|
|
|
label: "操作人",
|
|
|
type: "text"
|
|
|
},
|
|
|
@@ -87,7 +115,7 @@ export default {
|
|
|
type: "primary",
|
|
|
label: "授权机构",
|
|
|
click: (row, index) => {
|
|
|
- return this.uthorizedAgency(row)
|
|
|
+ return this.uthorizedAgency(row)
|
|
|
},
|
|
|
},
|
|
|
{
|
|
|
@@ -109,71 +137,113 @@ export default {
|
|
|
},
|
|
|
treedata: [], //授权结构树
|
|
|
defaultProps: {
|
|
|
- //自定义参数
|
|
|
- children: "children",
|
|
|
- label: "name",
|
|
|
- },
|
|
|
- treekeys: [],
|
|
|
- expandshow: false,
|
|
|
+ //自定义参数
|
|
|
+ children: "children",
|
|
|
+ label: "name",
|
|
|
+ },
|
|
|
+ treekeys: [],
|
|
|
+ expandshow: false,
|
|
|
+ treeSeachId: '',
|
|
|
+ treeSeachname: '',
|
|
|
};
|
|
|
},
|
|
|
created() {
|
|
|
this.getList();
|
|
|
- this.$api.dept.findDeptTree("9", "").then((res) => {
|
|
|
+
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ treeListFun(data){
|
|
|
+ this.$api.dept.queryTreeList(data).then((res) => {
|
|
|
this.treedata = res.data;
|
|
|
this.setDisabled(this.treedata)
|
|
|
});
|
|
|
- },
|
|
|
- methods: {
|
|
|
- uthorizedAgency(row){
|
|
|
- this.rowId=row.id
|
|
|
+ },
|
|
|
+ seachTree(){
|
|
|
+ let data={
|
|
|
+ id:this.treeSeachId,
|
|
|
+ name:this.treeSeachname
|
|
|
+ }
|
|
|
+ this.treeListFun(data)
|
|
|
+ },
|
|
|
+ getNodeLabelById(id) {
|
|
|
+ let label = null;
|
|
|
+ const findNode = (nodes) => {
|
|
|
+ nodes.forEach(node => {
|
|
|
+ if (node.id === id) {
|
|
|
+ label = node.name;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (node.children && node.children.length > 0) {
|
|
|
+ findNode(node.children);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ };
|
|
|
+ findNode(this.treedata);
|
|
|
+ return label;
|
|
|
+ },
|
|
|
+ uthorizedAgency(row) {
|
|
|
+ this.treeListFun({
|
|
|
+ "id": "",
|
|
|
+ "name": "",
|
|
|
+ })
|
|
|
+ this.rowId = row.id
|
|
|
+ this.treedatatransfer = []
|
|
|
+ this.treeSeachId=""
|
|
|
+ this.treeSeachname=""
|
|
|
this.$api.sys
|
|
|
- .queryRelationList(row.id)
|
|
|
- .then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.dialogVisible=true
|
|
|
- setTimeout(()=>{
|
|
|
- this.dept=res.data
|
|
|
- this.$refs.tree.setCheckedKeys(res.data);
|
|
|
- },500)
|
|
|
-
|
|
|
- } else {
|
|
|
- this.$message.error(res.msg);
|
|
|
- }
|
|
|
- });
|
|
|
+ .queryRelationList(row.id)
|
|
|
+ .then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.dialogVisible = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.dept = res.data
|
|
|
+ this.$refs.tree.setCheckedKeys(res.data);
|
|
|
+ res.data.forEach(e => {
|
|
|
+ this.treedatatransfer.push(this.getNodeLabelById(e))
|
|
|
+ })
|
|
|
+ }, 500)
|
|
|
+
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
},
|
|
|
- //获取选中节点
|
|
|
- treechange(item, node, self) {
|
|
|
- if(item.children.length==0){
|
|
|
- if (node === true) {
|
|
|
- this.dept.push(item.id)
|
|
|
|
|
|
- } else {
|
|
|
- let index = this.dept.indexOf(this.dept.filter(e=>e==item.id)[0]);
|
|
|
- if (index !== -1) {
|
|
|
- this.dept.splice(index, 1);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- },
|
|
|
- // 向有children的节点上增加disabled属性
|
|
|
- setDisabled(treeData) {
|
|
|
+ //获取选中节点
|
|
|
+ treechange(item, node, self) {
|
|
|
+ if (item.children.length == 0) {
|
|
|
+ if (node === true) {
|
|
|
+ this.dept.push(item.id)
|
|
|
+ this.treedatatransfer.push(item.name)
|
|
|
+ } else {
|
|
|
+ let index = this.dept.indexOf(this.dept.filter(e => e == item.id)[0]);
|
|
|
+ let name = this.treedatatransfer.indexOf(this.treedatatransfer.filter(e => e == item.name)[0]);
|
|
|
+ if (index !== -1) {
|
|
|
+ this.dept.splice(index, 1);
|
|
|
+ this.treedatatransfer.splice(name, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ },
|
|
|
+ // 向有children的节点上增加disabled属性
|
|
|
+ setDisabled(treeData) {
|
|
|
if (treeData) {
|
|
|
treeData.forEach(item => {
|
|
|
- if (!item.deptType || item.deptType!=='D') {
|
|
|
+ if (!item.deptType || item.deptType !== 'D' || !item.id.includes('M')) {
|
|
|
item.disabled = true
|
|
|
this.setDisabled(item.children)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
// 查询
|
|
|
handleSearchList(data) {
|
|
|
this.getList(data);
|
|
|
},
|
|
|
add() {
|
|
|
+ this.name=''
|
|
|
this.dialogVisibleadd = true
|
|
|
this.dialogTitle = '新增'
|
|
|
},
|
|
|
@@ -249,18 +319,18 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- sumbitInstitution(){
|
|
|
+ sumbitInstitution() {
|
|
|
this.$api.sys
|
|
|
- .sysChannelauthorized({ areaIdList: this.dept,id:this.rowId })
|
|
|
- .then(res => {
|
|
|
- if (res.code == 200) {
|
|
|
- this.getList();
|
|
|
- this.dialogVisible = false
|
|
|
+ .sysChannelauthorized({ areaIdList: this.dept, id: this.rowId })
|
|
|
+ .then(res => {
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.getList();
|
|
|
+ this.dialogVisible = false
|
|
|
|
|
|
- } else {
|
|
|
- this.$message.error(res.msg);
|
|
|
- }
|
|
|
- });
|
|
|
+ } else {
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
+ });
|
|
|
|
|
|
},
|
|
|
handleTableUpload(row) {
|
|
|
@@ -273,16 +343,16 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
-/deep/{
|
|
|
+/deep/ {
|
|
|
.stafftree {
|
|
|
-
|
|
|
- // 不可全选样式
|
|
|
- .el-tree-node {
|
|
|
- .el-checkbox__input.is-disabled {
|
|
|
- display: none;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
+ // 不可全选样式
|
|
|
+ .el-tree-node {
|
|
|
+ .el-checkbox__input.is-disabled {
|
|
|
+ display: none;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
</style>
|