warn1.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <div>
  3. <div
  4. style="position: absolute; height: 40px; width: 160px; opacity: 0.8; z-index: 1999; padding: 8px; top:6px; left: 6px; background: #fff; border-radius: 8px;">
  5. <button @click="uploadFile" style="width: 98%; text-align: center">导入违规零售户</button>
  6. </div>
  7. <div id="container" v-bind:style="'width: 100%;border: 1px solid #cecece;height:'+pageHeight*0.9+'px;'">
  8. </div>
  9. <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
  10. <el-upload
  11. ref="upload"
  12. :limit="1"
  13. accept=".xlsx, .xls"
  14. :headers="upload.headers"
  15. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  16. :disabled="upload.isUploading"
  17. :on-progress="handleFileUploadProgress"
  18. :on-success="handleFileSuccess"
  19. :auto-upload="false"
  20. drag
  21. >
  22. <i class="el-icon-upload"></i>
  23. <div class="el-upload__text">将文件拖到此处,或<em>点击上传</em></div>
  24. <div class="el-upload__tip text-center" slot="tip">
  25. <span>仅允许导入xls、xlsx格式文件。</span>
  26. <a href="/illegal_customer_template.xlsx" style="padding-left:10px; color: coral">下载违规零售户模板</a>
  27. </div>
  28. </el-upload>
  29. <div slot="footer" class="dialog-footer">
  30. <el-button type="primary" @click="submitFileForm">确 定</el-button>
  31. <el-button @click="upload.open = false">取 消</el-button>
  32. </div>
  33. </el-dialog>
  34. <div class="scroll-box">
  35. <h3>违规零售户列表</h3>
  36. <div class="scroll-item">
  37. <vue-seamless-scroll :data="list" class="warp">
  38. <div v-for="c in list" class="customer-info">
  39. <table align="center" width="98%" cellpadding="0">
  40. <tr>
  41. <td width="35%">许可证号</td>
  42. <td width="65%">{{c.licenceNo}}</td>
  43. </tr>
  44. <tr>
  45. <td>零售户姓名</td>
  46. <td>{{c.customerName}}</td>
  47. </tr>
  48. <tr>
  49. <td>违规类型</td>
  50. <td>{{typeItems[c.illegalType].typeName}}</td>
  51. </tr>
  52. <tr>
  53. <td>地址</td>
  54. <td>{{c.address}}</td>
  55. </tr>
  56. </table>
  57. </div>
  58. </vue-seamless-scroll>
  59. </div>
  60. </div>
  61. </div>
  62. </template>
  63. <script>
  64. import request from '@/utils/request'
  65. import {getToken} from "@/utils/auth";
  66. import vueSeamlessScroll from 'vue-seamless-scroll'
  67. export default {
  68. data() {
  69. return {
  70. address: "",
  71. queryParams: {
  72. address: {},
  73. distance: "50"
  74. },
  75. placeInfo: [
  76. {value: "", label: ""}
  77. ],
  78. distanceOptions: [
  79. {value: "50", label: "50米"},
  80. {value: "100", label: "100米"},
  81. {value: "200", label: "200米"}
  82. ],
  83. map: null,
  84. pageHeight: document.documentElement.clientHeight,
  85. // 用户导入参数
  86. upload: {
  87. // 是否显示弹出层(用户导入)
  88. open: false,
  89. // 弹出层标题(用户导入)
  90. title: "",
  91. // 是否禁用上传
  92. isUploading: false,
  93. // 是否更新已经存在的用户数据
  94. updateSupport: 0,
  95. // 设置上传的请求头部
  96. headers: {Authorization: "Bearer " + getToken()},
  97. // 上传的地址
  98. url: process.env.VUE_APP_BASE_API + "/buss/illegal-customer/importData"
  99. },
  100. typeItems: {
  101. '1': {color: 'red', 'typeName': '许可证异常信息'},
  102. '2': {color: 'orange', 'typeName': '经营户违规信息'},
  103. '3': {color: 'yellow', 'typeName': '真烟外流信息进行数据关链'},
  104. '4': {color: 'blue', 'typeName': '产生许可证异常预警'},
  105. '5': {color: 'green', 'typeName': '内管黑名单预警'},
  106. '6': {color: 'gray', 'typeName': '内管灰名单预警'},
  107. },
  108. list: []
  109. }
  110. },
  111. components: {
  112. vueSeamlessScroll
  113. },
  114. created() {
  115. setTimeout(() => {
  116. this.initMap()
  117. }, 100)
  118. },
  119. methods: {
  120. initMap() {
  121. this.map = new BMap.Map("container", {enableMapClick: false}); // 创建Map实例 命名空间为BMAP
  122. this.map.centerAndZoom(new BMap.Point(113.465771, 30.368834), 10); // 初始化地图,设置中心点坐标和地图级别
  123. this.map.setCurrentCity("仙桃");
  124. this.map.enableScrollWheelZoom(true); //开启鼠标滚轮缩放
  125. this.map.disableDoubleClickZoom(); //禁用双击放大
  126. // this.init();
  127. this.getList()
  128. },
  129. init() {
  130. const t = this;
  131. request({
  132. url: '/monitorArea/infoList',
  133. method: "get"
  134. }).then(function (rs) {
  135. const areaInfo = rs.areaInfo;
  136. const noWarnClientInfo = rs.noWarnClientInfo;
  137. const WarnClientInfo = rs.WarnClientInfo;
  138. console.log(areaInfo, noWarnClientInfo, WarnClientInfo);
  139. areaInfo.forEach(data => {
  140. if (data.areaType == 3) {
  141. let listData = JSON.parse(data.areaData);
  142. let list = [];
  143. listData.forEach(areaData => {
  144. let pt = new BMap.Point(areaData.longitude, areaData.latitude);
  145. list.push(pt);
  146. });
  147. let polygon = new BMap.Polygon(list, {fillColor: data.areaColor, strokeWeight: 2, strokeOpacity: 0.5}); //创建折线
  148. t.map.addOverlay(polygon);
  149. var x = 0,
  150. y = 0;
  151. var path = polygon.getPath();//返回多边型的点数组;ply是多边形覆盖物
  152. for (var k = 0; k < path.length; k++) {
  153. x = x + parseFloat(path[k].lng);
  154. y = y + parseFloat(path[k].lat);
  155. }
  156. x = x / path.length;
  157. y = y / path.length;
  158. let points = [];
  159. let pt = new BMap.Point(x, y);
  160. points.push(pt);
  161. let icon = new BMap.Icon(require("@/assets/images/area_icon16x16.png"), new BMap.Size(16, 16));
  162. let options = {
  163. icon: icon
  164. }
  165. let marker = new BMap.Marker(pt, options);
  166. t.map.addOverlay(marker);
  167. marker.addEventListener('click', function (e) {
  168. var content =
  169. '<ul class="map-customer-info">'
  170. + '<li ><span>社区名称:</span>' + 'xxx社区' + '</li>'
  171. + '<li ><span>人口:</span>' + 'xxxxxx' + '</li>'
  172. + '<li ><span>零售户数量:</span>' + 'xxx' + '</li>'
  173. + '<li ><span>可办证数量:</span>' + 'xx' + '</li>'
  174. + '</ul>';
  175. t.$alert(content, '社区信息', {
  176. dangerouslyUseHTMLString: true
  177. });
  178. });
  179. }
  180. });
  181. let points = [];
  182. noWarnClientInfo.forEach(data => {
  183. let pt = new BMap.Point(data.longitude, data.latitude);
  184. pt.shortName = data.shortName;
  185. pt.clientCode = data.clientCode;
  186. pt.telephone = data.telephone;
  187. pt.cnname = data.cnname;
  188. points.push(pt);
  189. });
  190. let options = {
  191. size: BMAP_POINT_SIZE_NORMAL,
  192. shape: BMAP_POINT_SHAPE_STAR,
  193. color: '#848080'
  194. }
  195. let pointCollection = new BMap.PointCollection(points, options);
  196. pointCollection.addEventListener('click', function (e) {
  197. var content =
  198. '<ul class="map-customer-info">'
  199. + '<li ><span>许可证号:</span>' + e.point.clientCode + '</li>'
  200. + '<li ><span>名称:</span>' + e.point.shortName + '</li>'
  201. + '<li ><span>电话:</span>' + e.point.telephone + '</li>'
  202. + '<li ><span>客户经理:</span>' + e.point.cnname + '</li>'
  203. + '<li ><span>库存:</span>' + 666 + '</li>'
  204. + '</ul>';
  205. t.$alert(content, '零售户信息', {
  206. dangerouslyUseHTMLString: true
  207. });
  208. });
  209. t.map.addOverlay(pointCollection);
  210. });
  211. },
  212. getList() {
  213. const t = this;
  214. request({
  215. url: '/buss/illegal-customer/all',
  216. method: "get"
  217. }).then(function (rs) {
  218. t.list = rs
  219. // 描点
  220. rs.forEach(o => {
  221. let pt = new BMap.Point(o.longitude, o.latitude);
  222. const ct = t.typeItems[o.illegalType];
  223. let marker = new BMap.Marker(pt, {
  224. // 指定Marker的icon属性为Symbol
  225. icon: new BMap.Symbol(BMap_Symbol_SHAPE_POINT, {
  226. scale: 1.5,//图标缩放大小
  227. fillColor: ct.color,//填充颜色
  228. fillOpacity: 0.8//填充透明度
  229. })
  230. });
  231. t.map.addOverlay(marker);
  232. marker.addEventListener('click', function (e) {
  233. var content =
  234. '<ul class="map-customer-info">'
  235. + '<li ><span>零售户名称:</span>' + o.customerName + '</li>'
  236. + '<li ><span>许可证号:</span>' + o.licenceNo + '</li>'
  237. + '<li ><span>地址:</span>' + o.address + '</li>'
  238. + '<li ><span>违规类型:</span>' + ct.typeName + '</li>'
  239. + '</ul>';
  240. t.$alert(content, '零售户违规信息', {
  241. dangerouslyUseHTMLString: true
  242. });
  243. });
  244. })
  245. })
  246. },
  247. uploadFile() {
  248. this.upload.title = "导入违规零售户";
  249. this.upload.open = true;
  250. }
  251. ,
  252. // 提交上传文件
  253. submitFileForm() {
  254. this.$refs.upload.submit();
  255. }
  256. ,
  257. // 文件上传中处理
  258. handleFileUploadProgress(event, file, fileList) {
  259. this.upload.isUploading = true;
  260. }
  261. ,
  262. // 文件上传成功处理
  263. handleFileSuccess(response, file, fileList) {
  264. this.upload.open = false;
  265. this.upload.isUploading = false;
  266. this.$refs.upload.clearFiles();
  267. this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
  268. this.initMap();
  269. }
  270. ,
  271. }
  272. }
  273. </script>
  274. <style rel="stylesheet/scss" lang="scss">
  275. .BMap_cpyCtrl {
  276. display: none;
  277. }
  278. .anchorBL {
  279. display: none;
  280. }
  281. .scroll-box {
  282. width: 240px;
  283. height: 560px;
  284. position: absolute;
  285. z-index: 1999;
  286. background: #ffffff;
  287. right: 10px;
  288. top: 10px;
  289. border-radius: 8px;
  290. opacity: 0.8;
  291. }
  292. .scroll-box h3 {
  293. text-align: center;
  294. line-height: 40px;
  295. }
  296. .scroll-item {
  297. height: 480px;
  298. overflow: hidden;
  299. }
  300. .customer-info {
  301. font-size: 12px;
  302. margin-top: 20px;
  303. padding: 2px;
  304. }
  305. </style>