index.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904
  1. <template>
  2. <template-page
  3. v-if="showTable"
  4. ref="pageRef"
  5. :get-list="[getList1, getList2][pageLevel]"
  6. :exportList="[exportList1, exportList2][pageLevel]"
  7. :options-evens-group="[optionsEvensGroup1, optionsEvensGroup2][pageLevel]"
  8. :operation="[operation1, operation2][pageLevel]()"
  9. :expCode="['exp', 'detailExp'][pageLevel]"
  10. :table-attributes="tableAttributes"
  11. :table-events="tableEvents"
  12. :moreParameters="moreParameters"
  13. :column-parsing="columnParsing"
  14. >
  15. <div slot="moreSearch" v-if="pageLevel == 0">
  16. <el-radio-group v-model="tagStatus" size="mini" @change="changeType">
  17. <el-radio-button label="">全部</el-radio-button>
  18. <el-radio-button label="NO">未汇总</el-radio-button>
  19. <el-radio-button label="YES">已汇总</el-radio-button>
  20. </el-radio-group>
  21. <br /><br />
  22. </div>
  23. <div class="cartographer_big">
  24. <el-dialog title="费用明细" width="100%" :modal="false" :visible.sync="formBool" :before-close="handleClose">
  25. <zj-page-container v-if="formBool">
  26. <zj-page-fill class="neibuview">
  27. <zj-form-container ref="formRef" :form-data="formData" :form-attributes="{ size: 'mini' }">
  28. <zj-form-module title="基本信息" label-width="130px" :form-data="formData" :form-items="formItems" />
  29. </zj-form-container>
  30. </zj-page-fill>
  31. <div>
  32. <div style="box-sizing: border-box; padding: 10px; text-align: right">
  33. <el-button size="mini" @click="handleClose">取 消</el-button>
  34. <el-button v-if="!formEdit" size="mini" @click="formConfirm" type="primary">确 定</el-button>
  35. </div>
  36. </div>
  37. </zj-page-container>
  38. </el-dialog>
  39. </div>
  40. </template-page>
  41. </template>
  42. <script>
  43. import TemplatePage from '@/components/template/template-page-1.vue'
  44. import import_mixin from '@/components/template/import_mixin.js'
  45. import operation_mixin from '@/components/template/operation_mixin.js'
  46. import ImageUpload from '@/components/file-upload'
  47. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  48. import {
  49. settleExpenseGatherList,
  50. settleExpenseGatherListExport,
  51. settleExpenseImport,
  52. settleExpenseMonthGather,
  53. settleExpenseList,
  54. settleExpenseListExport,
  55. settleExpenseGatherBatchDel,
  56. settleExpenseBatchDel,
  57. settleExpenseSave
  58. } from '@/api/costPerDimension'
  59. import { commonTemplateDownload } from '@/api/common.js'
  60. import { memberListPageV2 } from '@/api/masterManagement'
  61. export default {
  62. components: { TemplatePage, ImageUpload },
  63. mixins: [import_mixin, operation_mixin],
  64. data() {
  65. return {
  66. // 表格属性
  67. tableAttributes: {
  68. // 启用勾选列
  69. selectColumn: true,
  70. selectable: this.selectable
  71. },
  72. // 表格事件
  73. tableEvents: {
  74. 'selection-change': this.selectionChange
  75. },
  76. // 勾选选中行
  77. recordSelected: [],
  78. pageLevel: 0,
  79. showTable: true,
  80. collectItem: {},
  81. formData: {
  82. companyWechatName: JSON.parse(localStorage.getItem('greemall_user')).companyName
  83. },
  84. formBool: false,
  85. formEdit: false,
  86. workerList: [],
  87. tagStatus: this?.pageCode || ''
  88. }
  89. },
  90. computed: {
  91. optionsEvensGroup1() {
  92. return [
  93. [
  94. [
  95. this.optionsEvensAuth('batchSummary', {
  96. click: () => {
  97. if (this.recordSelected.length === 0) {
  98. this.$message.warning('请勾选工单')
  99. return
  100. }
  101. this.$prompt('汇总名称', '汇总', {
  102. confirmButtonText: '确定',
  103. cancelButtonText: '取消',
  104. inputPattern: /\S/,
  105. inputErrorMessage: '名称不能为空'
  106. })
  107. .then(({ value }) => {
  108. settleExpenseMonthGather({
  109. ids: this.recordSelected.map(item => item.id),
  110. name: value
  111. }).then(res => {
  112. this.$message({
  113. type: 'success',
  114. message: '操作成功!'
  115. })
  116. this.$refs?.pageRef?.refreshList()
  117. })
  118. })
  119. .catch(() => {})
  120. }
  121. })
  122. ],
  123. [
  124. this.optionsEvensAuth(['import', 'download1', 'download2', 'download3', 'download4'], {
  125. name: '导入费用',
  126. click: () => {}
  127. }),
  128. this.optionsEvensAuth('import', ({ moduleName }) => {
  129. return {
  130. name: moduleName,
  131. render: () => {
  132. return this.importButton(settleExpenseImport, moduleName)
  133. }
  134. }
  135. }),
  136. this.optionsEvensAuth('download1', {
  137. click: () => {
  138. commonTemplateDownload({ name: '师傅费用结算导入模板(其它).xlsx' }, `师傅费用结算导入模板(其它)`)
  139. .then(res => {
  140. this.$message({
  141. message: '下载成功',
  142. type: 'success'
  143. })
  144. })
  145. .catch(err => {
  146. this.$message.error('下载失败')
  147. })
  148. }
  149. }),
  150. this.optionsEvensAuth('download2', {
  151. click: () => {
  152. commonTemplateDownload(
  153. { name: '师傅费用结算导入模板(安装其它).xlsx' },
  154. `师傅费用结算导入模板(安装其它)`
  155. )
  156. .then(res => {
  157. this.$message({
  158. message: '下载成功',
  159. type: 'success'
  160. })
  161. })
  162. .catch(err => {
  163. this.$message.error('下载失败')
  164. })
  165. }
  166. }),
  167. this.optionsEvensAuth('download3', {
  168. click: () => {
  169. commonTemplateDownload(
  170. { name: '师傅费用结算导入模板(安装家用空调).xlsx' },
  171. `师傅费用结算导入模板(安装家用空调)`
  172. )
  173. .then(res => {
  174. this.$message({
  175. message: '下载成功',
  176. type: 'success'
  177. })
  178. })
  179. .catch(err => {
  180. this.$message.error('下载失败')
  181. })
  182. }
  183. }),
  184. this.optionsEvensAuth('download4', {
  185. click: () => {
  186. commonTemplateDownload({ name: '师傅费用结算导入模板(维修).xlsx' }, `师傅费用结算导入模板(维修)`)
  187. .then(res => {
  188. this.$message({
  189. message: '下载成功',
  190. type: 'success'
  191. })
  192. })
  193. .catch(err => {
  194. this.$message.error('下载失败')
  195. })
  196. }
  197. })
  198. ]
  199. ]
  200. ]
  201. },
  202. optionsEvensGroup2() {
  203. return [
  204. [
  205. [
  206. {
  207. name: '返回汇总页面',
  208. click: () => {
  209. this.pageLevel = 0
  210. }
  211. }
  212. ]
  213. ],
  214. ...(() => {
  215. if (this.collectItem.status != 'YES') {
  216. return [
  217. [
  218. [
  219. this.optionsEvensAuth('detailAdd', {
  220. click: () => {
  221. this.formBool = true
  222. this.formEdit = false
  223. this.getWorkers()
  224. }
  225. })
  226. ],
  227. [
  228. this.optionsEvensAuth('detailBatchDel', {
  229. click: () => {
  230. if (this.recordSelected.length === 0) {
  231. this.$message.warning('请勾选工单')
  232. return
  233. }
  234. this.$confirm('此操作将永久删除数据, 是否继续?', '提示', {
  235. confirmButtonText: '确定',
  236. cancelButtonText: '取消',
  237. type: 'warning'
  238. })
  239. .then(() => {
  240. settleExpenseBatchDel(this.recordSelected.map(item => item.id)).then(res => {
  241. this.$message({
  242. type: 'success',
  243. message: '删除成功!'
  244. })
  245. this.$refs?.pageRef?.refreshList()
  246. })
  247. })
  248. .catch(() => {})
  249. }
  250. })
  251. ]
  252. ]
  253. ]
  254. }
  255. return []
  256. })()
  257. ]
  258. },
  259. // 更多参数
  260. moreParameters() {
  261. return []
  262. },
  263. formItems() {
  264. return [
  265. {
  266. name: 'el-input',
  267. md: 12,
  268. attributes: {
  269. disabled: this.formEdit.map(item => ({ ...item, label: `(${item.value})${item.label}` }))
  270. },
  271. formItemAttributes: {
  272. label: '网点名称',
  273. prop: 'importWebsitName',
  274. rules: []
  275. }
  276. },
  277. {
  278. name: 'el-date-picker',
  279. md: 6,
  280. attributes: {
  281. type: 'month',
  282. disabled: this.formEdit,
  283. 'value-format': 'yyyy-MM'
  284. },
  285. formItemAttributes: {
  286. label: '发放月份',
  287. prop: 'sendMonth',
  288. rules: [...required]
  289. }
  290. },
  291. {
  292. name: 'el-input',
  293. md: 6,
  294. attributes: {
  295. disabled: this.formEdit
  296. },
  297. formItemAttributes: {
  298. label: '费用类型',
  299. prop: 'typeName',
  300. rules: [...required]
  301. }
  302. },
  303. {
  304. name: 'el-input',
  305. md: 6,
  306. attributes: {
  307. disabled: this.formEdit
  308. },
  309. formItemAttributes: {
  310. label: '安装/维修品类',
  311. prop: 'category',
  312. rules: []
  313. }
  314. },
  315. {
  316. name: 'el-input',
  317. md: 6,
  318. attributes: {
  319. disabled: this.formEdit
  320. },
  321. formItemAttributes: {
  322. label: '维修自编号',
  323. prop: 'repairCustomCode',
  324. rules: []
  325. }
  326. },
  327. {
  328. name: 'el-input',
  329. md: 6,
  330. attributes: {
  331. disabled: this.formEdit
  332. },
  333. formItemAttributes: {
  334. label: '内机条码',
  335. prop: 'insideCode',
  336. rules: []
  337. }
  338. },
  339. {
  340. name: 'el-input',
  341. md: 6,
  342. attributes: {
  343. disabled: this.formEdit
  344. },
  345. formItemAttributes: {
  346. label: '内机名称',
  347. prop: 'insideName',
  348. rules: []
  349. }
  350. },
  351. {
  352. name: 'el-input',
  353. md: 6,
  354. attributes: {
  355. disabled: this.formEdit
  356. },
  357. formItemAttributes: {
  358. label: '基础安装/维修费用',
  359. prop: 'baseAmount',
  360. rules: []
  361. }
  362. },
  363. {
  364. name: 'el-input',
  365. md: 6,
  366. attributes: {
  367. disabled: this.formEdit
  368. },
  369. formItemAttributes: {
  370. label: '辅材达标',
  371. prop: 'materialAmount',
  372. rules: []
  373. }
  374. },
  375. {
  376. name: 'el-input',
  377. md: 6,
  378. attributes: {
  379. disabled: this.formEdit
  380. },
  381. formItemAttributes: {
  382. label: '评价数据达标',
  383. prop: 'appraiseAmount',
  384. rules: []
  385. }
  386. },
  387. {
  388. name: 'el-input',
  389. md: 6,
  390. attributes: {
  391. disabled: this.formEdit
  392. },
  393. formItemAttributes: {
  394. label: '旧机回收达标',
  395. prop: 'recoveryAmount',
  396. rules: this.formData.categoryType === 'INSTALL_HOME' ? [...required] : []
  397. }
  398. },
  399. {
  400. name: 'el-input',
  401. md: 6,
  402. attributes: {
  403. disabled: this.formEdit
  404. },
  405. formItemAttributes: {
  406. label: '其它',
  407. prop: 'otherAmount',
  408. rules: []
  409. }
  410. },
  411. {
  412. md: 6,
  413. name: 'slot-component',
  414. formItemAttributes: {
  415. label: '合计金额',
  416. prop: 'totalAmount',
  417. rules: []
  418. },
  419. attributes: {},
  420. render: (h, { props, onInput }) => {
  421. this.formData.totalAmount =
  422. Number(this.formData.baseAmount || 0) +
  423. Number(this.formData.materialAmount || 0) +
  424. Number(this.formData.appraiseAmount || 0) +
  425. Number(this.formData.otherAmount || 0) +
  426. Number(this.formData.recoveryAmount || 0)
  427. return (
  428. <el-input value={this.formData.totalAmount} disabled={true} size="mini" placeholder="请输入"></el-input>
  429. )
  430. }
  431. },
  432. {
  433. name: 'el-input',
  434. md: 6,
  435. attributes: {
  436. disabled: this.formEdit
  437. },
  438. formItemAttributes: {
  439. label: '工单编号',
  440. prop: 'orderNo',
  441. rules: []
  442. }
  443. },
  444. {
  445. name: 'el-input',
  446. md: 6,
  447. attributes: {
  448. disabled: this.formEdit
  449. },
  450. formItemAttributes: {
  451. label: '销售单号',
  452. prop: 'salesOrderNo',
  453. rules: []
  454. }
  455. },
  456. {
  457. name: 'el-date-picker',
  458. md: 6,
  459. attributes: {
  460. type: 'date',
  461. disabled: this.formEdit,
  462. 'value-format': 'yyyy-MM-dd HH:mm:ss'
  463. },
  464. formItemAttributes: {
  465. label: '安装/维修日期',
  466. prop: 'workDate',
  467. rules: []
  468. }
  469. },
  470. {
  471. name: 'el-input',
  472. md: 6,
  473. attributes: {
  474. disabled: this.formEdit
  475. },
  476. formItemAttributes: {
  477. label: '销售类型',
  478. prop: 'salesType',
  479. rules: []
  480. }
  481. },
  482. {
  483. name: 'el-input',
  484. md: 12,
  485. attributes: {
  486. disabled: this.formEdit
  487. },
  488. formItemAttributes: {
  489. label: '维修内容',
  490. prop: 'repairContent',
  491. rules: []
  492. }
  493. },
  494. {
  495. name: 'el-input',
  496. md: 6,
  497. attributes: {
  498. disabled: this.formEdit
  499. },
  500. formItemAttributes: {
  501. label: '客户名称',
  502. prop: 'userName',
  503. rules: []
  504. }
  505. },
  506. {
  507. name: 'el-input',
  508. md: 6,
  509. attributes: {
  510. disabled: this.formEdit
  511. },
  512. formItemAttributes: {
  513. label: '客户电话',
  514. prop: 'userMobile',
  515. rules: []
  516. }
  517. },
  518. {
  519. name: 'el-input',
  520. md: 24,
  521. attributes: {
  522. disabled: this.formEdit
  523. },
  524. formItemAttributes: {
  525. label: '客户地址',
  526. prop: 'userAddress',
  527. rules: []
  528. }
  529. },
  530. {
  531. name: 'zj-select',
  532. options: this.workerList,
  533. md: 6,
  534. attributes: {
  535. disabled: this.formEdit,
  536. placeholder: '请选择',
  537. clearable: true,
  538. filterable: true,
  539. blurNoMatchText: true,
  540. blurNoMatchInputBorderColor: ''
  541. },
  542. formItemAttributes: {
  543. label: '工程师1名称',
  544. prop: 'workerId1',
  545. rules: [...required]
  546. },
  547. events: {
  548. change: val => {
  549. var data = this.workerList.find(item => item.value == val)?.data
  550. if (data) {
  551. this.formData.workerName1 = data?.workerName || ''
  552. this.formData.workerMobile1 = data?.workerMobile || ''
  553. } else {
  554. this.formData.workerName1 = val
  555. this.formData.workerMobile1 = ''
  556. }
  557. }
  558. }
  559. },
  560. {
  561. name: 'el-input',
  562. md: 6,
  563. attributes: {
  564. disabled: this.formEdit,
  565. placeholder: '请输入'
  566. },
  567. formItemAttributes: {
  568. label: '工程师1电话',
  569. prop: 'workerMobile1',
  570. rules: []
  571. }
  572. },
  573. {
  574. name: 'el-input',
  575. md: 6,
  576. attributes: {
  577. disabled: this.formEdit
  578. },
  579. formItemAttributes: {
  580. label: '工程师1结算比例',
  581. prop: 'workerSettleRate1',
  582. rules: []
  583. }
  584. },
  585. {
  586. name: 'el-input',
  587. md: 6,
  588. attributes: {
  589. disabled: this.formEdit
  590. },
  591. formItemAttributes: {
  592. label: '工程师1结算金额',
  593. prop: 'workerSettleAmount1',
  594. rules: []
  595. }
  596. },
  597. {
  598. name: 'zj-select',
  599. options: this.workerList,
  600. md: 6,
  601. attributes: {
  602. disabled: this.formEdit,
  603. placeholder: '请选择',
  604. clearable: true,
  605. filterable: true,
  606. blurNoMatchText: true,
  607. blurNoMatchInputBorderColor: ''
  608. },
  609. formItemAttributes: {
  610. label: '工程师2名称',
  611. prop: 'workerId2',
  612. rules: []
  613. },
  614. events: {
  615. change: val => {
  616. var data = this.workerList.find(item => item.value == val)?.data
  617. if (data) {
  618. this.formData.workerName2 = data?.workerName || ''
  619. this.formData.workerMobile2 = data?.workerMobile || ''
  620. } else {
  621. this.formData.workerName2 = val
  622. this.formData.workerMobile2 = ''
  623. }
  624. }
  625. }
  626. },
  627. {
  628. name: 'el-input',
  629. md: 6,
  630. attributes: {
  631. disabled: this.formEdit,
  632. placeholder: '请输入'
  633. },
  634. formItemAttributes: {
  635. label: '工程师2电话',
  636. prop: 'workerMobile2',
  637. rules: []
  638. }
  639. },
  640. {
  641. name: 'el-input',
  642. md: 6,
  643. attributes: {
  644. disabled: this.formEdit
  645. },
  646. formItemAttributes: {
  647. label: '工程师2结算比例',
  648. prop: 'workerSettleRate2',
  649. rules: []
  650. }
  651. },
  652. {
  653. name: 'el-input',
  654. md: 6,
  655. attributes: {
  656. disabled: this.formEdit
  657. },
  658. formItemAttributes: {
  659. label: '工程师2结算金额',
  660. prop: 'workerSettleAmount2',
  661. rules: []
  662. }
  663. },
  664. {
  665. name: 'el-input',
  666. md: 24,
  667. attributes: {
  668. disabled: this.formEdit
  669. },
  670. formItemAttributes: {
  671. label: '备注',
  672. prop: 'remark',
  673. rules: []
  674. }
  675. }
  676. ]
  677. }
  678. },
  679. watch: {
  680. pageLevel() {
  681. this.showTable = false
  682. this.$nextTick(() => {
  683. this.showTable = true
  684. })
  685. }
  686. },
  687. created() {
  688. if (this.pageCode) {
  689. this.tagStatus = this?.pageCode
  690. }
  691. },
  692. methods: {
  693. changeType(val) {
  694. this.$refs.pageRef.refreshList()
  695. },
  696. getList1(p, cb) {
  697. var pam = JSON.parse(JSON.stringify(p))
  698. try {
  699. if (this.tagStatus) {
  700. pam.params.push({ param: 'a.status', compare: '=', value: this.tagStatus })
  701. }
  702. cb && cb(pam)
  703. return settleExpenseGatherList(pam)
  704. } catch (err) {}
  705. },
  706. exportList1: settleExpenseGatherListExport,
  707. getList2(p, cb) {
  708. var pam = JSON.parse(JSON.stringify(p))
  709. try {
  710. pam.params.push({ param: 'a.settle_expense_id', compare: '=', value: this.collectItem.id })
  711. cb && cb(pam)
  712. return settleExpenseList(pam)
  713. } catch (err) {}
  714. },
  715. exportList2: settleExpenseListExport,
  716. selectable(row, index) {
  717. if (this.pageLevel) {
  718. return this?.collectItem?.status != 'YES'
  719. }
  720. return !['YES'].includes(Object.entries(row.selectMapData.status).find(([key, val]) => val == row.status)?.[0])
  721. },
  722. operation1() {
  723. return this.operationBtn({
  724. detail: {
  725. click: ({ row, index, column }) => {
  726. this.collectItem = { ...row }
  727. this.pageLevel = 1
  728. }
  729. },
  730. summary: {
  731. conditions: ({ row, index, column }) => {
  732. return row.status != 'YES'
  733. },
  734. click: ({ row, index, column }) => {
  735. this.$prompt('汇总名称', '汇总', {
  736. confirmButtonText: '确定',
  737. cancelButtonText: '取消',
  738. inputPattern: /\S/,
  739. inputErrorMessage: '名称不能为空'
  740. })
  741. .then(({ value }) => {
  742. settleExpenseMonthGather({
  743. ids: [row.id],
  744. name: value
  745. }).then(res => {
  746. this.$message({
  747. type: 'success',
  748. message: '操作成功!'
  749. })
  750. this.$refs?.pageRef?.refreshList()
  751. })
  752. })
  753. .catch(() => {})
  754. }
  755. },
  756. del: {
  757. prompt: '此操作将永久删除数据, 是否继续?',
  758. conditions: ({ row, index, column }) => {
  759. return row.status != 'YES'
  760. },
  761. click: ({ row, index, column }) => {
  762. settleExpenseGatherBatchDel([row.id]).then(res => {
  763. this.$message({
  764. type: 'success',
  765. message: '删除成功!'
  766. })
  767. this.$refs?.pageRef?.refreshList()
  768. })
  769. }
  770. }
  771. })
  772. },
  773. operation2() {
  774. return this.operationBtn({
  775. detailEdit: {
  776. conditions: ({ row, index, column }) => {
  777. return row.status != 'YES'
  778. },
  779. click: ({ row, index, column }) => {
  780. this.formData = {
  781. ...row,
  782. ...(() => {
  783. var obj = {}
  784. if (!row.workerId1 && row.workerName1) {
  785. obj.workerId1 = row.workerName1
  786. }
  787. if (!row.workerId2 && row.workerName2) {
  788. obj.workerId2 = row.workerName2
  789. }
  790. return obj
  791. })()
  792. }
  793. this.formEdit = false
  794. this.formBool = true
  795. this.getWorkers()
  796. }
  797. },
  798. detailDel: {
  799. prompt: '此操作将永久删除数据, 是否继续?',
  800. conditions: ({ row, index, column }) => {
  801. return row.status != 'YES'
  802. },
  803. click: ({ row, index, column }) => {
  804. settleExpenseBatchDel([row.id]).then(res => {
  805. this.$message({
  806. type: 'success',
  807. message: '删除成功!'
  808. })
  809. this.$refs?.pageRef?.refreshList()
  810. })
  811. }
  812. },
  813. details_mx: {
  814. click: ({ row, index, column }) => {
  815. this.formData = {
  816. ...row,
  817. ...(() => {
  818. var obj = {}
  819. if (!row.workerId1 && row.workerName1) {
  820. obj.workerId1 = row.workerName1
  821. }
  822. if (!row.workerId2 && row.workerName2) {
  823. obj.workerId2 = row.workerName2
  824. }
  825. return obj
  826. })()
  827. }
  828. this.formEdit = true
  829. this.formBool = true
  830. this.getWorkers()
  831. }
  832. }
  833. })
  834. },
  835. // 表格列解析渲染数据更改
  836. columnParsing(item, defaultData) {
  837. return defaultData
  838. },
  839. // 监听勾选变化
  840. selectionChange(data) {
  841. this.recordSelected = data
  842. },
  843. handleClose() {
  844. this.$data.formData = this.$options.data().formData
  845. this.formBool = false
  846. this.formEdit = false
  847. },
  848. formConfirm() {
  849. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  850. if (valid) {
  851. settleExpenseSave({ ...this.formData, settleExpenseId: this.collectItem.id }).then(res => {
  852. this.$message({
  853. type: 'success',
  854. message: '保存成功!'
  855. })
  856. this.$refs.pageRef.refreshList()
  857. this.handleClose()
  858. })
  859. }
  860. })
  861. },
  862. getWorkers() {
  863. memberListPageV2({
  864. pageNum: 1,
  865. pageSize: -1,
  866. isGroupByWorkerId: true,
  867. params: [{ param: 'b.examine_status', compare: '=', value: 'OK' }]
  868. }).then(res => {
  869. this.workerList = res.data.records.map(item => {
  870. var { id, userId, ...data } = item
  871. return {
  872. value: userId,
  873. label: data.nickName,
  874. data: {
  875. workerId: userId,
  876. workerName: data.nickName,
  877. workerIdcard: data.idCard,
  878. workerMobile: data.mobile,
  879. ...data
  880. }
  881. }
  882. })
  883. })
  884. }
  885. }
  886. }
  887. </script>
  888. <style lang="scss" scoped>
  889. .neibuview {
  890. box-sizing: border-box;
  891. padding-left: 16px;
  892. ::v-deep & > .zj-page-fill-scroll {
  893. box-sizing: border-box;
  894. padding-right: 16px;
  895. & > div:nth-child(1) {
  896. margin-top: 20px;
  897. }
  898. }
  899. }
  900. </style>