Authored by 王涛

文件预览优化;文档管理优化;

@@ -104,16 +104,17 @@ @@ -104,16 +104,17 @@
104 104
105 <cm-table-page :columns="columns" :dataList="dataList" @loaddata="getPage" :showIndex="true" 105 <cm-table-page :columns="columns" :dataList="dataList" @loaddata="getPage" :showIndex="true"
106 :showBorder="false" :showSelection="false" :showTools="isEditName" 106 :showBorder="false" :showSelection="false" :showTools="isEditName"
107 - :showPage="false" :height="height - 54"> 107 + :showPage="false" :height="height - 84">
108 <template #default="{row,prop,column}"> 108 <template #default="{row,prop,column}">
109 - <div class="fileName-div" style="display: flex; align-items: center;" v-if="isEditName && prop == 'fileName'" @click="getFile(row)"> 109 + <!--<div class="fileName-div" style="display: flex; align-items: center;" v-if="isEditName && prop == 'fileName'" @click="getFile(row)">
110 <i :class="['iconfont', iconclass[row.type] == undefined ? 'icon-wenjian' : iconclass[row.type]]" style="font-size: 22px;margin-right: 10px;"></i> 110 <i :class="['iconfont', iconclass[row.type] == undefined ? 'icon-wenjian' : iconclass[row.type]]" style="font-size: 22px;margin-right: 10px;"></i>
111 <div> 111 <div>
112 <span @click.stop="editFileName(row,index)" v-if="isInput!=row.id">{{row.fileName}}</span> 112 <span @click.stop="editFileName(row,index)" v-if="isInput!=row.id">{{row.fileName}}</span>
113 </div> 113 </div>
114 114
115 <el-input @click.stop="" @blur="reNameFile(row,true)" v-if="isInput==row.id" type="text" v-model="row.fileName"></el-input> 115 <el-input @click.stop="" @blur="reNameFile(row,true)" v-if="isInput==row.id" type="text" v-model="row.fileName"></el-input>
116 - </div> 116 + </div>-->
  117 +
117 </template> 118 </template>
118 119
119 <template #tools="{scope}" > 120 <template #tools="{scope}" >
@@ -134,9 +135,7 @@ @@ -134,9 +135,7 @@
134 </el-button> 135 </el-button>
135 </li> 136 </li>
136 </ul> 137 </ul>
137 -  
138 </div> 138 </div>
139 -  
140 </div> 139 </div>
141 </template> 140 </template>
142 </cm-table-page> 141 </cm-table-page>
@@ -181,9 +181,7 @@ export default { @@ -181,9 +181,7 @@ export default {
181 }, 181 },
182 render: function (row) { 182 render: function (row) {
183 let cls = iconclass[row.type] == undefined ? 'icon-wenjian' : iconclass[row.type]; 183 let cls = iconclass[row.type] == undefined ? 'icon-wenjian' : iconclass[row.type];
184 - // let inputFileName=row.fileName;  
185 - // return `<i class="iconfont ${cls}" style="font-size: 22px;margin-right: 10px;"></i><input value="${inputFileName}"></input>`  
186 - return `<i class="iconfont ${cls}" style="font-size: 22px;margin-right: 10px;"></i><span>${row.fileName}</span>` 184 + return `<div style="cursor: pointer"><i class="iconfont ${cls}" style="font-size: 22px;margin-right: 10px;"></i><span>${row.fileName}</span></div>`
187 } 185 }
188 }, 186 },
189 { 187 {
@@ -135,7 +135,7 @@ global.openBlankWindow = (url, width, height) => { @@ -135,7 +135,7 @@ global.openBlankWindow = (url, width, height) => {
135 let lyaui = global.layui; 135 let lyaui = global.layui;
136 lyaui.layer.open({ 136 lyaui.layer.open({
137 type: 2, 137 type: 2,
138 - title:'', 138 + title: '',
139 area: [width, height], 139 area: [width, height],
140 content: url //这里content是一个URL,如果你不想让iframe出现滚动条,你还可以content: ['http://sentsin.com', 'no'] 140 content: url //这里content是一个URL,如果你不想让iframe出现滚动条,你还可以content: ['http://sentsin.com', 'no']
141 }); 141 });
@@ -151,7 +151,18 @@ global.viewer = (path, proxy) => { @@ -151,7 +151,18 @@ global.viewer = (path, proxy) => {
151 if (res && res.success) { 151 if (res && res.success) {
152 global.openBlankWindow("/src/lib/extend/pdfjs/web/viewer.html?test=" + encodeURIComponent(res.str)); 152 global.openBlankWindow("/src/lib/extend/pdfjs/web/viewer.html?test=" + encodeURIComponent(res.str));
153 } else { 153 } else {
154 - global.showMsg((res.msg == undefined || res.msg == '' || res.msg == null) ? "该文档不支持预览!" : res.msg, "error") 154 + var access_token = 'access_token=' + proxy.$http.getToken();
  155 + let viewUrl =`/api-web/openoffice/downloadByPath?path=${encodeURIComponent(path)}&${access_token}`;
  156 + let mimeType = res.object;
  157 + // TODO 浏览器不能播放视频
  158 + // 图片视频
  159 + // if (mimeType.indexOf("image") != -1 || mimeType.indexOf("video") != -1) {
  160 + // global.openBlankWindow( sessionStorage.getItem('domainName') + viewUrl);
  161 + // return;
  162 + // }
  163 + global.confirm("文档不支持预览,是否下载!", function () {
  164 + proxy.$http.downloadFile(viewUrl, {});
  165 + });
155 } 166 }
156 }) 167 })
157 } 168 }
@@ -161,13 +172,7 @@ global.viewer = (path, proxy) => { @@ -161,13 +172,7 @@ global.viewer = (path, proxy) => {
161 * @param path 172 * @param path
162 */ 173 */
163 global.viewResTopo = (resId) => { 174 global.viewResTopo = (resId) => {
164 - // let url = `${sessionStorage.getItem('graphEditorOrigin')}/jgraph/grapheditor/index.html?access_token=${localStorage.getItem('access_token')}&id=${topoId}`;  
165 - // let height = window.innerHeight;  
166 - // let width = window.innerWidth;  
167 - // global.openBlankWindow(url, width, height);  
168 -  
169 let lyaui = global.layui; 175 let lyaui = global.layui;
170 -  
171 lyaui.common.viewResTopo(resId) 176 lyaui.common.viewResTopo(resId)
172 } 177 }
173 178
@@ -202,18 +207,18 @@ global.openCmdbAssets = (resTypeId, resId, proxy) => { @@ -202,18 +207,18 @@ global.openCmdbAssets = (resTypeId, resId, proxy) => {
202 } 207 }
203 208
204 global.openDetail = (resId, resType, proxy) => { 209 global.openDetail = (resId, resType, proxy) => {
205 - let lyaui = global.layui; 210 + let lyaui = global.layui;
206 211
207 let editFlag = false; 212 let editFlag = false;
208 let provider = ''; 213 let provider = '';
209 - let name= ''; 214 + let name = '';
210 let ip = ''; 215 let ip = '';
211 let resTypeName = ''; 216 let resTypeName = '';
212 let adminName = ''; 217 let adminName = '';
213 let manageIp = ''; 218 let manageIp = '';
214 let collProtocol = ''; 219 let collProtocol = '';
215 220
216 - // 获取资源详情 221 + // 获取资源详情
217 proxy.$http.get(`/api-web/v32/res/detail/${resId}`, {}, function (res) { 222 proxy.$http.get(`/api-web/v32/res/detail/${resId}`, {}, function (res) {
218 if (res && res.map) { 223 if (res && res.map) {
219 let data = res.map; 224 let data = res.map;
@@ -226,14 +231,11 @@ global.openDetail = (resId, resType, proxy) => { @@ -226,14 +231,11 @@ global.openDetail = (resId, resType, proxy) => {
226 collProtocol = data.collProtocol; 231 collProtocol = data.collProtocol;
227 name = data.resName; 232 name = data.resName;
228 233
229 - lyaui.commonCols.detailPage(resId, resType,editFlag,provider,name,ip,resTypeName,adminName,manageIp,collProtocol); 234 + lyaui.commonCols.detailPage(resId, resType, editFlag, provider, name, ip, resTypeName, adminName, manageIp, collProtocol);
230 } 235 }
231 }); 236 });
232 237
233 238
234 -  
235 -  
236 -  
237 } 239 }
238 240
239 /** 241 /**
1 -<title>视图</title> 1 +<title>视图</title>
2 <iframe src="/vue3/index.html#/res/list" class="layadmin-iframe" style="height: 99.5%!important;"/> 2 <iframe src="/vue3/index.html#/res/list" class="layadmin-iframe" style="height: 99.5%!important;"/>
@@ -97,9 +97,17 @@ const assets = (props, {attrs, slots, emit}) => { @@ -97,9 +97,17 @@ const assets = (props, {attrs, slots, emit}) => {
97 */ 97 */
98 let addAssets = () => { 98 let addAssets = () => {
99 let data = btnType.value.data 99 let data = btnType.value.data
100 - data.map(function (v){ 100 + let arr = data.map(function (v){
101 v.extend = JSON.stringify(v.extend); 101 v.extend = JSON.stringify(v.extend);
  102 + if( !v.value || v.value == '' || v.value == null){
  103 + return v;
  104 + }
102 }) 105 })
  106 +
  107 + if(arr.length == data.length ){
  108 + proxy.$global.showMsg(`请填写资产信息,不能全部为空!`,'warning');
  109 + return;
  110 + }
103 proxy.$http.post(`/api-web/person/assets/add/${props.parentNode.id}`,data , function (res) { 111 proxy.$http.post(`/api-web/person/assets/add/${props.parentNode.id}`,data , function (res) {
104 if (res && res.success) { 112 if (res && res.success) {
105 proxy.$global.showMsg("添加成功"); 113 proxy.$global.showMsg("添加成功");
@@ -118,9 +126,17 @@ const assets = (props, {attrs, slots, emit}) => { @@ -118,9 +126,17 @@ const assets = (props, {attrs, slots, emit}) => {
118 */ 126 */
119 let saveAssets = () => { 127 let saveAssets = () => {
120 let data = btnType.value.data 128 let data = btnType.value.data
121 - data.map(function (v){ 129 + let arr = data.map(function (v){
122 v.extend = JSON.stringify(v.extend); 130 v.extend = JSON.stringify(v.extend);
  131 + if( !v.value || v.value == '' || v.value == null){
  132 + return v;
  133 + }
123 }) 134 })
  135 +
  136 + if(arr.length == data.length ){
  137 + proxy.$global.showMsg(`请填写资产信息,不能全部为空!`,'warning');
  138 + return;
  139 + }
124 proxy.$http.post(`/api-web/person/assets/edit/${props.parentNode.id}`, data, function (res) { 140 proxy.$http.post(`/api-web/person/assets/edit/${props.parentNode.id}`, data, function (res) {
125 if (res && res.success) { 141 if (res && res.success) {
126 proxy.$global.showMsg("编辑成功"); 142 proxy.$global.showMsg("编辑成功");
@@ -452,4 +468,4 @@ export default { @@ -452,4 +468,4 @@ export default {
452 rules, 468 rules,
453 } 469 }
454 } 470 }
455 -}  
  471 +}
@@ -16,7 +16,7 @@ export default { @@ -16,7 +16,7 @@ export default {
16 }, 16 },
17 setup() { 17 setup() {
18 const {proxy} = Vue.getCurrentInstance(); 18 const {proxy} = Vue.getCurrentInstance();
19 - let height = Vue.ref(window.innerHeight -10); 19 + let height = Vue.ref(window.innerHeight -20);
20 const treeData = Vue.ref([]); 20 const treeData = Vue.ref([]);
21 const tableData = Vue.ref([]); 21 const tableData = Vue.ref([]);
22 22