浏览代码

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

ggooalice 2 年之前
父节点
当前提交
4a3bb1eba0
共有 1 个文件被更改,包括 137 次插入10 次删除
  1. 137 10
      fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

+ 137 - 10
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -90,6 +90,9 @@
                             <el-dropdown-item v-if="user.timeType.mainProjectState == 1">
                                 <el-link type="primary" :underline="false" @click="mainProjectDialog = true">主项目管理</el-link>
                             </el-dropdown-item>
+                            <el-dropdown-item v-if="user.company.packageProvider">
+                                <el-link type="primary" :underline="false" @click="phaseProjectDialog = true">项目阶段管理</el-link>
+                            </el-dropdown-item>
                         </el-dropdown-menu>
                         </el-dropdown>
                 </el-form-item>
@@ -152,9 +155,9 @@
                 <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-option v-for="(item, index) in phaseList" :key="index" :label="item.projectStageName" :value="item.id"> </el-option>
                         </el-select>
-                        <el-link v-else type="primary" :underline="false">{{scope.row.currentStage == null ? '暂无' : scope.row.currentStage}}</el-link>
+                        <el-link v-else type="primary" :underline="false">{{scope.row.currentStageId == null ? '暂无' : scope.row.currentStageName}}</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 && rowid == scope.row.id" type="primary" :underline="false"><i class="el-icon-edit"></i></el-link> 
@@ -603,6 +606,28 @@
                 <el-button type="primary" @click="addManPro()" >新增主项目</el-button>
             </div>
         </el-dialog>
+        <!-- 项目阶段配置 -->
+        <el-dialog title="项目阶段管理" show-header="false" v-if="phaseProjectDialog" :visible.sync="phaseProjectDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
+            <el-table :data="phaseList" highlight-current-row  height="400" style="width: 100%;">
+                <el-table-column type="index" width="60" label="序号">
+                    <template slot-scope="scope" >
+                            {{scope.$index+1+(page-1)*size}}
+                        </template>
+                </el-table-column>
+                <el-table-column prop="projectStageName" label="阶段名称" ></el-table-column>
+                <el-table-column label="操作" width="150">
+                    <template slot-scope="scope" >
+                        <el-button size="small" type="primary" @click="addPanthPro(scope.row)">编辑</el-button>
+                        <el-button size="small" type="danger" @click="deletePanthPro(scope.row)">删除</el-button>
+                    </template>
+                </el-table-column>
+
+            </el-table>
+            <div slot="footer" class="dialog-footer">
+                <el-button type="primary" @click="phaseProjectDialog = false" >关闭</el-button>
+                <el-button type="primary" @click="addPanthPro()" >新增项目阶段</el-button>
+            </div>
+        </el-dialog>
         <!-- 新增/编辑 分类条目 -->
         <el-dialog title="新增/修改分类条目" v-if="addClfDialog" :visible.sync="addClfDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
             <el-form ref="form2" :model="addClf" :rules="rules" label-width="100px">
@@ -635,6 +660,18 @@
                 <el-button type="primary" @click="submitManPro" :loading="addLoading">提交</el-button>
             </div>
         </el-dialog>
+        <!-- 新增/编辑项目阶段 -->
+        <el-dialog title="新增/修改项目阶段" v-if="addFlgPanthProjectDialog" :visible.sync="addFlgPanthProjectDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
+            <el-form ref="form2" :model="addPanthForm" :rules="rules" label-width="120px">
+                <el-form-item label="项目阶段名称" prop="name">
+                    <el-input v-model="addPanthForm.projectStageName" placeholder="请输入名称" clearable></el-input>
+                </el-form-item>
+            </el-form>
+            <div slot="footer" class="dialog-footer">
+                <el-button @click.native="addFlgPanthProjectDialog = false">取消</el-button>
+                <el-button type="primary" @click="submitPanthPro" :loading="addLoading">提交</el-button>
+            </div>
+        </el-dialog>
 
         <el-dialog title="新增/修改成本项" v-if="addBaseItemDialog" :visible.sync="addBaseItemDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
             <el-form ref="form2" :model="addForm" :rules="rules" label-width="100px">
@@ -823,6 +860,7 @@ a {
         data() {
             return {
                 addFlgmainProjectDialog: false,
+                addFlgPanthProjectDialog: false,
                 mainProjectList: [],
                 mainProjectDialog: false,
                 showImportResult: false,
@@ -904,7 +942,8 @@ a {
                 temaddForm: {},
                 rules: {
                     name: [{ required: true, message: "请输入名称", trigger: "blur" }],
-                    code: [{ required: true, message: "请输入编号", trigger: "blur" }]
+                    code: [{ required: true, message: "请输入编号", trigger: "blur" }],
+                    projectStageName: [{ required: true, message: "请输入名称", trigger: "blur" }],
                 },
                 ause: [],
                 auseList: [],
@@ -920,6 +959,10 @@ a {
                     code: '',
                     categoryId: ''
                 },
+                addPanthForm: {
+                    id: '',
+                    projectStageName: ''
+                },
                 statusClf:null,
                 permissionsObj: {},
 
@@ -949,7 +992,8 @@ a {
                 phaseProjectId: '', // 阶段项目id
                 phaseProjectValie: null, // 阶段项目值
                 listHeader: [], // 列表表头
-                rowid: ''
+                rowid: '',
+                phaseProjectDialog: false, // 项目阶段
             };
         },
         // 过滤器
@@ -997,9 +1041,7 @@ a {
             },
             // 获取阶段
             obtainPhase(item) {
-                this.http.post('/stages/getProjectStages', {
-                    projectId: item.id
-                },
+                this.http.post('/project-stage/list', {},
                 res => {
                     if (res.code == "ok") {
                         // this.phaseList = res.data
@@ -1026,11 +1068,11 @@ a {
             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.phaseProjectValie = row.currentStageId  ? row.currentStageId : ''
                     this.currentCell = row.index + ',' + column.index;
                     if(column.index == 5) {
                         this.phaseProjectId = row.id
-                        this.obtainPhase(row)
+                        // this.obtainPhase(row)
                     }
                     setTimeout(() => {
                         // 获得焦点
@@ -1039,9 +1081,16 @@ a {
                 }
             },
             selectChange() {
+                let currentStageName = ''
+                for(var i in this.phaseList) {
+                    if(this.phaseList[i].id == this.phaseProjectValie) {
+                        currentStageName = this.phaseList[i].projectStageName
+                    }
+                }
                 this.http.post('/project/changeCurrentStage', {
                     projectId: this.phaseProjectId,
-                    currentStage: this.phaseProjectValie 
+                    currentStageId: this.phaseProjectValie,
+                    currentStageName: currentStageName
                 },
                 res => {
                     if (res.code == "ok") {
@@ -1126,6 +1175,22 @@ a {
                     }
                 }
             },
+            addPanthPro(row) {
+                this.addFlgPanthProjectDialog = true
+                if(!row) {
+                    this.addPanthForm = {
+                        projectStageName: '',
+                        id: '',
+                        companyId:''
+                    }
+                } else {
+                    this.addPanthForm = {
+                        id: row.id,
+                        projectStageName: row.projectStageName,
+                        companyId: row.companyId
+                    }
+                }
+            },
             // 获取主项目
             getMainProject() {
                 this.http.post('/project-main/list',{},res => {
@@ -2033,6 +2098,28 @@ a {
                         }
                     );
             },
+            // 提交项目阶段
+            submitPanthPro() {
+                this.http.post('/project-stage/addOrMod',this.addPanthForm,
+                    res => {
+                        if (res.code == "ok") {
+                            this.addFlgPanthProjectDialog = false;
+                            this.obtainPhase()
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                        }
+                    );
+            },
             // 删除
             deleteClf(row) {
                 this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除分类条目", {
@@ -2109,6 +2196,44 @@ a {
                 })
                 .catch(() => {});
             },
+            // 删除项目阶段
+            deletePanthPro(row) {
+                this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除项目阶段", {
+                    confirmButtonText: "确定",
+                    cancelButtonText: "取消",
+                    type: "warning"
+                })
+                .then(() => {
+                    this.listLoading = true;
+                    this.http.post('/project-stage/delete ',{ 
+                        id: row.id 
+                    },
+                    res => {
+                        this.listLoading = false;
+                        if (res.code == "ok") {
+                            this.$message({
+                                message: "删除成功",
+                                type: "success"
+                            });
+                            this.obtainPhase();
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.listLoading = false;
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                        }
+                    );
+                })
+                .catch(() => {});
+            },
             // 分类筛选
             searchClfList(){
                 this.page = 1;
@@ -3019,6 +3144,8 @@ a {
             // 判断是否有供应商字段
             if(this.user.company.packageProvider == 1){
                 this.getSupplierList()
+                // this.getPhase()
+                this.obtainPhase()
             }
             // this.getSupplierList()