Showing
10 changed files
with
1060 additions
and
31 deletions
@@ -5,8 +5,8 @@ | @@ -5,8 +5,8 @@ | ||
5 | 5 | ||
6 | <template #footer v-if="showFooter"> | 6 | <template #footer v-if="showFooter"> |
7 | <span class="dialog-footer"> | 7 | <span class="dialog-footer"> |
8 | - <el-button @click="hideElDialog">{{cancelText}}</el-button> | ||
9 | - <el-button type="primary" @click="okFunc">{{okText}}</el-button> | 8 | + <el-button @click="hideElDialog" v-if="showCancelBtn">{{cancelText}}</el-button> |
9 | + <el-button type="primary" @click="okFunc" v-if="showOkBtn">{{okText}}</el-button> | ||
10 | </span> | 10 | </span> |
11 | </template> | 11 | </template> |
12 | </el-dialog> | 12 | </el-dialog> |
@@ -15,11 +15,21 @@ export default { | @@ -15,11 +15,21 @@ export default { | ||
15 | type: String, | 15 | type: String, |
16 | default: "新建" | 16 | default: "新建" |
17 | }, | 17 | }, |
18 | + // 展示取消按钮 | ||
19 | + showCancelBtn: { | ||
20 | + type: Boolean, | ||
21 | + default: true | ||
22 | + }, | ||
18 | // 取消文本 | 23 | // 取消文本 |
19 | cancelText: { | 24 | cancelText: { |
20 | type: String, | 25 | type: String, |
21 | default: "取消" | 26 | default: "取消" |
22 | }, | 27 | }, |
28 | + // 展示确定按钮 | ||
29 | + showOkBtn: { | ||
30 | + type: Boolean, | ||
31 | + default: true | ||
32 | + }, | ||
23 | // 确定文本 | 33 | // 确定文本 |
24 | okText: { | 34 | okText: { |
25 | type: String, | 35 | type: String, |
1 | -<cm-dialog title="文件上传" width="500px" :showDialogVisible="show" @hidedialog="hidedialog" @okfunc="uploadFile" okText="上传"> | 1 | +<cm-dialog v-if="!isInset" title="文件上传" width="500px" :showDialogVisible="show" @hidedialog="hidedialog" @okfunc="uploadFile" okText="上传"> |
2 | <template v-slot> | 2 | <template v-slot> |
3 | 3 | ||
4 | <el-upload | 4 | <el-upload |
@@ -6,9 +6,10 @@ | @@ -6,9 +6,10 @@ | ||
6 | ref="upload" | 6 | ref="upload" |
7 | :http-request="getFile" | 7 | :http-request="getFile" |
8 | :multiple="true" | 8 | :multiple="true" |
9 | + :before-upload="beforeUpload" | ||
9 | :auto-upload="false"> | 10 | :auto-upload="false"> |
10 | <template #trigger> | 11 | <template #trigger> |
11 | - <el-button size="small" type="primary">选择文件</el-button> | 12 | + <el-button size="small" type="primary">{{btnText}}</el-button> |
12 | </template> | 13 | </template> |
13 | 支持格式: | 14 | 支持格式: |
14 | <el-tooltip placement="top" effect="light"> | 15 | <el-tooltip placement="top" effect="light"> |
@@ -25,3 +26,14 @@ | @@ -25,3 +26,14 @@ | ||
25 | </el-upload> | 26 | </el-upload> |
26 | </template> | 27 | </template> |
27 | </cm-dialog> | 28 | </cm-dialog> |
29 | + | ||
30 | +<!--页面嵌套方式--> | ||
31 | +<el-upload | ||
32 | + v-if="isInset" | ||
33 | + :show-file-list="false" | ||
34 | + :before-upload="beforeUpload" | ||
35 | + :multiple="false" | ||
36 | + :http-request="getInsetFile" | ||
37 | + :auto-upload="true"> | ||
38 | + <el-button size="small" type="primary">上传照片</el-button> | ||
39 | +</el-upload> |
@@ -6,6 +6,15 @@ export default { | @@ -6,6 +6,15 @@ export default { | ||
6 | template: '', | 6 | template: '', |
7 | components: {}, | 7 | components: {}, |
8 | props: { | 8 | props: { |
9 | + // 嵌套方式 | ||
10 | + isInset: { | ||
11 | + type: Boolean, | ||
12 | + default: false | ||
13 | + }, | ||
14 | + btnText:{ | ||
15 | + type: String, | ||
16 | + default: '选择文件' | ||
17 | + }, | ||
9 | showDialogVisible: { | 18 | showDialogVisible: { |
10 | type: Boolean, | 19 | type: Boolean, |
11 | default: false | 20 | default: false |
@@ -126,6 +135,17 @@ export default { | @@ -126,6 +135,17 @@ export default { | ||
126 | let uploadFile = () => { | 135 | let uploadFile = () => { |
127 | proxy.$refs.upload.submit() | 136 | proxy.$refs.upload.submit() |
128 | } | 137 | } |
138 | + | ||
139 | + // 提交前的验证 | ||
140 | + let beforeUpload = (file) =>{ | ||
141 | + return emit('beforeUpload',res.file) | ||
142 | + } | ||
143 | + | ||
144 | + let getInsetFile = (param) =>{ | ||
145 | + let fileObj = param.file | ||
146 | + emit('callback',fileObj) | ||
147 | + } | ||
148 | + | ||
129 | // 监听编辑状态 | 149 | // 监听编辑状态 |
130 | Vue.watch( | 150 | Vue.watch( |
131 | () => props.showDialogVisible, (newValue, oldVlaue) => { | 151 | () => props.showDialogVisible, (newValue, oldVlaue) => { |
@@ -142,10 +162,12 @@ export default { | @@ -142,10 +162,12 @@ export default { | ||
142 | 162 | ||
143 | 163 | ||
144 | return { | 164 | return { |
165 | + getInsetFile, | ||
145 | getFile, | 166 | getFile, |
146 | show, | 167 | show, |
147 | uploadFile, | 168 | uploadFile, |
148 | - hidedialog | 169 | + hidedialog, |
170 | + beforeUpload | ||
149 | } | 171 | } |
150 | } | 172 | } |
151 | } | 173 | } |
@@ -104,10 +104,38 @@ global.getQueryVariable = (variable) => { | @@ -104,10 +104,38 @@ global.getQueryVariable = (variable) => { | ||
104 | return (false); | 104 | return (false); |
105 | } | 105 | } |
106 | 106 | ||
107 | +/** | ||
108 | + * 文件预览 | ||
109 | + * @param path | ||
110 | + */ | ||
107 | global.viewer = (path) =>{ | 111 | global.viewer = (path) =>{ |
108 | window.open("/src/lib/extend/pdfjs/web/viewer.html?test=" + encodeURIComponent(path)); | 112 | window.open("/src/lib/extend/pdfjs/web/viewer.html?test=" + encodeURIComponent(path)); |
109 | } | 113 | } |
110 | 114 | ||
115 | +/** | ||
116 | + * 将文件转成base64 | ||
117 | + * @param file | ||
118 | + * @returns {Promise<String>} | ||
119 | + */ | ||
120 | +global.getBase64 = (file) =>{ | ||
121 | + return new Promise(function(resolve, reject) { | ||
122 | + let reader = new FileReader(); | ||
123 | + let imgResult = ""; | ||
124 | + reader.readAsDataURL(file); | ||
125 | + reader.onload = function() { | ||
126 | + imgResult = reader.result; | ||
127 | + }; | ||
128 | + reader.onerror = function(error) { | ||
129 | + reject(error); | ||
130 | + }; | ||
131 | + reader.onloadend = function() { | ||
132 | + resolve(imgResult); | ||
133 | + }; | ||
134 | + }); | ||
135 | +} | ||
136 | + | ||
137 | + | ||
138 | + | ||
111 | // 组件默认大小 | 139 | // 组件默认大小 |
112 | global.elementSize = 'small'; | 140 | global.elementSize = 'small'; |
113 | 141 |
1 | +// 业务类型管理 | ||
2 | +layui.define(['table', 'form', 'admin', 'layer', 'laytpl', 'common', 'view', 'sessions', 'commonDetail', 'treeTable', 'xmSelect', 'userlist', 'reslist'], function (exports) { | ||
3 | + var $ = layui.$; | ||
4 | + var form = layui.form; | ||
5 | + var layer = layui.layer; | ||
6 | + var admin = layui.admin; | ||
7 | + var table = layui.table; | ||
8 | + var treeTable = layui.treeTable; | ||
9 | + var xmSelect = layui.xmSelect; | ||
10 | + var laytpl = layui.laytpl; | ||
11 | + var view = layui.view; | ||
12 | + var common = layui.common; | ||
13 | + var commonDetail = layui.commonDetail; | ||
14 | + var domainName = common.domainName; | ||
15 | + // 业务类型展示表格 | ||
16 | + var busTypeTable; | ||
17 | + // 对外暴露的接口 | ||
18 | + exports('bustype', function (data) { | ||
19 | + var sessions = layui.sessions; | ||
20 | + var accessToken = sessions.getToken()['access_token']; | ||
21 | + | ||
22 | + var cutoverId = '', targetType = ''; | ||
23 | + if (data && data.cutoverId) { | ||
24 | + cutoverId = data.cutoverId; | ||
25 | + targetType = data.targetType; | ||
26 | + } | ||
27 | + var mode = (data && data.mode) ? data.mode : ''; | ||
28 | + var username = (data && data.username) ? data.username : ''; | ||
29 | + //展示类型 | ||
30 | + var showTypeList=[]; | ||
31 | + var dataBusType=[]; | ||
32 | + initShowType(); | ||
33 | + | ||
34 | + // 查询条件 | ||
35 | + var conditions = {busTypeName: ''}; | ||
36 | + // 加载遮罩 | ||
37 | + var loading; | ||
38 | + var checkList = common.checkPermission(accessToken); | ||
39 | + | ||
40 | + loadBusTypeTable(); | ||
41 | + // 查询条件框回车查询事件 | ||
42 | + $('#condition-bustype-name').keydown(function (e) { | ||
43 | + if (e.keyCode === 13) { | ||
44 | + loadBusTypeTable(); | ||
45 | + return false; | ||
46 | + } | ||
47 | + }); | ||
48 | + | ||
49 | + //查询按钮点击事件 joke add 20210428 | ||
50 | + $('#bustypeQueryBtn').on('click',function () { | ||
51 | + loadBusTypeTable(); | ||
52 | + }); | ||
53 | + | ||
54 | + // 删除按钮删除事件 | ||
55 | + $('#btn-bustype-delete').click(function () { | ||
56 | + var checks = busTypeTable.checkStatus(false); | ||
57 | + var busId = $.map(checks, function (item) { | ||
58 | + return item.busId; | ||
59 | + }); | ||
60 | + deleteBusTypeByIds(busId); | ||
61 | + }); | ||
62 | + //授权按钮事件 | ||
63 | + $("#btn-bustype-authorization").click(function () { | ||
64 | + var checks = busTypeTable.checkStatus(false); | ||
65 | + var busId = []; | ||
66 | + var j = 0; | ||
67 | + var number = 0; | ||
68 | + for (var i = 0; i < checks.length; i++) { | ||
69 | + if (checks[i].children != null) { | ||
70 | + j++; | ||
71 | + number = checks[i].children.length; | ||
72 | + } | ||
73 | + } | ||
74 | + if (j = 1 && checks.length - number == 1) { | ||
75 | + busId = checks[0].busId; | ||
76 | + } else { | ||
77 | + busId = $.map(checks, function (item) { | ||
78 | + return item.busId; | ||
79 | + }); | ||
80 | + } | ||
81 | + if (busId.length == 0) { | ||
82 | + layer.msg('请先选择数据', {icon: 0, timeout: 3000}); | ||
83 | + return; | ||
84 | + } else if (busId.length == 1) { | ||
85 | + busId = busId[0]; | ||
86 | + } else { | ||
87 | + busId = busId.toString(); | ||
88 | + } | ||
89 | + authorizationIndex(busId) | ||
90 | + }) | ||
91 | + | ||
92 | + var cols = [] | ||
93 | + if (!mode) { | ||
94 | + cols.push({ | ||
95 | + type: 'checkbox' | ||
96 | + }) | ||
97 | + } | ||
98 | + cols = cols.concat([{ | ||
99 | + type: 'numbers', title: '序号', align: 'center', width: 70 | ||
100 | + }, { | ||
101 | + field: 'busTypeName', title: '名称', align: 'left', | ||
102 | + templet: | ||
103 | + '<div>' + | ||
104 | + ' <span' + | ||
105 | + ' data-code="{{d.busTypeCode}}"' + | ||
106 | + ' class="layui-table-link btn-bustype-edit">{{d.busTypeName}}' + | ||
107 | + ' </span>' + | ||
108 | + '</div>' | ||
109 | + }, { | ||
110 | + field: 'nickname', title: '负责人', align: 'center' | ||
111 | + }, { | ||
112 | + field: 'busTypeDesc', title: '业务类型描述', align: 'left' | ||
113 | + }, { | ||
114 | + field: 'isUse', title: '是否使用', align: 'center', width: 120, | ||
115 | + templet: function (d) { | ||
116 | + switch (d.isUse) { | ||
117 | + case 0: | ||
118 | + return '否'; | ||
119 | + case 1: | ||
120 | + return '是'; | ||
121 | + default: | ||
122 | + return ''; | ||
123 | + } | ||
124 | + } | ||
125 | + }, { | ||
126 | + field: 'important', title: '重要程度', align: 'center', width: 120, | ||
127 | + templet: function (d) { | ||
128 | + switch (d.important) { | ||
129 | + case 1: | ||
130 | + return '核心'; | ||
131 | + case 2: | ||
132 | + return '重要'; | ||
133 | + case 3: | ||
134 | + return '一般'; | ||
135 | + case 9: | ||
136 | + return '虚拟业务'; | ||
137 | + default: | ||
138 | + return ''; | ||
139 | + } | ||
140 | + } | ||
141 | + }, { | ||
142 | + field: 'sort', title: '排序', align: 'right', width: 120, | ||
143 | + }]) | ||
144 | + if (!mode) { | ||
145 | + cols.push({ | ||
146 | + title: '操作', align: 'center', fixed: 'right', width: '10%', | ||
147 | + templet: function (d) { | ||
148 | + if (d.isLeaf) { | ||
149 | + return '' + | ||
150 | + '<div>' + | ||
151 | + '<button data-id="' + d.busId + '" lay-tips="删除" type="button" class="layui-btn layui-btn-xs layui-btn-normal btn-bustype-delete"><i class="layui-icon layui-icon-delete"></i></button>' + | ||
152 | + '<button data-id="' + d.busId + '" lay-tips="资源分配" type="button" class="layui-btn layui-btn-xs layui-btn-normal btn-bustype-res-config"><i class="layui-icon layui-icon-menu-fill"></i></button>' + | ||
153 | + '<button data-id="' + d.busId + '" lay-tips="授权" type="button" class="layui-btn layui-btn-xs layui-btn-normal btn-bustype-authorize"><i class="layui-icon layui-icon-auz"></i></button>' + | ||
154 | + '<button data-id="' + d.busId + '" lay-tips="乙方运维配置" type="button" class="layui-btn layui-btn-xs layui-btn-normal btn-bustype-yf-config"><i class="layui-icon layui-icon-auz"></i></button>' + | ||
155 | + '</div>' | ||
156 | + } else { | ||
157 | + return '' + | ||
158 | + '<div class="layui-row">' + | ||
159 | + '<button data-id="' + d.busId + '" lay-tips="删除" type="button" class="layui-btn layui-btn-xs layui-btn-normal btn-bustype-delete"><i class="layui-icon layui-icon-delete"></i></button>' + | ||
160 | + '<button data-id="' + d.busId + '" lay-tips="授权" type="button" class="layui-btn layui-btn-xs layui-btn-normal btn-bustype-authorize"><i class="layui-icon layui-icon-auz"></i></button>' + | ||
161 | + '</div>' | ||
162 | + } | ||
163 | + } | ||
164 | + }); | ||
165 | + } else { | ||
166 | + cols.push({field: 'showType', title: '展示类型', align: 'center',sort:true,width:210, | ||
167 | + templet: function (d) { | ||
168 | + if(d.parentId == '0' && dataBusType.indexOf(d.busId)>-1){ | ||
169 | + return ''; | ||
170 | + }else{ | ||
171 | + //初始化select内容 | ||
172 | + var html='<div><select lay-ignore data-index="99" name="showType" class="layui-input resourceType_showType" style="min-width: 150px;display:inline">'; | ||
173 | + $.each(showTypeList,function (i,v) { | ||
174 | + if(d.showType == v.value){ | ||
175 | + html += '<option value="' + v.value + '" selected>' + v.name + '</option> ' | ||
176 | + }else{ | ||
177 | + html += '<option value="' + v.value + '">' + v.name + '</option> ' | ||
178 | + } | ||
179 | + }); | ||
180 | + html+='</select></div>'; | ||
181 | + return html; | ||
182 | + } | ||
183 | + } | ||
184 | + }); | ||
185 | + cols.push({ | ||
186 | + title: '操作', align: 'center', fixed: 'right', width: '10%', | ||
187 | + templet: function (d) { | ||
188 | + if (d.userCount) { | ||
189 | + return '' + | ||
190 | + '<div class="layui-row">' + | ||
191 | + '<button data-id="' + d.busId + '" type="button" class="layui-btn layui-btn-xs btn-bustype-bind hide" lay-tips="未授权,点击授权"><i class="layui-icon layui-icon-link"></i> 添加授权</button>' + | ||
192 | + '<button data-id="' + d.busId + '" type="button" style="margin-left: 0" class="layui-btn layui-btn-xs layui-btn-danger btn-bustype-unbind" lay-tips="已授权,点击解除授权"><i class="layui-icon layui-icon-unlink"></i> 解除授权</button>' + | ||
193 | + '</div>'; | ||
194 | + } else { | ||
195 | + return '' + | ||
196 | + '<div class="layui-row">' + | ||
197 | + '<button data-id="' + d.busId + '" type="button" class="layui-btn layui-btn-xs btn-bustype-bind" lay-tips="未授权,点击授权"><i class="layui-icon layui-icon-link"></i> 添加授权</button>' + | ||
198 | + '<button data-id="' + d.busId + '" type="button" style="margin-left: 0" class="layui-btn layui-btn-xs layui-btn-danger btn-bustype-unbind hide" lay-tips="已授权,点击解除授权"><i class="layui-icon layui-icon-unlink"></i> 解除授权</button>' + | ||
199 | + '</div>'; | ||
200 | + } | ||
201 | + } | ||
202 | + }); | ||
203 | + } | ||
204 | + | ||
205 | + /** | ||
206 | + * 加载业务类型表格 | ||
207 | + */ | ||
208 | + function loadBusTypeTable() { | ||
209 | + conditions = { | ||
210 | + busTypeName: $('#condition-bustype-name').val() ? $('#condition-bustype-name').val().trim() : '', | ||
211 | + access_token: accessToken, | ||
212 | + cutoverId: cutoverId, | ||
213 | + targetType: targetType, | ||
214 | + username: username, | ||
215 | + page: -1, | ||
216 | + limit: -1 | ||
217 | + }; | ||
218 | + conditions.limit = -1; | ||
219 | + admin.req({ | ||
220 | + url: domainName + '/api-web/manage/bustype/page', | ||
221 | + data: conditions | ||
222 | + }).done(function (response) { | ||
223 | + $.each(response.data,function (i,v) { | ||
224 | + dataBusType.push(v.parentId); | ||
225 | + }) | ||
226 | + // 设置总数 | ||
227 | + $('#span-bustype-total').html('共 ' + response.data.length + ' 个业务'); | ||
228 | + // 渲染表格 | ||
229 | + busTypeTable = treeTable.render({ | ||
230 | + elem: '#bustype-table', | ||
231 | + data: response.data, | ||
232 | + page: { | ||
233 | + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'], | ||
234 | + theme: '#1E9FFF' | ||
235 | + }, | ||
236 | + tree: { | ||
237 | + iconIndex: mode ? 1 : 2, // 折叠图标显示在第几列 | ||
238 | + isPidData: true, // 是否是id、pid形式数据 | ||
239 | + idName: 'busId', // id字段名称 | ||
240 | + pidName: 'parentId', // pid字段名称 | ||
241 | + onlyIconControl: true // 仅允许点击图标折叠 | ||
242 | + }, | ||
243 | + cols: cols | ||
244 | + }); | ||
245 | + | ||
246 | + //回填数据 | ||
247 | + if (data && data.username) { | ||
248 | + if (data.username.length == 1) { | ||
249 | + $.ajax({ | ||
250 | + type: "get", | ||
251 | + url: domainName + "/api-web/manage/bustype/getBusTypeByUser?access_token=" + accessToken + "&username=" + data.username[0], | ||
252 | + success: function (res) { | ||
253 | + if (res && res.success) { | ||
254 | + var busTypeData = res.data; | ||
255 | + busTypeTable.setChecked(busTypeData.map(item => item.busId)) | ||
256 | + } | ||
257 | + }, | ||
258 | + }) | ||
259 | + } | ||
260 | + } | ||
261 | + | ||
262 | + // 点击编号编辑事件 | ||
263 | + $('.btn-bustype-edit').click(function () { | ||
264 | + if ($.inArray('back:bustype:update', checkList) == -1) { | ||
265 | + layer.msg('暂无权限!', {icon: 7, time: 3000}); | ||
266 | + return; | ||
267 | + } | ||
268 | + var busTypeCode = $(this).data('code'); | ||
269 | + saveBusType(busTypeCode); | ||
270 | + }); | ||
271 | + // 删除事件 | ||
272 | + $('.btn-bustype-delete').click(function () { | ||
273 | + var busId = $(this).data('id'); | ||
274 | + deleteBusTypeByIds([busId]); | ||
275 | + }); | ||
276 | + // 授权事件 | ||
277 | + $('.btn-bustype-authorize').click(function () { | ||
278 | + loading = layer.load(2); | ||
279 | + var busId = $(this).data('id') | ||
280 | + | ||
281 | + authorizationIndex(busId) | ||
282 | + }); | ||
283 | + // 乙方运维配置 | ||
284 | + $('.btn-bustype-yf-config').click(function () { | ||
285 | + // TODO | ||
286 | + layer.open({ | ||
287 | + type: 2 | ||
288 | + ,title: "乙方运维配置" | ||
289 | + ,closeBtn: false | ||
290 | + ,area: ['80%', '60%'] | ||
291 | + ,shade: 0.8 | ||
292 | + , btn:["关闭"] | ||
293 | + ,id: 'operationMaintenance-config' //设定一个id,防止重复弹出 | ||
294 | + ,content:`/vue3/index.html#/operationMaintenance/config` | ||
295 | + ,yes: function(index, layero){ | ||
296 | + layer.closeAll(); | ||
297 | + return false; | ||
298 | + } | ||
299 | + }); | ||
300 | + | ||
301 | + }); | ||
302 | + | ||
303 | + $('.btn-bustype-bind').unbind('click').on('click', function () { | ||
304 | + var $this = $(this); | ||
305 | + var busId = $this.data('id') | ||
306 | + | ||
307 | + layer.load(2); | ||
308 | + admin.req({ | ||
309 | + url: domainName + '/api-web/manage/bustype/bindUser/' + busId, | ||
310 | + data: {username}, | ||
311 | + success(response) { | ||
312 | + layer.closeAll('loading'); | ||
313 | + if (response && response.success) { | ||
314 | + $this.addClass('hide'); | ||
315 | + $this.parent().find('.btn-bustype-unbind').removeClass('hide') | ||
316 | + var $child = $('tr[data-pid="' + busId + '"] .btn-bustype-bind'); | ||
317 | + $child.addClass('hide') | ||
318 | + $child.parent().find('.btn-bustype-unbind').removeClass('hide') | ||
319 | + } else { | ||
320 | + layer.msg('授权失败!', {icon: 2}); | ||
321 | + } | ||
322 | + }, | ||
323 | + error() { | ||
324 | + layer.closeAll('loading'); | ||
325 | + } | ||
326 | + }) | ||
327 | + }); | ||
328 | + $('.btn-bustype-unbind').unbind('click').on('click', function () { | ||
329 | + var $this = $(this); | ||
330 | + var busId = $this.data('id') | ||
331 | + | ||
332 | + layer.load(2); | ||
333 | + admin.req({ | ||
334 | + url: domainName + '/api-web/manage/bustype/unBindUser/' + busId, | ||
335 | + data: {username}, | ||
336 | + success(response) { | ||
337 | + layer.closeAll('loading'); | ||
338 | + if (response && response.success) { | ||
339 | + $this.addClass('hide'); | ||
340 | + $this.parent().find('.btn-bustype-bind').removeClass('hide') | ||
341 | + } else { | ||
342 | + layer.msg('取消授权失败!', {icon: 2}); | ||
343 | + } | ||
344 | + }, | ||
345 | + error() { | ||
346 | + layer.closeAll('loading'); | ||
347 | + } | ||
348 | + }) | ||
349 | + }); | ||
350 | + // 资源分配事件 | ||
351 | + // $('.btn-bustype-res-config').click(function () { | ||
352 | + // var busId = $(this).data('id'); | ||
353 | + // var bustypeReslist = layui.reslist({busId: busId, idSuffix: 1}) | ||
354 | + // // 展示资源页面layerindex | ||
355 | + // var bustypeReslayerIndex; | ||
356 | + // common.openWin("template/res/reslist", "当前绑定的资源", {busId: busId, idSuffix: 1}, ["完成", "取消"], function () { | ||
357 | + // layer.close(bustypeReslayerIndex); | ||
358 | + // }, null, ['80%', '90%'], | ||
359 | + // function (layero, layerIndex) { | ||
360 | + // bustypeReslayerIndex = layerIndex; | ||
361 | + // // 新增按钮 | ||
362 | + // $("#bustype-reslist-add").click(function () { | ||
363 | + // var reslist = layui.reslist(); | ||
364 | + // // 添加绑定页面的layerindex | ||
365 | + // var addResLayerIndex; | ||
366 | + // common.openWin("template/res/reslist", "添加绑定", {}, ["添加", "取消"], function () { | ||
367 | + // loading = layer.load(2); | ||
368 | + // // 当前选中的资源 | ||
369 | + // var checks = reslist.getData(); | ||
370 | + // // 之前已经选择过的资源 | ||
371 | + // var oldResIdList = []; | ||
372 | + // admin.req({ | ||
373 | + // url: domainName + '/api-web/manage/bustype/resourceList/' + busId, | ||
374 | + // async: false, | ||
375 | + // error: function () { | ||
376 | + // layer.close(loading); | ||
377 | + // } | ||
378 | + // }).done(function (response) { | ||
379 | + // $.each(response.data, function (index, value) { | ||
380 | + // oldResIdList.push(value.resId); | ||
381 | + // }); | ||
382 | + // }); | ||
383 | + // // 需要进行插入的资源 | ||
384 | + // var inserts = []; | ||
385 | + // var insertCount = 0; | ||
386 | + // var isExistCount = 0; | ||
387 | + // $.each(checks, function (index, value) { | ||
388 | + // if (oldResIdList.indexOf(value.resId) === -1) { | ||
389 | + // inserts.push(value.resId); | ||
390 | + // insertCount++; | ||
391 | + // } else { | ||
392 | + // isExistCount++; | ||
393 | + // } | ||
394 | + // }); | ||
395 | + // if (inserts.length === 0) { | ||
396 | + // layer.msg('所选的都已存在,无需重复添加!', {icon: 7, time: 5000}); | ||
397 | + // layer.close(loading); | ||
398 | + // return; | ||
399 | + // } | ||
400 | + // // 发送请求添加绑定 | ||
401 | + // admin.req({ | ||
402 | + // url: domainName + '/api-web/manage/bustype/addResource/' + busId + '?access_token=' + accessToken, | ||
403 | + // type: 'POST', | ||
404 | + // contentType: 'application/json', | ||
405 | + // data: JSON.stringify(inserts), | ||
406 | + // error: function () { | ||
407 | + // layer.close(loading); | ||
408 | + // } | ||
409 | + // }).done(function (response) { | ||
410 | + // layer.close(loading); | ||
411 | + // if (response.success) { | ||
412 | + // layer.msg('添加绑定成功!此次添加了' + insertCount + '个新资源' + (isExistCount > 0 ? ',有' + isExistCount + '个已经存在。' : ''), {icon: 1, time: 5000}); | ||
413 | + // layer.close(addResLayerIndex); | ||
414 | + // bustypeReslist.reloadResTable(); | ||
415 | + // } else { | ||
416 | + // layer.msg('添加绑定失败!', {icon: 2, time: 3000}); | ||
417 | + // } | ||
418 | + // }); | ||
419 | + // }, null, ['90%', '80%'], function (layero, layerIndex) { | ||
420 | + // addResLayerIndex = layerIndex | ||
421 | + // }); | ||
422 | + // }); | ||
423 | + // // 取消绑定按钮 | ||
424 | + // $("#bustype-reslist-unbind").click(function () { | ||
425 | + // // 需要取消绑定的资源id集合 | ||
426 | + // var deletes = []; | ||
427 | + // $.each(bustypeReslist.getData(), function (index, value) { | ||
428 | + // deletes.push(value.resId); | ||
429 | + // }); | ||
430 | + // admin.req({ | ||
431 | + // url: domainName + '/api-web/manage/bustype/deleteResource/' + busId + '?access_token=' + accessToken, | ||
432 | + // type: 'POST', | ||
433 | + // contentType: 'application/json', | ||
434 | + // data: JSON.stringify(deletes) | ||
435 | + // }).done(function (response) { | ||
436 | + // if (response.success) { | ||
437 | + // layer.msg('取消绑定成功!', {icon: 1, time: 3000}); | ||
438 | + // bustypeReslist.reloadResTable(); | ||
439 | + // } else { | ||
440 | + // layer.msg('取消绑定失败!', {icon: 2, time: 3000}); | ||
441 | + // } | ||
442 | + // }); | ||
443 | + // }); | ||
444 | + // }); | ||
445 | + // }); | ||
446 | + | ||
447 | + //资源分配 | ||
448 | + $('.btn-bustype-res-config').click(function () { | ||
449 | + if ($.inArray('back:bustype:resource', checkList) == -1) { | ||
450 | + layer.closeAll(); | ||
451 | + layer.msg('暂无权限!', {icon: 7, time: 3000}); | ||
452 | + return; | ||
453 | + } | ||
454 | + var busId = $(this).data('id'); | ||
455 | + layer.open({ | ||
456 | + title: '当前绑定的资源', | ||
457 | + type: 1, | ||
458 | + content: $('#bustype-reslist-table').html(), | ||
459 | + btn: ['完成'], | ||
460 | + area: ['80%', '90%'], | ||
461 | + success: function () { | ||
462 | + // 表格 | ||
463 | + var resType = 'all'; | ||
464 | + $("#bustype_reslist_resListBizTypes").attr("disabled",true); | ||
465 | + form.render(); | ||
466 | + //绑定业务下拉选择数据 | ||
467 | + common.bizTypeSelect("bustype_reslist_resListBizTypes",function () { | ||
468 | + $("#bustype_reslist_resListBizTypes").val(busId); | ||
469 | + form.render("select"); | ||
470 | + }); | ||
471 | + //绑定资源类型下拉选择 | ||
472 | + common.resTypeSelect("bustype_reslist_restype",function () { | ||
473 | + form.render("select"); | ||
474 | + }); | ||
475 | + //回车搜索 | ||
476 | + $('#bustype_reslist_keyword').keydown(function (e) { | ||
477 | + if (e.keyCode === 13) { | ||
478 | + reloadTable(resType); | ||
479 | + } | ||
480 | + }); | ||
481 | + //选择框搜索事件 | ||
482 | + bindSelectEvent(); | ||
483 | + //渲染表格 | ||
484 | + table.render({ | ||
485 | + elem: '#bustype_reslist_resListTable' | ||
486 | + , url: common.domainName + '/api-web/home/res-list/' + resType | ||
487 | + , where: { | ||
488 | + access_token: accessToken, | ||
489 | + resName: $("#bustype_reslist_keyword").val(), | ||
490 | + busId: busId, | ||
491 | + resHealth: $("#bustype_reslist_resStatus").val() | ||
492 | + } | ||
493 | + , height: 'full-300' | ||
494 | + , cellMinWidth: 80 | ||
495 | + , page: { | ||
496 | + layout: ['count', 'prev', 'page', 'next', 'limit', 'skip'] | ||
497 | + , theme: '#1E9FFF' | ||
498 | + } | ||
499 | + , limit: common.limit | ||
500 | + , limits: common.limits | ||
501 | + , cols: [[ | ||
502 | + {type: 'checkbox'}, | ||
503 | + {type: 'numbers', title: '序号', align: 'center'} | ||
504 | + , {field: 'resName', title: '资源名称', minWidth: 300, align: 'center'} | ||
505 | + , {field: 'ip', title: 'IP地址', align: 'center'} | ||
506 | + , {field: 'admin', title: '负责人', align: 'center'} | ||
507 | + , {field: 'resTypeName', title: '资源类型', align: 'center'} | ||
508 | + , {field: 'healthDesc', title: '资源状态', align: 'center'} | ||
509 | + ]] | ||
510 | + }); | ||
511 | + //绑定下拉搜索事件 | ||
512 | + function bindSelectEvent() { | ||
513 | + // 资源状态 | ||
514 | + form.on('select(bustype_reslist_resStatus)', function(data){ | ||
515 | + reloadTable(resType); | ||
516 | + }); | ||
517 | + // 资源类型 | ||
518 | + form.on('select(bustype_reslist_restype)', function(data){ | ||
519 | + resType = data.value; | ||
520 | + reloadTable(resType); | ||
521 | + }); | ||
522 | + } | ||
523 | + //刷新表格 | ||
524 | + function reloadTable(resType) { | ||
525 | + table.reload('bustype_reslist_resListTable', { | ||
526 | + url: common.domainName + '/api-web/home/res-list/' + (resType ? resType : 'all'), | ||
527 | + where: { | ||
528 | + access_token: accessToken, | ||
529 | + resName: $("#bustype_reslist_keyword").val(), | ||
530 | + busId: busId, | ||
531 | + resHealth: $("#bustype_reslist_resStatus").val() | ||
532 | + } | ||
533 | + }); | ||
534 | + } | ||
535 | + | ||
536 | + | ||
537 | + // 新增按钮 | ||
538 | + $("#bustype-reslist-add").click(function () { | ||
539 | + var reslist = layui.reslist(); | ||
540 | + // 添加绑定页面的layerindex | ||
541 | + var addResLayerIndex; | ||
542 | + common.openWin("template/res/reslist", "添加绑定", {}, ["添加", "取消"], function () { | ||
543 | + loading = layer.load(2); | ||
544 | + // 当前选中的资源 | ||
545 | + var checks = reslist.getData(); | ||
546 | + if (checks.length ==0) { | ||
547 | + layer.msg('请先选择资源后,再进行添加!', {icon: 7, time: 3000}); | ||
548 | + layer.close(loading); | ||
549 | + return; | ||
550 | + } | ||
551 | + // 之前已经选择过的资源 | ||
552 | + var oldResIdList = []; | ||
553 | + admin.req({ | ||
554 | + url: domainName + '/api-web/manage/bustype/resourceList/' + busId, | ||
555 | + async: false, | ||
556 | + error: function () { | ||
557 | + layer.close(loading); | ||
558 | + } | ||
559 | + }).done(function (response) { | ||
560 | + $.each(response.data, function (index, value) { | ||
561 | + oldResIdList.push(value.resId); | ||
562 | + }); | ||
563 | + }); | ||
564 | + // 需要进行插入的资源 | ||
565 | + var inserts = []; | ||
566 | + var insertCount = 0; | ||
567 | + var isExistCount = 0; | ||
568 | + var resTypes=[]; | ||
569 | + var parentIds=[]; | ||
570 | + $.each(checks, function (index, value) { | ||
571 | + if (oldResIdList.indexOf(value.resId) === -1) { | ||
572 | + resTypes.push(value.resType); | ||
573 | + parentIds.push(value.parentId); | ||
574 | + inserts.push(value.resId); | ||
575 | + insertCount++; | ||
576 | + } else { | ||
577 | + isExistCount++; | ||
578 | + } | ||
579 | + }); | ||
580 | + if (inserts.length === 0) { | ||
581 | + layer.msg('所选的都已存在,无需重复添加!', {icon: 7, time: 5000}); | ||
582 | + layer.close(loading); | ||
583 | + return; | ||
584 | + } | ||
585 | + var ArrIndex=[]; | ||
586 | + if(resTypes.length>0){ | ||
587 | + var identify=0; | ||
588 | + $.each(resTypes,function (i,v) { | ||
589 | + if(v=='MIDDLEWARE_WEBLOGIC' && parentIds[i]==''){ | ||
590 | + identify=1; | ||
591 | + ArrIndex.push(i); | ||
592 | + } | ||
593 | + }); | ||
594 | + if(identify==1){ | ||
595 | + //询问框 | ||
596 | + layer.confirm('选择的资源中包含weblogic控制台,是否将控制台下的服务一起分配到当前业务下?', { | ||
597 | + btn: ['是','否'] //按钮 | ||
598 | + }, function(){//是 | ||
599 | + //获得控制台下所有服务的resID | ||
600 | + //如果选择将控制台下的服务一起分配到当前业务下 | ||
601 | + var arrResIds=[]; | ||
602 | + $.each(ArrIndex,function (i,v) { | ||
603 | + arrResIds.push(inserts[v]); | ||
604 | + }) | ||
605 | + var map={ | ||
606 | + resIds: arrResIds.toString() | ||
607 | + }; | ||
608 | + admin.req({ | ||
609 | + url: common.domainName + '/api-web/bResource/resourceByResId?access_token='+accessToken, | ||
610 | + type:'post', | ||
611 | + data:JSON.stringify(map), | ||
612 | + contentType: "application/json;charset=utf-8", | ||
613 | + async:false, | ||
614 | + error: function () { | ||
615 | + layer.msg('获取控制台下所有服务失败', {icon: 2}); | ||
616 | + layer.close(layer.index); | ||
617 | + } | ||
618 | + }).done(function (response) { | ||
619 | + if(response.success && response.data && response.data.length>0){ | ||
620 | + $.each(response.data,function (i,v) { | ||
621 | + inserts.push(v.resId); | ||
622 | + insertCount++; | ||
623 | + }); | ||
624 | + } | ||
625 | + inserts=Array.from(new Set(inserts)); | ||
626 | + isExistCount = insertCount-inserts; | ||
627 | + add(addResLayerIndex,inserts,busId,insertCount,isExistCount,resType); | ||
628 | + layer.close(layer.index); | ||
629 | + }) | ||
630 | + }, function(){//否 | ||
631 | + add(addResLayerIndex,inserts,busId,insertCount,isExistCount,resType); | ||
632 | + layer.close(layer.index); | ||
633 | + }); | ||
634 | + }else{ | ||
635 | + add(addResLayerIndex,inserts,busId,insertCount,isExistCount,resType); | ||
636 | + } | ||
637 | + } | ||
638 | + | ||
639 | + }, null, ['90%', '80%'], function (layero, layerIndex) { | ||
640 | + addResLayerIndex = layerIndex | ||
641 | + }); | ||
642 | + }); | ||
643 | + // 取消绑定按钮 | ||
644 | + $("#bustype-reslist-unbind").click(function () { | ||
645 | + // 需要取消绑定的资源id集合 | ||
646 | + var deletes = []; | ||
647 | + var resTypes=[]; | ||
648 | + var parentIds=[]; | ||
649 | + $.each(table.checkStatus('bustype_reslist_resListTable').data, function (index, value) { | ||
650 | + deletes.push(value.resId); | ||
651 | + resTypes.push(value.resType); | ||
652 | + parentIds.push(value.parentId); | ||
653 | + }); | ||
654 | + if(deletes.length<1){ | ||
655 | + layer.msg('请选择要解除绑定的数据!', {icon: 7, time: 3000}); | ||
656 | + layer.close(loading); | ||
657 | + return; | ||
658 | + } | ||
659 | + var ArrIndex=[]; | ||
660 | + if(resTypes.length>0){ | ||
661 | + var identify=0; | ||
662 | + $.each(resTypes,function (i,v) { | ||
663 | + if(v=='MIDDLEWARE_WEBLOGIC' && parentIds[i]==''){ | ||
664 | + identify=1; | ||
665 | + ArrIndex.push(i); | ||
666 | + } | ||
667 | + }); | ||
668 | + if(identify==1){ | ||
669 | + //询问框 | ||
670 | + layer.confirm('选择的资源中包含weblogic控制台,是否将控制台下的服务一起取消?', { | ||
671 | + btn: ['是','否'] //按钮 | ||
672 | + }, function(){//是 | ||
673 | + //获得控制台下所有服务的resID | ||
674 | + //如果选择将控制台下的服务一起取消 | ||
675 | + var arrResIds=[]; | ||
676 | + $.each(ArrIndex,function (i,v) { | ||
677 | + arrResIds.push(deletes[v]); | ||
678 | + }) | ||
679 | + var map={ | ||
680 | + resIds: arrResIds.toString() | ||
681 | + }; | ||
682 | + admin.req({ | ||
683 | + url: common.domainName + '/api-web/bResource/resourceByResId?access_token='+accessToken, | ||
684 | + type:'post', | ||
685 | + data:JSON.stringify(map), | ||
686 | + contentType: "application/json;charset=utf-8", | ||
687 | + async:false, | ||
688 | + error: function () { | ||
689 | + layer.msg('获取控制台下所有服务失败', {icon: 2}); | ||
690 | + layer.close(layer.index); | ||
691 | + } | ||
692 | + }).done(function (response) { | ||
693 | + if(response.success && response.data && response.data.length>0){ | ||
694 | + $.each(response.data,function (i,v) { | ||
695 | + deletes.push(v.resId); | ||
696 | + }); | ||
697 | + } | ||
698 | + deletes=Array.from(new Set(deletes)); | ||
699 | + del(busId,deletes,resType); | ||
700 | + layer.close(layer.index); | ||
701 | + }) | ||
702 | + }, function(){//否 | ||
703 | + del(busId,deletes,resType); | ||
704 | + layer.close(layer.index); | ||
705 | + }); | ||
706 | + }else{ | ||
707 | + del(busId,deletes,resType); | ||
708 | + } | ||
709 | + } | ||
710 | + | ||
711 | + }); | ||
712 | + }, | ||
713 | + yes: function (index) { | ||
714 | + layer.close(index); | ||
715 | + } | ||
716 | + }); | ||
717 | + }); | ||
718 | + }); | ||
719 | + } | ||
720 | + | ||
721 | + //授权页面 | ||
722 | + function authorizationIndex(busId) { | ||
723 | + if ($.inArray('back:bustype:impower', checkList) == -1) { | ||
724 | + layer.closeAll(); | ||
725 | + layer.msg('暂无权限!', {icon: 7, time: 3000}); | ||
726 | + return; | ||
727 | + } | ||
728 | + var params = { | ||
729 | + oldUsers: [], | ||
730 | + bindUrl: '/api-web/manage/bustype/bindUser/' + busId, | ||
731 | + unBindUrl: '/api-web/manage/bustype/unBindUser/' + busId | ||
732 | + }; | ||
733 | + // 获取当前资源类型的权限用于回显 | ||
734 | + admin.req({ | ||
735 | + url: domainName + '/api-web/manage/bustype/getUsersByBusId', | ||
736 | + async: false, | ||
737 | + data: { | ||
738 | + busId: busId | ||
739 | + } | ||
740 | + }).done(function (response) { | ||
741 | + $.each(response.data, function (index, value) { | ||
742 | + params.oldUsers.push(value.userAccount); | ||
743 | + }) | ||
744 | + return false; | ||
745 | + }); | ||
746 | + layer.close(loading); | ||
747 | + var userlist; | ||
748 | + layer.open({ | ||
749 | + title: '授权', | ||
750 | + id: 'busType-role-config-layer', | ||
751 | + type: 1, | ||
752 | + area: ['80%', '90%'], | ||
753 | + btn: ['关闭'], | ||
754 | + scrollbar: false, | ||
755 | + success: function () { | ||
756 | + view(this.id).render('/template/user/userlist').done(function () { | ||
757 | + userlist = layui.userlist(params); | ||
758 | + }); | ||
759 | + }, | ||
760 | + yes: function (index, layero) { | ||
761 | + layer.close(index); | ||
762 | + } | ||
763 | + }); | ||
764 | + } | ||
765 | + | ||
766 | + // 新增按钮 | ||
767 | + $('#bustype-create').click(function () { | ||
768 | + if ($.inArray('back:bustype:save', checkList) == -1) { | ||
769 | + layer.msg('暂无权限!', {icon: 7, time: 3000}); | ||
770 | + return; | ||
771 | + } | ||
772 | + saveBusType(); | ||
773 | + }); | ||
774 | + | ||
775 | + // 刷新表格按钮 | ||
776 | + $('#btn-bustype-reload-table').click(function () { | ||
777 | + loadBusTypeTable(); | ||
778 | + }); | ||
779 | + | ||
780 | + /** | ||
781 | + * 新增或者编辑业务类型 | ||
782 | + * | ||
783 | + * @param busTypeCode 业务类型编号 | ||
784 | + */ | ||
785 | + function saveBusType(busTypeCode) { | ||
786 | + // 打开(新增/编辑)窗口 | ||
787 | + common.openWin('/baseconfig/bustype/add', '<a class="layui-icon layui-icon-edit win_title_icon"></a>' + busTypeCode ? '编辑' : '新增', | ||
788 | + {busTypeCode: busTypeCode}, ['保存', '取消'], function () { | ||
789 | + $('#btn-bustype-submit').click(); | ||
790 | + }, null, ['40%', 'auto']); | ||
791 | + } | ||
792 | + | ||
793 | + function deleteBusTypeByIds(busIds) { | ||
794 | + if ($.inArray('back:bustype:delete', checkList) == -1) { | ||
795 | + layer.msg('暂无权限!', {icon: 7, time: 3000}); | ||
796 | + return; | ||
797 | + } | ||
798 | + if (busIds.length == 0) { | ||
799 | + layer.msg('请先选择数据,再点击删除。', {icon: 0, timeout: 3000}); | ||
800 | + return; | ||
801 | + } | ||
802 | + layer.confirm('确认要删除吗?', {icon: 3, title: '提示'}, function () { | ||
803 | + loading = layer.load(2); | ||
804 | + admin.req({ | ||
805 | + url: domainName + '/api-web/manage/bustype/deleteByIds?access_token=' + accessToken, | ||
806 | + type: 'POST', | ||
807 | + contentType: 'application/json', | ||
808 | + data: JSON.stringify(busIds), | ||
809 | + success: function () { | ||
810 | + layer.close(loading); | ||
811 | + }, | ||
812 | + error: function () { | ||
813 | + layer.close(loading); | ||
814 | + } | ||
815 | + }).done(function (response) { | ||
816 | + if (response.success) { | ||
817 | + layer.msg('删除成功!', {icon: 1, time: 3000}); | ||
818 | + loadBusTypeTable(); | ||
819 | + } else { | ||
820 | + layer.msg('删除失败!', {icon: 2, time: 3000}); | ||
821 | + } | ||
822 | + }); | ||
823 | + }); | ||
824 | + } | ||
825 | + //添加绑定 | ||
826 | + function add(addResLayerIndex,inserts,busId,insertCount,isExistCount,resType) { | ||
827 | + // 发送请求添加绑定 | ||
828 | + admin.req({ | ||
829 | + url: domainName + '/api-web/manage/bustype/addResource/' + busId + '?access_token=' + accessToken, | ||
830 | + type: 'POST', | ||
831 | + async: false, | ||
832 | + contentType: 'application/json', | ||
833 | + data: JSON.stringify(inserts), | ||
834 | + error: function () { | ||
835 | + layer.close(layer.index); | ||
836 | + } | ||
837 | + }).done(function (response) { | ||
838 | + layer.close(loading); | ||
839 | + if (response.success) { | ||
840 | + layer.msg('添加绑定成功!此次添加了' + insertCount + '个新资源' + (isExistCount > 0 ? ',有' + isExistCount + '个已经存在。' : ''), {icon: 1, time: 5000}); | ||
841 | + layer.close(addResLayerIndex); | ||
842 | + reloadTable(resType,busId); | ||
843 | + } else { | ||
844 | + layer.msg('添加绑定失败!', {icon: 2, time: 3000}); | ||
845 | + } | ||
846 | + }); | ||
847 | + } | ||
848 | + | ||
849 | + //取消绑定 | ||
850 | + function del(busId,deletes,resType) { | ||
851 | + admin.req({ | ||
852 | + url: domainName + '/api-web/manage/bustype/deleteResource/' + busId + '?access_token=' + accessToken, | ||
853 | + type: 'POST', | ||
854 | + async: false, | ||
855 | + contentType: 'application/json', | ||
856 | + data: JSON.stringify(deletes) | ||
857 | + }).done(function (response) { | ||
858 | + if (response.success) { | ||
859 | + layer.msg('取消绑定成功!', {icon: 1, time: 3000}); | ||
860 | + | ||
861 | + reloadTable(resType,busId); | ||
862 | + } else { | ||
863 | + layer.msg('取消绑定失败!', {icon: 2, time: 3000}); | ||
864 | + } | ||
865 | + }); | ||
866 | + } | ||
867 | + //获取展示类型的字典数据 | ||
868 | + function initShowType(){ | ||
869 | + if(mode){//如果不展示字段就不去请求 | ||
870 | + admin.req({ | ||
871 | + url: domainName + '/api-web/manage/ddic/findSucDdics/DETAILS_POWER' | ||
872 | + , method: 'POST' | ||
873 | + , async: false | ||
874 | + , success: function (res) { | ||
875 | + $.each(res.data, function (i, v) { | ||
876 | + showTypeList.push({ | ||
877 | + name: v.ddicName | ||
878 | + ,value: v.ddicCode.substring(v.ddicCode.lastIndexOf("_")+1,v.ddicCode.length) | ||
879 | + }) | ||
880 | + }); | ||
881 | + } | ||
882 | + }); | ||
883 | + } | ||
884 | + } | ||
885 | + //刷新表格 | ||
886 | + function reloadTable(resType,busId) { | ||
887 | + table.reload('bustype_reslist_resListTable', { | ||
888 | + url: common.domainName + '/api-web/home/res-list/' + (resType ? resType : 'all'), | ||
889 | + where: { | ||
890 | + access_token: accessToken, | ||
891 | + resName: $("#bustype_reslist_keyword").val(), | ||
892 | + busId: busId, | ||
893 | + resHealth: $("#bustype_reslist_resStatus").val() | ||
894 | + } | ||
895 | + }); | ||
896 | + } | ||
897 | + //获取选中的数据 | ||
898 | + function getCheckData() { | ||
899 | + if(mode){ | ||
900 | + //获取改变的值 | ||
901 | + var str=''; | ||
902 | + var $tr=$('#bustype-table').next().find('tbody tr'); | ||
903 | + $.each($tr,function (i,v) { | ||
904 | + var $btn=$(this).find('.btn-bustype-unbind'); | ||
905 | + var showType=$(this).find('.resourceType_showType') && $(this).find('.resourceType_showType').eq(0) && $(this).find('.resourceType_showType').eq(0).val() ? $(this).find('.resourceType_showType').eq(0).val():'<'; | ||
906 | + if(!$btn.hasClass('hide')){ | ||
907 | + str += $btn.attr("data-id")+'_'+showType+','; | ||
908 | + } | ||
909 | + }); | ||
910 | + if(str!=''){ | ||
911 | + str=str.substring(0,str.length-1); | ||
912 | + } | ||
913 | + return str; | ||
914 | + }else{ | ||
915 | + return busTypeTable.checkStatus(false); | ||
916 | + } | ||
917 | + | ||
918 | + } | ||
919 | + | ||
920 | + return {getData: getCheckData}; | ||
921 | + }); | ||
922 | +}); |
@@ -7,12 +7,17 @@ | @@ -7,12 +7,17 @@ | ||
7 | <div id="score" style="width: 600px;height:400px;"></div> | 7 | <div id="score" style="width: 600px;height:400px;"></div> |
8 | </el-col> | 8 | </el-col> |
9 | </el-row> | 9 | </el-row> |
10 | + <div style="display: flex;flex-wrap: nowrap"> | ||
11 | + <div> | ||
10 | 12 | ||
11 | - <cm-dialog :title="title" width="60%" :showDialogVisible="dialogVisible" :showFooter="true"> | 13 | + </div> |
14 | + </div> | ||
15 | + | ||
16 | + <cm-dialog :title="title" width="60%" :showDialogVisible="dialogVisible" :showFooter="true" @hidedialog="closeDetail" :showOkBtn="false"> | ||
12 | <template v-slot> | 17 | <template v-slot> |
13 | <cm-table-page :columns="columns" :dataList="dataList" @loaddata="getPage" :showIndex="true" | 18 | <cm-table-page :columns="columns" :dataList="dataList" @loaddata="getPage" :showIndex="true" |
14 | :showBorder="true" | 19 | :showBorder="true" |
15 | - :showPage="false" :height="(height - 54)/3"></cm-table-page> | 20 | + :showPage="false" :height="height - 100"></cm-table-page> |
16 | </template> | 21 | </template> |
17 | </cm-dialog> | 22 | </cm-dialog> |
18 | 23 |
@@ -26,13 +26,12 @@ export default { | @@ -26,13 +26,12 @@ export default { | ||
26 | let title = Vue.ref(''); | 26 | let title = Vue.ref(''); |
27 | let dataList = Vue.ref([]); | 27 | let dataList = Vue.ref([]); |
28 | 28 | ||
29 | - | ||
30 | let columns = Vue.ref([{ | 29 | let columns = Vue.ref([{ |
31 | prop: 'item', | 30 | prop: 'item', |
32 | label: '分类', | 31 | label: '分类', |
33 | sortable: true, | 32 | sortable: true, |
34 | },{ | 33 | },{ |
35 | - prop: 'score', | 34 | + prop: 'standardScore', |
36 | label: '分值', | 35 | label: '分值', |
37 | sortable: true, | 36 | sortable: true, |
38 | },{ | 37 | },{ |
@@ -40,7 +39,7 @@ export default { | @@ -40,7 +39,7 @@ export default { | ||
40 | label: '打分人', | 39 | label: '打分人', |
41 | sortable: true, | 40 | sortable: true, |
42 | },{ | 41 | },{ |
43 | - prop: 'nickname', | 42 | + prop: 'score', |
44 | label: '得分', | 43 | label: '得分', |
45 | sortable: true, | 44 | sortable: true, |
46 | },{ | 45 | },{ |
@@ -101,20 +100,26 @@ export default { | @@ -101,20 +100,26 @@ export default { | ||
101 | } | 100 | } |
102 | 101 | ||
103 | let detail = (v) =>{ | 102 | let detail = (v) =>{ |
104 | - | ||
105 | let name = v.name; | 103 | let name = v.name; |
106 | let month = parseInt(name) | 104 | let month = parseInt(name) |
107 | title.value = name + "各项评分"; | 105 | title.value = name + "各项评分"; |
108 | - dialogVisible.value = true | ||
109 | 106 | ||
110 | - // let params = { | ||
111 | - // projectId: props.projectId, | ||
112 | - // year: props.treeNode.label | ||
113 | - // } | ||
114 | - // proxy.$http.get("/api-web/bOpsScore/bOpsScoreDetails", params, function (res) { | ||
115 | - // | ||
116 | - // }); | ||
117 | 107 | ||
108 | + let params = { | ||
109 | + projectId: props.projectId, | ||
110 | + opsYear: props.treeNode.label, | ||
111 | + opsMonth:month | ||
112 | + } | ||
113 | + proxy.$http.post("/api-web/bOpsScoreDetails/page", params, function (res) { | ||
114 | + if(res && res.code == 0){ | ||
115 | + closeDetail(true); | ||
116 | + dataList.value = res.data; | ||
117 | + } | ||
118 | + }); | ||
119 | + } | ||
120 | + | ||
121 | + let closeDetail = (flg) => { | ||
122 | + dialogVisible.value = flg | ||
118 | } | 123 | } |
119 | 124 | ||
120 | // 柱状图 | 125 | // 柱状图 |
@@ -175,7 +180,8 @@ export default { | @@ -175,7 +180,8 @@ export default { | ||
175 | title, | 180 | title, |
176 | dialogVisible, | 181 | dialogVisible, |
177 | columns, | 182 | columns, |
178 | - dataList | 183 | + dataList, |
184 | + closeDetail | ||
179 | } | 185 | } |
180 | } | 186 | } |
181 | } | 187 | } |
@@ -61,19 +61,14 @@ | @@ -61,19 +61,14 @@ | ||
61 | </el-form-item> | 61 | </el-form-item> |
62 | </el-col> | 62 | </el-col> |
63 | <el-col :span="8"> | 63 | <el-col :span="8"> |
64 | - <el-image style="width: 200px; height: 200px" :src="ruleForm.headImgUrl"></el-image> | 64 | + <el-image style="width: 200px; height: 200px" :src="imageUrl"></el-image> |
65 | <el-upload | 65 | <el-upload |
66 | class="upload-demo" | 66 | class="upload-demo" |
67 | :show-file-list="false" | 67 | :show-file-list="false" |
68 | - action="" | ||
69 | - :on-preview="handlePreview" | ||
70 | - :on-remove="handleRemove" | ||
71 | - :before-remove="beforeRemove" | ||
72 | - :http-request="uploadFile" | ||
73 | - multiple | ||
74 | - :limit="3" | ||
75 | - :on-exceed="handleExceed" | ||
76 | - > | 68 | + :before-upload="beforeAvatarUpload" |
69 | + :multiple="false" | ||
70 | + :http-request="getFile" | ||
71 | + :auto-upload="true"> | ||
77 | <el-button size="small" type="primary">上传照片</el-button> | 72 | <el-button size="small" type="primary">上传照片</el-button> |
78 | </el-upload> | 73 | </el-upload> |
79 | </el-col> | 74 | </el-col> |
@@ -23,6 +23,7 @@ export default { | @@ -23,6 +23,7 @@ export default { | ||
23 | let height = Vue.ref(window.innerHeight - 130); | 23 | let height = Vue.ref(window.innerHeight - 130); |
24 | 24 | ||
25 | const {proxy} = Vue.getCurrentInstance(); | 25 | const {proxy} = Vue.getCurrentInstance(); |
26 | + let imageUrl = Vue.ref(''); | ||
26 | 27 | ||
27 | let ruleForm = Vue.ref({ | 28 | let ruleForm = Vue.ref({ |
28 | nickname: '', | 29 | nickname: '', |
@@ -66,6 +67,31 @@ export default { | @@ -66,6 +67,31 @@ export default { | ||
66 | }); | 67 | }); |
67 | } | 68 | } |
68 | 69 | ||
70 | + | ||
71 | + let getFile = (param) =>{ | ||
72 | + | ||
73 | + let fileObj = param.file | ||
74 | + | ||
75 | + getBase64(fileObj).then(res => { | ||
76 | + console.log(res) | ||
77 | + }); | ||
78 | + | ||
79 | + imageUrl.value = URL.createObjectURL(fileObj) | ||
80 | + | ||
81 | + } | ||
82 | + let beforeAvatarUpload = (file) =>{ | ||
83 | + const isJPG = file.type.indexOf('image/') != -1 | ||
84 | + | ||
85 | + if (!isJPG) { | ||
86 | + proxy.$global.showMsg('您上传的不是图片文件,请选择图片!','error'); | ||
87 | + } | ||
88 | + | ||
89 | + return isJPG | ||
90 | + } | ||
91 | + | ||
92 | + | ||
93 | + | ||
94 | + | ||
69 | // // 挂载完 | 95 | // // 挂载完 |
70 | Vue.onMounted(() => { | 96 | Vue.onMounted(() => { |
71 | getPage(); | 97 | getPage(); |
@@ -77,8 +103,11 @@ export default { | @@ -77,8 +103,11 @@ export default { | ||
77 | }); | 103 | }); |
78 | 104 | ||
79 | return { | 105 | return { |
106 | + imageUrl, | ||
80 | ruleForm, | 107 | ruleForm, |
81 | - saveUser | 108 | + saveUser, |
109 | + getFile, | ||
110 | + beforeAvatarUpload, | ||
82 | } | 111 | } |
83 | } | 112 | } |
84 | } | 113 | } |
-
Please register or login to post a comment