goReport.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  1. <template>
  2. <div class="goreport">
  3. <div class="form gaisideshurukuang">
  4. <uni-forms
  5. ref="baseForm"
  6. style="font-size: 26rpx"
  7. :modelValue="form"
  8. label-width="160rpx"
  9. >
  10. <uni-forms-item
  11. label="走访类型:"
  12. class="mt42rpx pd42rpx border_bottom_ccc"
  13. >
  14. <div style="height: 73rpx; line-height: 73rpx">
  15. <picker
  16. style="float: left; width: 100%; height: 40rpx; color: #777"
  17. :range="dic_SelectList.interviewType"
  18. :value="0"
  19. @change="bindPickerChange"
  20. range-key="label"
  21. >
  22. {{
  23. !form.interviewType
  24. ? "请选择"
  25. : dic_SelectList.interviewType[form.interviewTypeIndex].label
  26. }}
  27. </picker>
  28. </div>
  29. </uni-forms-item>
  30. <uni-forms-item
  31. label="走访公司"
  32. class="mt42rpx pd42rpx border_bottom_ccc"
  33. >
  34. <div
  35. @click="chosseAboutCompany()"
  36. style="height: 73rpx; line-height: 73rpx"
  37. >
  38. {{ !form.companyName ? "请选择走访公司" : form.companyName }}
  39. </div>
  40. </uni-forms-item>
  41. <uni-forms-item
  42. label="走访时间:"
  43. class="mt42rpx pd42rpx border_bottom_ccc"
  44. >
  45. <div style="line-height: 73rpx">
  46. <!-- <picker
  47. style="float: left; width: 100%; height: 40rpx; color: #777"
  48. mode="time"
  49. :value="form.interviewTime"
  50. @change="getInterviewTime"
  51. >
  52. {{ !form.interviewTime ? "请选择走访时间" : form.interviewTime }}
  53. </picker> -->
  54. <uni-datetime-picker
  55. type="datetime"
  56. v-model="form.interviewTime"
  57. :border="false"
  58. />
  59. </div>
  60. </uni-forms-item>
  61. <uni-forms-item
  62. label="同行人:"
  63. class="mt42rpx pd42rpx border_bottom_ccc"
  64. >
  65. <div style="display: flex; justify-content: space-between">
  66. <div style="margin-top: 15rpx">
  67. <div v-for="(item, index) in isSelectPeers" class="isSelectPeers">
  68. {{ item.name }}
  69. <icon type="clear" size="18" @click="deletePeer(index)" />
  70. </div>
  71. </div>
  72. <picker
  73. style="margin-top: 20rpx"
  74. @change="selectPeers"
  75. :value="index"
  76. range-key="truename"
  77. :range="peersList"
  78. >
  79. <span style="color: #1d18bc">添加</span>
  80. </picker>
  81. </div>
  82. </uni-forms-item>
  83. <uni-forms-item
  84. label="估值:"
  85. v-if="form.interviewTypeIndex == 1"
  86. class="mt42rpx pd42rpx border_bottom_ccc"
  87. >
  88. <div style="height: 73rpx; display: flex; align-items: center">
  89. <input
  90. type="number"
  91. v-model="form.valuation"
  92. placeholder="请输入估值"
  93. />
  94. </div>
  95. </uni-forms-item>
  96. <uni-forms-item
  97. v-if="form.interviewTypeIndex == 1"
  98. label="融资情况"
  99. class="mt42rpx pd42rpx border_bottom_ccc"
  100. >
  101. <div style="height: 73rpx; display: flex; align-items: center">
  102. <input
  103. type="text"
  104. v-model="form.financingSituation"
  105. placeholder="请输入融资情况"
  106. />
  107. </div>
  108. </uni-forms-item>
  109. </uni-forms>
  110. </div>
  111. <div class="form" style="margin-bottom: 146rpx">
  112. <van-row>
  113. <van-col :span="24"> 走访记录 </van-col>
  114. <van-col :span="24">
  115. <div class="margint16rpx">
  116. <textarea
  117. type="textarea"
  118. inputBorder
  119. maxlength="5000"
  120. class="textarea_info"
  121. autoHeight
  122. style="
  123. background: #f9f9f9;
  124. margin-top: 16rpx;
  125. margin-top: 16rpx;
  126. border: 1px solid #cccccc;
  127. border-radius: 4px;
  128. padding: 10rpx;
  129. height: auto;
  130. min-height: 500rpx;
  131. width: 100%;
  132. "
  133. v-model="form.interviewRecord"
  134. placeholder="请输入"
  135. ></textarea>
  136. </div>
  137. </van-col>
  138. </van-row>
  139. </div>
  140. <van-popup :show="show" bind:close="onClose" round position="bottom">
  141. <div style="display: flex; justify-content: space-between">
  142. <div style="margin: 32rpx" @click="closePopup()">取消</div>
  143. <div style="margin: 32rpx" @click="getSelectValue()">确认</div>
  144. </div>
  145. <uni-easyinput
  146. v-model="companyName"
  147. @input="filtedCompanyAllList"
  148. placeholder="请输入内容"
  149. ></uni-easyinput>
  150. <picker-view
  151. indicator-style="height: 50px;"
  152. style="width: 100%; height: 300px"
  153. @change="getRowValue"
  154. :value="value"
  155. >
  156. <picker-view-column>
  157. <view
  158. v-for="(item, index) in companyAllList"
  159. :key="index"
  160. style="line-height: 50px; text-align: center"
  161. >{{ item.label }}</view
  162. >
  163. </picker-view-column>
  164. </picker-view>
  165. </van-popup>
  166. <view class="btn-view">
  167. <div
  168. class="btn"
  169. @click="takeParamsGoBack(1)"
  170. style="margin-left: 10rpx; width: 80%"
  171. >
  172. 添加
  173. </div>
  174. </view>
  175. </div>
  176. </template>
  177. <script>
  178. import multipleSelect from "../../../subPackages/components/momo-multipleSelect/momo-multipleSelect";
  179. import {
  180. getByCodes,
  181. addInterview,
  182. getBySaveStatus,
  183. editInterview,
  184. getCompanyAll,
  185. getQyList,
  186. } from "@/js_sdk/http.js";
  187. import vanRow from "../../../../wxcomponents/weapp/dist/row";
  188. import vanCol from "../../../../wxcomponents/weapp/dist/col";
  189. // import { findYuanQuList } from "@/js_sdk/http.js";
  190. const form = {
  191. id: null,
  192. isStatus: null,
  193. interviewTime: null,
  194. interviewType: null,
  195. interviewTypeIndex: null,
  196. companyId: null,
  197. companyIndex: null,
  198. projectType: "",
  199. interviewRecord: "",
  200. associationCompanyString: [],
  201. };
  202. const isSelectPeers = [];
  203. export default {
  204. components: {
  205. vanRow,
  206. vanCol,
  207. multipleSelect,
  208. },
  209. data() {
  210. return {
  211. companyAllList: [],
  212. isSelectPeers: [],
  213. companyName: "",
  214. value: 0,
  215. isSelectedIndex: null,
  216. isStatus: 2,
  217. range: [
  218. { value: 2, text: "是" },
  219. { value: 1, text: "否" },
  220. ],
  221. defaultSelected: [],
  222. dic_key: ["interviewType"],
  223. dic_SelectList: {},
  224. companyIndex: null,
  225. companyAllList: [],
  226. show: false,
  227. peersList: [],
  228. active: 0,
  229. form: { ...form },
  230. index: 0,
  231. };
  232. },
  233. computed: {},
  234. mounted() {
  235. this.getCompanyAll();
  236. this.getByCodes();
  237. this.getQyList();
  238. },
  239. methods: {
  240. deletePeer(i) {
  241. this.isSelectPeers.splice(i, 1);
  242. },
  243. selectPeers(e) {
  244. console.log(this.peersList[e.detail.value]);
  245. let data = this.peersList[e.detail.value];
  246. console.log(e.detail.value);
  247. for (let i = 0; i < this.isSelectPeers.length; i++) {
  248. if (data.truename == this.isSelectPeers[i].name) {
  249. this.$showToast("请勿重复添加");
  250. return;
  251. }
  252. }
  253. this.isSelectPeers.push({ name: data.truename, id: data.id });
  254. },
  255. async getQyList() {
  256. let data = await getQyList();
  257. this.peersList = data;
  258. console.log("dataadataasfdsagd", data);
  259. },
  260. closePopup() {
  261. this.show = false;
  262. this.form.companyIndex = null;
  263. this.form.companyId = null;
  264. },
  265. async filtedCompanyAllList() {
  266. // this.value = 0;
  267. // this.isSelectedIndex = 0;
  268. let companyAllList = await getCompanyAll(this.companyName);
  269. this.companyAllList = companyAllList.map((e) => {
  270. return {
  271. label: e.qymc,
  272. value: e.id,
  273. };
  274. });
  275. console.log("当前的value", this.value);
  276. console.log("companyAllList", this.companyAllList);
  277. // if (this.companyName && this.companyName.length > 0) {
  278. // // companyAllList = this.companyAllList.filter((e) =>
  279. // // e.label.includes(this.companyName)
  280. // // );
  281. // if (companyAllList.length > 0 && companyAllList[0].value) {
  282. // let index = this.companyAllList.findIndex(
  283. // (e) => e.value == companyAllList[0].value
  284. // );
  285. // this.form.companyIndex = index;
  286. // } else {
  287. // this.form.companyIndex = null;
  288. // this.form.companyId = null;
  289. // }
  290. // } else {
  291. // companyAllList = this.companyAllList;
  292. // }
  293. return companyAllList;
  294. },
  295. getRowValue(e) {
  296. console.log(e);
  297. // this.value = e.detail.value[0];
  298. this.isSelectedIndex = e.detail.value[0];
  299. },
  300. getSelectValue() {
  301. console.log(this.value, "this.value");
  302. console.log("this.isSelectedIndex", this.isSelectedIndex);
  303. if (this.isSelectedIndex == null) {
  304. this.form.companyIndex = 0;
  305. this.form.companyId = this.companyAllList[this.value].value;
  306. this.form.companyName = this.companyAllList[this.value].label;
  307. console.log("11111111", this.form.companyName);
  308. } else {
  309. let index = this.companyAllList.findIndex(
  310. (e) => e.value == this.companyAllList[this.isSelectedIndex].value
  311. );
  312. this.form.companyIndex = index;
  313. this.form.companyId = this.companyAllList[index].value;
  314. this.form.companyName = this.companyAllList[index].label;
  315. console.log("企业名称", this.form.companyName);
  316. console.log("企业id", this.form.companyId);
  317. console.log();
  318. }
  319. this.show = false;
  320. },
  321. changeLog(e) {},
  322. async getBySaveStatus() {
  323. const token = uni.getStorageSync("laocui_user_info");
  324. let data = await getBySaveStatus(JSON.parse(token).user.id);
  325. console.log("this.companyAllList", this.companyAllList);
  326. let companyIndex = this.companyAllList.findIndex(
  327. (e) => e.value == data.companyId
  328. );
  329. console.log("companyIndex", companyIndex);
  330. this.form.valuation = data.valuation;
  331. this.form.financingSituation = data.financingSituation;
  332. this.form.companyName =
  333. companyIndex != -1 ? this.companyAllList[companyIndex].label : "";
  334. this.form.id = data.id ? data.id : null;
  335. this.form.isStatus = Number(data.isStatus);
  336. this.form.interviewTime = data.interviewTime ? data.interviewTime : "";
  337. this.form.interviewRecord = data.interviewRecord
  338. ? data.interviewRecord
  339. : "";
  340. if (
  341. data.id &&
  342. data.interviewType != null &&
  343. data.interviewType != "null"
  344. ) {
  345. this.getInterviewLableByApiList(data);
  346. }
  347. if (data.id && data.companyId != null) {
  348. this.getCompanyIdByApiList(data);
  349. }
  350. if (data.companionsUserName.length > 0) {
  351. let isSelectPeers = data.companionsUserName.split(",").map((e) => {
  352. return { name: e };
  353. });
  354. for (let i = 0; i < data.companionsUserId.split(",").length; i++) {
  355. isSelectPeers[i].id = data.companionsUserId.split(",")[i];
  356. }
  357. console.log("isSelectPeers", isSelectPeers);
  358. this.isSelectPeers = isSelectPeers;
  359. } else {
  360. this.isSelectPeers = [];
  361. }
  362. },
  363. getCompanyIdByApiList(params) {
  364. this.form.companyId = params.companyId;
  365. let companyIndex = this.companyAllList.findIndex(
  366. (e) => e.value == params.companyId
  367. );
  368. this.form.companyIndex = companyIndex;
  369. },
  370. getInterviewLableByApiList(params) {
  371. let interviewTypeIndex = this.dic_SelectList.interviewType.findIndex(
  372. (e) => e.value == params.interviewType
  373. );
  374. this.form.interviewType =
  375. this.dic_SelectList.interviewType[interviewTypeIndex].value;
  376. this.form.interviewTypeIndex = interviewTypeIndex;
  377. },
  378. getInterviewTime(e) {
  379. this.form.interviewTime = e.detail.value;
  380. },
  381. async takeParamsGoBack(e) {
  382. console.log(this.form);
  383. const token = uni.getStorageSync("laocui_user_info");
  384. let data;
  385. if (e == 1) {
  386. if (this.form.companyId == null) {
  387. return this.$showToast("请选择走访公司");
  388. }
  389. if (this.form.interviewTime == null || this.form.interviewTime == "") {
  390. return this.$showToast("请选择走访时间");
  391. }
  392. if (this.form.interviewType == null) {
  393. return this.$showToast("请选择走访类型");
  394. }
  395. }
  396. // // console.log(this.form.interviewType);
  397. // return;
  398. // console.log("this.isSelectPeers", this.isSelectPeers);
  399. if (!this.form.valuation) {
  400. delete this.form.valuation;
  401. }
  402. if (!this.form.financingSituation) {
  403. delete this.form.financingSituation;
  404. }
  405. let companionsUserName = this.isSelectPeers
  406. .map((e) => {
  407. return e.name;
  408. })
  409. .join();
  410. let companionsUserId = this.isSelectPeers
  411. .map((e) => {
  412. return e.id;
  413. })
  414. .join();
  415. console.log(companionsUserId);
  416. // return;
  417. if (e == 0 && !this.form.id) {
  418. data = await addInterview({
  419. ...this.form,
  420. companionsUserName: companionsUserName,
  421. companionsUserId: companionsUserId,
  422. status: e,
  423. id: this.form.id == "null" ? "" : this.form.id,
  424. createdBy: JSON.parse(token).user.id,
  425. InterviewUserId: JSON.parse(token).user.id,
  426. });
  427. } else if (e == 0 && this.form.id) {
  428. data = await editInterview({
  429. ...this.form,
  430. status: e,
  431. companionsUserName: companionsUserName,
  432. companionsUserId: companionsUserId,
  433. createdBy: JSON.parse(token).user.id,
  434. InterviewUserId: JSON.parse(token).user.id,
  435. });
  436. } else if (e == 1 && this.form.id) {
  437. data = await editInterview({
  438. ...this.form,
  439. status: e,
  440. companionsUserName: companionsUserName,
  441. companionsUserId: companionsUserId,
  442. createdBy: JSON.parse(token).user.id,
  443. InterviewUserId: JSON.parse(token).user.id,
  444. });
  445. } else if (e == 1 && !this.form.id) {
  446. data = await addInterview({
  447. ...this.form,
  448. status: e,
  449. companionsUserName: companionsUserName,
  450. companionsUserId: companionsUserId,
  451. createdBy: JSON.parse(token).user.id,
  452. InterviewUserId: JSON.parse(token).user.id,
  453. });
  454. }
  455. if (data.code == 200) {
  456. if (e == 1) {
  457. this.$emit("changeActive");
  458. this.$showToast("提交成功");
  459. this.form = { ...form };
  460. this.isSelectPeers = [...isSelectPeers];
  461. }
  462. if (e == 0) {
  463. this.$showToast("保存成功");
  464. }
  465. }
  466. },
  467. getCompany(e) {
  468. this.form.companyIndex = e.detail.value;
  469. this.form.companyId = this.companyAllList[e.detail.value].value;
  470. },
  471. chosseAboutCompany() {
  472. this.show = true;
  473. // this.$refs.popup.open('top')
  474. },
  475. async getCompanyAll() {
  476. let companyAllList = await getCompanyAll();
  477. this.companyAllList = companyAllList.map((e) => {
  478. return {
  479. label: e.qymc,
  480. value: e.id,
  481. };
  482. });
  483. this.getBySaveStatus();
  484. },
  485. async getByCodes() {
  486. let data = await getByCodes(JSON.stringify(this.dic_key));
  487. this.dic_SelectList = this.$common.handleDicList(data);
  488. this.dic_SelectList.interviewType[0].id;
  489. },
  490. confirm(e) {
  491. let associationCompanyString = [];
  492. let associationCompany = [];
  493. for (var p in e) {
  494. associationCompanyString.push(e[p].label);
  495. associationCompany.push(e[p].value);
  496. }
  497. this.form.associationCompanyString = associationCompanyString.join(",");
  498. this.form.associationCompany = associationCompany.join(",");
  499. },
  500. bindPickerChange(e) {
  501. this.form.interviewTypeIndex = e.detail.value;
  502. this.form.interviewType =
  503. this.dic_SelectList.interviewType[e.detail.value].value;
  504. },
  505. },
  506. // onLoad: function (){
  507. // this.$refs.findYuanQuList()
  508. // },
  509. };
  510. </script>
  511. <style lang="scss">
  512. .btn-view {
  513. width: 100%;
  514. height: 100rpx;
  515. padding: 20rpx 10%;
  516. background-color: #ffffff;
  517. position: fixed;
  518. bottom: 0;
  519. left: 0;
  520. }
  521. .btn {
  522. border-radius: 8rpx 8rpx 8rpx 8rpx;
  523. width: 40%;
  524. height: 90rpx;
  525. border-radius: 8rpx 8rpx 8rpx 8rpx;
  526. background: #1d18bc;
  527. line-height: 90rpx;
  528. color: white;
  529. text-align: center;
  530. float: left;
  531. }
  532. .isSelectPeers {
  533. display: flex;
  534. align-items: center;
  535. justify-content: space-between;
  536. margin-bottom: 10rpx;
  537. width: 372rpx;
  538. }
  539. .gaisideshurukuang {
  540. font-size: 26rpx !important;
  541. .is-input-border {
  542. border-top: none !important;
  543. border-left: none !important;
  544. border-right: none !important;
  545. border: none;
  546. border-radius: 0 !important;
  547. }
  548. .uni-forms-item {
  549. border-bottom: 2rpx solid #cccccc !important;
  550. margin-top: 42rpx !important;
  551. padding-bottom: 42rpx !important;
  552. }
  553. .uni-forms-item__content {
  554. border-bottom: 2rpx solid #cccccc !important;
  555. }
  556. }
  557. .goreport {
  558. .textarea_info {
  559. textarea {
  560. background: #f9f9f9;
  561. }
  562. }
  563. .form {
  564. width: calc(100% - 128rpx);
  565. margin: 32rpx;
  566. background: #ffffff;
  567. padding: 32rpx;
  568. .label {
  569. height: 53rpx;
  570. line-height: 53rpx;
  571. }
  572. .is-input-border {
  573. border-top: none !important;
  574. border-left: none !important;
  575. border-right: none !important;
  576. border-radius: 0 !important;
  577. }
  578. .uni-forms-item {
  579. border-bottom: 2rpx solid #cccccc !important;
  580. margin-top: 0rpx !important;
  581. padding-bottom: 0rpx !important;
  582. }
  583. }
  584. }
  585. </style>