123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581 |
- <template>
- <section>
- <!--工具条-->
- <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
- <el-form :inline="true">
- <!-- <el-form-item label="财务核算成本 | 月份选择" style="margin-top:5px;"> -->
- <el-form-item label="月份选择" >
- <el-date-picker size="small" v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM" @change="changeMonth" :clearable="false" type="month" placeholder="选择月份" style="margin-right: 20px"></el-date-picker>
- <el-link type="primary" :underline="false" @click="audits()" v-if="user.timeType.financeAudit == '1'">{{revaelse}}</el-link>
- </el-form-item>
- <!-- <el-radio-group v-model="radio" @change="switchList" style="margin-left:160px;margin-top:5px;"> -->
- <el-radio-group size="small" v-model="radio" @change="switchList" style="margin-left:150px;margin-top:5px;">
- <el-radio-button label="全部人员" >全部人员({{allFinanceList.length}})</el-radio-button>
- <el-radio-button label="无项目工时人员">无项目工时人员({{noReportUserList.length}})</el-radio-button>
- </el-radio-group>
- <el-form-item v-if="permissions.financialProportion" style="margin-left:5px;">
- <el-link type="primary" :underline="false" @click="showSettingDialog()" >分摊比例设置</el-link>
- </el-form-item>
- <el-form-item style="float:right;" v-if="permissions.financialUpload">
- <el-link type="primary" :underline="false" @click="getTemplate()" >模板下载</el-link>
- </el-form-item>
- <!-- <el-form-item style="float:right;">
- <el-upload ref="upload" action="#" :limit="1" :http-request="importFinance" :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="permissions.financialUpload">
- <el-link type="primary" :underline="false" @click="importDialog = true;isUploading=false;">数据上传</el-link>
- </el-form-item>
- <el-form-item style="float:right;" v-if="permissions.financialExport">
- <el-link type="primary" :underline="false" @click="exportDialog = true;exportMonth = date;">数据导出</el-link>
- </el-form-item>
- <el-form-item style="float:right;" v-if="permissions.financialCustom">
- <el-link type="primary" :underline="false" @click="showItemDialog()">自定义薪资项</el-link>
- </el-form-item>
- <el-form-item style="float:right;" v-if="user.timeType.financeAudit == '1' && permissions.setFinanceAuditor">
- <el-link type="primary" :underline="false" @click="reviewerVisible = true">设置审核人</el-link>
- </el-form-item>
-
- </el-form>
- </el-col>
- <!-- 上传记录 -->
- <el-dialog title="薪资上传记录" :visible.sync="xzImportVisible" width="1100px" :before-close="handleClose">
- <div>
- <el-table :data="xzList" style="width: 100%" :height="400">
- <el-table-column prop="userName" label="操作人"></el-table-column>
- <el-table-column prop="ymonth" label="所属月份"></el-table-column>
- <el-table-column prop="fileName" label="文件名">
- <template slot-scope="scope">
- <div>
- <el-link type="primary" @click="downloadByA({name:scope.row.fileName,url:scope.row.serverName})"> {{scope.row.fileName}}</el-link>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="recoverReport" label="是否覆盖日报成本" width="150">
- <template slot-scope="scope">
- <div>
- {{scope.row.recoverReport == 1? '是' : '否'}}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="recoverMonthcost" label="是否覆盖人员月成本" width="150">
- <template slot-scope="scope">
- <div>
- {{scope.row.recoverMonthcost == 1? '是' : '否'}}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="indate" label="上传时间"></el-table-column>
- <!-- <el-table-column prop="date" label="操作" v-if="(tabPosition == 1 || tabPosition == 0) && (reviewerRuleForm.auditorId == user.id || user.role == 1 || user.role == 2)">
- <template slot-scope="scope">
- <div>
- <el-button type="primary" size="small" v-if="tabPosition == 0" @click="operationList(0, scope.row.id)">通过</el-button>
- <el-button type="warning" size="small" v-if="tabPosition == 0" @click="operationList(1, scope.row.id)">驳回</el-button>
- <el-button type="warning" size="small" v-if="tabPosition == 1" @click="operationList(2, scope.row.id)">撤销</el-button>
- </div>
- </template>
- </el-table-column> -->
- </el-table>
- </div>
- </el-dialog>
- <!-- 财务报表审核 -->
- <el-dialog :title="shenhe" :visible.sync="importVisible" width="1100px" :before-close="handleClose">
- <div>
- <el-radio-group v-model="tabPosition" style="margin-bottom: 20px;" @change="operationalData()">
- <el-radio-button label="1">已通过</el-radio-button>
- <el-radio-button label="0">待审核</el-radio-button>
- <el-radio-button label="2">已驳回</el-radio-button>
- <el-radio-button label="-1">已撤销</el-radio-button>
- </el-radio-group>
-
- <el-table :data="reviewLis" style="width: 100%" :height="400">
- <el-table-column prop="userName" label="操作人"></el-table-column>
- <el-table-column prop="ymonth" label="所属月份"></el-table-column>
- <el-table-column prop="fileName" label="文件名">
- <template slot-scope="scope">
- <div>
- <el-link type="primary" @click="downloadByA({name:scope.row.fileName,url:scope.row.serverName})"> {{scope.row.fileName}}</el-link>
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="recoverReport" label="是否覆盖日报成本" width="150">
- <template slot-scope="scope">
- <div>
- {{scope.row.recoverReport == 1? '是' : '否'}}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="recoverMonthcost" label="是否覆盖人员月成本" width="150">
- <template slot-scope="scope">
- <div>
- {{scope.row.recoverMonthcost == 1? '是' : '否'}}
- </div>
- </template>
- </el-table-column>
- <el-table-column prop="indate" label="上传时间"></el-table-column>
- <el-table-column prop="date" label="操作" v-if="(tabPosition == 1 || tabPosition == 0) && (reviewerRuleForm.auditorId == user.id)">
- <template slot-scope="scope">
- <div>
- <el-button type="primary" size="small" v-if="tabPosition == 0" @click="operationList(0, scope.row.id)">通过</el-button>
- <el-button type="warning" size="small" v-if="tabPosition == 0" @click="operationList(1, scope.row.id)">驳回</el-button>
- <el-button type="warning" size="small" v-if="tabPosition == 1" @click="operationList(2, scope.row.id)">撤销</el-button>
- </div>
- </template>
- </el-table-column>
- </el-table>
- </div>
- </el-dialog>
- <!-- 设置审核人弹窗 -->
- <el-dialog title="设置审核人" :visible.sync="reviewerVisible" width="350px" :before-close="handleCloses">
- <el-form :model="reviewerRuleForm" ref="reviewerRuleForm" label-width="100px" class="demo-ruleForm">
- <el-form-item label="选择审核人" prop="auditorId" :rules="{required: true, message: '审核人不能为空', trigger: 'blur'}">
- <el-select v-model="reviewerRuleForm.auditorId" clearable placeholder="请选择审核人" >
- <el-option v-for="(item, index) in people" :key="index" :label="item.name" :value="item.id"></el-option>
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="submitreviewerRuleForm('reviewerRuleForm')">提交</el-button>
- </el-form-item>
- </el-form>
- </el-dialog>
- <el-dialog title="财务数据导出" v-if="exportDialog" :visible.sync="exportDialog" :close-on-click-modal="false" customClass="customWidth" width="400px">
- <el-form ref="form3" >
- <el-form-item label="导出月份" >
- <!-- <div style="color:orange;">{{date}}</div> -->
- <el-date-picker v-model="exportMonth" type="month" placeholder="选择月份" format="yyyy-MM" value-format="yyyy-MM" style="width:280px;"></el-date-picker>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" style="width:100%;" :loading="isUploading" @click="exportFinance">导出</el-button>
- </div>
- </el-dialog>
-
- <!--列表-->
- <!-- 222 -->
- <el-table :data="list" highlight-current-row v-loading="listLoading"
- :show-summary='user.timeType.isSecretSalary==0?true:false'
- ref="table"
- :height="300" style="width: 100%;">
- <el-table-column prop="name" label="姓名" sortable width="150"></el-table-column>
- <el-table-column v-if="user.timeType.isSecretSalary==0" :prop="headerCols[index]" :label="item" sortable show-overflow-tooltip v-for="(item, index) in tblCols" :key="index" width="130px" align="center">
- </el-table-column>
- <el-table-column v-if="user.timeType.isSecretSalary==1" :label="item" sortable show-overflow-tooltip v-for="(item, index) in tblCols" :key="index" width="130px" align="center">
- <template slot-scope="scope" >
- *
- </template>
- </el-table-column>
- <el-table-column prop="totalCost" label="总成本">
- <template slot-scope="scope" >
- {{user.timeType.isSecretSalary==0?scope.row.totalCost:'*'}}
- </template>
- </el-table-column>
- </el-table>
-
- <el-form :inline="true" >
- <el-form-item >
- <!-- <el-checkbox style="margin-left:10px;" v-model="assignNoProUser" @click="assignToProject">均摊无项目人员成本</el-checkbox> -->
- <!-- <el-button type="primary" :underline="false" size="small" @click="assignNoProUser=false;assignToProject();" style="margin-left:10px;">分摊已填工时人员成本</el-button>
- <el-button type="primary" :underline="false" size="small" @click="assignNoProUser=true;assignToProject();" style="margin-left:10px;">分摊全部人员成本</el-button> -->
- <el-radio-group size="small" v-model="costListRadio" @change="switchCostList" style="margin-left:5px;margin-top:5px;">
- <el-radio-button label="1" >分摊已填工时人员成本</el-radio-button>
- <el-radio-button label="2">分摊全部人员成本</el-radio-button>
- </el-radio-group>
- </el-form-item>
- <el-form-item style="float:right;margin-right:20px;" v-if="permissions.financialShare">
- <el-link type="primary" :underline="false" @click="exportFinanceDialog=true">导出分摊数据</el-link>
- </el-form-item>
-
- <!-- <el-form-item style="float:right;margin-right:30px;" v-if="hasNoProjectUsers">
- <el-link type="primary" :underline="false" @click="showNoProjectUsers">查看无项目数据</el-link>
- </el-form-item> -->
- </el-form>
- <!-- 图表 -->
- <!-- <div id="container" :style="'height:300px;width:'+ widthHtval+'px;'"></div> -->
- <div id="clearfix" :style="'overflow-x: auto;width:100%;padding-bottom: 100px; position: relative; height:300px;'">
- <div id="container" :style="'height: 300px;width:100%;'"></div>
- </div>
- <!--新增界面-->
- <el-dialog :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth" width="600px">
- <el-form ref="form1" :model="addForm" :rules="rules" label-width="100px">
- <el-form-item label="项目编号" >
- <el-input v-model="addForm.code" placeholder="请输入项目编号" clearable></el-input>
- </el-form-item>
- <el-form-item label="项目名称" prop="name">
- <el-input v-model="addForm.name" placeholder="请输入项目名称" clearable></el-input>
- </el-form-item>
- <el-form-item label="全部参与者">
- <el-select v-model="addForm.userId" multiple filterable placeholder="请选择参与者" style="width:100%;" @change="changeParticipator">
- <el-option v-for="item in users" :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.inchargerId" :disabled="addForm.userId.length==0" filterable placeholder="请选择负责人" style="width:100%;" @change="changeIncharger">
- <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>
- <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>{{userDetail.departmentName}}</span></div>
- <div class="line"><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="财务数据导入" v-if="importDialog" :visible.sync="importDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
- <el-form ref="form3" :model="importParam" >
- <el-form-item label="导入月份" >
- <!-- <div style="color:orange;">{{date}}</div> -->
- <el-date-picker v-model="date" type="month" placeholder="选择月份" format="yyyy-MM" value-format="yyyy-MM"></el-date-picker>
- </el-form-item>
- <el-form-item prop="syncHistoryReport" >
- <el-checkbox label="重新计算该月已填日报成本" v-model="importParam.syncHistoryReport"></el-checkbox>
- </el-form-item>
- <el-form-item prop="syncUserCost" >
- <el-checkbox label="同步到组织架构中员工月薪成本" v-model="importParam.syncUserCost" ></el-checkbox>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-link v-if="user.timeType.financeAudit == '0'"
- style="float:left;"
- type="primary" :underline="false" @click="xzjl(),xzImportVisible = true">查看导入历史记录</el-link>
-
- <el-upload ref="upload" action="#" :limit="1" :http-request="importFinance" :show-file-list="false" >
- <el-button type="primary" style="width:100%;" :loading="isUploading" >选择文件并开始导入</el-button>
- </el-upload>
- </div>
- </el-dialog>
- <!--无项目人员列表-->
- <!-- <el-dialog title="无项目人员列表" v-if="showNPDialog" :visible.sync="showNPDialog" :close-on-click-modal="false" customClass="customWidth" width="1200px">
- <el-table :data="npUserList" highlight-current-row v-loading="listLoading"
- show-summary=true
- ref="table"
- :height="400" style="width: 100%;">
- <el-table-column prop="name" label="姓名" sortable width="150"></el-table-column>
- <el-table-column prop="monthCost" label="工资" width="150"></el-table-column>
- <el-table-column prop="bonus" label="奖金" ></el-table-column>
- <el-table-column prop="allowance" label="津贴" ></el-table-column>
- <el-table-column prop="insuranceOld" label="养老保险" ></el-table-column>
- <el-table-column prop="insuranceMedical" label="医疗保险" ></el-table-column>
- <el-table-column prop="insuranceLosejob" label="失业保险" ></el-table-column>
- <el-table-column prop="insuranceInjury" label="工伤保险" ></el-table-column>
- <el-table-column prop="houseFund" label="住房公积金" ></el-table-column>
- <el-table-column prop="others" label="其他" ></el-table-column>
- <el-table-column :label="item.fieldName" v-for="(item, index) in customCols" :key="item.id" :prop="index==0?'customField1':(index==1?'customField2':(index==2?'customField3':''))">
- <template slot-scope="scope">
- {{index==0?scope.row.customField1:(index==1?scope.row.customField2:(index==2?scope.row.customField3:''))}}
- </template>
- </el-table-column>
- <el-table-column prop="totalCost" label="总成本" ></el-table-column>
- </el-table>
- <div slot="footer" class="dialog-footer">
- <div style="float:left;color:#ff9900;">*以上人员当月尚无投入的项目,请提醒他们填写日报。</div>
- <el-button type="primary" @click="showNPDialog = false" >关闭</el-button>
- </div>
- </el-dialog> -->
- <el-dialog title="自定义薪资项" show-header="false" v-if="itemDialog" :visible.sync="itemDialog" :close-on-click-modal="false" customClass="customWidth" width="500px" top="20px">
- <div style="margin-left:30px;">
- <!-- 111 -->
- <p><el-input size="medium" v-model.trim="customCols.monthCost" placeholder="请输入自定义薪资项名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.monthCost != null && customCols.monthCost != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.monthCostCalculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.monthCostCalculate" :label="0">否</el-radio>
- </template>
- </p>
- <p><el-input size="medium" v-model.trim="customCols.bonus" placeholder="请输入自定义薪资项名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.bonus != null && customCols.bonus != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.bonusCalculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.bonusCalculate" :label="0">否</el-radio>
- </template>
- </p>
- <p><el-input size="medium" v-model.trim="customCols.allowance" placeholder="请输入自定义薪资项名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.allowance != null && customCols.allowance != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.allowanceCalculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.allowanceCalculate" :label="0">否</el-radio>
- </template>
- </p>
- <p><el-input size="medium" v-model.trim="customCols.insuranceOld" placeholder="请输入自定义薪资项名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.insuranceOld != null && customCols.insuranceOld != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.insuranceOldCalculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.insuranceOldCalculate" :label="0">否</el-radio>
- </template>
- </p>
- <p><el-input size="medium" v-model.trim="customCols.insuranceMedical" placeholder="请输入自定义薪资项名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.insuranceMedical != null && customCols.insuranceMedical != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.insuranceMedicalCalculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.insuranceMedicalCalculate" :label="0">否</el-radio>
- </template>
- </p>
- <p><el-input size="medium" v-model.trim="customCols.insuranceLosejob" placeholder="请输入自定义薪资项名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.insuranceLosejob != null && customCols.insuranceLosejob != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.insuranceLosejobCalculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.insuranceLosejobCalculate" :label="0">否</el-radio>
- </template>
- </p>
- <p><el-input size="medium" v-model.trim="customCols.insuranceInjury" placeholder="请输入自定义薪资项名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.insuranceInjury != null && customCols.insuranceInjury != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.insuranceInjuryCalculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.insuranceInjuryCalculate" :label="0">否</el-radio>
- </template>
- </p>
- <p><el-input size="medium" v-model.trim="customCols.houseFund" placeholder="请输入自定义薪资项名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.houseFund != null && customCols.houseFund != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.houseFundCalculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.houseFundCalculate" :label="0">否</el-radio>
- </template>
- </p>
- <p><el-input size="medium" v-model.trim="customCols.field1" placeholder="请输入自定义薪资项1名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.field1 != null && customCols.field1 != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.field1Calculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.field1Calculate" :label="0">否</el-radio>
- </template>
- </p>
- <p><el-input size="medium" v-model.trim="customCols.field2" placeholder="请输入自定义薪资项2名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.field2 != null && customCols.field2 != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.field2Calculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.field2Calculate" :label="0">否</el-radio>
- </template>
- </p>
- <p><el-input size="medium" v-model.trim="customCols.field3" placeholder="请输入自定义薪资项3名称" style="width:200px;margin-right:20px" maxlength="8"></el-input>
- <template v-if="customCols.field3 != null && customCols.field3 != ''">
- 计入总成本
- <el-radio size="medium" v-model="customCols.field3Calculate" :label="1" style="margin-right:10px;margin-left:10px">是</el-radio>
- <el-radio size="medium" v-model="customCols.field3Calculate" :label="0">否</el-radio>
- </template>
- </p>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="itemDialog = false" >关闭</el-button>
- <el-button type="primary" @click="saveItems()" >保存</el-button>
- </div>
- </el-dialog>
- <el-dialog :title="date+'月 无项目工时人员分摊比例设置'" show-header="false" v-if="settingDialog" :visible.sync="settingDialog"
- :close-on-click-modal="false" customClass="customWidth" width="1200px">
- <div>
- <div>
- <el-button :disabled="multipleSelection.length==0" @click="setPercent(true, null)">批量设置比例</el-button>
- <el-button :disabled="projectCols.length==0 || userCostSettingList.length == 0" @click="getLastMonthSetting">使用上月比例设置</el-button>
- <el-button @click="showSelectProjectDialog">管理待分摊项目</el-button>
- <el-button @click="intoAmortizationRatio">导入分摊比例</el-button>
- </div>
- <el-table :data="userCostSettingList" highlight-current-row v-loading="costSettingLoading"
- ref="settingTable" @selection-change="handleSelectionChange"
- :height="400" style="width: 100%;">
- <el-table-column type="selection" width="55"></el-table-column>
- <el-table-column prop="name" label="姓名" sortable width="90" fixed="left"></el-table-column>
-
- <el-table-column :label="item.projectName" v-for="(item) in projectCols" width="180" size="small"
- :key="item.id" align="center">
- <template slot-scope="scope">
- <span>{{scope.row[item.projectId]}}</span>%
- </template>
- </el-table-column>
- <el-table-column label="设置比例" width="80" fixed="right">
- <template slot-scope="scope">
- <el-button size="small" @click="setPercent(false,scope.row)">设置</el-button>
- </template>
- </el-table-column>
- </el-table>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="settingDialog = false" >关闭</el-button>
- <el-button type="primary" @click="saveMonthSetting()" >保存</el-button>
- </div>
- </el-dialog>
- <el-dialog title="待分摊项目选择" show-header="false" v-if="projectsDialog" :visible.sync="projectsDialog"
- :close-on-click-modal="false" customClass="customWidth" width="1000px">
- <el-select v-model="chosenProjects" multiple filterable clearable style="width:100%">
- <el-option v-for="item in allProjectList" :label="item.projectName" :key="item.id" :value="item.id"></el-option>
- </el-select>
- <div slot="footer" class="dialog-footer">
- <el-button type="default" @click="projectsDialog = false" >关闭</el-button>
- <el-button type="primary" @click="saveProjectSetting()" >确定</el-button>
- </div>
- </el-dialog>
- <el-dialog title="导入分摊比例数据" v-if="intoAmortizationDialog" :visible.sync="intoAmortizationDialog" customClass="customWidth" width="500px">
- <p>1. 下载
- <el-link type="primary" style="margin-left:5px;" :underline="false" href="./upload/员工项目分摊比例导入模板.xlsx" download="员工项目分摊比例导入模板.xlsx">员工项目分摊比例导入模板.xlsx</el-link>
- </p>
- <p>2. 填写excel模板,请确保模板中的项目和人员已添加到系统中。</p>
- <p style="display: flex;justify-content: center;padding:1em 0">
- <el-upload ref="upload" action="#" :limit="1" :http-request="batchImportData" :show-file-list="false">
- <el-button type="primary" :underline="false" :loading="importingData">开始导入</el-button>
- </el-upload>
- </p>
- </el-dialog>
- <el-dialog title="设置员工成本各项目占比" show-header="false" v-if="setPercentDialog" :visible.sync="setPercentDialog"
- :close-on-click-modal="false" customClass="customWidth" width="600px" >
- <div style="margin:0px 10px 10px 10px;">
- <span>选择员工</span>
- <el-select v-model="chosenNoReportUserIds" multiple filterable clearable style="width:330px;" collapse-tags>
- <el-option v-for="item in noReportUserList" :label="item.name" :key="item.id" :value="item.userId"></el-option>
- </el-select>
- <el-button @click="averageCost" >自动分摊</el-button>
- </div>
- <el-divider ></el-divider>
- <!--项目列表 -->
- <el-form v-model="curPercentVal" label-width="365px" style="margin-top:10px;">
- <div class="nameList">
- <el-form-item v-for="item in projectCols" :label="item.projectName" :key="item.projectId" >
- 占比: <el-input v-model="curPercentVal[item.projectId]" style="width:100px;" @input="updatePercentValue"></el-input> %
- </el-form-item>
- </div>
- <el-form-item >
- 总比例: {{totalPercent}} %
- </el-form-item>
- </el-form>
-
- <div slot="footer" class="dialog-footer">
- <el-button type="default" @click="setPercentDialog = false" >关闭</el-button>
- <el-button type="primary" @click="setPercentSetting()" >确定</el-button>
- </div>
- </el-dialog>
- <!-- 导入结果说明 -->
- <el-dialog title="分摊比例导入结果" v-if="showImportResult" :visible.sync="showImportResult" customClass="customWidth" width="500px">
- <div>
- <span>{{importResultMsg}}</span>
-
- </div>
- <span slot="footer" class="dialog-footer">
- <el-button type="primary" @click="showImportResult=false">确定</el-button>
- </span>
- </el-dialog>
- <el-dialog title="分摊数据导出" v-if="exportFinanceDialog" :visible.sync="exportFinanceDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
- <div style="margin:30px;">
- <el-radio-group v-model="groupByCategory" >
- <el-radio :label="0">按项目导出</el-radio>
- <el-radio :label="1">按项目分类导出</el-radio>
- </el-radio-group>
- </div>
- <div slot="footer" class="dialog-footer">
- <el-button @click="exportData" :loading="exportDataProcessing" type="primary">导出</el-button>
- </div>
- </el-dialog>
- </section>
- </template>
- <style scoped>
- .line {
- padding:10px;
- }
- .line span{
- font-size:18px;
- }
- .line span:nth-child(even){
- float:right;
- }
- </style>
- <style>
- .customWidth .el-dialog__body{
- padding-top: 0;
- padding-bottom: 0;
- }
- </style>
- <script>
- import { error } from 'dingtalk-jsapi';
- import util from "../../common/js/util";
- export default {
- data() {
- return {
- groupByCategory:0,
- exportFinanceDialog:false,
- exportMonth:null,
- exportDialog:false,
- headerCols:['monthCost','bonus', 'allowance', 'insuranceOld', 'insuranceMedical', 'insuranceLosejob', 'insuranceInjury', 'houseFund', 'customField1','customField2','customField3'],
- tblCols:[],
- costListRadio: 0,
- costSettingLoading: false,
- chosenNoReportUserIds:[],
- curPercentVal:{},
- setPercentDialog: false,
- chosenProjects:[],
- projectsDialog: false,
- projectCols:[],
- allProjectList:[],
- multipleSelection:[],
- userCostSettingList: [],
- settingDialog: false,
- radio:"全部人员",
- noReportUserList:[],
- allFinanceList:[],
- assignNoProUser: false,
- customFieldList:[],
- itemDialog: false,
- customCols:{},
- customColsi:{},
- // showNPDialog: false,
- npUserList:[],
- hasNoProjectUsers: false,
- isUploading:false,
- importDialog: false,
- importParam:{syncUserCost:true, syncHistoryReport:true},
- user: JSON.parse(sessionStorage.getItem("user")),
- permissions: JSON.parse(sessionStorage.getItem("permissions")),
- userDetailVisible: false,
- userDetail:{},
- date: null,
- tableHeight: 0,
- listLoading: false,
- list: [],
- addLoading: false,
-
- myChart: null,
- params: null,
- totalPercent:0,
- importVisible: false,
- shenhe: '',
- tabPosition: '0',
- reviewerVisible: false,
- reviewerRuleForm: {
- auditorId: ''
- },
- people: [],
- revaelse: '',
- reviewLis: [],
- ovReviewLis: [],
- xzImportVisible: false,
- xzList: [],
- intoAmortizationDialog : false ,
- importingData: false,
- importResultMsg:null,
- showImportResult:false,
- widthHtval: document.body.clientWidth - 230,
- };
- },
- methods: {
- exportFinance() {
- this.isUploading = true;
- this.http.post('/finance/exportFinance', {
- date: this.exportMonth
- },res =>{
- this.isUploading = false;
- if(res.code == 'ok') {
- this.downloadByA({name:this.exportMonth+'财务数据.xls', url: res.data});
- }
- },error => {
- this.$message({
- message: error,
- type: "error"
- });
- })
- },
- arrter() {
- this.http.post('/user/getEmployeeList', {
- departmentId: '-1',
- pageIndex: 1,
- pageSize: 99999
- },res =>{
- if(res.code == 'ok') {
- this.people = res.data.records
- }
- },error => {
- this.$message({
- message: error,
- type: "error"
- });
- })
- },
- addreviewer() {
- this.http.post('/finance-auditor/get', {
- companyId: this.user.companyId
- },
- res => {
- if (res.code == "ok") {
- console.log(res.data, '数据')
- if(res.data) {
- this.reviewerRuleForm.auditorId = res.data.auditorId
- } else {
- this.reviewerRuleForm.auditorId = ''
- }
- }
- },error => {
- this.$message({
- message: error,
- type: "error"
- });
- }
- );
- },
- // 提交审核人
- submitreviewerRuleForm(formName) {
- this.$refs[formName].validate((valid) => {
- if (valid) {
- this.reviewerRuleForm.companyId = this.user.companyId
- this.http.post('/finance-auditor/save', this.reviewerRuleForm,
- res =>{
- if(res.code == 'ok') {
- this.$message({
- message: '操作成功',
- type: "success"
- });
- this.addreviewer()
- } else {
- this.$message({
- message: '操作失败',
- type: "error"
- });
- }
- },error => {
- this.$message({
- message: error,
- type: "error"
- });
- })
- this.reviewerVisible = false
- } else {
- return false;
- }
- });
- },
- handleCloses(done) {
- var formName = 'reviewerRuleForm'
- this.$refs[formName].resetFields();
- done()
- },
- // 审核
- audits() {
- this.shenhe = '导入审核'
- this.importVisible = true
- },
- switchCostList() {
- //已填日报的人员成本
- if (this.costListRadio == 1) {
- this.assignNoProUser=false;
- this.assignToProject();
- } else if (this.costListRadio == 2) {
- //全部人员成本
- this.assignNoProUser=true;
- this.assignToProject();
- }
- },
- getLastMonthSetting() {
- this.costSettingLoading = true;
- var dataArr = this.date.split('-');
- var year = dataArr[0];
- var month = dataArr[1];
- if (parseInt(month) == 1) {
- year = parseInt(year) -1;
- month = 12;
- } else {
- month = parseInt(month) -1;
- if (month < 10) {
- month = '0'+month;
- }
- }
- var lastMonth = year + '-' + month;
- this.http.post('/project-percentage/getMonthSetting', {ymonth: lastMonth},
- res => {
- this.costSettingLoading = false;
- if (res.code == "ok") {
- this.projectCols = res.data.financeProjects;
- this.allProjectList = res.data.allProjectList;
- this.userCostSettingList = res.data.userCostSetting;
- //上次如果没有配置过,需要初始化
- for (var i=0;i<this.noReportUserList.length; i++) {
- var rUser = this.noReportUserList[i];
- //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
- if (this.userCostSettingList.filter(c=>c.id == rUser.userId).length == 0) {
- var item = {name: rUser.name, id: rUser.userId};
- this.projectCols.forEach(p=>{
- item[p.projectId] = 0;
- });
- this.userCostSettingList.push(item);
- }
- }
- this.$nextTick(()=>{
- this.$refs.settingTable.doLayout();
- })
- } });
- },
- //获取当月的无项目工时人员的分配比例设置
- getMonthSetting() {
- this.costSettingLoading = true;
- this.http.post('/project-percentage/getMonthSetting', {ymonth: this.date},
- res => {
- this.costSettingLoading = false;
- if (res.code == "ok") {
- this.projectCols = res.data.financeProjects;
- this.allProjectList = res.data.allProjectList;
- this.userCostSettingList = res.data.userCostSetting;
- //上次如果没有配置过,需要初始化
- for (var i=0;i<this.noReportUserList.length; i++) {
- var rUser = this.noReportUserList[i];
- console.log('userId====='+rUser.userId);
- //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
- if (this.userCostSettingList.filter(c=>c.id == rUser.userId).length == 0) {
- var item = {name: rUser.name, id: rUser.userId};
- this.projectCols.forEach(p=>{
- item[p.projectId] = 0;
- });
- this.userCostSettingList.push(item);
- }
- }
- this.$nextTick(()=>{
- this.$refs.settingTable.doLayout();
- })
- } });
- },
- //提交无工时人员的分配设置
- saveMonthSetting() {
- //检查数据是否都分配到100%了,防止由于修改了项目列而导致之前的数据不正确的情况
- var errorList = this.userCostSettingList.filter(u=>{
- let totalPercent = 0.0;
- this.projectCols.forEach(p=>{
- totalPercent += parseFloat(u[p.projectId]);
- });
- totalPercent = totalPercent.toFixed(1);
- if (totalPercent != 100) {
- return true;
- } else {
- return false;
- }
- });
- if (errorList.length > 0) {
- var nameList = errorList.map(e=>e.name);
- this.$message({type:'error', message:'存在人员分配比例非100%: '+nameList});
- return;
- }
- this.http.post('/project-percentage/saveMonthSetting', {projectCols: JSON.stringify(this.projectCols),
- ymonth: this.date, userSettings: JSON.stringify(this.userCostSettingList)},
- res => {
- if (res.code == "ok") {
- this.$message({type:'success', message:'保存成功'});
- this.settingDialog = false;
- } else {
- this.$message({type:'error', message:'发生错误:'+res.msg});
- }});
- },
- updatePercentValue() {
- var total = 0.0;
- this.projectCols.forEach(p=>{
- total += parseFloat(this.curPercentVal[p.projectId]);
- })
- this.totalPercent = total.toFixed(1);
- this.$forceUpdate();
- },
- averageCost() {
- var avg = (100/this.projectCols.length).toFixed(1);
- //最后一个用100减去前面的总和,保证最终合计为100
- for (var i=0;i<this.projectCols.length; i++) {
- if (i < this.projectCols.length -1) {
- this.curPercentVal[this.projectCols[i].projectId] = avg;
- } else {
- this.curPercentVal[this.projectCols[i].projectId] = (100-avg*(this.projectCols.length-1)).toFixed(1);
- }
- }
- this.updatePercentValue();
- this.$forceUpdate();
- },
- setPercent(isBatch, row) {
- this.setPercentDialog = true;
- this.chosenNoReportUserIds = [];
- if (!isBatch) {
- this.chosenNoReportUserIds.push(row.id);
- //获取当前比例
- this.projectCols.forEach(p=>{
- this.curPercentVal[p.projectId] = row[p.projectId];
- });
- } else {
- //批量处理
- this.multipleSelection.forEach(m=>{
- this.chosenNoReportUserIds.push(m.id);
- })
- //批量时获取第一条的比例进行加载
- this.projectCols.forEach(p=>{
- this.curPercentVal[p.projectId] = this.multipleSelection[0][p.projectId];
- });
- }
- this.updatePercentValue();
- },
- //确认设置的项目列
- saveProjectSetting() {
- this.projectsDialog = false;
- this.projectCols = [];
- this.chosenProjects.forEach(c=>{
- var item = this.allProjectList.filter(a=>a.id == c)[0];
- this.projectCols.push({projectId: item.id, projectName: item.projectName, projectCode: item.projectCode});
- });
-
- this.$nextTick(()=>{
- this.$refs.settingTable.doLayout();
- })
- },
- handleProjectSelectionChange(val) {
- this.projectSelection = val;
- },
- showSelectProjectDialog() {
- //设置选中状态
- this.chosenProjects = [];
- this.projectCols.forEach(item=>{
- this.chosenProjects.push(item.projectId);
- })
- this.projectsDialog = true;
- },
- setPercentSetting() {
- //检测是否填写的情况下,是否达到100%
- if (this.totalPercent != 100) {
- this.$message({
- message: '分配比例之和必须是100%',
- type: "error"
- });
- return;
- }
- this.setPercentDialog = false;
- this.chosenNoReportUserIds.forEach(u=>{
- var targetU = this.userCostSettingList.filter(a=>a.id == u)[0];
-
- //遍历项目
- this.projectCols.forEach(p=>{
- targetU[p.projectId] = this.curPercentVal[p.projectId];
- })
- });
- this.userCostSettingList.splice(1,0);
-
- },
- showSettingDialog() {
- this.settingDialog = true;
- this.getMonthSetting();
- },
- handleSelectionChange(val) {
- this.multipleSelection = val;
- },
- switchList() {
- if (this.radio == '全部人员') {
- this.list = this.allFinanceList;
- } else {
- this.list = this.noReportUserList;
- }
- },
- downloadByA(row) {
- const a = document.createElement('a'); // 创建a标签
- a.setAttribute('download', row.name);// download属性
- console.log(row.url);
- a.setAttribute('href', row.url);// href链接
- a.click();// 自执行点击事件
- a.remove();
- },
- getTemplate() {
- this.http.post('/finance/getTemplate', {companyId: this.user.companyId},
- res => {
- if (res.code == "ok") {
- if (res.data.indexOf('xlsx') > 0) {
- this.downloadByA({name:'财务成本报表.xlsx', url:res.data});
- } else {
- this.downloadByA({name:'财务成本报表.xls', url:res.data});
- }
- }});
-
- },
- saveItems() {
- // let savefields = {
- // monthCost : this.customCols.monthCost,
- // bonus : this.customCols.bonus,
- // allowance : this.customCols.allowance,
- // insuranceOld : this.customCols.insuranceOld,
- // insuranceMedical : this.customCols.insuranceMedical,
- // insuranceLosejob : this.customCols.insuranceLosejob,
- // insuranceInjury : this.customCols.insuranceInjury,
- // houseFund : this.customCols.houseFund,
- // field1 : this.customCols.field1,
- // field2 : this.customCols.field2,
- // field3 : this.customCols.field3
- // }
- if(this.customCols.field1 != null && this.customCols.field1 != ''){
- if(this.customCols.field1Calculate == null){
- this.$message({
- message: '请选择是否计入总成本',
- type: 'warning'
- })
- return
- }
- }
- if(this.customCols.field2 != null && this.customCols.field2 != ''){
- if(this.customCols.field1Calculate == null){
- this.$message({
- message: '请选择是否计入总成本',
- type: 'warning'
- })
- return
- }
- }
- if(this.customCols.field3 != null && this.customCols.field3 != ''){
- if(this.customCols.field1Calculate == null){
- this.$message({
- message: '请选择是否计入总成本',
- type: 'warning'
- })
- return
- }
- }
- this.http.post('/finance-tblcuscol/save', this.customCols,
- res => {
- if (res.code == "ok") {
- this.itemDialog = false;
- this.getCustomColumn();
- }});
- this.$forceUpdate();
- },
- showItemDialog() {
- // console.log(this.customColsi, '后台纯的')
- // console.log(this.customCols, '用来编辑的')
- this.customCols = JSON.parse(JSON.stringify(this.customColsi))
- // console.log(this.customColsi, '后台纯的')
- // console.log(this.customCols, '用来编辑的')
- this.itemDialog = true;
- // this.customFieldList = {field1:null,field2:null, field3:null};
- // if (this.customCols.field1 !== undefined) {
- // this.customFieldList.field1 = this.customCols.field1;
- // } else if (this.customCols.field2 !== undefined) {
- // this.customFieldList.field2 = this.customCols.field2;
- // } else if (this.customCols.field3 !== undefined) {
- // this.customFieldList.field3 = this.customCols.field3;
- // }
-
-
- },
- //获取自定义的字段
- getCustomColumn() {
- this.http.post('/finance-tblcuscol/getAll', {companyId: this.user.companyId},
- res => {
- if (res.code == "ok") {
- console.log("获取自定义字段",res.data);
- this.customColsi = res.data;
- this.tblCols = [];
- this.tblCols.push(this.customColsi.monthCost);
- this.tblCols.push(this.customColsi.bonus);
- this.tblCols.push(this.customColsi.allowance);
- this.tblCols.push(this.customColsi.insuranceOld);
- this.tblCols.push(this.customColsi.insuranceMedical);
- this.tblCols.push(this.customColsi.insuranceLosejob);
- this.tblCols.push(this.customColsi.insuranceInjury);
- this.tblCols.push(this.customColsi.houseFund);
- if (this.customColsi.field1 != null) {
- this.tblCols.push(this.customColsi.field1);
- }
- if (this.customColsi.field2 != null) {
- this.tblCols.push(this.customColsi.field2);
- }
- if (this.customColsi.field3 != null) {
- this.tblCols.push(this.customColsi.field3);
- }
- }});
-
- },
-
- // },
- // getProjects() {
- // this.http.post('/finance/getProjects', {companyId: this.user.companyId, yearMonth: this.date},
- // res => {
- // if (res.code == "ok") {
- // this.projectCols = res.data.financeProjects;
- // this.allProjectList = res.data.allProjectList;
- // }});
-
- // },
- // showNoProjectUsers() {
- // this.showNPDialog = true;
- // this.http.post('/finance/getNoProjectUsers', {yearMonth: this.date},
- // res => {
- // if (res.code == "ok") {
- // this.npUserList = res.data;
- // }});
- // },
- assignToProject(){
- var _this = this;
- this.http.post('/finance/getTimeCost', {yearMonth: this.date, assignNoProUser: this.assignNoProUser},
- res => {
- if (res.code == "ok") {
- // 待会删除
- // var lll = res.data.costList
- // var arrLists = []
- // for(var i = 0; i < 50; i++) {
- // arrLists.push(lll[1])
- // }
- // res.data.costList = arrLists
- // 待会删除
- for(var i in res.data.costList) {
- if(i>20) {
- this.widthHtval = +this.widthHtval + 40
- } else {
- this.widthHtval = document.body.clientWidth - 230
- }
- }
- console.log(res.data, '图表数据', this.widthHtval)
- var xList = [], yList = [], list = res.data.costList,
-
- totalMoneyCost = res.data.totalMoneyCost;
- var nopCost = 0;
- if (res.data.noProjectItem.project != null) {
- this.hasNoProjectUsers = true;
- nopCost = res.data.noProjectItem.cost;
- } else {
- this.hasNoProjectUsers = false;
- }
-
- for(var i in list) {
- xList.push(list[i].project);
-
- yList.push({
- "value": list[i].cost,
- "id": list[i].id,
- "time": list[i].workingTime
- });
- }
- var myChart = echarts.init(document.getElementById("container"));
- // 设置图表
- myChart.resize({
- width: this.widthHtval
- })
- _this.myChart = myChart;
- var option = {
- title: {
- text: this.assignNoProUser?'成本总计 ' + totalMoneyCost + '元'
- +(this.hasNoProjectUsers?",含无项目人员成本 " + nopCost+"元 ":"")
- :'成本总计 ' + totalMoneyCost + '元',
- left:'left',
- },
- grid : {
- top : 40, //距离容器上边界40像素
- // bottom: 100, //距离容器下边界30像素
- bottom: 40, //距离容器下边界30像素
- left: 100,
- right: 100
- },
- // 工具箱
- toolbox: {
- show: true,
- feature:{
- saveAsImage:{
- show:true
- },
- restore:{
- show:true
- },
- magicType:{
- type:['line','bar']
- },
-
- }
- },
- tooltip:{
- trigger:'axis',
- formatter: function (params,ticket,callback) {
- var res = params[0].name + "<br/>工作成本"+" : " + params[0].data.value
- + "元 <br/>工作时长"+" : " + params[0].data.time + "小时";
- _this.params = params;
- return res;
- }
- },
- xAxis: {
- data: xList,
- axisLabel: {
- interval:0,rotate:20
- }
- },
- yAxis: [{
- type : 'value',
- axisLabel: {
- formatter:'{value} (元)'
- }
- }],
- series: [{
- name: '工作时长(h)',
- type: 'bar',
- barMaxWidth: 30,
- data: yList,
- }]
- };
- option && myChart.setOption(option,{notMerge: true});
- // myChart.getZr().on('click', params => {
- // const pointInPixel = [params.offsetX, params.offsetY];
- // if (myChart.containPixel('grid', pointInPixel)) {
- // console.log(_this.params)
- // if(_this.radio=='项目') {
- // _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
- // }
- // }
- // });
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //导出财务数据
- exportData() {
- this.exportDataProcessing = true;
- this.http.post('/finance/exportData', {
- date: this.date, assignNoProUser: this.assignNoProUser, groupByCategory: this.groupByCategory
- },
- res => {
- this.exportDataProcessing = false;
- if (res.code == "ok") {
- this.exportFinanceDialog = false;
- var aTag = document.createElement('a');
- aTag.download = "财务成本统计.xls";
- aTag.href = res.data;
- aTag.click();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- getSummaries(param) {
- const { columns, data } = param;
- const sums = [];
- columns.forEach((column, index) => {
- if (index === 0) {
- sums[index] = '总价';
- return;
- }
- const values = data.map(item => Number(item[column.property]));
- if (!values.every(value => isNaN(value))) {
- sums[index] = values.reduce((prev, curr) => {
- const value = Number(curr);
- if (!isNaN(value)) {
- return prev + curr;
- } else {
- return prev;
- }
- }, 0);
- sums[index] += ' 元';
- } else {
- sums[index] = 'N/A';
- }
- });
- return sums;
- },
- changeMonth() {
- //改变月份
- this.getList();
- this.assignToProject();
- this.getMonths()
- },
- // 批量导入人员
- importFinance(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("companyId", this.user.companyId);
- formData.append("yearMonth", this.date);
- formData.append("syncUserCost", this.importParam.syncUserCost);
- formData.append("syncHistoryReport", this.importParam.syncHistoryReport);
- this.isUploading = true;
- let urls = ''
- if(this.user.timeType.financeAudit == '1') {
- urls = '/finance-import/submitImport'
- } else {
- urls = '/finance/importData'
- }
- // this.http.uploadFile('/finance/importData', formData,
- this.http.uploadFile(urls, formData,
- res => {
- console.log(this.user.timeType.financeAudit, '看看数据')
- this.$refs.upload.clearFiles();
- this.listLoading = false;
- this.isUploading = false;
- if (res.code == "ok") {
- if (this.user.timeType.financeAudit == 1 ) {
- this.$message({
- message: '导入成功,请等待审核',
- type: "warning"
- });
- this.getMonths();
- } else {
- this.$message({
- message: '导入成功',
- type: "success"
- });
- }
-
- this.importDialog = false;
- //重新读取列表
- this.getList();
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$refs.upload.clearFiles();
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- }
- },
- // 导入提交审核
- // submitReview(formData) {
- // this.http.uploadFile(' /finance-import/submitImport', formData,
- // res => {
- // if (res.code == "ok") {
- // console.log(res.data, '来的数据')
- // } else {
- // this.$message({
- // message: res.msg,
- // type: "error"
- // });
- // }
- // },
- // error => {
- // this.$refs.upload.clearFiles();
- // this.listLoading = false;
- // this.$message({
- // message: error,
- // type: "error"
- // });
- // });
- // },
-
- //获取项目列表
- getList() {
- this.listLoading = true;
- this.http.post('/finance/getByMonth', {
- companyId: this.user.companyId,
- yearMonth: this.date
- },
- res => {
- this.listLoading = false;
- if (res.code == "ok") {
- var list = res.data;
- this.allFinanceList = list;
- this.list = this.allFinanceList;
- this.noReportUserList = list.filter(r=>r.hasReport == 0);
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- // 获取当月的审核状态
- getMonths() {
- this.http.post('/finance-import/getStatus', {
- companyId: this.user.companyId,
- yearMonth: this.date
- },
- res => {
- this.listLoading = false;
- if (res.code == "ok") {
- console.log(res.data, '审核状态')
- if(res.data) {
- if(res.data.state == '0') {
- this.revaelse = '待审核'
- this.tabPosition = '0'
- } else if(res.data.state == '1') {
- this.revaelse = '审核记录'
- this.tabPosition = '1'
- }else if (res.data.state == '2') {
- this.revaelse = '已驳回'
- this.tabPosition = '2'
- } else if (res.data.state == '3') {
- this.revaelse = '已撤销'
- this.tabPosition = '-1'
- }
- this.getReviewList()
- } else {
- this.revaelse = ''
- }
-
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.listLoading = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- // 获取审核列表
- getReviewList() {
- this.http.post('/finance-import/list', {
- companyId: this.user.companyId,
- },
- res => {
- if (res.code == "ok") {
- console.log(res.data, '拿到的数据')
- this.ovReviewLis = res.data
- if(this.tabPosition == 0) {
- this.reviewLis = res.data.pendingList
- } else if(this.tabPosition == 1) {
- this.reviewLis = res.data.passList
- } else if(this.tabPosition == 2) {
- this.reviewLis = res.data.rejectList
- } else {
- this.reviewLis = res.data.cancelList
- }
- console.log(this.reviewLis, '数据')
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- // 操作数据
- operationalData () {
- var sss = this.ovReviewLis
- if(this.tabPosition == 0) {
- this.reviewLis = sss.pendingList
- } else if(this.tabPosition == 1) {
- this.reviewLis = sss.passList
- } else if(this.tabPosition == 2) {
- this.reviewLis = sss.rejectList
- } else {
- this.reviewLis = sss.cancelList
- }
- console.log(this.reviewLis, '数据')
- },
- // 审核操作
- operationList(zhi, id) {
- let urls
- if(zhi == 0) {
- urls = '/finance-import/agree'
- } else if(zhi == 1){
- urls = '/finance-import/deny'
- } else {
- urls = '/finance-import/cancel'
- }
- this.http.post(urls, {
- id: id,
- },
- res => {
- if (res.code == "ok") {
- this.$message({
- message: '操作成功',
- type: "success"
- });
- this.getReviewList()
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- // 获取薪资上传记录
- xzjl() {
- this.http.post('/finance-import/list', {
- companyId: this.user.companyId,
- // pageIndex:1,
- // pageSize: 9999
- },
- res => {
- if (res.code == "ok") {
- console.log('123',res.data)
- this.xzList = res.data.passList
- } else {
- this.$message({
- message: res.msg,
- type: "error"
- });
- }
- },
- error => {
- this.$message({
- message: error,
- type: "error"
- });
- });
- },
- //导入分摊比例
- intoAmortizationRatio(){
- this.intoAmortizationDialog = true;
- },
- batchImportData(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.importingData = true;
- let formData = new FormData();
- formData.append("file", item.file);
- formData.append("companyId", this.user.companyId);
- this.http.uploadFile('/project-percentage/importData', formData,
- res => {
- this.$refs.upload.clearFiles();
- this.importingData = false;
- this.showImportResult = true;
- if (res.code == "ok") {
- //换成弹出框,以免有人等了半天回来啥也没看到
- this.importResultMsg = "成功导入"+res.data+"条分摊比例数据。"+(res.msg?res.msg:"");
- this.showSettingDialog();
- } else {
- this.importResultMsg = "导入失败:"+res.msg;
- }
- },
- error => {
- this.$refs.upload.clearFiles();
- this.importingData = false;
- this.$message({
- message: error,
- type: "error"
- });
- });
- }
- },
- // 左右滚动
- scrollFunction () {
- this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div
- if (this.domObj.attachEvent) { // IE
- this.domObj.attachEvent('onmousewheel', this.mouseScroll)
- } else if (this.domObj.addEventListener) {
- this.domObj.addEventListener('DOMMouseScroll', this.mouseScroll, false)
- }
- this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll
- },
- mouseScroll(event) { // google 浏览器下
- let detail = event.wheelDelta || event.detail
- let moveForwardStep = -1
- let moveBackStep = 1
- let step = 0
- step = detail > 0 ? moveForwardStep * 100 : moveBackStep * 100
- event.preventDefault() // 阻止浏览器默认事件
- this.domObj.scrollLeft = this.domObj.scrollLeft + step
- },
- },
- created() {
- var d = new Date();
- this.date = d.getFullYear() +'-'+ ((d.getMonth()+1) < 10? '0'+(d.getMonth()+1):d.getMonth()+1);
-
- },
- mounted() {
- let height = window.innerHeight;
- this.tableHeight = height - 245;
- const that = this;
- window.onresize = function temp() {
- that.tableHeight = window.innerHeight - 245;
- };
-
- this.getCustomColumn();
- this.getList();
- // this.getProjects();
- this.addreviewer();
- this.arrter()
- this.getMonths()
- this.scrollFunction()
- },
- updated() {
- this.$nextTick(() => {
- this.$refs['table'].doLayout();
- })
- }
- };
- </script>
- <style lang="scss" scoped>
- .nameList {
- height: 400px;
- overflow: auto;
- }
- </style>
|