finance.vue 90 KB

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