line.vue 25 KB

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