Переглянути джерело

feat: 分享窗口,“拷贝工程”时弹窗中可重命名

vian 5 роки тому
батько
коміт
d177db1447

+ 3 - 1
web/building_saas/pm/html/project-management-share.html

@@ -53,7 +53,9 @@
                     <span style="display: none" id="copyShareEng-info" class="form-text text-danger">单项工程不可为空</span>
                 </div>-->
                 <div class="form-group">
-                    <p id="copyShare_name">拷贝后,工程将重命名为 "<b>建筑工程2(张三共享)</b>"</p>
+                    <label>分 段</label>
+                    <input id="copyShare_name" class="form-control"></input>
+                    <span style="display: none" id="copyShareTender-info" class="form-text text-danger">已存在同名分段</span>
                 </div>
             </div>
             <div class="modal-footer">

+ 11 - 17
web/building_saas/pm/js/pm_share.js

@@ -899,15 +899,20 @@ const pmShare = (function () {
                 return alert('当前分段与目标建设项目的项目类型不同,请选择其他建设项目进行复制。');
             }
             let copyMap = { copy: null, update: null };
-            let newName = getCopyName(selected);
+            let newName = $('#copyShare_name').val();
+            if (!newName) {
+                $('#copyShareTender-info').text('分段名称不可为空');
+                $('#copyShareTender-info').show();
+                return;
+            }
             //获取建设项目的分段
             let tenderQuery = { $or: [{ deleteInfo: null }, { 'deleteInfo.deleted': false }], userID: userID, ParentID: projID };
             const rstData = await ajaxPost('/pm/api/getProjectsByQuery', { user_id: userID, query: tenderQuery, options: '-_id -property' }, 10000);
             let updateTender = null;
             for (let tender of rstData) {
                 if (tender.name === newName) {
-                    $('#copyShare_name').text('已存在此单位工程。');
-                    $('#copyShare_name').addClass('text-danger');
+                    $('#copyShareTender-info').text('已存在同名分段');
+                    $('#copyShareTender-info').show();
                     return;
                 }
                 if (tender.NextSiblingID == -1) {
@@ -1062,33 +1067,22 @@ const pmShare = (function () {
         $('#copyShare').on('hidden.bs.modal', function () {
             $('#copyShareProj-info').hide();
             $('#copyShareEng-info').hide();
+            $('#copyShareTender-info').hide();
         });
         //打开拷贝工程
         $('#copyShare').on('shown.bs.modal', function () {
             setCopyModal();
             //更改显示名称
-            let newName = getCopyName(shareSeleted);
-            $('#copyShare_name').html(`拷贝后,工程将重命名为 "<b>${newName}</b>"`);
-            $('#copyShare_name').removeClass('text-danger');
+            $('#copyShare_name').val(shareSeleted.data.name);
         });
         //拷贝工程改变选择建设项目
         $('#copyShare_selectProj').change(function () {
-            //更改显示名称
-            let newName = getCopyName(shareSeleted);
-            $('#copyShare_name').html(`拷贝后,工程将重命名为 "<b>${newName}</b>"`);
-            $('#copyShare_name').removeClass('text-danger');
             $('#copyShareProj-info').hide();
             $('#copyShareEng-info').hide();
+            $('#copyShareTender-info').hide();
             let curSelID = $(this).select().val();
             setEng(parseInt(curSelID));
         });
-        //拷贝工程改变选择单项工程
-        $('#copyShare_selectEng').change(function () {
-            //更改显示名称
-            let newName = getCopyName(shareSeleted);
-            $('#copyShare_name').html(`拷贝后,工程将重命名为 "<b>${newName}</b>"`);
-            $('#copyShare_name').removeClass('text-danger');
-        });
         //确认拷贝
         $('#copyShare_confirm').click(function () {
             let selProj = $('#copyShare_selectProj').select().val();