addplan.vue 12 KB

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