finance.vue 89 KB

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