goReport.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438
  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="170rpx"
  9. >
  10. <uni-forms-item
  11. label="走访公司"
  12. class="mt42rpx pd42rpx border_bottom_ccc"
  13. >
  14. <div
  15. @click="chosseAboutCompany()"
  16. style="height: 73rpx; line-height: 73rpx"
  17. >
  18. {{
  19. !companyAllList[form.companyIndex].label
  20. ? "请选择走访公司"
  21. : companyAllList[form.companyIndex].label
  22. }}
  23. </div>
  24. </uni-forms-item>
  25. <uni-forms-item
  26. label="走访时间:"
  27. class="mt42rpx pd42rpx border_bottom_ccc"
  28. >
  29. <div style="line-height: 73rpx">
  30. <!-- <picker
  31. style="float: left; width: 100%; height: 40rpx; color: #777"
  32. mode="time"
  33. :value="form.interviewTime"
  34. @change="getInterviewTime"
  35. >
  36. {{ !form.interviewTime ? "请选择走访时间" : form.interviewTime }}
  37. </picker> -->
  38. <uni-datetime-picker
  39. type="datetime"
  40. v-model="form.interviewTime"
  41. :border="false"
  42. />
  43. </div>
  44. </uni-forms-item>
  45. <uni-forms-item
  46. label="走访类型:"
  47. class="mt42rpx pd42rpx border_bottom_ccc"
  48. >
  49. <div style="height: 73rpx; line-height: 73rpx">
  50. <picker
  51. style="float: left; width: 100%; height: 40rpx; color: #777"
  52. :range="dic_SelectList.interviewType"
  53. :value="0"
  54. @change="bindPickerChange"
  55. range-key="label"
  56. >
  57. {{
  58. !form.interviewType
  59. ? "请选择"
  60. : dic_SelectList.interviewType[form.interviewTypeIndex].label
  61. }}
  62. </picker>
  63. </div>
  64. </uni-forms-item>
  65. <uni-forms-item
  66. label="是否需要处理"
  67. class="mt42rpx pd42rpx border_bottom_ccc"
  68. >
  69. <div style="height: 73rpx; line-height: 73rpx">
  70. <uni-data-checkbox
  71. v-model="form.isStatus"
  72. :localdata="range"
  73. @change="change"
  74. ></uni-data-checkbox>
  75. </div>
  76. </uni-forms-item>
  77. </uni-forms>
  78. </div>
  79. <div class="form" style="margin-bottom: 146rpx">
  80. <van-row>
  81. <van-col :span="24"> 走访记录 </van-col>
  82. <van-col :span="24">
  83. <div class="margint16rpx">
  84. <uni-easyinput
  85. type="textarea"
  86. inputBorder
  87. class="textarea_info"
  88. style="background: #f9f9f9; margin-top: 16rpx"
  89. v-model="form.interviewRecord"
  90. placeholder="请输入"
  91. />
  92. </div>
  93. </van-col>
  94. </van-row>
  95. </div>
  96. <van-popup :show="show" bind:close="onClose" round position="bottom">
  97. <div style="display: flex; justify-content: space-between">
  98. <div style="margin: 32rpx" @click="closePopup()">取消</div>
  99. <div style="margin: 32rpx" @click="getSelectValue()">确认</div>
  100. </div>
  101. <uni-easyinput
  102. v-model="companyName"
  103. placeholder="请输入内容"
  104. ></uni-easyinput>
  105. <picker-view
  106. indicator-style="height: 50px;"
  107. style="width: 100%; height: 300px"
  108. @change="getRowValue"
  109. :value="value"
  110. >
  111. <picker-view-column>
  112. <view
  113. v-for="(item, index) in filtedCompanyAllList()"
  114. :key="index"
  115. style="line-height: 50px; text-align: center"
  116. >{{ item.label }}</view
  117. >
  118. </picker-view-column>
  119. </picker-view>
  120. </van-popup>
  121. <view class="btn-view">
  122. <button class="btn" @click="takeParamsGoBack(0)">保存</button>
  123. <button
  124. class="btn"
  125. @click="takeParamsGoBack(1)"
  126. style="margin-left: 10rpx"
  127. >
  128. 添加
  129. </button>
  130. </view>
  131. </div>
  132. </template>
  133. <script>
  134. import multipleSelect from "../../../subPackages/components/momo-multipleSelect/momo-multipleSelect";
  135. import {
  136. getByCodes,
  137. addInterview,
  138. getBySaveStatus,
  139. editInterview,
  140. getCompanyAll,
  141. } from "@/js_sdk/http.js";
  142. import vanRow from "../../../../wxcomponents/weapp/dist/row";
  143. import vanCol from "../../../../wxcomponents/weapp/dist/col";
  144. // import { findYuanQuList } from "@/js_sdk/http.js";
  145. const form = {
  146. id: null,
  147. isStatus: null,
  148. interviewTime: null,
  149. interviewType: null,
  150. interviewTypeIndex: null,
  151. companyId: null,
  152. companyIndex: null,
  153. projectType: "",
  154. interviewRecord: "",
  155. associationCompanyString: [],
  156. };
  157. export default {
  158. components: {
  159. vanRow,
  160. vanCol,
  161. multipleSelect,
  162. },
  163. data() {
  164. return {
  165. companyName: "",
  166. value: 0,
  167. isSelectedIndex: null,
  168. isStatus: 2,
  169. range: [
  170. { value: 2, text: "是" },
  171. { value: 1, text: "否" },
  172. ],
  173. defaultSelected: [],
  174. dic_key: ["interviewType"],
  175. dic_SelectList: {},
  176. companyIndex: null,
  177. companyAllList: [],
  178. show: false,
  179. active: 0,
  180. form: { ...form },
  181. index: 0,
  182. };
  183. },
  184. computed: {},
  185. mounted() {
  186. this.getCompanyAll();
  187. this.getByCodes();
  188. },
  189. methods: {
  190. closePopup() {
  191. this.show = false;
  192. this.form.companyIndex = null;
  193. this.form.companyId = null;
  194. },
  195. filtedCompanyAllList() {
  196. let companyAllList;
  197. if (this.companyName && this.companyName.length > 0) {
  198. companyAllList = this.companyAllList.filter((e) =>
  199. e.label.includes(this.companyName)
  200. );
  201. if (companyAllList.length > 0 && companyAllList[0].value) {
  202. let index = this.companyAllList.findIndex(
  203. (e) => e.value == companyAllList[0].value
  204. );
  205. this.form.companyIndex = index;
  206. this.form.companyId =
  207. this.companyAllList[this.form.companyIndex].value;
  208. } else {
  209. this.form.companyIndex = null;
  210. this.form.companyId = null;
  211. }
  212. } else {
  213. companyAllList = this.companyAllList;
  214. }
  215. console.log(companyAllList);
  216. return companyAllList;
  217. },
  218. getRowValue(e) {
  219. this.isSelectedIndex = e.detail.value[0];
  220. },
  221. getSelectValue() {
  222. console.log(this.value);
  223. if (this.isSelectedIndex == null) {
  224. this.form.companyIndex = 0;
  225. this.form.companyId = this.companyAllList[0].value;
  226. } else {
  227. this.form.companyIndex = this.isSelectedIndex;
  228. this.form.companyId = this.companyAllList[this.form.companyIndex].value;
  229. }
  230. this.$forceUpdate();
  231. this.show = false;
  232. },
  233. changeLog(e) {},
  234. async getBySaveStatus() {
  235. const token = uni.getStorageSync("laocui_user_info");
  236. let data = await getBySaveStatus(JSON.parse(token).user.id);
  237. this.form.id = data.id ? data.id : null;
  238. this.form.isStatus = Number(data.isStatus);
  239. this.form.interviewTime = data.interviewTime ? data.interviewTime : "";
  240. this.form.interviewRecord = data.interviewRecord
  241. ? data.interviewRecord
  242. : "";
  243. if (
  244. data.id &&
  245. data.interviewType != null &&
  246. data.interviewType != "null"
  247. ) {
  248. this.getInterviewLableByApiList(data);
  249. }
  250. if (data.id && data.companyId != null) {
  251. this.getCompanyIdByApiList(data);
  252. }
  253. },
  254. getCompanyIdByApiList(params) {
  255. this.form.companyId = params.companyId;
  256. console.log(
  257. "this.companyAllListthis.companyAllListthis.companyAllList",
  258. this.companyAllList
  259. );
  260. let companyIndex = this.companyAllList.findIndex(
  261. (e) => e.value == params.companyId
  262. );
  263. this.form.companyIndex = companyIndex;
  264. },
  265. getInterviewLableByApiList(params) {
  266. let interviewTypeIndex = this.dic_SelectList.interviewType.findIndex(
  267. (e) => e.value == params.interviewType
  268. );
  269. this.form.interviewType =
  270. this.dic_SelectList.interviewType[interviewTypeIndex].value;
  271. this.form.interviewTypeIndex = interviewTypeIndex;
  272. },
  273. getInterviewTime(e) {
  274. this.form.interviewTime = e.detail.value;
  275. },
  276. async takeParamsGoBack(e) {
  277. const token = uni.getStorageSync("laocui_user_info");
  278. let data;
  279. if (e == 1) {
  280. if (this.form.companyId == null) {
  281. return this.$showToast("请选择走访公司");
  282. }
  283. if (this.form.interviewTime == null || this.form.interviewTime == "") {
  284. return this.$showToast("请选择走访时间");
  285. }
  286. if (this.form.interviewType == null) {
  287. return this.$showToast("请选择走访类型");
  288. }
  289. if (this.form.isStatus == null) {
  290. return this.$showToast("请选择是否需要处理");
  291. }
  292. }
  293. if (e == 0) {
  294. data = await editInterview({
  295. ...this.form,
  296. status: e,
  297. createdBy: JSON.parse(token).user.id,
  298. InterviewUserId: JSON.parse(token).user.id,
  299. });
  300. } else {
  301. data = await addInterview({
  302. ...this.form,
  303. status: e,
  304. createdBy: JSON.parse(token).user.id,
  305. InterviewUserId: JSON.parse(token).user.id,
  306. });
  307. }
  308. if (data.code == 200) {
  309. if (e == 1) {
  310. this.$emit("changeActive");
  311. this.$showToast("提交成功");
  312. this.form = { ...form };
  313. }
  314. if (e == 0) {
  315. this.$showToast("保存成功");
  316. }
  317. }
  318. },
  319. getCompany(e) {
  320. this.form.companyIndex = e.detail.value;
  321. this.form.companyId = this.companyAllList[e.detail.value].value;
  322. },
  323. chosseAboutCompany() {
  324. this.show = true;
  325. // this.$refs.popup.open('top')
  326. },
  327. async getCompanyAll() {
  328. let companyAllList = await getCompanyAll();
  329. this.companyAllList = companyAllList.map((e) => {
  330. return {
  331. label: e.qymc,
  332. value: e.id,
  333. };
  334. });
  335. this.getBySaveStatus();
  336. },
  337. async getByCodes() {
  338. let data = await getByCodes(JSON.stringify(this.dic_key));
  339. this.dic_SelectList = this.$common.handleDicList(data);
  340. this.dic_SelectList.interviewType[0].id;
  341. },
  342. confirm(e) {
  343. let associationCompanyString = [];
  344. let associationCompany = [];
  345. for (var p in e) {
  346. associationCompanyString.push(e[p].label);
  347. associationCompany.push(e[p].value);
  348. }
  349. this.form.associationCompanyString = associationCompanyString.join(",");
  350. this.form.associationCompany = associationCompany.join(",");
  351. },
  352. bindPickerChange(e) {
  353. this.form.interviewTypeIndex = e.detail.value;
  354. this.form.interviewType =
  355. this.dic_SelectList.interviewType[e.detail.value].value;
  356. },
  357. },
  358. // onLoad: function (){
  359. // this.$refs.findYuanQuList()
  360. // },
  361. };
  362. </script>
  363. <style lang="scss">
  364. .btn-view {
  365. width: 100%;
  366. height: 100rpx;
  367. padding: 20rpx 10%;
  368. background-color: #ffffff;
  369. position: fixed;
  370. bottom: 0;
  371. left: 0;
  372. }
  373. .btn {
  374. width: 40%;
  375. height: 90rpx;
  376. border-radius: 8rpx 8rpx 8rpx 8rpx;
  377. background: #1d18bc;
  378. line-height: 90rpx;
  379. color: white;
  380. float: left;
  381. }
  382. .gaisideshurukuang {
  383. font-size: 26rpx !important;
  384. .is-input-border {
  385. border-top: none !important;
  386. border-left: none !important;
  387. border-right: none !important;
  388. border: none;
  389. border-radius: 0 !important;
  390. }
  391. .uni-forms-item {
  392. border-bottom: 2rpx solid #cccccc !important;
  393. margin-top: 42rpx !important;
  394. padding-bottom: 42rpx !important;
  395. }
  396. .uni-forms-item__content {
  397. border-bottom: 2rpx solid #cccccc !important;
  398. }
  399. }
  400. .goreport {
  401. .textarea_info {
  402. textarea {
  403. background: #f9f9f9;
  404. }
  405. }
  406. .form {
  407. width: calc(100% - 128rpx);
  408. margin: 32rpx;
  409. background: #ffffff;
  410. padding: 32rpx;
  411. .label {
  412. height: 53rpx;
  413. line-height: 53rpx;
  414. }
  415. .is-input-border {
  416. border-top: none !important;
  417. border-left: none !important;
  418. border-right: none !important;
  419. border-radius: 0 !important;
  420. }
  421. .uni-forms-item {
  422. border-bottom: 2rpx solid #cccccc !important;
  423. margin-top: 42rpx !important;
  424. padding-bottom: 42rpx !important;
  425. }
  426. }
  427. }
  428. </style>