goReport.vue 11 KB

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