detail.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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="getCurrentLocal()"
  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="true"
  119. :max-count="6"
  120. :file-list="form.infoMorePictureUrlList"
  121. @after-read="uploadRYXXZP"
  122. />
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="save_button" @click="save()" v-if="id == null">保存</div>
  128. </div>
  129. <select-dengjiyuan
  130. ref="selectDengjiyuan"
  131. :multiple="false"
  132. :range="range"
  133. :selectParent="false"
  134. :foldAll="true"
  135. rangeKey="name"
  136. idKey="id"
  137. @selectDengjiyuan="selectDengjiyuan"
  138. />
  139. <uni-file-picker v-show="false" ref="files" :auto-upload="false" />
  140. <multiple-select
  141. v-model="show"
  142. :data="companyAllList"
  143. :default-selected="defaultSelected"
  144. @confirm="confirm"
  145. ></multiple-select>
  146. </div>
  147. </template>
  148. <script>
  149. var QQMapWX = require("./txmap_sdk/qqmap-wx-jssdk");
  150. var qqmapsdk;
  151. const form = {
  152. infoMorePictureUrlList: [],
  153. testTypeIndex: 0,
  154. year: "2023",
  155. carDate: "2023-06-30",
  156. remark: "",
  157. checkInfo: "",
  158. updateAddressY: "",
  159. updateAddressX: "",
  160. updateAddress: "",
  161. };
  162. import multipleSelect from "../../subPackages/components/momo-multipleSelect/momo-multipleSelect";
  163. import selectDengjiyuan from "../../subPackages/components/select_dengjiyuan/tkitree.vue";
  164. import tools from "../../subPackages/components/tkitree/tools.js";
  165. import {
  166. getSelectUserTwo,
  167. getSelectDeptTwo,
  168. getByCodes,
  169. getUserLocalStorageInfo,
  170. addRectificationManagement,
  171. findRectificationManagementInOutById,
  172. } from "@/js_sdk/http";
  173. export default {
  174. components: {
  175. multipleSelect,
  176. selectDengjiyuan,
  177. },
  178. data() {
  179. return {
  180. id: null,
  181. BASE_URI: this.$constant.BASE_URI,
  182. companyAllList: [],
  183. defaultSelected: [],
  184. show: false,
  185. bizhongIndex: 0,
  186. testList: [
  187. { label: "类型1", value: 1 },
  188. { label: "类型2", value: 2 },
  189. { label: "类型3", value: 3 },
  190. { label: "类型4", value: 4 },
  191. { label: "类型5", value: 5 },
  192. { label: "类型6", value: 6 },
  193. { label: "类型7", value: 7 },
  194. { label: "类型8", value: 8 },
  195. ],
  196. settleInTypeIndex: 0,
  197. range: [],
  198. zaitiList: [],
  199. imageStyles: {},
  200. listStyles: {},
  201. fileLists: [],
  202. activeNames: [],
  203. StatusBar: 0,
  204. dic_key: ["rectification_management_update_type"],
  205. dic_SelectList: {},
  206. search: {
  207. pageSize: 10,
  208. pageNum: 1,
  209. },
  210. form: { ...form },
  211. companyAllList: [],
  212. value: ["0"],
  213. modeIndex: -1,
  214. styleIndex: -1,
  215. current: 0,
  216. mode: "default",
  217. dotsStyles: {},
  218. swiperDotIndex: 0,
  219. };
  220. },
  221. onLoad(option) {
  222. this.getByCodes();
  223. this.id = option.id !== "null" ? option.id : null;
  224. this.form.createdBy = getUserLocalStorageInfo().user.id;
  225. // qqmapsdk = new QQMapWX({
  226. // key: "OJ7BZ-ULH6V-XBLPV-ULIMK-APS3H-QHFIP",
  227. // });
  228. // this.getCurrentLocal();
  229. },
  230. onShow() {},
  231. methods: {
  232. selectDengjiyuan(e) {
  233. this.form.finishUserName = e[e.length - 1].name;
  234. this.form.finishUser = e[e.length - 1].id;
  235. this.$forceUpdate();
  236. },
  237. async getSelectUserTwo(key) {
  238. let that = this;
  239. let departmentList = await getSelectUserTwo("");
  240. that.range = tools.transData(
  241. departmentList.data,
  242. "id",
  243. "parentid",
  244. "children"
  245. );
  246. console.log(key);
  247. that.$refs[key]._show();
  248. },
  249. getCurrentLocal() {
  250. let that = this;
  251. qqmapsdk.reverseGeocoder({
  252. success: function (res) {
  253. that.form.updateAddressX = res.result.location.lng;
  254. that.form.updateAddressY = res.result.location.lat;
  255. that.form.updateAddress =
  256. res.result.formatted_addresses.standard_address;
  257. },
  258. });
  259. },
  260. async findRectificationManagementInOutById() {
  261. let that = this;
  262. try {
  263. if (that.id != null) {
  264. let detail = await findRectificationManagementInOutById(that.id);
  265. that.form = detail;
  266. if (detail.infoMorePictureUrl.length != 0) {
  267. let infoMorePictureUrlList = detail.infoMorePictureUrl.split(",");
  268. that.form.infoMorePictureUrlList = infoMorePictureUrlList.map(
  269. (e) => {
  270. return {
  271. name: e,
  272. imgUrl: "/FileController/download/" + e,
  273. url:
  274. that.$constant.BASE_URI + "/FileController/download/" + e,
  275. isImage: true,
  276. };
  277. }
  278. );
  279. console.log(that.form.infoMorePictureUrlList);
  280. }
  281. let index =
  282. that.dic_SelectList.rectification_management_update_type.findIndex(
  283. (e) => e.value == detail.updateType
  284. );
  285. if (index != -1) {
  286. that.form.testTypeIndex = index;
  287. that.form.updateType =
  288. that.rectification_management_update_type[index].value;
  289. }
  290. }
  291. } catch (error) {}
  292. },
  293. selectYear(event) {
  294. this.form.attributiveYear = event.detail.value;
  295. this.$forceUpdate();
  296. },
  297. selectCarDate(event) {
  298. this.form.finishTime = event.detail.value;
  299. this.$forceUpdate();
  300. },
  301. bindPickerChange: function (e) {
  302. console.log("picker发送选择改变,携带值为", e.detail);
  303. this.form.testTypeIndex = e.detail.value;
  304. this.form.updateType =
  305. this.dic_SelectList.rectification_management_update_type[
  306. e.detail.value
  307. ].value;
  308. },
  309. uploadRYXXZP(event) {
  310. let that = this;
  311. const { file } = event.detail;
  312. uni.uploadFile({
  313. url: that.$constant.BASE_URI + "/wx/fileController/upload",
  314. filePath: file.url,
  315. name: "file",
  316. formData: { user: "test" },
  317. success(res) {
  318. // 上传完成需要更新 fileList
  319. let data = JSON.parse(res.data);
  320. that.form.infoMorePictureUrlList.push({
  321. imgUrl: "/FileController/download/" + data.data[0],
  322. id: data.data[0],
  323. url:
  324. that.$constant.BASE_URI +
  325. "/FileController/download/" +
  326. data.data[0],
  327. isImage: true,
  328. });
  329. },
  330. fail(res) {},
  331. });
  332. },
  333. confirm(e) {
  334. var associationCompanyString = [];
  335. var associationCompany = [];
  336. for (var p in e) {
  337. associationCompanyString.push(e[p].label);
  338. associationCompany.push(e[p].value);
  339. }
  340. this.form.associationCompanyString = associationCompanyString.join(",");
  341. this.form.associationCompany = associationCompany.join(",");
  342. },
  343. deleteRYXXZP(event) {
  344. this.form.infoMorePictureUrlList.splice(event.detail.index, 1);
  345. },
  346. async getByCodes() {
  347. let data = await getByCodes(JSON.stringify(this.dic_key));
  348. this.dic_SelectList = this.$common.handleDicList(data);
  349. this.form.updateType =
  350. this.dic_SelectList.rectification_management_update_type[0].value;
  351. this.findRectificationManagementInOutById();
  352. console.log(this.form.updateType);
  353. },
  354. // /wx/SaleController/findRoomInfoListByIds
  355. async findRoomInfoListByIds() {
  356. let data = await findRoomInfoListByIds(ids);
  357. return data;
  358. },
  359. async getSelectDeptTwo(key) {
  360. let that = this;
  361. let departmentList = await getSelectDeptTwo("");
  362. that.range = tools.transData(
  363. departmentList.data,
  364. "id",
  365. "parentid",
  366. "children"
  367. );
  368. that.$refs[key]._show();
  369. },
  370. binddata() {},
  371. submit() {},
  372. async save() {
  373. let that = this;
  374. // let infoMorePictureUrlList = JSON.stringify(that.form.infoMorePictureUrlList);
  375. let infoMorePictureUrl;
  376. if (that.form.infoMorePictureUrlList > 0) {
  377. let infoMorePictureUrlString = that.form.infoMorePictureUrlList.map(
  378. (e) => {
  379. return e.id;
  380. }
  381. );
  382. infoMorePictureUrl = infoMorePictureUrlString.toString();
  383. } else {
  384. infoMorePictureUrl = "";
  385. }
  386. let form = { ...this.form };
  387. form.infoMorePictureUrl = infoMorePictureUrl;
  388. form.openUser = getUserLocalStorageInfo().user.id;
  389. let data = await addRectificationManagement(form);
  390. if (data.code == 200) {
  391. this.$showToast("新增成功");
  392. uni.navigateBack({});
  393. }
  394. },
  395. chossseFile() {
  396. this.$refs.files.upload();
  397. },
  398. onChange(event) {
  399. this.activeNames = event.detail;
  400. },
  401. },
  402. };
  403. </script>
  404. <style scoped lang="scss" scpoed>
  405. .save_button {
  406. width: calc(100% - 64rpx);
  407. margin: 64rpx 32rpx 0 32rpx;
  408. background: #1d18bc;
  409. border-radius: 50rpx;
  410. height: 88rpx;
  411. color: white;
  412. text-align: center;
  413. line-height: 88rpx;
  414. }
  415. .form {
  416. width: calc(100% - 64rpx);
  417. background: #ffffff;
  418. padding: 32rpx;
  419. margin-top: 64rpx;
  420. .label {
  421. height: 53rpx;
  422. line-height: 53rpx;
  423. }
  424. }
  425. .form_row {
  426. height: 40rpx;
  427. font-weight: 400;
  428. font-size: 24rpx;
  429. }
  430. .zaiti_list {
  431. width: 100%;
  432. height: 50rpx;
  433. line-height: 50rpx;
  434. }
  435. .idclass {
  436. width: 147rpx;
  437. height: 100rpx;
  438. }
  439. .dengjibutton {
  440. margin-top: 24rpx;
  441. margin-left: 60rpx;
  442. margin-right: 60rpx;
  443. width: calc(100% - 120rpx);
  444. height: 60rpx;
  445. text-align: center;
  446. background: #1d18bc;
  447. color: white;
  448. line-height: 60rpx;
  449. }
  450. .addcompany {
  451. margin-bottom: 200rpx;
  452. }
  453. .addcompany {
  454. .detailstitle {
  455. height: 42rpx;
  456. font-size: 30rpx;
  457. font-weight: 500;
  458. color: #333333;
  459. padding-bottom: 16rpx;
  460. }
  461. .typestitle {
  462. height: 42rpx;
  463. font-size: 24rpx;
  464. font-weight: 500;
  465. padding-bottom: 16rpx;
  466. margin-bottom: 16rpx;
  467. }
  468. }
  469. </style>
  470. <style lang="scss">
  471. ::v-deep .is-open + .uni-collapse-item__wrap {
  472. height: auto !important;
  473. }
  474. ::v-deep .uni-collapse-item__wrap-content {
  475. height: auto !important;
  476. }
  477. .pageconfig {
  478. background: #ffffff;
  479. padding: 32rpx;
  480. }
  481. .input_title {
  482. width: 40%;
  483. font-size: 28rpx;
  484. height: 40rpx;
  485. line-height: 40rpx;
  486. color: #333333;
  487. }
  488. .input_value {
  489. width: 60%;
  490. font-size: 28rpx;
  491. height: 40rpx;
  492. line-height: 40rpx;
  493. color: #777777;
  494. }
  495. .uni-collapse-item__title-box {
  496. padding: 0 !important;
  497. }
  498. .uni-collapse-item__title-text {
  499. color: #1d18bc !important;
  500. font-size: 32rpx !important;
  501. }
  502. </style>
  503. <style lang="scss">
  504. .example-body {
  505. padding: 10px;
  506. padding-top: 0;
  507. }
  508. .custom-image-box {
  509. /* #ifndef APP-NVUE */
  510. display: flex;
  511. /* #endif */
  512. flex-direction: row;
  513. justify-content: space-between;
  514. align-items: center;
  515. }
  516. .text {
  517. font-size: 14px;
  518. color: #333;
  519. }
  520. .uni-file-picker__item {
  521. display: none;
  522. }
  523. .uploadbutton {
  524. width: 162rpx;
  525. height: 44rpx;
  526. }
  527. </style>