index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  1. <template>
  2. <view class="page-wrap">
  3. <view class="head">
  4. <uni-card padding="0" margin="5px 0">
  5. <uni-search-bar @confirm="search" v-model="keywords" @clear="search"></uni-search-bar>
  6. </uni-card>
  7. <view class="addbt" @click="handle({type:'add'})">
  8. <view class="word"><uni-icons type="plusempty" size="30" color="#fff"></uni-icons></view>
  9. </view>
  10. </view>
  11. <view class="pageMain">
  12. <uni-swipe-action class="item-action-box">
  13. <uni-card padding="10px 0" margin="5px 0" v-for="(item,idx) in items" :key="item.entId">
  14. <uni-swipe-action-item class="item-action" :auto-close="true">
  15. <template v-slot:right>
  16. <view class="slot-button">
  17. <view class="bt edit" @click="handle({type:'edit',item})"><text class="slot-button-text">编辑</text></view>
  18. <view class="bt del" @click="handle({type:'del',item})"><text class="slot-button-text">删除</text></view>
  19. </view>
  20. </template>
  21. <view class="item" @click="handle({type:'detail',item})">
  22. <view class="title">
  23. <view class="name">{{item.entName}}</view>
  24. <view class="camera" @click.stop="showCamera(item)">
  25. <uni-icons v-if='item.cameraNum>0' type="videocam-filled" size="20" color="#007aff" ></uni-icons>
  26. </view>
  27. </view>
  28. <view class="item-row space-between">
  29. <view class="icon-item">
  30. <uni-icons type="location-filled" size="15" color="#999"></uni-icons>
  31. <text class="word">{{item.entAddress||'--'}}</text>
  32. </view>
  33. </view>
  34. <view class="item-row space-between">
  35. <uni-tag :text="item.entCatTitle" custom-style="background-color: #ecf5ff; border-color: #d9ecff; color: #409eff;"></uni-tag>
  36. </view>
  37. <view class="bottom">
  38. <view class="item-row space-between">
  39. <view class="icon-item">
  40. <uni-icons type="person-filled" size="15" color="#999"></uni-icons>
  41. <text class="word">{{item.charger||'--'}}【负责人】</text>
  42. </view>
  43. <view class="icon-item">
  44. <uni-icons type="phone-filled" size="15" color="#999"></uni-icons>
  45. <text class="word">{{item.chargerPhone||'--'}}</text>
  46. </view>
  47. </view>
  48. <view class="item-row space-between">
  49. <view class="icon-item">
  50. <uni-icons type="auth-filled" size="15" color="#999"></uni-icons>
  51. <text class="word">{{item.safetyManager||'--'}}【安全负责人】</text>
  52. </view>
  53. <view class="icon-item">
  54. <uni-icons type="phone-filled" size="15" color="#999"></uni-icons>
  55. <text class="word">{{item.safetyManagerPhone||'--'}}</text>
  56. </view>
  57. </view>
  58. <view class="icon-item">
  59. <image class="icon" src="/static/images/admin_icon.png" mode="widthFix"></image>
  60. <text class="word">{{item.groupName}}</text>
  61. </view>
  62. </view>
  63. </view>
  64. </uni-swipe-action-item>
  65. </uni-card>
  66. </uni-swipe-action>
  67. </view>
  68. <Create ref="industry" @success="search"></Create>
  69. <Detail ref="detail"></Detail>
  70. </view>
  71. </template>
  72. <script>
  73. import industryApi from '@/api/industry.js'
  74. import Create from './components/Create.vue'
  75. import Detail from './components/Detail.vue'
  76. export default {
  77. components:{
  78. Create,
  79. Detail
  80. },
  81. data() {
  82. return {
  83. items:[],
  84. page:1,
  85. limit:10,
  86. total:0,
  87. keywords: ""
  88. }
  89. },
  90. onShow() {
  91. this.getData();
  92. this.init()
  93. },
  94. methods: {
  95. init(){
  96. if(!uni.getStorageSync('entCats')){
  97. industryApi.getCatByList().then((res)=>{
  98. uni.setStorageSync('entCats',res.data)
  99. })
  100. }
  101. },
  102. search(){
  103. this.resetFilter();
  104. this.getData()
  105. },
  106. getData(){
  107. industryApi.getByPage({
  108. page:this.page,
  109. limit:this.limit,
  110. keywords:this.keywords
  111. }).then((res)=>{
  112. this.items=this.items.concat(res.data)
  113. })
  114. },
  115. handle({type,item}){
  116. const self=this;
  117. if(type==='detail'){
  118. this.$refs.detail.show(item)
  119. }else if(type==='del'){
  120. uni.showModal({
  121. title: '提示',
  122. content: '是否确定删除',
  123. success: function (res) {
  124. if (res.confirm) {
  125. industryApi.deleteById(item.entId).then(()=>{
  126. uni.showToast({
  127. title:'删除成功!',
  128. icon:'none'
  129. })
  130. self.search()
  131. })
  132. }
  133. }
  134. });
  135. }else{
  136. this.$refs.industry.show({type,item})
  137. }
  138. },
  139. resetFilter(){
  140. this.page = 1
  141. this.limit = 10
  142. this.total = 0
  143. this.items=[]
  144. },
  145. showCamera(){
  146. }
  147. },
  148. onReachBottom() {
  149. if(this.total>this.size*this.page){
  150. this.page++
  151. this.getData()
  152. }
  153. }
  154. }
  155. </script>
  156. <style lang="scss" scoped>
  157. .page-wrap{
  158. padding:0 20rpx;
  159. // position: fixed;
  160. // left: 0;
  161. // right: 0;
  162. // height: 100%;
  163. overflow-y: auto;
  164. .pageTabs{
  165. background-color: #fff;
  166. }
  167. .head{
  168. margin-top: 20rpx;
  169. .handle{
  170. display: inline-block;
  171. // background-color: #007aff;
  172. color: #777777;
  173. text-align: center;
  174. padding:16rpx 20rpx;
  175. border-radius: 30rpx;
  176. // border: 1px solid #007aff;
  177. font-size: 28rpx;
  178. line-height: 1;
  179. box-shadow: 0 0 4px rgba(0, 0, 0, 0.3);
  180. }
  181. .addbt{
  182. width: 100rpx;
  183. height: 100rpx;
  184. border-radius: 50%;
  185. color: #fff;
  186. background-color: rgba(64,158,255,0.6);
  187. box-shadow:0 0 10rpx rgba(0,0,0,0.6);
  188. position: fixed;
  189. right: 10rpx;
  190. bottom: 20%;
  191. z-index: 99;
  192. text-align: center;
  193. display: flex;
  194. justify-content: center;
  195. align-items: center;
  196. .word{
  197. width: 80rpx;
  198. height: 80rpx;
  199. border-radius: 50%;
  200. margin: 5rpx auto;
  201. font-size: 28rpx;
  202. letter-spacing: 2px;
  203. display: flex;
  204. justify-content: center;
  205. align-items: center;
  206. }
  207. }
  208. }
  209. .pageMain{
  210. margin-top: 20rpx;
  211. background-color: #f5f5f5;
  212. padding-bottom: 50rpx;
  213. .slot-button{
  214. width: 400rpx;
  215. height: 100%;
  216. display: flex;
  217. flex-direction: row;
  218. justify-content: center;
  219. align-items: center;
  220. color: #fff;
  221. padding-left: 10px;
  222. .bt{
  223. width: 50%;
  224. height: 100%;
  225. font-size: 30rpx;
  226. box-sizing: border-box;
  227. display: flex;
  228. justify-content: center;
  229. align-items: center;
  230. &.edit{
  231. background-color:#007aff;
  232. }
  233. &.del{
  234. background-color:#F56C6C;
  235. }
  236. &.detail{
  237. background-color: #e6a23c;
  238. }
  239. }
  240. }
  241. .item{
  242. color: #666;
  243. .title{
  244. display: flex;
  245. justify-content: space-between;
  246. align-items: center;
  247. .name{
  248. font-size: 32rpx;
  249. color: #222222;
  250. line-height: 1;
  251. padding-bottom: 10rpx;
  252. text-overflow: ellipsis;
  253. overflow: hidden;
  254. white-space: nowrap;
  255. flex: 1;
  256. }
  257. .camera{
  258. width: 100rpx;
  259. text-align: right;
  260. flex-shrink: 0;
  261. }
  262. }
  263. image{
  264. &.icon{
  265. width: 30rpx;
  266. height: 30rpx;
  267. display: block;
  268. }
  269. }
  270. .item-row{
  271. display: flex;
  272. align-items: center;
  273. padding-top: 14rpx;
  274. &.space-between{
  275. justify-content: space-between;
  276. }
  277. }
  278. .icon-item{
  279. display: flex;
  280. align-items: center;
  281. .word{
  282. margin-left: 8rpx;
  283. font-size: 24rpx;
  284. }
  285. }
  286. }
  287. }
  288. }
  289. </style>