|
@@ -3131,14 +3131,14 @@ function bindEvents_file_table(jqS, usedObj, targetBody, type){
|
|
|
});
|
|
|
}
|
|
|
//重命名
|
|
|
+ let fileObjs = getFileObj(targetBody, type),
|
|
|
+ fileDiv = $(jqS + ' div:eq(0)'),
|
|
|
+ renameDiv = $(jqS + ' div:eq(1)'),
|
|
|
+ hintText = $(jqS).find('span'),
|
|
|
+ postFix = '';
|
|
|
$(jqS + ' p a:eq(1)').on('click', function () {
|
|
|
- let fileObjs = getFileObj(targetBody, type);
|
|
|
let orgDispName = $(jqS + ' div:eq(0)')[0].childNodes[0].textContent;
|
|
|
- let postFix = '';
|
|
|
let orgName = orgDispName;
|
|
|
- let hintText = $(jqS).find('span');
|
|
|
- let fileDiv = $(jqS + ' div:eq(0)');
|
|
|
- let renameDiv = $(jqS + ' div:eq(1)');
|
|
|
$(jqS + ' input').val(orgName);
|
|
|
fileDiv.hide();
|
|
|
renameDiv.show();
|
|
@@ -3148,62 +3148,17 @@ function bindEvents_file_table(jqS, usedObj, targetBody, type){
|
|
|
renameDiv.hide();
|
|
|
hintText.hide();
|
|
|
});
|
|
|
- //确认重命名
|
|
|
- //回车键
|
|
|
- $(jqS).find('input:eq(0)').keypress(function (e) {
|
|
|
- if(e.keyCode === 13){
|
|
|
- let attrId = $(jqS).attr('id');
|
|
|
- let id = attrId.slice(5, attrId.length);
|
|
|
- let newName = $(jqS + ' input').val().trim();
|
|
|
- if(newName !== orgName){
|
|
|
- if(hasThisFileName(fileObjs, newName)){
|
|
|
- hintText.show();
|
|
|
- //$(jqS + ' input').val(orgName);
|
|
|
- return;
|
|
|
- }
|
|
|
- if(newName.trim().length === 0){
|
|
|
- alert('文件名不可为空!');
|
|
|
- $(jqS + ' input').val(orgName);
|
|
|
- return;
|
|
|
- }
|
|
|
- //ajax
|
|
|
- let updateObj = Object.create(null);
|
|
|
- updateObj.fileType = type;
|
|
|
- updateObj.updateType = 'update';
|
|
|
- updateObj.updateData = Object.create(null);
|
|
|
- if(type === fileType.unitPriceFile){
|
|
|
- updateObj.updateData.id = parseInt(id);
|
|
|
- //updateObj.updateData.id = id;
|
|
|
- }
|
|
|
- else if(type === fileType.feeRateFile){
|
|
|
- updateObj.updateData.ID = id;
|
|
|
- }
|
|
|
- updateObj.updateData.name = newName;
|
|
|
- a_updateFiles([updateObj], function () {
|
|
|
- let newDispName = newName + postFix;
|
|
|
- fileDiv[0].childNodes[0].textContent = newDispName;
|
|
|
- fileDiv.show();
|
|
|
- renameDiv.hide();
|
|
|
- //refresh tender
|
|
|
- refreshTenderFile(getTendersByFile(type, id, projTreeObj.tree.selected), type, newName);
|
|
|
- });
|
|
|
- }
|
|
|
- let newDispName = newName + postFix;
|
|
|
- fileDiv[0].childNodes[0].textContent = newDispName;
|
|
|
- fileDiv.show();
|
|
|
- renameDiv.hide();
|
|
|
- hintText.hide();
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- /*$(jqS + ' .btn-success').on('click', function () {
|
|
|
+ });
|
|
|
+ //回车键确认重命名
|
|
|
+ $(jqS).find('input:eq(0)').keypress(function (e) {
|
|
|
+ if(e.keyCode === 13){
|
|
|
+ let orgName = $(jqS + ' div:eq(0)')[0].childNodes[0].textContent;
|
|
|
let attrId = $(jqS).attr('id');
|
|
|
let id = attrId.slice(5, attrId.length);
|
|
|
let newName = $(jqS + ' input').val().trim();
|
|
|
if(newName !== orgName){
|
|
|
if(hasThisFileName(fileObjs, newName)){
|
|
|
- $(jqS).find('span:eq(2)').show();
|
|
|
- //$(jqS + ' input').val(orgName);
|
|
|
+ hintText.show();
|
|
|
return;
|
|
|
}
|
|
|
if(newName.trim().length === 0){
|
|
@@ -3218,7 +3173,6 @@ function bindEvents_file_table(jqS, usedObj, targetBody, type){
|
|
|
updateObj.updateData = Object.create(null);
|
|
|
if(type === fileType.unitPriceFile){
|
|
|
updateObj.updateData.id = parseInt(id);
|
|
|
- //updateObj.updateData.id = id;
|
|
|
}
|
|
|
else if(type === fileType.feeRateFile){
|
|
|
updateObj.updateData.ID = id;
|
|
@@ -3226,24 +3180,19 @@ function bindEvents_file_table(jqS, usedObj, targetBody, type){
|
|
|
updateObj.updateData.name = newName;
|
|
|
a_updateFiles([updateObj], function () {
|
|
|
let newDispName = newName + postFix;
|
|
|
- $(jqS + ' div:eq(0)')[0].childNodes[0].textContent = newDispName;
|
|
|
- $(jqS + ' div:eq(0)').show();
|
|
|
- $(jqS + ' div:eq(1)').hide();
|
|
|
+ fileDiv[0].childNodes[0].textContent = newDispName;
|
|
|
+ fileDiv.show();
|
|
|
+ renameDiv.hide();
|
|
|
//refresh tender
|
|
|
refreshTenderFile(getTendersByFile(type, id, projTreeObj.tree.selected), type, newName);
|
|
|
});
|
|
|
}
|
|
|
let newDispName = newName + postFix;
|
|
|
- $(jqS + ' div:eq(0)')[0].childNodes[0].textContent = newDispName;
|
|
|
- $(jqS + ' div:eq(0)').show();
|
|
|
- $(jqS + ' div:eq(1)').hide();
|
|
|
- });
|
|
|
- //取消重命名
|
|
|
- $(jqS + ' .btn-secondary').on('click', function () {
|
|
|
- $(jqS + ' div:eq(0)').show();
|
|
|
- $(jqS + ' div:eq(1)').hide();
|
|
|
- $(jqS).find('span:eq(2)').hide();
|
|
|
- });*/
|
|
|
+ fileDiv[0].childNodes[0].textContent = newDispName;
|
|
|
+ fileDiv.show();
|
|
|
+ renameDiv.hide();
|
|
|
+ hintText.hide();
|
|
|
+ }
|
|
|
});
|
|
|
//悬浮框显示使用该文件的单位工程
|
|
|
$($(jqS)[0].nextSibling).popover({
|