line.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803
  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="customerCode">
  5. <el-input
  6. v-model="queryParams.customerCode"
  7. placeholder="请输入客户编号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="客户名称" prop="customerName">
  14. <el-input
  15. v-model="queryParams.customerName"
  16. placeholder="请输入客户名称"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="手机" prop="mobile">
  23. <el-input
  24. v-model="queryParams.mobile"
  25. placeholder="请输入手机"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="客户来源" prop="source">
  32. <el-select v-model="queryParams.source" placeholder="请选择客户来源" clearable size="small">
  33. <el-option
  34. v-for="item in sourceOptions"
  35. :key="item.dictValue"
  36. :label="item.dictLabel"
  37. :value="item.dictValue"
  38. />
  39. </el-select>
  40. </el-form-item>
  41. <el-form-item label="创建时间" prop="createTime">
  42. <el-date-picker clearable size="small" style="width: 205.4px"
  43. v-model="dateRange"
  44. type="daterange"
  45. value-format="yyyy-MM-dd"
  46. start-placeholder="开始日期" end-placeholder="结束日期" @change="handleScheduleTimeChange"
  47. >
  48. </el-date-picker>
  49. </el-form-item>
  50. <el-form-item>
  51. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  52. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  53. </el-form-item>
  54. </el-form>
  55. <el-row :gutter="10" class="mb8">
  56. <el-col :span="1.5">
  57. <el-button
  58. type="primary"
  59. icon="el-icon-plus"
  60. size="mini"
  61. @click="handleAdd"
  62. v-hasPermi="['crm:customer:addLine']"
  63. >新增</el-button>
  64. </el-col>
  65. <el-col :span="1.5">
  66. <el-button
  67. type="success"
  68. icon="el-icon-edit"
  69. size="mini"
  70. :disabled="single"
  71. @click="handleUpdate"
  72. v-hasPermi="['crm:customer:editLine']"
  73. >修改</el-button>
  74. </el-col>
  75. <el-col :span="1.5">
  76. <el-button
  77. type="danger"
  78. icon="el-icon-delete"
  79. size="mini"
  80. :disabled="multiple"
  81. @click="handleDelete"
  82. v-hasPermi="['crm:customer:removeLine']"
  83. >删除</el-button>
  84. </el-col>
  85. <el-col :span="1.5">
  86. <el-button
  87. v-if="queryParams.status=='0'"
  88. type="success"
  89. icon="el-icon-edit"
  90. size="mini"
  91. :disabled="multiple"
  92. @click="handleAssign"
  93. v-hasPermi="['crm:customer:assign']"
  94. >分配线索客户</el-button>
  95. </el-col>
  96. <el-col :span="1.5">
  97. <el-button
  98. type="success"
  99. size="mini"
  100. @click="handleAssignList"
  101. v-hasPermi="['crm:customerAssign:list']"
  102. >分配历史记录</el-button>
  103. </el-col>
  104. <el-col :span="1.5">
  105. <el-button
  106. type="warning"
  107. icon="el-icon-upload2"
  108. size="mini"
  109. @click="handleImport"
  110. v-hasPermi="['crm:customer:importLine']"
  111. >导入线索客户</el-button>
  112. </el-col>
  113. <el-col :span="1.5">
  114. <el-button
  115. type="warning"
  116. icon="el-icon-download"
  117. size="mini"
  118. @click="handleExport"
  119. v-hasPermi="['crm:customer:exportLine']"
  120. >导出</el-button>
  121. </el-col>
  122. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  123. </el-row>
  124. <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
  125. <el-tab-pane label="待分配" name="0"></el-tab-pane>
  126. <el-tab-pane label="已分配" name="1"></el-tab-pane>
  127. </el-tabs>
  128. <el-table height="500" border v-loading="loading" :data="customerList" @selection-change="handleSelectionChange">
  129. <el-table-column type="selection" width="55" align="center" />
  130. <el-table-column label="ID" align="center" prop="customerId" />
  131. <el-table-column label="所属公司" align="center" prop="companyName" />
  132. <el-table-column label="客户编号" width="120" align="center" prop="customerCode" />
  133. <el-table-column label="客户名称" align="center" prop="customerName" />
  134. <el-table-column label="手机" align="center" prop="mobile" />
  135. <el-table-column label="备用手机" align="center" prop="backupMobile" :show-overflow-tooltip="true" />
  136. <el-table-column label="性别" align="center" prop="sex">
  137. <template slot-scope="scope">
  138. <el-tag prop="status" v-for="(item, index) in sexOptions" v-if="scope.row.sex==item.dictValue">{{item.dictLabel}}</el-tag>
  139. </template>
  140. </el-table-column>
  141. <el-table-column label="微信号" align="center" prop="weixin" />
  142. <el-table-column label="关联用户ID" align="center" prop="userId" />
  143. <el-table-column label="所在地" align="center" prop="address" />
  144. <el-table-column width="105" label="创建时间" align="center" prop="createTime" />
  145. <el-table-column label="客户来源" align="center" prop="source">
  146. <template slot-scope="scope">
  147. <el-tag prop="source" v-for="(item, index) in sourceOptions" v-if="scope.row.crmSource && (','+scope.row.crmSource+',').indexOf(','+item.dictValue+',') !== -1">{{item.dictLabel}}</el-tag>
  148. </template>
  149. </el-table-column>
  150. <el-table-column label="流量来源" align="center" prop="trafficSource" />
  151. <el-table-column label="备注" align="center" prop="remark" />
  152. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  153. <template slot-scope="scope">
  154. <el-button
  155. size="mini"
  156. type="text"
  157. icon="el-icon-edit"
  158. @click="handleUpdate(scope.row)"
  159. v-hasPermi="['crm:customer:editLine']"
  160. >修改</el-button>
  161. <!-- <el-button
  162. size="mini"
  163. type="text"
  164. icon="el-icon-edit"
  165. @click="handleAssign(scope.row)"
  166. v-hasPermi="['crm:customer:assign']"
  167. >分配</el-button> -->
  168. <el-button
  169. size="mini"
  170. type="text"
  171. icon="el-icon-delete"
  172. @click="handleDelete(scope.row)"
  173. v-hasPermi="['crm:customer:removeLine']"
  174. >删除</el-button>
  175. </template>
  176. </el-table-column>
  177. </el-table>
  178. <pagination
  179. v-show="total>0"
  180. :total="total"
  181. :page-sizes="pageSizes"
  182. :page.sync="queryParams.pageNum"
  183. :limit.sync="queryParams.pageSize"
  184. @pagination="getList"
  185. />
  186. <!-- 添加或修改客户对话框 -->
  187. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  188. <el-form ref="form" :model="form" :rules="rules" label-width="120px">
  189. <el-form-item label="客户名称" prop="customerName">
  190. <el-input v-model="form.customerName" placeholder="请输入客户名称" />
  191. </el-form-item>
  192. <el-form-item label="手机" prop="mobile">
  193. <el-input maxlength="11" v-model="form.mobile" placeholder="请输入手机" />
  194. </el-form-item>
  195. <el-form-item label="备用手机" prop="backupMobile">
  196. <el-input v-model="form.backupMobile" placeholder="多个用英文;分隔" />
  197. </el-form-item>
  198. <el-form-item label="性别" prop="sex">
  199. <el-radio-group v-model="form.sex">
  200. <el-radio :label="item.dictValue" v-for="item in sexOptions" >{{item.dictLabel}}</el-radio>
  201. </el-radio-group>
  202. </el-form-item>
  203. <el-form-item label="微信号" prop="weixin">
  204. <el-input v-model="form.weixin" placeholder="请输入微信号" />
  205. </el-form-item>
  206. <el-form-item label="关联用户ID" prop="userId">
  207. <el-input v-model="form.userId" placeholder="请输入关联用户ID" />
  208. </el-form-item>
  209. <el-form-item label="所在地区" prop="address">
  210. <el-cascader
  211. ref="citySelect"
  212. v-model="cityIds"
  213. :options="citys"
  214. @change="handleCityChange"></el-cascader>
  215. </el-form-item>
  216. <el-form-item label="详细地址" prop="detailAddress">
  217. <el-input v-model="form.detailAddress" placeholder="请输入详细地址" />
  218. </el-form-item>
  219. <el-form-item label="客户来源" prop="sourceArr">
  220. <el-select multiple v-model="form.sourceArr" placeholder="请选择客户来源" clearable size="small">
  221. <el-option
  222. v-for="item in sourceOptions"
  223. :key="item.dictValue"
  224. :label="item.dictLabel"
  225. :value="item.dictValue"
  226. />
  227. </el-select>
  228. </el-form-item>
  229. <el-form-item label="标签" prop="tags">
  230. <el-tag
  231. :key="tag"
  232. v-for="tag in tags"
  233. closable
  234. :disable-transitions="false"
  235. @close="handleClose(tag)">
  236. {{tag}}
  237. </el-tag>
  238. <el-input
  239. class="input-new-tag"
  240. v-if="inputVisible"
  241. v-model="inputValue"
  242. ref="saveTagInput"
  243. size="small"
  244. @keyup.enter.native="handleInputConfirm"
  245. @blur="handleInputConfirm"
  246. >
  247. </el-input>
  248. <el-button v-else class="button-new-tag" size="small" @click="showInput">添加标签+</el-button>
  249. <el-select @change="tagsChange" v-model="tagId" placeholder="选择客户来源" style="width:140px;margin-left: 5px;" clearable size="small">
  250. <el-option
  251. v-for="item in tagsOptions"
  252. :key="item.dictValue"
  253. :label="item.dictLabel"
  254. :value="item.dictValue"
  255. />
  256. </el-select>
  257. </el-form-item>
  258. <el-form-item label="进线日期" prop="registerDate">
  259. <el-date-picker
  260. value-format="yyyy-MM-dd"
  261. v-model="form.registerDate"
  262. type="date"
  263. placeholder="请选择进线日期">
  264. </el-date-picker>
  265. </el-form-item>
  266. <el-form-item label="进线链接" prop="registerLinkUrl">
  267. <el-input v-model="form.registerLinkUrl" placeholder="请输入进线链接" />
  268. </el-form-item>
  269. <el-form-item label="进线客户详情" prop="registerDesc">
  270. <el-input v-model="form.registerDesc" placeholder="请输入进线客户详情" />
  271. </el-form-item>
  272. <el-form-item label="进线填写时间" prop="registerSubmitTime">
  273. <el-date-picker
  274. value-format="yyyy-MM-dd HH:mm:ss"
  275. v-model="form.registerSubmitTime"
  276. type="datetime"
  277. placeholder="请选择进线填写时间">
  278. </el-date-picker>
  279. </el-form-item>
  280. <el-form-item label="备注" prop="remark">
  281. <el-input type="textarea" :rows="2" v-model="form.remark" placeholder="请输入备注" />
  282. </el-form-item>
  283. </el-form>
  284. <div slot="footer" class="dialog-footer">
  285. <el-button type="primary" @click="submitForm">确 定</el-button>
  286. <el-button @click="cancel">取 消</el-button>
  287. </div>
  288. </el-dialog>
  289. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  290. <el-upload ref="upload" :limit="1" accept=".xlsx, .xls" :headers="upload.headers" :action="upload.url + '?updateSupport=' + upload.updateSupport" :disabled="upload.isUploading" :on-progress="handleFileUploadProgress" :on-success="handleFileSuccess" :auto-upload="false" drag>
  291. <i class="el-icon-upload"></i>
  292. <div class="el-upload__text">
  293. 将文件拖到此处,或
  294. <em>点击上传</em>
  295. </div>
  296. <div class="el-upload__tip" slot="tip">
  297. <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
  298. </div>
  299. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  300. </el-upload>
  301. <div slot="footer" class="dialog-footer">
  302. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  303. <el-button @click="upload.open = false">取 消</el-button>
  304. </div>
  305. </el-dialog>
  306. <el-dialog title="导入结果" :close-on-press-escape="false" :close-on-click-modal="false" :visible.sync="importMsgOpen" width="500px" append-to-body>
  307. <div class="import-msg" v-html="importMsg">
  308. </div>
  309. </el-dialog>
  310. <el-dialog :title="assign.title" :visible.sync="assign.open" @close="closeAssignPop" width="900px" append-to-body>
  311. <assign-company ref="assignCompany" @close="closeAssign" />
  312. </el-dialog>
  313. <el-dialog :title="assignList.title" :visible.sync="assignList.open" width="1000px" append-to-body>
  314. <customer-assign-list ref="assignList" @close="closeAssignList"></customer-assign-list>
  315. </el-dialog>
  316. </div>
  317. </template>
  318. <script>
  319. import { assignCustomer,importLineTemplate,listLineCustomer, getLineCustomer, delLineCustomer, addLineCustomer, updateLineCustomer, exportLineCustomer } from "@/api/crm/customer";
  320. import {getCitys} from "@/api/store/city";
  321. import { getToken } from "@/utils/auth";
  322. import { isAdmin } from "@/api/system/user";
  323. import customerAssignList from '../components/customerAssignList.vue';
  324. import assignCompany from '../components/assignCompany.vue';
  325. export default {
  326. name: "Customer",
  327. components: { customerAssignList,assignCompany },
  328. data() {
  329. return {
  330. assignList:{
  331. title:"分配历史记录",
  332. open:false,
  333. },
  334. importMsgOpen:false,
  335. importMsg:"",
  336. tagId:null,
  337. activeName:"0",
  338. tagsOptions:[],
  339. companys:[],
  340. noAssignCount:0,
  341. assignCount:0,
  342. assign:{
  343. title:"分配客户",
  344. open:false,
  345. },
  346. companySelect:{
  347. title:"选择公司",
  348. open:false,
  349. },
  350. assignForm: {
  351. companyId:null,
  352. },
  353. // 表单校验
  354. assignRules: {
  355. companyId: [
  356. { required: true, message: "公司不能为空", trigger: "blur" }
  357. ],
  358. },
  359. // 用户导入参数
  360. upload: {
  361. // 是否显示弹出层(用户导入)
  362. open: false,
  363. // 弹出层标题(用户导入)
  364. title: "",
  365. // 是否禁用上传
  366. isUploading: false,
  367. // 设置上传的请求头部
  368. headers: { Authorization: "Bearer " + getToken() },
  369. // 上传的地址
  370. url: process.env.VUE_APP_BASE_API + "/crm/customer/importLineData",
  371. },
  372. pageSizes: [10, 20, 30, 50,100,500 ],
  373. cityIds:[],
  374. citys:[],
  375. tags:[],
  376. inputVisible: false,
  377. inputValue: '',
  378. sourceOptions:[],
  379. sexOptions:[],
  380. // 遮罩层
  381. loading: true,
  382. // 选中数组
  383. ids: [],
  384. // 非单个禁用
  385. single: true,
  386. // 非多个禁用
  387. multiple: true,
  388. // 显示搜索条件
  389. showSearch: true,
  390. // 总条数
  391. total: 0,
  392. // 客户表格数据
  393. customerList: [],
  394. dateRange:[],
  395. // 弹出层标题
  396. title: "",
  397. // 是否显示弹出层
  398. open: false,
  399. isAdmin:false,
  400. // 查询参数
  401. queryParams: {
  402. pageNum: 1,
  403. pageSize: 10,
  404. customerCode: null,
  405. customerName: null,
  406. mobile: null,
  407. sex: null,
  408. weixin: null,
  409. userId: null,
  410. createUserId: null,
  411. receiveUserId: null,
  412. customerUserId: null,
  413. address: null,
  414. location: null,
  415. detailAddress: null,
  416. lng: null,
  417. lat: null,
  418. status: "0",
  419. isReceive: null,
  420. deptId: null,
  421. isDel: null,
  422. customerType: null,
  423. receiveTime: null,
  424. poolTime: null,
  425. companyId: null,
  426. isLine: null,
  427. source: null,
  428. tags: null,
  429. beginTime: null,
  430. endTime: null,
  431. },
  432. // 表单参数
  433. form: {
  434. province:null,
  435. city:null,
  436. district:null,
  437. },
  438. // 表单校验
  439. rules: {
  440. mobile: [
  441. { required: true, message: "手机号不能为空", trigger: "blur" }
  442. ],
  443. sourceArr: [
  444. { required: true, message: "客户来源不能为空", trigger: "blur" }
  445. ],
  446. }
  447. };
  448. },
  449. created() {
  450. this.getDicts("crm_customer_source").then((response) => {
  451. this.sourceOptions = response.data;
  452. });
  453. this.getDicts("sys_sex").then((response) => {
  454. this.sexOptions = response.data;
  455. });
  456. this.getDicts("crm_customer_tag").then((response) => {
  457. this.tagsOptions = response.data;
  458. });
  459. isAdmin().then(res => {
  460. this.isAdmin=res.data;
  461. this.isAdmin=false;
  462. });
  463. this.getCitys();
  464. this.getList();
  465. },
  466. methods: {
  467. handleScheduleTimeChange(val) {
  468. if (val) {
  469. this.queryParams.beginTime = val[0];
  470. this.queryParams.endTime = val[1];
  471. } else {
  472. this.queryParams.beginTime = null;
  473. this.queryParams.endTime = null;
  474. }
  475. },
  476. handleAssignList(){
  477. this.assignList.open=true;
  478. var that=this;
  479. setTimeout(() => {
  480. that.$refs.assignList.getData();
  481. }, 200);
  482. },
  483. closeAssign(){
  484. this.assign.open=false;
  485. this.getList();
  486. },
  487. closeAssignPop(){
  488. this.$refs.assignCompany.closeAction();
  489. },
  490. closeAssignList(){
  491. this.assignList.open=false;
  492. this.getList();
  493. },
  494. tagsChange(e){
  495. var item=this.tagsOptions.find(val => val.dictValue === e);
  496. console.log(item);
  497. this.tags.push(item.dictLabel);
  498. this.form.tags=this.tags.toString();
  499. },
  500. handleClick(tab, event) {
  501. this.activeName=tab.name;
  502. this.queryParams.status=tab.name
  503. this.getList();
  504. },
  505. handleCityChange(value) {
  506. var nodes=this.$refs.citySelect.getCheckedNodes();
  507. console.log(value);
  508. this.form.address=nodes[0].pathLabels[0]+"-"+nodes[0].pathLabels[1]+"-"+nodes[0].pathLabels[2];
  509. this.form.cityIds=value.toString();
  510. },
  511. getCitys(){
  512. getCitys().then(res => {
  513. this.loading = false;
  514. this.citys=res.data;
  515. })
  516. },
  517. handleClose(tag) {
  518. this.tags.splice(this.tags.indexOf(tag), 1);
  519. this.form.tags=this.tags.toString();
  520. },
  521. showInput() {
  522. this.inputVisible = true;
  523. this.$nextTick(_ => {
  524. this.$refs.saveTagInput.$refs.input.focus();
  525. });
  526. },
  527. handleInputConfirm() {
  528. let inputValue = this.inputValue;
  529. if (inputValue) {
  530. this.tags.push(inputValue);
  531. }
  532. this.inputVisible = false;
  533. this.inputValue = '';
  534. this.form.tags=this.tags.toString();
  535. },
  536. /** 查询客户列表 */
  537. getList() {
  538. this.loading = true;
  539. listLineCustomer(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  540. this.customerList = response.rows;
  541. this.total = response.total;
  542. this.loading = false;
  543. });
  544. },
  545. // 取消按钮
  546. cancel() {
  547. this.open = false;
  548. this.reset();
  549. },
  550. // 表单重置
  551. reset() {
  552. this.form = {
  553. customerId: null,
  554. customerCode: null,
  555. customerName: null,
  556. mobile: null,
  557. sex: null,
  558. weixin: null,
  559. remark: null,
  560. userId: null,
  561. createUserId: null,
  562. receiveUserId: null,
  563. customerUserId: null,
  564. address: null,
  565. location: null,
  566. detailAddress: null,
  567. lng: null,
  568. lat: null,
  569. createTime: null,
  570. updateTime: null,
  571. status: 0,
  572. isReceive: null,
  573. deptId: null,
  574. isDel: null,
  575. customerType: null,
  576. receiveTime: null,
  577. poolTime: null,
  578. companyId: null,
  579. isLine: null,
  580. source: null,
  581. sourceArr: [],
  582. tags: null
  583. };
  584. this.tags=[];
  585. this.cityIds=[];
  586. this.resetForm("form");
  587. },
  588. /** 搜索按钮操作 */
  589. handleQuery() {
  590. this.queryParams.pageNum = 1;
  591. this.getList();
  592. },
  593. /** 重置按钮操作 */
  594. resetQuery() {
  595. this.queryParams.beginTime = null;
  596. this.queryParams.endTime = null;
  597. this.dateRange = null;
  598. this.resetForm("queryForm");
  599. this.handleQuery();
  600. },
  601. // 多选框选中数据
  602. handleSelectionChange(selection) {
  603. this.ids = selection.map(item => item.customerId)
  604. this.single = selection.length!==1
  605. this.multiple = !selection.length
  606. },
  607. handleAssign(){
  608. //if(this.isAdmin){
  609. var that=this
  610. this.assign.open = true;
  611. this.assign.title = "分配线索客户";
  612. setTimeout(() => {
  613. that.$refs.assignCompany.init(this.ids);
  614. }, 200);
  615. // }else{
  616. // this.msgError("无权限操作!");
  617. // }
  618. // //获取所有CUSTOMER列表
  619. // var cutsomers=[];
  620. // this.customerList.forEach(function(value,index,array){
  621. // that.ids.forEach(function(id,index,array){
  622. // if(id==value.customerId){
  623. // var data={customerId:value.customerId,customerName:value.customerName}
  624. // cutsomers.push(data)
  625. // }
  626. // })
  627. // });
  628. // this.assignForm.customers=cutsomers;
  629. // this.assignCount=this.assignForm.customers.length;
  630. },
  631. submitAssignForm() {
  632. if(this.assignForm.customers.length==0){
  633. this.msgError("请选择客户");
  634. return;
  635. }
  636. this.$refs["assignForm"].validate(valid => {
  637. if (valid) {
  638. var ids=[];
  639. this.assignForm.customers.forEach(function(value,index,array){
  640. ids.push(value.customerId)
  641. });
  642. this.assignForm.customerIds=ids;
  643. assignCustomer(this.assignForm).then(response => {
  644. if (response.code === 200) {
  645. this.msgSuccess("分配成功");
  646. this.assign.open = false;
  647. this.getList();
  648. }
  649. });
  650. }
  651. });
  652. },
  653. /** 新增按钮操作 */
  654. handleAdd() {
  655. this.reset();
  656. this.open = true;
  657. this.title = "添加线索客户";
  658. },
  659. /** 修改按钮操作 */
  660. handleUpdate(row) {
  661. this.reset();
  662. var that=this;
  663. const customerId = row.customerId || this.ids
  664. getLineCustomer(customerId).then(response => {
  665. this.form = response.data;
  666. this.form.sex = response.data.sex.toString();
  667. if(response.data.crmSource!=null){
  668. this.$set(this.form, 'sourceArr', response.data.crmSource.split(","));
  669. } else {
  670. this.$set(this.form, 'sourceArr', []);
  671. }
  672. if(this.form.tags!=null){
  673. this.tags = this.form.tags.split(",")
  674. }
  675. if(this.form.cityIds!=null){
  676. var ids=this.form.cityIds.split(",");
  677. this.cityIds=[];
  678. ids.forEach(element => {
  679. var id=parseInt(element);
  680. that.cityIds.push(id)
  681. });
  682. }
  683. this.open = true;
  684. this.title = "修改线索客户";
  685. });
  686. },
  687. /** 提交按钮 */
  688. submitForm() {
  689. this.$refs["form"].validate(valid => {
  690. if (valid) {
  691. if(this.form.sourceArr && this.form.sourceArr.length>0){
  692. this.form.crmSource=this.form.sourceArr.join(",");
  693. }
  694. if (this.form.customerId != null) {
  695. updateLineCustomer(this.form).then(response => {
  696. if (response.code === 200) {
  697. this.msgSuccess("修改成功");
  698. this.open = false;
  699. this.getList();
  700. }
  701. });
  702. } else {
  703. addLineCustomer(this.form).then(response => {
  704. if (response.code === 200) {
  705. this.msgSuccess("新增成功");
  706. this.open = false;
  707. this.getList();
  708. }
  709. });
  710. }
  711. }
  712. });
  713. },
  714. /** 删除按钮操作 */
  715. handleDelete(row) {
  716. const customerIds = row.customerId || this.ids;
  717. this.$confirm('是否确认删除客户编号为"' + customerIds + '"的数据项?', "警告", {
  718. confirmButtonText: "确定",
  719. cancelButtonText: "取消",
  720. type: "warning"
  721. }).then(function() {
  722. return delLineCustomer(customerIds);
  723. }).then(() => {
  724. this.getList();
  725. this.msgSuccess("删除成功");
  726. }).catch(function() {});
  727. },
  728. /** 导出按钮操作 */
  729. handleExport() {
  730. const queryParams = this.queryParams;
  731. this.$confirm('是否确认导出所有客户数据项?', "警告", {
  732. confirmButtonText: "确定",
  733. cancelButtonText: "取消",
  734. type: "warning"
  735. }).then(function() {
  736. return exportLineCustomer(queryParams);
  737. }).then(response => {
  738. this.download(response.msg);
  739. }).catch(function() {});
  740. },
  741. /** 导入按钮操作 */
  742. handleImport() {
  743. this.upload.title = "线索客户导入";
  744. this.upload.open = true;
  745. },
  746. /** 下载模板操作 */
  747. importTemplate() {
  748. importLineTemplate().then((response) => {
  749. this.download(response.msg);
  750. });
  751. },
  752. // 文件上传中处理
  753. handleFileUploadProgress(event, file, fileList) {
  754. this.upload.isUploading = true;
  755. },
  756. // 文件上传成功处理
  757. handleFileSuccess(response, file, fileList) {
  758. this.upload.open = false;
  759. this.upload.isUploading = false;
  760. this.$refs.upload.clearFiles();
  761. this.importMsgOpen=true;
  762. this.importMsg=response.msg
  763. this.getList();
  764. },
  765. // 提交上传文件
  766. submitFileForm() {
  767. this.$refs.upload.submit();
  768. }
  769. }
  770. };
  771. </script>
  772. <style>
  773. .el-tag + .el-tag {
  774. margin-left: 10px;
  775. }
  776. .button-new-tag {
  777. margin-left: 10px;
  778. height: 32px;
  779. line-height: 30px;
  780. padding-top: 0;
  781. padding-bottom: 0;
  782. }
  783. .input-new-tag {
  784. width: 90px;
  785. margin-left: 10px;
  786. vertical-align: bottom;
  787. }
  788. .el-dialog__wrapper{
  789. z-index: 100000;
  790. }
  791. </style>