goReport.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417
  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. !form.companyId
  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="show = false">取消</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 in filtedCompanyAllList"
  114. style="line-height: 50px; text-align: center"
  115. >{{ item.label }}</view
  116. >
  117. </picker-view-column>
  118. </picker-view>
  119. </van-popup>
  120. <view class="btn-view">
  121. <button class="btn" @click="takeParamsGoBack(0)">保存</button>
  122. <button
  123. class="btn"
  124. @click="takeParamsGoBack(1)"
  125. style="margin-left: 10rpx"
  126. >
  127. 添加
  128. </button>
  129. </view>
  130. </div>
  131. </template>
  132. <script>
  133. import multipleSelect from "../../subPackages/components/momo-multipleSelect/momo-multipleSelect";
  134. import {
  135. getByCodes,
  136. addInterview,
  137. getBySaveStatus,
  138. editInterview,
  139. getCompanyAll,
  140. } from "@/js_sdk/http.js";
  141. import vanRow from "../../../wxcomponents/weapp/dist/row";
  142. import vanCol from "../../../wxcomponents/weapp/dist/col";
  143. // import { findYuanQuList } from "@/js_sdk/http.js";
  144. const form = {
  145. id: null,
  146. isStatus: null,
  147. interviewTime: null,
  148. interviewType: null,
  149. interviewTypeIndex: null,
  150. companyId: null,
  151. companyIndex: null,
  152. projectType: "",
  153. interviewRecord: "",
  154. associationCompanyString: [],
  155. };
  156. export default {
  157. components: {
  158. vanRow,
  159. vanCol,
  160. multipleSelect,
  161. },
  162. data() {
  163. return {
  164. companyName: "",
  165. value: 0,
  166. isSelectedIndex: null,
  167. isStatus: 2,
  168. range: [
  169. { value: 2, text: "是" },
  170. { value: 1, text: "否" },
  171. ],
  172. defaultSelected: [],
  173. dic_key: ["interviewType"],
  174. dic_SelectList: {},
  175. companyIndex: null,
  176. companyAllList: [],
  177. show: false,
  178. active: 0,
  179. form: { ...form },
  180. index: 0,
  181. };
  182. },
  183. computed: {
  184. filtedCompanyAllList() {
  185. let companyAllList;
  186. if (this.companyName) {
  187. companyAllList = this.companyAllList.filter((e) =>
  188. e.label.includes(this.companyName)
  189. );
  190. } else {
  191. companyAllList = this.companyAllList;
  192. }
  193. return companyAllList;
  194. },
  195. },
  196. mounted() {
  197. this.getCompanyAll();
  198. this.getByCodes();
  199. },
  200. methods: {
  201. getRowValue(e) {
  202. this.isSelectedIndex = e.detail.value[0];
  203. },
  204. getSelectValue() {
  205. if (this.isSelectedIndex == null) {
  206. this.form.companyIndex = 0;
  207. this.form.companyId = this.companyAllList[0].value;
  208. } else {
  209. this.form.companyIndex = this.isSelectedIndex;
  210. this.form.companyId = this.companyAllList[this.form.companyIndex].value;
  211. }
  212. this.$forceUpdate();
  213. this.show = false;
  214. },
  215. changeLog(e) {},
  216. async getBySaveStatus() {
  217. const token = uni.getStorageSync("laocui_user_info");
  218. let data = await getBySaveStatus(JSON.parse(token).user.id);
  219. this.form.id = data.id ? data.id : null;
  220. this.form.isStatus = Number(data.isStatus);
  221. this.form.interviewTime = data.interviewTime ? data.interviewTime : "";
  222. this.form.interviewRecord = data.interviewRecord
  223. ? data.interviewRecord
  224. : "";
  225. if (
  226. data.id &&
  227. data.interviewType != null &&
  228. data.interviewType != "null"
  229. ) {
  230. this.getInterviewLableByApiList(data);
  231. }
  232. if (data.id && data.companyId != null) {
  233. this.getCompanyIdByApiList(data);
  234. }
  235. },
  236. getCompanyIdByApiList(params) {
  237. this.form.companyId = params.companyId;
  238. let companyIndex = this.companyAllList.findIndex(
  239. (e) => e.value == params.companyId
  240. );
  241. this.form.companyIndex = companyIndex;
  242. },
  243. getInterviewLableByApiList(params) {
  244. let interviewTypeIndex = this.dic_SelectList.interviewType.findIndex(
  245. (e) => e.value == params.interviewType
  246. );
  247. this.form.interviewType =
  248. this.dic_SelectList.interviewType[interviewTypeIndex].value;
  249. this.form.interviewTypeIndex = interviewTypeIndex;
  250. },
  251. getInterviewTime(e) {
  252. this.form.interviewTime = e.detail.value;
  253. },
  254. async takeParamsGoBack(e) {
  255. const token = uni.getStorageSync("laocui_user_info");
  256. let data;
  257. if (e == 1) {
  258. if (this.form.companyId == null) {
  259. return this.$showToast("请选择走访公司");
  260. }
  261. if (this.form.interviewTime == null || this.form.interviewTime == "") {
  262. return this.$showToast("请选择走访时间");
  263. }
  264. if (this.form.interviewType == null) {
  265. return this.$showToast("请选择走访类型");
  266. }
  267. if (this.form.isStatus == null) {
  268. return this.$showToast("请选择是否需要处理");
  269. }
  270. }
  271. if (e == 0) {
  272. data = await editInterview({
  273. ...this.form,
  274. status: e,
  275. createdBy: JSON.parse(token).user.id,
  276. InterviewUserId: JSON.parse(token).user.id,
  277. });
  278. } else {
  279. data = await addInterview({
  280. ...this.form,
  281. status: e,
  282. createdBy: JSON.parse(token).user.id,
  283. InterviewUserId: JSON.parse(token).user.id,
  284. });
  285. }
  286. if (data.code == 200) {
  287. if (e == 1) {
  288. this.$emit("changeActive");
  289. this.$showToast("提交成功");
  290. this.form = { ...form };
  291. }
  292. if (e == 0) {
  293. this.$showToast("保存成功");
  294. }
  295. }
  296. },
  297. getCompany(e) {
  298. this.form.companyIndex = e.detail.value;
  299. this.form.companyId = this.companyAllList[e.detail.value].value;
  300. },
  301. chosseAboutCompany() {
  302. this.show = true;
  303. // this.$refs.popup.open('top')
  304. },
  305. async getCompanyAll() {
  306. let companyAllList = await getCompanyAll();
  307. this.companyAllList = companyAllList.map((e) => {
  308. return {
  309. label: e.qymc,
  310. value: e.id,
  311. };
  312. });
  313. this.getBySaveStatus();
  314. },
  315. async getByCodes() {
  316. let data = await getByCodes(JSON.stringify(this.dic_key));
  317. this.dic_SelectList = this.$common.handleDicList(data);
  318. this.dic_SelectList.interviewType[0].id;
  319. },
  320. confirm(e) {
  321. let associationCompanyString = [];
  322. let associationCompany = [];
  323. for (var p in e) {
  324. associationCompanyString.push(e[p].label);
  325. associationCompany.push(e[p].value);
  326. }
  327. this.form.associationCompanyString = associationCompanyString.join(",");
  328. this.form.associationCompany = associationCompany.join(",");
  329. },
  330. bindPickerChange(e) {
  331. this.form.interviewTypeIndex = e.detail.value;
  332. this.form.interviewType =
  333. this.dic_SelectList.interviewType[e.detail.value].value;
  334. },
  335. },
  336. // onLoad: function (){
  337. // this.$refs.findYuanQuList()
  338. // },
  339. };
  340. </script>
  341. <style lang="scss">
  342. .btn-view {
  343. width: 100%;
  344. height: 100rpx;
  345. padding: 20rpx 10%;
  346. background-color: #ffffff;
  347. position: fixed;
  348. bottom: 0;
  349. left: 0;
  350. }
  351. .btn {
  352. width: 40%;
  353. height: 90rpx;
  354. border-radius: 8rpx 8rpx 8rpx 8rpx;
  355. background: #1d18bc;
  356. line-height: 90rpx;
  357. color: white;
  358. float: left;
  359. }
  360. .gaisideshurukuang {
  361. font-size: 26rpx !important;
  362. .is-input-border {
  363. border-top: none !important;
  364. border-left: none !important;
  365. border-right: none !important;
  366. border: none;
  367. border-radius: 0 !important;
  368. }
  369. .uni-forms-item {
  370. border-bottom: 2rpx solid #cccccc !important;
  371. margin-top: 42rpx !important;
  372. padding-bottom: 42rpx !important;
  373. }
  374. .uni-forms-item__content {
  375. border-bottom: 2rpx solid #cccccc !important;
  376. }
  377. }
  378. .goreport {
  379. .textarea_info {
  380. textarea {
  381. background: #f9f9f9;
  382. }
  383. }
  384. .form {
  385. width: calc(100% - 128rpx);
  386. margin: 32rpx;
  387. background: #ffffff;
  388. padding: 32rpx;
  389. .label {
  390. height: 53rpx;
  391. line-height: 53rpx;
  392. }
  393. .is-input-border {
  394. border-top: none !important;
  395. border-left: none !important;
  396. border-right: none !important;
  397. border-radius: 0 !important;
  398. }
  399. .uni-forms-item {
  400. border-bottom: 2rpx solid #cccccc !important;
  401. margin-top: 42rpx !important;
  402. padding-bottom: 42rpx !important;
  403. }
  404. }
  405. }
  406. </style>