customerAssignList.vue 6.0 KB

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