report.vue 15 KB

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