index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="扣款单号" prop="deductNo">
  5. <el-input
  6. v-model="queryParams.deductNo"
  7. placeholder="请输入扣款单号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="公司名称" prop="companyName">
  14. <el-input
  15. v-model="queryParams.companyName"
  16. placeholder="请输入公司名称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="业务类型" prop="businessType">
  23. <el-select v-model="queryParams.businessType" placeholder="请选择支付类型" clearable size="small">
  24. <el-option
  25. v-for="dict in businessTypeOptions"
  26. :key="dict.dictValue"
  27. :label="dict.dictLabel"
  28. :value="dict.dictValue"
  29. />
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="创建时间" prop="createTime">
  33. <el-date-picker clearable size="small"
  34. v-model="queryParams.createTime"
  35. type="date"
  36. value-format="yyyy-MM-dd"
  37. placeholder="选择创建时间">
  38. </el-date-picker>
  39. </el-form-item>
  40. <el-form-item>
  41. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  42. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  43. </el-form-item>
  44. </el-form>
  45. <el-row :gutter="10" class="mb8">
  46. <el-col :span="1.5">
  47. <el-button
  48. type="warning"
  49. plain
  50. icon="el-icon-download"
  51. size="mini"
  52. :loading="exportLoading"
  53. @click="handleExport"
  54. v-hasPermi="['his:companyDeduct:export']"
  55. >导出</el-button>
  56. </el-col>
  57. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  58. </el-row>
  59. <el-tabs type="card" v-model="queryParams.isAudit" @tab-click="handleClickX">
  60. <el-tab-pane v-for="(item,index) in isAuditOptions" :label="item.dictLabel" :name="item.dictValue"></el-tab-pane>
  61. </el-tabs>
  62. <el-table v-loading="loading" border :data="companyDeductList" @selection-change="handleSelectionChange">
  63. <el-table-column type="selection" width="55" align="center" />
  64. <el-table-column label="扣款单号" align="center" prop="deductNo" width="200px" />
  65. <el-table-column label="公司名称" align="center" prop="companyName" />
  66. <el-table-column label="金额" align="center" prop="money" />
  67. <el-table-column label="余额" align="center" prop="balance" />
  68. <el-table-column label="提交人" align="center" prop="createUserNickName" />
  69. <el-table-column label="业务类型" align="center" prop="businessType">
  70. <template slot-scope="scope">
  71. <dict-tag :options="businessTypeOptions" :value="scope.row.businessType"/>
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="审核状态" align="center" prop="isAudit">
  75. <template slot-scope="scope">
  76. <dict-tag :options="isAuditOptions" :value="scope.row.isAudit"/>
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="审核人" align="center" prop="auditUserId" />
  80. <el-table-column label="备注" align="center" prop="remark" />
  81. <el-table-column label="审核时间" align="center" prop="auditTime" width="180" />
  82. <el-table-column label="创建时间" align="center" prop="createTime" width="180" />
  83. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right">
  84. <template slot-scope="scope" v-if="scope.row.isAudit==0">
  85. <el-button
  86. size="mini"
  87. type="text"
  88. icon="el-icon-edit"
  89. @click="handleUpdate(scope.row)"
  90. v-hasPermi="['his:companyDeduct:edit']"
  91. >审核</el-button>
  92. </template>
  93. </el-table-column>
  94. </el-table>
  95. <pagination
  96. v-show="total>0"
  97. :total="total"
  98. :page.sync="queryParams.pageNum"
  99. :limit.sync="queryParams.pageSize"
  100. @pagination="getList"
  101. />
  102. <!-- 添加或修改扣款管理对话框 -->
  103. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  104. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  105. <el-form-item label="公司" prop="companyName">
  106. <el-input v-model="form.companyName" disabled />
  107. </el-form-item>
  108. <el-form-item label="扣款金额" prop="money">
  109. <el-input v-model="form.money" disabled />
  110. </el-form-item>
  111. <el-form-item label="状态" prop="isAudit">
  112. <el-radio-group v-model="form.isAudit">
  113. <el-radio label="1">通过</el-radio>
  114. <el-radio label="-1">驳回</el-radio>
  115. </el-radio-group>
  116. </el-form-item>
  117. <el-form-item label="备注" prop="remark">
  118. <el-input v-model="form.remark" type="textarea" :row="5" />
  119. </el-form-item>
  120. </el-form>
  121. <div slot="footer" class="dialog-footer">
  122. <el-button type="primary" @click="submitForm">确 定</el-button>
  123. <el-button @click="cancel">取 消</el-button>
  124. </div>
  125. </el-dialog>
  126. </div>
  127. </template>
  128. <script>
  129. import { listCompanyDeduct, getCompanyDeduct, delCompanyDeduct, addCompanyDeduct, updateCompanyDeduct, exportCompanyDeduct } from "@/api/his/companyDeduct";
  130. export default {
  131. name: "CompanyDeduct",
  132. data() {
  133. return {
  134. // 遮罩层
  135. loading: true,
  136. // 导出遮罩层
  137. exportLoading: false,
  138. // 选中数组
  139. ids: [],
  140. // 非单个禁用
  141. single: true,
  142. // 非多个禁用
  143. multiple: true,
  144. // 显示搜索条件
  145. showSearch: true,
  146. // 总条数
  147. total: 0,
  148. // 扣款管理表格数据
  149. companyDeductList: [],
  150. // 弹出层标题
  151. title: "",
  152. // 是否显示弹出层
  153. open: false,
  154. // 审核状态字典
  155. isAuditOptions: [],
  156. // 业务类型 0-普通 1-红包充值
  157. businessTypeOptions:[],
  158. // 查询参数
  159. queryParams: {
  160. pageNum: 1,
  161. pageSize: 10,
  162. deductNo: null,
  163. companyName: null,
  164. createTime: null,
  165. isAudit: 0,
  166. businessType:null, // 业务类型
  167. },
  168. // 表单参数
  169. form: {},
  170. // 表单校验
  171. rules: {
  172. isAudit: [
  173. { required: true, message: "状态不能为空", trigger: "blur" }
  174. ],
  175. }
  176. };
  177. },
  178. created() {
  179. this.getDicts("sys_company_isaudit").then(response => {
  180. this.isAuditOptions = response.data;
  181. });
  182. this.getDicts("sys_company_deduct_business_type").then(response => {
  183. this.businessTypeOptions = response.data;
  184. });
  185. this.getList();
  186. },
  187. methods: {
  188. /** 查询扣款管理列表 */
  189. getList() {
  190. this.loading = true;
  191. listCompanyDeduct(this.queryParams).then(response => {
  192. this.companyDeductList = response.rows;
  193. this.total = response.total;
  194. this.loading = false;
  195. });
  196. },
  197. // 取消按钮
  198. cancel() {
  199. this.open = false;
  200. this.reset();
  201. },
  202. // 表单重置
  203. reset() {
  204. this.form = {
  205. deductId: null,
  206. deductNo: null,
  207. companyId: null,
  208. money: null,
  209. balance: null,
  210. createTime: null,
  211. createUserId: null,
  212. isAudit: null,
  213. auditUserId: null,
  214. auditTime: null,
  215. remark: null
  216. };
  217. this.resetForm("form");
  218. },
  219. /** 搜索按钮操作 */
  220. handleQuery() {
  221. this.queryParams.pageNum = 1;
  222. this.getList();
  223. },
  224. /** 重置按钮操作 */
  225. resetQuery() {
  226. this.resetForm("queryForm");
  227. this.queryParams.businessType=null;
  228. this.handleQuery();
  229. },
  230. // 多选框选中数据
  231. handleSelectionChange(selection) {
  232. this.ids = selection.map(item => item.deductId)
  233. this.single = selection.length!==1
  234. this.multiple = !selection.length
  235. },
  236. /** 修改按钮操作 */
  237. handleUpdate(row) {
  238. this.reset();
  239. getCompanyDeduct(row.deductId).then(response => {
  240. this.form = response.data;
  241. this.open = true;
  242. this.title = "审核";
  243. this.form.companyName=row.companyName;
  244. this.form.isAudit=null;
  245. });
  246. },
  247. handleClickX(){
  248. this.handleQuery()
  249. },
  250. /** 提交按钮 */
  251. submitForm() {
  252. this.$refs["form"].validate(valid => {
  253. if (valid) {
  254. if (this.form.deductId != null) {
  255. updateCompanyDeduct(this.form).then(response => {
  256. this.msgSuccess("修改成功");
  257. this.open = false;
  258. this.getList();
  259. });
  260. } else {
  261. addCompanyDeduct(this.form).then(response => {
  262. this.msgSuccess("新增成功");
  263. this.open = false;
  264. this.getList();
  265. });
  266. }
  267. }
  268. });
  269. },
  270. /** 删除按钮操作 */
  271. handleDelete(row) {
  272. const deductIds = row.deductId || this.ids;
  273. this.$confirm('是否确认删除扣款管理编号为"' + deductIds + '"的数据项?', "警告", {
  274. confirmButtonText: "确定",
  275. cancelButtonText: "取消",
  276. type: "warning"
  277. }).then(function() {
  278. return delCompanyDeduct(deductIds);
  279. }).then(() => {
  280. this.getList();
  281. this.msgSuccess("删除成功");
  282. }).catch(() => {});
  283. },
  284. /** 导出按钮操作 */
  285. handleExport() {
  286. const queryParams = this.queryParams;
  287. this.$confirm('是否确认导出所有扣款管理数据项?', "警告", {
  288. confirmButtonText: "确定",
  289. cancelButtonText: "取消",
  290. type: "warning"
  291. }).then(() => {
  292. this.exportLoading = true;
  293. return exportCompanyDeduct(queryParams);
  294. }).then(response => {
  295. this.download(response.msg);
  296. this.exportLoading = false;
  297. }).catch(() => {});
  298. }
  299. }
  300. };
  301. </script>