followList.vue 17 KB

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