finance.vue 89 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744
  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="'mini'"></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. a.setAttribute('href', row.url);// href链接
  1001. a.click();// 自执行点击事件
  1002. a.remove();
  1003. },
  1004. getTemplate() {
  1005. this.http.post('/finance/getTemplate', {companyId: this.user.companyId},
  1006. res => {
  1007. if (res.code == "ok") {
  1008. if (res.data.indexOf('xlsx') > 0) {
  1009. this.downloadByA({name:this.$t('financialcoststatement')+ '.xlsx', url:res.data});
  1010. } else {
  1011. this.downloadByA({name:this.$t('financialcoststatement')+ '.xls', url:res.data});
  1012. }
  1013. }});
  1014. },
  1015. saveItems() {
  1016. // let savefields = {
  1017. // monthCost : this.customCols.monthCost,
  1018. // bonus : this.customCols.bonus,
  1019. // allowance : this.customCols.allowance,
  1020. // insuranceOld : this.customCols.insuranceOld,
  1021. // insuranceMedical : this.customCols.insuranceMedical,
  1022. // insuranceLosejob : this.customCols.insuranceLosejob,
  1023. // insuranceInjury : this.customCols.insuranceInjury,
  1024. // houseFund : this.customCols.houseFund,
  1025. // field1 : this.customCols.field1,
  1026. // field2 : this.customCols.field2,
  1027. // field3 : this.customCols.field3
  1028. // }
  1029. if(this.customCols.field1 != null && this.customCols.field1 != ''){
  1030. if(this.customCols.field1Calculate == null){
  1031. this.$message({
  1032. message: this.$t('choosewhethertoincludethetotalcost'),
  1033. type: 'warning'
  1034. })
  1035. return
  1036. }
  1037. }
  1038. if(this.customCols.field2 != null && this.customCols.field2 != ''){
  1039. if(this.customCols.field1Calculate == null){
  1040. this.$message({
  1041. message: this.$t('choosewhethertoincludethetotalcost'),
  1042. type: 'warning'
  1043. })
  1044. return
  1045. }
  1046. }
  1047. if(this.customCols.field3 != null && this.customCols.field3 != ''){
  1048. if(this.customCols.field1Calculate == null){
  1049. this.$message({
  1050. message: this.$t('choosewhethertoincludethetotalcost'),
  1051. type: 'warning'
  1052. })
  1053. return
  1054. }
  1055. }
  1056. this.http.post('/finance-tblcuscol/save', this.customCols,
  1057. res => {
  1058. if (res.code == "ok") {
  1059. this.itemDialog = false;
  1060. this.getCustomColumn();
  1061. }});
  1062. this.$forceUpdate();
  1063. },
  1064. showItemDialog() {
  1065. // console.log(this.customColsi, '后台纯的')
  1066. // console.log(this.customCols, '用来编辑的')
  1067. this.customCols = JSON.parse(JSON.stringify(this.customColsi))
  1068. // console.log(this.customColsi, '后台纯的')
  1069. // console.log(this.customCols, '用来编辑的')
  1070. this.itemDialog = true;
  1071. // this.customFieldList = {field1:null,field2:null, field3:null};
  1072. // if (this.customCols.field1 !== undefined) {
  1073. // this.customFieldList.field1 = this.customCols.field1;
  1074. // } else if (this.customCols.field2 !== undefined) {
  1075. // this.customFieldList.field2 = this.customCols.field2;
  1076. // } else if (this.customCols.field3 !== undefined) {
  1077. // this.customFieldList.field3 = this.customCols.field3;
  1078. // }
  1079. },
  1080. //获取自定义的字段
  1081. getCustomColumn() {
  1082. this.http.post('/finance-tblcuscol/getAll', {companyId: this.user.companyId},
  1083. res => {
  1084. if (res.code == "ok") {
  1085. // console.log("获取自定义字段",res.data);
  1086. this.customColsi = res.data;
  1087. this.tblCols = [];
  1088. this.tblCols.push(this.customColsi.monthCost);
  1089. this.tblCols.push(this.customColsi.bonus);
  1090. this.tblCols.push(this.customColsi.allowance);
  1091. this.tblCols.push(this.customColsi.insuranceOld);
  1092. this.tblCols.push(this.customColsi.insuranceMedical);
  1093. this.tblCols.push(this.customColsi.insuranceLosejob);
  1094. this.tblCols.push(this.customColsi.insuranceInjury);
  1095. this.tblCols.push(this.customColsi.houseFund);
  1096. if (this.customColsi.field1 != null) {
  1097. this.tblCols.push(this.customColsi.field1);
  1098. }
  1099. if (this.customColsi.field2 != null) {
  1100. this.tblCols.push(this.customColsi.field2);
  1101. }
  1102. if (this.customColsi.field3 != null) {
  1103. this.tblCols.push(this.customColsi.field3);
  1104. }
  1105. }});
  1106. },
  1107. // },
  1108. // getProjects() {
  1109. // this.http.post('/finance/getProjects', {companyId: this.user.companyId, yearMonth: this.date},
  1110. // res => {
  1111. // if (res.code == "ok") {
  1112. // this.projectCols = res.data.financeProjects;
  1113. // this.allProjectList = res.data.allProjectList;
  1114. // }});
  1115. // },
  1116. // showNoProjectUsers() {
  1117. // this.showNPDialog = true;
  1118. // this.http.post('/finance/getNoProjectUsers', {yearMonth: this.date},
  1119. // res => {
  1120. // if (res.code == "ok") {
  1121. // this.npUserList = res.data;
  1122. // }});
  1123. // },
  1124. assignToProject(){
  1125. var _this = this;
  1126. this.http.post('/finance/getTimeCost', {yearMonth: this.date, assignNoProUser: this.assignNoProUser},
  1127. res => {
  1128. if (res.code == "ok") {
  1129. for(var i in res.data.costList) {
  1130. if(i>20) {
  1131. this.widthHtval = +this.widthHtval + 40
  1132. } else {
  1133. this.widthHtval = document.body.clientWidth - 230
  1134. }
  1135. }
  1136. // console.log(res.data, '图表数据', this.widthHtval)
  1137. var xList = [], yList = [], list = res.data.costList,
  1138. totalMoneyCost = res.data.totalMoneyCost;
  1139. var nopCost = 0;
  1140. if (res.data.noProjectItem.project != null) {
  1141. this.hasNoProjectUsers = true;
  1142. nopCost = res.data.noProjectItem.cost;
  1143. } else {
  1144. this.hasNoProjectUsers = false;
  1145. }
  1146. for(var i in list) {
  1147. xList.push(list[i].project);
  1148. yList.push({
  1149. "value": list[i].cost,
  1150. "id": list[i].id,
  1151. "time": list[i].workingTime
  1152. });
  1153. }
  1154. var myChart = echarts.init(document.getElementById("container"));
  1155. // 设置图表
  1156. myChart.resize({
  1157. width: this.widthHtval
  1158. })
  1159. _this.myChart = myChart;
  1160. var option = {
  1161. title: {
  1162. text: _this.assignNoProUser ? _this.$t('costintotal') + totalMoneyCost + _this.$t('yuan')
  1163. +(_this.hasNoProjectUsers?","+ _this.$t('projectpersonnelcostincluded') + nopCost + _this.$t('yuan'):"")
  1164. : _this.$t('costintotal') + totalMoneyCost + _this.$t('yuan'),
  1165. left:'left',
  1166. },
  1167. grid : {
  1168. top : 40, //距离容器上边界40像素
  1169. // bottom: 100, //距离容器下边界30像素
  1170. bottom: 40, //距离容器下边界30像素
  1171. left: 100,
  1172. right: 100
  1173. },
  1174. // 工具箱
  1175. toolbox: {
  1176. show: true,
  1177. feature:{
  1178. saveAsImage:{
  1179. show:true
  1180. },
  1181. restore:{
  1182. show:true
  1183. },
  1184. magicType:{
  1185. type:['line','bar']
  1186. },
  1187. }
  1188. },
  1189. tooltip:{
  1190. trigger:'axis',
  1191. formatter: function (params,ticket,callback) {
  1192. var res = params[0].name + "<br/>"+ _this.$t('workcost')+" : " + params[0].data.value
  1193. + _this.$t('yuan')+"<br/>"+ _this.$t('screening.workTime')+" : " + params[0].data.time + _this.$t('time.hour');
  1194. _this.params = params;
  1195. return res;
  1196. }
  1197. },
  1198. xAxis: {
  1199. data: xList,
  1200. axisLabel: {
  1201. interval:0,rotate:20
  1202. }
  1203. },
  1204. yAxis: [{
  1205. type : 'value',
  1206. axisLabel: {
  1207. formatter:'{value} ('+ _this.$t('yuan')+')'
  1208. }
  1209. }],
  1210. series: [{
  1211. name: _this.$t('screening.workTime')+'(h)',
  1212. type: 'bar',
  1213. barMaxWidth: 30,
  1214. data: yList,
  1215. }]
  1216. };
  1217. option && myChart.setOption(option,{notMerge: true});
  1218. // myChart.getZr().on('click', params => {
  1219. // const pointInPixel = [params.offsetX, params.offsetY];
  1220. // if (myChart.containPixel('grid', pointInPixel)) {
  1221. // console.log(_this.params)
  1222. // if(_this.radio=='项目') {
  1223. // _this.$router.push("/cost/" + _this.params[0].data.id + "/" + _this.params[0].name);
  1224. // }
  1225. // }
  1226. // });
  1227. } else {
  1228. this.$message({
  1229. message: res.msg,
  1230. type: "error"
  1231. });
  1232. }
  1233. },
  1234. error => {
  1235. this.$message({
  1236. message: error,
  1237. type: "error"
  1238. });
  1239. });
  1240. },
  1241. //导出财务数据
  1242. exportData() {
  1243. this.exportDataProcessing = true;
  1244. this.http.post('/finance/exportData', {
  1245. date: this.date, assignNoProUser: this.assignNoProUser, groupByCategory: this.groupByCategory
  1246. },
  1247. res => {
  1248. this.exportDataProcessing = false;
  1249. if (res.code == "ok") {
  1250. this.exportFinanceDialog = false;
  1251. var aTag = document.createElement('a');
  1252. aTag.download = this.$t('financialcoststatisticss')+".xls";
  1253. aTag.href = res.data;
  1254. aTag.click();
  1255. } else {
  1256. this.$message({
  1257. message: res.msg,
  1258. type: "error"
  1259. });
  1260. }
  1261. },
  1262. error => {
  1263. this.listLoading = false;
  1264. this.$message({
  1265. message: error,
  1266. type: "error"
  1267. });
  1268. });
  1269. },
  1270. getSummaries(param) {
  1271. const { columns, data } = param;
  1272. const sums = [];
  1273. columns.forEach((column, index) => {
  1274. if (index === 0) {
  1275. sums[index] = this.$t('zongjia');
  1276. return;
  1277. }
  1278. if (index === 1 || index === 2){
  1279. sums[index] = ''
  1280. return
  1281. }
  1282. const values = data.map(item => Number(item[column.property]));
  1283. if (!values.every(value => isNaN(value))) {
  1284. sums[index] = values.reduce((prev, curr) => {
  1285. const value = Number(curr);
  1286. if (!isNaN(value)) {
  1287. return prev + curr;
  1288. } else {
  1289. return prev;
  1290. }
  1291. }, 0);
  1292. sums[index] = sums[index].toFixed(2) + this.$t('yuan');
  1293. } else {
  1294. sums[index] = 'N/A';
  1295. }
  1296. });
  1297. return sums;
  1298. },
  1299. changeMonth() {
  1300. //改变月份
  1301. this.getList();
  1302. this.assignToProject();
  1303. this.getMonths()
  1304. },
  1305. // 批量导入人员
  1306. importFinance(item) {
  1307. //首先判断文件类型
  1308. let str = item.file.name.split(".");
  1309. let format = str[str.length - 1];
  1310. if (format != "xls" && format != "xlsx") {
  1311. this.$message({
  1312. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1313. type: "error"
  1314. });
  1315. } else {
  1316. this.listLoading = true;
  1317. let formData = new FormData();
  1318. formData.append("file", item.file);
  1319. formData.append("companyId", this.user.companyId);
  1320. formData.append("yearMonth", this.date);
  1321. formData.append("syncUserCost", this.importParam.syncUserCost);
  1322. formData.append("syncHistoryReport", this.importParam.syncHistoryReport);
  1323. this.isUploading = true;
  1324. let urls = ''
  1325. if(this.user.timeType.financeAudit == '1') {
  1326. urls = '/finance-import/submitImport'
  1327. } else {
  1328. urls = '/finance/importData'
  1329. }
  1330. // this.http.uploadFile('/finance/importData', formData,
  1331. this.http.uploadFile(urls, formData,
  1332. res => {
  1333. // console.log(this.user.timeType.financeAudit, '看看数据')
  1334. this.$refs.upload.clearFiles();
  1335. this.listLoading = false;
  1336. this.isUploading = false;
  1337. if (res.code == "ok") {
  1338. if (this.user.timeType.financeAudit == 1 ) {
  1339. this.$message({
  1340. message: this.$t('waiforverification'),
  1341. type: "warning"
  1342. });
  1343. this.getMonths();
  1344. } else {
  1345. this.$message({
  1346. message: this.$t('other.importSuccess'),
  1347. type: "success"
  1348. });
  1349. }
  1350. this.importDialog = false;
  1351. //重新读取列表
  1352. this.getList();
  1353. } else {
  1354. this.$message({
  1355. message: res.msg,
  1356. type: "error"
  1357. });
  1358. }
  1359. },
  1360. error => {
  1361. this.$refs.upload.clearFiles();
  1362. this.listLoading = false;
  1363. this.$message({
  1364. message: error,
  1365. type: "error"
  1366. });
  1367. });
  1368. }
  1369. },
  1370. // 导入提交审核
  1371. // submitReview(formData) {
  1372. // this.http.uploadFile(' /finance-import/submitImport', formData,
  1373. // res => {
  1374. // if (res.code == "ok") {
  1375. // console.log(res.data, '来的数据')
  1376. // } else {
  1377. // this.$message({
  1378. // message: res.msg,
  1379. // type: "error"
  1380. // });
  1381. // }
  1382. // },
  1383. // error => {
  1384. // this.$refs.upload.clearFiles();
  1385. // this.listLoading = false;
  1386. // this.$message({
  1387. // message: error,
  1388. // type: "error"
  1389. // });
  1390. // });
  1391. // },
  1392. //获取项目列表
  1393. getList() {
  1394. this.listLoading = true;
  1395. this.http.post('/finance/getByMonth', {
  1396. companyId: this.user.companyId,
  1397. yearMonth: this.date
  1398. },
  1399. res => {
  1400. this.listLoading = false;
  1401. if (res.code == "ok") {
  1402. var list = res.data;
  1403. this.allFinanceList = list;
  1404. this.noReportUserList = list.filter(r=>r.hasReport == 0);
  1405. if(this.radio == this.$t('lable.allStaff')){
  1406. this.list = this.allFinanceList;
  1407. }else{
  1408. this.list = this.noReportUserList
  1409. }
  1410. } else {
  1411. this.$message({
  1412. message: res.msg,
  1413. type: "error"
  1414. });
  1415. }
  1416. },
  1417. error => {
  1418. this.listLoading = false;
  1419. this.$message({
  1420. message: error,
  1421. type: "error"
  1422. });
  1423. });
  1424. },
  1425. // 获取当月的审核状态
  1426. getMonths() {
  1427. this.http.post('/finance-import/getStatus', {
  1428. companyId: this.user.companyId,
  1429. yearMonth: this.date
  1430. },
  1431. res => {
  1432. this.listLoading = false;
  1433. if (res.code == "ok") {
  1434. // console.log(res.data, '审核状态')
  1435. if(res.data) {
  1436. if(res.data.state == '0') {
  1437. this.revaelse = this.$t('state.WaitingAudit')
  1438. this.tabPosition = '0'
  1439. } else if(res.data.state == '1') {
  1440. this.revaelse = this.$t('Auditrecords')
  1441. this.tabPosition = '1'
  1442. }else if (res.data.state == '2') {
  1443. this.revaelse = this.$t('state.rejected')
  1444. this.tabPosition = '2'
  1445. } else if (res.data.state == '3') {
  1446. this.revaelse = this.$t('state.undone')
  1447. this.tabPosition = '-1'
  1448. }
  1449. this.getReviewList()
  1450. } else {
  1451. this.revaelse = ''
  1452. }
  1453. } else {
  1454. this.$message({
  1455. message: res.msg,
  1456. type: "error"
  1457. });
  1458. }
  1459. },
  1460. error => {
  1461. this.listLoading = false;
  1462. this.$message({
  1463. message: error,
  1464. type: "error"
  1465. });
  1466. });
  1467. },
  1468. // 获取审核列表
  1469. getReviewList() {
  1470. this.http.post('/finance-import/list', {
  1471. companyId: this.user.companyId,
  1472. },
  1473. res => {
  1474. if (res.code == "ok") {
  1475. // console.log(res.data, '拿到的数据')
  1476. this.ovReviewLis = res.data
  1477. if(this.tabPosition == 0) {
  1478. this.reviewLis = res.data.pendingList
  1479. } else if(this.tabPosition == 1) {
  1480. this.reviewLis = res.data.passList
  1481. } else if(this.tabPosition == 2) {
  1482. this.reviewLis = res.data.rejectList
  1483. } else {
  1484. this.reviewLis = res.data.cancelList
  1485. }
  1486. // console.log(this.reviewLis, '数据')
  1487. } else {
  1488. this.$message({
  1489. message: res.msg,
  1490. type: "error"
  1491. });
  1492. }
  1493. },
  1494. error => {
  1495. this.$message({
  1496. message: error,
  1497. type: "error"
  1498. });
  1499. });
  1500. },
  1501. // 操作数据
  1502. operationalData () {
  1503. var sss = this.ovReviewLis
  1504. if(this.tabPosition == 0) {
  1505. this.reviewLis = sss.pendingList
  1506. } else if(this.tabPosition == 1) {
  1507. this.reviewLis = sss.passList
  1508. } else if(this.tabPosition == 2) {
  1509. this.reviewLis = sss.rejectList
  1510. } else {
  1511. this.reviewLis = sss.cancelList
  1512. }
  1513. // console.log(this.reviewLis, '数据')
  1514. },
  1515. // 审核操作
  1516. operationList(zhi, id) {
  1517. let urls
  1518. if(zhi == 0) {
  1519. urls = '/finance-import/agree'
  1520. } else if(zhi == 1){
  1521. urls = '/finance-import/deny'
  1522. } else {
  1523. urls = '/finance-import/cancel'
  1524. }
  1525. this.http.post(urls, {
  1526. id: id,
  1527. },
  1528. res => {
  1529. if (res.code == "ok") {
  1530. this.$message({
  1531. message: this.$t('operationissuccessful'),
  1532. type: "success"
  1533. });
  1534. this.getReviewList()
  1535. } else {
  1536. this.$message({
  1537. message: res.msg,
  1538. type: "error"
  1539. });
  1540. }
  1541. },
  1542. error => {
  1543. this.$message({
  1544. message: error,
  1545. type: "error"
  1546. });
  1547. });
  1548. },
  1549. // 获取薪资上传记录
  1550. xzjl() {
  1551. this.http.post('/finance-import/list', {
  1552. companyId: this.user.companyId,
  1553. // pageIndex:1,
  1554. // pageSize: 9999
  1555. },
  1556. res => {
  1557. if (res.code == "ok") {
  1558. // console.log('123',res.data)
  1559. this.xzList = res.data.passList
  1560. } else {
  1561. this.$message({
  1562. message: res.msg,
  1563. type: "error"
  1564. });
  1565. }
  1566. },
  1567. error => {
  1568. this.$message({
  1569. message: error,
  1570. type: "error"
  1571. });
  1572. });
  1573. },
  1574. //导入分摊比例
  1575. intoAmortizationRatio(){
  1576. this.intoAmortizationDialog = true;
  1577. },
  1578. batchImportData(item) {
  1579. //首先判断文件类型
  1580. let str = item.file.name.split(".");
  1581. let format = str[str.length - 1];
  1582. if (format != "xls" && format != "xlsx") {
  1583. this.$message({
  1584. message: this.$t('other.PleaseselecttheXLSorXLSXfile'),
  1585. type: "error"
  1586. });
  1587. } else {
  1588. this.importingData = true;
  1589. let formData = new FormData();
  1590. formData.append("file", item.file);
  1591. formData.append("companyId", this.user.companyId);
  1592. formData.append('ymonth',this.date)
  1593. this.http.uploadFile('/project-percentage/importData', formData,
  1594. res => {
  1595. this.$refs.upload.clearFiles();
  1596. this.importingData = false;
  1597. this.showImportResult = true;
  1598. if (res.code == "ok") {
  1599. //换成弹出框,以免有人等了半天回来啥也没看到
  1600. this.importResultMsg = this.$t('other.importSuccess')+res.data+this.$t('apportionmentratiodata')+'。'+(res.msg?res.msg:"");
  1601. this.showSettingDialog();
  1602. } else {
  1603. this.importResultMsg = this.$t('export.Importfailure')+":"+res.msg;
  1604. }
  1605. },
  1606. error => {
  1607. this.$refs.upload.clearFiles();
  1608. this.importingData = false;
  1609. this.$message({
  1610. message: error,
  1611. type: "error"
  1612. });
  1613. });
  1614. }
  1615. },
  1616. // 左右滚动
  1617. scrollFunction () {
  1618. this.domObj = document.getElementById('clearfix') // 通过id获取要设置的div
  1619. if (this.domObj.attachEvent) { // IE
  1620. this.domObj.attachEvent('onmousewheel', this.mouseScroll)
  1621. } else if (this.domObj.addEventListener) {
  1622. this.domObj.addEventListener('DOMMouseScroll', this.mouseScroll, false)
  1623. }
  1624. this.domObj.onmousewheel = this.domObj.onmousewheel = this.mouseScroll
  1625. },
  1626. mouseScroll(event) { // google 浏览器下
  1627. let detail = event.wheelDelta || event.detail
  1628. let moveForwardStep = -1
  1629. let moveBackStep = 1
  1630. let step = 0
  1631. step = detail > 0 ? moveForwardStep * 100 : moveBackStep * 100
  1632. event.preventDefault() // 阻止浏览器默认事件
  1633. this.domObj.scrollLeft = this.domObj.scrollLeft + step
  1634. },
  1635. // 自定义组件事件
  1636. selectCal(obj) {
  1637. if(obj.distinction == '1') {
  1638. this.reviewerRuleForm.auditorId = obj.id
  1639. } else if(obj.distinction == '2') {
  1640. this.chosenNoReportUserIds = obj.id
  1641. }
  1642. }
  1643. },
  1644. created() {
  1645. var d = new Date();
  1646. this.date = d.getFullYear() +'-'+ ((d.getMonth()+1) < 10? '0'+(d.getMonth()+1):d.getMonth()+1);
  1647. },
  1648. mounted() {
  1649. let height = window.innerHeight;
  1650. this.tableHeight = height - 245;
  1651. const that = this;
  1652. window.onresize = function temp() {
  1653. that.tableHeight = window.innerHeight - 245;
  1654. };
  1655. this.getCustomColumn();
  1656. this.getList();
  1657. // this.getProjects();
  1658. this.addreviewer();
  1659. this.arrter()
  1660. this.getMonths()
  1661. this.scrollFunction()
  1662. },
  1663. updated() {
  1664. this.$nextTick(() => {
  1665. this.$refs['table'].doLayout();
  1666. })
  1667. }
  1668. };
  1669. </script>
  1670. <style lang="scss" scoped>
  1671. .nameList {
  1672. height: 400px;
  1673. overflow: auto;
  1674. }
  1675. </style>