infoPage.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <!-- 新增/编辑物联设备 -->
  2. <template>
  3. <view id="iotClassification-info-page">
  4. <view class="info-max-big-box">
  5. <view>名称:{{newData.typeName}}</view>
  6. <view>标识:{{newData.typeKey}}</view>
  7. </view>
  8. <view class="top-table-button-box">
  9. <view :class="pageType == 1 ? 'colorA':''" @click="tbaleButton(1)">模型</view>
  10. <view :class="pageType == 2 ? 'colorA':''" @click="tbaleButton(2)">属性</view>
  11. <view :class="pageType == 3 ? 'colorA':''" @click="tbaleButton(3)">功能</view>
  12. </view>
  13. <!-- 模型 -->
  14. <view class="model-max-big-box" v-if="pageType == 1">
  15. <view class="list-max-big-null" v-if="!modelList[0]">暂无数据</view>
  16. <view class="model-for-box" v-for="(item,index) in modelList">
  17. <view class="model-title-box">
  18. <view>名称:{{item.label}}</view>
  19. <view>{{item.required?'必填':'非必填'}}</view>
  20. </view>
  21. <view class="model-text">类型:<span v-for="(minItem,minIndex) in classOption" v-if="item.type == minItem.value">{{minItem.label}}</span></view>
  22. </view>
  23. </view>
  24. <!-- 属性 -->
  25. <view class="attribute-max-big-box" v-if="pageType == 2">
  26. <view class="list-max-big-box">
  27. <view class="list-max-big-null" v-if="!attributeList[0]">暂无数据</view>
  28. <view class="for-list-max-big-box" v-for="(item,index) in attributeList" :key="index">
  29. <view class="for-box">
  30. <view>名称:{{item.name}}</view>
  31. <view :class="item.state?'colorA':''">{{item.state?'启用':'停用'}}</view>
  32. </view>
  33. <view class="for-text">
  34. <view>标识:</view>
  35. <view>{{item.code}}</view>
  36. </view>
  37. <view class="for-text">
  38. <view>属性:</view>
  39. <view>{{item.attrName}}</view>
  40. </view>
  41. <view class="for-text">
  42. <view>备注:</view>
  43. <view>{{item.remark}}</view>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="pagination-max-big-box">
  48. <view class="pagination-button" @click="attributeButton(1)"
  49. :class="attributeQuery.page == 1 ? 'pagination-color':''">上一页</view>
  50. <view class="pagination-num">{{attributeQuery.page}}/{{attributePages}}</view>
  51. <view class="pagination-button" @click="attributeButton(2)"
  52. :class="attributeQuery.page == attributePages || attributeQuery.page > attributePages ? 'pagination-color':''">下一页</view>
  53. </view>
  54. </view>
  55. <!-- 功能 -->
  56. <view class="function-max-big-box" v-if="pageType == 3">
  57. <view class="list-max-big-box">
  58. <view class="list-max-big-null" v-if="!functionList[0]">暂无数据</view>
  59. <view class="for-list-max-big-box" v-for="(item,index) in functionList" :key="index">
  60. <view class="for-box">
  61. <view>名称:{{item.name}}</view>
  62. <view :class="item.state?'colorA':''">{{item.state?'启用':'停用'}}</view>
  63. </view>
  64. <view class="for-text">
  65. <view>地址:</view>
  66. <view>{{item.reqApi}}</view>
  67. </view>
  68. <view class="for-text">
  69. <view>方式:</view>
  70. <view>{{item.reqMethod}}</view>
  71. </view>
  72. <view class="for-text">
  73. <view>备注:</view>
  74. <view>{{item.remark}}</view>
  75. </view>
  76. </view>
  77. </view>
  78. <view class="pagination-max-big-box">
  79. <view class="pagination-button" @click="functionButton(1)"
  80. :class="functionQuery.page == 1 ? 'pagination-color':''">上一页</view>
  81. <view class="pagination-num">{{functionQuery.page}}/{{functionPages}}</view>
  82. <view class="pagination-button" @click="functionButton(2)"
  83. :class="functionQuery.page == functionPages || functionQuery.page > functionPages ? 'pagination-color':''">下一页</view>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import { itoTypeTypeModelAndAttr,itoAttributeList,itoTypeFunctionList } from '@/api/index.js'
  90. export default {
  91. data() {
  92. return {
  93. pageType:1,
  94. newData:{},
  95. //模型列表
  96. modelList:[],
  97. classOption:[
  98. {label:'文本框',value:'text'},
  99. {label:'文本域',value:'textarea'},
  100. {label:'密码框',value:'password'},
  101. {label:'计数器',value:'number'},
  102. {label:'单选下拉框',value:'select'},
  103. {label:'多选下拉框',value:'selectMultiple'},
  104. {label:'单选框',value:'radio'},
  105. {label:'复选框',value:'checkbox'},
  106. {label:'滑块',value:'slider'},
  107. {label:'时间选择器',value:'timePicker'},
  108. {label:'时间范围选择器',value:'timePickerRange'},
  109. {label:'日期选择器',value:'datePicker'},
  110. {label:'日期范围选择器',value:'datePickerRange'},
  111. {label:'颜色选择器',value:'colorPicker'},
  112. ],
  113. attributeList:[],
  114. attributeQuery:{
  115. page:1,
  116. pageSize:10,
  117. },
  118. attributePages:0,
  119. functionList:[],
  120. functionQuery:{
  121. page:1,
  122. pageSize:10,
  123. },
  124. functionPages:0,
  125. }
  126. },
  127. onLoad(option) {
  128. this.initialize(option.item);
  129. },
  130. onShow() {
  131. },
  132. methods: {
  133. initialize(item){
  134. let obj = JSON.parse(decodeURIComponent(item));
  135. this.$set(this,'newData',obj);
  136. this.itoTypeTypeModelAndAttr();
  137. },
  138. tbaleButton(type){
  139. if(type == 1){
  140. this.itoTypeTypeModelAndAttr();
  141. }else if(type == 2){
  142. this.$set(this,'attributeQuery',{
  143. page:1,
  144. pageSize:10,
  145. });
  146. this.itoAttributeList();
  147. }else if(type == 3){
  148. this.$set(this,'functionQuery',{
  149. page:1,
  150. pageSize:10,
  151. });
  152. this.itoTypeFunctionList();
  153. }
  154. this.$set(this,'pageType',type);
  155. },
  156. //模型列表
  157. async itoTypeTypeModelAndAttr(){
  158. const {data} = await itoTypeTypeModelAndAttr({id:this.newData.typeId});
  159. if(data.code==200){
  160. let list = [];
  161. data.data.model.forEach((item)=>{
  162. if(item.isSelect){
  163. list.push(item);
  164. }
  165. })
  166. this.$set(this,'modelList',list);
  167. }
  168. },
  169. attributeButton(type){
  170. if(type == 1){
  171. if(this.attributeQuery.page != 1){
  172. this.attributeQuery.page--
  173. this.itoAttributeList();
  174. }
  175. }else if(type == 2){
  176. if(this.attributeQuery.page != this.attributePages && this.attributeQuery.page < this.attributePages){
  177. this.attributeQuery.page++
  178. this.itoAttributeList();
  179. }
  180. }
  181. },
  182. //属性列表
  183. async itoAttributeList(){
  184. let obj = JSON.parse(JSON.stringify(this.attributeQuery))
  185. obj.typeId = this.newData.typeId
  186. const {data} = await itoAttributeList(obj);
  187. if(data.code==200){
  188. this.$set(this,'attributeList',data.data.records);
  189. this.$set(this,'attributePages',data.data.pages);
  190. }
  191. },
  192. functionButton(type){
  193. if(type == 1){
  194. if(this.functionQuery.page != 1){
  195. this.functionQuery.page--
  196. this.itoTypeFunctionList();
  197. }
  198. }else if(type == 2){
  199. if(this.functionQuery.page != this.functionPages && this.functionQuery.page < this.functionPages){
  200. this.functionQuery.page++
  201. this.itoTypeFunctionList();
  202. }
  203. }
  204. },
  205. //功能列表
  206. async itoTypeFunctionList(){
  207. let obj = JSON.parse(JSON.stringify(this.functionQuery))
  208. obj.typeId = this.newData.typeId
  209. const {data} = await itoTypeFunctionList(obj);
  210. if(data.code==200){
  211. this.$set(this,'functionList',data.data.records);
  212. this.$set(this,'functionPages',data.data.pages);
  213. }
  214. },
  215. }
  216. }
  217. </script>
  218. <style lang="stylus" scoped>
  219. #iotClassification-info-page {
  220. flex:1;
  221. display: flex;
  222. flex-direction: column;
  223. overflow: hidden;
  224. .info-max-big-box{
  225. background-color: #fff;
  226. height:80rpx;
  227. display: flex;
  228. padding:0 20rpx;
  229. view{
  230. flex:1;
  231. font-size:28rpx;
  232. line-height:80rpx;
  233. }
  234. }
  235. .top-table-button-box{
  236. display: flex;
  237. view{
  238. flex:1;
  239. font-size:28rpx;
  240. line-height:60rpx;
  241. text-align:center;
  242. background-color:#999;
  243. color:#fff;
  244. }
  245. .colorA{
  246. background-color:#0183FA;
  247. color:#fff;
  248. }
  249. }
  250. .model-max-big-box{
  251. flex:1;
  252. overflow-x: hidden;
  253. overflow-y: scroll;
  254. .list-max-big-null{
  255. font-size:28rpx;
  256. text-align:center;
  257. line-height:100rpx;
  258. color:#999;
  259. }
  260. .model-for-box{
  261. margin:20rpx 20rpx 0;
  262. padding:20rpx;
  263. background-color: #fff;
  264. border-radius:8rpx;
  265. .model-title-box{
  266. display: flex;
  267. view{
  268. font-size:28rpx;
  269. line-height:50rpx;
  270. }
  271. view:nth-child(1){
  272. flex:1;
  273. }
  274. view:nth-child(2){
  275. width:100rpx;
  276. }
  277. }
  278. .model-text{
  279. font-size:28rpx;
  280. line-height:50rpx;
  281. }
  282. }
  283. }
  284. .attribute-max-big-box{
  285. flex:1;
  286. display: flex;
  287. flex-direction: column;
  288. overflow: hidden;
  289. }
  290. .function-max-big-box{
  291. flex:1;
  292. display: flex;
  293. flex-direction: column;
  294. overflow: hidden;
  295. }
  296. .list-max-big-box{
  297. flex:1;
  298. overflow-x: hidden;
  299. overflow-y: scroll;
  300. .list-max-big-null{
  301. font-size:28rpx;
  302. text-align:center;
  303. line-height:100rpx;
  304. color:#999;
  305. }
  306. .for-list-max-big-box{
  307. background-color: #fff;
  308. margin:20rpx;
  309. padding:20rpx;
  310. border-radius:8rpx;
  311. .for-box{
  312. display: flex;
  313. view{
  314. font-size:28rpx;
  315. line-height:50rpx;
  316. }
  317. view:nth-child(1){
  318. flex:1;
  319. }
  320. view:nth-child(2){
  321. width:100rpx;
  322. }
  323. .colorA{
  324. color:#14AE10;
  325. }
  326. }
  327. .for-text{
  328. display: flex;
  329. view{
  330. font-size:28rpx;
  331. line-height:50rpx;
  332. }
  333. view:nth-child(1){
  334. width:90rpx;
  335. }
  336. view:nth-child(2){
  337. width:590rpx;
  338. font-size:28rpx;
  339. line-height:40rpx;
  340. padding:5rpx 0;
  341. word-wrap: break-word;
  342. }
  343. }
  344. }
  345. }
  346. .pagination-max-big-box{
  347. height:80rpx;
  348. background-color: #fff;
  349. display: flex;
  350. .pagination-button{
  351. margin:10rpx;
  352. border-radius:8rpx;
  353. width:140rpx;
  354. height:60rpx;
  355. line-height:60rpx;
  356. text-align: center;
  357. font-size:28rpx;
  358. background-color:#0183FA;
  359. color:#fff;
  360. }
  361. .pagination-num{
  362. flex:1;
  363. text-align: center;
  364. line-height:80rpx;
  365. }
  366. .pagination-color{
  367. background-color: #dedede;
  368. }
  369. }
  370. }
  371. </style>