index.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <div class="app-container">
  3. <strong>1.工伤、残保费用配置:</strong>
  4. <br /><br />
  5. <!-- 按钮 -->
  6. <div class="btn-group clearfix">
  7. <div class="fl">
  8. <el-button type="primary" size="mini" @click="showDialog">新增</el-button>
  9. </div>
  10. </div>
  11. <!-- 列表 -->
  12. <div class="mymain-container">
  13. <div class="table">
  14. <el-table
  15. v-loading="listLoading"
  16. :data="dataList"
  17. element-loading-text="Loading"
  18. border
  19. fit
  20. highlight-current-row
  21. stripe
  22. >
  23. <el-table-column align="center" label="操作" fixed width="100">
  24. <template slot-scope="scope">
  25. <el-button type="text" @click="editFn(scope.row)">编辑</el-button>
  26. <el-popconfirm @confirm="delFn(scope.row.id)" title="你确定删除吗?">
  27. <el-button type="text" class="textColor" slot="reference">删除</el-button>
  28. </el-popconfirm>
  29. </template>
  30. </el-table-column>
  31. <el-table-column
  32. align="left"
  33. label="费用名称"
  34. prop="name"
  35. min-width="100"
  36. show-overflow-tooltip
  37. ></el-table-column>
  38. <el-table-column align="right" label="扣除金额" prop="amount" min-width="100" show-overflow-tooltip>
  39. <template slot-scope="scope">
  40. {{ scope.row.amount | numToFixed }}
  41. </template>
  42. </el-table-column>
  43. <el-table-column
  44. align="left"
  45. label="备注"
  46. prop="remark"
  47. min-width="100"
  48. show-overflow-tooltip
  49. ></el-table-column>
  50. <el-table-column
  51. align="left"
  52. label="创建人"
  53. prop="createBy"
  54. min-width="100"
  55. show-overflow-tooltip
  56. ></el-table-column>
  57. <el-table-column
  58. align="left"
  59. label="创建时间"
  60. prop="createTime"
  61. min-width="100"
  62. show-overflow-tooltip
  63. ></el-table-column>
  64. </el-table>
  65. </div>
  66. <!-- 分页 -->
  67. <div class="fr">
  68. <el-pagination
  69. @size-change="handleSizeChange"
  70. @current-change="handleCurrentChange"
  71. :current-page="currentPage"
  72. :page-sizes="[10, 20, 30, 50]"
  73. :page-size="pageSize"
  74. layout="total, sizes, prev, pager, next, jumper"
  75. :total="listTotal"
  76. >
  77. </el-pagination>
  78. </div>
  79. </div>
  80. <br /><br />
  81. <el-row>
  82. <el-col :xs="24" :sm="6" :lg="4">
  83. <strong style="line-height: 28px"> 2.结算汇总暂扣款比例:</strong>
  84. </el-col>
  85. <el-col :xs="24" :sm="3" :lg="3">
  86. <el-input type="number" v-model="config" size="mini"><i class="el-input__icon" slot="suffix">% </i></el-input>
  87. </el-col>
  88. </el-row>
  89. <br />
  90. <span style="color: red"
  91. >注:维修结算费用发放优先扣除工伤、残保:每天结算费用汇总时扣除暂扣比例后,再发放工资给师傅!</span
  92. >
  93. <!-- 弹窗 -->
  94. <el-dialog
  95. :title="title"
  96. :visible.sync="dialogForm"
  97. width="500px"
  98. :show-close="false"
  99. :close-on-click-modal="false"
  100. >
  101. <el-form ref="addForm" :rules="rules" :model="addForm" label-width="100px">
  102. <el-form-item label="费用名称" prop="name">
  103. <el-input v-model="addForm.name" placeholder="请输入"></el-input>
  104. </el-form-item>
  105. <el-form-item label="扣除金额" prop="amount">
  106. <el-input v-model="addForm.amount" placeholder="请输入"
  107. ><i class="el-input__icon" slot="suffix">元 </i></el-input
  108. >
  109. </el-form-item>
  110. <el-form-item label="备注" prop="remark">
  111. <el-input v-model="addForm.remark" placeholder="请输入"></el-input>
  112. </el-form-item>
  113. </el-form>
  114. <div slot="footer" class="dialog-footer">
  115. <el-button @click="cancelFn">取 消</el-button>
  116. <el-button type="primary" @click="confirmFn">确 定</el-button>
  117. </div>
  118. </el-dialog>
  119. <div class="page-footer">
  120. <div class="footer">
  121. <el-button type="primary" @click="editConfigFn">修改</el-button>
  122. </div>
  123. </div>
  124. </div>
  125. </template>
  126. <script>
  127. import {
  128. getList,
  129. getListAdd,
  130. getListDelete,
  131. getListUpdate,
  132. getConfig,
  133. getConfigSave
  134. } from '@/api/maintainDailyWithholdDispose'
  135. export default {
  136. data() {
  137. return {
  138. title: '新增',
  139. dialogForm: false,
  140. dialogForm: false,
  141. rules: {
  142. name: [{ required: true, message: '请输入费用名称', trigger: 'blur' }],
  143. amount: [{ required: true, message: '请输入金额', trigger: 'blur' }]
  144. },
  145. addForm: {
  146. name: '',
  147. amount: '',
  148. remark: ''
  149. },
  150. editId: '',
  151. dataList: [], // 列表数据
  152. listLoading: false, // 列表加载loading
  153. currentPage: 1, // 当前页码
  154. pageSize: 10, // 每页数量
  155. listTotal: 0, // 列表总数
  156. config: 0
  157. }
  158. },
  159. created() {
  160. this.getDataList()
  161. this.getConfigData()
  162. },
  163. methods: {
  164. //修改
  165. async editConfigFn() {
  166. let res = (this.config / 100).toFixed(2)
  167. await getConfigSave({
  168. rate: res
  169. })
  170. this.$message.success('修改成功')
  171. },
  172. //获取扣款比例
  173. async getConfigData() {
  174. let res = await getConfig()
  175. this.config = (res.data.dictValue * 100).toFixed(0)
  176. },
  177. // 更改每页数量
  178. handleSizeChange(val) {
  179. this.pageSize = val
  180. this.currentPage = 1
  181. this.getDataList()
  182. },
  183. // 更改当前页
  184. handleCurrentChange(val) {
  185. this.currentPage = val
  186. this.getDataList()
  187. },
  188. //编辑
  189. editFn(value) {
  190. this.dialogForm = true
  191. this.$nextTick(() => {
  192. this.title = '编辑'
  193. this.editId = value.id
  194. this.addForm.name = value.name
  195. this.addForm.amount = value.amount
  196. this.addForm.remark = value.remark
  197. })
  198. },
  199. //删除
  200. async delFn(id) {
  201. await getListDelete({ id })
  202. this.getDataList()
  203. this.$message.success('删除成功')
  204. },
  205. //获取列表数据
  206. async getDataList() {
  207. let res = await getList({ pageNum: this.currentPage, pageSize: this.pageSize, params: [] })
  208. this.dataList = res.data.records
  209. this.listTotal = res.data.total
  210. },
  211. //取消
  212. async cancelFn() {
  213. await this.$refs.addForm.resetFields()
  214. this.dialogForm = false
  215. },
  216. //确定
  217. async confirmFn() {
  218. await this.$refs.addForm.validate()
  219. if (this.title == '编辑') {
  220. let data = {
  221. id: this.editId,
  222. ...this.addForm
  223. }
  224. await getListUpdate(data)
  225. this.$message.success('编辑成功')
  226. } else {
  227. await getListAdd(this.addForm)
  228. this.$message.success('新增成功')
  229. }
  230. this.getDataList()
  231. this.cancelFn()
  232. },
  233. //新增
  234. showDialog() {
  235. this.title = '新增'
  236. this.dialogForm = true
  237. }
  238. }
  239. }
  240. </script>
  241. <style lang="scss" scoped>
  242. .page-footer {
  243. height: 70px;
  244. .footer {
  245. position: fixed;
  246. bottom: 0;
  247. left: 0;
  248. z-index: 9;
  249. width: 100%;
  250. background: #fff;
  251. padding: 15px 40px;
  252. box-sizing: border-box;
  253. transition: all 0.28s;
  254. text-align: right;
  255. box-shadow: 0 2px 5px 0 rgb(0 0 0 / 50%), 0 2px 5px 0 rgb(0 0 0 / 10%);
  256. &.hideSidebar {
  257. margin-left: 54px;
  258. width: calc(100vw - 54px);
  259. }
  260. &.openSidebar {
  261. margin-left: 210px;
  262. width: calc(100vw - 210px);
  263. }
  264. }
  265. }
  266. ::v-deep .el-dialog__body {
  267. overflow-y: auto;
  268. }
  269. </style>