finance.vue 89 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751
  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 type="primary" style="margin-left:5px;" :underline="false" :href="'./upload/'+$t('allocationImporttemplates')+'.xlsx'" :download="$t('allocationImporttemplates') + '.xlsx'">{{$t('allocationImporttemplates')+'.xlsx'}}</el-link>
  465. </p>
  466. <p>{{'2.' + $t('other.projectsAndPeopleInThetemplate') }}</p>
  467. <p style="display: flex;justify-content: center;padding:1em 0">
  468. <el-upload ref="upload" action="#" :limit="1" :http-request="batchImportData" :show-file-list="false">
  469. <el-button type="primary" :underline="false" :loading="importingData">{{ $t('other.startImporting') }}</el-button>
  470. </el-upload>
  471. </p>
  472. </el-dialog>
  473. <el-dialog :title="$t('eachitemofemployeecost')" show-header="false" v-if="setPercentDialog" :visible.sync="setPercentDialog"
  474. :close-on-click-modal="false" customClass="customWidth" width="600px" >
  475. <div style="margin:0px 10px 10px 10px;">
  476. <span>{{ $t('Selecttheemployee') }}</span>
  477. <el-select v-if="user.userNameNeedTranslate != '1'" v-model="chosenNoReportUserIds" multiple filterable clearable style="width:330px;" collapse-tags>
  478. <el-option v-for="item in noReportUserList" :label="item.name" :key="item.id" :value="item.userId"></el-option>
  479. </el-select>
  480. <selectCat v-if="user.userNameNeedTranslate == '1'" @selectCal="selectCal" :subject="noReportUserList" :subjectId="chosenNoReportUserIds" :distinction="'2'" :size="'small'"></selectCat>
  481. <el-button @click="averageCost" >{{ $t('Automaticallocation') }}</el-button>
  482. </div>
  483. <el-divider ></el-divider>
  484. <!--项目列表 -->
  485. <el-form v-model="curPercentVal" label-width="365px" style="margin-top:10px;">
  486. <div class="nameList">
  487. <el-form-item v-for="item in projectCols" :label="item.projectName" :key="item.projectId" >
  488. {{ $t('Accountedfor') + ':' }}<el-input v-model="curPercentVal[item.projectId]" style="width:100px;" @input="updatePercentValue"></el-input>&nbsp;%
  489. </el-form-item>
  490. </div>
  491. <el-form-item >
  492. {{ $t('totalpercentage') + ':' }}{{totalPercent}}&nbsp;%
  493. </el-form-item>
  494. </el-form>
  495. <div slot="footer" class="dialog-footer">
  496. <el-button type="default" @click="setPercentDialog = false" >{{ $t('Shutdown') }}</el-button>
  497. <el-button type="primary" @click="setPercentSetting()" >{{ $t('btn.determine') }}</el-button>
  498. </div>
  499. </el-dialog>
  500. <!-- 导入结果说明 -->
  501. <el-dialog :title="$t('importingtheallocationratio')" v-if="showImportResult" :visible.sync="showImportResult" customClass="customWidth" width="500px">
  502. <div>
  503. <span>{{importResultMsg}}</span>
  504. </div>
  505. <span slot="footer" class="dialog-footer">
  506. <el-button type="primary" @click="showImportResult=false">{{ $t('btn.determine') }}</el-button>
  507. </span>
  508. </el-dialog>
  509. <el-dialog :title="$t('AmortizedDataExport')" v-if="exportFinanceDialog" :visible.sync="exportFinanceDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
  510. <div style="margin:30px;">
  511. <el-radio-group v-model="groupByCategory" >
  512. <el-radio :label="0">{{ $t('Exportbyproject') }}</el-radio>
  513. <el-radio :label="1">{{ $t('Exportbprojectcategory') }}</el-radio>
  514. </el-radio-group>
  515. </div>
  516. <div slot="footer" class="dialog-footer">
  517. <el-button @click="exportData" :loading="exportDataProcessing" type="primary">{{ $t('export.export') }}</el-button>
  518. </div>
  519. </el-dialog>
  520. </section>
  521. </template>
  522. <style scoped>
  523. .line {
  524. padding:10px;
  525. }
  526. .line span{
  527. font-size:18px;
  528. }
  529. .line span:nth-child(even){
  530. float:right;
  531. }
  532. </style>
  533. <style>
  534. .customWidth .el-dialog__body{
  535. padding-top: 0;
  536. padding-bottom: 0;
  537. }
  538. </style>
  539. <script>
  540. import { error } from 'dingtalk-jsapi';
  541. import util from "../../common/js/util";
  542. // 自定义select组件
  543. import selectCat from "@/components/select.vue"
  544. export default {
  545. components: {
  546. selectCat
  547. },
  548. data() {
  549. return {
  550. groupByCategory:0,
  551. exportFinanceDialog:false,
  552. exportMonth:null,
  553. exportDialog:false,
  554. headerCols:['monthCost','bonus', 'allowance', 'insuranceOld', 'insuranceMedical', 'insuranceLosejob', 'insuranceInjury', 'houseFund', 'customField1','customField2','customField3'],
  555. tblCols:[],
  556. costListRadio: 0,
  557. costSettingLoading: false,
  558. chosenNoReportUserIds:[],
  559. curPercentVal:{},
  560. setPercentDialog: false,
  561. chosenProjects:[],
  562. projectsDialog: false,
  563. projectCols:[],
  564. allProjectList:[],
  565. multipleSelection:[],
  566. userCostSettingList: [],
  567. settingDialog: false,
  568. radio:this.$t('lable.allStaff'),
  569. noReportUserList:[],
  570. allFinanceList:[],
  571. assignNoProUser: false,
  572. customFieldList:[],
  573. itemDialog: false,
  574. customCols:{},
  575. customColsi:{},
  576. // showNPDialog: false,
  577. npUserList:[],
  578. hasNoProjectUsers: false,
  579. isUploading:false,
  580. importDialog: false,
  581. importParam:{syncUserCost:true, syncHistoryReport:true},
  582. user: JSON.parse(sessionStorage.getItem("user")),
  583. permissions: JSON.parse(sessionStorage.getItem("permissions")),
  584. userDetailVisible: false,
  585. userDetail:{},
  586. date: null,
  587. tableHeight: 0,
  588. listLoading: false,
  589. list: [],
  590. addLoading: false,
  591. myChart: null,
  592. params: null,
  593. totalPercent:0,
  594. importVisible: false,
  595. shenhe: '',
  596. tabPosition: '0',
  597. reviewerVisible: false,
  598. reviewerRuleForm: {
  599. auditorId: ''
  600. },
  601. people: [],
  602. revaelse: '',
  603. reviewLis: [],
  604. ovReviewLis: [],
  605. xzImportVisible: false,
  606. xzList: [],
  607. intoAmortizationDialog : false ,
  608. importingData: false,
  609. importResultMsg:null,
  610. showImportResult:false,
  611. widthHtval: document.body.clientWidth - 230,
  612. deleteSelList: [],
  613. chosenProjectsChecked: false
  614. };
  615. },
  616. methods: {
  617. uploadTest(){
  618. this.http.post('/report/uploadThirdReportData',{
  619. yearMonth: this.date
  620. },res => {
  621. if(res.code == 'ok'){
  622. this.$message({
  623. message: '上传成功',
  624. type: 'success'
  625. })
  626. }else{
  627. this.$message({
  628. message: res.msg,
  629. type: 'error'
  630. })
  631. }
  632. },err => {
  633. this.$message({
  634. message: er,
  635. type: 'error'
  636. })
  637. })
  638. },
  639. chosenProjectsCheckedClick() {
  640. console.log(this.chosenProjects, '数据')
  641. if(this.chosenProjectsChecked) {
  642. let arr = []
  643. for(let i in this.allProjectList) {
  644. arr.push(this.allProjectList[i].id)
  645. }
  646. this.chosenProjects = arr
  647. } else {
  648. this.chosenProjects = []
  649. }
  650. },
  651. deleteSel(sel){
  652. this.deleteSelList = sel
  653. // console.log(sel);
  654. },
  655. deleteUsers(){
  656. this.$confirm(this.$t(this.$t('doyouwanttodeleteit')),this.$t('other.prompts'),{
  657. confirmButtonText: this.$t('btn.determine'),
  658. cancelButtonText: this.$t('btn.cancel'),
  659. type: 'warning'
  660. }).then(()=>{
  661. let ids = ''
  662. for(let i in this.deleteSelList){
  663. ids += this.deleteSelList[i].id + ','
  664. }
  665. ids = ids.substring(0,ids.length - 1)
  666. this.http.post('/finance/batchRemove',{
  667. ids: ids
  668. },res => {
  669. if(res.code == 'ok'){
  670. this.getList()
  671. this.$message({
  672. message: this.$t('message.successfullyDeleted'),
  673. type: 'success'
  674. })
  675. }else {
  676. this.$message({
  677. message: res.msg,
  678. type: 'error'
  679. })
  680. }
  681. },err => {
  682. this.$message({
  683. message: err,
  684. type: 'error'
  685. })
  686. })
  687. }).catch(()=>{
  688. this.$message({
  689. type: 'info',
  690. message: this.$t('thedeletionhasbeencancelled')
  691. })
  692. })
  693. },
  694. exportFinance() {
  695. this.isUploading = true;
  696. this.http.post('/finance/exportFinance', {
  697. date: this.exportMonth
  698. },res =>{
  699. this.isUploading = false;
  700. if(res.code == 'ok') {
  701. this.downloadByA({name:this.exportMonth+this.$t('financialdata') + '.xls', url: res.data});
  702. }
  703. },error => {
  704. this.$message({
  705. message: error,
  706. type: "error"
  707. });
  708. })
  709. },
  710. arrter() {
  711. this.http.post('/user/getEmployeeList', {
  712. departmentId: '-1',
  713. pageIndex: 1,
  714. // pageSize: 99999
  715. pageSize: -1
  716. },res =>{
  717. if(res.code == 'ok') {
  718. this.people = res.data.records
  719. }
  720. },error => {
  721. this.$message({
  722. message: error,
  723. type: "error"
  724. });
  725. })
  726. },
  727. addreviewer() {
  728. this.http.post('/finance-auditor/get', {
  729. companyId: this.user.companyId
  730. },
  731. res => {
  732. if (res.code == "ok") {
  733. // console.log(res.data, '数据')
  734. if(res.data) {
  735. this.reviewerRuleForm.auditorId = res.data.auditorId
  736. } else {
  737. this.reviewerRuleForm.auditorId = ''
  738. }
  739. }
  740. },error => {
  741. this.$message({
  742. message: error,
  743. type: "error"
  744. });
  745. }
  746. );
  747. },
  748. // 提交审核人
  749. submitreviewerRuleForm(formName) {
  750. this.$refs[formName].validate((valid) => {
  751. if (valid) {
  752. this.reviewerRuleForm.companyId = this.user.companyId
  753. this.http.post('/finance-auditor/save', this.reviewerRuleForm,
  754. res =>{
  755. if(res.code == 'ok') {
  756. this.$message({
  757. message: this.$t('operationissuccessful'),
  758. type: "success"
  759. });
  760. this.addreviewer()
  761. } else {
  762. this.$message({
  763. message: this.$t('operationfailure'),
  764. type: "error"
  765. });
  766. }
  767. },error => {
  768. this.$message({
  769. message: error,
  770. type: "error"
  771. });
  772. })
  773. this.reviewerVisible = false
  774. } else {
  775. return false;
  776. }
  777. });
  778. },
  779. handleCloses(done) {
  780. var formName = 'reviewerRuleForm'
  781. this.$refs[formName].resetFields();
  782. done()
  783. },
  784. // 审核
  785. audits() {
  786. this.shenhe = this.$t('importtheaudits')
  787. this.importVisible = true
  788. },
  789. switchCostList() {
  790. //已填日报的人员成本
  791. if (this.costListRadio == 1) {
  792. this.assignNoProUser=false;
  793. this.assignToProject();
  794. } else if (this.costListRadio == 2) {
  795. //全部人员成本
  796. this.assignNoProUser=true;
  797. this.assignToProject();
  798. }
  799. },
  800. getLastMonthSetting() {
  801. this.costSettingLoading = true;
  802. var dataArr = this.date.split('-');
  803. var year = dataArr[0];
  804. var month = dataArr[1];
  805. if (parseInt(month) == 1) {
  806. year = parseInt(year) -1;
  807. month = 12;
  808. } else {
  809. month = parseInt(month) -1;
  810. if (month < 10) {
  811. month = '0'+month;
  812. }
  813. }
  814. var lastMonth = year + '-' + month;
  815. this.http.post('/project-percentage/getMonthSetting', {ymonth: lastMonth},
  816. res => {
  817. this.costSettingLoading = false;
  818. if (res.code == "ok") {
  819. this.projectCols = res.data.financeProjects;
  820. this.allProjectList = res.data.allProjectList;
  821. this.userCostSettingList = res.data.userCostSetting;
  822. //上次如果没有配置过,需要初始化
  823. for (var i=0;i<this.noReportUserList.length; i++) {
  824. var rUser = this.noReportUserList[i];
  825. //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
  826. if (this.userCostSettingList.filter(c=>c.id == rUser.userId).length == 0) {
  827. var item = {name: rUser.name, id: rUser.userId};
  828. this.projectCols.forEach(p=>{
  829. item[p.projectId] = 0;
  830. });
  831. this.userCostSettingList.push(item);
  832. }
  833. }
  834. this.$nextTick(()=>{
  835. this.$refs.settingTable.doLayout();
  836. })
  837. } });
  838. },
  839. //获取当月的无项目工时人员的分配比例设置
  840. getMonthSetting() {
  841. this.costSettingLoading = true;
  842. this.http.post('/project-percentage/getMonthSetting', {ymonth: this.date},
  843. res => {
  844. this.costSettingLoading = false;
  845. if (res.code == "ok") {
  846. this.projectCols = res.data.financeProjects;
  847. this.allProjectList = res.data.allProjectList;
  848. this.userCostSettingList = res.data.userCostSetting;
  849. //上次如果没有配置过,需要初始化
  850. for (var i=0;i<this.noReportUserList.length; i++) {
  851. var rUser = this.noReportUserList[i];
  852. // console.log('userId====='+rUser.userId);
  853. //检查当前列表中的无项目人员是否在之前的里面存在,如果不在需要加上去
  854. if (this.userCostSettingList.filter(c=>c.id == rUser.userId).length == 0) {
  855. var item = {name: rUser.name, id: rUser.userId};
  856. this.projectCols.forEach(p=>{
  857. item[p.projectId] = 0;
  858. });
  859. this.userCostSettingList.push(item);
  860. }
  861. }
  862. this.$nextTick(()=>{
  863. this.$refs.settingTable.doLayout();
  864. })
  865. } });
  866. },
  867. //提交无工时人员的分配设置
  868. saveMonthSetting() {
  869. //检查数据是否都分配到100%了,防止由于修改了项目列而导致之前的数据不正确的情况
  870. var errorList = this.userCostSettingList.filter(u=>{
  871. let totalPercent = 0.0;
  872. this.projectCols.forEach(p=>{
  873. totalPercent += parseFloat(u[p.projectId]);
  874. });
  875. totalPercent = totalPercent.toFixed(1);
  876. if (totalPercent != 100) {
  877. return true;
  878. } else {
  879. return false;
  880. }
  881. });
  882. if (errorList.length > 0) {
  883. var nameList = errorList.map(e=>e.name);
  884. this.$message({type:'error', message:this.$t('proportionofassignedpersonnelisnot ')+'100%:'+nameList});
  885. return;
  886. }
  887. this.http.post('/project-percentage/saveMonthSetting', {projectCols: JSON.stringify(this.projectCols),
  888. ymonth: this.date, userSettings: JSON.stringify(this.userCostSettingList)},
  889. res => {
  890. if (res.code == "ok") {
  891. this.$message({type:'success', message:this.$t('savesuccess')});
  892. this.settingDialog = false;
  893. } else {
  894. this.$message({type:'error', message:this.$t('erroroccurred')+':'+res.msg});
  895. }});
  896. },
  897. updatePercentValue() {
  898. var total = 0.0;
  899. this.projectCols.forEach(p=>{
  900. total += parseFloat(this.curPercentVal[p.projectId]);
  901. })
  902. this.totalPercent = total.toFixed(1);
  903. this.$forceUpdate();
  904. },
  905. averageCost() {
  906. var avg = (100/this.projectCols.length).toFixed(1);
  907. //最后一个用100减去前面的总和,保证最终合计为100
  908. for (var i=0;i<this.projectCols.length; i++) {
  909. if (i < this.projectCols.length -1) {
  910. this.curPercentVal[this.projectCols[i].projectId] = avg;
  911. } else {
  912. this.curPercentVal[this.projectCols[i].projectId] = (100-avg*(this.projectCols.length-1)).toFixed(1);
  913. }
  914. }
  915. this.updatePercentValue();
  916. this.$forceUpdate();
  917. },
  918. setPercent(isBatch, row) {
  919. this.setPercentDialog = true;
  920. this.chosenNoReportUserIds = [];
  921. if (!isBatch) {
  922. this.chosenNoReportUserIds.push(row.id);
  923. //获取当前比例
  924. this.projectCols.forEach(p=>{
  925. this.curPercentVal[p.projectId] = row[p.projectId];
  926. });
  927. } else {
  928. //批量处理
  929. this.multipleSelection.forEach(m=>{
  930. this.chosenNoReportUserIds.push(m.id);
  931. })
  932. //批量时获取第一条的比例进行加载
  933. this.projectCols.forEach(p=>{
  934. this.curPercentVal[p.projectId] = this.multipleSelection[0][p.projectId];
  935. });
  936. }
  937. this.updatePercentValue();
  938. },
  939. //确认设置的项目列
  940. saveProjectSetting() {
  941. this.projectsDialog = false;
  942. this.projectCols = [];
  943. this.chosenProjects.forEach(c=>{
  944. var item = this.allProjectList.filter(a=>a.id == c)[0];
  945. this.projectCols.push({projectId: item.id, projectName: item.projectName, projectCode: item.projectCode});
  946. });
  947. this.$nextTick(()=>{
  948. this.$refs.settingTable.doLayout();
  949. })
  950. },
  951. handleProjectSelectionChange(val) {
  952. this.projectSelection = val;
  953. },
  954. showSelectProjectDialog() {
  955. //设置选中状态
  956. this.chosenProjects = [];
  957. this.chosenProjectsChecked = false
  958. this.projectCols.forEach(item=>{
  959. this.chosenProjects.push(item.projectId);
  960. })
  961. this.projectsDialog = true;
  962. },
  963. setPercentSetting() {
  964. //检测是否填写的情况下,是否达到100%
  965. if (this.totalPercent != 100) {
  966. this.$message({
  967. message: this.$t('sumoftheallocationsmustbe'),
  968. type: "error"
  969. });
  970. return;
  971. }
  972. this.setPercentDialog = false;
  973. this.chosenNoReportUserIds.forEach(u=>{
  974. var targetU = this.userCostSettingList.filter(a=>a.id == u)[0];
  975. //遍历项目
  976. this.projectCols.forEach(p=>{
  977. targetU[p.projectId] = this.curPercentVal[p.projectId];
  978. })
  979. });
  980. this.userCostSettingList.splice(1,0);
  981. },
  982. showSettingDialog() {
  983. this.settingDialog = true;
  984. this.getMonthSetting();
  985. },
  986. handleSelectionChange(val) {
  987. this.multipleSelection = val;
  988. },
  989. switchList() {
  990. if (this.radio == this.$t('lable.allStaff')) {
  991. this.list = this.allFinanceList;
  992. } else {
  993. this.list = this.noReportUserList;
  994. }
  995. },
  996. downloadByA(row) {
  997. const a = document.createElement('a'); // 创建a标签
  998. a.setAttribute('download', row.name);// download属性
  999. // console.log(row.url);
  1000. if (row.url.indexOf('upload/') == -1) {
  1001. row.url = '/upload/' +row.url;
  1002. }
  1003. a.setAttribute('href', row.url);// href链接
  1004. a.click();// 自执行点击事件
  1005. a.remove();
  1006. },
  1007. getTemplate() {
  1008. this.http.post('/finance/getTemplate', {companyId: this.user.companyId},
  1009. res => {
  1010. if (res.code == "ok") {
  1011. if (res.data.indexOf('xlsx') > 0) {
  1012. this.downloadByA({name:this.$t('financialcoststatement')+ '.xlsx', url:res.data});
  1013. } else {
  1014. this.downloadByA({name:this.$t('financialcoststatement')+ '.xls', url:res.data});
  1015. }
  1016. }});
  1017. },
  1018. saveItems() {
  1019. // let savefields = {
  1020. // monthCost : this.customCols.monthCost,
  1021. // bonus : this.customCols.bonus,
  1022. // allowance : this.customCols.allowance,
  1023. // insuranceOld : this.customCols.insuranceOld,
  1024. // insuranceMedical : this.customCols.insuranceMedical,
  1025. // insuranceLosejob : this.customCols.insuranceLosejob,
  1026. // insuranceInjury : this.customCols.insuranceInjury,
  1027. // houseFund : this.customCols.houseFund,
  1028. // field1 : this.customCols.field1,
  1029. // field2 : this.customCols.field2,
  1030. // field3 : this.customCols.field3
  1031. // }
  1032. if(this.customCols.field1 != null && this.customCols.field1 != ''){
  1033. if(this.customCols.field1Calculate == null){
  1034. this.$message({
  1035. message: this.$t('choosewhethertoincludethetotalcost'),
  1036. type: 'warning'
  1037. })
  1038. return
  1039. }
  1040. }
  1041. if(this.customCols.field2 != null && this.customCols.field2 != ''){
  1042. if(this.customCols.field1Calculate == null){
  1043. this.$message({
  1044. message: this.$t('choosewhethertoincludethetotalcost'),
  1045. type: 'warning'
  1046. })
  1047. return
  1048. }
  1049. }
  1050. if(this.customCols.field3 != null && this.customCols.field3 != ''){
  1051. if(this.customCols.field1Calculate == null){
  1052. this.$message({
  1053. message: this.$t('choosewhethertoincludethetotalcost'),
  1054. type: 'warning'
  1055. })
  1056. return
  1057. }
  1058. }
  1059. this.http.post('/finance-tblcuscol/save', this.customCols,
  1060. res => {
  1061. if (res.code == "ok") {
  1062. this.itemDialog = false;
  1063. this.getCustomColumn();
  1064. }});
  1065. this.$forceUpdate();
  1066. },
  1067. showItemDialog() {
  1068. // console.log(this.customColsi, '后台纯的')
  1069. // console.log(this.customCols, '用来编辑的')
  1070. this.customCols = JSON.parse(JSON.stringify(this.customColsi))
  1071. // console.log(this.customColsi, '后台纯的')
  1072. // console.log(this.customCols, '用来编辑的')
  1073. this.itemDialog = true;
  1074. // this.customFieldList = {field1:null,field2:null, field3:null};
  1075. // if (this.customCols.field1 !== undefined) {
  1076. // this.customFieldList.field1 = this.customCols.field1;
  1077. // } else if (this.customCols.field2 !== undefined) {
  1078. // this.customFieldList.field2 = this.customCols.field2;
  1079. // } else if (this.customCols.field3 !== undefined) {
  1080. // this.customFieldList.field3 = this.customCols.field3;
  1081. // }
  1082. },
  1083. //获取自定义的字段
  1084. getCustomColumn() {
  1085. this.http.post('/finance-tblcuscol/getAll', {companyId: this.user.companyId},
  1086. res => {
  1087. if (res.code == "ok") {
  1088. // console.log("获取自定义字段",res.data);
  1089. this.customColsi = res.data;
  1090. this.tblCols = [];
  1091. this.tblCols.push(this.customColsi.monthCost);
  1092. this.tblCols.push(this.customColsi.bonus);
  1093. this.tblCols.push(this.customColsi.allowance);
  1094. this.tblCols.push(this.customColsi.insuranceOld);
  1095. this.tblCols.push(this.customColsi.insuranceMedical);
  1096. this.tblCols.push(this.customColsi.insuranceLosejob);
  1097. this.tblCols.push(this.customColsi.insuranceInjury);
  1098. this.tblCols.push(this.customColsi.houseFund);
  1099. if (this.customColsi.field1 != null) {
  1100. this.tblCols.push(this.customColsi.field1);
  1101. }
  1102. if (this.customColsi.field2 != null) {
  1103. this.tblCols.push(this.customColsi.field2);
  1104. }
  1105. if (this.customColsi.field3 != null) {
  1106. this.tblCols.push(this.customColsi.field3);
  1107. }
  1108. }});
  1109. },
  1110. // },
  1111. // getProjects() {
  1112. // this.http.post('/finance/getProjects', {companyId: this.user.companyId, yearMonth: this.date},
  1113. // res => {
  1114. // if (res.code == "ok") {
  1115. // this.projectCols = res.data.financeProjects;
  1116. // this.allProjectList = res.data.allProjectList;
  1117. // }});
  1118. // },
  1119. // showNoProjectUsers() {
  1120. // this.showNPDialog = true;
  1121. // this.http.post('/finance/getNoProjectUsers', {yearMonth: this.date},
  1122. // res => {
  1123. // if (res.code == "ok") {
  1124. // this.npUserList = res.data;
  1125. // }});
  1126. // },
  1127. assignToProject(){
  1128. var _this = this;
  1129. this.http.post('/finance/getTimeCost', {yearMonth: this.date, assignNoProUser: this.assignNoProUser},
  1130. res => {
  1131. if (res.code == "ok") {
  1132. for(var i in res.data.costList) {
  1133. if(i>20) {
  1134. this.widthHtval = +this.widthHtval + 40
  1135. } else {
  1136. this.widthHtval = document.body.clientWidth - 230
  1137. }
  1138. }
  1139. // console.log(res.data, '图表数据', this.widthHtval)
  1140. var xList = [], yList = [], list = res.data.costList,
  1141. totalMoneyCost = res.data.totalMoneyCost;
  1142. var nopCost = 0;
  1143. if (res.data.noProjectItem.project != null) {
  1144. this.hasNoProjectUsers = true;
  1145. nopCost = res.data.noProjectItem.cost;
  1146. } else {
  1147. this.hasNoProjectUsers = false;
  1148. }
  1149. for(var i in list) {
  1150. xList.push(list[i].project);
  1151. yList.push({
  1152. "value": list[i].cost,
  1153. "id": list[i].id,
  1154. "time": list[i].workingTime
  1155. });
  1156. }
  1157. var myChart = echarts.init(document.getElementById("container"));
  1158. // 设置图表
  1159. myChart.resize({
  1160. width: this.widthHtval
  1161. })
  1162. _this.myChart = myChart;
  1163. var option = {
  1164. title: {
  1165. text: _this.assignNoProUser ? _this.$t('costintotal') + totalMoneyCost + _this.$t('yuan')
  1166. +(_this.hasNoProjectUsers?","+ _this.$t('projectpersonnelcostincluded') + nopCost + _this.$t('yuan'):"")
  1167. : _this.$t('costintotal') + totalMoneyCost + _this.$t('yuan'),
  1168. left:'left',
  1169. },
  1170. grid : {
  1171. top : 40, //距离容器上边界40像素
  1172. // bottom: 100, //距离容器下边界30像素
  1173. bottom: 40, //距离容器下边界30像素
  1174. left: 100,
  1175. right: 100
  1176. },
  1177. // 工具箱
  1178. toolbox: {
  1179. show: true,
  1180. feature:{
  1181. saveAsImage:{
  1182. show:true
  1183. },
  1184. restore:{
  1185. show:true
  1186. },
  1187. magicType:{
  1188. type:['line','bar']
  1189. },
  1190. }
  1191. },
  1192. tooltip:{
  1193. trigger:'axis',
  1194. formatter: function (params,ticket,callback) {
  1195. var res = params[0].name + "<br/>"+ _this.$t('workcost')+" : " + params[0].data.value
  1196. + _this.$t('yuan')+"<br/>"+ _this.$t('screening.workTime')+" : " + params[0].data.time + _this.$t('time.hour');
  1197. _this.params = params;
  1198. return res;
  1199. }
  1200. },
  1201. xAxis: {
  1202. data: xList,
  1203. axisLabel: {
  1204. interval:0,rotate:20
  1205. }
  1206. },
  1207. yAxis: [{
  1208. type : 'value',
  1209. axisLabel: {
  1210. formatter:'{value} ('+ _this.$t('yuan')+')'
  1211. }
  1212. }],
  1213. series: [{
  1214. name: _this.$t('screening.workTime')+'(h)',
  1215. type: 'bar',
  1216. barMaxWidth: 30,
  1217. data: yList,
  1218. }]
  1219. };
  1220. option && myChart.setOption(option,{notMerge: true});
  1221. // myChart.getZr().on('click', params => {
  1222. // const pointInPixel = [params.offsetX, params.offsetY];
  1223. // if (myChart.containPixel('grid', pointInPixel)) {
  1224. // console.log(_this.params)
  1225. // if(_this.radio=='项目') {
  1226. // _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
  1227. // }
  1228. // }
  1229. // });
  1230. } else {
  1231. this.$message({
  1232. message: res.msg,
  1233. type: "error"
  1234. });
  1235. }
  1236. },
  1237. error => {
  1238. this.$message({
  1239. message: error,
  1240. type: "error"
  1241. });
  1242. });
  1243. },
  1244. //导出财务数据
  1245. exportData() {
  1246. this.exportDataProcessing = true;
  1247. this.http.post('/finance/exportData', {
  1248. date: this.date, assignNoProUser: this.assignNoProUser, groupByCategory: this.groupByCategory
  1249. },
  1250. res => {
  1251. this.exportDataProcessing = false;
  1252. if (res.code == "ok") {
  1253. this.exportFinanceDialog = false;
  1254. var aTag = document.createElement('a');
  1255. aTag.download = this.$t('financialcoststatisticss')+".xls";
  1256. aTag.href = res.data;
  1257. aTag.click();
  1258. } else {
  1259. this.$message({
  1260. message: res.msg,
  1261. type: "error"
  1262. });
  1263. }
  1264. },
  1265. error => {
  1266. this.listLoading = false;
  1267. this.$message({
  1268. message: error,
  1269. type: "error"
  1270. });
  1271. });
  1272. },
  1273. getSummaries(param) {
  1274. const { columns, data } = param;
  1275. const sums = [];
  1276. columns.forEach((column, index) => {
  1277. if (index === 0) {
  1278. sums[index] = this.$t('zongjia');
  1279. return;
  1280. }
  1281. if (index === 1){
  1282. sums[index] = '';
  1283. return
  1284. }
  1285. if (index === 2 && this.user.timeType.financeJobnumEnabled == 1) {
  1286. sums[index] = '';
  1287. return;
  1288. }
  1289. const values = data.map(item => Number(item[column.property]));
  1290. if (!values.every(value => isNaN(value))) {
  1291. sums[index] = values.reduce((prev, curr) => {
  1292. const value = Number(curr);
  1293. if (!isNaN(value)) {
  1294. return prev + curr;
  1295. } else {
  1296. return prev;
  1297. }
  1298. }, 0);
  1299. sums[index] = sums[index].toFixed(2) + this.$t('yuan');
  1300. } else {
  1301. sums[index] = 'N/A';
  1302. }
  1303. });
  1304. return sums;
  1305. },
  1306. changeMonth() {
  1307. //改变月份
  1308. this.getList();
  1309. this.assignToProject();
  1310. this.getMonths()
  1311. },
  1312. // 批量导入人员
  1313. importFinance(item) {
  1314. //首先判断文件类型
  1315. let str = item.file.name.split(".");
  1316. let format = str[str.length - 1];
  1317. if (format != "xls" && format != "xlsx") {
  1318. this.$message({
  1319. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1320. type: "error"
  1321. });
  1322. } else {
  1323. this.listLoading = true;
  1324. let formData = new FormData();
  1325. formData.append("file", item.file);
  1326. formData.append("companyId", this.user.companyId);
  1327. formData.append("yearMonth", this.date);
  1328. formData.append("syncUserCost", this.importParam.syncUserCost);
  1329. formData.append("syncHistoryReport", this.importParam.syncHistoryReport);
  1330. this.isUploading = true;
  1331. let urls = ''
  1332. if(this.user.timeType.financeAudit == '1') {
  1333. urls = '/finance-import/submitImport'
  1334. } else {
  1335. urls = '/finance/importData'
  1336. }
  1337. // this.http.uploadFile('/finance/importData', formData,
  1338. this.http.uploadFile(urls, formData,
  1339. res => {
  1340. // console.log(this.user.timeType.financeAudit, '看看数据')
  1341. this.$refs.upload.clearFiles();
  1342. this.listLoading = false;
  1343. this.isUploading = false;
  1344. if (res.code == "ok") {
  1345. if (this.user.timeType.financeAudit == 1 ) {
  1346. this.$message({
  1347. message: this.$t('waiforverification'),
  1348. type: "warning"
  1349. });
  1350. this.getMonths();
  1351. } else {
  1352. this.$message({
  1353. message: this.$t('other.importSuccess'),
  1354. type: "success"
  1355. });
  1356. }
  1357. this.importDialog = false;
  1358. //重新读取列表
  1359. this.getList();
  1360. } else {
  1361. this.$message({
  1362. message: res.msg,
  1363. type: "error"
  1364. });
  1365. }
  1366. },
  1367. error => {
  1368. this.$refs.upload.clearFiles();
  1369. this.listLoading = false;
  1370. this.$message({
  1371. message: error,
  1372. type: "error"
  1373. });
  1374. });
  1375. }
  1376. },
  1377. // 导入提交审核
  1378. // submitReview(formData) {
  1379. // this.http.uploadFile(' /finance-import/submitImport', formData,
  1380. // res => {
  1381. // if (res.code == "ok") {
  1382. // console.log(res.data, '来的数据')
  1383. // } else {
  1384. // this.$message({
  1385. // message: res.msg,
  1386. // type: "error"
  1387. // });
  1388. // }
  1389. // },
  1390. // error => {
  1391. // this.$refs.upload.clearFiles();
  1392. // this.listLoading = false;
  1393. // this.$message({
  1394. // message: error,
  1395. // type: "error"
  1396. // });
  1397. // });
  1398. // },
  1399. //获取项目列表
  1400. getList() {
  1401. this.listLoading = true;
  1402. this.http.post('/finance/getByMonth', {
  1403. companyId: this.user.companyId,
  1404. yearMonth: this.date
  1405. },
  1406. res => {
  1407. this.listLoading = false;
  1408. if (res.code == "ok") {
  1409. var list = res.data;
  1410. this.allFinanceList = list;
  1411. this.noReportUserList = list.filter(r=>r.hasReport == 0);
  1412. if(this.radio == this.$t('lable.allStaff')){
  1413. this.list = this.allFinanceList;
  1414. }else{
  1415. this.list = this.noReportUserList
  1416. }
  1417. } else {
  1418. this.$message({
  1419. message: res.msg,
  1420. type: "error"
  1421. });
  1422. }
  1423. },
  1424. error => {
  1425. this.listLoading = false;
  1426. this.$message({
  1427. message: error,
  1428. type: "error"
  1429. });
  1430. });
  1431. },
  1432. // 获取当月的审核状态
  1433. getMonths() {
  1434. this.http.post('/finance-import/getStatus', {
  1435. companyId: this.user.companyId,
  1436. yearMonth: this.date
  1437. },
  1438. res => {
  1439. this.listLoading = false;
  1440. if (res.code == "ok") {
  1441. // console.log(res.data, '审核状态')
  1442. if(res.data) {
  1443. if(res.data.state == '0') {
  1444. this.revaelse = this.$t('state.WaitingAudit')
  1445. this.tabPosition = '0'
  1446. } else if(res.data.state == '1') {
  1447. this.revaelse = this.$t('Auditrecords')
  1448. this.tabPosition = '1'
  1449. }else if (res.data.state == '2') {
  1450. this.revaelse = this.$t('state.rejected')
  1451. this.tabPosition = '2'
  1452. } else if (res.data.state == '3') {
  1453. this.revaelse = this.$t('state.undone')
  1454. this.tabPosition = '-1'
  1455. }
  1456. this.getReviewList()
  1457. } else {
  1458. this.revaelse = ''
  1459. }
  1460. } else {
  1461. this.$message({
  1462. message: res.msg,
  1463. type: "error"
  1464. });
  1465. }
  1466. },
  1467. error => {
  1468. this.listLoading = false;
  1469. this.$message({
  1470. message: error,
  1471. type: "error"
  1472. });
  1473. });
  1474. },
  1475. // 获取审核列表
  1476. getReviewList() {
  1477. this.http.post('/finance-import/list', {
  1478. companyId: this.user.companyId,
  1479. },
  1480. res => {
  1481. if (res.code == "ok") {
  1482. // console.log(res.data, '拿到的数据')
  1483. this.ovReviewLis = res.data
  1484. if(this.tabPosition == 0) {
  1485. this.reviewLis = res.data.pendingList
  1486. } else if(this.tabPosition == 1) {
  1487. this.reviewLis = res.data.passList
  1488. } else if(this.tabPosition == 2) {
  1489. this.reviewLis = res.data.rejectList
  1490. } else {
  1491. this.reviewLis = res.data.cancelList
  1492. }
  1493. // console.log(this.reviewLis, '数据')
  1494. } else {
  1495. this.$message({
  1496. message: res.msg,
  1497. type: "error"
  1498. });
  1499. }
  1500. },
  1501. error => {
  1502. this.$message({
  1503. message: error,
  1504. type: "error"
  1505. });
  1506. });
  1507. },
  1508. // 操作数据
  1509. operationalData () {
  1510. var sss = this.ovReviewLis
  1511. if(this.tabPosition == 0) {
  1512. this.reviewLis = sss.pendingList
  1513. } else if(this.tabPosition == 1) {
  1514. this.reviewLis = sss.passList
  1515. } else if(this.tabPosition == 2) {
  1516. this.reviewLis = sss.rejectList
  1517. } else {
  1518. this.reviewLis = sss.cancelList
  1519. }
  1520. // console.log(this.reviewLis, '数据')
  1521. },
  1522. // 审核操作
  1523. operationList(zhi, id) {
  1524. let urls
  1525. if(zhi == 0) {
  1526. urls = '/finance-import/agree'
  1527. } else if(zhi == 1){
  1528. urls = '/finance-import/deny'
  1529. } else {
  1530. urls = '/finance-import/cancel'
  1531. }
  1532. this.http.post(urls, {
  1533. id: id,
  1534. },
  1535. res => {
  1536. if (res.code == "ok") {
  1537. this.$message({
  1538. message: this.$t('operationissuccessful'),
  1539. type: "success"
  1540. });
  1541. this.getReviewList()
  1542. } else {
  1543. this.$message({
  1544. message: res.msg,
  1545. type: "error"
  1546. });
  1547. }
  1548. },
  1549. error => {
  1550. this.$message({
  1551. message: error,
  1552. type: "error"
  1553. });
  1554. });
  1555. },
  1556. // 获取薪资上传记录
  1557. xzjl() {
  1558. this.http.post('/finance-import/list', {
  1559. companyId: this.user.companyId,
  1560. // pageIndex:1,
  1561. // pageSize: 9999
  1562. },
  1563. res => {
  1564. if (res.code == "ok") {
  1565. // console.log('123',res.data)
  1566. this.xzList = res.data.passList
  1567. } else {
  1568. this.$message({
  1569. message: res.msg,
  1570. type: "error"
  1571. });
  1572. }
  1573. },
  1574. error => {
  1575. this.$message({
  1576. message: error,
  1577. type: "error"
  1578. });
  1579. });
  1580. },
  1581. //导入分摊比例
  1582. intoAmortizationRatio(){
  1583. this.intoAmortizationDialog = true;
  1584. },
  1585. batchImportData(item) {
  1586. //首先判断文件类型
  1587. let str = item.file.name.split(".");
  1588. let format = str[str.length - 1];
  1589. if (format != "xls" && format != "xlsx") {
  1590. this.$message({
  1591. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1592. type: "error"
  1593. });
  1594. } else {
  1595. this.importingData = true;
  1596. let formData = new FormData();
  1597. formData.append("file", item.file);
  1598. formData.append("companyId", this.user.companyId);
  1599. formData.append('ymonth',this.date)
  1600. this.http.uploadFile('/project-percentage/importData', formData,
  1601. res => {
  1602. this.$refs.upload.clearFiles();
  1603. this.importingData = false;
  1604. this.showImportResult = true;
  1605. if (res.code == "ok") {
  1606. //换成弹出框,以免有人等了半天回来啥也没看到
  1607. this.importResultMsg = this.$t('other.importSuccess')+res.data+this.$t('apportionmentratiodata')+'。'+(res.msg?res.msg:"");
  1608. this.showSettingDialog();
  1609. } else {
  1610. this.importResultMsg = this.$t('export.Importfailure')+":"+res.msg;
  1611. }
  1612. },
  1613. error => {
  1614. this.$refs.upload.clearFiles();
  1615. this.importingData = false;
  1616. this.$message({
  1617. message: error,
  1618. type: "error"
  1619. });
  1620. });
  1621. }
  1622. },
  1623. // 左右滚动
  1624. scrollFunction () {
  1625. this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div
  1626. if (this.domObj.attachEvent) { // IE
  1627. this.domObj.attachEvent('onmousewheel', this.mouseScroll)
  1628. } else if (this.domObj.addEventListener) {
  1629. this.domObj.addEventListener('DOMMouseScroll', this.mouseScroll, false)
  1630. }
  1631. this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll
  1632. },
  1633. mouseScroll(event) { // google 浏览器下
  1634. let detail = event.wheelDelta || event.detail
  1635. let moveForwardStep = -1
  1636. let moveBackStep = 1
  1637. let step = 0
  1638. step = detail > 0 ? moveForwardStep * 100 : moveBackStep * 100
  1639. event.preventDefault() // 阻止浏览器默认事件
  1640. this.domObj.scrollLeft = this.domObj.scrollLeft + step
  1641. },
  1642. // 自定义组件事件
  1643. selectCal(obj) {
  1644. if(obj.distinction == '1') {
  1645. this.reviewerRuleForm.auditorId = obj.id
  1646. } else if(obj.distinction == '2') {
  1647. this.chosenNoReportUserIds = obj.id
  1648. }
  1649. }
  1650. },
  1651. created() {
  1652. var d = new Date();
  1653. this.date = d.getFullYear() +'-'+ ((d.getMonth()+1) < 10? '0'+(d.getMonth()+1):d.getMonth()+1);
  1654. },
  1655. mounted() {
  1656. let height = window.innerHeight;
  1657. this.tableHeight = height - 245;
  1658. const that = this;
  1659. window.onresize = function temp() {
  1660. that.tableHeight = window.innerHeight - 245;
  1661. };
  1662. this.getCustomColumn();
  1663. this.getList();
  1664. // this.getProjects();
  1665. this.addreviewer();
  1666. this.arrter()
  1667. this.getMonths()
  1668. this.scrollFunction()
  1669. },
  1670. updated() {
  1671. this.$nextTick(() => {
  1672. this.$refs['table'].doLayout();
  1673. })
  1674. }
  1675. };
  1676. </script>
  1677. <style lang="scss" scoped>
  1678. .nameList {
  1679. height: 400px;
  1680. overflow: auto;
  1681. }
  1682. </style>