followList.vue 19 KB

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