ソースを参照

增加项目阶段

Lijy 2 年 前
コミット
6f3931158b

+ 99 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -106,9 +106,8 @@
                 </el-form-item>
             </el-form>
         </el-col>
-
         <!--列表-->
-        <el-table ref="projectlistOfWudulist" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="checkedWudulist" @sort-change="tableSort">
+        <el-table ref="projectlistOfWudulist" @cell-click="clickCell" :cell-class-name="tableCellClassName" :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;" @selection-change="checkedWudulist" @sort-change="tableSort">
             <el-table-column type="selection" width="60" :selectable="isSelectable">
                 <!-- creator 项目创建人    incharger 项目负责人 -->
             </el-table-column>
@@ -146,6 +145,21 @@
                     <el-link type="primary" :underline="false" @click="showUser(scope.row.inchargerId)">{{scope.row.inchargerName}}</el-link>
                 </template>
             </el-table-column>
+
+            <!-- 项目阶段 -->
+            <el-table-column prop="inchargerName" label="项目阶段" sortable="custom" min-width="150" width="220" v-if="user.company.packageProject == 1">
+                <template slot-scope="scope">
+                    <span style="display: inline-block; width: 150px">
+                        <el-select v-model="phaseProjectValie" v-if="scope.row.index + ',' + scope.column.index == currentCell" :ref="scope.row.index + ',' + scope.column.index" filterable placeholder="请选择项目阶段" size="mini" @blur="hideSelect" @change="selectChange">
+                            <el-option v-for="(item, index) in phaseList" :key="index" :label="item" :value="item"> </el-option>
+                        </el-select>
+                        <el-link v-else type="primary" :underline="false">{{scope.row.currentStage == null ? '暂无' : scope.row.currentStage}}</el-link>
+                    </span> 
+                    
+                    <el-link v-if="(permissions.projectManagement || user.id==scope.row.inchargerId || user.id==scope.row.creatorId) && scope.row.index + ',' + scope.column.index != currentCell" type="primary" :underline="false"><i class="el-icon-edit"></i></el-link> 
+                </template>
+            </el-table-column>
+
             <el-table-column prop="participator" label="参与者" :min-width="user.company.packageCustomer != 1 ? '' : '300'" sortable v-if="user.company.packageProject==0">
                 <template slot-scope="scope">
                     <!-- <v-for v-for="par in scope.row.participator" :key="par.id" >
@@ -185,6 +199,12 @@
                 </div>
             </template>
             </el-table-column>
+            <!-- 级别 -->
+            <el-table-column prop="level" label="级别" min-width="190"   v-if="user.company.packageProject == 1" sortable="custom">
+                <template slot-scope="scope">
+                    {{importanceListLable[scope.row.level - 1]}}
+                </template>
+            </el-table-column>
             <!-- 供应商 -->
             <el-table-column prop="providerNames" label="供应商" min-width="190" v-if="user.company.packageProvider">
             </el-table-column>
@@ -833,6 +853,7 @@ a {
                 status:"1",
                 statusTxt:["-","进行中","已完成","已撤销","已暂停"],
                 importanceList:[{id:1,label:'正常'},{id:2,label:'紧急'},{id:3,label:'重要'},{id:4,label:'重要且紧急'}],
+                importanceListLable:['正常', '紧急', '重要', '重要且紧急', '低风险', '中风险', '高风险'],
                 searchField:'1',
                 keyword:null,
                 user: JSON.parse(sessionStorage.getItem("user")),
@@ -908,7 +929,11 @@ a {
                 projectMainId: '',
                 supplierList: '',
                 sortProp: '',
-                sortOrder: null
+                sortOrder: null,
+                currentCell: null, // 当前单击的是哪一个单元格
+                phaseList: [],
+                phaseProjectId: '', // 阶段项目id
+                phaseProjectValie: null, // 阶段项目值
             };
         },
         // 过滤器
@@ -941,6 +966,77 @@ a {
             }
         },
         methods: {
+            // 获取阶段
+            obtainPhase(item) {
+                this.http.post('/stages/getProjectStages', {
+                    projectId: item.id
+                },
+                res => {
+                    if (res.code == "ok") {
+                        // this.phaseList = res.data
+                        this.$set(this, 'phaseList', res.data)
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+            // 表格点击
+            tableCellClassName({row, column, rowIndex, columnIndex}) {
+                row.index=rowIndex;
+                column.index=columnIndex;
+            },
+            clickCell(row,column) {
+                console.log(this.permissions.projectManagement || this.user.id==row.inchargerId || this.user.id==row.creatorId)
+                if(this.permissions.projectManagement || this.user.id==row.inchargerId || this.user.id==row.creatorId) {
+                    this.phaseProjectValie = row.currentStage ? row.currentStage : ''
+                    this.currentCell = row.index + ',' + column.index;
+                    if(column.index == 5) {
+                        this.phaseProjectId = row.id
+                        this.obtainPhase(row)
+                    }
+                    setTimeout(() => {
+                        // 获得焦点
+                        this.$refs[row.index + ',' + column.index].focus();
+                    })
+                }
+            },
+            selectChange() {
+                this.http.post('/project/changeCurrentStage', {
+                    projectId: this.phaseProjectId,
+                    currentStage: this.phaseProjectValie 
+                },
+                res => {
+                    if (res.code == "ok") {
+                        this.getList()
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
+            hideSelect() {
+                var that = this
+                setTimeout(() => {
+                    that.currentCell = null
+                }, 500)
+            },
             // 点击主项目事件
             projectManagementChange() {
                 let categoryId = ''

+ 2 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/task/list.vue

@@ -53,8 +53,8 @@
                 <el-table :data="list" highlight-current-row v-loading="listLoading" :height="tableHeight" style="width: 100%;">
                     <el-table-column type="index" width="60">
                         <template slot-scope="scope" >
-                                {{scope.$index+1+(page-1)*size}} 
-                            </template>
+                            {{scope.$index+1+(page-1)*size}} 
+                        </template>
                     </el-table-column>
                     <el-table-column prop="stagesName" label="任务阶段" sortable width="180" @mouseover="mouseOver">
                     </el-table-column>