followList.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. v-if="type === '1'"
  5. :model="queryParams"
  6. ref="queryForm"
  7. size="small"
  8. :inline="true"
  9. v-show="showSearch"
  10. label-width="90px"
  11. >
  12. <el-form-item label="项目名称" prop="projectName">
  13. <el-input
  14. v-model="queryParams.projectName"
  15. placeholder="请输入项目名称"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="公司联系人" prop="contacts">
  21. <el-input
  22. v-model="queryParams.contacts"
  23. placeholder="请输入公司联系人"
  24. clearable
  25. @keyup.enter.native="handleQuery"
  26. />
  27. </el-form-item>
  28. <el-form-item label="跟进人" prop="upPerson">
  29. <el-input
  30. v-model="queryParams.upPerson"
  31. placeholder="请输入跟进人"
  32. clearable
  33. @keyup.enter.native="handleQuery"
  34. />
  35. </el-form-item>
  36. <el-form-item label="跟进方式" prop="upWay">
  37. <el-select v-model="queryParams.upWay" placeholder="全部" clearable>
  38. <el-option
  39. v-for="dict in dict.type.up_way"
  40. :key="dict.value"
  41. :label="dict.label"
  42. :value="dict.value"
  43. />
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="跟进日期" prop="realityUpDate">
  47. <el-date-picker
  48. style="width: 205px"
  49. clearable
  50. v-model="queryParams.realityUpDate"
  51. type="date"
  52. value-format="yyyy-MM-dd"
  53. placeholder="请选择跟进日期"
  54. >
  55. </el-date-picker>
  56. </el-form-item>
  57. <el-form-item>
  58. <el-button
  59. type="primary"
  60. icon="el-icon-search"
  61. size="mini"
  62. @click="handleQuery"
  63. >搜索</el-button
  64. >
  65. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  66. >重置</el-button
  67. >
  68. </el-form-item>
  69. </el-form>
  70. <el-row :gutter="10" class="mb8" v-if="type === '1'">
  71. <el-col :span="1.5">
  72. <el-button
  73. type="primary"
  74. plain
  75. icon="el-icon-plus"
  76. size="mini"
  77. @click="handleAdd"
  78. v-hasPermi="['invest:record:add']"
  79. >新增</el-button
  80. >
  81. </el-col>
  82. <el-col :span="1.5">
  83. <el-button
  84. type="success"
  85. plain
  86. icon="el-icon-edit"
  87. size="mini"
  88. :disabled="single"
  89. @click="handleUpdate"
  90. v-hasPermi="['invest:record:edit']"
  91. >修改</el-button
  92. >
  93. </el-col>
  94. <el-col :span="1.5">
  95. <el-button
  96. type="danger"
  97. plain
  98. icon="el-icon-delete"
  99. size="mini"
  100. :disabled="multiple"
  101. @click="handleDelete"
  102. v-hasPermi="['invest:record:remove']"
  103. >删除</el-button
  104. >
  105. </el-col>
  106. <el-col :span="1.5">
  107. <el-button
  108. type="warning"
  109. plain
  110. icon="el-icon-download"
  111. size="mini"
  112. @click="handleExport"
  113. v-hasPermi="['invest:record:export']"
  114. >导出</el-button
  115. >
  116. </el-col>
  117. <right-toolbar
  118. :showSearch.sync="showSearch"
  119. @queryTable="getList"
  120. ></right-toolbar>
  121. </el-row>
  122. <el-table
  123. class="tableWrapper"
  124. v-if="type !== '3'"
  125. v-loading="loading"
  126. border
  127. :data="recordList"
  128. @selection-change="handleSelectionChange"
  129. >
  130. <el-table-column type="selection" width="55" align="center" />
  131. <!-- <el-table-column label="主键ID" align="center" prop="id" /> -->
  132. <!-- <el-table-column label="项目编号" align="center" prop="projectId" /> -->
  133. <el-table-column
  134. label="项目名称"
  135. align="center"
  136. prop="tProjectPool.projectName"
  137. >
  138. <template slot-scope="scope">
  139. <div :title="scope.row.tProjectPool.projectName">
  140. {{ scope.row.tProjectPool.projectName }}
  141. </div>
  142. </template>
  143. </el-table-column>
  144. <el-table-column label="跟进人" align="center" prop="upPerson">
  145. <template slot-scope="scope">
  146. <div :title="scope.row.upPerson">
  147. {{ scope.row.upPerson }}
  148. </div>
  149. </template>
  150. </el-table-column>
  151. <el-table-column label="跟进方式" width="120" align="center" prop="upWay">
  152. <template slot-scope="scope">
  153. <dict-tag :options="dict.type.up_way" :value="scope.row.upWay" />
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="公司联系人" align="center" prop="contacts">
  157. <template slot-scope="scope">
  158. <div :title="scope.row.contacts">
  159. {{ scope.row.contacts }}
  160. </div>
  161. </template>
  162. </el-table-column>
  163. <el-table-column label="跟进内容" align="center" prop="upContent">
  164. <template slot-scope="scope">
  165. <div :title="scope.row.upContent">
  166. {{ scope.row.upContent }}
  167. </div>
  168. </template>
  169. </el-table-column>
  170. <el-table-column label="跟进日期" align="center" prop="realityUpDate">
  171. <template slot-scope="scope">
  172. <span :title="scope.row.realityUpDate">{{
  173. parseTime(scope.row.realityUpDate, "{y}-{m}-{d}")
  174. }}</span>
  175. </template>
  176. </el-table-column>
  177. <el-table-column label="创建人" align="center" prop="createBy">
  178. <template slot-scope="scope">
  179. <div :title="scope.row.createBy">
  180. {{ scope.row.createBy }}
  181. </div>
  182. </template>
  183. </el-table-column>
  184. <el-table-column label="创建时间" align="center" prop="createTime">
  185. <template slot-scope="scope">
  186. <div :title="scope.row.createTime">
  187. {{ scope.row.createTime }}
  188. </div>
  189. </template>
  190. </el-table-column>
  191. <!-- fixed="right" -->
  192. <el-table-column
  193. label="操作"
  194. width="120"
  195. align="center"
  196. class-name="small-padding fixed-width"
  197. >
  198. <template slot-scope="scope">
  199. <el-button
  200. size="mini"
  201. type="text"
  202. icon="el-icon-edit"
  203. @click="handleUpdate(scope.row)"
  204. v-hasPermi="['invest:record:edit']"
  205. >修改</el-button
  206. >
  207. <el-button
  208. class="custom-red-color"
  209. size="mini"
  210. type="text"
  211. icon="el-icon-delete"
  212. @click="handleDelete(scope.row)"
  213. v-hasPermi="['invest:record:remove']"
  214. >删除</el-button
  215. >
  216. </template>
  217. </el-table-column>
  218. </el-table>
  219. <pagination
  220. v-show="total > 0 && type !== '3'"
  221. :total="total"
  222. :page.sync="queryParams.pageNum"
  223. :limit.sync="queryParams.pageSize"
  224. @pagination="getList"
  225. />
  226. <!-- 添加或修改跟进记录对话框 -->
  227. <el-dialog
  228. :title="title"
  229. :visible.sync="open"
  230. width="1000px"
  231. append-to-body
  232. >
  233. <el-form
  234. class="special-el-form"
  235. ref="form"
  236. :model="form"
  237. :rules="rules"
  238. label-width="120px"
  239. >
  240. <el-form-item label="项目名称" prop="projectName">
  241. <div
  242. class="el-input__inner inputSimulation yichu1"
  243. @click="handleProjectItem"
  244. :class="{ show_disabled: pageType === '1' }"
  245. :title="form.projectName"
  246. >
  247. {{ form.projectName ? form.projectName : "请选择 " }}
  248. </div>
  249. <projectItem
  250. ref="projectItem"
  251. @getProjectInfo="getProjectInfo"
  252. ></projectItem>
  253. </el-form-item>
  254. <el-form-item label="项目阶段" prop="projectStage">
  255. <el-select v-model="form.projectStage" disabled placeholder="">
  256. <el-option
  257. v-for="dict in dict.type.project_stage"
  258. :key="dict.value"
  259. :label="dict.label"
  260. :value="dict.value"
  261. />
  262. </el-select>
  263. </el-form-item>
  264. <el-form-item label="公司联系人" prop="contacts">
  265. <el-input disabled v-model="form.contacts" />
  266. </el-form-item>
  267. <el-form-item label="跟进日期" prop="realityUpDate">
  268. <el-date-picker
  269. clearable
  270. v-model="form.realityUpDate"
  271. type="date"
  272. value-format="yyyy-MM-dd"
  273. placeholder="请选择跟进日期"
  274. >
  275. </el-date-picker>
  276. </el-form-item>
  277. <el-form-item label="跟进人" prop="upPerson">
  278. <div class="el-input__inner inputSimulation" @click="openSelectDept">
  279. {{ form.upPerson ? form.upPerson : "请选择 " }}
  280. </div>
  281. <selecDept
  282. ref="selecDepts"
  283. @getDeptUserInfo="getDeptUserInfo"
  284. :deptId="deptId"
  285. ></selecDept>
  286. </el-form-item>
  287. <el-form-item label="跟进方式" prop="upWay">
  288. <el-select v-model="form.upWay" placeholder="请选择跟进方式">
  289. <el-option
  290. v-for="dict in dict.type.up_way"
  291. :key="dict.value"
  292. :label="dict.label"
  293. :value="dict.value"
  294. ></el-option>
  295. </el-select>
  296. </el-form-item>
  297. <el-form-item label="附件" prop="file">
  298. <fileItem
  299. ref="fileItems"
  300. :id="form.id"
  301. @getFileList="getFileList"
  302. ></fileItem>
  303. </el-form-item>
  304. <el-form-item
  305. label="跟进内容"
  306. prop="upContent"
  307. class="special-el-form-item"
  308. >
  309. <el-input
  310. maxlength="200"
  311. rows="4"
  312. type="textarea"
  313. v-model="form.upContent"
  314. placeholder="请输入跟进内容"
  315. />
  316. </el-form-item>
  317. <el-form-item label="备注" prop="mark" class="special-el-form-item">
  318. <el-input
  319. maxlength="200"
  320. rows="4"
  321. type="textarea"
  322. v-model="form.mark"
  323. placeholder="请输入备注"
  324. />
  325. </el-form-item>
  326. </el-form>
  327. <div slot="footer" class="dialog-footer">
  328. <el-button type="primary" @click="submitForm" v-preventReClick
  329. >确 定</el-button
  330. >
  331. <el-button @click="cancel">取 消</el-button>
  332. </div>
  333. </el-dialog>
  334. </div>
  335. </template>
  336. <script>
  337. import {
  338. listRecord,
  339. getRecord,
  340. delRecord,
  341. addRecord,
  342. updateRecord,
  343. } from "@/api/invest/record";
  344. import projectItem from "./projectItem";
  345. import fileItem from "./fileItem";
  346. import selecDept from "./selecDept";
  347. export default {
  348. props: {
  349. type: {
  350. type: String,
  351. default: "1", //1=显示全部列表 2=显示某项目下的详情列表 3=只展示弹窗
  352. },
  353. projectId: {
  354. type: String,
  355. },
  356. },
  357. dicts: ["up_way", "project_stage"],
  358. components: { projectItem, fileItem, selecDept },
  359. watch: {
  360. open: function (newValue, oldValue) {
  361. // console.log("newValue=", newValue);
  362. if (newValue === false) {
  363. this.queryParams.projectId = null;
  364. this.pageType = null;
  365. }
  366. },
  367. },
  368. data() {
  369. return {
  370. pageType: null, //1=新增表单
  371. deptId: process.env.VUE_APP_DEPTID,
  372. fileList: [],
  373. showProjectItem: false,
  374. // 遮罩层
  375. loading: true,
  376. // 选中数组
  377. ids: [],
  378. idsName: [],
  379. // 非单个禁用
  380. single: true,
  381. // 非多个禁用
  382. multiple: true,
  383. // 显示搜索条件
  384. showSearch: true,
  385. // 总条数
  386. total: 0,
  387. // 跟进记录表格数据
  388. recordList: [],
  389. // 弹出层标题
  390. title: "",
  391. // 是否显示弹出层
  392. open: false,
  393. // 查询参数
  394. queryParams: {
  395. pageNum: 1,
  396. pageSize: 10,
  397. projectName: null,
  398. projectId: null,
  399. contacts: null,
  400. upPerson: null,
  401. upWay: null,
  402. realityUpDate: null,
  403. orderByColumn: "createTime",
  404. isAsc: "desc",
  405. },
  406. // 表单参数
  407. form: {
  408. id: null,
  409. projectId: null,
  410. projectName: null,
  411. projectStage: null,
  412. contacts: null,
  413. realityUpDate: null,
  414. upPerson: null,
  415. upWay: null,
  416. upContent: null,
  417. mark: null,
  418. delFlag: null,
  419. createBy: null,
  420. createTime: null,
  421. updateBy: null,
  422. updateTime: null,
  423. listFile: null,
  424. },
  425. // 表单校验
  426. rules: {
  427. projectName: [{ required: true, trigger: "blur", message: "请选择" }],
  428. // contacts: [{ required: true, trigger: "blur", message: "请输入" }],
  429. realityUpDate: [{ required: true, trigger: "blur", message: "请选择" }],
  430. upWay: [{ required: true, trigger: "change", message: "请选择" }],
  431. upContent: [{ required: true, trigger: "blur", message: "请输入" }],
  432. upPerson: [{ required: true, trigger: "blur", message: "请选择" }],
  433. },
  434. };
  435. },
  436. created() {
  437. // 查询该id下的列表信息
  438. if (this.$route.query.id) {
  439. this.queryParams.projectId = this.$route.query.id;
  440. }
  441. // 直接弹出新增
  442. if (this.$route.query.type === "1") {
  443. this.pageType = this.$route.query.type;
  444. this.handleAdd();
  445. }
  446. if (this.projectId) {
  447. this.queryParams.projectId = this.projectId;
  448. }
  449. if (this.type !== "3") {
  450. this.getList();
  451. }
  452. },
  453. methods: {
  454. // 选择部门人
  455. openSelectDept() {
  456. this.$refs.selecDepts.show();
  457. },
  458. getDeptUserInfo(info) {
  459. if (info.length > 0) {
  460. this.form.upPerson = info[0].nickName;
  461. this.$refs.form.clearValidate(["upPerson"]);
  462. }
  463. },
  464. // 获取公司信息
  465. getProjectInfo(info) {
  466. if (info.length > 0) {
  467. this.form.projectId = info[0].id;
  468. this.form.projectName = info[0].projectName;
  469. this.form.projectStage = info[0].projectStage;
  470. this.form.projectState = info[0].projectState;
  471. // 公司联系人
  472. this.form.contacts = info[0].tProjectContacts.name;
  473. this.$refs.form.clearValidate(["projectName"]);
  474. }
  475. // this.form.projectState = info[0].tProjectContacts;
  476. },
  477. //展示人员
  478. handleProjectItem() {
  479. this.$refs.projectItem.showProjectItem = true;
  480. },
  481. // 获取fileList
  482. getFileList(fileList) {
  483. this.fileList = fileList;
  484. },
  485. /** 查询跟进记录列表 */
  486. getList() {
  487. this.loading = true;
  488. if (this.projectId) {
  489. this.queryParams.projectId = this.projectId;
  490. }
  491. listRecord(this.queryParams).then((response) => {
  492. this.recordList = response.rows;
  493. this.total = response.total;
  494. this.loading = false;
  495. });
  496. },
  497. // 取消按钮
  498. cancel() {
  499. this.open = false;
  500. this.reset();
  501. },
  502. // 表单重置
  503. reset() {
  504. this.form = {
  505. id: null,
  506. projectId: null,
  507. projectName: null,
  508. projectStage: null,
  509. contacts: null,
  510. realityUpDate: null,
  511. upPerson: null,
  512. upWay: null,
  513. upContent: null,
  514. mark: null,
  515. delFlag: null,
  516. createBy: null,
  517. createTime: null,
  518. updateBy: null,
  519. updateTime: null,
  520. listFile: null,
  521. };
  522. this.resetForm("form");
  523. },
  524. /** 搜索按钮操作 */
  525. handleQuery() {
  526. this.queryParams.pageNum = 1;
  527. this.getList();
  528. },
  529. /** 重置按钮操作 */
  530. resetQuery() {
  531. this.resetForm("queryForm");
  532. this.queryParams.orderByColumn = "createTime";
  533. this.queryParams.isAsc = "desc";
  534. this.handleQuery();
  535. },
  536. // 多选框选中数据
  537. handleSelectionChange(selection) {
  538. this.ids = selection.map((item) => item.id);
  539. this.idsName = selection.map(
  540. (item) => item.upPerson + "(跟进时间:" + item.realityUpDate + ")"
  541. );
  542. this.single = selection.length !== 1;
  543. this.multiple = !selection.length;
  544. },
  545. /** 新增按钮操作 */
  546. handleAdd(projectId) {
  547. let that = this;
  548. this.reset();
  549. // 直接绑定好项目
  550. if (projectId && typeof projectId === "string") {
  551. this.pageType = "1";
  552. }
  553. if (this.pageType === "1") {
  554. let projectItemMessage = this.$store.getters.projectItemMessage;
  555. this.form.projectId = projectItemMessage.id;
  556. this.form.projectName = projectItemMessage.projectName;
  557. this.form.projectStage = projectItemMessage.projectStage;
  558. this.form.contacts = projectItemMessage.tProjectContacts.name;
  559. }
  560. this.open = true;
  561. this.title = "添加跟进记录";
  562. setTimeout(() => {
  563. that.$refs.fileItems.fileList = [];
  564. }, 200);
  565. },
  566. /** 修改按钮操作 */
  567. handleUpdate(row) {
  568. this.reset();
  569. const id = row.id || this.ids;
  570. getRecord(id).then((response) => {
  571. this.form = response.data;
  572. this.form.projectName = response.data.tProjectPool.projectName;
  573. this.form.projectStage = response.data.tProjectPool.projectStage;
  574. this.open = true;
  575. this.title = "修改跟进记录";
  576. setTimeout(() => {
  577. this.$refs.fileItems.getListFileBusinessId(id);
  578. }, 200);
  579. });
  580. },
  581. /** 提交按钮 */
  582. submitForm() {
  583. this.$refs["form"].validate((valid) => {
  584. if (valid) {
  585. this.form.listFile = this.fileList;
  586. if (this.form.id != null) {
  587. updateRecord(this.form).then((response) => {
  588. this.$modal.msgSuccess("修改成功");
  589. this.open = false;
  590. this.getList();
  591. });
  592. } else {
  593. addRecord(this.form).then((response) => {
  594. this.$modal.msgSuccess("新增成功");
  595. this.open = false;
  596. this.getList();
  597. });
  598. }
  599. }
  600. });
  601. },
  602. /** 删除按钮操作 */
  603. handleDelete(row) {
  604. const ids = row.id || this.ids;
  605. const idsName = row.upPerson
  606. ? row.upPerson + "(跟进日期:" + row.realityUpDate + ")"
  607. : this.idsName;
  608. this.$modal
  609. .confirm("是否确认删除“" + idsName + "”的跟进记录?")
  610. .then(function () {
  611. return delRecord(ids);
  612. })
  613. .then(() => {
  614. this.getList();
  615. this.$modal.msgSuccess("删除成功");
  616. })
  617. .catch(() => {});
  618. },
  619. /** 导出按钮操作 */
  620. handleExport() {
  621. this.download(
  622. "invest/record/export",
  623. {
  624. ...this.queryParams,
  625. },
  626. `record_${new Date().getTime()}.xlsx`
  627. );
  628. },
  629. },
  630. };
  631. </script>
  632. <style lang="scss" scoped>
  633. .inputSimulation {
  634. }
  635. </style>