index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  1. <template>
  2. <div class="addcompany">
  3. <div class="form">
  4. <div
  5. class="form_row pdt32 pdb32 border_bottom_ccc width100"
  6. style="display: flex; height: auto; align-items: center"
  7. @click="openZaitiTree()"
  8. >
  9. <div class="width30 first_title" style="height: auto">关联载体</div>
  10. <div style="width: 65%; color: #777" class="float_left font28rpx">
  11. {{ form.socialCarrierName ? form.socialCarrierName : "请选择" }}
  12. </div>
  13. <img
  14. class="height40rpx width40rpx"
  15. src="../../../static/mine/youjiantou.png"
  16. alt=""
  17. />
  18. </div>
  19. <div
  20. class="form_row pdt32 pdb32 border_bottom_ccc width100"
  21. style="display: flex; height: auto; align-items: center"
  22. >
  23. <div class="width30 first_title" style="height: auto">区域</div>
  24. <div style="width: 65%" class="float_left font28rpx color292d98">
  25. <picker
  26. style="float: left; width: 360rpx; height: 40rpx; color: #777"
  27. @change="getLcmcqyIndex"
  28. :range="lcqymcList"
  29. >
  30. <div style="width: 315rpx; float: left">
  31. {{ lcqymcIndex != null ? lcqymcList[lcqymcIndex] : "请选择" }}
  32. </div>
  33. </picker>
  34. </div>
  35. <img
  36. class="height40rpx width40rpx"
  37. src="../../../static/mine/youjiantou.png"
  38. alt=""
  39. />
  40. </div>
  41. <div
  42. class="form_row pdt32 pdb32 border_bottom_ccc width100"
  43. style="display: flex; height: auto; align-items: center"
  44. >
  45. <div class="width30 first_title" style="height: auto">楼层</div>
  46. <div style="width: 65%" class="float_left font28rpx color292d98">
  47. <picker
  48. style="float: left; width: 360rpx; height: 40rpx; color: #777"
  49. @change="getLcmcIndex"
  50. :range="lcmcList"
  51. >
  52. <div style="width: 315rpx; float: left">
  53. {{ lcmcIndex != null ? lcmcList[lcmcIndex] : "请选择" }}
  54. </div>
  55. </picker>
  56. </div>
  57. <img
  58. class="height40rpx width40rpx"
  59. src="../../../static/mine/youjiantou.png"
  60. alt=""
  61. />
  62. </div>
  63. <div
  64. class="form_row pdt32 pdb32 border_bottom_ccc width100"
  65. style="display: flex; height: auto; align-items: center"
  66. >
  67. <div class="width30 first_title" style="height: auto">房间号</div>
  68. <div style="width: 65%" class="float_left font28rpx color292d98">
  69. <input
  70. style="color: #777"
  71. class="input_value float_left"
  72. placeholder="请输入"
  73. v-model="form.roomNo"
  74. />
  75. </div>
  76. </div>
  77. <div
  78. class="form_row pdt32 pdb32 border_bottom_ccc width100"
  79. style="display: flex; height: auto; align-items: center"
  80. >
  81. <div class="width30 first_title" style="height: auto">面积</div>
  82. <div style="width: 65%" class="float_left font28rpx color292d98">
  83. <input
  84. style="color: #777"
  85. class="input_value float_left"
  86. placeholder="请输入"
  87. v-model="form.size"
  88. />
  89. </div>
  90. </div>
  91. </div>
  92. <div class="save_button" @click="save()">保存</div>
  93. <!-- 载体树 -->
  94. <zaiti-tree2
  95. ref="zaitiTree"
  96. :multiple="false"
  97. :range="range"
  98. :selectParent="false"
  99. :foldAll="true"
  100. rangeKey="label"
  101. idKey="id"
  102. @confirm="selectZaiti"
  103. />
  104. </div>
  105. </template>
  106. <script>
  107. const form = {
  108. socialCarrierName: "",
  109. };
  110. import zaitiTree2 from "@/components/zaiti-tree2/index.vue";
  111. import tools from "../../subPackages/components/tkitree/tools.js";
  112. import { getTreeData2, getBuildDetails, addZaiti } from "@/js_sdk/http";
  113. export default {
  114. components: {
  115. zaitiTree2,
  116. },
  117. data() {
  118. return {
  119. parentId1: "",
  120. parentId2: "",
  121. lcmcIndex: null,
  122. lcqymcIndex: null,
  123. range: [],
  124. zaitiList: [],
  125. imageStyles: {},
  126. listStyles: {},
  127. fileLists: [],
  128. activeNames: [],
  129. StatusBar: 0,
  130. lcmcList: [],
  131. lcqymcList: [],
  132. search: {
  133. pageSize: 10,
  134. pageNum: 1,
  135. },
  136. form: { ...form },
  137. };
  138. },
  139. onLoad() {},
  140. onShow() {},
  141. methods: {
  142. async save() {
  143. let form = {
  144. floor: this.lcmcList[this.lcmcIndex],
  145. region: this.lcqymcList[this.lcqymcIndex],
  146. groudId: this.form.socialCarrierStr,
  147. discId: this.parentId1,
  148. buildId: this.parentId2,
  149. size: this.form.size,
  150. roomNo: this.form.roomNo,
  151. };
  152. let data = await addZaiti(form);
  153. if (data.code == 200) {
  154. uni.navigateBack({});
  155. this.$showToast("载体创建成功");
  156. }
  157. console.log(data);
  158. },
  159. getLcmcqyIndex(e) {
  160. console.log(Number(e.detail.value));
  161. this.lcqymcIndex = Number(e.detail.value);
  162. console.log(this.lcqymcIndex);
  163. },
  164. getLcmcIndex(e) {
  165. console.log(Number(e.detail.value));
  166. this.lcmcIndex = Number(e.detail.value);
  167. console.log(this.lcmcIndex);
  168. },
  169. async openZaitiTree() {
  170. console.log(123123);
  171. try {
  172. let that = this;
  173. let departmentList = await getTreeData2("");
  174. that.range = tools.transData(
  175. departmentList.data,
  176. "id",
  177. "parentid",
  178. "children"
  179. );
  180. that.$refs.zaitiTree._show();
  181. } catch (error) {
  182. console.log(error);
  183. }
  184. },
  185. async selectZaiti(e) {
  186. if (!e[0].parentId1 || !e[0].parentId1) {
  187. this.$showToast("关联载体结构不完整请重新选择");
  188. return;
  189. }
  190. this.lcmcIndex = null;
  191. this.lcqymcIndex = null;
  192. console.log("selectZaitiselectZaitiselectZaiti", e);
  193. this.form.socialCarrierStr = e[0].id;
  194. this.form.socialCarrierName = e[0].label;
  195. this.parentId1 = e[0].parentId1;
  196. this.parentId2 = e[0].parentId2;
  197. let data = await getBuildDetails({ id: e[0].id });
  198. this.lcmcList = data.lcmc.split(",");
  199. this.lcqymcList = data.lcqymc.split(",");
  200. },
  201. },
  202. };
  203. </script>
  204. <style scoped lang="scss" scpoed>
  205. .save_button {
  206. width: calc(100% - 64rpx);
  207. margin: 64rpx 32rpx 0 32rpx;
  208. background: #1d18bc;
  209. border-radius: 50rpx;
  210. height: 88rpx;
  211. color: white;
  212. text-align: center;
  213. line-height: 88rpx;
  214. }
  215. .form {
  216. width: calc(100% - 64rpx);
  217. background: #ffffff;
  218. padding: 32rpx;
  219. margin-top: 64rpx;
  220. .label {
  221. height: 53rpx;
  222. line-height: 53rpx;
  223. }
  224. }
  225. .form_row {
  226. height: 40rpx;
  227. font-weight: 400;
  228. font-size: 24rpx;
  229. }
  230. .zaiti_list {
  231. width: 100%;
  232. height: 50rpx;
  233. line-height: 50rpx;
  234. }
  235. .idclass {
  236. width: 147rpx;
  237. height: 100rpx;
  238. }
  239. .dengjibutton {
  240. margin-top: 24rpx;
  241. margin-left: 60rpx;
  242. margin-right: 60rpx;
  243. width: calc(100% - 120rpx);
  244. height: 60rpx;
  245. text-align: center;
  246. background: #1d18bc;
  247. color: white;
  248. line-height: 60rpx;
  249. }
  250. .addcompany {
  251. margin-bottom: 200rpx;
  252. }
  253. .addcompany {
  254. .detailstitle {
  255. height: 42rpx;
  256. font-size: 30rpx;
  257. font-weight: 500;
  258. color: #333333;
  259. padding-bottom: 16rpx;
  260. }
  261. .typestitle {
  262. height: 42rpx;
  263. font-size: 24rpx;
  264. font-weight: 500;
  265. padding-bottom: 16rpx;
  266. margin-bottom: 16rpx;
  267. }
  268. }
  269. </style>
  270. <style lang="scss">
  271. ::v-deep .is-open + .uni-collapse-item__wrap {
  272. height: auto !important;
  273. }
  274. ::v-deep .uni-collapse-item__wrap-content {
  275. height: auto !important;
  276. }
  277. .pageconfig {
  278. background: #ffffff;
  279. padding: 32rpx;
  280. }
  281. .input_title {
  282. width: 40%;
  283. font-size: 28rpx;
  284. height: 40rpx;
  285. line-height: 40rpx;
  286. color: #333333;
  287. }
  288. .input_value {
  289. width: 60%;
  290. font-size: 28rpx;
  291. height: 40rpx;
  292. line-height: 40rpx;
  293. color: #777777;
  294. }
  295. .uni-collapse-item__title-box {
  296. padding: 0 !important;
  297. }
  298. .uni-collapse-item__title-text {
  299. color: #1d18bc !important;
  300. font-size: 32rpx !important;
  301. }
  302. </style>
  303. <style lang="scss">
  304. .example-body {
  305. padding: 10px;
  306. padding-top: 0;
  307. }
  308. .custom-image-box {
  309. /* #ifndef APP-NVUE */
  310. display: flex;
  311. /* #endif */
  312. flex-direction: row;
  313. justify-content: space-between;
  314. align-items: center;
  315. }
  316. .text {
  317. font-size: 14px;
  318. color: #333;
  319. }
  320. .uni-file-picker__item {
  321. display: none;
  322. }
  323. .uploadbutton {
  324. width: 162rpx;
  325. height: 44rpx;
  326. }
  327. </style>