finvouchersitems.vue 31 KB

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