addplan.vue 12 KB

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