add.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. <template>
  2. <div class="addcompany">
  3. <div class="list">
  4. <div class="list-row" style="padding-top: 0">
  5. <div style="height: auto" class="width100">
  6. <div class="width100 mt24rpx padb24rpx border_bottom_ccc list_date">
  7. <div class="input_title float_left">
  8. <span style="color: red">*&nbsp;</span>安全检查类型
  9. </div>
  10. <div
  11. class="float_left width60 whitespacenowrap first_title height50rpx font28rpx"
  12. style="color: #777"
  13. >
  14. <picker
  15. :disabled="id != null"
  16. style="input_value float_left"
  17. @change="bindPickerChange"
  18. :value="form.testTypeIndex"
  19. :range="dic_SelectList.rectification_management_update_type"
  20. range-key="label"
  21. >
  22. {{
  23. !dic_SelectList.rectification_management_update_type[
  24. form.testTypeIndex
  25. ].label
  26. ? "未知类型"
  27. : dic_SelectList.rectification_management_update_type[
  28. form.testTypeIndex
  29. ].label
  30. }}
  31. </picker>
  32. </div>
  33. <textarea
  34. :disabled="id != null"
  35. v-model="form.info"
  36. :maxlength="2000"
  37. placeholder="请输入"
  38. type="textarea"
  39. style="
  40. height: 200rpx;
  41. background: rgba(249, 249, 249, 1);
  42. padding: 20rpx;
  43. width: calc(100% - 40rpx);
  44. "
  45. />
  46. <div
  47. style="
  48. background: rgba(249, 249, 249, 1);
  49. text-align: right;
  50. padding-right: 10px;
  51. padding-bottom: 10rpx;
  52. "
  53. >
  54. {{ form.checkInfo.length }}/2000
  55. </div>
  56. </div>
  57. <div
  58. class="width100 mt24rpx padb24rpx border_bottom_ccc list_date display_flex"
  59. style="display: flex"
  60. >
  61. <div class="input_title float_left">
  62. <span style="color: red">*&nbsp;</span>
  63. 整改位置
  64. </div>
  65. <div
  66. @click="getAuth()"
  67. class="float_left width60 first_title font28rpx"
  68. style="color: #777; height: auto"
  69. >
  70. <div
  71. style="color: #777; height: auto; width: 80%"
  72. class="float_left input_value"
  73. >
  74. {{ form.updateAddress }}
  75. </div>
  76. </div>
  77. </div>
  78. <div
  79. @click="getSelectUserTwo('selectDengjiyuan')"
  80. class="width100 mt24rpx padb24rpx border_bottom_ccc list_date height40rpx"
  81. >
  82. <div class="input_title float_left">
  83. <span style="color: red">*</span>
  84. 处理人
  85. </div>
  86. <view style="color: #777" class="input_value float_left">
  87. {{ !form.finishUserName ? "请选择" : form.finishUserName }}
  88. </view>
  89. </div>
  90. <div
  91. class="width100 mt24rpx padb24rpx border_bottom_ccc list_date height40rpx"
  92. >
  93. <div class="input_title float_left">要求完成日期</div>
  94. <div
  95. class="float_left width60 whitespacenowrap first_title height50rpx font28rpx"
  96. style="color: #777"
  97. >
  98. <picker
  99. :disabled="id != null"
  100. mode="date"
  101. @change="selectCarDate"
  102. >
  103. {{ form.finishTime ? form.finishTime : "请选择" }}
  104. </picker>
  105. </div>
  106. </div>
  107. <div
  108. class="width100 mt24rpx border_bottom_ccc list_date height300rpx"
  109. style="height: 270rpx"
  110. >
  111. <div class="input_title">整改处理前照片</div>
  112. <div style="margin-top: 24rpx">(支持图片上传10M内,最多6张)</div>
  113. <div
  114. class="custom-image-box"
  115. style="margin-top: 20rpx; margin-bottom: 36rpx"
  116. >
  117. <van-uploader
  118. :disabled="id != null"
  119. :max-count="12"
  120. @delete="deleteRYXXZP"
  121. :file-list="form.infoMorePictureUrlList"
  122. @after-read="uploadRYXXZP"
  123. :show-upload="true"
  124. />
  125. </div>
  126. </div>
  127. </div>
  128. </div>
  129. <div class="save_button" @click="save()" v-if="id == null">保存</div>
  130. </div>
  131. <select-dengjiyuan
  132. ref="selectDengjiyuan"
  133. :multiple="false"
  134. :range="range"
  135. :selectParent="false"
  136. :foldAll="true"
  137. rangeKey="name"
  138. idKey="id"
  139. @selectDengjiyuan="selectDengjiyuan"
  140. />
  141. <uni-file-picker v-show="false" ref="files" :auto-upload="false" />
  142. <multiple-select
  143. v-model="show"
  144. :data="companyAllList"
  145. :default-selected="defaultSelected"
  146. @confirm="confirm"
  147. ></multiple-select>
  148. </div>
  149. </template>
  150. <script>
  151. var QQMapWX = require("./txmap_sdk/qqmap-wx-jssdk");
  152. var qqmapsdk;
  153. const form = {
  154. infoMorePictureUrlList: [],
  155. testTypeIndex: 0,
  156. year: "2023",
  157. carDate: "2023-06-30",
  158. remark: "",
  159. checkInfo: "",
  160. updateAddressY: "",
  161. updateAddressX: "",
  162. updateAddress: "",
  163. };
  164. import multipleSelect from "../../subPackages/components/momo-multipleSelect/momo-multipleSelect";
  165. import selectDengjiyuan from "../../subPackages/components/select_dengjiyuan/tkitree.vue";
  166. import tools from "../../subPackages/components/tkitree/tools.js";
  167. import {
  168. getSelectUserTwo,
  169. getSelectDeptTwo,
  170. getByCodes,
  171. getUserLocalStorageInfo,
  172. addRectificationManagement,
  173. findSafetySelfCheckingManagetById,
  174. } from "@/js_sdk/http";
  175. export default {
  176. components: {
  177. multipleSelect,
  178. selectDengjiyuan,
  179. },
  180. data() {
  181. return {
  182. id: null,
  183. BASE_URI: this.$constant.BASE_URI,
  184. companyAllList: [],
  185. defaultSelected: [],
  186. show: false,
  187. bizhongIndex: 0,
  188. testList: [
  189. { label: "类型1", value: 1 },
  190. { label: "类型2", value: 2 },
  191. { label: "类型3", value: 3 },
  192. { label: "类型4", value: 4 },
  193. { label: "类型5", value: 5 },
  194. { label: "类型6", value: 6 },
  195. { label: "类型7", value: 7 },
  196. { label: "类型8", value: 8 },
  197. ],
  198. settleInTypeIndex: 0,
  199. range: [],
  200. zaitiList: [],
  201. imageStyles: {},
  202. listStyles: {},
  203. fileLists: [],
  204. activeNames: [],
  205. StatusBar: 0,
  206. dic_key: ["rectification_management_update_type"],
  207. dic_SelectList: {},
  208. search: {
  209. pageSize: 10,
  210. pageNum: 1,
  211. },
  212. form: { ...form },
  213. companyAllList: [],
  214. value: ["0"],
  215. modeIndex: -1,
  216. styleIndex: -1,
  217. current: 0,
  218. mode: "default",
  219. dotsStyles: {},
  220. swiperDotIndex: 0,
  221. };
  222. },
  223. onLoad(option) {
  224. this.getByCodes();
  225. this.id = option.id !== "null" ? option.id : null;
  226. this.form.createdBy = getUserLocalStorageInfo().user.id;
  227. qqmapsdk = new QQMapWX({
  228. key: "OJ7BZ-ULH6V-XBLPV-ULIMK-APS3H-QHFIP",
  229. });
  230. this.getCurrentLocal();
  231. },
  232. onShow() {},
  233. methods: {
  234. getAuth() {
  235. wx.showModal({
  236. title: "是否授权当前位置",
  237. content: "需要获取您的地理位置,请确认授权,否则无法获取您所需数据",
  238. success: function (res) {
  239. if (res.cancel) {
  240. that.setData({
  241. isshowCIty: false,
  242. });
  243. wx.showToast({
  244. title: "授权失败",
  245. icon: "success",
  246. duration: 1000,
  247. });
  248. }
  249. },
  250. });
  251. },
  252. selectDengjiyuan(e) {
  253. this.form.finishUserName = e[e.length - 1].name;
  254. this.form.finishUser = e[e.length - 1].id;
  255. this.$forceUpdate();
  256. },
  257. async getSelectUserTwo(key) {
  258. let that = this;
  259. let departmentList = await getSelectUserTwo("");
  260. that.range = tools.transData(
  261. departmentList.data,
  262. "id",
  263. "parentid",
  264. "children"
  265. );
  266. console.log(key);
  267. that.$refs[key]._show();
  268. },
  269. getCurrentLocal() {
  270. let that = this;
  271. qqmapsdk.reverseGeocoder({
  272. success(res) {
  273. that.form.updateAddressX = res.result.location.lng;
  274. that.form.updateAddressY = res.result.location.lat;
  275. that.form.updateAddress =
  276. res.result.formatted_addresses.standard_address;
  277. },
  278. });
  279. },
  280. async findSafetySelfCheckingManagetById() {
  281. let that = this;
  282. if (that.id != null) {
  283. let detail = await findSafetySelfCheckingManagetById(that.id);
  284. that.form = detail;
  285. let index =
  286. that.dic_SelectList.rectification_management_update_type.findIndex(
  287. (e) => e.value == detail.type
  288. );
  289. if (index != -1) {
  290. that.form.testTypeIndex = index;
  291. that.form.updateType =
  292. that.rectification_management_update_type[index].value;
  293. }
  294. console.log(JSON.parse(detail.infoMorePictureUrlList));
  295. that.form.infoMorePictureUrlList = JSON.parse(
  296. detail.infoMorePictureUrlList
  297. );
  298. }
  299. },
  300. selectYear(event) {
  301. this.form.attributiveYear = event.detail.value;
  302. this.$forceUpdate();
  303. },
  304. selectCarDate(event) {
  305. this.form.finishTime = event.detail.value;
  306. this.$forceUpdate();
  307. },
  308. bindPickerChange: function (e) {
  309. console.log("picker发送选择改变,携带值为", e.detail);
  310. this.form.testTypeIndex = e.detail.value;
  311. this.form.updateType =
  312. this.dic_SelectList.rectification_management_update_type[
  313. e.detail.value
  314. ].value;
  315. },
  316. uploadRYXXZP(event) {
  317. let that = this;
  318. const { file } = event.detail;
  319. uni.uploadFile({
  320. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  321. filePath: file.url,
  322. name: "file",
  323. formData: { user: "test" },
  324. success(res) {
  325. // 上传完成需要更新 fileList
  326. let data = JSON.parse(res.data);
  327. that.form.infoMorePictureUrlList.push({
  328. imgUrl: "/FileController/download/" + data.data[0],
  329. id: data.data[0],
  330. url:
  331. that.$constant.BASE_URI +
  332. "/FileController/download/" +
  333. data.data[0],
  334. isImage: true,
  335. });
  336. },
  337. fail(res) {},
  338. });
  339. },
  340. confirm(e) {
  341. var associationCompanyString = [];
  342. var associationCompany = [];
  343. for (var p in e) {
  344. associationCompanyString.push(e[p].label);
  345. associationCompany.push(e[p].value);
  346. }
  347. this.form.associationCompanyString = associationCompanyString.join(",");
  348. this.form.associationCompany = associationCompany.join(",");
  349. },
  350. deleteRYXXZP(event) {
  351. this.form.infoMorePictureUrlList.splice(event.detail.index, 1);
  352. },
  353. async getByCodes() {
  354. let data = await getByCodes(JSON.stringify(this.dic_key));
  355. this.dic_SelectList = this.$common.handleDicList(data);
  356. this.form.updateType =
  357. this.dic_SelectList.rectification_management_update_type[0].value;
  358. this.findSafetySelfCheckingManagetById();
  359. // console.log(this.form.updateType);
  360. },
  361. // /wx/SaleController/findRoomInfoListByIds
  362. async findRoomInfoListByIds() {
  363. let data = await findRoomInfoListByIds(ids);
  364. return data;
  365. },
  366. async getSelectDeptTwo(key) {
  367. let that = this;
  368. let departmentList = await getSelectDeptTwo("");
  369. that.range = tools.transData(
  370. departmentList.data,
  371. "id",
  372. "parentid",
  373. "children"
  374. );
  375. that.$refs[key]._show();
  376. },
  377. binddata() {},
  378. submit() {},
  379. async save() {
  380. let that = this;
  381. if (!that.form.finishUser || that.form.finishUser.length == 0) {
  382. that.$showToast("请选择处理人");
  383. return;
  384. }
  385. // let infoMorePictureUrlList = JSON.stringify(that.form.infoMorePictureUrlList);
  386. let infoMorePictureUrl;
  387. if (that.form.infoMorePictureUrlList.length > 0) {
  388. let infoMorePictureUrlString = that.form.infoMorePictureUrlList.map(
  389. (e) => {
  390. return e.id;
  391. }
  392. );
  393. infoMorePictureUrl = infoMorePictureUrlString.toString();
  394. } else {
  395. infoMorePictureUrl = "";
  396. }
  397. let form = { ...this.form };
  398. form.infoMorePictureUrl = infoMorePictureUrl;
  399. form.openUser = getUserLocalStorageInfo().user.id;
  400. let data = await addRectificationManagement(form);
  401. if (data.code == 200) {
  402. this.$showToast("新增成功");
  403. uni.navigateBack({});
  404. }
  405. },
  406. chossseFile() {
  407. this.$refs.files.upload();
  408. },
  409. onChange(event) {
  410. this.activeNames = event.detail;
  411. },
  412. },
  413. };
  414. </script>
  415. <style scoped lang="scss" scpoed>
  416. .save_button {
  417. width: calc(100% - 64rpx);
  418. margin: 64rpx 32rpx 0 32rpx;
  419. background: #1d18bc;
  420. border-radius: 50rpx;
  421. height: 88rpx;
  422. color: white;
  423. text-align: center;
  424. line-height: 88rpx;
  425. }
  426. .form {
  427. width: calc(100% - 64rpx);
  428. background: #ffffff;
  429. padding: 32rpx;
  430. margin-top: 64rpx;
  431. .label {
  432. height: 53rpx;
  433. line-height: 53rpx;
  434. }
  435. }
  436. .form_row {
  437. height: 40rpx;
  438. font-weight: 400;
  439. font-size: 24rpx;
  440. }
  441. .zaiti_list {
  442. width: 100%;
  443. height: 50rpx;
  444. line-height: 50rpx;
  445. }
  446. .idclass {
  447. width: 147rpx;
  448. height: 100rpx;
  449. }
  450. .dengjibutton {
  451. margin-top: 24rpx;
  452. margin-left: 60rpx;
  453. margin-right: 60rpx;
  454. width: calc(100% - 120rpx);
  455. height: 60rpx;
  456. text-align: center;
  457. background: #1d18bc;
  458. color: white;
  459. line-height: 60rpx;
  460. }
  461. .addcompany {
  462. margin-bottom: 200rpx;
  463. }
  464. .addcompany {
  465. .detailstitle {
  466. height: 42rpx;
  467. font-size: 30rpx;
  468. font-weight: 500;
  469. color: #333333;
  470. padding-bottom: 16rpx;
  471. }
  472. .typestitle {
  473. height: 42rpx;
  474. font-size: 24rpx;
  475. font-weight: 500;
  476. padding-bottom: 16rpx;
  477. margin-bottom: 16rpx;
  478. }
  479. }
  480. </style>
  481. <style lang="scss">
  482. ::v-deep .is-open + .uni-collapse-item__wrap {
  483. height: auto !important;
  484. }
  485. ::v-deep .uni-collapse-item__wrap-content {
  486. height: auto !important;
  487. }
  488. .pageconfig {
  489. background: #ffffff;
  490. padding: 32rpx;
  491. }
  492. .input_title {
  493. width: 40%;
  494. font-size: 28rpx;
  495. height: 40rpx;
  496. line-height: 40rpx;
  497. color: #333333;
  498. }
  499. .input_value {
  500. width: 60%;
  501. font-size: 28rpx;
  502. height: 40rpx;
  503. line-height: 40rpx;
  504. color: #777777;
  505. }
  506. .uni-collapse-item__title-box {
  507. padding: 0 !important;
  508. }
  509. .uni-collapse-item__title-text {
  510. color: #1d18bc !important;
  511. font-size: 32rpx !important;
  512. }
  513. </style>
  514. <style lang="scss">
  515. .example-body {
  516. padding: 10px;
  517. padding-top: 0;
  518. }
  519. .custom-image-box {
  520. /* #ifndef APP-NVUE */
  521. display: flex;
  522. /* #endif */
  523. flex-direction: row;
  524. justify-content: space-between;
  525. align-items: center;
  526. }
  527. .text {
  528. font-size: 14px;
  529. color: #333;
  530. }
  531. .uni-file-picker__item {
  532. display: none;
  533. }
  534. .uploadbutton {
  535. width: 162rpx;
  536. height: 44rpx;
  537. }
  538. </style>