index.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  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 v-model="queryParams.companyId" placeholder="请选择公司名" clearable size="small">
  6. <el-option
  7. v-for="item in companys"
  8. :key="'companyId'+item.companyId"
  9. :label="item.companyName"
  10. :value="item.companyId"
  11. />
  12. </el-select>
  13. </el-form-item>
  14. <el-form-item label="客户编码" prop="customerCode">
  15. <el-input
  16. v-model="queryParams.customerCode"
  17. placeholder="请输入客户编码"
  18. clearable
  19. size="small"
  20. @keyup.enter.native="handleQuery" />
  21. </el-form-item>
  22. <el-form-item label="客户名称" prop="customerName">
  23. <el-input
  24. v-model="queryParams.customerName"
  25. placeholder="请输入客户名称"
  26. clearable
  27. size="small"
  28. @keyup.enter.native="handleQuery"
  29. />
  30. </el-form-item>
  31. <el-form-item label="手机" prop="mobile">
  32. <el-input
  33. v-model="queryParams.mobile"
  34. placeholder="请输入手机"
  35. clearable
  36. size="small"
  37. @keyup.enter.native="handleQuery"/>
  38. </el-form-item>
  39. <el-form-item label="客户状态" prop="status">
  40. <el-select v-model="queryParams.status" placeholder="请选择客户状态" clearable size="small">
  41. <el-option
  42. v-for="item in statusOptions"
  43. :key="'status'+item.dictValue"
  44. :label="item.dictLabel"
  45. :value="item.dictValue"
  46. />
  47. </el-select>
  48. </el-form-item>
  49. <el-form-item label="客户类型" prop="customerType">
  50. <el-select multiple v-model="ctsTypeArr" placeholder="请选择客户类型" clearable size="small">
  51. <el-option
  52. v-for="item in typeOptions"
  53. :key="'type'+item.dictValue"
  54. :label="item.dictLabel"
  55. :value="item.dictValue"
  56. />
  57. </el-select>
  58. </el-form-item>
  59. <el-form-item label="创建时间" prop="createTime">
  60. <el-date-picker clearable size="small" style="width: 205.4px"
  61. v-model="dateRange"
  62. type="daterange"
  63. value-format="yyyy-MM-dd"
  64. start-placeholder="开始日期" end-placeholder="结束日期">
  65. </el-date-picker>
  66. </el-form-item>
  67. <el-form-item label="客户来源" prop="source">
  68. <el-select multiple v-model="sourceArr" placeholder="请选择客户来源" clearable size="small">
  69. <el-option
  70. v-for="item in sourceOptions"
  71. :key="'source'+item.dictValue"
  72. :label="item.dictLabel"
  73. :value="item.dictValue"
  74. />
  75. </el-select>
  76. </el-form-item>
  77. <el-form-item label="客户标签" prop="tags">
  78. <el-select multiple v-model="tagIds" placeholder="请选择客户标签" clearable size="small">
  79. <el-option
  80. v-for="item in tagsOptions"
  81. :key="'tags'+item.dictValue"
  82. :label="item.dictLabel"
  83. :value="item.dictValue"
  84. />
  85. </el-select>
  86. </el-form-item>
  87. <el-form-item label="是否下单" prop="isBuy">
  88. <el-select style="width:220px" filterable v-model="queryParams.isBuy" placeholder="请选择是否下单" clearable size="small">
  89. <el-option key="1" label="已下单" value="1" />
  90. <el-option key="0" label="未下单" value="0" />
  91. </el-select>
  92. </el-form-item>
  93. <el-form-item>
  94. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  95. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  96. </el-form-item>
  97. </el-form>
  98. <el-row :gutter="10" class="mb8">
  99. <el-col :span="1.5">
  100. <el-button
  101. type="success"
  102. icon="el-icon-edit"
  103. size="mini"
  104. :disabled="multiple"
  105. @click="handleEditSource"
  106. v-hasPermi="['crm:customer:editSource']"
  107. >修改客户来源</el-button>
  108. </el-col>
  109. <el-col :span="1.5">
  110. <el-button
  111. type="success"
  112. icon="el-icon-edit"
  113. size="mini"
  114. :disabled="single"
  115. @click="handleUpdate"
  116. v-hasPermi="['crm:customer:edit']"
  117. >修改</el-button>
  118. </el-col>
  119. <el-col :span="1.5">
  120. <el-button
  121. type="danger"
  122. icon="el-icon-delete"
  123. size="mini"
  124. :disabled="multiple"
  125. @click="handleDelete"
  126. v-hasPermi="['crm:customer:remove']"
  127. >删除</el-button>
  128. </el-col>
  129. <el-col :span="1.5">
  130. <el-button
  131. type="warning"
  132. icon="el-icon-download"
  133. size="mini"
  134. @click="handleExport"
  135. v-hasPermi="['crm:customer:export']"
  136. >导出</el-button>
  137. </el-col>
  138. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  139. </el-row>
  140. <el-table height="500" border v-loading="loading" :data="customerList" @selection-change="handleSelectionChange">
  141. <el-table-column type="selection" width="55" align="center" />
  142. <el-table-column label="ID" align="center" prop="customerId" />
  143. <el-table-column label="所属公司" align="center" prop="companyName" />
  144. <el-table-column label="客户编码" align="center" prop="customerCode" />
  145. <el-table-column label="客户名称" align="center" prop="customerName" />
  146. <el-table-column label="手机" align="center" prop="mobile" />
  147. <el-table-column label="性别" align="center" prop="sex">
  148. <template slot-scope="scope">
  149. <el-tag prop="sex" v-for="(item, index) in sexOptions" :key="'sex'+index" v-if="scope.row.sex==item.dictValue">{{item.dictLabel}}</el-tag>
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="微信号" align="center" prop="weixin" />
  153. <el-table-column label="所在地" align="center" prop="address" />
  154. <el-table-column label="标签" align="center" prop="tags" />
  155. <el-table-column label="客户来源" align="center" prop="source">
  156. <template slot-scope="scope">
  157. <el-tag prop="source" v-for="(item, index) in sourceOptions" :key="'source'+index" v-if="scope.row.source==item.dictValue">{{item.dictLabel}}</el-tag>
  158. </template>
  159. </el-table-column>
  160. <el-table-column label="客户类型" align="center" prop="customerType">
  161. <template slot-scope="scope">
  162. <el-tag prop="customerType" v-for="(item, index) in typeOptions" :key="'customerType'+index" v-if="scope.row.customerType==item.dictValue">{{item.dictLabel}}</el-tag>
  163. </template>
  164. </el-table-column>
  165. <el-table-column label="客户状态" align="center" prop="status">
  166. <template slot-scope="scope">
  167. <el-tag prop="status" v-for="(item, index) in statusOptions" :key="'status'+index" v-if="scope.row.status==item.dictValue">{{item.dictLabel}}</el-tag>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="认领人" align="center" prop="companyUserNickName" />
  171. <el-table-column label="领取时间" align="center" prop="startTime" />
  172. <el-table-column label="创建时间" align="center" prop="createTime" />
  173. <el-table-column label="最后一次跟进时间" align="center" prop="receiveTime" width="180">
  174. </el-table-column>
  175. <el-table-column label="入公海时间" align="center" prop="poolTime" width="180">
  176. </el-table-column>
  177. <el-table-column label="操作" fixed="right" width="180px" align="center" class-name="small-padding fixed-width">
  178. <template slot-scope="scope">
  179. <el-button
  180. size="mini"
  181. type="text"
  182. icon="el-icon-edit"
  183. @click="handleUpdate(scope.row)"
  184. v-hasPermi="['crm:customer:edit']"
  185. >修改</el-button>
  186. <el-button
  187. size="mini"
  188. type="text"
  189. @click="handleShow(scope.row)"
  190. v-hasPermi="['crm:customer:query']"
  191. >查看</el-button>
  192. <el-button
  193. size="mini"
  194. type="text"
  195. icon="el-icon-delete"
  196. @click="handleDelete(scope.row)"
  197. v-hasPermi="['crm:customer:remove']"
  198. >删除</el-button>
  199. </template>
  200. </el-table-column>
  201. </el-table>
  202. <pagination
  203. v-show="total>0"
  204. :total="total"
  205. :page-sizes="pageSizes"
  206. :page.sync="queryParams.pageNum"
  207. :limit.sync="queryParams.pageSize"
  208. @pagination="getList"
  209. />
  210. <!-- 添加或修改客户对话框 -->
  211. <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
  212. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  213. <el-form-item label="客户编码" prop="customerCode">
  214. <el-input v-model="form.customerCode" :disabled="form.customerId!=null" placeholder="请输入客户编码" />
  215. </el-form-item>
  216. <el-form-item label="客户名称" prop="customerName">
  217. <el-input v-model="form.customerName" placeholder="请输入客户名称" />
  218. </el-form-item>
  219. <el-form-item label="手机" prop="mobile">
  220. <el-input maxlength="11" v-model="form.mobile" placeholder="请输入手机" />
  221. </el-form-item>
  222. <el-form-item label="性别" prop="sex">
  223. <el-radio-group v-model="form.sex">
  224. <el-radio :label="item.dictValue" v-for="item in sexOptions" >{{item.dictLabel}}</el-radio>
  225. </el-radio-group>
  226. </el-form-item>
  227. <el-form-item label="微信号" prop="weixin">
  228. <el-input v-model="form.weixin" placeholder="请输入性别" />
  229. </el-form-item>
  230. <el-form-item label="所在地区" prop="address">
  231. <el-cascader
  232. ref="citySelect"
  233. v-model="cityIds"
  234. :options="citys"
  235. @change="handleCityChange"></el-cascader>
  236. </el-form-item>
  237. <el-form-item label="详细地址" prop="detailAddress">
  238. <el-input v-model="form.detailAddress" placeholder="请输入详细地址" />
  239. </el-form-item>
  240. <el-form-item label="客户来源" prop="source">
  241. <el-select v-model="form.source" placeholder="请选择客户来源" clearable size="small">
  242. <el-option
  243. v-for="item in sourceOptions"
  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="customerType">
  251. <el-select v-model="form.customerType" placeholder="请选择客户类型" clearable size="small">
  252. <el-option
  253. v-for="item in typeOptions"
  254. :key="item.dictValue"
  255. :label="item.dictLabel"
  256. :value="item.dictValue"
  257. />
  258. </el-select>
  259. </el-form-item>
  260. <el-form-item label="客户状态">
  261. <el-radio-group v-model="form.status">
  262. <el-radio :label="item.dictValue" v-for="item in statusOptions">{{item.dictLabel}}</el-radio>
  263. </el-radio-group>
  264. </el-form-item>
  265. <el-form-item label="标签" prop="tags">
  266. <el-tag
  267. :key="tag"
  268. v-for="tag in tags"
  269. closable
  270. :disable-transitions="false"
  271. @close="handleClose(tag)">
  272. {{tag}}
  273. </el-tag>
  274. <el-input
  275. class="input-new-tag"
  276. v-if="inputVisible"
  277. v-model="inputValue"
  278. ref="saveTagInput"
  279. size="small"
  280. @keyup.enter.native="handleInputConfirm"
  281. @blur="handleInputConfirm"
  282. >
  283. </el-input>
  284. <el-button v-else class="button-new-tag" size="small" @click="showInput">添加标签+</el-button>
  285. <el-select @change="tagsChange" v-model="tagId" placeholder="选择客户来源" style="width:140px;margin-left: 5px;" clearable size="small">
  286. <el-option
  287. v-for="item in tagsOptions"
  288. :key="item.dictValue"
  289. :label="item.dictLabel"
  290. :value="item.dictValue"
  291. />
  292. </el-select>
  293. </el-form-item>
  294. <el-form-item label="备注" prop="remark">
  295. <el-input :rows="2" v-model="form.remark" type="textarea" placeholder="请输入内容" />
  296. </el-form-item>
  297. </el-form>
  298. <div slot="footer" class="dialog-footer">
  299. <el-button type="primary" @click="submitForm">确 定</el-button>
  300. <el-button @click="cancel">取 消</el-button>
  301. </div>
  302. </el-dialog>
  303. <el-drawer
  304. size="75%"
  305. :title="show.title" :visible.sync="show.open">
  306. <customer-details ref="customerDetails" />
  307. </el-drawer>
  308. <el-dialog :title="source.title" :visible.sync="source.open" width="600px" append-to-body>
  309. <edit-customer-source ref="editSource" @close="closeSource"></edit-customer-source>
  310. </el-dialog>
  311. </div>
  312. </template>
  313. <script>
  314. import { listCustomer,getCustomer,addCustomer,updateCustomer,delCustomer,exportCustomer } from "@/api/crm/customer";
  315. import { getCompanyList } from "@/api/company/company";
  316. import customerDetails from '../components/customerDetails.vue';
  317. import editCustomerSource from '../components/editCustomerSource.vue';
  318. import {getCitys} from "@/api/store/city";
  319. import { throwStatement } from "@babel/types";
  320. export default {
  321. name: "Customer",
  322. components: { customerDetails,editCustomerSource },
  323. data() {
  324. return {
  325. source:{
  326. title:"修改客户来源",
  327. open:false,
  328. },
  329. tagId:null,
  330. tagsOptions:[],
  331. ctsTypeArr:[],
  332. sourceArr:[],
  333. dateRange:[],
  334. cityIds:[],
  335. citys:[],
  336. tags:[],
  337. tagIds:[],
  338. inputVisible: false,
  339. inputValue: '',
  340. statusOptions:[],
  341. typeOptions:[],
  342. sourceOptions:[],
  343. sexOptions:[],
  344. pageSizes: [10, 20, 30, 50,100,500 ],
  345. show:{
  346. title:"客户详情",
  347. open:false,
  348. },
  349. companys:[],
  350. // 遮罩层
  351. loading: true,
  352. // 选中数组
  353. ids: [],
  354. // 非单个禁用
  355. single: true,
  356. // 非多个禁用
  357. multiple: true,
  358. // 显示搜索条件
  359. showSearch: true,
  360. // 总条数
  361. total: 0,
  362. // 客户表格数据
  363. customerList: [],
  364. // 弹出层标题
  365. title: "",
  366. // 是否显示弹出层
  367. open: false,
  368. // 查询参数
  369. queryParams: {
  370. pageNum: 1,
  371. pageSize: 10,
  372. customerCode: null,
  373. customerName: null,
  374. mobile: null,
  375. sex: null,
  376. weixin: null,
  377. userId: null,
  378. createUserId: null,
  379. receiveUserId: null,
  380. customerUserId: null,
  381. address: null,
  382. location: null,
  383. detailAddress: null,
  384. lng: null,
  385. lat: null,
  386. status: null,
  387. isReceive: null,
  388. deptId: null,
  389. isDel: null,
  390. customerType: null,
  391. receiveTime: null,
  392. poolTime: null,
  393. companyId: null,
  394. isLine: null,
  395. source: null,
  396. tags: null
  397. },
  398. // 表单参数
  399. form: {},
  400. // 表单校验
  401. rules: {
  402. // customerName: [
  403. // { required: true, message: "客户名称不能为空", trigger: "blur" }
  404. // ],
  405. mobile: [
  406. { required: true, message: "手机号不能为空", trigger: "blur" }
  407. ],
  408. // sex: [
  409. // { required: true, message: "性别不能为空", trigger: "blur" }
  410. // ],
  411. source: [
  412. { required: true, message: "客户来源不能为空", trigger: "blur" }
  413. ],
  414. }
  415. };
  416. },
  417. created() {
  418. this.getDicts("crm_customer_tag").then((response) => {
  419. this.tagsOptions = response.data;
  420. });
  421. this.getDicts("crm_customer_source").then((response) => {
  422. this.sourceOptions = response.data;
  423. });
  424. this.getDicts("common_sex").then((response) => {
  425. this.sexOptions = response.data;
  426. });
  427. this.getDicts("crm_customer_status").then((response) => {
  428. this.statusOptions = response.data;
  429. });
  430. this.getDicts("crm_customer_type").then((response) => {
  431. this.typeOptions = response.data;
  432. });
  433. getCompanyList().then(response => {
  434. this.companys = response.data;
  435. });
  436. this.getCitys();
  437. this.getList();
  438. },
  439. methods: {
  440. handleEditSource(){
  441. this.source.open=true;
  442. var that=this;
  443. setTimeout(() => {
  444. that.$refs.editSource.handleEdit(that.ids);
  445. }, 200);
  446. },
  447. closeSource(){
  448. this.source.open=false;
  449. this.getList();
  450. },
  451. handleClose(tag) {
  452. this.tags.splice(this.tags.indexOf(tag), 1);
  453. this.form.tags=this.tags.toString();
  454. },
  455. showInput() {
  456. this.inputVisible = true;
  457. this.$nextTick(_ => {
  458. this.$refs.saveTagInput.$refs.input.focus();
  459. });
  460. },
  461. handleInputConfirm() {
  462. let inputValue = this.inputValue;
  463. if (inputValue) {
  464. this.tags.push(inputValue);
  465. }
  466. this.inputVisible = false;
  467. this.inputValue = '';
  468. this.form.tags=this.tags.toString();
  469. },
  470. tagsChange(e){
  471. var item=this.tagsOptions.find(val => val.dictValue === e);
  472. console.log(item);
  473. this.tags.push(item.dictLabel);
  474. this.form.tags=this.tags.toString();
  475. },
  476. handleCityChange(value) {
  477. console.log(value);
  478. var nodes=this.$refs.citySelect.getCheckedNodes();
  479. this.form.address=nodes[0].pathLabels[0]+"-"+nodes[0].pathLabels[1]+"-"+nodes[0].pathLabels[2];
  480. this.form.cityIds=value.toString();
  481. },
  482. getCitys(){
  483. getCitys().then(res => {
  484. this.loading = false;
  485. this.citys=res.data;
  486. })
  487. },
  488. handleClose(tag) {
  489. this.tags.splice(this.tags.indexOf(tag), 1);
  490. this.form.tags=this.tags.toString();
  491. },
  492. showInput() {
  493. this.inputVisible = true;
  494. this.$nextTick(_ => {
  495. this.$refs.saveTagInput.$refs.input.focus();
  496. });
  497. },
  498. handleInputConfirm() {
  499. let inputValue = this.inputValue;
  500. if (inputValue) {
  501. this.tags.push(inputValue);
  502. }
  503. this.inputVisible = false;
  504. this.inputValue = '';
  505. this.form.tags=this.tags.toString();
  506. },
  507. handleShow(row){
  508. var that=this;
  509. that.show.open=true;
  510. setTimeout(() => {
  511. that.$refs.customerDetails.getDetails(row.customerId);
  512. }, 200);
  513. },
  514. /** 查询客户列表 */
  515. getList() {
  516. this.loading = true;
  517. if(this.ctsTypeArr.length>0){
  518. this.queryParams.customerType=this.ctsTypeArr.toString();
  519. }
  520. else{
  521. this.queryParams.customerType=null
  522. }
  523. if(this.sourceArr.length>0){
  524. this.queryParams.source=this.sourceArr.toString();
  525. }
  526. else{
  527. this.queryParams.source=null
  528. }
  529. if(this.tagIds.length>0){
  530. this.queryParams.tags=this.tagIds.toString();
  531. }
  532. else{
  533. this.queryParams.tags=null
  534. }
  535. listCustomer(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  536. this.customerList = response.rows;
  537. this.total = response.total;
  538. this.loading = false;
  539. });
  540. },
  541. // 取消按钮
  542. cancel() {
  543. this.open = false;
  544. this.reset();
  545. },
  546. // 表单重置
  547. reset() {
  548. this.form = {
  549. customerId: null,
  550. customerCode: null,
  551. customerName: null,
  552. mobile: null,
  553. sex: null,
  554. weixin: null,
  555. remark: null,
  556. userId: null,
  557. createUserId: null,
  558. receiveUserId: null,
  559. customerUserId: null,
  560. address: null,
  561. location: null,
  562. detailAddress: null,
  563. lng: null,
  564. lat: null,
  565. createTime: null,
  566. updateTime: null,
  567. status: "1",
  568. isReceive: null,
  569. deptId: null,
  570. isDel: null,
  571. customerType: null,
  572. receiveTime: null,
  573. poolTime: null,
  574. companyId: null,
  575. isLine: null,
  576. source: null,
  577. tags: null
  578. };
  579. this.tags=[];
  580. this.cityIds=[];
  581. this.resetForm("form");
  582. },
  583. /** 搜索按钮操作 */
  584. handleQuery() {
  585. this.queryParams.pageNum = 1;
  586. this.getList();
  587. },
  588. /** 重置按钮操作 */
  589. resetQuery() {
  590. this.resetForm("queryForm");
  591. this.handleQuery();
  592. },
  593. // 多选框选中数据
  594. handleSelectionChange(selection) {
  595. this.ids = selection.map(item => item.customerId)
  596. this.single = selection.length!==1
  597. this.multiple = !selection.length
  598. },
  599. /** 新增按钮操作 */
  600. handleAdd() {
  601. this.reset();
  602. this.open = true;
  603. this.title = "添加客户";
  604. },
  605. /** 修改按钮操作 */
  606. handleUpdate(row) {
  607. this.reset();
  608. const customerId = row.customerId || this.ids
  609. var that=this;
  610. getCustomer(customerId).then(response => {
  611. this.form = response.customer;
  612. if(this.form.status!=null){
  613. this.form.status = this.form.status.toString();
  614. }
  615. if(this.form.customerType!=null){
  616. this.form.customerType = this.form.customerType.toString();
  617. }
  618. if(this.form.sex!=null){
  619. this.form.sex = this.form.sex.toString();
  620. }
  621. if(this.form.source!=null){
  622. this.form.source = this.form.source.toString();
  623. }
  624. if(this.form.tags!=null){
  625. this.tags = this.form.tags.split(",")
  626. }
  627. if(this.form.cityIds!=null){
  628. var ids=this.form.cityIds.split(",");
  629. this.cityIds=[];
  630. ids.forEach(element => {
  631. var id=parseInt(element);
  632. that.cityIds.push(id)
  633. });
  634. }
  635. this.open = true;
  636. this.title = "修改客户";
  637. });
  638. },
  639. /** 提交按钮 */
  640. submitForm() {
  641. this.$refs["form"].validate(valid => {
  642. if (valid) {
  643. if (this.form.customerId != null) {
  644. updateCustomer(this.form).then(response => {
  645. if (response.code === 200) {
  646. this.msgSuccess("修改成功");
  647. this.open = false;
  648. this.getList();
  649. }
  650. });
  651. } else {
  652. addCustomer(this.form).then(response => {
  653. if (response.code === 200) {
  654. this.msgSuccess("新增成功");
  655. this.open = false;
  656. this.getList();
  657. }
  658. });
  659. }
  660. }
  661. });
  662. },
  663. /** 删除按钮操作 */
  664. handleDelete(row) {
  665. const customerIds = row.customerId || this.ids;
  666. this.$confirm('是否确认删除客户编号为"' + customerIds + '"的数据项?', "警告", {
  667. confirmButtonText: "确定",
  668. cancelButtonText: "取消",
  669. type: "warning"
  670. }).then(function() {
  671. return delCustomer(customerIds);
  672. }).then(() => {
  673. this.getList();
  674. this.msgSuccess("删除成功");
  675. }).catch(function() {});
  676. },
  677. /** 导出按钮操作 */
  678. handleExport() {
  679. //const queryParams = this.queryParams;
  680. const queryParams=this.addDateRange(this.queryParams, this.dateRange)
  681. this.$confirm('是否确认导出客户数据项?', "警告", {
  682. confirmButtonText: "确定",
  683. cancelButtonText: "取消",
  684. type: "warning"
  685. }).then(function() {
  686. return exportCustomer(queryParams);
  687. }).then(response => {
  688. this.download(response.msg);
  689. }).catch(function() {});
  690. }
  691. }
  692. };
  693. </script>
  694. <style>
  695. .el-tag + .el-tag {
  696. margin-left: 10px;
  697. }
  698. .button-new-tag {
  699. margin-left: 10px;
  700. height: 32px;
  701. line-height: 30px;
  702. padding-top: 0;
  703. padding-bottom: 0;
  704. }
  705. .input-new-tag {
  706. width: 90px;
  707. margin-left: 10px;
  708. vertical-align: bottom;
  709. }
  710. .el-dialog__wrapper{
  711. z-index: 100000;
  712. }
  713. </style>