index.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <view>
  3. <u-navbar title="监控列表" :background="{ background: '#1669e6' }" title-color="#FFFFFF" back-icon-color="#FFFFFF">
  4. <view slot="right" v-if="deptName != '外部用户'" style="margin-right: 20rpx;color: #FFFFFF;" @click="addCamera">
  5. 添加设备</view>
  6. </u-navbar>
  7. <view style="box-shadow: 0px 0px 8px 0px rgba(165, 189, 251, 0.4);margin-bottom: 20rpx">
  8. <u-tabs :list="list" :is-scroll="false" :current="current" @change="changetwo"></u-tabs>
  9. </view>
  10. <view v-for="(item,index) in dataList" :key="index"
  11. style="box-shadow: 0px 0px 8px 0px rgba(165, 189, 251, 0.4);width: 96%;border-top-right-radius: 10rpx;margin: 10rpx auto;padding-top: 10rpx;">
  12. <text
  13. style="width: 10rpx;height: 40rpx;background-color: #2979ff;display: block;float: left;margin-top: 10rpx;"></text>
  14. <h4 @click="editDevice(item)"
  15. style="width: 100rpx;border-radius: 200rpx;text-align: center;color: #2979ff;border: 2rpx solid #1785FF;float: right;margin-right: 10rpx;margin-top: 10rpx;">
  16. <!-- {{item.createTime.slice(0,10)}} -->
  17. 编辑
  18. </h4>
  19. <view style="width: 90%;margin: 0 auto;margin: 0 auto;">
  20. <view
  21. style="display: flex;justify-content: space-between;height: 60rpx;line-height: 60rpx;border-bottom: 1rpx solid #eff4ff;">
  22. <h4>{{item.warehouseName}}</h4>
  23. </view>
  24. <view v-for="(li,i) in item.webcam" :key="i">
  25. <view style="width: 100%;height: 80rpx;line-height: 80rpx;border-bottom: 1rpx solid #eff4ff;" @click="singleView(item,li)">
  26. <view style="float: left;">设备位置</view>
  27. <view style="float: right; display: flex;justify-content: space-around;">
  28. {{li.deviceName}}
  29. <u-icon name="camera-fill" size="40rpx" color="#707070" style="margin-left: 20rpx;"></u-icon>
  30. </view>
  31. </view>
  32. </view>
  33. <view
  34. style="width: 100%;margin: 0 auto;height: 80rpx;margin: 0 auto;line-height: 80rpx;"
  35. @click="expenseDetails(item)">
  36. <view style="float: left;">
  37. <h3>查看全部监控</h3>
  38. </view>
  39. <view style="float: right;">
  40. <u-icon name="arrow-right"></u-icon>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <view v-if="dataList.length == 0">
  46. <view style="margin-top: 65%;" v-if="dataList.length == 0">
  47. <u-empty mode="page" text="没有可查看的监控" icon="http://cdn.uviewui.com/uview/empty/data.png">
  48. </u-empty>
  49. </view>
  50. </view>
  51. <!-- <u-action-sheet :list="listData" v-model="show" :mask-close-able="false"></u-action-sheet> -->
  52. <u-select v-model="show" :list="listData" value-name="fId" @cancel="cancel" @confirm="confirm"
  53. label-name="text" z-index="10076"></u-select>
  54. <u-toast ref="uToast" />
  55. <u-popup v-model="open" @close="open = false" mode="bottom" length="60%" border-radius="40" :closeable="true">
  56. <view class="content" style="padding: 24rpx;text-align: center;">
  57. <view
  58. style="width: 100%;position:fixed;top: 0;text-align: center;height: 100rpx;line-height: 100rpx;background-color: #FFFFFF;">
  59. <text style="font-weight: bold;font-size: 32rpx;">修改设备信息</text>
  60. </view>
  61. <scroll-view scroll-y="true" style="height: 730rpx;margin-top: 100rpx;">
  62. <view>
  63. <view v-for="(item,index) in webcam" :key="index"
  64. style="box-shadow: 0px 0px 8px 0px rgba(230, 230, 230, 1.0);width: 100%;border-top-right-radius: 10rpx;margin: 10rpx auto;padding-top: 10rpx;margin-bottom: 10rpx;">
  65. <text
  66. style="width: 10rpx;height: 40rpx;background-color: #2979ff;display: block;float: left;margin-top: 10rpx;"></text>
  67. <view style="width: 96%;margin: 0 auto;margin: 0 auto;">
  68. <view
  69. style="display: flex;justify-content: space-between;height: 60rpx;line-height: 60rpx;border-bottom: 1rpx solid #eff4ff;">
  70. <h4>设备序列号:{{item.deviceSerial}}</h4>
  71. </view>
  72. <view style="width: 100%;">
  73. <u-field style="padding: 10px 0 10px 0;" v-model="item.deviceName" label="设备名称"
  74. type="text" placeholder="请填写设备名称">
  75. </u-field>
  76. <u-field style="padding: 10px 0 10px 0;" v-model="item.fWarehouseName" label="仓库"
  77. disabled
  78. @click="show = true;changeIndex = index"
  79. type="text" placeholder="请填写设备名称">
  80. </u-field>
  81. </view>
  82. </view>
  83. </view>
  84. </view>
  85. <view class="confrim-btn">
  86. <u-button type="primary" @click="confirmCompletion">确认修改</u-button>
  87. </view>
  88. </scroll-view>
  89. </view>
  90. </u-popup>
  91. </view>
  92. </template>
  93. <script>
  94. export default {
  95. data() {
  96. return {
  97. dataList: [],
  98. webcam: [],
  99. changeIndex:0,
  100. current: 0,
  101. total: 0,
  102. show: false,
  103. open: false,
  104. form: {
  105. pageNum: 1,
  106. pageSize: 10
  107. },
  108. listData: [],
  109. deptName: '',
  110. list: [{
  111. name: '全部'
  112. }, {
  113. name: '仓库'
  114. }],
  115. }
  116. },
  117. onShow() {
  118. uni.request({
  119. url: 'https://open.hikyun.com/artemis/oauth/token/v2',
  120. data: {
  121. "accessKey": "16400485963408782", //开发者账户AppKey
  122. "secretKey": "mCRWptOImJrehsvfjwkw",
  123. "productCode": "1640070936703286", //项目产品标识
  124. },
  125. method: 'POST',
  126. success: (res) => {
  127. console.log(res.data.msg)
  128. if (res.data.code == 200) {
  129. uni.setStorageSync('access_token', res.data.data.access_token);
  130. } else {
  131. this.$refs.uToast.show({
  132. title: res.data.msg,
  133. position: 'bottom'
  134. })
  135. }
  136. }
  137. });
  138. },
  139. created() {
  140. this.deptName = uni.getStorageSync('deptName')
  141. this.$u.get('/basicdata/warehouse/appList').then(res => {
  142. console.log(res)
  143. for (let item in res.rows) {
  144. this.listData.push({
  145. text: res.rows[item].fName,
  146. fId: res.rows[item].fId
  147. })
  148. }
  149. })
  150. this.query()
  151. },
  152. methods: {
  153. // 确认修改
  154. confirmCompletion(){
  155. this.$u.post('/warehouse/webcam/appEdit',this.webcam).then(res=>{
  156. this.form = {
  157. pageNum: 1,
  158. pageSize: 10
  159. }
  160. this.dataList = []
  161. this.current = 0
  162. this.open = false
  163. this.query()
  164. })
  165. },
  166. //编辑设备
  167. editDevice(item) {
  168. this.open = true
  169. this.webcam = JSON.parse(JSON.stringify(item.webcam))
  170. },
  171. //仓库筛选
  172. confirm(item) {
  173. if(this.open == true){
  174. this.webcam[this.changeIndex].fWarehouseId = item[0].value
  175. this.webcam[this.changeIndex].fWarehouseName = item[0].label
  176. }else{
  177. this.form = {
  178. pageNum: 1,
  179. pageSize: 10,
  180. fWarehouseId: item[0].value
  181. }
  182. this.dataList = []
  183. this.current = null
  184. this.query()
  185. }
  186. },
  187. cancel() {
  188. this.current = null
  189. },
  190. changetwo(index) {
  191. console.log(index)
  192. if (index === 0) {
  193. this.dataList = []
  194. this.form = {
  195. pageNum: 1,
  196. pageSize: 10
  197. }
  198. this.query()
  199. } else {
  200. this.show = true
  201. }
  202. this.current = index;
  203. },
  204. query() {
  205. this.$u.get('/warehouse/webcam/appList', this.form).then(res => {
  206. console.log(res)
  207. this.dataList = this.dataList.concat(res.rows)
  208. this.total = res.total
  209. if (res.total === 0) this.status = 'nomore'
  210. })
  211. },
  212. expenseDetails(item) {
  213. this.$u.route('/pages/home/cameraList/viewMonitoring', {
  214. form: JSON.stringify(item)
  215. });
  216. },
  217. singleView(item, li) {
  218. let data = JSON.parse(JSON.stringify(item))
  219. data.webcam = []
  220. data.webcam.push(li)
  221. this.$u.route('/pages/home/cameraList/viewMonitoring', {
  222. form: JSON.stringify(data)
  223. });
  224. },
  225. addCamera() {
  226. this.$u.route('/pages/home/cameraList/addCamera');
  227. }
  228. }
  229. }
  230. </script>
  231. <style>
  232. </style>