1 | <template>
|
2 | <div style="padding: 0px 100px;" class="flex">
|
3 | <div class="btn-group auto" style="margin-bottom: 30px">
|
4 | <button type="button" class="button_clear button_spacing" style="width: 70px" @click="removeData(ids)" v-if="hasbtn('批量删除')">批量删除</button>
|
5 | <button type="button" class="button_new button_spacing" style="width: 70px" @click='add("add-org")' v-if="hasbtn('添加组织')">添加组织</button>
|
6 | <button type="button" class="button_new button_spacing" style="width: 70px" @click='add("add-zone")' v-if="hasbtn('添加片区')">添加片区</button>
|
7 | </div>
|
8 | <div class="datapanel">
|
9 | <h3 class="txtline"> 【{{data.name}}】组织管理</h3>
|
10 | <data-grid class="list_area table_sy" partial='list' v-ref:grid :model="model">
|
11 | <template partial='head'>
|
12 | <tr>
|
13 | <th>全选
|
14 | <input type="checkbox" class="all-checked" v-model="checked" @click="$parent.$parent.isAll(checked)">
|
15 | </th>
|
16 | <th></th>
|
17 | <th>资源名称</th>
|
18 | <th>修改</th>
|
19 | <th>删除</th>
|
20 | </tr>
|
21 | </template>
|
22 | <template partial='body'>
|
23 | <tr v-if="">
|
24 | <td style="text-align: center;">
|
25 | <input type="checkbox" v-model="$parent.$parent.ids" :value="row">
|
26 | </td>
|
27 | <td style="text-align: center;"><img :src="$parent.$parent.imgsrc(row.f_icon)" alt=""></td>
|
28 | <td style="text-align: center;">{{row.name}}</td>
|
29 | <td style="text-align: center;" ><img height="15" width="15" v-if="row.resourcetype == 'organization' || row.resourcetype == 'zone'" src="../../../static/ldaplefticon/修改.png" @click="$parent.$parent.modify(row)"></img></td>
|
30 | <td style="text-align: center;"><img height="15" width="15" v-if="row.resourcetype == 'organization' || row.resourcetype == 'zone'" src="../../../static/ldaplefticon/删除.png" @click="$parent.$parent.removeData([row])"></img></td>
|
31 | </tr>
|
32 | </template>
|
33 | </data-grid>
|
34 | </div>
|
35 |
|
36 | </div>
|
37 | </template>
|
38 |
|
39 | <script>
|
40 | import { PagedList } from 'vue-client'
|
41 | import co from 'co'
|
42 | import * as Util from '../Util'
|
43 |
|
44 | let gen = function * (self) {
|
45 |
|
46 | self.model = yield self.$http.post('rs/search',{source: `this.getRights().where(row.getAttributes().get($parentid$) == $${self.data.id}$)`, userid: self.userid})
|
47 |
|
48 | }
|
49 | let deleteData = function * (self,data) {
|
50 | let msg = yield self.$http.post('rs/data/delete',{data: data})
|
51 |
|
52 | yield self.$showMessage(msg.bodyText)
|
53 | self.ids = []
|
54 | self.refresh()
|
55 | self.flush()
|
56 | }
|
57 | export default {
|
58 | title: '组织机构',
|
59 | props: ['data', 'userid'],
|
60 | ready() {
|
61 | this.$parent.setTitle(this.data.name)
|
62 | this.refresh()
|
63 | },
|
64 | data() {
|
65 | return {
|
66 | ids: [],
|
67 | model: ''
|
68 | }
|
69 | },
|
70 | methods: {
|
71 | flush(){
|
72 | this.$parent.$parent.$parent.$parent.flush()
|
73 | },
|
74 |
|
75 | refresh () {
|
76 | let g = gen(this)
|
77 | co(g)
|
78 | },
|
79 | add(name) {
|
80 | console.log(name)
|
81 | let parent = this.data
|
82 | delete parent.children
|
83 | this.$goto(name, {parent: parent}, 'self', this.isRefresh)
|
84 | },
|
85 | modify(row) {
|
86 | let type = row.resourcetype
|
87 | let name = ''
|
88 | if (type === 'organization') {
|
89 | name = 'add-org'
|
90 | }else if (type === 'zone') {
|
91 | name = 'add-zone'
|
92 | }
|
93 | let parent = this.data
|
94 | delete parent.children
|
95 | this.$goto(name, {parent: parent, data: row},'self', this.isRefresh)
|
96 | this.refresh()
|
97 | },
|
98 | isAll (checked) {
|
99 | this.ids = []
|
100 | if (!checked) {
|
101 | this.model.data.forEach((row) => {
|
102 | this.ids.push(row)
|
103 | })
|
104 | }
|
105 | },
|
106 | imgsrc (name) {
|
107 | return Util.getImgsrc(name)
|
108 | },
|
109 | hasbtn (val) {
|
110 | if(this.$login.f.lics&&this.$login.f.lics.includes(val)){
|
111 | return true
|
112 | }else {
|
113 | return false
|
114 | }
|
115 | },
|
116 | removeData (data) {
|
117 | var removeName = ''
|
118 | data.forEach((item) => {
|
119 | removeName = removeName + item.name + ';'
|
120 | })
|
121 | if(!removeName){
|
122 | this.$showMessage("请选择需要删除项!")
|
123 | } else {
|
124 | this.$showMessage('确定要删除【'+removeName+'】', ['confirm', 'cancel']).then((res) => {
|
125 | if (res === 'confirm') {
|
126 | let d = deleteData(this,data)
|
127 | co(d)
|
128 | }
|
129 | })
|
130 | }
|
131 | },
|
132 | isRefresh (param) {
|
133 | if (param === 'refresh') {
|
134 | this.refresh()
|
135 | }
|
136 | }
|
137 | }
|
138 | }
|
139 | </script>
|
140 | <style>
|
141 | .all-checked {
|
142 | vertical-align: text-top;
|
143 | margin-left: 10px !important;
|
144 | }
|
145 | td > .glyphicon {
|
146 | cursor: pointer;
|
147 | }
|
148 | th > input[type="checkbox"], td > input[type="checkbox"] {
|
149 | cursor: pointer;
|
150 | }
|
151 | .btn-group>.btn {
|
152 | margin-right: 20px;
|
153 | }
|
154 | .datapanel {
|
155 | color: #333;
|
156 | background-color: white;
|
157 | box-shadow: darkgrey 0.5px 0.5px 0.5px 0.5px ;
|
158 | padding: 10px 30px 10px 30px;
|
159 | border-radius:15px;
|
160 | }
|
161 | .txtline {
|
162 | border-left-width:5px;
|
163 | border-left-style:solid;
|
164 | border-left-color:#4a7cae;
|
165 | }
|
166 | .form-fix-width{
|
167 | display: -webkit-box;
|
168 | display: -webkit-flex;
|
169 | display: -ms-flexbox;
|
170 | display:flex;
|
171 | }
|
172 | .form-fix-width>:first-child{
|
173 | width: 100px;
|
174 | -webkit-box-flex:none;
|
175 | -webkit-flex:none;
|
176 | -ms-flexbox-flex:none;
|
177 | flex:none;
|
178 | }
|
179 | .form-fix-width>:last-child{
|
180 | flex:1;
|
181 | -webkit-box-flex:1;
|
182 | -webkit-flex:1;
|
183 | -ms-flexbox-flex:1;
|
184 | }
|
185 | </style>
|