customerAssignList.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  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="companyUserName">
  5. <el-input
  6. v-model="queryParams.companyUserName"
  7. placeholder="请输入"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="操作时间" prop="createTime">
  14. <el-date-picker clearable size="small" style="width: 205.4px"
  15. v-model="dateRange"
  16. type="daterange"
  17. value-format="yyyy-MM-dd"
  18. start-placeholder="开始日期" end-placeholder="结束日期"
  19. >
  20. </el-date-picker>
  21. </el-form-item>
  22. <el-form-item>
  23. <el-button type="cyan" 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-table v-loading="loading" :data="customerAssignList" @selection-change="handleSelectionChange">
  28. <el-table-column type="selection" width="55" align="center" />
  29. <el-table-column label="ID" align="center" prop="assignId" />
  30. <el-table-column label="公司" align="center" prop="companyName" />
  31. <el-table-column label="分配数量" align="center" prop="customerIds" width="120" >
  32. <template slot-scope="scope">
  33. <el-tag >{{scope.row.customerIds.split(',').length}}</el-tag>
  34. </template>
  35. </el-table-column>
  36. <el-table-column label="操作时间" align="center" prop="createTime" />
  37. <el-table-column label="操作人(平台)" align="center" prop="sysUserName" />
  38. <el-table-column label="操作人(公司)" align="center" prop="companyUserName" />
  39. <el-table-column label="备注" align="center" prop="remark" />
  40. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  41. <template slot-scope="scope">
  42. <el-button
  43. size="mini"
  44. type="text"
  45. @click="handleShow(scope.row)"
  46. >查看</el-button>
  47. <el-button
  48. v-if="scope.row.status==0"
  49. size="mini"
  50. type="text"
  51. icon="el-icon-delete"
  52. @click="handleCancel(scope.row)"
  53. v-hasPermi="['crm:customerAssign:cancel']"
  54. >撤销</el-button>
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. <pagination
  59. v-show="total>0"
  60. :total="total"
  61. :page.sync="queryParams.pageNum"
  62. :limit.sync="queryParams.pageSize"
  63. @pagination="getList"
  64. />
  65. <el-dialog :title="customer.title" :visible.sync="customer.open" width="1000px" append-to-body>
  66. <el-table border :data="customers" >
  67. <el-table-column label="客户名称" align="center" prop="customerName" />
  68. <el-table-column label="客户手机号" align="center" prop="mobile" />
  69. </el-table>
  70. </el-dialog>
  71. </div>
  72. </template>
  73. <script>
  74. import { listCustomerAssign, cancelCustomerAssign } from "@/api/crm/customerAssign";
  75. import { getCustomerListByIds } from "@/api/crm/customer";
  76. export default {
  77. name: "CustomerAssign",
  78. data() {
  79. return {
  80. customer:{
  81. open:false,
  82. title:"查看客户信息"
  83. },
  84. customers:[],
  85. dateRange:[],
  86. // 遮罩层
  87. loading: true,
  88. // 选中数组
  89. ids: [],
  90. // 非单个禁用
  91. single: true,
  92. // 非多个禁用
  93. multiple: true,
  94. // 显示搜索条件
  95. showSearch: true,
  96. // 总条数
  97. total: 0,
  98. // 客户分配记录表格数据
  99. customerAssignList: [],
  100. // 弹出层标题
  101. title: "",
  102. // 是否显示弹出层
  103. open: false,
  104. // 查询参数
  105. queryParams: {
  106. pageNum: 1,
  107. pageSize: 10,
  108. companyId: null,
  109. companyUserId: null,
  110. customerIds: null,
  111. sysUserId: null,
  112. assignType: null,
  113. },
  114. };
  115. },
  116. created() {
  117. },
  118. methods: {
  119. handleShow(item){
  120. this.getCustomerListByIds(item.customerIds)
  121. },
  122. getData(){
  123. this.getList()
  124. },
  125. getCustomerListByIds(ids) {
  126. var data={customerIds:ids};
  127. getCustomerListByIds(data).then(response => {
  128. this.customers = response.data;
  129. this.customer.open=true;
  130. });
  131. },
  132. /** 查询客户分配记录列表 */
  133. getList() {
  134. this.loading = true;
  135. listCustomerAssign(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  136. this.customerAssignList = response.rows;
  137. this.total = response.total;
  138. this.loading = false;
  139. });
  140. },
  141. /** 搜索按钮操作 */
  142. handleQuery() {
  143. this.queryParams.pageNum = 1;
  144. this.getList();
  145. },
  146. /** 重置按钮操作 */
  147. resetQuery() {
  148. this.dateRange = [];
  149. this.resetForm("queryForm");
  150. this.handleQuery();
  151. },
  152. // 多选框选中数据
  153. handleSelectionChange(selection) {
  154. this.ids = selection.map(item => item.assignId)
  155. this.single = selection.length!==1
  156. this.multiple = !selection.length
  157. },
  158. handleCancel(row) {
  159. this.$confirm('是否确认撤销客户分配记录编号为"' + row.assignId + '"的数据项?', "警告", {
  160. confirmButtonText: "确定",
  161. cancelButtonText: "取消",
  162. type: "warning"
  163. }).then(function() {
  164. var data={assignId: row.assignId}
  165. return cancelCustomerAssign(data);
  166. }).then(() => {
  167. this.getList();
  168. this.msgSuccess("操作成功");
  169. }).catch(function() {});
  170. },
  171. }
  172. };
  173. </script>