report.vue 20 KB

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