finance.vue 91 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true">
  6. <!-- <el-form-item label="财务核算成本 | 月份选择" style="margin-top:5px;"> -->
  7. <el-form-item :label="this.$t('Selectmonth')" >
  8. <el-date-picker size="small" v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM" @change="changeMonth" :clearable="false" type="month" :placeholder="$t('Selectmonth')" style="margin-right: 20px"></el-date-picker>
  9. <el-link type="primary" :underline="false" @click="audits()" v-if="user.timeType.financeAudit == '1'">{{revaelse}}</el-link>
  10. </el-form-item>
  11. <!-- <el-radio-group v-model="radio" @change="switchList" style="margin-left:160px;margin-top:5px;"> -->
  12. <el-radio-group size="small" v-model="radio" @change="switchList" style="margin-left:150px;margin-top:5px;">
  13. <el-radio-button :label="$t('lable.allStaff')" >{{$t('lable.allStaff')}}({{allFinanceList.length}})</el-radio-button>
  14. <el-radio-button :label="$t('projectworker')">{{$t('projectworker')}}({{noReportUserList.length}})</el-radio-button>
  15. </el-radio-group>
  16. <el-form-item v-if="permissions.financialProportion" style="margin-left:5px;">
  17. <el-link type="primary" :underline="false" @click="showSettingDialog()" >{{ $t('Apportionmentratesetting') }}</el-link>
  18. </el-form-item>
  19. <el-form-item style="float:right;" v-if="permissions.financialUpload">
  20. <el-link type="primary" :underline="false" @click="getTemplate()" >{{ $t('Downloadthetemplate') }}</el-link>
  21. </el-form-item>
  22. <!-- <el-form-item style="float:right;">
  23. <el-upload ref="upload" action="#" :limit="1" :http-request="importFinance" :show-file-list="false">
  24. <el-link type="primary" :underline="false" >财务数据上传</el-link>
  25. </el-upload>
  26. </el-form-item> -->
  27. <el-form-item style="float:right;" v-if="permissions.financialUpload">
  28. <el-link type="primary" :underline="false" @click="importDialog = true;isUploading=false;">{{ $t('Dataupload') }}</el-link>
  29. </el-form-item>
  30. <el-form-item style="float:right;" v-if="permissions.financialExport">
  31. <el-link type="primary" :underline="false" @click="exportDialog = true;exportMonth = date;">{{ $t('Exportdata') }}</el-link>
  32. </el-form-item>
  33. <el-form-item style="float:right;" v-if="permissions.financialCustom">
  34. <el-link type="primary" :underline="false" @click="showItemDialog()">{{ $t('Customizesalaryitems') }}</el-link>
  35. </el-form-item>
  36. <el-form-item style="float:right;" v-if="user.timeType.financeAudit == '1' && permissions.setFinanceAuditor">
  37. <el-link type="primary" :underline="false" @click="reviewerVisible = true">{{ $t('Setupauditor') }}</el-link>
  38. </el-form-item>
  39. </el-form>
  40. </el-col>
  41. <!-- 上传记录 -->
  42. <el-dialog :title="$t('Salaryuploadrecord')" :visible.sync="xzImportVisible" width="1100px" :before-close="handleClose">
  43. <div>
  44. <el-table :data="xzList" style="width: 100%" :height="400">
  45. <el-table-column prop="userName" :label="$t('other.operator')">
  46. <template slot-scope="scope">
  47. <div>
  48. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='scope.row.userName'></ww-open-data></span>
  49. <span v-if="user.userNameNeedTranslate != '1'">{{scope.row.userName}}</span>
  50. </div>
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="ymonth" :label="$t('BelongsIn')"></el-table-column>
  54. <el-table-column prop="fileName" :label="$t('filename')">
  55. <template slot-scope="scope">
  56. <div>
  57. <el-link type="primary" @click="downloadByA({name:scope.row.fileName,url:scope.row.serverName})"> {{scope.row.fileName}}</el-link>
  58. </div>
  59. </template>
  60. </el-table-column>
  61. <el-table-column prop="recoverReport" :label="$t('Whetherdailycostiscovered')" width="150">
  62. <template slot-scope="scope">
  63. <div>
  64. {{scope.row.recoverReport == 1? $t('state.yes') : $t('state.no')}}
  65. </div>
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="recoverMonthcost" :label="$t('Whethermonthlypersonnelcostiscovered')" width="150">
  69. <template slot-scope="scope">
  70. <div>
  71. {{scope.row.recoverMonthcost == 1? $t('state.yes') : $t('state.no')}}
  72. </div>
  73. </template>
  74. </el-table-column>
  75. <el-table-column prop="indate" :label="$t('Uploadtime')"></el-table-column>
  76. <!-- <el-table-column prop="date" label="操作" v-if="(tabPosition == 1 || tabPosition == 0) && (reviewerRuleForm.auditorId == user.id || user.role == 1 || user.role == 2)">
  77. <template slot-scope="scope">
  78. <div>
  79. <el-button type="primary" size="small" v-if="tabPosition == 0" @click="operationList(0, scope.row.id)">通过</el-button>
  80. <el-button type="warning" size="small" v-if="tabPosition == 0" @click="operationList(1, scope.row.id)">驳回</el-button>
  81. <el-button type="warning" size="small" v-if="tabPosition == 1" @click="operationList(2, scope.row.id)">撤销</el-button>
  82. </div>
  83. </template>
  84. </el-table-column> -->
  85. </el-table>
  86. </div>
  87. </el-dialog>
  88. <!-- 财务报表审核 -->
  89. <el-dialog :title="shenhe" :visible.sync="importVisible" width="1100px" :before-close="handleClose">
  90. <div>
  91. <el-radio-group v-model="tabPosition" style="margin-bottom: 20px;" @change="operationalData()">
  92. <el-radio-button label="1">{{ $t('state.alreadyPassed') }}</el-radio-button>
  93. <el-radio-button label="0">{{ $t('state.WaitingAudit') }}</el-radio-button>
  94. <el-radio-button label="2">{{ $t('state.rejected') }}</el-radio-button>
  95. <el-radio-button label="-1">{{ $t('state.undone') }}</el-radio-button>
  96. </el-radio-group>
  97. <el-table :data="reviewLis" style="width: 100%" :height="400">
  98. <el-table-column prop="userName" :label="$t('other.operator')">
  99. <template slot-scope="scope">
  100. <div>
  101. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='scope.row.userName'></ww-open-data></span>
  102. <span v-if="user.userNameNeedTranslate != '1'">{{scope.row.userName}}</span>
  103. </div>
  104. </template>
  105. </el-table-column>
  106. <el-table-column prop="ymonth" :label="$t('BelongsIn')"></el-table-column>
  107. <el-table-column prop="fileName" :label="$t('filename')">
  108. <template slot-scope="scope">
  109. <div>
  110. <el-link type="primary" @click="downloadByA({name:scope.row.fileName,url:scope.row.serverName})"> {{scope.row.fileName}}</el-link>
  111. </div>
  112. </template>
  113. </el-table-column>
  114. <el-table-column prop="recoverReport" :label="$t('Whetherdailycostiscovered')" width="150">
  115. <template slot-scope="scope">
  116. <div>
  117. {{scope.row.recoverReport == 1? $t('state.yes') : $t('state.no')}}
  118. </div>
  119. </template>
  120. </el-table-column>
  121. <el-table-column prop="recoverMonthcost" :label="$t('Whethermonthlypersonnelcostiscovered')" width="150">
  122. <template slot-scope="scope">
  123. <div>
  124. {{scope.row.recoverMonthcost == 1? $t('state.yes') : $t('state.no')}}
  125. </div>
  126. </template>
  127. </el-table-column>
  128. <el-table-column prop="indate" :label="$t('Uploadtime')"></el-table-column>
  129. <el-table-column prop="date" :label="$t('operation')" v-if="(tabPosition == 1 || tabPosition == 0) && (reviewerRuleForm.auditorId == user.id)">
  130. <template slot-scope="scope">
  131. <div>
  132. <el-button type="primary" size="small" v-if="tabPosition == 0" @click="operationList(0, scope.row.id)">{{ $t('btn.through') }}</el-button>
  133. <el-button type="warning" size="small" v-if="tabPosition == 0" @click="operationList(1, scope.row.id)">{{ $t('btn.rejected') }}</el-button>
  134. <el-button type="warning" size="small" v-if="tabPosition == 1" @click="operationList(2, scope.row.id)">{{ $t('btn.undo') }}</el-button>
  135. </div>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. </div>
  140. </el-dialog>
  141. <!-- 设置审核人弹窗 -->
  142. <el-dialog :title="$t('Setupauditor')" :visible.sync="reviewerVisible" width="350px" :before-close="handleCloses">
  143. <el-form :model="reviewerRuleForm" ref="reviewerRuleForm" label-width="100px" class="demo-ruleForm">
  144. <el-form-item :label="$t('SelectionofAuditor')" prop="auditorId" :rules="{required: true, message: $t('reviewercannotbeempty'), trigger: 'blur'}">
  145. <el-select v-model="reviewerRuleForm.auditorId" clearable :placeholder="$t('SelectionofAuditor')" v-if="user.userNameNeedTranslate != '1'" >
  146. <el-option v-for="(item, index) in people" :key="index" :label="item.name" :value="item.id"></el-option>
  147. </el-select>
  148. <selectCat v-if="user.userNameNeedTranslate == '1'" @selectCal="selectCal" :subject="people" :subjectId="reviewerRuleForm.auditorId" :distinction="'1'" :size="'mini'"></selectCat>
  149. </el-form-item>
  150. <el-form-item>
  151. <el-button type="primary" @click="submitreviewerRuleForm('reviewerRuleForm')">{{ $t('btn.submit') }}</el-button>
  152. </el-form-item>
  153. </el-form>
  154. </el-dialog>
  155. <el-dialog :title="$t('Exportoffinancialdata')" v-if="exportDialog" :visible.sync="exportDialog" :close-on-click-modal="false" customClass="customWidth" width="400px">
  156. <el-form ref="form3" >
  157. <el-form-item :label="$t('Intheexport')" >
  158. <!-- <div style="color:orange;">{{date}}</div> -->
  159. <el-date-picker v-model="exportMonth" type="month" :placeholder="$t('Selectmonth')" format="yyyy-MM" value-format="yyyy-MM" style="width:280px;"></el-date-picker>
  160. </el-form-item>
  161. </el-form>
  162. <div slot="footer" class="dialog-footer">
  163. <el-button type="primary" style="width:100%;" :loading="isUploading" @click="exportFinance">{{ $t('export.export') }}</el-button>
  164. </div>
  165. </el-dialog>
  166. <!--列表-->
  167. <!-- 222 -->
  168. <el-table :data="list" highlight-current-row v-loading="listLoading"
  169. :show-summary='user.timeType.isSecretSalary==0?true:false'
  170. ref="table"
  171. :summary-method="getSummaries"
  172. @selection-change="deleteSel"
  173. :height="300" style="width: 100%;">
  174. <el-table-column type="selection" width="80" fixed="left"></el-table-column>
  175. <el-table-column prop="jobNumber" v-if="user.timeType.financeJobnumEnabled==1" :label="$t('Worknumber')" sortable width="100" fixed="left"></el-table-column>
  176. <el-table-column prop="name" :label="$t('lable.name')" sortable width="150" fixed="left">
  177. <template slot-scope="scope">
  178. <div>
  179. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='scope.row.name'></ww-open-data></span>
  180. <span v-if="user.userNameNeedTranslate != '1'">{{scope.row.name}}</span>
  181. <!-- {{scope.row.name}} -->
  182. </div>
  183. </template>
  184. </el-table-column>
  185. <template v-if="user.timeType.isSecretSalary==0">
  186. <el-table-column :prop="headerCols[index]" :label="item" sortable show-overflow-tooltip v-for="(item, index) in tblCols" :key="index" width="130px" align="right">
  187. <template slot-scope="scope">
  188. <div style="padding-right:5px;">{{scope.row[headerCols[index]]==null?'0.00':scope.row[headerCols[index]].toFixed(2)}}</div>
  189. </template>
  190. </el-table-column>
  191. </template>
  192. <template v-if="user.timeType.isSecretSalary==1">
  193. <el-table-column :label="item" sortable show-overflow-tooltip v-for="(item, index) in tblCols" :key="index" width="130px" align="center">
  194. <template slot-scope="scope" >
  195. * <span v-if="scope.row"></span>
  196. </template>
  197. </el-table-column>
  198. </template>
  199. <el-table-column prop="totalCost" width="150" align="right" :label="$t('totalcost')" fixed="right">
  200. <template slot-scope="scope" >
  201. <div style="padding-right:5px;">{{user.timeType.isSecretSalary==0?scope.row.totalCost:'*'}}</div>
  202. </template>
  203. </el-table-column>
  204. </el-table>
  205. <div style="padding:5px 0 0 10px" v-if="permissions.financialUpload">
  206. <el-button @click="deleteUsers" size="mini" type="primary" :disabled="deleteSelList.length == 0">{{ $t('Batchdelete') }}</el-button>
  207. </div>
  208. <el-form :inline="true" >
  209. <el-form-item >
  210. <!-- <el-checkbox style="margin-left:10px;" v-model="assignNoProUser" @click="assignToProject">均摊无项目人员成本</el-checkbox> -->
  211. <!-- <el-button type="primary" :underline="false" size="small" @click="assignNoProUser=false;assignToProject();" style="margin-left:10px;">分摊已填工时人员成本</el-button>
  212. <el-button type="primary" :underline="false" size="small" @click="assignNoProUser=true;assignToProject();" style="margin-left:10px;">分摊全部人员成本</el-button> -->
  213. <el-radio-group size="small" v-model="costListRadio" @change="switchCostList" style="margin-left:5px;margin-top:5px;">
  214. <el-radio-button label="1" >{{ $t('Apportionmentofpersonnelcosts') }}</el-radio-button>
  215. <el-radio-button label="2">{{ $t('Spreadallpersonnelcosts') }}</el-radio-button>
  216. </el-radio-group>
  217. </el-form-item>
  218. <el-form-item style="float:right;margin-right:20px;" v-if="permissions.financialShare">
  219. <el-link type="primary" :underline="false" @click="uploadTest()" v-if="user.companyId == 936" style="margin-right:10px">上传</el-link>
  220. <el-link type="primary" :underline="false" @click="exportFinanceDialog=true">{{ $t('ExportingtheAllocationData') }}</el-link>
  221. </el-form-item>
  222. <!-- <el-form-item style="float:right;margin-right:30px;" v-if="hasNoProjectUsers">
  223. <el-link type="primary" :underline="false" @click="showNoProjectUsers">查看无项目数据</el-link>
  224. </el-form-item> -->
  225. </el-form>
  226. <!-- 图表 -->
  227. <!-- <div id="container" :style="'height:300px;width:'+ widthHtval+'px;'"></div> -->
  228. <div id="clearfix" :style="'overflow-x: auto;width:100%;padding-bottom: 100px; position: relative; height:300px;'">
  229. <div id="container" :style="'height: 300px;width:100%;'"></div>
  230. </div>
  231. <!--新增界面-->
  232. <el-dialog :title="title" v-if="addFormVisible" :visible.sync="addFormVisible" :close-on-click-modal="false" customClass="customWidth" width="600px">
  233. <el-form ref="form1" :model="addForm" :rules="rules" label-width="100px">
  234. <el-form-item :label="$t('Itemno')" >
  235. <el-input v-model="addForm.code" :placeholder="$t('Pleaseentertheprojectnumber')" clearable></el-input>
  236. </el-form-item>
  237. <el-form-item :label="$t('headerTop.projectName')" prop="name">
  238. <el-input v-model="addForm.name" :placeholder="$t('Pleaseenteraprojectname')" clearable></el-input>
  239. </el-form-item>
  240. <el-form-item :label="$t('Allparticipants')">
  241. <el-select v-model="addForm.userId" multiple filterable :placeholder="$t('Pleaseselectparticipants')" style="width:100%;" @change="changeParticipator">
  242. <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id"></el-option>
  243. </el-select>
  244. </el-form-item>
  245. <el-form-item :label="$t('Principalpersoninharge')" >
  246. <el-select v-model="addForm.inchargerId" :disabled="addForm.userId.length==0" filterable :placeholder="$t('Pleaseselectthepersonincharge')" style="width:100%;" @change="changeIncharger">
  247. <el-option v-for="item in participator" :key="item.id" :label="item.name" :value="item.id"></el-option>
  248. </el-select>
  249. </el-form-item>
  250. </el-form>
  251. <div slot="footer" class="dialog-footer">
  252. <el-button @click.native="addFormVisible = false">{{ $t('btn.cancel') }}</el-button>
  253. <el-button type="primary" @click="submitInsert" :loading="addLoading">{{ $t('btn.submit') }}</el-button>
  254. </div>
  255. </el-dialog>
  256. <!--用户详细信息弹出框-->
  257. <el-dialog :title="$t('Checkthedetails')" v-if="userDetailVisible" :visible.sync="userDetailVisible" :close-on-click-modal="false" customClass="customWidth" width="400px">
  258. <div class="line"><span>{{ $t('lable.name') }}</span>
  259. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='userDetail.name'></ww-open-data></span>
  260. <span v-if="user.userNameNeedTranslate != '1'">{{userDetail.name}}</span>
  261. </div>
  262. <div class="line"><span>{{ $t('Worknumber') }}</span><span>{{userDetail.jobNumber}}</span></div>
  263. <div class="line"><span>{{ $t('lable.phone') }}</span><span>{{userDetail.phone}}</span></div>
  264. <div class="line"><span>{{ $t('lable.department') }}</span>
  265. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='departmentName' :openid='userDetail.departmentName'></ww-open-data></span>
  266. <span v-if="user.userNameNeedTranslate != '1'">{{userDetail.departmentName}}</span>
  267. </div>
  268. <div class="line"><span>{{ $t('costof') }}</span><span>{{userDetail.cost}}{{$t('Yuananhour')}}</span></div>
  269. <div slot="footer" class="dialog-footer">
  270. <el-button type="primary" @click="userDetailVisible = false" >{{ $t('btn.determine') }}</el-button>
  271. </div>
  272. </el-dialog>
  273. <!--导入时的设置界面 -->
  274. <el-dialog :title="$t('Financialdataimport')" v-if="importDialog" :visible.sync="importDialog" :close-on-click-modal="false" customClass="customWidth" width="550px">
  275. <el-form ref="form3" :model="importParam" >
  276. <el-form-item :label="$t('Itheimport')" >
  277. <!-- <div style="color:orange;">{{date}}</div> -->
  278. <el-date-picker v-model="date" type="month" :placeholder="$t('Selectmonth')" format="yyyy-MM" value-format="yyyy-MM"></el-date-picker>
  279. </el-form-item>
  280. <el-form-item prop="syncHistoryReport" >
  281. <el-checkbox :label="$t('Recalculatereportedcostsforthemonth')" v-model="importParam.syncHistoryReport"></el-checkbox>
  282. <span v-if="user.companyId == '936'">&nbsp;[ 按每月 {{$t(user.timeType.monthDays)}} 天 * 每天 {{$t(user.timeType.allday)}} 小时计算时薪 ]</span>
  283. </el-form-item>
  284. <el-form-item prop="syncUserCost" >
  285. <el-checkbox :label="$t('Synchronizeemployeemonthlycosttorganizationalstructure')" v-model="importParam.syncUserCost" ></el-checkbox>
  286. </el-form-item>
  287. </el-form>
  288. <div slot="footer" class="dialog-footer">
  289. <el-link v-if="user.timeType.financeAudit == '0'"
  290. style="float:left;"
  291. type="primary" :underline="false" @click="xzjl(),xzImportVisible = true">{{ $t('Viewtheimporthistory') }}</el-link>
  292. <el-upload ref="upload" action="#" :limit="1" :http-request="importFinance" :show-file-list="false" >
  293. <el-button type="primary" style="width:100%;" :loading="isUploading" >{{ $t('Selectthefilendstartimporting') }}</el-button>
  294. </el-upload>
  295. </div>
  296. </el-dialog>
  297. <!--无项目人员列表-->
  298. <!-- <el-dialog title="无项目人员列表" v-if="showNPDialog" :visible.sync="showNPDialog" :close-on-click-modal="false" customClass="customWidth" width="1200px">
  299. <el-table :data="npUserList" highlight-current-row v-loading="listLoading"
  300. show-summary=true
  301. ref="table"
  302. :height="400" style="width: 100%;">
  303. <el-table-column prop="name" label="姓名" sortable width="150"></el-table-column>
  304. <el-table-column prop="monthCost" label="工资" width="150"></el-table-column>
  305. <el-table-column prop="bonus" label="奖金" ></el-table-column>
  306. <el-table-column prop="allowance" label="津贴" ></el-table-column>
  307. <el-table-column prop="insuranceOld" label="养老保险" ></el-table-column>
  308. <el-table-column prop="insuranceMedical" label="医疗保险" ></el-table-column>
  309. <el-table-column prop="insuranceLosejob" label="失业保险" ></el-table-column>
  310. <el-table-column prop="insuranceInjury" label="工伤保险" ></el-table-column>
  311. <el-table-column prop="houseFund" label="住房公积金" ></el-table-column>
  312. <el-table-column prop="others" label="其他" ></el-table-column>
  313. <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':''))">
  314. <template slot-scope="scope">
  315. {{index==0?scope.row.customField1:(index==1?scope.row.customField2:(index==2?scope.row.customField3:''))}}
  316. </template>
  317. </el-table-column>
  318. <el-table-column prop="totalCost" label="总成本" ></el-table-column>
  319. </el-table>
  320. <div slot="footer" class="dialog-footer">
  321. <div style="float:left;color:#ff9900;">*以上人员当月尚无投入的项目,请提醒他们填写日报。</div>
  322. <el-button type="primary" @click="showNPDialog = false" >关闭</el-button>
  323. </div>
  324. </el-dialog> -->
  325. <el-dialog :title="$t('Customizesalaryitems')" show-header="false" v-if="itemDialog" :visible.sync="itemDialog" :close-on-click-modal="false" customClass="customWidth" width="500px" top="20px">
  326. <div style="margin-left:30px;">
  327. <!-- 111 -->
  328. <p><el-input size="medium" v-model.trim="customCols.monthCost" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  329. <template v-if="customCols.monthCost != null && customCols.monthCost != ''">
  330. {{ $t('Addttotalcost') }}
  331. <el-radio size="medium" v-model="customCols.monthCostCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  332. <el-radio size="medium" v-model="customCols.monthCostCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  333. </template>
  334. </p>
  335. <p><el-input size="medium" v-model.trim="customCols.bonus" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  336. <template v-if="customCols.bonus != null && customCols.bonus != ''">
  337. {{ $t('Addttotalcost') }}
  338. <el-radio size="medium" v-model="customCols.bonusCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  339. <el-radio size="medium" v-model="customCols.bonusCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  340. </template>
  341. </p>
  342. <p><el-input size="medium" v-model.trim="customCols.allowance" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  343. <template v-if="customCols.allowance != null && customCols.allowance != ''">
  344. {{ $t('Addttotalcost') }}
  345. <el-radio size="medium" v-model="customCols.allowanceCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  346. <el-radio size="medium" v-model="customCols.allowanceCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  347. </template>
  348. </p>
  349. <p><el-input size="medium" v-model.trim="customCols.insuranceOld" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  350. <template v-if="customCols.insuranceOld != null && customCols.insuranceOld != ''">
  351. {{ $t('Addttotalcost') }}
  352. <el-radio size="medium" v-model="customCols.insuranceOldCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  353. <el-radio size="medium" v-model="customCols.insuranceOldCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  354. </template>
  355. </p>
  356. <p><el-input size="medium" v-model.trim="customCols.insuranceMedical" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  357. <template v-if="customCols.insuranceMedical != null && customCols.insuranceMedical != ''">
  358. {{ $t('Addttotalcost') }}
  359. <el-radio size="medium" v-model="customCols.insuranceMedicalCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  360. <el-radio size="medium" v-model="customCols.insuranceMedicalCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  361. </template>
  362. </p>
  363. <p><el-input size="medium" v-model.trim="customCols.insuranceLosejob" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  364. <template v-if="customCols.insuranceLosejob != null && customCols.insuranceLosejob != ''">
  365. {{ $t('Addttotalcost') }}
  366. <el-radio size="medium" v-model="customCols.insuranceLosejobCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  367. <el-radio size="medium" v-model="customCols.insuranceLosejobCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  368. </template>
  369. </p>
  370. <p><el-input size="medium" v-model.trim="customCols.insuranceInjury" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  371. <template v-if="customCols.insuranceInjury != null && customCols.insuranceInjury != ''">
  372. {{ $t('Addttotalcost') }}
  373. <el-radio size="medium" v-model="customCols.insuranceInjuryCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  374. <el-radio size="medium" v-model="customCols.insuranceInjuryCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  375. </template>
  376. </p>
  377. <p><el-input size="medium" v-model.trim="customCols.houseFund" :placeholder="$t('Pleaseenteracustomsalaryitemname')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  378. <template v-if="customCols.houseFund != null && customCols.houseFund != ''">
  379. {{ $t('Addttotalcost') }}
  380. <el-radio size="medium" v-model="customCols.houseFundCalculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  381. <el-radio size="medium" v-model="customCols.houseFundCalculate" :label="0">{{ $t('state.no') }}</el-radio>
  382. </template>
  383. </p>
  384. <p><el-input size="medium" v-model.trim="customCols.field1" :placeholder="$t('Pleaseenterthenameofcustomsalaryitem1')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  385. <template v-if="customCols.field1 != null && customCols.field1 != ''">
  386. {{ $t('Addttotalcost') }}
  387. <el-radio size="medium" v-model="customCols.field1Calculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  388. <el-radio size="medium" v-model="customCols.field1Calculate" :label="0">{{ $t('state.no') }}</el-radio>
  389. </template>
  390. </p>
  391. <p><el-input size="medium" v-model.trim="customCols.field2" :placeholder="$t('Pleaseenterthenameofcustomsalaryitem2')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  392. <template v-if="customCols.field2 != null && customCols.field2 != ''">
  393. {{ $t('Addttotalcost') }}
  394. <el-radio size="medium" v-model="customCols.field2Calculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  395. <el-radio size="medium" v-model="customCols.field2Calculate" :label="0">{{ $t('state.no') }}</el-radio>
  396. </template>
  397. </p>
  398. <p><el-input size="medium" v-model.trim="customCols.field3" :placeholder="$t('Pleaseenterthenameofcustomsalaryitem3')" style="width:200px;margin-right:20px" maxlength="8"></el-input>
  399. <template v-if="customCols.field3 != null && customCols.field3 != ''">
  400. {{ $t('Addttotalcost') }}
  401. <el-radio size="medium" v-model="customCols.field3Calculate" :label="1" style="margin-right:10px;margin-left:10px">{{ $t('state.yes') }}</el-radio>
  402. <el-radio size="medium" v-model="customCols.field3Calculate" :label="0">{{ $t('state.no') }}</el-radio>
  403. </template>
  404. </p>
  405. </div>
  406. <div slot="footer" class="dialog-footer">
  407. <el-button type="primary" @click="itemDialog = false" >{{ $t('Shutdown') }}</el-button>
  408. <el-button type="primary" @click="saveItems()" >{{ $t('save') }}</el-button>
  409. </div>
  410. </el-dialog>
  411. <el-dialog :title="date+$t('weekDay.month')+' ' + $t('Noallocationratioofprojectworkinghoursisset')" show-header="false" v-if="settingDialog" :visible.sync="settingDialog"
  412. :close-on-click-modal="false" customClass="customWidth" width="1200px">
  413. <div>
  414. <div>
  415. <el-button :disabled="multipleSelection.length==0" @click="setPercent(true, null)">{{ $t('BatchSettingProportion') }}</el-button>
  416. <el-button :disabled="projectCols.length==0 || userCostSettingList.length == 0" @click="getLastMonthSetting">{{ $t('UselastmonthscaleSettings') }}</el-button>
  417. <!-- <el-button @click="showSelectProjectDialog">{{date}} 月待分摊项目设置</el-button> -->
  418. <el-button @click="showSelectProjectDialog">{{date}}{{ $t('Monthlyprojecttobeapportioned') }}</el-button>
  419. <el-button @click="intoAmortizationRatio">{{ $t('Importallocationratio') }}</el-button>
  420. </div>
  421. <el-table :data="userCostSettingList" highlight-current-row v-loading="costSettingLoading"
  422. ref="settingTable" @selection-change="handleSelectionChange"
  423. :height="400" style="width: 100%;">
  424. <el-table-column type="selection" width="55"></el-table-column>
  425. <el-table-column prop="name" :label="$t('lable.name')" sortable width="90" fixed="left">
  426. <template slot-scope="scope">
  427. <div>
  428. <span v-if="user.userNameNeedTranslate == '1'"><ww-open-data type='userName' :openid='scope.row.name'></ww-open-data></span>
  429. <span v-if="user.userNameNeedTranslate != '1'">{{scope.row.name}}</span>
  430. </div>
  431. </template>
  432. </el-table-column>
  433. <el-table-column :label="item.projectName" v-for="(item) in projectCols" width="180" size="small"
  434. :key="item.id" align="center">
  435. <template slot-scope="scope">
  436. <span>{{scope.row[item.projectId]}}</span>%
  437. </template>
  438. </el-table-column>
  439. <el-table-column :label="$t('Settheproportion')" width="80" fixed="right">
  440. <template slot-scope="scope">
  441. <el-button size="small" @click="setPercent(false,scope.row)">{{ $t('setup') }}</el-button>
  442. </template>
  443. </el-table-column>
  444. </el-table>
  445. </div>
  446. <div slot="footer" class="dialog-footer">
  447. <el-button type="primary" @click="settingDialog = false" >{{ $t('Shutdown') }}</el-button>
  448. <el-button type="primary" @click="saveMonthSetting()" >{{ $t('save') }}</el-button>
  449. </div>
  450. </el-dialog>
  451. <el-dialog :title="date + $t('projectstobe assessed')" show-header="false" v-if="projectsDialog" :visible.sync="projectsDialog"
  452. :close-on-click-modal="false" customClass="customWidth" width="1000px">
  453. <el-select v-model="chosenProjects" multiple filterable clearable style="width:100%">
  454. <el-option v-for="item in allProjectList" :label="item.projectName" :key="item.id" :value="item.id"></el-option>
  455. </el-select>
  456. <el-checkbox v-model="chosenProjectsChecked" @change="chosenProjectsCheckedClick" style="margin: 20px 0;">{{chosenProjectsChecked ? $t('Deselectallitems') : $t('Selectallitems')}}</el-checkbox>
  457. <div slot="footer" class="dialog-footer">
  458. <el-button type="default" @click="projectsDialog = false" >{{ $t('Shutdown') }}</el-button>
  459. <el-button type="primary" @click="saveProjectSetting()" >{{ $t('btn.determine') }}</el-button>
  460. </div>
  461. </el-dialog>
  462. <el-dialog :title="$t('allocationdata')" v-if="intoAmortizationDialog" :visible.sync="intoAmortizationDialog" customClass="customWidth" width="500px">
  463. <p>{{'1.' + $t('other.download')}}
  464. <el-link v-if="financialFlg" type="primary" style="margin-left:5px;" :underline="false" :href="'./upload/'+$t('allocationImporttemplates')+'.xlsx'" :download="$t('allocationImporttemplates') + '.xlsx'">{{$t('allocationImporttemplates')+'.xlsx'}}</el-link>
  465. <el-link v-else type="primary" style="margin-left:5px;" :underline="false" @click="financialClick()">{{$t('allocationImporttemplates')+'.xlsx'}}</el-link>
  466. </p>
  467. <p>{{'2.' + $t('other.projectsAndPeopleInThetemplate') }}</p>
  468. <p style="display: flex;justify-content: center;padding:1em 0">
  469. <el-upload ref="upload" action="#" :limit="1" :http-request="batchImportData" :show-file-list="false">
  470. <el-button type="primary" :underline="false" :loading="importingData">{{ $t('other.startImporting') }}</el-button>
  471. </el-upload>
  472. </p>
  473. </el-dialog>
  474. <el-dialog :title="$t('eachitemofemployeecost')" show-header="false" v-if="setPercentDialog" :visible.sync="setPercentDialog"
  475. :close-on-click-modal="false" customClass="customWidth" width="600px" >
  476. <div style="margin:0px 10px 10px 10px;">
  477. <span>{{ $t('Selecttheemployee') }}</span>
  478. <el-select v-if="user.userNameNeedTranslate != '1'" v-model="chosenNoReportUserIds" multiple filterable clearable style="width:330px;" collapse-tags>
  479. <el-option v-for="item in noReportUserList" :label="item.name" :key="item.id" :value="item.userId"></el-option>
  480. </el-select>
  481. <selectCat v-if="user.userNameNeedTranslate == '1'" @selectCal="selectCal" :subject="noReportUserList" :subjectId="chosenNoReportUserIds" :distinction="'2'" :size="'small'"></selectCat>
  482. <el-button @click="averageCost" >{{ $t('Automaticallocation') }}</el-button>
  483. </div>
  484. <el-divider ></el-divider>
  485. <!--项目列表 -->
  486. <el-form v-model="curPercentVal" label-width="365px" style="margin-top:10px;">
  487. <div class="nameList">
  488. <el-form-item v-for="item in projectCols" :label="item.projectName" :key="item.projectId" >
  489. {{ $t('Accountedfor') + ':' }}<el-input v-model="curPercentVal[item.projectId]" style="width:100px;" @input="updatePercentValue"></el-input>&nbsp;%
  490. </el-form-item>
  491. </div>
  492. <el-form-item >
  493. {{ $t('totalpercentage') + ':' }}{{totalPercent}}&nbsp;%
  494. </el-form-item>
  495. </el-form>
  496. <div slot="footer" class="dialog-footer">
  497. <el-button type="default" @click="setPercentDialog = false" >{{ $t('Shutdown') }}</el-button>
  498. <el-button type="primary" @click="setPercentSetting()" >{{ $t('btn.determine') }}</el-button>
  499. </div>
  500. </el-dialog>
  501. <!-- 导入结果说明 -->
  502. <el-dialog :title="$t('importingtheallocationratio')" v-if="showImportResult" :visible.sync="showImportResult" customClass="customWidth" width="500px">
  503. <div>
  504. <span>{{importResultMsg}}</span>
  505. </div>
  506. <span slot="footer" class="dialog-footer">
  507. <el-button type="primary" @click="showImportResult=false">{{ $t('btn.determine') }}</el-button>
  508. </span>
  509. </el-dialog>
  510. <el-dialog :title="$t('AmortizedDataExport')" v-if="exportFinanceDialog" :visible.sync="exportFinanceDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  511. <div style="margin:30px;">
  512. <el-radio-group v-model="groupByCategory" >
  513. <el-radio :label="0">{{ $t('Exportbyproject') }}</el-radio>
  514. <el-radio :label="1">{{ $t('Exportbprojectcategory') }}</el-radio>
  515. </el-radio-group>
  516. </div>
  517. <div slot="footer" class="dialog-footer">
  518. <el-button @click="exportData" :loading="exportDataProcessing" type="primary">{{ $t('export.export') }}</el-button>
  519. </div>
  520. </el-dialog>
  521. </section>
  522. </template>
  523. <style scoped>
  524. .line {
  525. padding:10px;
  526. }
  527. .line span{
  528. font-size:18px;
  529. }
  530. .line span:nth-child(even){
  531. float:right;
  532. }
  533. </style>
  534. <style>
  535. .customWidth .el-dialog__body{
  536. padding-top: 0;
  537. padding-bottom: 0;
  538. }
  539. </style>
  540. <script>
  541. import { error } from 'dingtalk-jsapi';
  542. import util from "../../common/js/util";
  543. // 自定义select组件
  544. import selectCat from "@/components/select.vue"
  545. export default {
  546. components: {
  547. selectCat
  548. },
  549. data() {
  550. return {
  551. groupByCategory:0,
  552. exportFinanceDialog:false,
  553. exportMonth:null,
  554. exportDialog:false,
  555. headerCols:['monthCost','bonus', 'allowance', 'insuranceOld', 'insuranceMedical', 'insuranceLosejob', 'insuranceInjury', 'houseFund', 'customField1','customField2','customField3'],
  556. tblCols:[],
  557. costListRadio: 0,
  558. costSettingLoading: false,
  559. chosenNoReportUserIds:[],
  560. curPercentVal:{},
  561. setPercentDialog: false,
  562. chosenProjects:[],
  563. projectsDialog: false,
  564. projectCols:[],
  565. allProjectList:[],
  566. multipleSelection:[],
  567. userCostSettingList: [],
  568. settingDialog: false,
  569. radio:this.$t('lable.allStaff'),
  570. noReportUserList:[],
  571. allFinanceList:[],
  572. assignNoProUser: false,
  573. customFieldList:[],
  574. itemDialog: false,
  575. customCols:{},
  576. customColsi:{},
  577. // showNPDialog: false,
  578. npUserList:[],
  579. hasNoProjectUsers: false,
  580. isUploading:false,
  581. importDialog: false,
  582. importParam:{syncUserCost:true, syncHistoryReport:true},
  583. user: JSON.parse(sessionStorage.getItem("user")),
  584. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  585. userDetailVisible: false,
  586. userDetail:{},
  587. date: null,
  588. tableHeight: 0,
  589. listLoading: false,
  590. list: [],
  591. addLoading: false,
  592. myChart: null,
  593. params: null,
  594. totalPercent:0,
  595. importVisible: false,
  596. shenhe: '',
  597. tabPosition: '0',
  598. reviewerVisible: false,
  599. reviewerRuleForm: {
  600. auditorId: ''
  601. },
  602. people: [],
  603. revaelse: '',
  604. reviewLis: [],
  605. ovReviewLis: [],
  606. xzImportVisible: false,
  607. xzList: [],
  608. intoAmortizationDialog : false ,
  609. importingData: false,
  610. importResultMsg:null,
  611. showImportResult:false,
  612. widthHtval: document.body.clientWidth - 230,
  613. deleteSelList: [],
  614. chosenProjectsChecked: false,
  615. exportDataProcessing: false,
  616. financialFlg: false
  617. };
  618. },
  619. methods: {
  620. uploadTest(){
  621. this.http.post('/report/uploadThirdReportData',{
  622. yearMonth: this.date
  623. },res => {
  624. if(res.code == 'ok'){
  625. this.$message({
  626. message: '上传成功',
  627. type: 'success'
  628. })
  629. }else{
  630. this.$message({
  631. message: res.msg,
  632. type: 'error'
  633. })
  634. }
  635. },err => {
  636. this.$message({
  637. message: er,
  638. type: 'error'
  639. })
  640. })
  641. },
  642. chosenProjectsCheckedClick() {
  643. console.log(this.chosenProjects, '数据')
  644. if(this.chosenProjectsChecked) {
  645. let arr = []
  646. for(let i in this.allProjectList) {
  647. arr.push(this.allProjectList[i].id)
  648. }
  649. this.chosenProjects = arr
  650. } else {
  651. this.chosenProjects = []
  652. }
  653. },
  654. deleteSel(sel){
  655. this.deleteSelList = sel
  656. // console.log(sel);
  657. },
  658. deleteUsers(){
  659. this.$confirm(this.$t(this.$t('doyouwanttodeleteit')),this.$t('other.prompts'),{
  660. confirmButtonText: this.$t('btn.determine'),
  661. cancelButtonText: this.$t('btn.cancel'),
  662. type: 'warning'
  663. }).then(()=>{
  664. let ids = ''
  665. for(let i in this.deleteSelList){
  666. ids += this.deleteSelList[i].id + ','
  667. }
  668. ids = ids.substring(0,ids.length - 1)
  669. this.http.post('/finance/batchRemove',{
  670. ids: ids
  671. },res => {
  672. if(res.code == 'ok'){
  673. this.getList()
  674. this.$message({
  675. message: this.$t('message.successfullyDeleted'),
  676. type: 'success'
  677. })
  678. }else {
  679. this.$message({
  680. message: res.msg,
  681. type: 'error'
  682. })
  683. }
  684. },err => {
  685. this.$message({
  686. message: err,
  687. type: 'error'
  688. })
  689. })
  690. }).catch(()=>{
  691. this.$message({
  692. type: 'info',
  693. message: this.$t('thedeletionhasbeencancelled')
  694. })
  695. })
  696. },
  697. exportFinance() {
  698. this.isUploading = true;
  699. this.http.post('/finance/exportFinance', {
  700. date: this.exportMonth
  701. },res =>{
  702. this.isUploading = false;
  703. if(res.code == 'ok') {
  704. this.downloadByA({name:this.exportMonth+this.$t('financialdata') + '.xlsx', url: res.data});
  705. }
  706. },error => {
  707. this.$message({
  708. message: error,
  709. type: "error"
  710. });
  711. })
  712. },
  713. arrter() {
  714. this.http.post('/user/getEmployeeList', {
  715. departmentId: '-1',
  716. pageIndex: 1,
  717. // pageSize: 99999
  718. pageSize: -1
  719. },res =>{
  720. if(res.code == 'ok') {
  721. this.people = res.data.records
  722. }
  723. },error => {
  724. this.$message({
  725. message: error,
  726. type: "error"
  727. });
  728. })
  729. },
  730. addreviewer() {
  731. this.http.post('/finance-auditor/get', {
  732. companyId: this.user.companyId
  733. },
  734. res => {
  735. if (res.code == "ok") {
  736. // console.log(res.data, '数据')
  737. if(res.data) {
  738. this.reviewerRuleForm.auditorId = res.data.auditorId
  739. } else {
  740. this.reviewerRuleForm.auditorId = ''
  741. }
  742. }
  743. },error => {
  744. this.$message({
  745. message: error,
  746. type: "error"
  747. });
  748. }
  749. );
  750. },
  751. // 提交审核人
  752. submitreviewerRuleForm(formName) {
  753. this.$refs[formName].validate((valid) => {
  754. if (valid) {
  755. this.reviewerRuleForm.companyId = this.user.companyId
  756. this.http.post('/finance-auditor/save', this.reviewerRuleForm,
  757. res =>{
  758. if(res.code == 'ok') {
  759. this.$message({
  760. message: this.$t('operationissuccessful'),
  761. type: "success"
  762. });
  763. this.addreviewer()
  764. } else {
  765. this.$message({
  766. message: this.$t('operationfailure'),
  767. type: "error"
  768. });
  769. }
  770. },error => {
  771. this.$message({
  772. message: error,
  773. type: "error"
  774. });
  775. })
  776. this.reviewerVisible = false
  777. } else {
  778. return false;
  779. }
  780. });
  781. },
  782. handleCloses(done) {
  783. var formName = 'reviewerRuleForm'
  784. this.$refs[formName].resetFields();
  785. done()
  786. },
  787. // 审核
  788. audits() {
  789. this.shenhe = this.$t('importtheaudits')
  790. this.importVisible = true
  791. },
  792. switchCostList() {
  793. //已填日报的人员成本
  794. if (this.costListRadio == 1) {
  795. this.assignNoProUser=false;
  796. this.assignToProject();
  797. } else if (this.costListRadio == 2) {
  798. //全部人员成本
  799. this.assignNoProUser=true;
  800. this.assignToProject();
  801. }
  802. },
  803. getLastMonthSetting() {
  804. this.costSettingLoading = true;
  805. var dataArr = this.date.split('-');
  806. var year = dataArr[0];
  807. var month = dataArr[1];
  808. if (parseInt(month) == 1) {
  809. year = parseInt(year) -1;
  810. month = 12;
  811. } else {
  812. month = parseInt(month) -1;
  813. if (month < 10) {
  814. month = '0'+month;
  815. }
  816. }
  817. var lastMonth = year + '-' + month;
  818. this.http.post('/project-percentage/getMonthSetting', {ymonth: lastMonth},
  819. res => {
  820. this.costSettingLoading = false;
  821. if (res.code == "ok") {
  822. this.projectCols = res.data.financeProjects;
  823. this.allProjectList = res.data.allProjectList;
  824. this.userCostSettingList = res.data.userCostSetting;
  825. //上次如果没有配置过,需要初始化
  826. for (var i=0;i<this.noReportUserList.length; i++) {
  827. var rUser = this.noReportUserList[i];
  828. //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
  829. if (this.userCostSettingList.filter(c=>c.id == rUser.userId).length == 0) {
  830. var item = {name: rUser.name, id: rUser.userId};
  831. this.projectCols.forEach(p=>{
  832. item[p.projectId] = 0;
  833. });
  834. this.userCostSettingList.push(item);
  835. }
  836. }
  837. this.$nextTick(()=>{
  838. this.$refs.settingTable.doLayout();
  839. })
  840. } });
  841. },
  842. // 补齐注释,一月三十号
  843. financialClick() {
  844. this.http.post('/project-percentage/getTemplate', {ymonth: this.date},
  845. res => {
  846. if (res.code == "ok") {
  847. let fName = this.$t('allocationImporttemplates' ) + '.xlsx'
  848. var filePath = res.data;
  849. const a = document.createElement('a'); // 创建a标签
  850. a.setAttribute('download', fName);// download属性
  851. a.setAttribute('href', filePath);// href链接
  852. a.click(); //自执行点击事件
  853. a.remove();
  854. } else {
  855. this.$message({
  856. message: res.msg,
  857. type: "error"
  858. });
  859. }
  860. });
  861. },
  862. //获取当月的无项目工时人员的分配比例设置
  863. getMonthSetting() {
  864. this.costSettingLoading = true;
  865. this.http.post('/project-percentage/getMonthSetting', {ymonth: this.date},
  866. res => {
  867. this.costSettingLoading = false;
  868. if (res.code == "ok") {
  869. this.projectCols = res.data.financeProjects;
  870. this.allProjectList = res.data.allProjectList;
  871. this.userCostSettingList = res.data.userCostSetting;
  872. if(res.data.financeProjects.length <= 0 && res.data.userCostSetting <= 0) {
  873. this.financialFlg = true
  874. } else {
  875. this.financialFlg = false
  876. }
  877. console.log(this.financialFlg, '看看返回的数据是什么')
  878. //上次如果没有配置过,需要初始化
  879. for (var i=0;i<this.noReportUserList.length; i++) {
  880. var rUser = this.noReportUserList[i];
  881. // console.log('userId====='+rUser.userId);
  882. //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
  883. if (this.userCostSettingList.filter(c=>c.id == rUser.userId).length == 0) {
  884. var item = {name: rUser.name, id: rUser.userId};
  885. this.projectCols.forEach(p=>{
  886. item[p.projectId] = 0;
  887. });
  888. this.userCostSettingList.push(item);
  889. }
  890. }
  891. this.$nextTick(()=>{
  892. this.$refs.settingTable.doLayout();
  893. })
  894. } });
  895. },
  896. //提交无工时人员的分配设置
  897. saveMonthSetting() {
  898. //检查数据是否都分配到100%了,防止由于修改了项目列而导致之前的数据不正确的情况
  899. var errorList = this.userCostSettingList.filter(u=>{
  900. let totalPercent = 0.0;
  901. this.projectCols.forEach(p=>{
  902. totalPercent += parseFloat(u[p.projectId]);
  903. });
  904. totalPercent = totalPercent.toFixed(1);
  905. if (totalPercent != 100) {
  906. return true;
  907. } else {
  908. return false;
  909. }
  910. });
  911. if (errorList.length > 0) {
  912. var nameList = errorList.map(e=>e.name);
  913. this.$message({type:'error', message:this.$t('proportionofassignedpersonnelisnot ')+'100%:'+nameList});
  914. return;
  915. }
  916. this.http.post('/project-percentage/saveMonthSetting', {projectCols: JSON.stringify(this.projectCols),
  917. ymonth: this.date, userSettings: JSON.stringify(this.userCostSettingList)},
  918. res => {
  919. if (res.code == "ok") {
  920. this.$message({type:'success', message:this.$t('savesuccess')});
  921. this.settingDialog = false;
  922. } else {
  923. this.$message({type:'error', message:this.$t('erroroccurred')+':'+res.msg});
  924. }});
  925. },
  926. updatePercentValue() {
  927. var total = 0.0;
  928. this.projectCols.forEach(p=>{
  929. total += parseFloat(this.curPercentVal[p.projectId]);
  930. })
  931. this.totalPercent = total.toFixed(1);
  932. this.$forceUpdate();
  933. },
  934. averageCost() {
  935. var avg = (100/this.projectCols.length).toFixed(1);
  936. //最后一个用100减去前面的总和,保证最终合计为100
  937. for (var i=0;i<this.projectCols.length; i++) {
  938. if (i < this.projectCols.length -1) {
  939. this.curPercentVal[this.projectCols[i].projectId] = avg;
  940. } else {
  941. this.curPercentVal[this.projectCols[i].projectId] = (100-avg*(this.projectCols.length-1)).toFixed(1);
  942. }
  943. }
  944. this.updatePercentValue();
  945. this.$forceUpdate();
  946. },
  947. setPercent(isBatch, row) {
  948. this.setPercentDialog = true;
  949. this.chosenNoReportUserIds = [];
  950. if (!isBatch) {
  951. this.chosenNoReportUserIds.push(row.id);
  952. //获取当前比例
  953. this.projectCols.forEach(p=>{
  954. this.curPercentVal[p.projectId] = row[p.projectId];
  955. });
  956. } else {
  957. //批量处理
  958. this.multipleSelection.forEach(m=>{
  959. this.chosenNoReportUserIds.push(m.id);
  960. })
  961. //批量时获取第一条的比例进行加载
  962. this.projectCols.forEach(p=>{
  963. this.curPercentVal[p.projectId] = this.multipleSelection[0][p.projectId];
  964. });
  965. }
  966. this.updatePercentValue();
  967. },
  968. //确认设置的项目列
  969. saveProjectSetting() {
  970. this.projectsDialog = false;
  971. this.projectCols = [];
  972. this.chosenProjects.forEach(c=>{
  973. var item = this.allProjectList.filter(a=>a.id == c)[0];
  974. this.projectCols.push({projectId: item.id, projectName: item.projectName, projectCode: item.projectCode});
  975. });
  976. this.$nextTick(()=>{
  977. this.$refs.settingTable.doLayout();
  978. })
  979. },
  980. handleProjectSelectionChange(val) {
  981. this.projectSelection = val;
  982. },
  983. showSelectProjectDialog() {
  984. //设置选中状态
  985. this.chosenProjects = [];
  986. this.chosenProjectsChecked = false
  987. this.projectCols.forEach(item=>{
  988. this.chosenProjects.push(item.projectId);
  989. })
  990. this.projectsDialog = true;
  991. },
  992. setPercentSetting() {
  993. //检测是否填写的情况下,是否达到100%
  994. if (this.totalPercent != 100) {
  995. this.$message({
  996. message: this.$t('sumoftheallocationsmustbe'),
  997. type: "error"
  998. });
  999. return;
  1000. }
  1001. this.setPercentDialog = false;
  1002. this.chosenNoReportUserIds.forEach(u=>{
  1003. var targetU = this.userCostSettingList.filter(a=>a.id == u)[0];
  1004. //遍历项目
  1005. this.projectCols.forEach(p=>{
  1006. targetU[p.projectId] = this.curPercentVal[p.projectId];
  1007. })
  1008. });
  1009. this.userCostSettingList.splice(1,0);
  1010. },
  1011. showSettingDialog() {
  1012. this.settingDialog = true;
  1013. this.getMonthSetting();
  1014. },
  1015. handleSelectionChange(val) {
  1016. this.multipleSelection = val;
  1017. },
  1018. switchList() {
  1019. if (this.radio == this.$t('lable.allStaff')) {
  1020. this.list = this.allFinanceList;
  1021. } else {
  1022. this.list = this.noReportUserList;
  1023. }
  1024. },
  1025. downloadByA(row) {
  1026. const a = document.createElement('a'); // 创建a标签
  1027. a.setAttribute('download', row.name);// download属性
  1028. // console.log(row.url);
  1029. if (row.url.indexOf('upload/') == -1) {
  1030. row.url = '/upload/' +row.url;
  1031. }
  1032. a.setAttribute('href', row.url);// href链接
  1033. a.click();// 自执行点击事件
  1034. a.remove();
  1035. },
  1036. getTemplate() {
  1037. this.http.post('/finance/getTemplate', {companyId: this.user.companyId},
  1038. res => {
  1039. if (res.code == "ok") {
  1040. if (res.data.indexOf('xlsx') > 0) {
  1041. this.downloadByA({name:this.$t('financialcoststatement')+ '.xlsx', url:res.data});
  1042. } else {
  1043. this.downloadByA({name:this.$t('financialcoststatement')+ '.xls', url:res.data});
  1044. }
  1045. }});
  1046. },
  1047. saveItems() {
  1048. // let savefields = {
  1049. // monthCost : this.customCols.monthCost,
  1050. // bonus : this.customCols.bonus,
  1051. // allowance : this.customCols.allowance,
  1052. // insuranceOld : this.customCols.insuranceOld,
  1053. // insuranceMedical : this.customCols.insuranceMedical,
  1054. // insuranceLosejob : this.customCols.insuranceLosejob,
  1055. // insuranceInjury : this.customCols.insuranceInjury,
  1056. // houseFund : this.customCols.houseFund,
  1057. // field1 : this.customCols.field1,
  1058. // field2 : this.customCols.field2,
  1059. // field3 : this.customCols.field3
  1060. // }
  1061. if(this.customCols.field1 != null && this.customCols.field1 != ''){
  1062. if(this.customCols.field1Calculate == null){
  1063. this.$message({
  1064. message: this.$t('choosewhethertoincludethetotalcost'),
  1065. type: 'warning'
  1066. })
  1067. return
  1068. }
  1069. }
  1070. if(this.customCols.field2 != null && this.customCols.field2 != ''){
  1071. if(this.customCols.field1Calculate == null){
  1072. this.$message({
  1073. message: this.$t('choosewhethertoincludethetotalcost'),
  1074. type: 'warning'
  1075. })
  1076. return
  1077. }
  1078. }
  1079. if(this.customCols.field3 != null && this.customCols.field3 != ''){
  1080. if(this.customCols.field1Calculate == null){
  1081. this.$message({
  1082. message: this.$t('choosewhethertoincludethetotalcost'),
  1083. type: 'warning'
  1084. })
  1085. return
  1086. }
  1087. }
  1088. this.http.post('/finance-tblcuscol/save', this.customCols,
  1089. res => {
  1090. if (res.code == "ok") {
  1091. this.itemDialog = false;
  1092. this.getCustomColumn();
  1093. }});
  1094. this.$forceUpdate();
  1095. },
  1096. showItemDialog() {
  1097. // console.log(this.customColsi, '后台纯的')
  1098. // console.log(this.customCols, '用来编辑的')
  1099. this.customCols = JSON.parse(JSON.stringify(this.customColsi))
  1100. // console.log(this.customColsi, '后台纯的')
  1101. // console.log(this.customCols, '用来编辑的')
  1102. this.itemDialog = true;
  1103. // this.customFieldList = {field1:null,field2:null, field3:null};
  1104. // if (this.customCols.field1 !== undefined) {
  1105. // this.customFieldList.field1 = this.customCols.field1;
  1106. // } else if (this.customCols.field2 !== undefined) {
  1107. // this.customFieldList.field2 = this.customCols.field2;
  1108. // } else if (this.customCols.field3 !== undefined) {
  1109. // this.customFieldList.field3 = this.customCols.field3;
  1110. // }
  1111. },
  1112. //获取自定义的字段
  1113. getCustomColumn() {
  1114. this.http.post('/finance-tblcuscol/getAll', {companyId: this.user.companyId},
  1115. res => {
  1116. if (res.code == "ok") {
  1117. // console.log("获取自定义字段",res.data);
  1118. this.customColsi = res.data;
  1119. this.tblCols = [];
  1120. this.tblCols.push(this.customColsi.monthCost);
  1121. this.tblCols.push(this.customColsi.bonus);
  1122. this.tblCols.push(this.customColsi.allowance);
  1123. this.tblCols.push(this.customColsi.insuranceOld);
  1124. this.tblCols.push(this.customColsi.insuranceMedical);
  1125. this.tblCols.push(this.customColsi.insuranceLosejob);
  1126. this.tblCols.push(this.customColsi.insuranceInjury);
  1127. this.tblCols.push(this.customColsi.houseFund);
  1128. if (this.customColsi.field1 != null) {
  1129. this.tblCols.push(this.customColsi.field1);
  1130. }
  1131. if (this.customColsi.field2 != null) {
  1132. this.tblCols.push(this.customColsi.field2);
  1133. }
  1134. if (this.customColsi.field3 != null) {
  1135. this.tblCols.push(this.customColsi.field3);
  1136. }
  1137. }});
  1138. },
  1139. // },
  1140. // getProjects() {
  1141. // this.http.post('/finance/getProjects', {companyId: this.user.companyId, yearMonth: this.date},
  1142. // res => {
  1143. // if (res.code == "ok") {
  1144. // this.projectCols = res.data.financeProjects;
  1145. // this.allProjectList = res.data.allProjectList;
  1146. // }});
  1147. // },
  1148. // showNoProjectUsers() {
  1149. // this.showNPDialog = true;
  1150. // this.http.post('/finance/getNoProjectUsers', {yearMonth: this.date},
  1151. // res => {
  1152. // if (res.code == "ok") {
  1153. // this.npUserList = res.data;
  1154. // }});
  1155. // },
  1156. assignToProject(){
  1157. var _this = this;
  1158. this.http.post('/finance/getTimeCost', {yearMonth: this.date, assignNoProUser: this.assignNoProUser},
  1159. res => {
  1160. if (res.code == "ok") {
  1161. for(var i in res.data.costList) {
  1162. if(i>20) {
  1163. this.widthHtval = +this.widthHtval + 40
  1164. } else {
  1165. this.widthHtval = document.body.clientWidth - 230
  1166. }
  1167. }
  1168. // console.log(res.data, '图表数据', this.widthHtval)
  1169. var xList = [], yList = [], list = res.data.costList,
  1170. totalMoneyCost = res.data.totalMoneyCost;
  1171. var nopCost = 0;
  1172. if (res.data.noProjectItem.project != null) {
  1173. this.hasNoProjectUsers = true;
  1174. nopCost = res.data.noProjectItem.cost;
  1175. } else {
  1176. this.hasNoProjectUsers = false;
  1177. }
  1178. for(var i in list) {
  1179. xList.push(list[i].project);
  1180. yList.push({
  1181. "value": list[i].cost,
  1182. "id": list[i].id,
  1183. "time": list[i].workingTime
  1184. });
  1185. }
  1186. var myChart = echarts.init(document.getElementById("container"));
  1187. // 设置图表
  1188. myChart.resize({
  1189. width: this.widthHtval
  1190. })
  1191. _this.myChart = myChart;
  1192. var option = {
  1193. title: {
  1194. text: _this.assignNoProUser ? _this.$t('costintotal') + totalMoneyCost + _this.$t('yuan')
  1195. +(_this.hasNoProjectUsers?","+ _this.$t('projectpersonnelcostincluded') + nopCost + _this.$t('yuan'):"")
  1196. : _this.$t('costintotal') + totalMoneyCost + _this.$t('yuan'),
  1197. left:'left',
  1198. },
  1199. grid : {
  1200. top : 40, //距离容器上边界40像素
  1201. // bottom: 100, //距离容器下边界30像素
  1202. bottom: 40, //距离容器下边界30像素
  1203. left: 100,
  1204. right: 100
  1205. },
  1206. // 工具箱
  1207. toolbox: {
  1208. show: true,
  1209. feature:{
  1210. saveAsImage:{
  1211. show:true
  1212. },
  1213. restore:{
  1214. show:true
  1215. },
  1216. magicType:{
  1217. type:['line','bar']
  1218. },
  1219. }
  1220. },
  1221. tooltip:{
  1222. trigger:'axis',
  1223. formatter: function (params,ticket,callback) {
  1224. var res = params[0].name + "<br/>"+ _this.$t('workcost')+" : " + params[0].data.value
  1225. + _this.$t('yuan')+"<br/>"+ _this.$t('screening.workTime')+" : " + params[0].data.time + _this.$t('time.hour');
  1226. _this.params = params;
  1227. return res;
  1228. }
  1229. },
  1230. xAxis: {
  1231. data: xList,
  1232. axisLabel: {
  1233. interval:0,rotate:20
  1234. }
  1235. },
  1236. yAxis: [{
  1237. type : 'value',
  1238. axisLabel: {
  1239. formatter:'{value} ('+ _this.$t('yuan')+')'
  1240. }
  1241. }],
  1242. series: [{
  1243. name: _this.$t('screening.workTime')+'(h)',
  1244. type: 'bar',
  1245. barMaxWidth: 30,
  1246. data: yList,
  1247. }]
  1248. };
  1249. option && myChart.setOption(option,{notMerge: true});
  1250. // myChart.getZr().on('click', params => {
  1251. // const pointInPixel = [params.offsetX, params.offsetY];
  1252. // if (myChart.containPixel('grid', pointInPixel)) {
  1253. // console.log(_this.params)
  1254. // if(_this.radio=='项目') {
  1255. // _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
  1256. // }
  1257. // }
  1258. // });
  1259. } else {
  1260. this.$message({
  1261. message: res.msg,
  1262. type: "error"
  1263. });
  1264. }
  1265. },
  1266. error => {
  1267. this.$message({
  1268. message: error,
  1269. type: "error"
  1270. });
  1271. });
  1272. },
  1273. //导出财务数据
  1274. exportData() {
  1275. this.exportDataProcessing = true;
  1276. this.http.post('/finance/exportData', {
  1277. date: this.date, assignNoProUser: this.assignNoProUser, groupByCategory: this.groupByCategory
  1278. },
  1279. res => {
  1280. this.exportDataProcessing = false;
  1281. if (res.code == "ok") {
  1282. this.exportFinanceDialog = false;
  1283. var aTag = document.createElement('a');
  1284. aTag.download = this.$t('financialcoststatisticss')+".xlsx";
  1285. aTag.href = res.data;
  1286. aTag.click();
  1287. } else {
  1288. this.$message({
  1289. message: res.msg,
  1290. type: "error"
  1291. });
  1292. }
  1293. },
  1294. error => {
  1295. this.exportDataProcessing = false;
  1296. this.$message({
  1297. message: error,
  1298. type: "error"
  1299. });
  1300. });
  1301. },
  1302. getSummaries(param) {
  1303. const { columns, data } = param;
  1304. const sums = [];
  1305. columns.forEach((column, index) => {
  1306. if (index === 0) {
  1307. sums[index] = this.$t('zongjia');
  1308. return;
  1309. }
  1310. if (index === 1){
  1311. sums[index] = '';
  1312. return
  1313. }
  1314. if (index === 2 && this.user.timeType.financeJobnumEnabled == 1) {
  1315. sums[index] = '';
  1316. return;
  1317. }
  1318. const values = data.map(item => Number(item[column.property]));
  1319. if (!values.every(value => isNaN(value))) {
  1320. sums[index] = values.reduce((prev, curr) => {
  1321. const value = Number(curr);
  1322. if (!isNaN(value)) {
  1323. return prev + curr;
  1324. } else {
  1325. return prev;
  1326. }
  1327. }, 0);
  1328. sums[index] = sums[index].toFixed(2) + this.$t('yuan');
  1329. } else {
  1330. sums[index] = 'N/A';
  1331. }
  1332. });
  1333. return sums;
  1334. },
  1335. changeMonth() {
  1336. //改变月份
  1337. this.getList();
  1338. this.assignToProject();
  1339. this.getMonths()
  1340. },
  1341. // 批量导入人员
  1342. importFinance(item) {
  1343. //首先判断文件类型
  1344. let str = item.file.name.split(".");
  1345. let format = str[str.length - 1];
  1346. if (format != "xls" && format != "xlsx") {
  1347. this.$message({
  1348. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1349. type: "error"
  1350. });
  1351. } else {
  1352. this.listLoading = true;
  1353. let formData = new FormData();
  1354. formData.append("file", item.file);
  1355. formData.append("companyId", this.user.companyId);
  1356. formData.append("yearMonth", this.date);
  1357. formData.append("syncUserCost", this.importParam.syncUserCost);
  1358. formData.append("syncHistoryReport", this.importParam.syncHistoryReport);
  1359. this.isUploading = true;
  1360. let urls = ''
  1361. if(this.user.timeType.financeAudit == '1') {
  1362. urls = '/finance-import/submitImport'
  1363. } else {
  1364. urls = '/finance/importData'
  1365. }
  1366. // this.http.uploadFile('/finance/importData', formData,
  1367. this.http.uploadFile(urls, formData,
  1368. res => {
  1369. // console.log(this.user.timeType.financeAudit, '看看数据')
  1370. this.$refs.upload.clearFiles();
  1371. this.listLoading = false;
  1372. this.isUploading = false;
  1373. if (res.code == "ok") {
  1374. if (this.user.timeType.financeAudit == 1 ) {
  1375. this.$message({
  1376. message: this.$t('waiforverification'),
  1377. type: "warning"
  1378. });
  1379. this.getMonths();
  1380. } else {
  1381. this.$message({
  1382. message: this.$t('other.importSuccess'),
  1383. type: "success"
  1384. });
  1385. }
  1386. this.importDialog = false;
  1387. //重新读取列表
  1388. this.getList();
  1389. } else {
  1390. this.$message({
  1391. message: res.msg,
  1392. type: "error"
  1393. });
  1394. }
  1395. },
  1396. error => {
  1397. this.$refs.upload.clearFiles();
  1398. this.listLoading = false;
  1399. this.$message({
  1400. message: error,
  1401. type: "error"
  1402. });
  1403. });
  1404. }
  1405. },
  1406. // 导入提交审核
  1407. // submitReview(formData) {
  1408. // this.http.uploadFile(' /finance-import/submitImport', formData,
  1409. // res => {
  1410. // if (res.code == "ok") {
  1411. // console.log(res.data, '来的数据')
  1412. // } else {
  1413. // this.$message({
  1414. // message: res.msg,
  1415. // type: "error"
  1416. // });
  1417. // }
  1418. // },
  1419. // error => {
  1420. // this.$refs.upload.clearFiles();
  1421. // this.listLoading = false;
  1422. // this.$message({
  1423. // message: error,
  1424. // type: "error"
  1425. // });
  1426. // });
  1427. // },
  1428. //获取项目列表
  1429. getList() {
  1430. this.listLoading = true;
  1431. this.http.post('/finance/getByMonth', {
  1432. companyId: this.user.companyId,
  1433. yearMonth: this.date
  1434. },
  1435. res => {
  1436. this.listLoading = false;
  1437. if (res.code == "ok") {
  1438. var list = res.data;
  1439. this.allFinanceList = list;
  1440. this.noReportUserList = list.filter(r=>r.hasReport == 0);
  1441. if(this.radio == this.$t('lable.allStaff')){
  1442. this.list = this.allFinanceList;
  1443. }else{
  1444. this.list = this.noReportUserList
  1445. }
  1446. } else {
  1447. this.$message({
  1448. message: res.msg,
  1449. type: "error"
  1450. });
  1451. }
  1452. },
  1453. error => {
  1454. this.listLoading = false;
  1455. this.$message({
  1456. message: error,
  1457. type: "error"
  1458. });
  1459. });
  1460. },
  1461. // 获取当月的审核状态
  1462. getMonths() {
  1463. this.http.post('/finance-import/getStatus', {
  1464. companyId: this.user.companyId,
  1465. yearMonth: this.date
  1466. },
  1467. res => {
  1468. this.listLoading = false;
  1469. if (res.code == "ok") {
  1470. // console.log(res.data, '审核状态')
  1471. if(res.data) {
  1472. if(res.data.state == '0') {
  1473. this.revaelse = this.$t('state.WaitingAudit')
  1474. this.tabPosition = '0'
  1475. } else if(res.data.state == '1') {
  1476. this.revaelse = this.$t('Auditrecords')
  1477. this.tabPosition = '1'
  1478. }else if (res.data.state == '2') {
  1479. this.revaelse = this.$t('state.rejected')
  1480. this.tabPosition = '2'
  1481. } else if (res.data.state == '3') {
  1482. this.revaelse = this.$t('state.undone')
  1483. this.tabPosition = '-1'
  1484. }
  1485. this.getReviewList()
  1486. } else {
  1487. this.revaelse = ''
  1488. }
  1489. } else {
  1490. this.$message({
  1491. message: res.msg,
  1492. type: "error"
  1493. });
  1494. }
  1495. },
  1496. error => {
  1497. this.listLoading = false;
  1498. this.$message({
  1499. message: error,
  1500. type: "error"
  1501. });
  1502. });
  1503. },
  1504. // 获取审核列表
  1505. getReviewList() {
  1506. this.http.post('/finance-import/list', {
  1507. companyId: this.user.companyId,
  1508. },
  1509. res => {
  1510. if (res.code == "ok") {
  1511. // console.log(res.data, '拿到的数据')
  1512. this.ovReviewLis = res.data
  1513. if(this.tabPosition == 0) {
  1514. this.reviewLis = res.data.pendingList
  1515. } else if(this.tabPosition == 1) {
  1516. this.reviewLis = res.data.passList
  1517. } else if(this.tabPosition == 2) {
  1518. this.reviewLis = res.data.rejectList
  1519. } else {
  1520. this.reviewLis = res.data.cancelList
  1521. }
  1522. // console.log(this.reviewLis, '数据')
  1523. } else {
  1524. this.$message({
  1525. message: res.msg,
  1526. type: "error"
  1527. });
  1528. }
  1529. },
  1530. error => {
  1531. this.$message({
  1532. message: error,
  1533. type: "error"
  1534. });
  1535. });
  1536. },
  1537. // 操作数据
  1538. operationalData () {
  1539. var sss = this.ovReviewLis
  1540. if(this.tabPosition == 0) {
  1541. this.reviewLis = sss.pendingList
  1542. } else if(this.tabPosition == 1) {
  1543. this.reviewLis = sss.passList
  1544. } else if(this.tabPosition == 2) {
  1545. this.reviewLis = sss.rejectList
  1546. } else {
  1547. this.reviewLis = sss.cancelList
  1548. }
  1549. // console.log(this.reviewLis, '数据')
  1550. },
  1551. // 审核操作
  1552. operationList(zhi, id) {
  1553. let urls
  1554. if(zhi == 0) {
  1555. urls = '/finance-import/agree'
  1556. } else if(zhi == 1){
  1557. urls = '/finance-import/deny'
  1558. } else {
  1559. urls = '/finance-import/cancel'
  1560. }
  1561. this.http.post(urls, {
  1562. id: id,
  1563. },
  1564. res => {
  1565. if (res.code == "ok") {
  1566. this.$message({
  1567. message: this.$t('operationissuccessful'),
  1568. type: "success"
  1569. });
  1570. this.getReviewList()
  1571. } else {
  1572. this.$message({
  1573. message: res.msg,
  1574. type: "error"
  1575. });
  1576. }
  1577. },
  1578. error => {
  1579. this.$message({
  1580. message: error,
  1581. type: "error"
  1582. });
  1583. });
  1584. },
  1585. // 获取薪资上传记录
  1586. xzjl() {
  1587. this.http.post('/finance-import/list', {
  1588. companyId: this.user.companyId,
  1589. // pageIndex:1,
  1590. // pageSize: 9999
  1591. },
  1592. res => {
  1593. if (res.code == "ok") {
  1594. // console.log('123',res.data)
  1595. this.xzList = res.data.passList
  1596. } else {
  1597. this.$message({
  1598. message: res.msg,
  1599. type: "error"
  1600. });
  1601. }
  1602. },
  1603. error => {
  1604. this.$message({
  1605. message: error,
  1606. type: "error"
  1607. });
  1608. });
  1609. },
  1610. //导入分摊比例
  1611. intoAmortizationRatio(){
  1612. this.intoAmortizationDialog = true;
  1613. },
  1614. batchImportData(item) {
  1615. //首先判断文件类型
  1616. let str = item.file.name.split(".");
  1617. let format = str[str.length - 1];
  1618. if (format != "xls" && format != "xlsx") {
  1619. this.$message({
  1620. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1621. type: "error"
  1622. });
  1623. } else {
  1624. this.importingData = true;
  1625. let formData = new FormData();
  1626. formData.append("file", item.file);
  1627. formData.append("companyId", this.user.companyId);
  1628. formData.append('ymonth',this.date)
  1629. this.http.uploadFile('/project-percentage/importData', formData,
  1630. res => {
  1631. this.$refs.upload.clearFiles();
  1632. this.importingData = false;
  1633. this.showImportResult = true;
  1634. if (res.code == "ok") {
  1635. //换成弹出框,以免有人等了半天回来啥也没看到
  1636. this.importResultMsg = this.$t('other.importSuccess')+res.data+this.$t('apportionmentratiodata')+'。'+(res.msg?res.msg:"");
  1637. this.showSettingDialog();
  1638. } else {
  1639. this.importResultMsg = this.$t('export.Importfailure')+":"+res.msg;
  1640. }
  1641. },
  1642. error => {
  1643. this.$refs.upload.clearFiles();
  1644. this.importingData = false;
  1645. this.$message({
  1646. message: error,
  1647. type: "error"
  1648. });
  1649. });
  1650. }
  1651. },
  1652. // 左右滚动
  1653. scrollFunction () {
  1654. this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div
  1655. if (this.domObj.attachEvent) { // IE
  1656. this.domObj.attachEvent('onmousewheel', this.mouseScroll)
  1657. } else if (this.domObj.addEventListener) {
  1658. this.domObj.addEventListener('DOMMouseScroll', this.mouseScroll, false)
  1659. }
  1660. this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll
  1661. },
  1662. mouseScroll(event) { // google 浏览器下
  1663. let detail = event.wheelDelta || event.detail
  1664. let moveForwardStep = -1
  1665. let moveBackStep = 1
  1666. let step = 0
  1667. step = detail > 0 ? moveForwardStep * 100 : moveBackStep * 100
  1668. event.preventDefault() // 阻止浏览器默认事件
  1669. this.domObj.scrollLeft = this.domObj.scrollLeft + step
  1670. },
  1671. // 自定义组件事件
  1672. selectCal(obj) {
  1673. if(obj.distinction == '1') {
  1674. this.reviewerRuleForm.auditorId = obj.id
  1675. } else if(obj.distinction == '2') {
  1676. this.chosenNoReportUserIds = obj.id
  1677. }
  1678. }
  1679. },
  1680. created() {
  1681. var d = new Date();
  1682. this.date = d.getFullYear() +'-'+ ((d.getMonth()+1) < 10? '0'+(d.getMonth()+1):d.getMonth()+1);
  1683. },
  1684. mounted() {
  1685. let height = window.innerHeight;
  1686. this.tableHeight = height - 245;
  1687. const that = this;
  1688. window.onresize = function temp() {
  1689. that.tableHeight = window.innerHeight - 245;
  1690. };
  1691. this.getCustomColumn();
  1692. this.getList();
  1693. // this.getProjects();
  1694. this.addreviewer();
  1695. this.arrter()
  1696. this.getMonths()
  1697. this.scrollFunction()
  1698. },
  1699. updated() {
  1700. this.$nextTick(() => {
  1701. this.$refs['table'].doLayout();
  1702. })
  1703. }
  1704. };
  1705. </script>
  1706. <style lang="scss" scoped>
  1707. .nameList {
  1708. height: 400px;
  1709. overflow: auto;
  1710. }
  1711. </style>