detailsPage.vue 78 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008
  1. <template>
  2. <div>
  3. <div class="customer-head">
  4. <div class="customer-back">
  5. <el-button type="danger" style="border: none; background: none; color: red" icon="el-icon-arrow-left" @click="goBack()">返回列表 </el-button>
  6. <el-button v-if="form.id && pageIds.length" type="text" @click="lastPage">上一票</el-button>
  7. <el-button v-if="form.id && pageIds.length" type="text" @click="nextPage">下一票</el-button>
  8. </div>
  9. <div class="customer-title">{{ form.operatingType }}</div>
  10. <div class="add-customer-btn">
  11. <el-button size="small" :disabled="!form.id" @click="$refs.print.openDialog()">预 览 </el-button>
  12. <el-button v-if="roleName.includes('admin')" size="small" :disabled="!form.id" @click="$refs.report.openDialog()">报表设计 </el-button>
  13. <el-button size="small" type="danger" plain :disabled="editButton" v-if="form.isCleared == 1" @click="allClick('撤销结算')"
  14. >撤销结算
  15. </el-button>
  16. <el-button size="small" type="success" plain :disabled="editButton" v-if="form.id&&form.status ==0" @click="allClick('确认结算')">确认结算 </el-button>
  17. <el-button class="el-button--small-yh" type="primary" size="small" v-if="editButton" @click="inEdit">编 辑 </el-button>
  18. <el-button v-else class="el-button--small-yh" type="primary" size="small" :disabled="editButton || form.status == 3" @click="submit"
  19. >保 存
  20. </el-button>
  21. </div>
  22. </div>
  23. <div style="margin-top: 50px">
  24. <el-card class="box-card">
  25. <avue-form :option="optionForm" v-model="form" ref="avueForm">
  26. <tempalte slot="bankAccountNo">
  27. <dic-select
  28. v-model="form.bankAccountNo"
  29. :key="form.corpId"
  30. placeholder="开户帐号"
  31. label="accountNo"
  32. res="records"
  33. :url="'/blade-los/bcorpsbank/list?current=1&size=50&pid=' + form.corpId"
  34. :filterable="true"
  35. :remote="true"
  36. dataName="accountNo"
  37. @selectChange="dicChange('bankAccountNo', $event)"
  38. :disabled="editDisabled"
  39. :slotRight="true"
  40. rightLabel="accountBank"
  41. ></dic-select>
  42. </tempalte>
  43. </avue-form>
  44. <avue-form v-show="show" class="form2" :option="optionForm2" v-model="form" ref="form2">
  45. <tempalte slot="businessDate">
  46. <date-range
  47. :start-date.sync="form.businessDateStart"
  48. :end-date.sync="form.businessDateEnd"
  49. :defaultTime="['00:00:00', '00:00:00']"
  50. :disabled="true"
  51. ></date-range>
  52. </tempalte>
  53. </avue-form>
  54. <div style="display: flex; justify-content: center; font-size: 14px" @click="show = !show" @mouseenter="enter" @mouseleave="leave">
  55. <div v-show="show" style="height: 16px; cursor: pointer">
  56. <span class="el-button--text"><i class="el-icon-caret-top" /><span v-show="showSpan">隐藏</span></span>
  57. </div>
  58. <div v-show="!show" style="height: 16px; cursor: pointer">
  59. <span class="el-button--text"><i class="el-icon-caret-bottom" /><span v-show="showSpan">显示</span></span>
  60. </div>
  61. </div>
  62. </el-card>
  63. <el-tabs style="margin-top: 2px" class="box-tabs" type="border-card" v-model="activeName" @tab-click="handleClick">
  64. <el-tab-pane label="结算明细" name="1">
  65. <picked-data ref="pickedData" :form="form" :tableData="form.finStlBillsItemsList" @update="update" :disabled="editButton"></picked-data>
  66. </el-tab-pane>
  67. <el-tab-pane label="凭证数据" name="2" v-if="form.isCleared == 1">
  68. <div style="margin-bottom: 10px">
  69. <el-form :model="form" ref="form1" label-width="70px">
  70. <el-row>
  71. <el-col :span="4">
  72. <el-form-item label="凭证字" prop="voucherType">
  73. <search-query
  74. :datalist="voucherTypeData"
  75. :selectValue="form.voucherType"
  76. :clearable="false"
  77. :buttonIf="false"
  78. :disabled="!canEditVoucher"
  79. :forParameter="{ key: 'dictKey', label: 'dictValue', value: 'dictKey' }"
  80. placeholder="请选择凭证字"
  81. @corpChange="corpChange($event, 'voucherType')"
  82. >
  83. </search-query>
  84. </el-form-item>
  85. </el-col>
  86. <el-col :span="4">
  87. <el-form-item label="凭证日期" prop="voucherDate">
  88. <el-date-picker
  89. v-model="form.voucherDate"
  90. clearable
  91. style="width: 100%"
  92. type="date"
  93. size="small"
  94. value-format="yyyy-MM-dd"
  95. :disabled="!canEditVoucher"
  96. placeholder="选择凭证日期"
  97. >
  98. </el-date-picker>
  99. </el-form-item>
  100. </el-col>
  101. <el-col :span="16" style="padding-left: 20px">
  102. <el-button size="small" type="primary" style="margin-right: 8px" @click="addEntryfun" :disabled="!canEditVoucher"
  103. >添加分录
  104. </el-button>
  105. <el-button size="small" type="danger" style="margin-right: 8px" @click="deleteEntryfun" :disabled="!canEditVoucher"
  106. >删除分录
  107. </el-button>
  108. <el-button
  109. size="small"
  110. type="primary"
  111. style="margin-right: 10px; margin-right: 8px"
  112. @click="oneClickSave"
  113. :disabled="!canEditVoucher"
  114. >一键保存
  115. </el-button>
  116. <el-button
  117. size="small"
  118. type="primary"
  119. style="margin-left: 8px; margin-right: 8px"
  120. :disabled="!form.id || form.isCleared != 1"
  121. v-if="!form.voucherNo"
  122. @click="generateVoucherfun"
  123. >生成凭证
  124. </el-button>
  125. <span v-if="form.voucherNo" style="font-size: 12px; margin-left: 16px; margin-right: 8px">{{
  126. "凭证号:" + form.voucherNo + " 单据号:" + form.voucherBillNo
  127. }}</span>
  128. </el-col>
  129. </el-row>
  130. </el-form>
  131. </div>
  132. <fromtable-details
  133. :assemblyForm="form"
  134. :tableData="form.finStlBillsVoucherItemsList"
  135. :handleSelectionData="handleSelectionData2"
  136. :disabled="!canEditVoucher"
  137. @handleSelectionChange="handleSelectionChange2"
  138. @addRowsfun="addRowsfun"
  139. @deletefun="deletefun"
  140. @auxiliaryAccountingfun="auxiliaryAccountingfun"
  141. @showOffRecordsfun="showOffRecordsfun"
  142. >
  143. </fromtable-details>
  144. </el-tab-pane>
  145. </el-tabs>
  146. <fee-info ref="feeInfo"></fee-info>
  147. <business-reports :id="form.id" ref="print" businessValue="JSZX" :type="true"></business-reports>
  148. <reports :id="form.id" :assemblyForm="form" businessValue="JSZX" ref="report"></reports>
  149. <!--辅助核算-->
  150. <el-dialog title="核算项目维护" append-to-body :visible.sync="auxiliaryVisible" class="el-dialogDeep" width="40%" :before-close="handleClose">
  151. <div>科目名称: {{ subjectRow.accountFullName }}</div>
  152. <div style="margin-top: 10px">
  153. <el-form :model="subjectRow" ref="subjectRow" label-width="70px" class="demo-ruleForm">
  154. <!--#region-->
  155. <!--<div>外币核算:</div>-->
  156. <!--<el-row>-->
  157. <!-- <el-col :span="4">-->
  158. <!-- <el-form-item label="币种:" prop="curCode">-->
  159. <!-- <el-input style="width: 100%;" v-model="subjectRow.curCode"-->
  160. <!-- size="small" autocomplete="off"-->
  161. <!-- clearable placeholder="请输入币种" >-->
  162. <!-- </el-input>-->
  163. <!-- </el-form-item>-->
  164. <!-- </el-col>-->
  165. <!-- <el-col :span="4">-->
  166. <!-- <el-form-item label="汇率:" prop="exrate">-->
  167. <!-- <el-input style="width: 100%;" v-model="subjectRow.exrate"-->
  168. <!-- size="small" autocomplete="off"-->
  169. <!-- clearable placeholder="请输入汇率" >-->
  170. <!-- </el-input>-->
  171. <!-- </el-form-item>-->
  172. <!-- </el-col>-->
  173. <!-- <el-col :span="4">-->
  174. <!-- <el-form-item label="借方金额:" prop="amountDrUsd">-->
  175. <!-- <el-input style="width: 100%;" v-model="subjectRow.amountDrUsd"-->
  176. <!-- size="small" autocomplete="off"-->
  177. <!-- clearable placeholder="请输入借方金额" >-->
  178. <!-- </el-input>-->
  179. <!-- </el-form-item>-->
  180. <!-- </el-col>-->
  181. <!-- <el-col :span="4">-->
  182. <!-- <el-form-item label="贷方金额:" prop="amountCrUsd">-->
  183. <!-- <el-input style="width: 100%;" v-model="subjectRow.amountCrUsd"-->
  184. <!-- size="small" autocomplete="off"-->
  185. <!-- clearable placeholder="请输入贷方金额" >-->
  186. <!-- </el-input>-->
  187. <!-- </el-form-item>-->
  188. <!-- </el-col>-->
  189. <!-- <el-col :span="4">-->
  190. <!-- <el-form-item label="本币借方:" prop="amountDr">-->
  191. <!-- <el-input style="width: 100%;" v-model="subjectRow.amountDr"-->
  192. <!-- size="small" autocomplete="off"-->
  193. <!-- clearable placeholder="请输入本币借方" >-->
  194. <!-- </el-input>-->
  195. <!-- </el-form-item>-->
  196. <!-- </el-col>-->
  197. <!-- <el-col :span="4">-->
  198. <!-- <el-form-item label="本币贷方:" prop="amountCr">-->
  199. <!-- <el-input style="width: 100%;" v-model="subjectRow.amountCr"-->
  200. <!-- size="small" autocomplete="off"-->
  201. <!-- clearable placeholder="请输入本币贷方" >-->
  202. <!-- </el-input>-->
  203. <!-- </el-form-item>-->
  204. <!-- </el-col>-->
  205. <!--</el-row>-->
  206. <!--#endregion-->
  207. <!--#region-->
  208. <!--<div>数量核算:</div>-->
  209. <!--<el-row>-->
  210. <!-- <el-col :span="4">-->
  211. <!-- <el-form-item label="单位:" prop="unitNo">-->
  212. <!-- <el-input style="width: 100%;" v-model="subjectRow.unitNo"-->
  213. <!-- size="small" autocomplete="off"-->
  214. <!-- clearable placeholder="请输入单位" >-->
  215. <!-- </el-input>-->
  216. <!-- </el-form-item>-->
  217. <!-- </el-col>-->
  218. <!-- <el-col :span="4">-->
  219. <!-- <el-form-item label="规格:" prop="voucherNo">-->
  220. <!-- <el-input style="width: 100%;" v-model="subjectRow.voucherNo"-->
  221. <!-- size="small" autocomplete="off"-->
  222. <!-- clearable placeholder="请输入规格" >-->
  223. <!-- </el-input>-->
  224. <!-- </el-form-item>-->
  225. <!-- </el-col>-->
  226. <!-- <el-col :span="4">-->
  227. <!-- <el-form-item label="借方数量:" prop="quantityDr">-->
  228. <!-- <el-input style="width: 100%;" v-model="subjectRow.quantityDr"-->
  229. <!-- size="small" autocomplete="off"-->
  230. <!-- clearable placeholder="请输入借方数量" >-->
  231. <!-- </el-input>-->
  232. <!-- </el-form-item>-->
  233. <!-- </el-col>-->
  234. <!-- <el-col :span="4">-->
  235. <!-- <el-form-item label="借方单价:" prop="voucherNo">-->
  236. <!-- <el-input style="width: 100%;" v-model="subjectRow.voucherNo"-->
  237. <!-- size="small" autocomplete="off"-->
  238. <!-- clearable placeholder="请输入借方单价" >-->
  239. <!-- </el-input>-->
  240. <!-- </el-form-item>-->
  241. <!-- </el-col>-->
  242. <!-- <el-col :span="4">-->
  243. <!-- <el-form-item label="贷方数量:" prop="quantityCr">-->
  244. <!-- <el-input style="width: 100%;" v-model="subjectRow.quantityCr"-->
  245. <!-- size="small" autocomplete="off"-->
  246. <!-- clearable placeholder="请输入贷方数量" >-->
  247. <!-- </el-input>-->
  248. <!-- </el-form-item>-->
  249. <!-- </el-col>-->
  250. <!-- <el-col :span="4">-->
  251. <!-- <el-form-item label="贷方单价:" prop="voucherNo">-->
  252. <!-- <el-input style="width: 100%;" v-model="subjectRow.voucherNo"-->
  253. <!-- size="small" autocomplete="off"-->
  254. <!-- clearable placeholder="请输入贷方单价" >-->
  255. <!-- </el-input>-->
  256. <!-- </el-form-item>-->
  257. <!-- </el-col>-->
  258. <!--</el-row>-->
  259. <!--#endregion-->
  260. <el-row :gutter="40">
  261. <el-col :span="12" v-if="subjectAccount.isCorp">
  262. <!--<div>客户核算:</div>-->
  263. <el-form-item label="客户名称:" prop="corpCnName">
  264. <search-query
  265. style="width: 100%"
  266. ref="searchQueryRef"
  267. :datalist="corpCnNameData"
  268. :selectValue="subjectRow.corpCnName"
  269. :filterable="true"
  270. :clearable="true"
  271. :remote="true"
  272. :buttonIf="true"
  273. placeholder="请选择客户名称"
  274. :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
  275. @corpFocus="getBcorpsListfun"
  276. @remoteMethod="getBcorpsListfun"
  277. @corpChange="corpChange2($event, 'corpCnName')"
  278. @eldialogConfirm="eldialogConfirm('bcorps')"
  279. @bottonSearchfun="bottonSearchfun('bcorps')"
  280. >
  281. <bcorps ref="bcorps" :eldialog="true" @selectionChange="eldialogMultipleChoice($event, 'bcorps')"></bcorps>
  282. </search-query>
  283. </el-form-item>
  284. </el-col>
  285. <el-col :span="12" v-if="subjectAccount.isDept">
  286. <!--<div>部门核算:</div>-->
  287. <el-form-item label="部门名称:" prop="deptName">
  288. <tree-select
  289. v-model="subjectRow.deptName"
  290. filterable
  291. :data="deptData"
  292. :props="{ label: 'title', children: 'children' }"
  293. nodeKey="title"
  294. size="small"
  295. :multiple="false"
  296. placeholder="请选择部门名称"
  297. @focus="getDeptTreefun"
  298. @input="corpChange2($event, 'deptName')"
  299. >
  300. </tree-select>
  301. </el-form-item>
  302. </el-col>
  303. <el-col :span="12" v-if="subjectAccount.isEmpl">
  304. <!--<div>职员核算:</div>-->
  305. <el-form-item label="职员名称:" prop="emplName">
  306. <search-query
  307. :datalist="emplData"
  308. :selectValue="subjectRow.emplName"
  309. :clearable="true"
  310. :buttonIf="false"
  311. :filterable="true"
  312. :remote="true"
  313. placeholder="请选择职员名称"
  314. :forParameter="{ key: 'id', label: 'name', value: 'name' }"
  315. @corpFocus="userGetListfun"
  316. @corpChange="corpChange2($event, 'emplName')"
  317. @remoteMethod="userGetListfun"
  318. >
  319. </search-query>
  320. </el-form-item>
  321. </el-col>
  322. <!--<el-col :span="12" v-if="subjectAccount.isItem">-->
  323. <!-- <div>项目核算:</div>-->
  324. <!-- <el-form-item label="项目名称:" prop="itemName">-->
  325. <!-- <el-input style="width: 100%;" v-model="subjectRow.itemName"-->
  326. <!-- size="small" autocomplete="off"-->
  327. <!-- clearable placeholder="请输入项目名称" >-->
  328. <!-- </el-input>-->
  329. <!-- <search-query :datalist="itemData"-->
  330. <!-- :selectValue="subjectRow.itemName"-->
  331. <!-- :clearable="true"-->
  332. <!-- :buttonIf="false"-->
  333. <!-- :filterable="true"-->
  334. <!-- :remote="true"-->
  335. <!-- placeholder="请选择项目名称"-->
  336. <!-- :forParameter="{ key:'id', label:'cnName', value:'cnName'}"-->
  337. <!-- @corpFocus="baccitemstypeListfun"-->
  338. <!-- @corpChange="corpChange($event,'itemName')"-->
  339. <!-- @remoteMethod="baccitemstypeListfun" >-->
  340. <!-- </search-query>-->
  341. <!-- </el-form-item>-->
  342. <!--</el-col>-->
  343. </el-row>
  344. </el-form>
  345. </div>
  346. <span slot="footer" class="dialog-footer">
  347. <el-button @click="auxiliaryVisible = false">取 消</el-button>
  348. <el-button type="primary" @click="auxiliaryDeterminefun">确 定</el-button>
  349. </span>
  350. </el-dialog>
  351. <!--预收预付核销-->
  352. <el-dialog
  353. title="预收预付核销管理"
  354. append-to-body
  355. :visible.sync="offRecordsVisible"
  356. class="el-dialogDeep"
  357. width="80%"
  358. :before-close="handleClose"
  359. >
  360. <div>
  361. 科目名称:
  362. {{
  363. subjectRow.accountCode +
  364. " " +
  365. subjectRow.accountFullName +
  366. (subjectRow.isEmpl === 1 && subjectRow.emplName ? "/" + subjectRow.emplName : "") +
  367. (subjectRow.isDept === 1 && subjectRow.deptName ? "/" + subjectRow.deptName : "") +
  368. (subjectRow.isCorp === 1 && subjectRow.corpShortName ? "/" + subjectRow.corpShortName : "") +
  369. (subjectRow.isItem === 1 ? "/" + subjectRow.itemClassify + "-" + (subjectRow.itemName ? subjectRow.itemName : "") : "")
  370. }}
  371. 方向:{{ subjectRow.dc === "D" ? "借" : "贷" }}
  372. </div>
  373. <div>
  374. 借方金额: CNY {{ fixedAmt(subjectRow.amountDr, 16) }} {{ subjectRow.isForeign === 1 ? "USD " + fixedAmt(subjectRow.amountDrUsd, 16) : "" }}
  375. </div>
  376. <div>
  377. 贷方金额: CNY {{ fixedAmt(subjectRow.amountCr, 16) }} {{ subjectRow.isForeign === 1 ? "USD " + fixedAmt(subjectRow.amountCrUsd, 16) : "" }}
  378. </div>
  379. <div style="margin-top: 10px; margin-bottom: 10px">
  380. <el-form :model="subjectRowOff" ref="subjectRowOff" label-width="70px" class="demo-ruleForm">
  381. <el-row :gutter="40">
  382. <el-col :span="12" v-if="subjectRowOff.isCorp">
  383. <!--<div>客户核算:</div>-->
  384. <el-form-item label="客户名称:" prop="corpCnName">
  385. <search-query
  386. style="width: 100%"
  387. ref="searchQueryRef"
  388. :datalist="corpCnNameData"
  389. :selectValue="subjectRowOff.corpCnName"
  390. :filterable="true"
  391. :clearable="true"
  392. :remote="true"
  393. :buttonIf="true"
  394. placeholder="请选择客户名称"
  395. :forParameter="{ key: 'id', label: 'cnName', value: 'cnName' }"
  396. @corpFocus="getBcorpsListfun"
  397. @remoteMethod="getBcorpsListfun"
  398. @corpChange="corpChangeOff($event, 'corpCnName')"
  399. @eldialogConfirm="eldialogConfirmOff('bcorps')"
  400. @bottonSearchfun="bottonSearchfun('bcorps')"
  401. >
  402. <bcorps ref="bcorps" :eldialog="true" @selectionChange="eldialogMultipleChoice($event, 'bcorps')"></bcorps>
  403. </search-query>
  404. </el-form-item>
  405. </el-col>
  406. <el-col :span="12" v-if="subjectRowOff.isCorp">
  407. <el-form-item label="" prop="">
  408. <el-button type="primary" @click="regetOffVoucherItems">查询</el-button>
  409. </el-form-item>
  410. </el-col>
  411. </el-row>
  412. </el-form>
  413. </div>
  414. <div style="margin-top: 10px">
  415. <!-- show-summary-->
  416. <!-- :summary-method="summaryMethodOff"-->
  417. <el-table
  418. ref="tableOffRecords"
  419. :cell-style="{ padding: '0px', fontSize: '12px' }"
  420. :header-cell-style="tableHeaderCellStyle"
  421. :close-on-click-modal="false"
  422. :data="offRecordsData"
  423. :border="true"
  424. style="width: 100%"
  425. show-summary
  426. :summary-method="summaryMethodOff"
  427. @selection-change="handleOffRecordsSelectionChange"
  428. :row-class-name="rowClassName"
  429. >
  430. <el-table-column fixed="left" type="selection" width="50"> </el-table-column>
  431. <el-table-column type="index" width="40" style="text-align: center"> </el-table-column>
  432. <el-table-column prop="voucherDate" label="凭证日期" width="120" style="padding: 0">
  433. <template slot-scope="{ row }">
  434. <span>{{ row.voucherDate }}</span>
  435. </template>
  436. </el-table-column>
  437. <el-table-column prop="descr" label="摘要" width="200" style="padding: 0">
  438. <template slot-scope="{ row }">
  439. <span>{{ row.descr }}</span>
  440. </template>
  441. </el-table-column>
  442. <el-table-column prop="accountCode" label="科目名称" width="240" style="padding: 0">
  443. <template slot-scope="{ row }">
  444. <span>
  445. {{
  446. row.accountCode +
  447. " " +
  448. row.accountFullName +
  449. (row.isEmpl === 1 && row.emplName ? "/" + row.emplName : "") +
  450. (row.isDept === 1 && row.deptName ? "/" + row.deptName : "") +
  451. (row.isCorp === 1 && row.corpShortName ? "/" + row.corpShortName : "") +
  452. (row.isItem === 1 ? "/" + row.itemClassify + "-" + (row.itemName ? row.itemName : "") : "")
  453. }}
  454. </span>
  455. </template>
  456. </el-table-column>
  457. <el-table-column prop="dc" label="借贷" width="40px" style="padding: 0">
  458. <template slot-scope="{ row }">
  459. <span>{{ row.dc === "C" ? "借" : "贷" }}</span>
  460. </template>
  461. </el-table-column>
  462. <el-table-column label="本币金额">
  463. <el-table-column label="借方">
  464. <el-table-column prop="amountDr" label="金额" width="100px" style="text-align: right">
  465. <template slot-scope="{ row }">
  466. <span>{{ displayAmt(row.amountDr) }}</span>
  467. </template>
  468. </el-table-column>
  469. <el-table-column prop="amountDrOffCurrent" label="本次可核销" width="120px" style="text-align: right">
  470. <template slot-scope="{ row }">
  471. <el-input-number
  472. v-if="subjectRow.dc === 'C' && row.amountDrBlc !== '0.00'"
  473. style="width: 100%"
  474. v-model="row.amountDrOffCurrent"
  475. size="small"
  476. autocomplete="off"
  477. :disabled="form.voucherStatus == 1"
  478. placeholder="请输入借方"
  479. :precision="2"
  480. @change="offAmountBlur(row, 'D')"
  481. :controls="false"
  482. >
  483. </el-input-number>
  484. <span v-if="subjectRow.dc === 'D' || row.amountDr === '0.00'">{{ displayAmt(row.amountDrOff) }}</span>
  485. </template>
  486. </el-table-column>
  487. <el-table-column prop="amountDrBlc" label="核销余额" width="100px" style="text-align: right">
  488. <template slot-scope="{ row }">
  489. <span>{{ displayAmt(row.amountDrBlc) }}</span>
  490. </template>
  491. </el-table-column>
  492. </el-table-column>
  493. <el-table-column label="货方">
  494. <el-table-column prop="amountCr" label="金额" width="100px" style="text-align: right">
  495. <template slot-scope="{ row }">
  496. <span>{{ displayAmt(row.amountCr) }}</span>
  497. </template>
  498. </el-table-column>
  499. <el-table-column prop="amountCrOffCurrent" label="本次可核销" width="120px" style="text-align: right">
  500. <template slot-scope="{ row }">
  501. <el-input-number
  502. v-if="subjectRow.dc !== 'C' && row.amountCrBlc !== '0.00'"
  503. style="width: 100%"
  504. v-model="row.amountCrOffCurrent"
  505. size="small"
  506. autocomplete="off"
  507. :disabled="form.voucherStatus == 1"
  508. placeholder="请输入货方"
  509. :precision="2"
  510. @change="offAmountBlur(row, 'C')"
  511. :controls="false"
  512. >
  513. </el-input-number>
  514. <span v-if="subjectRow.dc === 'C' || row.amountCrBlc === '0.00'">{{ displayAmt(row.amountCrOff) }}</span>
  515. </template>
  516. </el-table-column>
  517. <el-table-column prop="amountCrBlc" label="核销余额" width="100px" style="text-align: right">
  518. <template slot-scope="{ row }">
  519. <span>{{ displayAmt(row.amountCrBlc) }}</span>
  520. </template>
  521. </el-table-column>
  522. </el-table-column>
  523. </el-table-column>
  524. <el-table-column label="外币金额">
  525. <el-table-column prop="curCode" label="币种" width="50px" align="center"> </el-table-column>
  526. <el-table-column prop="exrate" label="汇率" width="80px" style="text-align: right">
  527. <template slot-scope="{ row }">
  528. <span>{{ row.exrate ? Number(row.exrate).toFixed(4) : "" }}</span>
  529. </template>
  530. </el-table-column>
  531. <el-table-column label="借方">
  532. <el-table-column prop="amountDrUsd" label="金额" width="100px" style="text-align: right">
  533. <template slot-scope="{ row }">
  534. <span>{{ displayAmt(row.amountDrUsd) }}</span>
  535. </template>
  536. </el-table-column>
  537. <el-table-column prop="amountDrUsdOffCurrent" label="本次可核销" width="120px" style="text-align: right">
  538. <template slot-scope="{ row }">
  539. <el-input-number
  540. v-if="subjectRow.dc === 'C' && row.amountDrUsdBlc !== '0.00'"
  541. style="width: 100%; text-align: right"
  542. v-model="row.amountDrUsdOffCurrent"
  543. size="small"
  544. autocomplete="off"
  545. :disabled="form.voucherStatus == 1 || row.curCode == 'CNY'"
  546. clearable
  547. placeholder="请输入借方"
  548. :precision="2"
  549. @change="offAmountUSDBlur(row, 'Dusd')"
  550. :controls="false"
  551. >
  552. </el-input-number>
  553. <span v-if="subjectRow.dc === 'D' || row.amountDrUsdBlc === '0.00'">{{ displayAmt(row.amountDrUsdOff) }}</span>
  554. </template>
  555. </el-table-column>
  556. <el-table-column prop="amountDrUsdBlc" label="核销余额" width="100px" style="text-align: right">
  557. <template slot-scope="{ row }">
  558. <span>{{ displayAmt(row.amountDrUsdBlc) }}</span>
  559. </template>
  560. </el-table-column>
  561. </el-table-column>
  562. <el-table-column label="货方">
  563. <el-table-column prop="amountCrUsd" label="金额" width="100px" style="text-align: right">
  564. <template slot-scope="{ row }">
  565. <span>{{ displayAmt(row.amountCrUsd) }}</span>
  566. </template>
  567. </el-table-column>
  568. <el-table-column prop="amountCrUsdOffCurrent" label="金额" width="120px" style="text-align: right">
  569. <template slot-scope="{ row }">
  570. <el-input-number
  571. v-if="subjectRow.dc !== 'C' && row.amountCrUsdBlc !== '0.00'"
  572. style="width: 100%"
  573. v-model="row.amountCrUsdOffCurrent"
  574. size="small"
  575. autocomplete="off"
  576. :disabled="form.voucherStatus == 1 || row.curCode == 'CNY'"
  577. clearable
  578. placeholder="请输入货方"
  579. :precision="2"
  580. @change="offAmountUSDBlur(row, 'Cusd')"
  581. :controls="false"
  582. >
  583. </el-input-number>
  584. <span v-if="subjectRow.dc === 'C' || row.amountCrUsdBlc === '0.00'">{{ displayAmt(row.amountCrUsdOff) }}</span>
  585. </template>
  586. </el-table-column>
  587. <el-table-column prop="amountCrUsdBlc" label="核销余额" width="100px" style="text-align: right">
  588. <template slot-scope="{ row }">
  589. <span>{{ displayAmt(row.amountCrUsdBlc) }}</span>
  590. </template>
  591. </el-table-column>
  592. </el-table-column>
  593. </el-table-column>
  594. </el-table>
  595. </div>
  596. <span slot="footer" class="dialog-footer">
  597. <el-button @click="offRecordsVisible = false">取 消</el-button>
  598. <el-button type="primary" @click="offRecordsDeterminefun">确 定</el-button>
  599. </span>
  600. </el-dialog>
  601. </div>
  602. </div>
  603. </template>
  604. <script>
  605. import dicSelect from "@/components/dicSelect/main";
  606. import dateRange from "@/components/dateRange/main.vue";
  607. import pickedData from "./components/pickedData.vue";
  608. import fromtableDetails from "./components/fromtableDetails.vue";
  609. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  610. import { dateFormat } from "@/util/date";
  611. import {
  612. finstlbillsConfirmSettlement,
  613. finstlbillsDetail,
  614. finstlbillsRevokeSettlement,
  615. finstlbillsSubmit,
  616. revokeSettlementApprove,
  617. confirmOffset,
  618. revokeOffset,
  619. finInvoicesApprove,
  620. revokeFinInvoicesApprove,
  621. agreementListAll,
  622. finstlbillslistAccBillByCorp,
  623. voucherRemove,
  624. finstlbillsGenerateVoucher,
  625. finstlbillsSubmitVouchers,
  626. } from "@/api/iosBasicData/finstlbills";
  627. import { accountsDetail } from "@/api/iosBasicData/accounts";
  628. import { getOffVoucherItems } from "@/api/iosBasicData/finvouchers";
  629. import { generateFinStlBills } from "@/api/iosBasicData/fininvoices";
  630. import { confirmWriteOff, revokeWriteOff } from "@/api/iosBasicData/writeOff.js";
  631. import { getListAllDetail } from "@/api/iosBasicData/cashier.js";
  632. import { getWorkDicts } from "@/api/system/dictbiz";
  633. import { getDeptLazyTree } from "@/api/system/dept";
  634. import { getBcorpsList } from "@/api/iosBasicData/bcorps";
  635. import { selectEmpls } from "@/api/approval/processConfig";
  636. import TreeSelect from "@/components/iosbasic-data/TreeSelect.vue";
  637. import businessReports from "@/components/iosbasic-data/businessReportsTS.vue";
  638. import reports from "@/components/iosbasic-data/reportsTS.vue";
  639. import _ from "lodash";
  640. export default {
  641. name: "detailsPage",
  642. data() {
  643. return {
  644. show: true,
  645. showSpan: false,
  646. canEditVoucher: false, // 凭证是否可以编辑
  647. handleSelectionData2: [], // 分录多选的数据
  648. removedFinvouchersitems: [],
  649. voucherTypeData: [], // 凭证字数据
  650. auxiliaryVisible: false, // 辅助核算弹窗
  651. offRecordsVisible: false, // 预收预付核销弹窗
  652. offRecordsData: [], // 预收预付核销数据
  653. offRecordsSelectionData: [],
  654. subjectRowOff: {}, // 核销科目弹窗的显示数据
  655. subjectRow: {}, // 科目弹窗的显示数据
  656. subjectAccount: {}, // 当前选择科目的数据
  657. corpCnNameData: [], // 客户核算 下拉数据
  658. deptData: [], // 部门核算 下拉数据
  659. emplData: [], // 职员核算 下拉数据
  660. itemData: [], // 项目核算 下拉数据
  661. editButton: false,
  662. editDisabled: false,
  663. activeName: "1",
  664. form: {},
  665. optionForm: {
  666. menuBtn: false,
  667. span: 5,
  668. disabled: false,
  669. labelWidth: 70,
  670. column: [
  671. {
  672. label: "结算单号",
  673. prop: "billNo",
  674. placeholder:"系统生成结算单号",
  675. disabled: true,
  676. },
  677. {
  678. label: "结算单位",
  679. prop: "corpCnName",
  680. disabled: true,
  681. },
  682. {
  683. label: "结算日期",
  684. prop: "billDate",
  685. type: "date",
  686. format: "yyyy-MM-dd",
  687. valueFormat: "yyyy-MM-dd HH:mm:ss",
  688. disabled: false,
  689. },
  690. {
  691. label: "开户帐号",
  692. prop: "bankAccountNo",
  693. disabled: false,
  694. },
  695. {
  696. label: "来源单号",
  697. prop: "requestNo",
  698. disabled: true,
  699. span: 4,
  700. },
  701. ],
  702. },
  703. optionForm2: {
  704. menuBtn: false,
  705. span: 5,
  706. disabled: false,
  707. labelWidth: 70,
  708. column: [
  709. {
  710. label: "收/付",
  711. prop: "dc",
  712. type: "select",
  713. dicData: [
  714. {
  715. label: "收",
  716. value: "D",
  717. },
  718. {
  719. label: "付",
  720. value: "C",
  721. },
  722. ],
  723. disabled: true,
  724. span: 3,
  725. },
  726. {
  727. label: "币别",
  728. labelWidth: 40,
  729. prop: "curCode",
  730. type: "select",
  731. dicUrl: "/api/blade-los/bcurrency/page?current=1&size=10&code={{key}}",
  732. props: {
  733. label: "code",
  734. value: "code",
  735. res: "data.records",
  736. },
  737. disabled: true,
  738. span: 2,
  739. },
  740. {
  741. label: "业务类型",
  742. prop: "businessTypes",
  743. type: "select",
  744. dicData: [
  745. {
  746. label: "海运出口",
  747. value: "SE",
  748. },
  749. {
  750. label: "海运进口",
  751. value: "SI",
  752. },
  753. ],
  754. filterable: true,
  755. multiple: true,
  756. dataType: "string",
  757. tags: true,
  758. disabled: true,
  759. },
  760. {
  761. label: "主单号",
  762. prop: "mblno",
  763. disabled: true,
  764. },
  765. {
  766. label: "分单号",
  767. prop: "hblno",
  768. disabled: true,
  769. },
  770. {
  771. label: "业务编号",
  772. prop: "businessNo",
  773. disabled: true,
  774. span: 4,
  775. },
  776. {
  777. label: "业务日期",
  778. prop: "businessDate", // businessDate只是插槽值 字段为 businessDateStart businessDateEnd
  779. disabled: true,
  780. },
  781. {
  782. label: "费用名称",
  783. prop: "feeCnName",
  784. type: "select",
  785. dicUrl: "/api/blade-los/bfees/listAll",
  786. props: {
  787. label: "cnName",
  788. value: "cnName",
  789. },
  790. filterable: true,
  791. multiple: true,
  792. dataType: "string",
  793. tags: true,
  794. disabled: true,
  795. },
  796. {
  797. label: "船名",
  798. prop: "vesselCnName",
  799. disabled: true,
  800. },
  801. {
  802. label: "航次",
  803. prop: "voyageNo",
  804. disabled: true,
  805. },
  806. {
  807. label: "ACCT NO",
  808. prop: "accountNo",
  809. disabled: true,
  810. span: 4,
  811. },
  812. ],
  813. },
  814. dcOptions: [
  815. {
  816. label: "收",
  817. value: "D",
  818. },
  819. {
  820. label: "付",
  821. value: "C",
  822. },
  823. ],
  824. retrievePopupsType: false, // 弹窗开启关闭
  825. retrievePopupsData: [], // 选择弹窗数据
  826. retrievePopupsOption: {
  827. border: true,
  828. calcHeight: 30,
  829. tip: false,
  830. height: 500,
  831. index: true,
  832. addBtn: false,
  833. viewBtn: false,
  834. delBtn: false,
  835. editBtn: false,
  836. refreshBtn: false,
  837. columnBtn: false,
  838. menuWidth: "60",
  839. column: [
  840. {
  841. label: "客户中文名",
  842. prop: "cnName",
  843. overHidden: true,
  844. },
  845. {
  846. label: "客户英文文名",
  847. prop: "cnEame",
  848. overHidden: true,
  849. },
  850. ],
  851. },
  852. roleName: localStorage.getItem("roleName").split(","),
  853. saberUserInfo: JSON.parse(localStorage.getItem("saber-userInfo")).content, // 当前登录人个人信息
  854. };
  855. },
  856. components: {
  857. dicSelect,
  858. pickedData,
  859. dateRange,
  860. fromtableDetails,
  861. SearchQuery,
  862. TreeSelect,
  863. businessReports,
  864. reports,
  865. },
  866. props: {
  867. detailData: Object,
  868. pageIds: {
  869. type: Array, // 指定 prop 的类型为 Array
  870. default: () => [], // 提供一个默认值,这里使用函数形式返回一个空数组
  871. },
  872. },
  873. async created() {
  874. if (this.detailData && this.detailData.settlementId) {
  875. this.getSettlement(this.detailData.settlementId, this.detailData.dc, this.detailData.type);
  876. }
  877. if (this.detailData && this.detailData.id) {
  878. this.editButton = true;
  879. this.editDisabled = true;
  880. this.optionForm.disabled = true;
  881. this.optionForm2.disabled = true;
  882. this.getDetail(this.detailData.id);
  883. }
  884. getWorkDicts("voucher_word_los").then((res) => {
  885. this.voucherTypeData = res.data.data;
  886. });
  887. },
  888. methods: {
  889. enter() {
  890. this.showSpan = true;
  891. },
  892. leave() {
  893. this.showSpan = false;
  894. },
  895. //凭证代码
  896. offRecordsDeterminefun() {
  897. if (!Array.isArray(this.offRecordsData)) {
  898. this.offRecordsVisible = false;
  899. return;
  900. }
  901. if (this.offRecordsSelectionData.length === 0) {
  902. return this.$message.warning("请选择至少一条数据");
  903. }
  904. let row = this.subjectRow;
  905. let amt = row.dc === "D" ? Number(row.amountCr) : Number(row.amountDr);
  906. let usd = row.dc === "D" ? Number(row.amountCrUsd) : Number(row.amountDrUsd);
  907. let amtOff = 0.0,
  908. usdOff = 0;
  909. let rows = [];
  910. this.offRecordsSelectionData.forEach((item) => {
  911. let currAmt = 0;
  912. if (row.dc === "D") {
  913. currAmt = Number(item.amountCrOffCurrent);
  914. amtOff = amtOff + currAmt;
  915. if (item.curCode === "USD") {
  916. usdOff = usdOff + Number(item.amountCrUsdOffCurrent);
  917. }
  918. } else {
  919. currAmt = Number(item.amountDrOffCurrent);
  920. amtOff = amtOff + currAmt;
  921. if (item.curCode === "USD") {
  922. usdOff = usdOff + Number(item.amountDrUsdOffCurrent);
  923. }
  924. }
  925. currAmt = currAmt > 0.0 ? currAmt.toFixed(2) : "0.00";
  926. if (currAmt !== "0.00") {
  927. rows.push(item);
  928. }
  929. });
  930. if (Number(amt.toFixed(2)) < Number(amtOff.toFixed(2))) {
  931. return this.$message({
  932. dangerouslyUseHTMLString: true,
  933. message: "<div>选定核销金额不应该大于应核销金额!</div>",
  934. type: "warning",
  935. });
  936. }
  937. rows.forEach((item) => {
  938. let obj = {
  939. dynUID: this.newGuid().replace(/-/g, ""),
  940. };
  941. let flds = "accountId,accountCode,accountCnName,accountEnName,accountFullName,accountLevel,accountProperty,dc,";
  942. flds += "isArAp,isCorp,isDc,isDept,isEmpl,isForeign,curCode,isQuantity,unitNo,isItem,itemClassify,itemClassifyId,itemId,itemName,";
  943. flds += "corpId,corpShortName,corpCnName,corpEnName,deptId,deptName,emplId,emplName,exrate";
  944. flds.split(",").forEach((name) => {
  945. obj[name] = item[name];
  946. });
  947. obj.descr = row.descr;
  948. if (row.dc === "D") {
  949. obj.amountDr = item.amountCrOffCurrent;
  950. obj.amountCr = 0.0;
  951. if (item.curCode === "USD") {
  952. obj.amountDrUsd = item.amountCrUsdOffCurrent;
  953. obj.amountCrUsd = 0.0;
  954. }
  955. } else {
  956. obj.amountCr = item.amountDrOffCurrent;
  957. obj.amountDr = 0.0;
  958. if (item.curCode === "USD") {
  959. obj.amountCrUsd = item.amountDrUsdOffCurrent;
  960. obj.amountDrUsd = 0.0;
  961. }
  962. }
  963. obj.isOff = 1;
  964. obj.offSrcItemId = item.id;
  965. obj.offVouItemId = row.id;
  966. if (!Array.isArray(row.offVouItems)) row.offVouItems = [];
  967. row.offVouItems.push(obj);
  968. this.form.finStlBillsVoucherItemsList.push(obj);
  969. });
  970. this.offRecordsVisible = false;
  971. },
  972. handleClose(done) {
  973. done();
  974. },
  975. corpChange2(value, name) {
  976. let found = false;
  977. // 客户名称客户名称
  978. if (name == "corpCnName") {
  979. for (let item of this.corpCnNameData) {
  980. if (item.cnName == value) {
  981. found = true;
  982. this.$set(this.subjectRow, "corpEnName", item.enName);
  983. this.$set(this.subjectRow, "corpCnName", item.cnName);
  984. this.$set(this.subjectRow, "corpShortName", item.shortName);
  985. this.$set(this.subjectRow, "corpId", item.id);
  986. }
  987. }
  988. if (!found) {
  989. this.$set(this.subjectRow, "corpEnName", "");
  990. this.$set(this.subjectRow, "corpCnName", "");
  991. this.$set(this.subjectRow, "corpShortName", "");
  992. this.$set(this.subjectRow, "corpId", 0);
  993. }
  994. }
  995. // 核算
  996. else if (name == "deptName") {
  997. for (let item of this.deptData) {
  998. if (item.title == value) {
  999. found = true;
  1000. this.$set(this.subjectRow, "deptName", item.title);
  1001. this.$set(this.subjectRow, "deptId", item.id);
  1002. }
  1003. }
  1004. if (!found) {
  1005. this.$set(this.subjectRow, "deptName", "");
  1006. this.$set(this.subjectRow, "deptId", 0);
  1007. }
  1008. }
  1009. // 职员
  1010. else if (name == "emplName") {
  1011. for (let item of this.emplData) {
  1012. if (item.name == value) {
  1013. found = true;
  1014. this.$set(this.subjectRow, "emplName", item.name);
  1015. this.$set(this.subjectRow, "emplId", item.id);
  1016. }
  1017. }
  1018. if (!found) {
  1019. this.$set(this.subjectRow, "emplName", "");
  1020. this.$set(this.subjectRow, "emplId", 0);
  1021. }
  1022. }
  1023. // 项目核算
  1024. else if (name == "itemName") {
  1025. for (let item of this.itemData) {
  1026. if (item.cnName == value) {
  1027. found = true;
  1028. this.$set(this.subjectRow, "itemName", item.cnName);
  1029. this.$set(this.subjectRow, "itemId", item.id);
  1030. }
  1031. }
  1032. if (!found) {
  1033. this.$set(this.subjectRow, "itemName", "");
  1034. this.$set(this.subjectRow, "itemId", 0);
  1035. }
  1036. } else if (name == "voucherType") {
  1037. this.$set(this.form, name, value);
  1038. for (let item of this.voucherTypeData) {
  1039. if (item.dictKey == value) {
  1040. found = true;
  1041. this.$set(this.form, "voucherTypeName", item.dictValue + "凭证");
  1042. }
  1043. }
  1044. if (!found) {
  1045. this.$set(this.subjectRow, "voucherTypeName", "");
  1046. }
  1047. } else if (name == "voucherSource") {
  1048. this.$set(this.form, name, value);
  1049. }
  1050. },
  1051. corpChangeOff(value, name) {
  1052. let found = false;
  1053. // 客户名称
  1054. if (name == "corpCnName") {
  1055. for (let item of this.corpCnNameData) {
  1056. if (item.cnName == value) {
  1057. found = true;
  1058. this.$set(this.subjectRowOff, "corpEnName", item.enName);
  1059. this.$set(this.subjectRowOff, "corpCnName", item.cnName);
  1060. this.$set(this.subjectRowOff, "corpShortName", item.shortName);
  1061. this.$set(this.subjectRowOff, "corpId", item.id);
  1062. }
  1063. }
  1064. if (!found) {
  1065. this.$set(this.subjectRowOff, "corpEnName", "");
  1066. this.$set(this.subjectRowOff, "corpCnName", "");
  1067. this.$set(this.subjectRowOff, "corpShortName", "");
  1068. this.$set(this.subjectRowOff, "corpId", 0);
  1069. }
  1070. }
  1071. // 核算
  1072. else if (name == "deptName") {
  1073. for (let item of this.deptData) {
  1074. if (item.title == value) {
  1075. found = true;
  1076. this.$set(this.subjectRowOff, "deptName", item.title);
  1077. this.$set(this.subjectRowOff, "deptId", item.id);
  1078. }
  1079. }
  1080. if (!found) {
  1081. this.$set(this.subjectRowOff, "deptName", "");
  1082. this.$set(this.subjectRowOff, "deptId", 0);
  1083. }
  1084. }
  1085. // 职员
  1086. else if (name == "emplName") {
  1087. for (let item of this.emplData) {
  1088. if (item.name == value) {
  1089. found = true;
  1090. this.$set(this.subjectRowOff, "emplName", item.name);
  1091. this.$set(this.subjectRowOff, "emplId", item.id);
  1092. }
  1093. }
  1094. if (!found) {
  1095. this.$set(this.subjectRowOff, "emplName", "");
  1096. this.$set(this.subjectRowOff, "emplId", 0);
  1097. }
  1098. }
  1099. // 项目核算
  1100. else if (name == "itemName") {
  1101. for (let item of this.itemData) {
  1102. if (item.cnName == value) {
  1103. found = true;
  1104. this.$set(this.subjectRowOff, "itemName", item.cnName);
  1105. this.$set(this.subjectRowOff, "itemId", item.id);
  1106. }
  1107. }
  1108. if (!found) {
  1109. this.$set(this.subjectRowOff, "itemName", "");
  1110. this.$set(this.subjectRowOff, "itemId", 0);
  1111. }
  1112. } else if (name == "voucherType") {
  1113. this.$set(this.form, name, value);
  1114. for (let item of this.voucherTypeData) {
  1115. if (item.dictKey == value) {
  1116. found = true;
  1117. this.$set(this.form, "voucherTypeName", item.dictValue + "凭证");
  1118. }
  1119. }
  1120. if (!found) {
  1121. this.$set(this.subjectRowOff, "voucherTypeName", "");
  1122. }
  1123. } else if (name == "voucherSource") {
  1124. this.$set(this.form, name, value);
  1125. }
  1126. },
  1127. bottonSearchfun(name) {
  1128. this.$nextTick(() => {
  1129. if (this.$refs.bcorps.selectionList.length == 0) return;
  1130. this.$refs.bcorps.$refs.crud.toggleSelection(); // 先清空所以选择的数据
  1131. });
  1132. },
  1133. // 下拉多选弹窗数据多选回调
  1134. eldialogMultipleChoice(list, name) {
  1135. if (name == "bcorps") {
  1136. let arr = [];
  1137. if (list.length > 1) {
  1138. this.$refs.bcorps.$refs.crud.toggleSelection(); // 先清空所以选择的数据
  1139. arr = [list[list.length - 1]]; // 获取最新点击的数组
  1140. this.$refs.bcorps.$refs.crud.toggleSelection(arr, true); // 把刚点击的数组变成选择状态
  1141. } else {
  1142. arr = list;
  1143. }
  1144. this.$refs.bcorps.selectionList = arr;
  1145. } else {
  1146. console.log("其他的组件");
  1147. }
  1148. },
  1149. // 下拉多选弹窗的确认
  1150. eldialogConfirm(name) {
  1151. if (name == "bcorps") {
  1152. if (this.$refs.bcorps.isShow) {
  1153. console.log("列表确认");
  1154. this.$set(this.subjectRow, "corpCnName", this.$refs.bcorps.selectionList[0].cnName);
  1155. this.$set(this.subjectRow, "corpEnName", this.$refs.bcorps.selectionList[0].enName);
  1156. this.$set(this.subjectRow, "corpId", this.$refs.bcorps.selectionList[0].id);
  1157. } else {
  1158. console.log("详情确认");
  1159. this.$refs.bcorps.$refs.detail.submitForm();
  1160. this.$set(this.subjectRow, "corpCnName", this.$refs.bcorps.$refs.detail.formData.cnName);
  1161. this.$set(this.subjectRow, "corpEnName", this.$refs.bcorps.$refs.detail.formData.enName);
  1162. this.$set(this.subjectRow, "corpId", this.$refs.bcorps.$refs.detail.formData.id);
  1163. }
  1164. } else {
  1165. console.log("其他的组件");
  1166. }
  1167. this.$refs.searchQueryRef.corpVisible = false;
  1168. },
  1169. // 下拉多选弹窗的确认
  1170. eldialogConfirmOff(name) {
  1171. if (name == "bcorps") {
  1172. if (this.$refs.bcorps.isShow) {
  1173. console.log("列表确认");
  1174. this.$set(this.subjectRowOff, "corpCnName", this.$refs.bcorps.selectionList[0].cnName);
  1175. this.$set(this.subjectRowOff, "corpEnName", this.$refs.bcorps.selectionList[0].enName);
  1176. this.$set(this.subjectRowOff, "corpId", this.$refs.bcorps.selectionList[0].id);
  1177. } else {
  1178. console.log("详情确认");
  1179. this.$refs.bcorps.$refs.detail.submitForm();
  1180. this.$set(this.subjectRowOff, "corpCnName", this.$refs.bcorps.$refs.detail.formData.cnName);
  1181. this.$set(this.subjectRowOff, "corpEnName", this.$refs.bcorps.$refs.detail.formData.enName);
  1182. this.$set(this.subjectRowOff, "corpId", this.$refs.bcorps.$refs.detail.formData.id);
  1183. }
  1184. } else {
  1185. console.log("其他的组件");
  1186. }
  1187. this.$refs.searchQueryRef.corpVisible = false;
  1188. },
  1189. fixedAmt(amt, len) {
  1190. let N = Number(amt);
  1191. let S = isNaN(N) ? "0.00" : N.toFixed(2);
  1192. while (S.length < len) {
  1193. S = "_" + S;
  1194. }
  1195. return S;
  1196. },
  1197. displayAmt(amt, len) {
  1198. let N = Number(amt);
  1199. let S = isNaN(N) ? "" : N.toFixed(len ? len : 2);
  1200. let Z = 0;
  1201. return S === Z.toFixed(len ? len : 2) ? "" : S;
  1202. },
  1203. // 表头样式
  1204. tableHeaderCellStyle({ row, column, rowIndex, columnIndex }) {
  1205. return "padding:4px 0px;fontSize:12px;color:#000;background:#ecf5ff;text-align:center";
  1206. },
  1207. summaryMethodOff(param) {
  1208. const { columns, data } = param;
  1209. const sums = [];
  1210. columns.forEach((column, index) => {
  1211. if (index === 2) {
  1212. sums[index] = "合计";
  1213. return;
  1214. }
  1215. const values = data.map((item) => Number(item[column.property]));
  1216. // 显示列的统计 金额
  1217. let arr = ["amountDrOffCurrent", "amountCrOffCurrent", "amountDrUsdOffCurrent", "amountCrUsdOffCurrent"];
  1218. // 判断是否有这个数据
  1219. if (arr.indexOf(column.property) != -1) {
  1220. if (!values.every((value) => isNaN(value))) {
  1221. sums[index] = values.reduce((prev, curr) => {
  1222. const value = Number(curr);
  1223. if (!isNaN(value)) {
  1224. return prev + curr;
  1225. } else {
  1226. return prev;
  1227. }
  1228. }, 0);
  1229. sums[index] = this.displayAmt(sums[index]); // 把合计的参数保留两位小数
  1230. // sums[index] += " 元";
  1231. } else {
  1232. sums[index] = " ";
  1233. }
  1234. }
  1235. });
  1236. return sums;
  1237. },
  1238. rowClassName({ row, rowIndex }) {
  1239. let rowName = "",
  1240. findRow = this.handleSelectionData.find((c) => c.rowIndex === row.rowIndex);
  1241. if (findRow) {
  1242. rowName = "current-row "; // elementUI 默认高亮行的class类 不用再样式了^-^,也可通过css覆盖改变背景颜色
  1243. }
  1244. return rowName; //也可以再加上其他类名 如果有需求的话
  1245. },
  1246. // 表格多选数据
  1247. handleOffRecordsSelectionChange(list) {
  1248. this.offRecordsSelectionData = list;
  1249. },
  1250. // 辅助核算弹窗确认按钮
  1251. auxiliaryDeterminefun() {
  1252. this.auxiliaryVisible = false;
  1253. },
  1254. // 生成凭证
  1255. generateVoucherfun() {
  1256. this.$confirm("确定要生成凭证?", {
  1257. confirmButtonText: "确定",
  1258. cancelButtonText: "取消",
  1259. type: "warning",
  1260. }).then(() => {
  1261. this.oneClickSave(() => {
  1262. const loading = this.$loading({
  1263. lock: true,
  1264. text: "加载中",
  1265. spinner: "el-icon-loading",
  1266. background: "rgba(255,255,255,0.7)",
  1267. });
  1268. finstlbillsGenerateVoucher({ id: this.form.id })
  1269. .then((res) => {
  1270. this.$message.success("操作成功");
  1271. this.finstlbillsDetailfun(this.form.id);
  1272. })
  1273. .finally(() => {
  1274. loading.close();
  1275. });
  1276. });
  1277. /*
  1278. this.pageLoading = true;
  1279. this.form.businessDateStart = this.form.businessDateStart ? this.form.businessDateStart.slice(0, 10) + " 00:00:00" : null; // 财务开始日期
  1280. this.form.businessDateEnd = this.form.businessDateEnd ? this.form.businessDateEnd.slice(0, 10) + " 00:00:00" : null; // 财务开始日期
  1281. this.form.billDate = this.form.billDate ? this.form.billDate.slice(0, 10) + " 00:00:00" : null;
  1282. this.form.auditDateTo = this.form.auditDateTo ? this.form.auditDateTo.slice(0, 10) + " 00:00:00" : null;
  1283. this.form.voucherDate = this.form.voucherDate ? this.form.voucherDate.slice(0, 10) + " 00:00:00" : null;
  1284. if(Array.isArray(this.form.finStlBillsItemsList)){
  1285. this.form.finStlBillsItemsList.forEach((item, index) => {
  1286. item.voucherDate = item.voucherDate ? item.voucherDate.slice(0, 10) + " 00:00:00" : null;
  1287. })
  1288. }
  1289. if(Array.isArray(this.form.finStlBillsVoucherItemsList)){
  1290. this.form.finStlBillsVoucherItemsList.forEach((item, index) => {
  1291. item.voucherDate = item.voucherDate ? item.voucherDate.slice(0, 10) + " 00:00:00" : null;
  1292. })
  1293. }
  1294. finstlbillsGenerateVoucher(this.form)
  1295. .then((res) => {
  1296. this.$message.success("操作成功");
  1297. this.finstlbillsDetailfun(this.form.id);
  1298. })
  1299. .finally(() => {
  1300. this.pageLoading = false;
  1301. });
  1302. */
  1303. });
  1304. },
  1305. // 保存结算凭证模板
  1306. finstlbillsSubmitVouchersfun(callback) {
  1307. if (!this.form.id) {
  1308. return this.$message({
  1309. dangerouslyUseHTMLString: true,
  1310. message: "请首选保存结算单!",
  1311. type: "warning",
  1312. });
  1313. }
  1314. if (this.form.estimatedTime) {
  1315. this.form.estimatedTime = this.form.estimatedTime + " 00:00:00";
  1316. }
  1317. this.form.billNoFormat = "STL";
  1318. this.form.businessTypeCode = "STL";
  1319. this.form.businessType = "STL"; // 结算单
  1320. this.form.businessDateStart = this.form.businessDateStart ? this.form.businessDateStart.slice(0, 10) + " 00:00:00" : null; // 财务开始日期
  1321. this.form.businessDateEnd = this.form.businessDateEnd ? this.form.businessDateEnd.slice(0, 10) + " 00:00:00" : null; // 财务开始日期
  1322. this.form.billDate = this.form.billDate ? this.form.billDate.slice(0, 10) + " 00:00:00" : null;
  1323. this.form.auditDateTo = this.form.auditDateTo ? this.form.auditDateTo.slice(0, 10) + " 00:00:00" : null;
  1324. this.form.voucherDate = this.form.voucherDate ? this.form.voucherDate.slice(0, 10) + " 00:00:00" : null;
  1325. if (Array.isArray(this.form.finStlBillsItemsList)) {
  1326. this.form.finStlBillsItemsList.forEach((item, index) => {
  1327. item.voucherDate = item.voucherDate ? item.voucherDate.slice(0, 10) + " 00:00:00" : null;
  1328. });
  1329. }
  1330. let msgs = [];
  1331. let amountDrSum = 0;
  1332. let amountCrSum = 0;
  1333. let index = 0;
  1334. if (this.form.finStlBillsVoucherItemsList && this.form.finStlBillsVoucherItemsList.length) {
  1335. for (let item of this.form.finStlBillsVoucherItemsList) {
  1336. index++;
  1337. let amtDr = this.forceNumber(item.amountDr);
  1338. let amtCr = this.forceNumber(item.amountCr);
  1339. amountDrSum += amtDr;
  1340. amountCrSum += amtCr;
  1341. let descr = item.descr ? item.descr.trim() : "";
  1342. if (!descr) {
  1343. // 生成凭证时自动填写
  1344. // msgs.push(`第 ${index} 行分录请填写摘要!`);
  1345. } else {
  1346. item.descr = descr;
  1347. }
  1348. if (!item.accountId) {
  1349. msgs.push(`第 ${index} 行分录缺少科目代码!`);
  1350. } else {
  1351. if (item.isCorp === 1 && !item.corpId) {
  1352. msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算客户,请选择客户名称!`);
  1353. }
  1354. if (item.isDept === 1 && !item.deptId) {
  1355. msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算部门,请选择部门名称!`);
  1356. }
  1357. if (item.isEmpl === 1 && !item.emplId) {
  1358. msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算职员,请选择职员名称!`);
  1359. }
  1360. // if (item.isItem === 1 && !item.itemId) {
  1361. // msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 核算项目,请选择项目名称!`);
  1362. // }
  1363. if (amtDr.toFixed(2) === "0.00" && amtCr.toFixed(2) === "0.00") {
  1364. msgs.push(`第 ${index} 行分录科目 ${item.accountCode} ${item.accountFullName} 请填写金额!`);
  1365. }
  1366. }
  1367. }
  1368. if (amountDrSum !== amountCrSum) {
  1369. msgs.push(`凭证借贷金额不平衡!`);
  1370. }
  1371. if (msgs.length > 0) {
  1372. return this.$message({
  1373. dangerouslyUseHTMLString: true,
  1374. message: msgs.join("<br /><br />"),
  1375. type: "warning",
  1376. });
  1377. }
  1378. }
  1379. const loading = this.$loading({
  1380. lock: true,
  1381. text: "加载中",
  1382. spinner: "el-icon-loading",
  1383. background: "rgba(255,255,255,0.7)",
  1384. });
  1385. finstlbillsSubmitVouchers(this.form)
  1386. .then((res) => {
  1387. this.$message.success("操作成功");
  1388. this.$set(this.form, "version", res.data.data.version);
  1389. this.$set(this.form, "finStlBillsVoucherItemsList", res.data.data.finStlBillsVoucherItemsList);
  1390. if (typeof callback === "function") {
  1391. callback();
  1392. }
  1393. loading.close();
  1394. })
  1395. .catch(() => {
  1396. loading.close();
  1397. });
  1398. },
  1399. forceNumber(n) {
  1400. try {
  1401. let N = parseFloat(n);
  1402. if (isNaN(N)) {
  1403. N = 0.0;
  1404. } else {
  1405. let S = N.toFixed(2);
  1406. N = Number(S);
  1407. }
  1408. return N;
  1409. } catch (e) {
  1410. return 0.0;
  1411. }
  1412. },
  1413. oneClickSave(callback) {
  1414. if (this.form.finStlBillsVoucherItemsList.length < 2) {
  1415. return this.$message.warning("请填写至少凭证两笔分录后再保存!");
  1416. }
  1417. this.finstlbillsSubmitVouchersfun(callback);
  1418. },
  1419. newGuid() {
  1420. let vd = "0123456789abcdefghijklmnopqrstuvwxyz".split("");
  1421. var i = vd,
  1422. o = [],
  1423. s = Math.random,
  1424. n;
  1425. (o[8] = o[13] = o[18] = o[23] = "-"), (o[14] = "4");
  1426. for (var r = 0; r < 36; r++) o[r] || ((n = 0 | (16 * s())), (o[r] = i[19 == r ? (3 & n) | 8 : 15 & n]));
  1427. return o.join("");
  1428. },
  1429. // 添加分录
  1430. addEntryfun() {
  1431. let obj = {
  1432. dynUID: this.newGuid().replace(/-/g, ""),
  1433. };
  1434. console.log(obj);
  1435. if (this.handleSelectionData2.length > 0) {
  1436. obj.descr = this.handleSelectionData2[this.handleSelectionData2.length - 1].descr;
  1437. } else {
  1438. if (this.form.finStlBillsVoucherItemsList.length > 0) {
  1439. obj.descr = this.form.finStlBillsVoucherItemsList[this.form.finStlBillsVoucherItemsList.length - 1].descr;
  1440. }
  1441. }
  1442. this.form.finStlBillsVoucherItemsList.push(obj);
  1443. },
  1444. isARAPRow(row) {
  1445. let code = row && row.accountCode ? row.accountCode : "";
  1446. return code.startsWith("1141") || code.startsWith("2121");
  1447. },
  1448. // 删除分录
  1449. deleteEntryfun() {
  1450. if (this.handleSelectionData2.length === 0) {
  1451. return this.$message.warning("请选择至少一条数据");
  1452. }
  1453. let multiList = this.handleSelectionData2.filter((r) => !this.isARAPRow(r));
  1454. if (multiList.length === 0) {
  1455. return this.$message.warning("请选择至少一条数据");
  1456. }
  1457. let offVouItems = [];
  1458. let arr = this.form.finStlBillsVoucherItemsList;
  1459. // 获取有id 的数据
  1460. const itemsWithId = multiList.filter((item) => item.id);
  1461. let arrIds = itemsWithId.map((item) => item.id); // 获取id 数据
  1462. console.log(arrIds);
  1463. // 把选中的删除掉
  1464. multiList.forEach((item) => {
  1465. offVouItems = offVouItems.concat(Array.isArray(item.offVouItems) ? item.offVouItems : []);
  1466. if (!item.hasOwnProperty("id")) {
  1467. for (let index in arr) {
  1468. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  1469. arr.splice(Number(index), 1);
  1470. }
  1471. }
  1472. }
  1473. });
  1474. // 有id 的处理
  1475. if (itemsWithId.length != 0) {
  1476. voucherRemove(arrIds.join(",")).then((res) => {
  1477. arrIds.forEach((id) => {
  1478. let i = this.form.finStlBillsVoucherItemsList.findIndex((item) => item.id === id);
  1479. if (i >= 0) {
  1480. let row = this.form.finStlBillsVoucherItemsList[i];
  1481. this.$set(row, "changeMode", "d");
  1482. this.removedFinvouchersitems.push();
  1483. this.form.finStlBillsVoucherItemsList.splice(i, 1);
  1484. }
  1485. });
  1486. this.$message.success("删除成功");
  1487. });
  1488. }
  1489. offVouItems.forEach((item) => {
  1490. let rowIdx = this.form.finStlBillsVoucherItemsList.indexOf(item);
  1491. if (rowIdx >= 0) {
  1492. if (item.id) {
  1493. this.$set(item, "changeMode", item.changeMode === "d" ? "u" : "d");
  1494. // this.finvouchersitemsRemovefun(row.id);
  1495. this.removedFinvouchersitems.push(item);
  1496. this.form.finStlBillsVoucherItemsList.splice(rowIdx, 1);
  1497. } else this.form.finStlBillsVoucherItemsList.splice(rowIdx, 1);
  1498. }
  1499. });
  1500. },
  1501. // 下拉回调
  1502. corpChange(value, name) {
  1503. this.$set(this.form, name, value);
  1504. },
  1505. handleSelectionChange2(list) {
  1506. this.handleSelectionData2 = list;
  1507. },
  1508. // 行添加
  1509. addRowsfun(row, index) {
  1510. //第二个参数为0的时候,是可以添加参数的,1的时候是删除
  1511. let obj = {
  1512. dynUID: this.newGuid().replace(/-/g, ""),
  1513. };
  1514. this.form.finStlBillsVoucherItemsList.splice(index, 0, obj);
  1515. },
  1516. // 行删除
  1517. deletefun(row, index) {
  1518. let offVouItems = Array.isArray(row.offVouItems) ? row.offVouItems : [];
  1519. if (row.id) {
  1520. this.$set(row, "changeMode", row.changeMode === "d" ? "u" : "d");
  1521. // this.finvouchersitemsRemovefun(row.id);
  1522. this.removedFinvouchersitems.push(row);
  1523. voucherRemove(row.id).then((res) => {
  1524. this.form.finStlBillsVoucherItemsList.splice(index, 1);
  1525. });
  1526. } else {
  1527. this.form.finStlBillsVoucherItemsList.splice(index, 1);
  1528. }
  1529. offVouItems.forEach((item) => {
  1530. let rowIdx = this.form.finStlBillsVoucherItemsList.indexOf(item);
  1531. if (rowIdx >= 0) {
  1532. if (item.id) {
  1533. this.$set(item, "changeMode", item.changeMode === "d" ? "u" : "d");
  1534. // this.finvouchersitemsRemovefun(row.id);
  1535. this.removedFinvouchersitems.push(item);
  1536. this.form.finStlBillsVoucherItemsList.splice(rowIdx, 1);
  1537. } else this.form.finStlBillsVoucherItemsList.splice(rowIdx, 1);
  1538. }
  1539. });
  1540. },
  1541. // 科目编辑打开辅助核算弹窗
  1542. auxiliaryAccountingfun(row) {
  1543. // 获取状态
  1544. accountsDetail(row.accountId).then((res) => {
  1545. this.subjectAccount = res.data.data;
  1546. this.subjectRow = row;
  1547. // 如果三个都没有勾选 直接不自动打开弹窗
  1548. if (res.data.data.isCorp || res.data.data.isDept || res.data.data.isEmpl || res.data.data.isItem) {
  1549. this.auxiliaryVisible = true;
  1550. }
  1551. });
  1552. },
  1553. // 获取核销记录
  1554. showOffRecordsfun(row) {
  1555. // 获取状态
  1556. this.subjectRowOff = JSON.parse(JSON.stringify(row));
  1557. getOffVoucherItems(this.subjectRowOff).then((res) => {
  1558. this.offRecordsSelectionData = [];
  1559. this.offRecordsData = Array.isArray(res.data.data) ? res.data.data : [];
  1560. this.subjectRow = row;
  1561. this.offRecordsVisible = true;
  1562. });
  1563. },
  1564. // 借方/贷方 本币的计算
  1565. offAmountBlur(row, name) {
  1566. if (name === "D") {
  1567. this.$set(row, "amountCrOffCurrent", 0);
  1568. }
  1569. if (name === "C") {
  1570. this.$set(row, "amountDrOffCurrent", 0);
  1571. }
  1572. let a = row.amountCrOffCurrent ? Number(row.amountCrOffCurrent) : 0;
  1573. this.$set(row, "amountCrOffCurrent", a > Number(row.amountCrBlc) ? Number(row.amountCrBlc) : a);
  1574. a = row.amountDrOff ? Number(row.amountDrOff) : 0;
  1575. this.$set(row, "amountDrOffCurrent", a > Number(row.amountDrBlc) ? Number(row.amountDrBlc) : a);
  1576. if (row.curCode === "USD") {
  1577. this.$set(row, "exrate", row.exrate ? Number(row.exrate) : 1);
  1578. this.$set(row, "amountCrUsdOffCurrent", (row.amountCrOffCurrent / row.exrate).toFixed(2));
  1579. this.$set(row, "amountDrUsdOffCurrent", (row.amountDrOffCurrent / row.exrate).toFixed(2));
  1580. }
  1581. },
  1582. // 外币的计算
  1583. offAmountUSDBlur(row, name) {
  1584. if (name === "Dusd") {
  1585. this.$set(row, "amountCrUsdOffCurrent", 0);
  1586. }
  1587. if (name === "Cusd") {
  1588. this.$set(row, "amountDrUsdOffCurrent", 0);
  1589. }
  1590. let a = row.amountCrUsdOffCurrent ? Number(row.amountCrUsdOffCurrent) : 0;
  1591. this.$set(row, "amountCrUsdOffCurrent", a > Number(row.amountCrUsdBlc) ? Number(row.amountCrUsdBlc) : a);
  1592. a = row.amountDrUsdOffCurrent ? Number(row.amountDrUsdOffCurrent) : 0;
  1593. this.$set(row, "amountDrUsdOffCurrent", a > Number(row.amountDrUsdBlc) ? Number(row.amountDrUsdBlc) : a);
  1594. this.$set(row, "exrate", row.exrate ? Number(row.exrate) : 1);
  1595. this.$set(row, "amountCrOffCurrent", (row.amountCrUsdOffCurrent * row.exrate).toFixed(2));
  1596. this.$set(row, "amountDrOffCurrent", (row.amountDrUsdOffCurrent * row.exrate).toFixed(2));
  1597. },
  1598. // 客户
  1599. getBcorpsListfun(cnName) {
  1600. getBcorpsList(1, 10, { cnName }).then((res) => {
  1601. this.corpCnNameData = res.data.data.records;
  1602. });
  1603. },
  1604. // 部门
  1605. getDeptTreefun() {
  1606. getDeptLazyTree(JSON.parse(localStorage.getItem("saber-userInfo")).content.dept_pid.split(",")[0]).then((res) => {
  1607. this.deptData = res.data.data;
  1608. });
  1609. },
  1610. // 职员
  1611. userGetListfun(account = undefined, type = false) {
  1612. // userGetList(1, 10, { account }, JSON.parse(localStorage.getItem('saber-userInfo')).content.dept_pid.split(',')[0]).then(res => {
  1613. // this.emplData = res.data.data.records
  1614. // })
  1615. selectEmpls(1, 10, { cname: account, whetherEmployedOrNot: 1 }).then((res) => {
  1616. if (Array.isArray(res.data.data.records)) {
  1617. res.data.data.records.forEach((item) => {
  1618. item.name = item.cname;
  1619. });
  1620. }
  1621. this.emplData = res.data.data.records;
  1622. });
  1623. },
  1624. lastPage() {
  1625. if (this.pageIds.length) {
  1626. const index = this.pageIds.indexOf(this.form.id);
  1627. if (index == 0) {
  1628. return this.$message.error("没有上一票了");
  1629. }
  1630. const lastIndex = index - 1;
  1631. this.getDetail(this.pageIds[lastIndex]);
  1632. }
  1633. },
  1634. nextPage() {
  1635. if (this.pageIds.length) {
  1636. const index = this.pageIds.indexOf(this.form.id);
  1637. if (this.pageIds[this.pageIds.length - 1] == this.form.id) {
  1638. return this.$message.error("没有下一票了");
  1639. }
  1640. const nextIndex = index + 1;
  1641. this.getDetail(this.pageIds[nextIndex]);
  1642. }
  1643. },
  1644. inEdit() {
  1645. this.editButton = false;
  1646. //管理员 允许修改他人业务 本人单据可以编辑
  1647. if (this.roleName.includes("admin") || this.roleName.includes("允许修改他人业务") || this.saberUserInfo.user_id == this.form.createUser) {
  1648. if (this.form.finStlBillsItemsList.filter((item) => item.isChecked == 1).length == 0) {
  1649. this.editDisabled = false;
  1650. this.optionForm.disabled = false;
  1651. this.optionForm2.disabled = false;
  1652. }
  1653. }
  1654. },
  1655. dicChange(name, row) {
  1656. if (name == "bankAccountNo") {
  1657. if (row) {
  1658. this.form.bankId = row.id;
  1659. this.form.bankAccountName = row.accountName;
  1660. this.form.bankAccountBank = row.accountBank;
  1661. } else {
  1662. this.form.bankId = null;
  1663. this.form.bankAccountName = null;
  1664. this.form.bankAccountBank = null;
  1665. this.form.bankAccountNo = null;
  1666. }
  1667. }
  1668. },
  1669. async allClick(name) {
  1670. if (name == "确认结算") {
  1671. if (this.form.finStlBillsItemsList.length == 0) {
  1672. return this.$message.error("选定数据不能为空");
  1673. }
  1674. this.$confirm("是否确认结算?", {
  1675. confirmButtonText: "确定",
  1676. cancelButtonText: "取消",
  1677. type: "warning",
  1678. }).then(() => {
  1679. let obj = {
  1680. ...this.form,
  1681. billNoFormat: "STL",
  1682. businessTypeCode: "STL",
  1683. businessType: "STL",
  1684. url: "/iosBasicData/financialManagement/finstlbills/index",
  1685. pageLabel: "结算中心(J)",
  1686. };
  1687. const loading = this.$loading({
  1688. lock: true,
  1689. text: "加载中",
  1690. spinner: "el-icon-loading",
  1691. background: "rgba(255,255,255,0.7)",
  1692. });
  1693. finstlbillsConfirmSettlement(obj)
  1694. .then((res) => {
  1695. this.$message.success("操作成功");
  1696. this.getDetail(this.form.id);
  1697. })
  1698. .finally(() => {
  1699. loading.close();
  1700. });
  1701. });
  1702. }
  1703. if (name == "撤销结算") {
  1704. this.$confirm("确定进行撤销对账操作?", {
  1705. confirmButtonText: "确定",
  1706. cancelButtonText: "取消",
  1707. type: "warning",
  1708. }).then(() => {
  1709. let obj = {
  1710. ...this.form,
  1711. billNoFormat: "STL",
  1712. businessTypeCode: "STL",
  1713. businessType: "STL",
  1714. };
  1715. const loading = this.$loading({
  1716. lock: true,
  1717. text: "加载中",
  1718. spinner: "el-icon-loading",
  1719. background: "rgba(255,255,255,0.7)",
  1720. });
  1721. finstlbillsRevokeSettlement(obj)
  1722. .then((res) => {
  1723. this.$message.success("操作成功");
  1724. this.getDetail(this.form.id);
  1725. })
  1726. .finally(() => {
  1727. loading.close();
  1728. });
  1729. });
  1730. }
  1731. },
  1732. // application() {
  1733. // },
  1734. update(id, type) {
  1735. this.getDetail(id, type);
  1736. },
  1737. apData(list) {
  1738. this.form.advancePaymentRecordList = list;
  1739. let obj = {
  1740. ...this.form,
  1741. billNoFormat: "HYDZ",
  1742. businessTypeCode: "HYDZ",
  1743. businessType: "CHK",
  1744. url: "/iosBasicData/financialManagement/finstlbills/index",
  1745. pageLabel: "对账中心(J)",
  1746. };
  1747. const loading = this.$loading({
  1748. lock: true,
  1749. text: "加载中",
  1750. spinner: "el-icon-loading",
  1751. background: "rgba(255,255,255,0.7)",
  1752. });
  1753. confirmWriteOff(obj)
  1754. .then((res) => {
  1755. this.$message.success("操作成功");
  1756. this.getDetail(this.form.id);
  1757. })
  1758. .finally(() => {
  1759. loading.close();
  1760. });
  1761. },
  1762. submit() {
  1763. this.form.finStlBillsItemsList.forEach((item, index) => {
  1764. if (item.currentStlCurCode == "CNY") {
  1765. item.currentStlAmount = item.currentStlAmountRMB;
  1766. } else {
  1767. item.currentStlAmount = item.currentStlAmountUSD;
  1768. }
  1769. });
  1770. let obj = {
  1771. ...this.form,
  1772. billNoFormat: "STL",
  1773. businessTypeCode: "STL",
  1774. businessType: "STL",
  1775. };
  1776. const loading = this.$loading({
  1777. lock: true,
  1778. text: "加载中",
  1779. spinner: "el-icon-loading",
  1780. background: "rgba(255,255,255,0.7)",
  1781. });
  1782. finstlbillsSubmit(obj)
  1783. .then((res) => {
  1784. this.$message.success("操作成功");
  1785. this.getDetail(res.data.data.id);
  1786. })
  1787. .finally(() => {
  1788. loading.close();
  1789. });
  1790. },
  1791. getSettlement(id, dc, type) {
  1792. let obj = {
  1793. billId: id,
  1794. dc: dc,
  1795. type: type,
  1796. };
  1797. const loading = this.$loading({
  1798. lock: true,
  1799. text: "加载中",
  1800. spinner: "el-icon-loading",
  1801. background: "rgba(255,255,255,0.7)",
  1802. });
  1803. generateFinStlBills(obj)
  1804. .then((res) => {
  1805. res.data.data.finStlBillsItemsList.forEach((item) => {
  1806. if (item.curCode == "CNY") {
  1807. this.$set(item, "currentInvoiceAmountRMB", item.currentInvoiceAmount);
  1808. this.$set(item, "amountRMB", item.amount);
  1809. this.$set(item, "amountNetRMB", item.amountNet);
  1810. this.$set(item, "stlTtlAmountRMB", item.stlTtlAmount);
  1811. this.$set(item, "stlTtlAmountNetRMB", item.stlTtlAmountNet);
  1812. this.$set(item, "currentStlAmountNetRMB", item.currentStlAmountNet);
  1813. this.$set(item, "currentStlAmountRMB", Number(item.currentStlAmount ? item.currentStlAmount : 0));
  1814. this.$set(item, "currentStlAmountUSD", Number(0));
  1815. } else {
  1816. this.$set(item, "currentInvoiceAmountUSD", item.currentInvoiceAmount);
  1817. this.$set(item, "amountUSD", item.amount);
  1818. this.$set(item, "amountNetUSD", item.amountNet);
  1819. this.$set(item, "stlTtlAmountNetUSD", item.stlTtlAmountNet);
  1820. this.$set(item, "stlTtlAmountUSD", item.stlTtlAmount);
  1821. this.$set(item, "currentStlAmountNetUSD", item.currentStlAmountNet);
  1822. this.$set(item, "currentStlAmountUSD", Number(item.currentStlAmount ? item.currentStlAmount : 0));
  1823. this.$set(item, "currentStlAmountRMB", Number(0));
  1824. }
  1825. });
  1826. this.form = res.data.data;
  1827. setTimeout(() => {
  1828. this.$refs.pickedData.refreshData();
  1829. }, 100);
  1830. })
  1831. .finally(() => {
  1832. loading.close();
  1833. });
  1834. },
  1835. getDetail(id, type) {
  1836. const loading = this.$loading({
  1837. lock: true,
  1838. text: "加载中",
  1839. spinner: "el-icon-loading",
  1840. background: "rgba(255,255,255,0.7)",
  1841. });
  1842. finstlbillsDetail(id)
  1843. .then((res) => {
  1844. res.data.data.finStlBillsItemsList.forEach((item) => {
  1845. if (item.curCode == "CNY") {
  1846. this.$set(item, "currentInvoiceAmountRMB", item.currentInvoiceAmount);
  1847. this.$set(item, "amountRMB", item.amount);
  1848. this.$set(item, "amountNetRMB", item.amountNet);
  1849. this.$set(item, "stlTtlAmountRMB", item.stlTtlAmount);
  1850. this.$set(item, "stlTtlAmountNetRMB", item.stlTtlAmountNet);
  1851. this.$set(item, "currentStlAmountNetRMB", item.currentStlAmountNet);
  1852. this.$set(item, "currentStlAmountRMB", Number(item.currentStlAmount ? item.currentStlAmount : 0));
  1853. this.$set(item, "currentStlAmountUSD", Number(0));
  1854. } else {
  1855. this.$set(item, "currentInvoiceAmountUSD", item.currentInvoiceAmount);
  1856. this.$set(item, "amountUSD", item.amount);
  1857. this.$set(item, "amountNetUSD", item.amountNet);
  1858. this.$set(item, "stlTtlAmountNetUSD", item.stlTtlAmountNet);
  1859. this.$set(item, "stlTtlAmountUSD", item.stlTtlAmount);
  1860. this.$set(item, "currentStlAmountNetUSD", item.currentStlAmountNet);
  1861. this.$set(item, "currentStlAmountUSD", Number(item.currentStlAmount ? item.currentStlAmount : 0));
  1862. this.$set(item, "currentStlAmountRMB", Number(0));
  1863. }
  1864. });
  1865. if (
  1866. this.roleName.includes("admin") ||
  1867. this.roleName.includes("允许修改他人业务") ||
  1868. this.saberUserInfo.user_id == res.data.data.createUser
  1869. ) {
  1870. this.canEditVoucher = res.data.data.id && res.data.data.isCleared == 1 && !res.data.data.voucherNo;
  1871. }
  1872. this.form = res.data.data;
  1873. setTimeout(() => {
  1874. this.$refs.pickedData.refreshData();
  1875. }, 100);
  1876. })
  1877. .finally(() => {
  1878. loading.close();
  1879. });
  1880. },
  1881. // 更改表格颜色
  1882. headerClassName(tab) {
  1883. //颜色间隔
  1884. let back = "";
  1885. if (tab.columnIndex >= 0 && tab.column.level === 1) {
  1886. if (tab.columnIndex % 2 === 0) {
  1887. back = "back-one";
  1888. } else if (tab.columnIndex % 2 === 1) {
  1889. back = "back-two";
  1890. }
  1891. }
  1892. return back;
  1893. },
  1894. goBack(type) {
  1895. this.$emit("goBack");
  1896. },
  1897. },
  1898. watch: {},
  1899. };
  1900. </script>
  1901. <style lang="scss" scoped>
  1902. ::v-deep .el-form-item__error {
  1903. display: none !important;
  1904. }
  1905. ::v-deep .el-form-item {
  1906. margin-bottom: 2px !important;
  1907. }
  1908. ::v-deep .el-table .cell {
  1909. padding: 0 2px !important;
  1910. .el-form-item {
  1911. margin-bottom: 0px !important;
  1912. }
  1913. }
  1914. ::v-deep .avue-crud .el-table .el-form-item__label {
  1915. left: -1px;
  1916. }
  1917. // ::v-deep#out-table .back-one {
  1918. // background: #ecf5ff !important;
  1919. // }
  1920. // ::v-deep#out-table .back-two {
  1921. // background: #ecf5ff !important;
  1922. // }
  1923. ::v-deep #out-table .back-one {
  1924. background: #ecf5ff !important;
  1925. text-align: center;
  1926. padding: 4px 0;
  1927. }
  1928. ::v-deep #out-table .back-two {
  1929. background: #ecf5ff !important;
  1930. text-align: center;
  1931. padding: 4px 0;
  1932. }
  1933. ::v-deep .el-table--small td,
  1934. .el-table--small th {
  1935. padding: 2px !important;
  1936. }
  1937. ::v-deep .box-card .el-card__body {
  1938. padding: 2px !important;
  1939. }
  1940. ::v-deep .form2 .el-collapse-item__wrap {
  1941. background-color: #ecf5ff !important;
  1942. }
  1943. ::v-deep .box-tabs .el-tabs__item {
  1944. height: 30px;
  1945. line-height: 30px;
  1946. }
  1947. ::v-deep .box-tabs .el-tabs__content {
  1948. padding: 2px !important;
  1949. }
  1950. ::v-deep .el-checkbox__input.is-disabled + span.el-checkbox__label {
  1951. color: #606266;
  1952. }
  1953. .disabledBox {
  1954. display: flex;
  1955. align-items: center;
  1956. }
  1957. .meetSize {
  1958. font-size: 16px;
  1959. color: #54bcbd;
  1960. }
  1961. .customer-title {
  1962. position: absolute;
  1963. top: 12px;
  1964. z-index: 1000;
  1965. left: calc(50% - 175px);
  1966. color: #67c23a;
  1967. }
  1968. </style>