QwUserSelect.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <template>
  2. <el-drawer size="75%" title="客户选择" :visible.sync="shows" append-to-body destroy-on-close>
  3. <div class="app-container">
  4. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  5. <el-form-item label="认领人" prop="companyUserNickName">
  6. <el-input
  7. v-model="queryParams.companyUserNickName"
  8. placeholder="请输入认领人"
  9. clearable
  10. size="small"
  11. @keyup.enter.native="handleQuery"
  12. />
  13. </el-form-item>
  14. <el-form-item label="客户状态" prop="status">
  15. <el-select v-model="queryParams.status" placeholder="请选择客户状态" clearable size="small">
  16. <el-option
  17. v-for="item in statusOptions"
  18. :key="'status'+item.dictValue"
  19. :label="item.dictLabel"
  20. :value="item.dictValue"
  21. />
  22. </el-select>
  23. </el-form-item>
  24. <el-form-item label="客户类型" prop="customerType">
  25. <el-select multiple v-model="ctsTypeArr" placeholder="请选择客户类型" clearable size="small">
  26. <el-option
  27. v-for="(item, index) in typeOptions"
  28. :key="`${item.dictValue}-${index}`"
  29. :label="item.dictLabel"
  30. :value="item.dictValue"
  31. />
  32. </el-select>
  33. </el-form-item>
  34. <el-form-item label="创建时间" prop="createTime">
  35. <el-date-picker clearable size="small" style="width: 205.4px"
  36. v-model="dateRange"
  37. type="daterange"
  38. value-format="yyyy-MM-dd"
  39. start-placeholder="开始日期" end-placeholder="结束日期">
  40. </el-date-picker>
  41. </el-form-item>
  42. <el-form-item label="领取时间" prop="receiveTimeRange">
  43. <el-date-picker
  44. style="width:205.4px"
  45. clearable size="small"
  46. v-model="receiveTimeRange"
  47. type="daterange"
  48. value-format="yyyy-MM-dd"
  49. start-placeholder="开始日期"
  50. end-placeholder="结束日期">
  51. </el-date-picker>
  52. </el-form-item>
  53. <el-form-item label="客户来源" prop="source">
  54. <el-select multiple v-model="sourceArr" placeholder="请选择客户来源" clearable size="small">
  55. <el-option
  56. v-for="item in sourceOptions"
  57. :key="'source'+item.dictValue"
  58. :label="item.dictLabel"
  59. :value="item.dictValue"
  60. />
  61. </el-select>
  62. </el-form-item>
  63. <el-form-item label="客户标签" prop="tags">
  64. <el-select multiple v-model="tagIds" placeholder="请选择客户标签" clearable size="small">
  65. <el-option
  66. v-for="(item, index) in tagsOptions"
  67. :key="`${item.dictValue}-${index}`"
  68. :label="item.dictLabel"
  69. :value="item.dictLabel"
  70. />
  71. </el-select>
  72. </el-form-item>
  73. <el-form-item>
  74. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  75. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  76. </el-form-item>
  77. </el-form>
  78. <el-table border v-loading="loading" :data="customerList" :row-key="getRowKeys" @selection-change="handleSelectionChange" size="mini" ref="table" height="460">
  79. <el-table-column type="selection" width="55" align="center" :reserve-selection="true" />
  80. <el-table-column label="微信昵称" align="center" prop="wxNickName"/>
  81. <el-table-column label="微信号" align="center" prop="wxNo"/>
  82. <el-table-column label="手机号" align="center" prop="phone"/>
  83. <el-table-column label="员工" align="center" prop="companyUserName"/>
  84. </el-table>
  85. <div slot="footer" class="dialog-footer" style="width: 100%;display: flex;flex-direction: row-reverse;margin-top: 20px;z-index: 9898989;padding-top: 5px">
  86. <el-button type="primary" @click="submitForm" style="margin-bottom: 5px">确 定</el-button>
  87. </div>
  88. </div>
  89. </el-drawer>
  90. </template>
  91. <script>
  92. import { getCompanyList } from "@/api/company/company";
  93. import {getCitys} from "@/api/store/city";
  94. import {companyUserList} from "@/api/company/companyVoiceRobotic";
  95. export default {
  96. name: "CustomerSelect",
  97. data() {
  98. return {
  99. source:{
  100. title:"修改客户来源",
  101. open:false,
  102. },
  103. shows:false,
  104. deptOptions:[],
  105. receiveTimeRange:[],
  106. tagId:null,
  107. deptId:undefined,
  108. companyId:undefined,
  109. tagsOptions:[],
  110. ctsTypeArr:[],
  111. sourceArr:[],
  112. dateRange:[],
  113. cityIds:[],
  114. citys:[],
  115. tags:[],
  116. tagIds:[],
  117. inputVisible: false,
  118. inputValue: '',
  119. statusOptions:[],
  120. typeOptions:[],
  121. sourceOptions:[],
  122. sexOptions:[],
  123. pageSizes: [10, 20, 30, 50,100,500 ],
  124. show:{
  125. title:"客户详情",
  126. open:false,
  127. },
  128. companys:[],
  129. // 遮罩层
  130. loading: true,
  131. // 选中数组
  132. ids: [],
  133. names: [],
  134. userIds: [],
  135. // 非单个禁用
  136. single: true,
  137. // 非多个禁用
  138. multiple: true,
  139. // 显示搜索条件
  140. showSearch: true,
  141. // 总条数
  142. total: 0,
  143. // 客户表格数据
  144. customerList: [],
  145. // 弹出层标题
  146. title: "",
  147. // 是否显示弹出层
  148. open: false,
  149. // 查询参数
  150. queryParams: {
  151. customerCode: null,
  152. customerName: null,
  153. mobile: null,
  154. sex: null,
  155. weixin: null,
  156. userId: null,
  157. createUserId: null,
  158. receiveUserId: null,
  159. customerUserId: null,
  160. address: null,
  161. location: null,
  162. detailAddress: null,
  163. lng: null,
  164. lat: null,
  165. status: null,
  166. isReceive: null,
  167. deptId: null,
  168. isDel: null,
  169. customerType: null,
  170. receiveTime: null,
  171. poolTime: null,
  172. companyId: null,
  173. isLine: null,
  174. source: null,
  175. tags: null
  176. },
  177. // 表单参数
  178. form: {},
  179. // 表单校验
  180. rules: {
  181. // customerName: [
  182. // { required: true, message: "客户名称不能为空", trigger: "blur" }
  183. // ],
  184. mobile: [
  185. { required: true, message: "手机号不能为空", trigger: "blur" }
  186. ],
  187. // sex: [
  188. // { required: true, message: "性别不能为空", trigger: "blur" }
  189. // ],
  190. source: [
  191. { required: true, message: "客户来源不能为空", trigger: "blur" }
  192. ],
  193. }
  194. };
  195. },
  196. created() {
  197. this.getDicts("crm_customer_tag").then((response) => {
  198. this.tagsOptions = response.data;
  199. });
  200. this.getDicts("crm_customer_source").then((response) => {
  201. this.sourceOptions = response.data;
  202. });
  203. this.getDicts("common_sex").then((response) => {
  204. this.sexOptions = response.data;
  205. });
  206. this.getDicts("crm_customer_status").then((response) => {
  207. this.statusOptions = response.data;
  208. });
  209. this.getDicts("crm_customer_type").then((response) => {
  210. this.typeOptions = response.data;
  211. });
  212. getCompanyList().then(response => {
  213. this.companys = response.data;
  214. });
  215. this.getCitys();
  216. },
  217. methods: {
  218. setRows(rows){
  219. this.shows = true;
  220. this.rows = rows;
  221. this.getList();
  222. },
  223. initSelect(){
  224. let row = this.rows;
  225. if(row && row.length > 0){
  226. row.forEach(row => {
  227. this.$refs.table.toggleRowSelection(row, true);
  228. })
  229. }
  230. },
  231. getRowKeys(item){
  232. return item.id;
  233. },
  234. getCitys(){
  235. getCitys().then(res => {
  236. this.loading = false;
  237. this.citys=res.data;
  238. })
  239. },
  240. /** 查询客户列表 */
  241. getList() {
  242. this.loading = true;
  243. if(this.receiveTimeRange!=null&&this.receiveTimeRange.length==2){
  244. this.queryParams.receiveTimeRange=this.receiveTimeRange[0]+"--"+this.receiveTimeRange[1]
  245. }
  246. else{
  247. this.queryParams.receiveTimeRange=null;
  248. }
  249. if(this.ctsTypeArr.length>0){
  250. this.queryParams.customerType=this.ctsTypeArr.toString();
  251. }
  252. else{
  253. this.queryParams.customerType=null
  254. }
  255. if(this.sourceArr.length>0){
  256. this.queryParams.source=this.sourceArr.toString();
  257. }
  258. else{
  259. this.queryParams.source=null
  260. }
  261. if(this.tagIds.length>0){
  262. this.queryParams.tags=this.tagIds.toString();
  263. }
  264. else{
  265. this.queryParams.tags=null
  266. }
  267. companyUserList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  268. this.$refs.table.clearSelection();
  269. this.customerList = response.data;
  270. this.loading = false;
  271. this.initSelect();
  272. });
  273. },
  274. // 取消按钮
  275. cancel() {
  276. this.open = false;
  277. this.reset();
  278. },
  279. /** 搜索按钮操作 */
  280. handleQuery() {
  281. this.getList();
  282. },
  283. /** 重置按钮操作 */
  284. resetQuery() {
  285. this.resetForm("queryForm");
  286. },
  287. // 多选框选中数据
  288. handleSelectionChange(selection) {
  289. this.rows = selection;
  290. this.ids = selection.map(item => item.id)
  291. // this.names = selection.map(item => item.qwUserName)
  292. this.single = selection.length!==1
  293. this.multiple = !selection.length
  294. },
  295. currDeptChange(val){
  296. this.queryParams.deptId=val;
  297. this.getList();
  298. },
  299. submitForm(){
  300. this.$nextTick(() => {
  301. this.$emit("success", {ids: this.ids, names: this.names, rows: this.rows})
  302. this.shows = false;
  303. this.$refs.table.clearSelection();
  304. })
  305. },
  306. }
  307. };
  308. </script>
  309. <style scoped>
  310. .el-tag + .el-tag {
  311. margin-left: 10px;
  312. }
  313. .button-new-tag {
  314. margin-left: 10px;
  315. height: 32px;
  316. line-height: 30px;
  317. padding-top: 0;
  318. padding-bottom: 0;
  319. }
  320. .input-new-tag {
  321. width: 90px;
  322. margin-left: 10px;
  323. vertical-align: bottom;
  324. }
  325. .el-dialog__wrapper{
  326. z-index: 100000;
  327. }
  328. .app-container{padding: 0}
  329. .dialog-footer{
  330. position: absolute;
  331. bottom: 0;
  332. right: 20px;
  333. background: #FFF;
  334. }
  335. </style>