index.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. <template>
  2. <div class="app-container" v-loading="loading">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" >
  4. <el-form-item label="人员名称" prop="name">
  5. <el-input
  6. v-model.trim="queryParams.name"
  7. placeholder="请输入人员名称"
  8. clearable
  9. size="medium"
  10. style="width: 200px"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="手机号" prop="phone">
  15. <el-input
  16. v-model.trim="queryParams.phone"
  17. placeholder="请输入手机号"
  18. clearable
  19. size="medium"
  20. style="width: 200px"
  21. @keyup.enter.native="handleQuery"
  22. />
  23. </el-form-item>
  24. <el-form-item label="卡号" prop="card">
  25. <el-input
  26. v-model.trim="queryParams.card"
  27. placeholder="请输入卡号"
  28. clearable
  29. size="medium"
  30. style="width: 200px"
  31. @keyup.enter.native="handleQuery"
  32. />
  33. </el-form-item>
  34. <el-form-item>
  35. <el-button type="primary" icon="el-icon-search" size="medium" @click="handleQuery">搜索</el-button>
  36. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  37. <el-button icon="el-icon-refresh" size="mini" @click="synchroPersonnel">人员信息同步</el-button>
  38. <el-button type="primary" icon="el-icon-circle-plus-outline" size="mini" @click="batchChange(0)">批量绑定</el-button>
  39. <el-button type="primary" icon="el-icon-remove-outline" size="mini" @click="batchChange(1)">批量解除</el-button>
  40. </el-form-item>
  41. </el-form>
  42. <el-table :data="adminList" @selection-change="handleSelectionChange">
  43. <el-table-column type="selection" width="50" align="center" />
  44. <el-table-column label="id" align="center" prop="id" />
  45. <el-table-column label="人员名称" align="center" prop="name" />
  46. <el-table-column label="身份信息" align="center" prop="identity" />
  47. <el-table-column label="手机号" align="center" prop="contacts" />
  48. <el-table-column label="卡号" align="center" prop="cardId" />
  49. <el-table-column label="充值到账比例" align="center" prop="proportion" />
  50. <el-table-column label="创建时间" align="center" prop="createTime" />
  51. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  52. <template slot-scope="scope">
  53. <el-button
  54. size="mini"
  55. type="text"
  56. icon="el-icon-link"
  57. @click="radio(scope.row)"
  58. >充值</el-button>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. <!-- 添加或修改参数配置对话框 -->
  63. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body :before-close="cancel" :close-on-click-modal="false" >
  64. <el-form ref="queryParams" :model="queryParams" :rules="rules" label-width="120px" >
  65. <el-form-item label="到账比例:" prop="id">
  66. <el-select v-model="queryParams.id" style="width: 240px" placeholder="请选择到账比例" clearable size="small" >
  67. <el-option :label="`${item.identity}:${item.proportion}`" :value="item.id" v-for="(item, index) in radioList" :key="index" />
  68. </el-select>
  69. </el-form-item>
  70. </el-form>
  71. <div slot="footer" class="dialog-footer">
  72. <el-button type="primary" @click="submitForm" v-if="!loading">确 定</el-button>
  73. <el-button :loading="loading" type="primary" @click="submitForm" v-else>提交中...</el-button>
  74. <el-button @click="cancel">取 消</el-button>
  75. </div>
  76. </el-dialog>
  77. <pagination
  78. v-show="total>0"
  79. :total="total"
  80. :page.sync="queryParams.current"
  81. :limit.sync="queryParams.size"
  82. @pagination="getList"
  83. />
  84. </div>
  85. </template>
  86. <script>
  87. import { listChannel, personJob, staff } from "@/api/recharge/personnel";
  88. import { allRadio } from "@/api/recharge/radio";
  89. export default {
  90. name: "admin",
  91. data() {
  92. return {
  93. // 遮罩层
  94. loading: true,
  95. // 导出遮罩层
  96. exportLoading: false,
  97. dialogFormVisible:false,
  98. // 选中数组id
  99. ids: [],
  100. // 非单个禁用
  101. single: true,
  102. // 非多个禁用
  103. multiple: true,
  104. // 显示搜索条件
  105. showSearch: true,
  106. // 总条数
  107. total: 0,
  108. // 参数表格数据
  109. adminList: [],
  110. // 弹出层标题
  111. title: "",
  112. // 是否显示弹出层
  113. open: false,
  114. // 类型数据字典
  115. typeOptions: [],
  116. // 日期范围
  117. dateRange: [],
  118. // 查询参数
  119. queryParams: {
  120. current: 1,
  121. size: 10,
  122. name: undefined,
  123. aliasName: undefined,
  124. startTime: undefined,
  125. endTime: undefined,
  126. identity: undefined,
  127. proportion: undefined,
  128. id:undefined,
  129. phone:undefined,
  130. card:undefined
  131. },
  132. // 表单参数
  133. form: {
  134. name:'',
  135. aliasName:''
  136. },
  137. // 到账比例
  138. radioList:[
  139. ],
  140. //批量到账比例处理
  141. staffList:[],
  142. // 表单校验
  143. rules: {
  144. id:[
  145. { required: true, message: "充值比例不能为空", trigger: "change"},
  146. ],
  147. }
  148. };
  149. },
  150. created() {
  151. this.getList();
  152. this.getListczgl();
  153. },
  154. methods: {
  155. forceUpdate(){ //重置form
  156. this.form = JSON.parse(JSON.stringify(this.form));
  157. },
  158. /** 查询参数列表 */
  159. getList() {
  160. this.loading = true;
  161. listChannel(this.addDateRange(this.queryParams)).then(response => {
  162. this.adminList = response.data.records;
  163. this.total = response.data.total;
  164. this.loading = false;
  165. }
  166. );
  167. },
  168. /** 获取充值管理的数据用于修改赋值 */
  169. getListczgl() {
  170. allRadio().then(response => {
  171. this.radioList = response.data.map(item=>{
  172. return {
  173. identity:item.identity,
  174. proportion:item.proportion,
  175. id:item.id
  176. }
  177. })
  178. });
  179. },
  180. // 取消按钮
  181. cancel() {
  182. this.open = false;
  183. this.reset();
  184. },
  185. // 表单重置
  186. reset() {
  187. this.form = {
  188. ids: undefined,
  189. name: undefined,
  190. aliasName: undefined,
  191. adminType: "Y",
  192. proportion:undefined,
  193. id:undefined
  194. };
  195. this.staffList = []
  196. this.resetForm("form");
  197. },
  198. // 同步人员信息
  199. synchroPersonnel(){
  200. if(this.queryParams.name){
  201. personJob({"blurry":this.queryParams.name}).then(response =>{
  202. this.getList();
  203. })
  204. localStorage.setItem("timeout","大于10s")
  205. this.msgSuccess('请在定时任务中人员信息中,选择点击更多--调度日志查询同步进度 ', 5000)
  206. this.$router.push({path:'/system/job/jobTaskIndex'})
  207. localStorage.setItem('personnel', 1)
  208. }else{
  209. this.$message.error('同步人员信息不能为空')
  210. }
  211. },
  212. /** 搜索按钮操作 */
  213. handleQuery() {
  214. this.queryParams.current = 1;
  215. this.getList();
  216. },
  217. /** 重置按钮操作 */
  218. resetQuery() {
  219. this.dateRange = [];
  220. this.resetForm("queryForm");
  221. this.handleQuery();
  222. },
  223. /** 充值跳转 */
  224. radio(row){
  225. this.$router.push({path:'userRecharge'})
  226. localStorage.setItem('chongzhi', JSON.stringify({"name":row.name,"proportion":row.proportion,"sid":row.sid,"contacts":row.contacts}))
  227. },
  228. // 多选框选中数据
  229. handleSelectionChange(selection) {
  230. this.ids = selection.map(item => item);
  231. this.single = selection.length != 1;
  232. this.multiple = !selection.length;
  233. },
  234. //批量处理
  235. batchChange(change){
  236. if(this.ids.length>0){
  237. if(change == 0){
  238. this.open = true;
  239. this.title = "修改参数";
  240. }else{
  241. this.loading = true;
  242. this.staffList = this.ids.map(item=>{
  243. return {
  244. staffId:item.sid,
  245. radioId:item.radioId,
  246. delFlag:change
  247. }
  248. })
  249. staff(this.staffList).then(response =>{
  250. this.loading = false;
  251. this.msgSuccess('批量处理完成')
  252. this.getList();
  253. }).catch(err=>{
  254. this.loading = false;
  255. })
  256. }
  257. }else{
  258. this.$message.error('请勾选需要批量处理充值到账比例人员信息')
  259. }
  260. },
  261. /** 提交按钮 */
  262. submitForm() {
  263. this.$refs["queryParams"].validate(valid => {
  264. if (valid) {
  265. if(this.queryParams.id){
  266. this.loading = true;
  267. this.staffList = this.ids.map(item=>{
  268. return {
  269. staffId:item.sid,
  270. radioId:this.queryParams.id,
  271. delFlag:0
  272. }
  273. })
  274. staff(this.staffList).then(response =>{
  275. this.loading = false;
  276. this.open = false;
  277. this.msgSuccess('批量处理完成')
  278. this.getList();
  279. this.reset()
  280. }).catch(err=>{
  281. this.loading = false;
  282. })
  283. }
  284. }
  285. })
  286. },
  287. }
  288. };
  289. </script>
  290. <style lang="scss" >
  291. .el-select-dropdown__item.selected{
  292. font-weight: none !important;
  293. }
  294. </style>