Explorar o código

文件中心调整

Lijy %!s(int64=2) %!d(string=hai) anos
pai
achega
3d9fa9675a

+ 2 - 0
fhKeeper/formulahousekeeper/timesheet/src/permissions.js

@@ -17,6 +17,7 @@ const StringUtil = {
         projectAllocate: false, // 下拨成本预算 //
         projectPhase: false, // 项目阶段管理 // 
         projectCodeAndName: false, // 编辑负责项目编码和名称 //
+        projectEditDefaultFolder: false, // 修改默认文件夹 //
 
         // 合同管理
         contractNew: false, // 新增合同 // 
@@ -234,6 +235,7 @@ const StringUtil = {
         arr[i] == '审核合同' ? obj.contractAudit = true : ''
         arr[i] == '全部子项目工时成本' ? obj.reportAllManhourCost = true : ''
         arr[i] == '负责项目子项目工时成本' ? obj.reportResponsibleManhourCost = true : ''
+        arr[i] == '修改默认文件夹' ? obj.projectEditDefaultFolder = true : ''
     }
     return obj
   }

+ 140 - 70
fhKeeper/formulahousekeeper/timesheet/src/views/project/fileCenter.vue

@@ -8,6 +8,7 @@
             <span style="float:right;">
                 <!-- <el-link type="primary" :underline="false" v-if="list.length
                 > 0"><i class="el-icon-setting"></i><span style="margin-right:5px;" @click="templatedialingClick('设为模板')">设为模板</span></el-link> -->
+                    <el-link type="primary" :underline="false" @click="defaultTemplate" v-if="permissions.projectEditDefaultFolder"><i class="el-icon-folder-add"></i><span style="margin-left:5px;">默认文件夹</span></el-link>
                     <el-link type="primary" :underline="false" @click="createFolder"><i class="el-icon-folder-add"></i><span style="margin-left:5px;">{{ $t('createafolder') }}</span></el-link>
                     <el-upload ref="upload" action="#" :http-request="uploadFile" :show-file-list="false" :limit="1" style="display:inline-block;">
                         <el-link type="primary" :underline="false" style="margin-left:10px;"><i class="iconfont firerock-iconshangchuan"></i><span style="margin-left:5px;">{{ $t('fileupload') }}</span></el-link>
@@ -155,40 +156,29 @@
         </el-dialog>
 
         <!-- 设为模板 -->
-        <el-dialog :title="'编辑模板'" v-if="templatedialing" :visible.sync="templatedialing" :close-on-click-modal="false" customClass="customWidth" width="500px">
+        <el-dialog :title="'编辑默认模板'" v-if="templatedialing" :visible.sync="templatedialing" :close-on-click-modal="false" customClass="customWidth" width="500px">
             <div>
-                <el-form :model="templateForm" ref="templateForm" label-width="80px">
-                    <el-form-item label="模板名称" prop="name" :rules="[
-                            { required: true, message: '请输入模板名称'}
-                        ]">
-                        <el-input v-model="templateForm.name" :placeholder="'请输入模板名称'" maxlength="25" show-word-limit clearable ></el-input>
-                    </el-form-item>
-                    <el-form-item>
-                        <el-checkbox v-model="templateForm.creWithPro">随项目自动创建</el-checkbox>
-                    </el-form-item>
-                </el-form>
-
-                <div class="fileCenter">文件中心结构</div>
                 <div class="filrTree">
                     <el-tree
                         :data="templateDataTree"
                         node-key="id"
-                        default-expand-all
                         :expand-on-click-node="false">
                         <span class="custom-tree-node tree_node" slot-scope="{ node, data }">
                             <span>{{ node.label }}</span>
                             <span class="tree_node_btn">
-                                <i class="el-icon-circle-plus-outline" @click="addtemplateNodeDailoing = true, excessiveNodeData = data, nodeForm.name = ''"></i>
-                                <i class="el-icon-delete" style="margin-left: 20px" @click="removeNode(node, data)"></i>
+                                <i class="el-icon-edit" @click="editNode(data)"></i>
+                                <i class="el-icon-circle-plus-outline" style="margin-left: 10px" @click="newNode(data)"></i>
+                                <i class="el-icon-delete" style="margin-left: 10px" @click="removeNode(node, data)"></i>
                             </span>
                         </span>
-                        </el-tree>
+                    </el-tree>
+                    <div class="treeAdd">
+                        <i class="el-icon-circle-plus-outline" @click="newNode()"></i>
+                    </div>
                 </div>
 
             </div>
             <div slot="footer" class="dialog-footer">
-                <!-- <el-button v-if="templateFlg" type="primary" style="width:100%;" :loading="templateDataTreeDaylong" @click="addTemplate('templateForm')">{{ $t('save') }}</el-button>
-                <el-button v-if="!templateFlg" type="primary" style="width:100%;" :loading="templateDataTreeDaylong" @click="uploadTemplate('templateForm')">{{ $t('save') }}</el-button> -->
                 <el-button type="primary" style="width:100%;" :loading="templateDataTreeDaylong" @click="addTemplate('templateForm')">{{ $t('save') }}</el-button>
             </div>
         </el-dialog>
@@ -210,6 +200,41 @@
                 <el-button type="primary" style="width:100%;" @click="addtemplateNode('nodeForm')">确定</el-button>
             </div>
         </el-dialog>
+        <!-- 点击第一级的节点 -->
+        <el-dialog :title="'新增节点'" v-if="addtemplateTwoNodeDailoing" :visible.sync="addtemplateTwoNodeDailoing" :close-on-click-modal="false" customClass="customWidth" width="500px">
+            <div>
+                <el-form :model="nodeForm" ref="nodeForms" label-width="100px" class="demo-ruleForm">
+                    <el-form-item label="节点名称" prop="name"
+                        :rules="[
+                            { required: true, message: '请输入节点名称'}
+                        ]"
+                    >
+                        <el-input v-model="nodeForm.name"></el-input>
+                    </el-form-item>
+                </el-form>
+            </div>
+            <div slot="footer" class="dialog-footer">
+                <el-button type="primary" style="width:100%;" @click="addtemplateTwoNode('nodeForms')">确定</el-button>
+            </div>
+        </el-dialog>
+        <!-- 编辑节点的名称 -->
+        <el-dialog :title="'新增节点'" v-if="addtemplateNodeNameDailoing" :visible.sync="addtemplateNodeNameDailoing" :close-on-click-modal="false" customClass="customWidth" width="500px">
+            <div>
+                <el-form :model="nodeForm" ref="nodeFormss" label-width="100px" class="demo-ruleForm">
+                    <el-form-item label="节点名称" prop="name"
+                        :rules="[
+                            { required: true, message: '请输入节点名称'}
+                        ]"
+                    >
+                        <el-input v-model="nodeForm.name"></el-input>
+                    </el-form-item>
+                </el-form>
+            </div>
+            <div slot="footer" class="dialog-footer">
+                <el-button type="primary" style="width:100%;" @click="editTemplateNodeName('nodeFormss')">确定</el-button>
+            </div>
+        </el-dialog>
+
         </div>
     </section>
 </template>
@@ -284,6 +309,10 @@
     font-size: 16px;
     font-weight: bold;
 }
+.treeAdd {
+    padding: 0 10px;
+    font-size: 20px;
+}
 </style>
 <script>
     import util from "../../common/js/util";
@@ -307,6 +336,7 @@
                 upLoading:false,
                 keyword:null,
                 user: JSON.parse(sessionStorage.getItem("user")),
+                permissions: JSON.parse(sessionStorage.getItem("permissions")),
                 recentFiles: [],
                 addFormVisible: false,
                 addLoading: false,
@@ -331,7 +361,9 @@
                 templateList: [],
                 templateFlg: false,
                 templateIndex: '0',
-                addFolderDialogTwo: false
+                addFolderDialogTwo: false,
+                addtemplateTwoNodeDailoing: false,
+                addtemplateNodeNameDailoing: false
             };
         },
         methods: {
@@ -359,13 +391,28 @@
                 this.templateIndex = index
             },
             editTemplate(data) {
-                this.templateForm.name = data.name
-                this.templateForm.creWithPro = data.creWithPro ? true : false
+                console.log('触发')
+                // this.templateForm.name = data.name
+                // this.templateForm.creWithPro = data.creWithPro ? true : false
                 this.templateForm.id = data.id
                 this.templateDataTree = data.proDocumentTemDetailList
-                this.templateFlg = false
+                // this.templateFlg = false
                 this.templatedialing = true
             },
+            newNode(data) {
+                if(data) {
+                    this.excessiveNodeData = data
+                    this.addtemplateNodeDailoing = true
+                } else {
+                    this.addtemplateTwoNodeDailoing = true
+                }
+                this.nodeForm.name = ''
+            },
+            editNode(data) {
+                this.excessiveNodeData = data
+                this.addtemplateNodeNameDailoing = true
+                this.nodeForm.name = data.label
+            },
             removeTemplate(data) {
                 this.$confirm(`确定删除【${data.name}】模板吗?`, '提示', {
                     confirmButtonText: '确定',
@@ -417,55 +464,43 @@
                     }
                 });
             },
-            addTemplate(formName) {
-                this.$refs[formName].validate((valid) => {
-                    if (valid) {
-                        let obj = {} 
-                        if(this.templateFlg) {
-                            obj = {
-                                documentString: JSON.stringify(this.templateDataTree),
-                                name: this.templateForm.name,
-                                creWithPro: this.templateForm.creWithPro ? '1' : '0',
-                                companyId: this.user.companyId
-                            }
-                        } else {
-                            obj = {
-                                documentString: JSON.stringify(this.templateDataTree),
-                                name: this.templateForm.name,
-                                creWithPro: this.templateForm.creWithPro ? '1' : '0',
-                                id: this.templateForm.id,
-                                companyId: this.user.companyId
-                            }
-                        }
-                        this.templateDataTreeDaylong = true
-                        // this.http.post('/project-document-template/addTemplate', {
-                        this.http.post('/project-document-template/addTemplate', obj,
-                        res => {
-                            this.templateDataTreeDaylong = false
-                            if (res.code == "ok") {
-                                this.$message({
-                                    message: `(${this.templateForm.name}) 模板添加成功,可在创建文件夹中查看`,
-                                    type: 'success'
-                                });
-                                this.templatedialing = false
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: 'error'
-                                });
-                            }
-                        }, error => {
-                            this.templateDataTreeDaylong = false
-                            this.$message({
-                                message: error,
-                                type: 'error'
-                            });
-                        })
+            addTemplate() {
+                let obj = {} 
+                if(this.templateFlg) {
+                    obj = {
+                        documentString: JSON.stringify(this.templateDataTree),
+                        companyId: this.user.companyId
+                    }
+                } else {
+                    obj = {
+                        documentString: JSON.stringify(this.templateDataTree),
+                        id: this.templateForm.id,
+                        companyId: this.user.companyId
+                    }
+                }
+                this.templateDataTreeDaylong = true
+                this.http.post('/project-document-template/addTemplate', obj,
+                res => {
+                    this.templateDataTreeDaylong = false
+                    if (res.code == "ok") {
+                        this.$message({
+                            message: `操作成功`,
+                            type: 'success'
+                        });
+                        this.templatedialing = false
                     } else {
-                        console.log('error submit!!');
-                        return false;
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        });
                     }
-                });
+                }, error => {
+                    this.templateDataTreeDaylong = false
+                    this.$message({
+                        message: error,
+                        type: 'error'
+                    });
+                })
             },
             addtemplateNode(formName) {
                 this.$refs[formName].validate((valid) => {
@@ -484,6 +519,37 @@
                     }
                 });
             },
+            addtemplateTwoNode(formName) {
+                this.$refs[formName].validate((valid) => {
+                    if (valid) {
+                        let obj = {
+                            children: [],
+                            id: new Date().getTime()/ 1000,
+                            label: this.nodeForm.name
+                        }
+                        this.templateDataTree.push(obj)
+                        this.addtemplateTwoNodeDailoing = false
+                    } else {
+                        console.log('error submit!!');
+                        return false;
+                    }
+                });
+            },
+            editTemplateNodeName(formName) {
+                this.$refs[formName].validate((valid) => {
+                    if (valid) {
+                        console.log('excessiveNodeData',this.excessiveNodeData)
+                        let data = this.excessiveNodeData
+                        data.label = this.nodeForm.name
+                        data.name = this.nodeForm.name
+                        this.addtemplateNodeNameDailoing = false
+                    } else {
+                        console.log('error submit!!');
+                        return false;
+                    }
+                });
+            },
+            
             removeNode(node, data) {
                 this.$confirm(`确定删除(${data.label})节点?`, '提示', {
                     confirmButtonText: '确定',
@@ -649,6 +715,9 @@
                 this.addFolderDialogTwo = false
                 this.folderForm = {projectId: this.curProjectId, folderId: this.parentFid,isFolder: 1};
                 this.activeName = 'one'
+                // this.getTemplateList()
+            },
+            defaultTemplate() {
                 this.getTemplateList()
             },
             getTemplateList() {
@@ -656,6 +725,7 @@
                 res => {
                     if (res.code == "ok") {
                         this.templateList = res.data
+                        this.editTemplate(res.data[0])
                     } else {
                         this.$message({message: res.msg,type: 'error'});
                     }