finvouchersitems.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <template>
  2. <div class="borderless" v-loading="pageLoading">
  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"
  6. @click="backToList">返回列表
  7. </el-button>
  8. </div>
  9. <div class="add-customer-btn">
  10. <el-button size="small" type="success" style="margin-right: 8px"
  11. :loading="saveLoading" >凭证标错
  12. </el-button>
  13. <el-button size="small" type="primary" style="margin-right: 8px"
  14. :loading="saveLoading" @click="finvouchersSubmitfun" >保 存
  15. </el-button>
  16. </div>
  17. </div>
  18. <div style="margin: 55px 5px 0px 5px;'">
  19. <el-card class="box-card">
  20. <el-form :model="form" ref="form" label-width="90px" class="demo-ruleForm">
  21. <el-row>
  22. <el-col :span="6">
  23. <el-form-item label="凭证类型" prop="voucherType">
  24. <search-query :datalist="voucherTypeData"
  25. :selectValue="form.voucherType"
  26. :clearable="true"
  27. :buttonIf="false"
  28. :forParameter="{key:'dictKey',label:'dictValue',value:'dictKey'}"
  29. placeholder="请选择凭证类型"
  30. @corpChange="corpChange($event,'voucherType')">
  31. </search-query>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="6">
  35. <el-form-item label="凭证号" prop="voucherNo">
  36. <el-input style="width: 100%;" v-model="form.voucherNo"
  37. size="small" autocomplete="off"
  38. :disabled="true"
  39. clearable placeholder="请输入凭证号" >
  40. </el-input>
  41. </el-form-item>
  42. </el-col>
  43. <el-col :span="6">
  44. <el-form-item label="凭证日期" prop="voucherDate">
  45. <el-date-picker v-model="form.voucherDate" clearable
  46. style="width: 100%;"
  47. type="date" size="small"
  48. value-format="yyyy-MM-dd HH:mm"
  49. placeholder="选择凭证日期">
  50. </el-date-picker>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="6">
  54. <el-form-item label="凭证来源" prop="voucherSource">
  55. <search-query :datalist="voucherSourceData"
  56. :selectValue="form.voucherSource"
  57. :clearable="true"
  58. :buttonIf="false"
  59. :forParameter="{key:'dictKey',label:'dictValue',value:'dictKey'}"
  60. placeholder="请选择凭证类型"
  61. @corpChange="corpChange($event,'voucherSource')">
  62. </search-query>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="6">
  66. <el-form-item label="REF NO" prop="billNo">
  67. <el-input style="width: 100%;" v-model="form.billNo"
  68. size="small" autocomplete="off"
  69. :disabled="true"
  70. clearable placeholder="请输入编号" >
  71. </el-input>
  72. </el-form-item>
  73. </el-col>
  74. <!--<el-col :span="6">-->
  75. <!-- <el-form-item label="附件" prop="billNo">-->
  76. <!-- <el-input type="" style="width: 100%;" v-model="form.billNo"-->
  77. <!-- size="small" autocomplete="off"-->
  78. <!-- clearable placeholder="请输入附件" >-->
  79. <!-- </el-input>-->
  80. <!-- </el-form-item>-->
  81. <!--</el-col>-->
  82. </el-row>
  83. </el-form>
  84. </el-card>
  85. <el-card style="margin-top: 10px">
  86. <div style="margin-bottom: 10px">
  87. <el-button size="small" type="primary" style="margin-right: 8px"
  88. :loading="saveLoading" @click="addEntryfun" >添加分录
  89. </el-button>
  90. <el-button size="small" type="danger" style="margin-right: 8px"
  91. :loading="saveLoading" @click="deleteEntryfun" >删除分录
  92. </el-button>
  93. <el-button size="small" type="success" style="margin-right: 8px"
  94. :loading="saveLoading" >项目属性
  95. </el-button>
  96. <el-button size="small" type="success" style="margin-right: 8px"
  97. :loading="saveLoading" >凭证断号观察器
  98. </el-button>
  99. <el-button size="small" type="success" style="margin-right: 8px"
  100. :loading="saveLoading" >断号优化
  101. </el-button>
  102. <el-button size="small" type="success" style="margin-right: 8px"
  103. :loading="saveLoading" >科目余额查询
  104. </el-button>
  105. </div>
  106. <fromtable-details :tableData="form.finVouchersItemsList"
  107. :handleSelectionData="handleSelectionData"
  108. @handleSelectionChange="handleSelectionChange"
  109. @addRowsfun="addRowsfun"
  110. @deletefun="deletefun"
  111. @auxiliaryAccountingfun="auxiliaryAccountingfun">
  112. </fromtable-details>
  113. </el-card>
  114. </div>
  115. <!--辅助核算-->
  116. <el-dialog
  117. title=" "
  118. append-to-body
  119. :visible.sync="auxiliaryVisible"
  120. class="el-dialogDeep"
  121. width="70%"
  122. :before-close="handleClose">
  123. <div>科目名称:{{subjectRow.accountCnName}}</div>
  124. <div style="margin-top: 10px">
  125. <el-form :model="subjectRow" ref="subjectRow" label-width="70px" class="demo-ruleForm">
  126. <!--#region-->
  127. <!--<div>外币核算:</div>-->
  128. <!--<el-row>-->
  129. <!-- <el-col :span="4">-->
  130. <!-- <el-form-item label="币种:" prop="curCode">-->
  131. <!-- <el-input style="width: 100%;" v-model="subjectRow.curCode"-->
  132. <!-- size="small" autocomplete="off"-->
  133. <!-- clearable placeholder="请输入币种" >-->
  134. <!-- </el-input>-->
  135. <!-- </el-form-item>-->
  136. <!-- </el-col>-->
  137. <!-- <el-col :span="4">-->
  138. <!-- <el-form-item label="汇率:" prop="exrate">-->
  139. <!-- <el-input style="width: 100%;" v-model="subjectRow.exrate"-->
  140. <!-- size="small" autocomplete="off"-->
  141. <!-- clearable placeholder="请输入汇率" >-->
  142. <!-- </el-input>-->
  143. <!-- </el-form-item>-->
  144. <!-- </el-col>-->
  145. <!-- <el-col :span="4">-->
  146. <!-- <el-form-item label="借方金额:" prop="amountDrUsd">-->
  147. <!-- <el-input style="width: 100%;" v-model="subjectRow.amountDrUsd"-->
  148. <!-- size="small" autocomplete="off"-->
  149. <!-- clearable placeholder="请输入借方金额" >-->
  150. <!-- </el-input>-->
  151. <!-- </el-form-item>-->
  152. <!-- </el-col>-->
  153. <!-- <el-col :span="4">-->
  154. <!-- <el-form-item label="贷方金额:" prop="amountCrUsd">-->
  155. <!-- <el-input style="width: 100%;" v-model="subjectRow.amountCrUsd"-->
  156. <!-- size="small" autocomplete="off"-->
  157. <!-- clearable placeholder="请输入贷方金额" >-->
  158. <!-- </el-input>-->
  159. <!-- </el-form-item>-->
  160. <!-- </el-col>-->
  161. <!-- <el-col :span="4">-->
  162. <!-- <el-form-item label="本币借方:" prop="amountDr">-->
  163. <!-- <el-input style="width: 100%;" v-model="subjectRow.amountDr"-->
  164. <!-- size="small" autocomplete="off"-->
  165. <!-- clearable placeholder="请输入本币借方" >-->
  166. <!-- </el-input>-->
  167. <!-- </el-form-item>-->
  168. <!-- </el-col>-->
  169. <!-- <el-col :span="4">-->
  170. <!-- <el-form-item label="本币贷方:" prop="amountCr">-->
  171. <!-- <el-input style="width: 100%;" v-model="subjectRow.amountCr"-->
  172. <!-- size="small" autocomplete="off"-->
  173. <!-- clearable placeholder="请输入本币贷方" >-->
  174. <!-- </el-input>-->
  175. <!-- </el-form-item>-->
  176. <!-- </el-col>-->
  177. <!--</el-row>-->
  178. <!--#endregion-->
  179. <!--#region-->
  180. <!--<div>数量核算:</div>-->
  181. <!--<el-row>-->
  182. <!-- <el-col :span="4">-->
  183. <!-- <el-form-item label="单位:" prop="unitNo">-->
  184. <!-- <el-input style="width: 100%;" v-model="subjectRow.unitNo"-->
  185. <!-- size="small" autocomplete="off"-->
  186. <!-- clearable placeholder="请输入单位" >-->
  187. <!-- </el-input>-->
  188. <!-- </el-form-item>-->
  189. <!-- </el-col>-->
  190. <!-- <el-col :span="4">-->
  191. <!-- <el-form-item label="规格:" prop="voucherNo">-->
  192. <!-- <el-input style="width: 100%;" v-model="subjectRow.voucherNo"-->
  193. <!-- size="small" autocomplete="off"-->
  194. <!-- clearable placeholder="请输入规格" >-->
  195. <!-- </el-input>-->
  196. <!-- </el-form-item>-->
  197. <!-- </el-col>-->
  198. <!-- <el-col :span="4">-->
  199. <!-- <el-form-item label="借方数量:" prop="quantityDr">-->
  200. <!-- <el-input style="width: 100%;" v-model="subjectRow.quantityDr"-->
  201. <!-- size="small" autocomplete="off"-->
  202. <!-- clearable placeholder="请输入借方数量" >-->
  203. <!-- </el-input>-->
  204. <!-- </el-form-item>-->
  205. <!-- </el-col>-->
  206. <!-- <el-col :span="4">-->
  207. <!-- <el-form-item label="借方单价:" prop="voucherNo">-->
  208. <!-- <el-input style="width: 100%;" v-model="subjectRow.voucherNo"-->
  209. <!-- size="small" autocomplete="off"-->
  210. <!-- clearable placeholder="请输入借方单价" >-->
  211. <!-- </el-input>-->
  212. <!-- </el-form-item>-->
  213. <!-- </el-col>-->
  214. <!-- <el-col :span="4">-->
  215. <!-- <el-form-item label="贷方数量:" prop="quantityCr">-->
  216. <!-- <el-input style="width: 100%;" v-model="subjectRow.quantityCr"-->
  217. <!-- size="small" autocomplete="off"-->
  218. <!-- clearable placeholder="请输入贷方数量" >-->
  219. <!-- </el-input>-->
  220. <!-- </el-form-item>-->
  221. <!-- </el-col>-->
  222. <!-- <el-col :span="4">-->
  223. <!-- <el-form-item label="贷方单价:" prop="voucherNo">-->
  224. <!-- <el-input style="width: 100%;" v-model="subjectRow.voucherNo"-->
  225. <!-- size="small" autocomplete="off"-->
  226. <!-- clearable placeholder="请输入贷方单价" >-->
  227. <!-- </el-input>-->
  228. <!-- </el-form-item>-->
  229. <!-- </el-col>-->
  230. <!--</el-row>-->
  231. <!--#endregion-->
  232. <el-row :gutter="40">
  233. <el-col :span="12" v-if="subjectAccount.isCorp">
  234. <!--<div>客户核算:</div>-->
  235. <el-form-item label="客户名称:" prop="corpCnName">
  236. <search-query style="width: 100%"
  237. ref="searchQueryRef"
  238. :datalist="corpCnNameData"
  239. :selectValue="subjectRow.corpCnName"
  240. :filterable="true"
  241. :clearable="true"
  242. :remote="true"
  243. :buttonIf="true"
  244. placeholder="请选择客户名称"
  245. :forParameter="{key:'id',label:'cnName',value:'cnName'}"
  246. @corpFocus="getBcorpsListfun"
  247. @remoteMethod="getBcorpsListfun"
  248. @corpChange="corpChange($event,'corpCnName')"
  249. @eldialogConfirm="eldialogConfirm('bcorps')"
  250. @bottonSearchfun="bottonSearchfun('bcorps')" >
  251. <bcorps ref="bcorps"
  252. :eldialog="true"
  253. @selectionChange="eldialogMultipleChoice($event,'bcorps')" ></bcorps>
  254. </search-query>
  255. </el-form-item>
  256. </el-col>
  257. <el-col :span="12" v-if="subjectAccount.isDept">
  258. <!--<div>部门核算:</div>-->
  259. <el-form-item label="部门名称:" prop="deptName">
  260. <tree-select v-model="subjectRow.deptName"
  261. filterable
  262. :data="deptData"
  263. :props="{label:'title',children:'children'}"
  264. nodeKey="title"
  265. size="small"
  266. :multiple="false"
  267. placeholder="请选择部门名称"
  268. @focus="getDeptTreefun"
  269. @input="corpChange($event,'deptName')">
  270. </tree-select>
  271. </el-form-item>
  272. </el-col>
  273. <el-col :span="12" v-if="subjectAccount.isEmpl">
  274. <!--<div>职员核算:</div>-->
  275. <el-form-item label="职员名称:" prop="emplName">
  276. <search-query :datalist="emplData"
  277. :selectValue="subjectRow.emplName"
  278. :clearable="true"
  279. :buttonIf="false"
  280. :filterable="true"
  281. :remote="true"
  282. placeholder="请选择职员名称"
  283. :forParameter="{ key:'id', label:'name', value:'name'}"
  284. @corpFocus="userGetListfun"
  285. @corpChange="corpChange($event,'emplName')"
  286. @remoteMethod="userGetListfun" >
  287. </search-query>
  288. </el-form-item>
  289. </el-col>
  290. <!--<el-col :span="12" v-if="subjectAccount.isItem">-->
  291. <!-- <div>项目核算:</div>-->
  292. <!-- <el-form-item label="项目名称:" prop="itemName">-->
  293. <!-- <el-input style="width: 100%;" v-model="subjectRow.itemName"-->
  294. <!-- size="small" autocomplete="off"-->
  295. <!-- clearable placeholder="请输入项目名称" >-->
  296. <!-- </el-input>-->
  297. <!-- <search-query :datalist="itemData"-->
  298. <!-- :selectValue="subjectRow.itemName"-->
  299. <!-- :clearable="true"-->
  300. <!-- :buttonIf="false"-->
  301. <!-- :filterable="true"-->
  302. <!-- :remote="true"-->
  303. <!-- placeholder="请选择项目名称"-->
  304. <!-- :forParameter="{ key:'id', label:'cnName', value:'cnName'}"-->
  305. <!-- @corpFocus="baccitemstypeListfun"-->
  306. <!-- @corpChange="corpChange($event,'itemName')"-->
  307. <!-- @remoteMethod="baccitemstypeListfun" >-->
  308. <!-- </search-query>-->
  309. <!-- </el-form-item>-->
  310. <!--</el-col>-->
  311. </el-row>
  312. </el-form>
  313. </div>
  314. <span slot="footer" class="dialog-footer">
  315. <el-button @click="auxiliaryVisible = false">取 消</el-button>
  316. <el-button type="primary" @click="auxiliaryDeterminefun">确 定</el-button>
  317. </span>
  318. </el-dialog>
  319. </div>
  320. </template>
  321. <script>
  322. import SearchQuery from "@/components/iosbasic-data/searchquery.vue";
  323. import {getWorkDicts} from "@/api/system/dictbiz";
  324. import {finvouchersDetail, finvouchersitemsRemove, finvouchersSubmit} from "@/api/iosBasicData/finvouchers";
  325. import {getCurrentDate, getYearDate} from "@/util/date";
  326. import fromtableDetails from "@/views/iosBasicData/finvouchers/assembly/fromtableDetails.vue";
  327. import {accountsDetail} from "@/api/iosBasicData/accounts";
  328. import {getBcorpsList} from "@/api/iosBasicData/bcorps";
  329. import TreeSelect from "@/components/iosbasic-data/TreeSelect.vue";
  330. import {getDeptLazyTree, getDeptTree} from "@/api/system/dept";
  331. import {getList as userGetList} from '@/api/system/user'
  332. import {baccitemstypeList} from "@/api/iosBasicData/baccitemstype";
  333. import bcorps from "@/views/iosBasicData/bcorps/index.vue";
  334. export default {
  335. components: {bcorps, TreeSelect, SearchQuery,fromtableDetails},
  336. data(){
  337. return {
  338. pageLoading:false, // 整个的动画
  339. saveLoading:false, // 按钮动画
  340. // 获取的数据
  341. form:{
  342. voucherType:'PZDH-J', // 凭证类型
  343. voucherDate:getCurrentDate(),
  344. finVouchersItemsList:[],
  345. },
  346. voucherTypeData:[], // 凭证字数据
  347. voucherSourceData:[], // 业务类型
  348. auxiliaryVisible:false, // 辅助核算弹窗
  349. handleSelectionData:[], // 分录多选的数据
  350. subjectRow:{}, // 科目弹窗的显示数据
  351. subjectAccount:{},// 当前选择科目的数据
  352. corpCnNameData:[], // 客户核算 下拉数据
  353. deptData:[], // 部门核算 下拉数据
  354. emplData:[], // 职员核算 下拉数据
  355. itemData:[], // 项目核算 下拉数据
  356. }
  357. },
  358. created() {
  359. this.getWorkDictsfun()
  360. },
  361. methods:{
  362. // 下拉弹窗打开操作
  363. bottonSearchfun(name){
  364. this.$nextTick(()=>{
  365. if (this.$refs.bcorps.selectionList.length == 0) return
  366. this.$refs.bcorps.$refs.crud.toggleSelection() // 先清空所以选择的数据
  367. })
  368. },
  369. // 下拉多选弹窗的确认
  370. eldialogConfirm(name){
  371. if (name == 'bcorps') {
  372. if (this.$refs.bcorps.isShow) {
  373. console.log('列表确认')
  374. this.$set(this.subjectRow,'corpCnName',this.$refs.bcorps.selectionList[0].cnName)
  375. this.$set(this.subjectRow,'corpEnName',this.$refs.bcorps.selectionList[0].enName)
  376. this.$set(this.subjectRow,'corpId',this.$refs.bcorps.selectionList[0].id)
  377. }else {
  378. console.log('详情确认')
  379. this.$refs.bcorps.$refs.detail.submitForm()
  380. this.$set(this.subjectRow,'corpCnName',this.$refs.bcorps.$refs.detail.formData.cnName)
  381. this.$set(this.subjectRow,'corpEnName',this.$refs.bcorps.$refs.detail.formData.enName)
  382. this.$set(this.subjectRow,'corpId',this.$refs.bcorps.$refs.detail.formData.id)
  383. }
  384. }else {
  385. console.log('其他的组件')
  386. }
  387. this.$refs.searchQueryRef.corpVisible = false
  388. },
  389. // 下拉多选弹窗数据多选回调
  390. eldialogMultipleChoice(list,name){
  391. if (name == 'bcorps') {
  392. let arr = []
  393. if (list.length > 1) {
  394. this.$refs.bcorps.$refs.crud.toggleSelection() // 先清空所以选择的数据
  395. arr = [list[list.length -1]] // 获取最新点击的数组
  396. this.$refs.bcorps.$refs.crud.toggleSelection(arr,true) // 把刚点击的数组变成选择状态
  397. }else {
  398. arr = list
  399. }
  400. this.$refs.bcorps.selectionList = arr
  401. }else {
  402. console.log('其他的组件')
  403. }
  404. },
  405. // 详情接口
  406. finvouchersDetailfun(id) {
  407. this.pageLoading = true
  408. finvouchersDetail(id).then(res=>{
  409. this.pageLoading = false
  410. this.form = res.data.data
  411. })
  412. },
  413. // 添加分录
  414. addEntryfun(){
  415. let obj = {}
  416. if (this.form.finVouchersItemsList.length > 0){
  417. obj.descr = this.form.finVouchersItemsList[this.form.finVouchersItemsList.length - 1].descr
  418. }
  419. this.form.finVouchersItemsList.push(obj)
  420. },
  421. // 行添加
  422. addRowsfun(row,index){
  423. //第二个参数为0的时候,是可以添加参数的,1的时候是删除
  424. this.form.finVouchersItemsList.splice(index,0,{
  425. descr:row.descr
  426. });
  427. },
  428. // 行删除
  429. deletefun(row,index){
  430. if (row.id) {
  431. this.finvouchersitemsRemovefun(row.id)
  432. }
  433. this.form.finVouchersItemsList.splice(index,1)
  434. },
  435. // 删除分录
  436. deleteEntryfun(){
  437. if (this.handleSelectionData.length == 0) {
  438. return this.$message.warning('请选择至少一条数据')
  439. }
  440. let multiList = this.handleSelectionData
  441. let arr = this.form.finVouchersItemsList
  442. // 获取有id 的数据
  443. const itemsWithId = multiList.filter(item => item.hasOwnProperty('id'));
  444. let arrIds = itemsWithId.map(item=>item.id) // 获取id 数据
  445. // 把选中的删除掉
  446. multiList.forEach((item)=>{
  447. for (let index in arr) {
  448. if (JSON.stringify(item) == JSON.stringify(arr[index])) {
  449. arr.splice(Number(index),1)
  450. }
  451. }
  452. })
  453. // 有id 的处理
  454. if(itemsWithId.length != 0) {
  455. this.finvouchersitemsRemovefun(arrIds.join(','))
  456. }
  457. },
  458. // 大保存
  459. finvouchersSubmitfun(){
  460. this.form.businessTypeCode = 'PZDH'
  461. this.form.billNoFormat = this.form.voucherType
  462. if (this.form.finVouchersItemsList.length < 2) {
  463. return this.$message.warning('请填写至少凭证两笔分录后再保存!')
  464. }
  465. // // 判断币种是否一样
  466. // for (let item of this.form.finVouchersItemsList) {
  467. // if (this.form.finVouchersItemsList[0].curCode != item.curCode) {
  468. // return this.$message.warning('请选择相同币种的科目')
  469. // }
  470. // }
  471. // 判断借方金额合计 是否等于 贷方金额合计
  472. let amountDrSum = 0
  473. let amountCrSum = 0
  474. for (let item of this.form.finVouchersItemsList) {
  475. amountDrSum += Number(item.amountDr)
  476. amountCrSum += Number(item.amountCr)
  477. // if (item.curCode == 'USD') {
  478. // amountDrSum += Number(item.amountDrUsd)
  479. // amountCrSum += Number(item.amountCrUsd)
  480. // }else {
  481. // amountDrSum += Number(item.amountDr)
  482. // amountCrSum += Number(item.amountCr)
  483. // }
  484. }
  485. if (amountDrSum != amountCrSum) {
  486. return this.$message.warning('凭证借贷金额不平衡')
  487. }
  488. console.log(this.form,379)
  489. this.pageLoading = true
  490. finvouchersSubmit(this.form).then(res=>{
  491. this.$message.success('操作成功')
  492. this.pageLoading = false
  493. this.finvouchersDetailfun(res.data.data.id)
  494. })
  495. },
  496. // 分录删除接口
  497. finvouchersitemsRemovefun(id){
  498. finvouchersitemsRemove(id).then(res=>{
  499. this.$message.success('操作成功')
  500. this.finvouchersDetailfun()
  501. })
  502. },
  503. // 科目编辑打开辅助核算弹窗
  504. auxiliaryAccountingfun(row){
  505. // 获取状态
  506. accountsDetail(row.accountId).then(res=>{
  507. this.subjectAccount = res.data.data
  508. this.subjectRow = row
  509. // 如果三个都没有勾选 直接不自动打开弹窗
  510. if (res.data.data.isCorp || res.data.data.isDept || res.data.data.isEmpl) {
  511. this.auxiliaryVisible = true
  512. }
  513. })
  514. },
  515. // 辅助核算弹窗确认按钮
  516. auxiliaryDeterminefun(){
  517. this.auxiliaryVisible = false
  518. },
  519. // 下拉回调
  520. corpChange(value,name){
  521. // 客户名称
  522. if (name == 'corpCnName') {
  523. for (let item of this.corpCnNameData) {
  524. if (item.cnName == value) {
  525. this.$set(this.subjectRow,'corpEnName',item.enName)
  526. this.$set(this.subjectRow,'corpCnName',item.cnName)
  527. this.$set(this.subjectRow,'corpId',item.id)
  528. }
  529. }
  530. }
  531. // 核算
  532. else if (name == 'deptName') {
  533. for (let item of this.deptData) {
  534. if (item.title == value) {
  535. this.$set(this.subjectRow,'deptName',item.title)
  536. this.$set(this.subjectRow,'deptId',item.id)
  537. }
  538. }
  539. }
  540. // 职员
  541. else if (name == 'emplName') {
  542. for (let item of this.emplData) {
  543. if (item.name == value) {
  544. this.$set(this.subjectRow,'emplName',item.name)
  545. this.$set(this.subjectRow,'emplId',item.id)
  546. }
  547. }
  548. }
  549. // 项目核算
  550. else if (name == 'itemName') {
  551. for (let item of this.itemData) {
  552. if (item.cnName == value) {
  553. this.$set(this.subjectRow,'itemName',item.cnName)
  554. this.$set(this.subjectRow,'itemId',item.id)
  555. }
  556. }
  557. }else if (name == 'voucherType' || name == 'voucherSource') {
  558. this.$set(this.form,name,value)
  559. }
  560. },
  561. // 接口数据调用
  562. // 客户
  563. getBcorpsListfun(cnName){
  564. getBcorpsList(1,10,{cnName}).then(res=>{
  565. this.corpCnNameData = res.data.data.records
  566. })
  567. },
  568. // 部门
  569. getDeptTreefun(){
  570. getDeptLazyTree(JSON.parse(localStorage.getItem('saber-userInfo')).content.dept_pid.split(',')[0]).then(res=>{
  571. this.deptData = res.data.data
  572. })
  573. },
  574. // 职员
  575. userGetListfun(account = undefined,type = false,){
  576. userGetList(1,10,{account},JSON.parse(localStorage.getItem('saber-userInfo')).content.dept_pid.split(',')[0]).then(res=>{
  577. this.emplData = res.data.data.records
  578. })
  579. },
  580. // 项目核算
  581. baccitemstypeListfun(cnName){
  582. baccitemstypeList(1,10,{cnName}).then(res=>{
  583. this.itemData = res.data.data.records
  584. })
  585. },
  586. // 表格多选数据
  587. handleSelectionChange(list){
  588. this.handleSelectionData = list
  589. },
  590. // 弹窗点击差号
  591. handleClose(done) {
  592. this.$confirm('确认关闭?')
  593. .then(_ => {
  594. done();
  595. })
  596. .catch(_ => {});
  597. },
  598. // 获取字典数据
  599. getWorkDictsfun(){
  600. // 凭证字数据
  601. getWorkDicts('voucher_word_los').then(res=>{
  602. this.voucherTypeData = res.data.data
  603. })
  604. getWorkDicts('voucher_source_los').then(res=>{
  605. this.voucherSourceData = res.data.data
  606. })
  607. },
  608. //返回列表
  609. backToList() {
  610. this.$emit('goBack')
  611. },
  612. }
  613. }
  614. </script>
  615. <style scoped lang="scss">
  616. ::v-deep.el-form-item {
  617. margin-bottom: 0;
  618. }
  619. .borderBox {
  620. border: 1px solid #b6b6b6;
  621. padding: 5px;
  622. box-sizing: border-box;
  623. border-radius: 2px;
  624. position: relative;
  625. margin-right: 10px;
  626. }
  627. .positionCheckbox {
  628. position: absolute;
  629. top: -10px;
  630. left: 10px;
  631. background: #fff;
  632. }
  633. .cardRight {
  634. margin-right: 10px;
  635. height: 220px;
  636. }
  637. .borderCheckbox {
  638. border-bottom: 1px solid #4a9de6;
  639. padding-bottom: 5px;
  640. color:#4a9de6;
  641. margin-bottom: 5px;
  642. }
  643. .el-dialogDeep {
  644. ::v-deep .el-dialog {
  645. .el-dialog__body {
  646. padding-bottom: 0 !important;
  647. padding-top: 0 !important;
  648. }
  649. }
  650. }
  651. </style>