index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409
  1. <template>
  2. <template-page v-if="showTable" ref="pageRef" :get-list="[getList, getList1, getList2][pageLevel]"
  3. :exportList="[undefined, exportList1, exportList2][pageLevel]"
  4. :options-evens-group="[optionsEvensGroup0, optionsEvensGroup1, optionsEvensGroup2][pageLevel]"
  5. :operation="([operation0, operation1, operation2][pageLevel])()"
  6. :expCode="['', 'workerExp', 'detailExp'][pageLevel]" :table-attributes="tableAttributes" :table-events="tableEvents"
  7. :moreParameters="moreParameters" :column-parsing="columnParsing">
  8. <div class="cartographer_big">
  9. <el-dialog title="发放" width="100%" :modal="false" :visible.sync="formBool" :before-close="handleClose">
  10. <zj-page-container v-if="formBool">
  11. <zj-page-fill class="neibuview">
  12. <zj-form-container ref="formRef" :form-data="formData" :form-attributes="{ size: 'mini' }">
  13. <zj-form-module title="发放信息" label-width="130px" :form-data="formData" :form-items="formItems" />
  14. </zj-form-container>
  15. </zj-page-fill>
  16. <div>
  17. <div style="box-sizing: border-box; padding: 10px">
  18. <el-button size="mini" @click="handleClose">取 消</el-button>
  19. <el-button v-if="!formEdit" size="mini" @click="formConfirm" type="primary">确 定</el-button>
  20. </div>
  21. </div>
  22. </zj-page-container>
  23. </el-dialog>
  24. </div>
  25. </template-page>
  26. </template>
  27. <script>
  28. import TemplatePage from '@/components/template/template-page-1.vue'
  29. import import_mixin from '@/components/template/import_mixin.js'
  30. import operation_mixin from '@/components/template/operation_mixin.js'
  31. import ImageUpload from '@/components/file-upload'
  32. import { required, mobileRequired, mobile, httpUrl, email } from '@/components/template/rules_verify.js'
  33. import {
  34. settleExpenseList,
  35. settleExpenseListExport,
  36. settleMonthWagesGatherList,
  37. settleMonthWagesList,
  38. settleMonthWagesListExport,
  39. settleMonthWagesBatchReject,
  40. settleMonthWagesBatchSend,
  41. settleMonthWagesWorkerBatchSend
  42. } from "@/api/costPerDimension";
  43. export default {
  44. components: { TemplatePage, ImageUpload },
  45. mixins: [import_mixin, operation_mixin],
  46. data() {
  47. return {
  48. // 表格属性
  49. tableAttributes: {
  50. // 启用勾选列
  51. selectColumn: true,
  52. selectable: this.selectable
  53. },
  54. // 表格事件
  55. tableEvents: {
  56. 'selection-change': this.selectionChange
  57. },
  58. // 勾选选中行
  59. recordSelected: [],
  60. pageLevel: 0,
  61. showTable: true,
  62. monthItem: {},
  63. workerItem: {},
  64. formData: {
  65. sendDate: "",
  66. fileUrl: [],
  67. remark: ""
  68. },
  69. formBool: false,
  70. formEdit: false,
  71. workerList: []
  72. }
  73. },
  74. computed: {
  75. optionsEvensGroup0() {
  76. return [
  77. [
  78. [
  79. this.optionsEvensAuth("monthBatchRelease", {
  80. click: () => {
  81. if (this.recordSelected.length === 0) {
  82. this.$message.warning('请勾选工单')
  83. return
  84. }
  85. this.formBool = true
  86. }
  87. })
  88. ],
  89. [
  90. this.optionsEvensAuth("monthBatchRejection", {
  91. click: () => {
  92. if (this.recordSelected.length === 0) {
  93. this.$message.warning('请勾选工单')
  94. return
  95. }
  96. this.$confirm('是否确定驳回', '提示', {
  97. confirmButtonText: '确定',
  98. cancelButtonText: '取消',
  99. type: 'warning'
  100. }).then(() => {
  101. settleMonthWagesBatchReject(this.recordSelected.map(item => item.id)).then(res => {
  102. this.$message({
  103. type: 'success',
  104. message: '操作成功!'
  105. })
  106. this.$refs?.pageRef?.refreshList()
  107. })
  108. }).catch(() => {
  109. });
  110. }
  111. })
  112. ],
  113. ]
  114. ]
  115. },
  116. optionsEvensGroup1() {
  117. return [
  118. [
  119. [
  120. {
  121. name: "返回月度汇总页面",
  122. click: () => {
  123. this.pageLevel = 0
  124. }
  125. }
  126. ],
  127. ],
  128. [
  129. [
  130. this.optionsEvensAuth("workerBatchRelease", {
  131. click: () => {
  132. if (this.recordSelected.length === 0) {
  133. this.$message.warning('请勾选工单')
  134. return
  135. }
  136. this.formBool = true
  137. }
  138. })
  139. ],
  140. ]
  141. ]
  142. },
  143. optionsEvensGroup2() {
  144. return [
  145. [
  146. [
  147. {
  148. name: "返回师傅汇总页面",
  149. click: () => {
  150. this.pageLevel = 1
  151. }
  152. }
  153. ],
  154. ],
  155. ]
  156. },
  157. // 更多参数
  158. moreParameters() {
  159. return []
  160. },
  161. formItems() {
  162. return [{
  163. name: 'el-date-picker',
  164. md: 6,
  165. attributes: {
  166. type: "date",
  167. disabled: this.formEdit,
  168. 'value-format': 'yyyy-MM-dd HH:mm:ss',
  169. },
  170. formItemAttributes: {
  171. label: '发放日期',
  172. prop: 'sendDate',
  173. rules: [...required]
  174. }
  175. }, {
  176. md: 24,
  177. name: 'slot-component',
  178. formItemAttributes: {
  179. label: '发放凭证',
  180. prop: 'fileUrl',
  181. rules: []
  182. },
  183. render: (h, { props, onInput }) => {
  184. return (
  185. <ImageUpload fileList={this.formData.fileUrl} limit={1} fileType={["image"]} />
  186. )
  187. }
  188. }, {
  189. name: 'el-input',
  190. md: 24,
  191. attributes: {
  192. disabled: this.formEdit,
  193. },
  194. formItemAttributes: {
  195. label: '备注',
  196. prop: 'remark',
  197. rules: []
  198. }
  199. }, {
  200. md: 24,
  201. name: 'slot-component',
  202. formItemAttributes: {
  203. label: '',
  204. 'label-width': '0px',
  205. prop: '',
  206. },
  207. render: (h, { props, onInput }) => {
  208. return <hr />
  209. }
  210. }, {
  211. md: 6,
  212. name: 'slot-component',
  213. formItemAttributes: {
  214. label: '结算金额合计',
  215. prop: '',
  216. },
  217. render: (h, { props, onInput }) => {
  218. return <div>1</div>
  219. }
  220. }, {
  221. md: 6,
  222. name: 'slot-component',
  223. formItemAttributes: {
  224. label: '发放人数',
  225. prop: '',
  226. },
  227. render: (h, { props, onInput }) => {
  228. return <div>1</div>
  229. }
  230. }, {
  231. md: 24,
  232. name: 'slot-component',
  233. formItemAttributes: {
  234. label: '',
  235. 'label-width': '0px',
  236. prop: '',
  237. },
  238. render: (h, { props, onInput }) => {
  239. return <zj-table
  240. columns={[
  241. {
  242. columnAttributes: {
  243. label: '操作类别',
  244. prop: 'type',
  245. width: 140
  246. }
  247. },
  248. {
  249. columnAttributes: {
  250. label: '操作类别',
  251. prop: 'type',
  252. width: 140
  253. }
  254. },
  255. {
  256. columnAttributes: {
  257. label: '操作类别',
  258. prop: 'type',
  259. }
  260. },
  261. ]}
  262. table-data={this.recordSelected}
  263. />
  264. }
  265. }]
  266. }
  267. },
  268. watch: {
  269. pageLevel() {
  270. this.showTable = false
  271. this.$nextTick(() => {
  272. this.showTable = true
  273. })
  274. }
  275. },
  276. methods: {
  277. getList: settleMonthWagesGatherList,
  278. getList1(p, cb) {
  279. var pam = JSON.parse(JSON.stringify(p))
  280. try {
  281. pam.params.push({ "param": "a.settle_month_wages_id", "compare": "=", "value": this.monthItem.id })
  282. cb && cb(pam)
  283. return settleMonthWagesList(pam)
  284. } catch (err) {
  285. }
  286. },
  287. exportList1: settleMonthWagesListExport,
  288. getList2(p, cb) {
  289. var pam = JSON.parse(JSON.stringify(p))
  290. try {
  291. pam.params.push({ "param": "a.month_settle_worker_id", "compare": "=", "value": this.workerItem.workerId })
  292. cb && cb(pam)
  293. return settleExpenseList(pam)
  294. } catch (err) {
  295. }
  296. },
  297. exportList2: settleExpenseListExport,
  298. selectable(row, index) {
  299. return !["END"].includes(Object.entries(row.selectMapData.status).find(([key, val]) => val == row.status)?.[0])
  300. },
  301. operation0() {
  302. return this.operationBtn({
  303. monthRelease: {
  304. conditions: ({ row, index, column }) => {
  305. return row.status != "END"
  306. },
  307. click: ({ row, index, column }) => {
  308. this.recordSelected = [{ ...row }]
  309. this.formBool = true
  310. }
  311. },
  312. monthRejection: {
  313. prompt: "是否确定驳回?",
  314. conditions: ({ row, index, column }) => {
  315. return true
  316. },
  317. click: ({ row, index, column }) => {
  318. settleMonthWagesBatchReject([row.id]).then(res => {
  319. this.$message({
  320. type: 'success',
  321. message: '操作成功!'
  322. })
  323. this.$refs?.pageRef?.refreshList()
  324. })
  325. }
  326. },
  327. monthDetails: {
  328. click: ({ row, index, column }) => {
  329. this.monthItem = row
  330. this.pageLevel = 1
  331. }
  332. }
  333. })
  334. },
  335. operation1() {
  336. return this.operationBtn({
  337. workerRelease: {
  338. conditions: ({ row, index, column }) => {
  339. return row.status != "END"
  340. },
  341. click: ({ row, index, column }) => {
  342. this.recordSelected = [{ ...row }]
  343. this.formBool = true
  344. }
  345. },
  346. workerDetails: {
  347. click: ({ row, index, column }) => {
  348. this.workerItem = row
  349. this.pageLevel = 2
  350. }
  351. },
  352. })
  353. },
  354. operation2() {
  355. return undefined
  356. },
  357. // 表格列解析渲染数据更改
  358. columnParsing(item, defaultData) {
  359. return defaultData
  360. },
  361. // 监听勾选变化
  362. selectionChange(data) {
  363. this.recordSelected = data
  364. },
  365. handleClose() {
  366. this.recordSelected = []
  367. this.$refs?.pageRef?.refreshList()
  368. this.$data.formData = this.$options.data().formData
  369. this.formBool = false
  370. },
  371. formConfirm() {
  372. this.$refs.formRef.validate((valid, invalidFields, errLabels) => {
  373. if (valid) {
  374. ; ([settleMonthWagesBatchSend, settleMonthWagesWorkerBatchSend][this.pageLevel])({
  375. ...this.formData,
  376. fileUrl: this.formData.fileUrl.length ? this.formData.fileUrl[0]?.url : "",
  377. ids: this.recordSelected.map(item => item.id),
  378. settleMonthWagesId: this.monthItem.id || undefined
  379. }).then(res => {
  380. this.$message({
  381. type: 'success',
  382. message: '发放成功!'
  383. })
  384. this.handleClose()
  385. })
  386. }
  387. })
  388. },
  389. }
  390. }
  391. </script>
  392. <style lang="scss" scoped>
  393. .neibuview {
  394. box-sizing: border-box;
  395. padding-left: 16px;
  396. ::v-deep &>.zj-page-fill-scroll {
  397. box-sizing: border-box;
  398. padding-right: 16px;
  399. &>div:nth-child(1) {
  400. margin-top: 20px;
  401. }
  402. }
  403. }
  404. </style>