index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="120px">
  4. <el-form-item label="申请人名称" label-width="100px">
  5. <el-input
  6. v-model="queryParams.name"
  7. placeholder="请输入申请人名称"
  8. clearable
  9. style="width: 240px;"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="申请人手机号:" prop="goodsId">
  14. <el-input
  15. v-model="queryParams.mobile"
  16. placeholder="请输入申请人手机号"
  17. clearable
  18. style="width: 240px;"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  24. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  25. </el-form-item>
  26. </el-form>
  27. <el-row :gutter="10" class="mb8">
  28. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  29. </el-row>
  30. <el-table ref="tables" v-loading="loading" :data="dataList" border>
  31. <el-table-column label="序号" align="center" type="index" width="50"></el-table-column>
  32. <el-table-column label="申请人姓名" align="center" prop="name" />
  33. <el-table-column label="申请人手机号" align="center" prop="mobile" />
  34. <el-table-column label="职业" align="center" prop="careerName" />
  35. <el-table-column label="销售渠道" align="center" prop="saleChannel" />
  36. <el-table-column label="申请时间" align="center" prop="createTime" />
  37. <el-table-column label="最近一次备注" align="center" prop="remark" />
  38. <el-table-column label="最近一次更新时间" align="center" prop="updateTime" />
  39. <el-table-column label="操作员" align="center" prop="updateBy" />
  40. <el-table-column label="操作" align="center" fixed="right" width="150" class-name="small-padding fixed-width">
  41. <template slot-scope="scope">
  42. <el-button
  43. size="mini"
  44. type="text"
  45. @click="setRemark(scope.row)"
  46. v-hasPermi="['distribution:distributionapplication:remarks']"
  47. >备注</el-button>
  48. </template>
  49. </el-table-column>
  50. </el-table>
  51. <pagination
  52. v-show="total>0"
  53. :total="total"
  54. :page.sync="queryParams.pageNum"
  55. :limit.sync="queryParams.pageSize"
  56. @pagination="getList"
  57. />
  58. <el-dialog
  59. title="备注"
  60. :visible.sync="visibleStatus"
  61. width="600px"
  62. :destroy-on-close="true"
  63. :close-on-click-modal="false"
  64. >
  65. <el-form v-loading="visibleStatusLoading" :model="ruleForm" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
  66. <el-form-item label-width="0" prop="remark">
  67. <el-input type="textarea" v-model="ruleForm.remark" maxlength="50" show-word-limit :rows="4"></el-input>
  68. </el-form-item>
  69. </el-form>
  70. <div slot="footer" class="dialog-footer">
  71. <el-button :loading="visibleStatusLoading" type="primary" @click="submitForm('ruleForm')">确 定</el-button>
  72. </div>
  73. </el-dialog>
  74. </div>
  75. </template>
  76. <script>
  77. import { pageList,setRemark } from '@/api/distribution/distributionapplication'
  78. export default {
  79. name: "Distributionapplication",
  80. data() {
  81. return {
  82. // 遮罩层
  83. loading: true,
  84. // 选中数组
  85. ids: [],
  86. // 非单个禁用
  87. single: true,
  88. // 非多个禁用
  89. multiple: true,
  90. // 显示搜索条件
  91. showSearch: true,
  92. // 总条数
  93. total: 0,
  94. // 用户表格数据
  95. dataList: null,
  96. // 查询参数
  97. queryParams: {
  98. pageNum: 1,
  99. pageSize: 10,
  100. type: undefined
  101. },
  102. visibleStatus: false,
  103. visibleStatusLoading: false,
  104. ruleForm: {},
  105. rules: {
  106. remark: [
  107. { required: true, message: '请输入备注', trigger: ['blur','change'] },
  108. { min: 0, max: 50, message: '长度在 0 到 50 个字符', trigger: ['blur','change'] }
  109. ]
  110. }
  111. };
  112. },
  113. created() {
  114. this.getList();
  115. },
  116. methods: {
  117. /** 查询列表 */
  118. getList() {
  119. this.loading = true;
  120. pageList(this.queryParams)
  121. .then(response => {
  122. this.dataList = response.data.rows;
  123. this.dataList.forEach(item =>{
  124. item.switchValue = item.status;
  125. })
  126. this.total = response.data.total;
  127. this.loading = false;
  128. }
  129. );
  130. },
  131. // 取消按钮
  132. cancel() {
  133. this.open = false;
  134. },
  135. /** 搜索按钮操作 */
  136. handleQuery() {
  137. this.queryParams.pageNum = 1;
  138. this.getList();
  139. },
  140. /** 重置按钮操作 */
  141. resetQuery() {
  142. this.dateRange = [];
  143. this.$set(this.queryParams, 'name', '');
  144. this.$set(this.queryParams, 'mobile', '');
  145. this.queryParams.pageNum = 1;
  146. this.handleQuery();
  147. },
  148. setRemark(data) {
  149. this.visibleStatus = true
  150. this.resetForm.id = data.id
  151. },
  152. submitForm(formName) {
  153. this.$refs[formName].validate(async (valid) => {
  154. if (valid) {
  155. try {
  156. this.visibleStatusLoading = true
  157. let res = await setRemark({
  158. id: this.resetForm.id,
  159. "remark": this.ruleForm.remark
  160. })
  161. this.visibleStatus = false
  162. this.visibleStatusLoading = false
  163. this.resetForm('ruleForm')
  164. this.queryParams.pageNum = 1;
  165. this.getList()
  166. } catch (error) {
  167. this.visibleStatusLoading = false
  168. }
  169. } else {
  170. this.visibleStatusLoading = false
  171. return false;
  172. }
  173. });
  174. },
  175. resetForm(formName) {
  176. this.$refs[formName].resetFields();
  177. }
  178. }
  179. };
  180. </script>