detail.vue 16 KB

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