123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136 |
- <template>
- <section>
- <!--工具条-->
- <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
- <el-form :inline="true">
- <el-form-item label="项目列表" class="toolbar_formitem_n1">
-
- </el-form-item>
- <el-form-item >
- <div>
- <el-input style="float:left;" v-model="keyword" class="input-with-select" placeholder="请输入项目名称关键字" clearable="true">
- <el-select v-model="searchField" style="width:120px;" slot="prepend" placeholder="请选择">
- <el-option label="项目名称" value=1 ></el-option>
- <el-option label="项目编号" value=2></el-option>
- </el-select>
- <el-button slot="append" @click="searchList" icon="el-icon-search"></el-button>
- </el-input>
- </div>
- </el-form-item>
- <el-form-item >
- <span style="margin-left:5px;margin-right:5px;color:#606266;">状态</span>
- <el-select v-model="status" style="width:110px;" placeholder="请选择" @change="searchList">
- <el-option label="全部" value=0 ></el-option>
- <el-option label="进行中" value=1 ></el-option>
- <el-option label="已完成" value=2 ></el-option>
- <el-option label="已撤销" value=3 ></el-option>
- </el-select>
- </el-form-item>
- <!-- 分类筛选 -->
- <el-form-item >
- <span style="margin-left:5px;margin-right:5px;color:#606266;">分类</span>
- <el-select v-model="statusClf" style="width:110px;" placeholder="请选择" clearable @change="searchClfList">
- <el-option v-for="item in baseClfList" :key="item.id" :label="item.name" :value="item.id" ></el-option>
- </el-select>
- </el-form-item>
- <!-- 分类条目 -->
- <el-form-item style="float:right;" v-if="permissions.projectClassification">
- <el-link type="primary" :underline="false" @click="showClfDialog = true">分类管理</el-link>
- </el-form-item>
- <!-- 项目成本基线条目 -->
- <el-form-item style="float:right;" v-if="user.company.packageProject == 1 && permissions.projectCostOfItems">
- <el-link type="primary" :underline="false" @click="showBaseCostItemDialog">基线成本项</el-link>
- </el-form-item>
-
- <el-form-item style="float:right;" v-if="permissions.projectExport">
- <el-link type="primary" style="margin-left:5px;" :underline="false" @click="exportProjectData" download="项目导出.xlsx">导出项目</el-link>
- </el-form-item>
- <el-form-item style="float:right;" v-if="permissions.projectImport">
- <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/项目导入模板.xlsx" download="项目导入模板.xlsx">模板下载</el-link>
- </el-form-item>
- <el-form-item style="float:right;" v-if="permissions.projectImport">
- <el-upload ref="upload" style="margin-left:5px;" action="#" :limit="1" :http-request="importProject" :show-file-list="false">
- <el-link type="primary" :underline="false" >导入项目</el-link>
- </el-upload>
- </el-form-item>
- <!-- <el-form-item style="float:right;" v-if="user.role == 1||user.role == 2||user.role == 5"> -->
- <el-form-item style="float:right;" v-if="permissions.projectNew">
- <el-link type="primary" :underline="false" @click="handleAdd(-1,null)">新增项目</el-link>
- </el-form-item>
- <el-form-item style="float:right;" v-if="permissions.projectResources">
- <!-- <router-link to="/projectGantt"> -->
- <el-link type="primary" :underline="false" @click="isganttshow = true">资源分配</el-link>
- <!-- </router-link> -->
- <el-dialog v-if="isganttshow" :visible.sync="isganttshow" width="1480px" top="3vh" style="height:96%" class="ganttdialog">
- <projectgantt></projectgantt>
- </el-dialog>
- </el-form-item>
- </el-form>
- </el-col>
- <!--列表-->
- <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>
- </el-table-column>
- <el-table-column prop="projectCode" label="项目编号" sortable width="120"></el-table-column>
- <el-table-column prop="categoryName" label="项目分类" sortable width="120"></el-table-column>
- <el-table-column prop="projectName" label="项目名称" width="250" sortable>
- <template slot-scope="scope">
- <!-- <div class="kans">
- <el-link type="primary" v-if="user.company.packageProject==1" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
- <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
- </div> -->
- <el-popover placement="top" width="400" trigger="hover" v-if="scope.row.projectName.length > 15">
- <div>
- <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
- <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
- </div>
- <div slot="reference" class="kans">
- <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
- <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
- </div>
- </el-popover>
- <div v-else>
- <el-link type="primary" v-if="user.company.packageProject==1" :underline="false" :href="'#/projectInside/'+scope.row.id">{{scope.row.projectName}}</el-link>
- <span v-if="user.company.packageProject==0" >{{scope.row.projectName}}</span>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="inchargerName" label="负责人" sortable width="150">
- <template slot-scope="scope">
- <el-link type="primary" :underline="false" @click="showUser(scope.row.inchargerId)">{{scope.row.inchargerName}}</el-link>
- </template>
- </el-table-column>
- <el-table-column prop="participator" label="参与者" :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" >
- <el-link style="margin-right:10px;" type="primary" @click="showUser(par.id)">{{par.name}}</el-link>
- </v-for> -->
- <div v-if="scope.row.participator.length > 5">
- <el-popover placement="top" width="500" trigger="hover" v-if="scope.row.participator.length > 0">
- <span v-for="par in scope.row.participator" :key="par.id">
- <el-link style="margin-right:10px;" :underline="false" type="primary" @click="showUser(par.id)">{{par.name}}</el-link>
- </span>
- <div slot="reference" class="addss">
- <span v-for="par in scope.row.participator" :key="par.id">
- <el-link style="margin-right:10px;" :underline="false" type="primary" @click="showUser(par.id)">{{par.name}}</el-link>
- </span>
- </div>
- </el-popover>
- </div>
- <div v-else>
- <span v-for="par in scope.row.participator" :key="par.id" >
- <el-link style="margin-right:10px;" type="primary" :underline="false" @click="showUser(par.id)">{{par.name}}</el-link>
- </span>
- </div>
-
- </template>
- </el-table-column>
- <!-- 客户管理 -->
- <el-table-column prop="customerName" label="客户" v-if="user.company.packageCustomer == 1">
- </el-table-column>
- <el-table-column prop="status" label="状态" width="100" >
- <template slot-scope="scope">
- {{scope.row.status == null?"-":statusTxt[scope.row.status]}}
- </template>
- </el-table-column>
- <!--专业项目协作-->
-
- <el-table-column prop="planStartDate" label="开始日期" width="96" >
- </el-table-column>
- <el-table-column prop="planEndDate" label="截止日期" width="96" >
- </el-table-column>
- <el-table-column prop="progress" label="完成度" width="100" v-if="user.company.packageProject == 1">
- <template slot-scope="scope">
- {{scope.row.progress==null?"-":scope.row.progress}}%
- </template>
- </el-table-column>
- <el-table-column label="操作" width="390" align="left" v-if="permissions.projectManagement">
- <template slot-scope="scope">
- <el-button v-if="user.role>0" size="mini" @click="subProject(scope.row)">子项目</el-button>
- <el-button size="mini" v-if="user.role>0 || user.id==scope.row.inchargerId" type="primary" @click="handleAdd(scope.$index, scope.row)">编辑</el-button>
- <el-button v-if="user.role>0" size="mini" @click="deletePro(scope.$index, scope.row)">删除</el-button>
- <!-- 111 -->
- <el-dropdown class="customdropdown" split-button size="mini" @click="finishPro(scope.row)" v-if="user.role>0 && scope.row.status == 1" placement="bottom-start">
- 完成
- <el-dropdown-menu slot="dropdown" class="customdropdown_menu">
- <el-button size="mini" @click="cancelPro(scope.row)" class="customdropdown_menu_btn">撤销</el-button>
- </el-dropdown-menu>
- </el-dropdown>
- <!-- <el-button v-if="user.role>0 && scope.row.status == 1" size="mini" @click="cancelPro(scope.row)">撤销</el-button>
- <el-button v-if="user.role>0 && scope.row.status == 1" size="mini" @click="finishPro(scope.row)">完成</el-button> -->
- <el-button v-if="user.role>0 && scope.row.status >= 2" size="mini" @click="restartPro(scope.row)">重启</el-button>
- </template>
- </el-table-column>
- </el-table>
- <!--工具条-->
- <el-col :span="24" class="toolbar">
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[20 , 50 , 80 , 100]"
- :page-size="20"
- layout="total, sizes, prev, pager, next"
- :total="total"
- style="float:right;"
- ></el-pagination>
- </el-col>
- <!--新增界面-->
- <el-dialog :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth" width="960px">
- <el-form ref="form1" :model="addForm" :rules="rules" label-width="120px">
- <el-form-item label="项目编号" >
- <el-input v-model="addForm.code" :disabled="user.role==0" placeholder="请输入项目编号" clearable></el-input>
- </el-form-item>
- <el-form-item label="项目分类">
- <el-select v-model="addForm.category" clearable>
- <el-option v-for="(item) in baseClfList" :key="item.id" :value="item.id" :label="item.name"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="项目名称" prop="name">
- <el-input v-model="addForm.name" :disabled="user.role==0" placeholder="请输入项目名称" clearable></el-input>
- </el-form-item>
- <el-form-item label="项目类型" prop="isPublic">
- <el-select v-model="addForm.isPublic" style="width:32%;" @change="selectPublic">
- <el-option :value="0" label="普通项目"></el-option>
- <el-option :value="1" label="公共项目"></el-option>
- </el-select>
- <el-tooltip effect="dark" content="普通项目只对参与人员开放,公共项目对所有成员开放" placement="top-start">
- <i class="el-icon-question"></i>
- </el-tooltip>
- <div v-if="user.company.packageProject==1" style="display: inline-block;width: 50%">
- <span style="margin-left:63px;margin-right:10px;" v-if="user.company.packageCustomer == 1">客户</span>
- <el-select v-model="addForm.customerId" clearable="true" filterable placeholder="请选择客户" style="width:70%;" >
- <el-option v-for="item in customerList" :key="item.id" :label="item.customerName" :value="item.id"></el-option>
- </el-select>
- </div>
- </el-form-item>
- <el-form-item :label="yonghuUser.customDegreeName" v-if="yonghuUser.customDegreeActive == 1">
- <el-select v-model="auseList" multiple placeholder="请选择" filterable="true" style="width: 100%">
- <span v-for="(item, index) in ause" :key="index">
- <el-option :label="item.name" :value="item.id"></el-option>
- </span>
- </el-select>
- </el-form-item>
- <!-- <el-form-item label="客户" v-if="user.company.packageCustomer == 1">
- <el-select v-model="addForm.customerId" clearable="true" filterable placeholder="请选择客户" style="width:100%;" >
- <el-option v-for="item in customerList" :key="item.id" :label="item.customerName" :value="item.id"></el-option>
- </el-select>
- </el-form-item> -->
- <el-form-item label="全部参与者" v-show="addForm.isPublic == 0">
- <el-input @focus="showChooseMembTree" v-model="addForm.userNames"></el-input>
- </el-form-item>
- <el-form-item label="负责人" >
- <el-select v-model="addForm.inchargerId" :disabled="(addForm.userId.length==0 || user.role==0) && addForm.isPublic == 0" filterable placeholder="请选择负责人" style="width:32%;" >
- <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item label="日报审核人" >
- <el-select v-model="addForm.auditUserIds" multiple="true" :disabled=" !(user.role==1 ||user.role==2|| user.id == addForm.inchargerId || user.id == addForm.creatorId)" filterable placeholder="默认为项目负责人" style="width:100%;" >
- <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- <!--专业项目协作版本功能 -->
- <el-form-item label="级别" v-if="user.company.packageProject==1">
- <el-select v-model="addForm.level" placeholder="请选择级别" style="width:32%;" >
- <el-option v-for="item in importanceList" :key="item.id" :label="item.label" :value="item.id"></el-option>
- </el-select>
- <!-- 增加合同金额字段 -->
- <span style="margin-left:63px;margin-right:10px;" v-if="user.company.packageProject==1">合同金额</span>
- <el-input id="contractAmount" v-model="addForm.contractAmount" style="width:33%;"
- placeholder="整数" clearable @keyup.native="restrictNumber('contractAmount')" ></el-input><span style="margin-left:10px;">元</span>
- <!-- 增加合同金额字段 -->
- </el-form-item>
- <el-form-item label="开始日期" prop="planStartDate" >
- <el-date-picker v-model="addForm.planStartDate"
- :editable="false" style="width:32%;"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- :clearable="false" type="date"
- placeholder="选择日期"></el-date-picker>
- <span style="margin-left:63px;margin-right:10px;" >截止日期</span>
- <el-date-picker v-model="addForm.planEndDate" style="width:33%;"
- :editable="false"
- format="yyyy-MM-dd"
- value-format="yyyy-MM-dd"
- :clearable="false" type="date"
- placeholder="选择日期"></el-date-picker>
- </el-form-item>
- <!--非建筑工程专业版设置 -->
- <!-- <el-form-item label="日报审核权限" v-if="user.company.packageProject==1 && user.company.packageEngineering == 0">
- <el-radio-group v-model="addForm.taskGpIncharge" >
- <el-radio :label="0">由项目负责人审核</el-radio>
- <el-radio :label="1">由各任务分组负责人审核</el-radio>
- </el-radio-group>
- </el-form-item> -->
-
- <!-- 项目基线 -->
- <div style="margin: 10px 0 30px 0;min-height:200px;" v-if="user.company.packageProject == 1">
- <el-tabs v-model="activeName" @tab-click="handleClick">
- <el-tab-pane label="成本基线" name="baseCostPanel" >
- <div style="padding-top:10px;">
- <!--新版 -->
- <span class="rg_span" v-for="(item, index) in projectBaseCostData" :key="item.id">
- <span style="width:120px;display: inline-block;" v-if="user.company.packageProject==1">{{item.baseName}}</span>
- <el-input :id="'baseCost'+index" @input="addUpfun()" v-model="item.baseAmount" style="width:200px; margin-bottom: 20px"
- placeholder="整数" clearable @keyup.native="restrictNumber('baseCost'+index)"></el-input><span style="margin-left:10px;">元</span>
- </span>
- <!-- 合计 -->
- <div style="margin-top: 10px;float:right;">
- <span style="margin-right:50px;margin-right:10px;" v-if="user.company.packageProject==1">合计</span>
- <span v-if="addForm.budget <= 0 || addForm.budget == undefined">0</span>
- <span v-else>{{addForm.budget | numberToCurrency}}</span>
- <span style="margin-right:50px;margin-left:10px;">元</span>
- </div>
- </div>
- </el-tab-pane>
- <el-tab-pane label="工程专业" name="engineeringProfession" v-if="user.company.packageEngineering == 1">
- <div style="padding-top:10px;">
- <el-table :data="projectProfessionList" size="small" :key="Math.random()">
- <el-table-column prop="professionId" width="200">
- <template slot-scope="scope">
- <el-select v-model="scope.row.professionId" >
- <el-option v-for="item in professionList" :key="item.id" :label="item.name" :value="item.id"/>
- </el-select>
- </template>
- <template slot="header" >
- <span style="font-size:14px;font-weight:normal;">专业名称</span>
- </template>
- </el-table-column>
- <el-table-column prop="percentage" width="120" label="占比(%)">
- <template slot-scope="scope">
- <div><el-input type="number" v-model="scope.row.percentage"></el-input></div>
- </template>
- </el-table-column>
-
- <el-table-column prop="membNames" label="相关人员及占比">
- <template slot-scope="scope">
- <span style="margin:0 5px;" v-for="item in scope.row.membList" :key="item.membId">{{item.membName}}({{item.percentage}}%)</span>
- <el-link @click="showEditPpMembs(scope.row)">{{(scope.row.membList == null || scope.row.membList.length == 0)?'设置专业参与人员':'设置'}}</el-link>
- </template>
- </el-table-column>
- <el-table-column prop="inchargerName" width="120" label="负责人">
- <template slot-scope="scope">
- <el-select v-model="scope.row.inchargerId" >
- <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id">
-
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column width="80">
- <template slot-scope="scope">
- <el-button icon="el-icon-delete" size="mini" style="margin-left:10px;" @click.stop.native="deleteItem(scope.$index)"></el-button>
- </template>
- <template slot="header" >
- <el-link type="primary" :underline="false" @click="addItem">添加</el-link>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </el-tab-pane>
- <el-tab-pane label="相关领导" name="leaders" >
- <div style="padding-top:10px;">
- <el-input @focus="showChooseLeaderTree" v-model="addForm.notifyUserNames" placeholder="请选择需要接收审核通知的相关领导"></el-input>
- </div>
- </el-tab-pane>
- </el-tabs>
- </div>
-
- </el-form>
- <div slot="footer" class="dialog-footer;">
- <el-button @click.native="addFormVisible = false">取消</el-button>
- <el-button type="primary" @click="submitInsert" :loading="addLoading">提交</el-button>
- </div>
- </el-dialog>
- <!--用户详细信息弹出框-->
- <el-dialog title="查看详情" v-if="userDetailVisible" :visible.sync="userDetailVisible" :close-on-click-modal="false" customClass="customWidth" width="400px">
- <div class="line"><span>姓名</span><span>{{userDetail.name}}</span></div>
- <div class="line"><span>手机号码</span><span>{{userDetail.phone}}</span></div>
- <div class="line"><span>角色</span><span>{{roleArray[userDetail.role]}}</span></div>
- <div class="line"><span>部门</span><span>{{userDetail.departmentName}}</span></div>
- <div class="line" v-if="user.role == 1 || user.role == 2 || user.role == 6"><span>成本</span><span>{{userDetail.cost}}元/小时</span></div>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="userDetailVisible = false" >确定</el-button>
- </div>
- </el-dialog>
- <!-- 子项目列表 -->
- <el-dialog title="子项目列表" show-header="false" v-if="subProjectVisible" :visible.sync="subProjectVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
- <el-table :data="subProjectList" 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 width="120" label="子项目编号" prop="code"></el-table-column>
- <el-table-column prop="name" label="名称" ></el-table-column>
- <el-table-column label="操作" width="150">
- <template slot-scope="scope" >
- <el-button size="small" type="primary" @click="addNewSubProject(scope.row)">编辑</el-button>
- <el-button size="small" type="danger" @click="deleteSubPro(scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="subProjectVisible = false" >关闭</el-button>
- <el-button type="primary" @click="addNewSubProject()" >新增子项目</el-button>
- </div>
- </el-dialog>
- <!-- 新增子项目弹出框 -->
- <el-dialog title="新增/修改子项目" v-if="addSubProject" :visible.sync="addSubProject" :close-on-click-modal="false" customClass="customWidth" width="500px">
- <el-form ref="form2" :model="temaddForm" :rules="rules" label-width="100px">
- <el-form-item label="项目编号" prop="code">
- <el-input v-model="temaddForm.code" placeholder="请输入项目编号" clearable></el-input>
- </el-form-item>
- <el-form-item label="项目名称" prop="name">
- <el-input v-model="temaddForm.name" placeholder="请输入项目名称" clearable></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click.native="addSubProject = false">取消</el-button>
- <el-button type="primary" @click="submitInsertSubProject" :loading="addLoading">提交</el-button>
- </div>
- </el-dialog>
- <!-- 项目基线成本项配置弹出框 -->
- <el-dialog title="项目基线成本项管理" show-header="false" v-if="showBaseConfig" :visible.sync="showBaseConfig" :close-on-click-modal="false" customClass="customWidth" width="500px">
- <el-table :data="baseCostItemList" 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="name" label="名称" ></el-table-column>
- <el-table-column label="操作" width="150">
- <template slot-scope="scope" >
- <el-button size="small" type="primary" @click="addNewBaseItem(scope.row)">编辑</el-button>
- <el-button size="small" type="danger" @click="deleteBaseItem(scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="showBaseConfig = false" >关闭</el-button>
- <el-button type="primary" @click="addNewBaseItem()" >新增成本项</el-button>
- </div>
- </el-dialog>
- <!-- 分类条目配置 -->
- <el-dialog title="项目分类条目管理" show-header="false" v-if="showClfDialog" :visible.sync="showClfDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
- <el-table :data="baseClfList" 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="name" label="名称" ></el-table-column>
- <el-table-column label="操作" width="150">
- <template slot-scope="scope" >
- <el-button size="small" type="primary" @click="addNewClf(scope.row)">编辑</el-button>
- <el-button size="small" type="danger" @click="deleteClf(scope.row)">删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="showClfDialog = false" >关闭</el-button>
- <el-button type="primary" @click="addNewClf()" >新增分类项</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">
- <el-form-item label="分类名称" prop="name">
- <el-input v-model="addClf.name" placeholder="请输入名称" clearable></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click.native="addClfDialog = false">取消</el-button>
- <el-button type="primary" @click="submitClf" :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">
- <el-form-item label="成本项名称" prop="name">
- <el-input v-model="addForm.name" placeholder="请输入名称" clearable></el-input>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button @click.native="addBaseItemDialog = false">取消</el-button>
- <el-button type="primary" @click="submitInsertBaseItem" :loading="addLoading">提交</el-button>
- </div>
- </el-dialog>
- <!-- 按部门选择人员 -->
- <el-dialog title="选择参与人员" v-if="chooseParticipVisible" :visible.sync="chooseParticipVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
- <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
- <div class="tree" style="height:400px">
- <el-scrollbar style="height:100%">
- <el-input
- placeholder="输入关键字进行过滤"
- v-model="filterText">
- </el-input>
- <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
- ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="addForm.userId"
- highlight-current :filter-node-method="filterNode" default-expand-all></el-tree>
- </el-scrollbar>
- </div>
- <div>已选中 {{chosenMembCount}} 人</div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="chooseParticipVisible = false" >取消</el-button>
- <el-button type="primary" @click="chooseParticip()" >确定</el-button>
- </div>
- </el-dialog>
- <!-- 按部门选择相关领导 -->
- <el-dialog title="选择相关领导" v-if="chooseLeaderVisible" :visible.sync="chooseLeaderVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
- <!-- <el-input style="width:100%" v-model="filterName" placeholder="请输入姓名搜索" @change="findUserInTree"></el-input> -->
- <div class="tree" style="height:400px">
- <el-scrollbar style="height:100%">
- <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
- ref="chooseLeaderTree" @check-change="onLeaderTreeItemChange" :default-checked-keys="addForm.notifyUserIds"
- highlight-current ></el-tree>
- </el-scrollbar>
- </div>
- <div>已选中 {{chosenMembCount}} 人</div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="chooseLeaderVisible = false" >取消</el-button>
- <el-button type="primary" @click="chooseLeader()" >确定</el-button>
- </div>
- </el-dialog>
- <!-- 项目专业人员的设置 -->
- <el-dialog title="设置项目专业人员" v-if="editPpMembDialog" :visible.sync="editPpMembDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
- <el-table :data="curProfessionRow.membList" height="400">
- <el-table-column prop="name" label="专业人员">
- <template slot-scope="scope">
- <el-select v-model="scope.row.membId" filterable placeholder="请选择专业参与人" style="width:100%;" >
- <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id">
- </el-option>
- </el-select>
- </template>
- </el-table-column>
- <el-table-column prop="percentage" width="120" label="占比(%)">
- <template slot-scope="scope">
- <el-input type="number" v-model="scope.row.percentage"></el-input>
- </template>
- </el-table-column>
- <el-table-column width="80">
- <template slot-scope="scope">
- <el-button icon="el-icon-delete" size="mini" style="margin-left:10px;" @click.stop.native="deleteMembItem(scope.$index)"></el-button>
- </template>
- <template slot="header" >
- <el-link @click="addMembItem">添加</el-link>
- </template>
- </el-table-column>
- </el-table>
- <div slot="footer" class="dialog-footer">
- <el-button @click="editPpMembDialog = false" >取消</el-button>
- <el-button type="primary" @click="addPpMemb" >确定</el-button>
- </div>
- </el-dialog>
- <!-- <el-dialog title="提示" v-if="deleteReconfirmDialog" :visible.sync="deleteReconfirmDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
- <p>{{deleteAlertMsg}}</p>
- <div slot="footer" class="dialog-footer">
- <el-button @click="deleteReconfirmDialog = false" >取消</el-button>
- <el-button type="primary" @click="forceDeletePro" >确认并删除</el-button>
- </div>
- </el-dialog> -->
- </section>
- </template>
- <style scoped>
- .input-with-select .el-input-group__prepend {
- background-color: #fff;
- }
- .line {
- padding:10px;
- }
- .line span{
- font-size:15px;
- }
- .line span:nth-child(even){
- float:right;
- }
- .kans {
- width: 230px;
- overflow:hidden;
- white-space:nowrap;
- text-overflow: ellipsis;
- }
- a {
- text-decoration: none;
- }
-
- .router-link-active {
- text-decoration: none;
- }
- </style>
- <script>
- import util from "../../common/js/util";
- import projectgantt from "./project_gantt.vue"
- export default {
- components:{projectgantt},
- data() {
- return {
- isganttshow: false,
- deleteAlertMsg: null,
- chosenLeaders:[],
- chooseLeaderVisible:false,
- projectProfessionItem:null,
- curProfessionRow:null,
- editPpMembDialog:false,
- professionList:[],
- projectProfessionList:[],
- activeName:"baseCostPanel",
- chosenMembCount:0,
- chosenMembList:[],//选中的人员
- allMembData:[],
- deptMembData: [
- {
- id: 0,
- label: '未分配',
- }
- ],
- option: [],
- depData: {
- id: -1,
- label: '全部人员',
- },
- defaultProps: {
- children: 'children',
- label: 'label'
- },
- filterName:null,
- chooseParticipVisible: false,
- projectBaseCostData:[],
- addBaseItemDialog:false,
- showBaseConfig:false,
- customerList:[],
- roleArray:["普通员工","超级管理员", "系统管理员", "公司高层","财务管理员", "项目管理员"],
- status:null,
- statusTxt:["-","进行中","已完成","已撤销"],
- importanceList:[{id:1,label:'正常'},{id:2,label:'紧急'},{id:3,label:'重要'},{id:4,label:'重要且紧急'}],
- searchField:null,
- keyword:null,
- user: JSON.parse(sessionStorage.getItem("user")),
- permissions: JSON.parse(sessionStorage.getItem("permissions")),
- userDetailVisible: false,
- userDetail:{},
- date: new Date(),
- users: [],
- participator:[],
- tableHeight: 0,
- listLoading: false,
- total: 0,
- page: 1,
- size: 20,
- list: [],
- subProjectVisible: false,
- subProjectList: [],//子项目列表
- currentProject:{},
- addSubProject: false,
- addFormVisible: false,
- addLoading: false,
- addUp: 0, // 合计
- title: "",
- addForm: {
- name: '',
- userId: [],
- level:1,
- taskGpIncharge: 0,
- id: '',
- code: ''
- },
- temaddForm: {},
- rules: {
- name: [{ required: true, message: "请输入名称", trigger: "blur" }]
- },
- ause: [],
- auseList: [],
- yonghuUser: [],
- filterText: '',
- showClfDialog: false,
- addClfDialog:false,
- addClf:{name:'',id:''},
- statusClf:null,
- permissionsObj: {},
- };
- },
- // 过滤器
- filters: {
- numberToCurrency(value) {
- if (!value) return '0.00'
- // 将数值截取,保留两位小数
- value = value.toFixed(2)
- // 获取整数部分
- const intPart = Math.trunc(value)
- // 整数部分处理,增加,
- const intPartFormat = intPart.toString().replace(/(\d)(?=(?:\d{3})+$)/g, '$1,')
- // 预定义小数部分
- let floatPart = '.00'
- // 将数值截取为小数部分和整数部分
- const valueArray = value.toString().split('.')
- if (valueArray.length === 2) { // 有小数部分
- floatPart = valueArray[1].toString() // 取得小数部分
- return intPartFormat + '.' + floatPart
- }
- return intPartFormat + floatPart
- },
- },
- watch: {
- filterText(val) {
- this.$refs.chooseMembTree.filter(val);
- }
- },
- methods: {
- filterNode(value, data) {
- if (!value) return true;
- return data.label.indexOf(value) !== -1;
- },
- //重启项目
- restartPro(row) {
- this.http.post('/project/start',{id: row.id},
- res => {
- if (res.code == "ok") {
- this.$message({
- message: '重启成功',
- type: "success"
- });
- row.status = 1;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //撤销项目
- cancelPro(row) {
- this.http.post('/project/cancel',{id: row.id},
- res => {
- if (res.code == "ok") {
- this.$message({
- message: '撤销成功',
- type: "success"
- });
- row.status = 3;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //完成项目
- finishPro(row) {
- this.http.post('/project/finish',{id: row.id},
- res => {
- if (res.code == "ok") {
- this.$message({
- message: '项目完成',
- type: "success"
- });
- row.status = 2;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- exportProjectData() {
- //导出项目
- this.http.post('/project/exportData',{},
- res => {
- if (res.code == "ok") {
- var filePath = res.data;
- const a = document.createElement('a'); // 创建a标签
- a.setAttribute('download', '项目导出.xls');// download属性
- a.setAttribute('href', filePath);// href链接
- a.click(); //自执行点击事件
- a.remove();
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- userssHu() {
- this.http.post('/time-type/getCompanyTimeSetting',{
- companyId: this.user.companyId
- },
- res => {
- if (res.code == "ok") {
- this.yonghuUser = res.data
- console.log(this.yonghuUser)
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- yanjiuzx() {
- this.http.post('/report-extra-degree/getAll ',{},
- res => {
- if (res.code == "ok") {
- console.log(res, '过来的数据')
- this.ause = res.data
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- selectPublic() {
- if (this.addForm.isPublic == 1) {
- this.participator = this.users;
- } else {
- this.participator = [];
- }
- },
- addPpMemb() {
- //检查合计比例是否到达100%
- let p = 0;
- let hasNoMemb = false;
- this.curProfessionRow.membList.forEach(m=>{
- p += parseInt(m.percentage);
- //检查人员是否选择
- if (m.membId == null) {
- hasNoMemb = true;
- }
- });
- if (hasNoMemb) {
- this.$message({
- message: '专业人员不能为空',
- type: "error"
- });
- return;
- }
- //检查人员不能重复
- let hasDuplicate = false;
- this.curProfessionRow.membList.forEach(m=>{
- if (this.curProfessionRow.membList.filter(innerM=>innerM.membId == m.membId).length>1) {
- hasDuplicate = true;
- }
- });
- if (hasDuplicate) {
- this.$message({
- message: '专业人员不能重复',
- type: "error"
- });
- return;
- }
- if (p != 100) {
- this.$message({
- message: '占比合计必须是100%',
- type: "error"
- });
- return;
- }
-
- this.editPpMembDialog = false;
- this.curProfessionRow.membList.forEach(m=>{
- m.membName = this.participator.filter(p=>p.id == m.membId)[0].name;
- });
- this.projectProfessionItem.membList = JSON.parse(JSON.stringify(this.curProfessionRow.membList));
- },
- //删除专业人员
- deleteMembItem(index) {
- this.curProfessionRow.membList.splice(index,1);
- },
- //添加专业人员
- addMembItem() {
- if (this.curProfessionRow.membList == null) {
- this.curProfessionRow.membList = [{membId:null, percentage:100}];
- } else {
- let p = 0;
- this.curProfessionRow.membList.forEach(m=>{
- p += parseInt(m.percentage);
- });
- this.curProfessionRow.membList.push({membId:null, percentage:100-p});
- }
- this.$forceUpdate();
- },
- showEditPpMembs(row) {
- this.projectProfessionItem = row;
- this.curProfessionRow = JSON.parse(JSON.stringify(row));
- if (this.curProfessionRow.membList == null || this.curProfessionRow.membList.length == 0) {
- this.curProfessionRow.membList = [{membId:null, percentage:100}];
- }
- this.editPpMembDialog = true;
- },
- getProjectNotifyUserList(projectId) {
- this.http.post("/project-notify-user/get", {projectId: projectId},
- res => {
- if (res.code == "ok") {
- var chosenLeaderIds = [];
- var chosenLeaderNames = '';
- var leaderList = res.data;
- this.chosenLeaders = leaderList;
- for(var j in leaderList) {
- chosenLeaderIds.push(leaderList[j].userId)
- chosenLeaderNames += leaderList[j].userName+',';
- }
- if (chosenLeaderNames.length > 0) {
- chosenLeaderNames = chosenLeaderNames.substring(0, chosenLeaderNames.length -1);
- }
- this.addForm.notifyUserIds = chosenLeaderIds;
- this.addForm.notifyUserNames = chosenLeaderNames;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- getProjectProfessions(projectId) {
- this.http.post("/project-profession/get", {projectId: projectId},
- res => {
- if (res.code == "ok") {
- this.projectProfessionList = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- checkProjectProfession() {
- //检查合计比例是否到达100%
- let p = 0;
- let hasNoMemb = false;
- let hasNoProfession = false;
- let hasNoMembList = false;
- this.projectProfessionList.forEach(m=>{
- p += parseInt(m.percentage);
- //检查人员是否选择
- if (m.inchargerId == null) {
- hasNoMemb = true;
- }
- if (m.professionId == null) {
- hasNoProfession = true;
- }
- if (m.membList == null) {
- hasNoMembList = true;
- }
- });
-
- if (hasNoProfession) {
- this.$message({
- message: '专业不能为空',
- type: "error"
- });
- return false;
- }
- if (hasNoMembList) {
- this.$message({
- message: '专业相关人员不能为空',
- type: "error"
- });
- return false;
- }
- if (hasNoMemb) {
- this.$message({
- message: '专业负责人不能为空',
- type: "error"
- });
- return false;
- }
- //检查专业不能重复
- let hasDuplicate = false;
- this.projectProfessionList.forEach(m=>{
- if (this.projectProfessionList.filter(innerM=>innerM.professionId == m.professionId).length>1) {
- hasDuplicate = true;
- }
- });
- if (hasDuplicate) {
- this.$message({
- message: '专业不能重复',
- type: "error"
- });
- return false;
- }
- if (this.projectProfessionList.length > 0 && p != 100) {
- this.$message({
- message: '专业占比合计必须是100%',
- type: "error"
- });
- return false;
- }
- return true;
- },
- //保存项目专业
- saveProjectProfessions(projectId) {
- var list = this.projectProfessionList.filter(p=>p.professionId != null);
- list.forEach(p=>p.inchargerName = this.participator.filter(m=>m.id == p.inchargerId)[0].name);
- list.forEach(p=>p.professionName = this.professionList.filter(m=>m.id == p.professionId)[0].name);
- this.http.post("/project-profession/modify", {projectId: projectId, json: JSON.stringify(list)},
- res => {
- if (res.code == "ok") {
-
- return false;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //删除项目专业
- deleteItem(index) {
- this.projectProfessionList.splice(index,1);
- },
- //添加项目专业
- addItem() {
- let p = 0;
- this.projectProfessionList.forEach(m=>{
- p += parseInt(m.percentage);
- });
- this.projectProfessionList.push( { professionId:null, inchargerId:null,membIds:[], percentage: 100-p});
- },
- getProfessionList() {
- this.http.post("/profession/getAll", {},
- res => {
- if (res.code == "ok") {
- var list = res.data;
- this.professionList = list;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- restrictNumber(targetId) {
- let inpu = document.getElementById(targetId);
- inpu.value = inpu.value.replace(/[^\d.]/g, ""); //仅保留数字和"."
- inpu.value = inpu.value.replace(/\.{2,}/g, "."); //两个连续的"."仅保留第一个"."
- inpu.value = inpu.value.replace(".", "$#*").replace(/\./g,'').replace('$#*','.');//去除其他"."
- inpu.value = inpu.value.replace(/^(\d+)\.(\d\d).*$/, '$1.$2');;//限制只能输入两个小数
- if (inpu.value.indexOf(".") < 0 && inpu.value != "") { //首位是0的话去掉
- inpu.value = parseFloat(inpu.value);
- }
- },
- showChooseLeaderTree() {
- this.chosenMembCount = this.chosenLeaders.length;
- this.chooseLeaderVisible = true;
- },
- onLeaderTreeItemChange() {
- var chosenList = this.$refs.chooseLeaderTree.getCheckedNodes();
- var list = chosenList.filter(item=>item.isUser == 1);
- this.chosenMembCount = list.length;
- },
- showChooseMembTree() {
- this.chosenMembCount = this.participator.length;
- this.chooseParticipVisible = true;
- },
- onTreeItemChange() {
- var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
- var list = chosenList.filter(item=>item.isUser == 1);
- this.chosenMembCount = list.length;
- },
- findUserInTree() {
- if (this.filterName == '') {
- this.deptMembData = this.allMembData;
- } else {
- var list = this.findRecursively(this.filterName, this.allMembData);
- this.deptMembData = list;
- }
- },
- findRecursively(username, list) {
- var filterList = [];
- for (var i=0;i<list.length; i++) {
- if (list[i].isUser == 1) {
- if (list[i].label.indexOf(username) >= 0) {
- //匹配上了
- filterList.push(list[i]);
- }
- } else if (list[i].children != null && list[i].children.length > 0) {
- var subList = this.findRecursively(username, list[i].children);
- if (subList.length > 0) {
- subList.forEach(s=>filterList.push(s));
- }
- }
- }
- return filterList;
- },
- //确定选择参与人
- chooseParticip() {
- this.chooseParticipVisible = false;
- var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
- this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
- this.addForm.userNames = '';
- this.addForm.userId = [];
- this.participator = [];
- for (var i=0;i<this.chosenMembList.length; i++) {
- this.addForm.userId.push(this.chosenMembList[i].id);
- this.addForm.userNames += this.chosenMembList[i].label+',';
- var item = {id:this.chosenMembList[i].id, name:this.chosenMembList[i].label};
- this.participator.push(item);
- }
- if (this.addForm.userNames.length > 0) {
- this.addForm.userNames = this.addForm.userNames.substring(0, this.addForm.userNames.length-1);
- }
- },
- //选中相关领导
- chooseLeader() {
- this.chooseLeaderVisible = false;
- var chosenList = this.$refs.chooseLeaderTree.getCheckedNodes();
- var chosenMembList = chosenList.filter(item=>item.isUser == 1);
- this.addForm.notifyUserNames = '';
- this.addForm.notifyUserIds = [];
- this.chosenLeaders = [];
- for (var i=0;i<chosenMembList.length; i++) {
- this.addForm.notifyUserIds.push(chosenMembList[i].id);
- this.addForm.notifyUserNames += chosenMembList[i].label+',';
- var item = {userId:chosenMembList[i].id, userName:chosenMembList[i].label};
- this.chosenLeaders.push(item);
- }
- if (this.addForm.notifyUserNames.length > 0) {
- this.addForm.notifyUserNames = this.addForm.notifyUserNames.substring(0, this.addForm.notifyUserNames.length-1);
- }
- },
- // 获取部门列表
- getDepartment() {
- this.http.post("/department/listAllMemb", {},
- res => {
- if (res.code == "ok") {
- var list = res.data;
- //设置员工到部门下面
- this.setUserToDept(list);
- this.deptMembData = list;
- //用于筛选过滤
- this.allMembData = JSON.parse(JSON.stringify(this.deptMembData));
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
-
- setUserToDept(list) {
- for (var i in list) {
- if (list[i].children != null) {
- this.setUserToDept(list[i].children);
- }
-
- if (list[i].userList != null) {
- if (list[i].children == null) {
- list[i].children = [];
- }
- list[i].userList.forEach(element => {
- var obj = {id: element.id, label:element.name, parentId:element.departmentId, isUser:1};
- list[i].children.push(obj);
- });
- }
- }
- },
- // 获取分类条目
- getClfConfigList() {
- this.http.get('/project-category/list',
- res => {
- if (res.code == "ok") {
- this.baseClfList = res.data;
- console.log("获取分类条目",res.data);
- this.$forceUpdate();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
-
- },
- // 新增/编辑 分类条目
- addNewClf(row) {
- this.addClfDialog = true;
- if (row == null) {
- this.addClf = {}
- } else {
- this.addClf = row;
- }
- },
- // 提交
- submitClf() {
- this.http.post('/project-category/addOrMod',this.addClf,
- res => {
- if (res.code == "ok") {
- this.addClfDialog = false;
- this.baseClfList = res.data;
- // this.$forceUpdate();
- console.log(res.data);
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- // 删除
- deleteClf(row) {
- this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除分类条目", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.listLoading = true;
- this.http.post('/project-category/delete',{
- id: row.id
- },
- res => {
- this.listLoading = false;
- if (res.code == "ok") {
- this.$message({
- message: "删除成功",
- type: "success"
- });
- this.getClfConfigList();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- })
- .catch(() => {});
- },
- // 分类筛选
- searchClfList(){
- this.page = 1;
- this.getList();
- },
-
- getProjectBaseConfigList() {
- this.http.post('/project-basecost-setting/list',{},
- res => {
- if (res.code == "ok") {
- this.baseCostItemList = res.data;
- this.$forceUpdate();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
-
- },
- deleteBaseItem(row) {
- this.$confirm("该操作可能造成已有数据丢失,确定要删除吗?","删除成本基线项", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.listLoading = true;
- this.http.post('/project-basecost-setting/delete',{
- id: row.id
- },
- res => {
- this.listLoading = false;
- if (res.code == "ok") {
- this.$message({
- message: "删除成功",
- type: "success"
- });
- this.getProjectBaseConfigList();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- })
- .catch(() => {});
- },
- submitInsertBaseItem() {
- this.http.post('/project-basecost-setting/addOrMod',this.addForm,
- res => {
- if (res.code == "ok") {
- this.addBaseItemDialog = false;
- this.baseCostItemList = res.data;
- this.$forceUpdate();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- showBaseCostItemDialog() {
- this.showBaseConfig = true;
- },
- addNewBaseItem(row) {
- this.addBaseItemDialog = true;
- if (row == null) {
- this.addForm = {}
- } else {
- this.addForm = row;
- }
- },
- //获取客户列表
- getCustomerList() {
- this.http.post('/customer-info/getAll', {
- },
- res => {
- if (res.code == "ok") {
- this.customerList = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- importProject(item) {
- //首先判断文件类型
- let str = item.file.name.split(".");
- let format = str[str.length - 1];
- if (format != "xls" && format != "xlsx") {
- this.$message({
- message: "请选择.xls或.xlsx文件",
- type: "error"
- });
- } else {
- this.listLoading = true;
- let formData = new FormData();
- formData.append("file", item.file);
- formData.append("userId", this.user.id);
- this.http.uploadFile('/project/importData', formData,
- res => {
- this.$refs.upload.clearFiles();
- this.listLoading = false;
- if (res.code == "ok") {
- this.$message({
- message: "导入成功",
- type: "success"
- });
- this.getList();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$refs.upload.clearFiles();
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- }
- },
- number(){
- // this.addForm.budget = this.addForm.budget.replace(/[^\.\d]/g,'');
- // this.addForm.budget = this.addForm.budget.replace('.','');
- },
- deleteSubPro(subProject) {
- this.$confirm("确定要删除子项目" + subProject.name + "吗?","删除子项目", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.listLoading = true;
- this.http.post('/sub-project/deleteProject',{
- id: subProject.id
- },
- res => {
- this.listLoading = false;
- if (res.code == "ok") {
- this.$message({
- message: "删除成功",
- type: "success"
- });
- this.subProject(this.currentProject);
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- })
- .catch(() => {});
- },
- searchList() {
- this.page = 1;
- this.getList();
- },
- addNewSubProject(subProject) {
- if (subProject == null) {
- this.temaddForm = {projectId: this.currentProject.id, level:1}
- } else {
- this.temaddForm = JSON.parse(JSON.stringify(subProject));
- }
- this.addSubProject = true;
- },
- //显示子项目
- subProject(item) {
- this.subProjectVisible = true;
- this.currentProject = item;
- this.http.post('/sub-project/list', {
- projectId: item.id
- },
- res => {
- if (res.code == "ok") {
- this.subProjectList = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //显示用户详情
- showUser(userId) {
- this.userDetailVisible = true;
- this.http.post(this.port.manage.userDetail, {
- userId: userId
- },
- res => {
- if (res.code == "ok") {
- this.userDetail = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //选择参与人
- changeParticipator() {
- //检查是否在参与人中,如果没有需要加入到参与人中
- this.participator = [];
- this.addForm.userId.forEach(u=>{
- var list = this.users.filter(au=>au.id == u);
- if (list.length > 0) {
- var findUser = list[0];
- this.participator.push(findUser);
- } else {
- console.log('未找到用户: '+u);
- }
-
- })
- },
- getUsers() {
- this.http.post(this.port.manage.list, {
- departmentId: -1,
- pageIndex: 1,
- pageSize: 99999
- },
- res => {
- if (res.code == "ok") {
- this.users = res.data.records;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //分页
- handleCurrentChange(val) {
- this.page = val;
- this.getList();
- },
- handleSizeChange(val) {
- this.size = val;
- this.getList();
- },
- //获取项目列表
- getList() {
- this.listLoading = true;
- this.http.post(this.port.project.listPage, {
- pageIndex: this.page,
- pageSize: this.size,
- keyword:this.keyword,
- searchField: this.searchField,
- status: this.status,
- category: this.statusClf
- //
- },
- res => {
- this.listLoading = false;
- if (res.code == "ok") {
- var list = res.data.records;
- for(var i in list) {
- var participator = list[i].participator , str = "";
- for(var j in participator) {
- if(j == participator.length-1) {
- str += participator[j].name
- } else {
- str += participator[j].name + ','
- }
- }
- list[i].userNames = str;
- }
- this.list = list;
- this.total = res.data.total;
- console.log("列表",res.data);
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //显示新增界面
- handleAdd(i, item) {
- if(i == -1) {
- this.title = "新增项目";
- this.addForm = {
- name: '',
- isPublic:0,
- userId: [],
- userNames:'',
- code:'',
- inchargerId:null,
- level:1,
- customerId:null,
- notifyUserNames:'',
- chosenLeaders:[],
- taskGpIncharge: 0,
- category:null
- }
- this.projectBaseCostData = [];
- this.auseList = [];
- for (var m=0;m<this.baseCostItemList.length; m++) {
- this.projectBaseCostData.push({baseId: this.baseCostItemList[m].id, baseName:this.baseCostItemList[m].name, baseAmount:0});
- }
- } else {
- this.title = "修改项目";
- var list = item.participator;
- if (item.isPublic == 1) {
- list = this.users;
- }
- var arr = [];
- var names = '';
- for(var j in list) {
- arr.push(list[j].id)
- names += list[j].name+',';
- }
- if (names.length > 0) {
- names = names.substring(0, names.length -1);
- }
-
- this.addForm = {
- id: item.id,
- name: item.projectName,
- isPublic: item.isPublic,
- userId: arr,
- userNames:names,
- code:item.projectCode,
- inchargerId: item.inchargerId,
- level: item.level,
- planStartDate: item.planStartDate,
- planEndDate: item.planEndDate,
- budget: item.budget,
- baseMan: item.baseMan,
- contractAmount: item.contractAmount,
- baseFee: item.baseFee,
- baseRisk1: item.baseRisk1,
- baseRisk2: item.baseRisk2,
- baseOutsourcing: item.baseOutsourcing,
- customerId:item.customerId==0?null:item.customerId,
- taskGpIncharge: item.taskGpIncharge,
- category:item.category
- }
- console.log("handleadd",item)
- if(item.associateDegrees != null && item.associateDegrees != 'null' && item.associateDegrees != '') {
- var spli = item.associateDegrees.split(',')
- var sl = []
- for(var i in spli) {
- var num = +spli[i] + 0
- sl.push(num)
- }
- this.auseList = sl
- console.log(this.auseList)
- } else {
- this.auseList = []
- }
- // var spli = item.associateDegrees.split(',')
- // var sl = []
- // for(var i in spli) {
- // var num = +spli[i] + 0
- // sl.push(num)
- // }
- // this.auseList = sl
- // console.log(this.auseList)
- this.changeParticipator();
- this.getProjectBaseData(item.id);
- if (this.user.company.packageEngineering == 1) {
- this.getProjectProfessions(item.id);
-
- }
- //获取项目的相关领导
- this.getProjectNotifyUserList(item.id);
- this.getProjectAutorList(item.id);
- }
- this.addFormVisible = true;
- if (this.user.company.packageEngineering == 1) {
- if (this.professionList.length == 0) {
- this.getProfessionList();
- }
- }
- },
- //获取项目审核人
- getProjectAutorList(projectId) {
- this.http.post('/project-auditor/getList',{projectId: projectId},
- res => {
- if (res.code == "ok") {
- this.addForm.auditUserIds = res.data.map(function(item) {
- return item.auditorId;
- });
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- getProjectBaseData(projectId) {
- this.http.post('/project-basecost/get',{projectId: projectId},
- res => {
- if (res.code == "ok") {
- this.projectBaseCostData = res.data;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- //提交子项目创建修改请求
- submitInsertSubProject () {
- this.$refs.form2.validate(valid => {
- if (valid) {
- this.http.post('/sub-project/saveOrUpdate',this.temaddForm,
- res => {
- if (res.code == "ok") {
- this.$message({
- message: "操作成功",
- type: "success"
- });
- this.subProject(this.currentProject);
- this.addSubProject = false;
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- }
- });
- },
- // 项目基线合计
- addUpfun() {
- var total = 0;
- for (var i=0;i<this.projectBaseCostData.length; i++) {
- total += parseFloat(this.projectBaseCostData[i].baseAmount);
- }
- this.addForm.budget = total;
- // var a = '0'
- // var q = '0'
- // var w = '0'
- // var e = '0'
- // var r = '0'
- // // this.addForm.baseMan === undefined || this.addForm.baseMan === NaN ? this.addForm.baseMa = '0' : this.addForm.baseMan
- // if (this.addForm.baseMan == undefined || this.addForm.baseMan == NaN) {
- // a = 0
- // } else {
- // a = this.addForm.baseMan
- // }
- // if (this.addForm.baseFee !== undefined) q = this.addForm.baseFee
- // if (this.addForm.baseOutsourcing !== undefined) w = this.addForm.baseOutsourcing
- // if (this.addForm.baseRisk1 !== undefined) e = this.addForm.baseRisk1
- // if (this.addForm.baseRisk2 !== undefined) r = this.addForm.baseRisk2
- // this.addForm.budget = +a + +q + +w + +e + +r
- },
- submitInsert() {
- this.$refs.form1.validate(valid => {
- if (valid) {
- if (this.user.company.packageEngineering == 1) {
- if (!this.checkProjectProfession()) {//检查不通过,直接返回
- return;
- }
- }
- this.addLoading = true;
- let formData = new FormData();
- formData.append("name", this.addForm.name);
- if(this.addForm.id != null) {
- formData.append("id", this.addForm.id);
- }
- if(this.addForm.isPublic != null) {
- formData.append("isPublic", this.addForm.isPublic);
- }
- if(this.addForm.userId.length != 0 && this.addForm.isPublic == 0) {
- for(var j in this.addForm.userId) {
- formData.append("userId", this.addForm.userId[j]);
- }
- }
- if(this.addForm.inchargerId != null) {
- formData.append("inchargerId", this.addForm.inchargerId);
- }
- if(this.addForm.code != null) {
- formData.append("code", this.addForm.code);
- }
- if(this.addForm.planStartDate != null) {
- formData.append("planStartDate", this.addForm.planStartDate);
- }
- if(this.addForm.planEndDate != null) {
- formData.append("planEndDate", this.addForm.planEndDate);
- }
- if(this.addForm.level != null) {
- formData.append("level", this.addForm.level);
- }
- if(this.addForm.contractAmount != null) {
- formData.append("contractAmount", this.addForm.contractAmount);
- }
- if (this.projectBaseCostData != null) {
- formData.append("projectBaseCostData", JSON.stringify(this.projectBaseCostData));
- //计算总预算成本
- if (this.addForm.budget == null) {
- this.addForm.budget = 0;
- }
- formData.append("budget", this.addForm.budget);
- }
- if (this.addForm.customerId == null) {
- formData.append("customerId", 0);
- } else {
- formData.append("customerId", this.addForm.customerId);
- }
- if (this.chosenLeaders != null && this.chosenLeaders.length > 0) {
- formData.append("chosenLeaders", JSON.stringify(this.chosenLeaders));
- }
- var listId = []
- var listName = []
- for(var i in this.auseList) {
- for(var j in this.ause) {
- if(this.auseList[i] == this.ause[j].id) {
- listId.push(this.ause[j].id);
- listName.push(this.ause[j].name);
- break;
- }
- }
- }
- listId.toString()
- listName.toString()
- formData.append("associateDegrees", listId)
- formData.append("associateDegreeNames", listName)
- formData.append("taskGpIncharge", this.addForm.taskGpIncharge)
- //日报审核人
- formData.append("auditUserIds", JSON.stringify(this.addForm.auditUserIds));
- if(this.addForm.category != null) {
- formData.append("category", this.addForm.category);
- }
- // formData.append("associateDegreeNames", listName)
- // console.log("addform",formData);
- // return
- this.http.uploadFile(this.port.project.add,formData,
- res => {
- this.addLoading = false;
- if (res.code == "ok") {
- this.$message({
- message: (this.addForm.id!=null?'修改':'创建')+"成功",
- type: "success"
- });
- this.addFormVisible = false;
- this.getList();
- if (this.user.company.packageEngineering == 1) {
- this.saveProjectProfessions(res.data);
- }
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.addLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- }
- });
- },
- // 删除
- deletePro(i, item) {
- this.$confirm("确定要删除项目[" + item.projectName + "]吗?","删除项目", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.listLoading = true;
- this.http.post(this.port.project.delete,{
- id: item.id
- },
- res => {
- this.listLoading = false;
- if (res.code == "ok") {
- this.$message({
- message: "删除成功",
- type: "success"
- });
- this.getList();
- } else if (res.code == 'reconfirm') {
- this.deleteAlertMsg = res.msg;
- this.forceDeletePro(item.id);
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- })
- .catch(() => {});
- },
- //强制删除项目
- forceDeletePro(deleteProId) {
- this.$confirm(this.deleteAlertMsg,"删除项目", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- })
- .then(() => {
- this.listLoading = true;
- this.http.post(this.port.project.delete,{
- id: deleteProId ,force:1
- },
- res => {
- this.listLoading = false;
- if (res.code == "ok") {
- this.$message({
- message: "删除成功",
- type: "success"
- });
- this.getList();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- })
- .catch(() => {});
- },
- detail(i) {
- this.$router.push("/list/" + this.list[i].id + "/" + this.list[i].projectName);
- }
- },
- created() {
- let height = window.innerHeight;
- this.tableHeight = height - 195;
- const that = this;
- window.onresize = function temp() {
- that.tableHeight = window.innerHeight - 195;
- };
- },
- mounted() {
- this.userssHu()
- this.getDepartment();
- this.getList();
- this.getUsers();
- this.getCustomerList();
- this.getProjectBaseConfigList();
- this.getClfConfigList()
- this.yanjiuzx()
- }
- };
- </script>
- <style lang="scss" scoped>
- .rg_span{
- display: inline-block;
- }
- .rg_span span {
- text-align: right;
- box-sizing: border-box;
- padding-right: 10px;
- }
- .el-dialog__title {
- display: inline-table;
- margin-top: 20px;
- }
- .addss {
- width: 100%;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- // 111
- </style>
- <style>
- .customdropdown .el-dropdown__caret-button{
- height: 27px;
- }
- .customdropdown .el-button--mini:nth-child(1){
- height: 27px;
- }
- .customdropdown_menu{
- padding: 0;
- }
- .customdropdown_menu_btn{
- border-color: transparent;
- }
- .ganttdialog .el-dialog__body{
- height: 880px;
- }
- .toolbar_formitem_n1{
- margin-right: 0 !important;
- }
- </style>
|