123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820 |
- <template>
- <view>
- <!-- 搜索井下人员 -->
- <p-personnel-orientation-navbar :mine="mine"></p-personnel-orientation-navbar>
- <view class="content">
- <view class="tip_box">
- <view class="left">
- <view class="icon">
- <image v-if="status == 1" src="./icon/01.png" mode=""></image>
- <image v-if="status == 0" src="./icon/00.png" mode=""></image>
- </view>
- <view v-if="status == 1" class="text">数据正常</view>
- <view v-if="status == 0" class="text">数据异常</view>
- </view>
- <view class="right">
- <view class="text">数据更新时间</view>
- <view class="time">{{updated_at}}</view>
- </view>
- </view>
- <!-- 当前井下人员 -->
- <p-personnel-orientation-section-1 :mine="mine">
- <!-- 圆环图 -->
- <canvas style="width: 720upx; height:500upx;" canvas-id="canvasRing" id="canvasRing"
- @touchstart="touchRing"></canvas>
- </p-personnel-orientation-section-1>
-
-
- <!-- <view class="overtime_box">
- <view class="left">
- <view class="icon">
- <image src="./icon/overtime.png" mode=""></image>
- </view>
- <view class="text">井下超时人员统计</view>
- </view>
- <view class="right">
- <view class="text">6</view>
- <view class="icon">
- <uni-icons type="arrowright" size="14"></uni-icons>
- </view>
- </view>
- </view> -->
-
- <p-personnel-orientation-section-3>
- <!-- 职能科室 -->
- <!-- <view class="section_title">职能科室</view> -->
- <!-- <canvas style="width: 720upx; height:800upx;" canvas-id="canvasRing2" id="canvasRing2" @touchstart="touchRing2"></canvas> -->
- <!-- 基层区队 -->
- <!-- <view class="section_title">基层区队</view> -->
- <!-- <canvas style="width: 720upx; height:800upx;" canvas-id="canvasRing3" id="canvasRing3" @touchstart="touchRing3"></canvas> -->
-
- <!-- 表格 -->
- <view class="table">
- <uni-table border emptyText="暂无更多数据">
- <!-- 表头行 -->
- <uni-tr>
- <uni-th align="center" width="180">部门名称</uni-th>
- <uni-th align="center" width="90">人数</uni-th>
- <uni-th align="center" width="80">占比</uni-th>
- </uni-tr>
- <!-- 表格数据行 -->
- <uni-tr v-for="(item,index) in table" :key="index" @row-click="table_detail(item.depart_name)">
- <uni-td style="vertical-align: middle;" align="center">
- <view>{{item.depart_name}}</view>
- </uni-td>
- <uni-td style="vertical-align: middle;" align="center">
- <view>{{item.pepole_num}}</view>
- </uni-td>
- <uni-td style="vertical-align: middle;" align="center">
- <view>{{((item.pepole_num / people_total)*100).toFixed(2) + ' %'}}</view>
- </uni-td>
- </uni-tr>
-
- </uni-table>
- </view>
- </p-personnel-orientation-section-3>
- <!-- 各科室下井人数 -->
- <p-personnel-orientation-section-4 @changeDepart="changeDepart">
- <canvas style="width: 700upx; height:2500upx;" canvas-id="canvasColumn" id="canvasColumn"
- class="charts-rotate" @touchstart="touchColumn"></canvas>
- </p-personnel-orientation-section-4>
- </view>
- </view>
- </template>
- <script>
- import uCharts from '@/components/u-charts/u-charts.js';
- var _self;
- var canvaRing = null;
- var canvaRing2 = null;
- var canvaRing3 = null;
- // 柱状图
- var canvaColumn = null;
- export default {
- data() {
- return {
- // 矿编码
- mine: "",
- cWidth: '',
- cHeight: '',
- pixelRatio: 1,
- serverData: '',
- cWidth2: '', //横屏图表
- cHeight2: '', //横屏图表
- // 今日部门人数统计
- departType: "now",
- lastTapTimeoutFunc: null,
- lastTapDiffTime: 0,
- // 数据正常状态与更新时间
- status: 1,
- updated_at: "",
-
- // 表格
- table:[],
- people_total:0
- }
- },
- onLoad(option) {
- console.log(option.mine)
- // 矿编码
- this.mine = option.mine
- _self = this;
- this.cWidth = uni.upx2px(720);
- this.cHeight = uni.upx2px(500);
- this.cHeight3 = uni.upx2px(750);
- this.getServerData();
- this.getServerData2();
- this.getServerData3();
- // 柱状图
- this.cWidth2 = uni.upx2px(700);
- this.cHeight2 = uni.upx2px(2400);
- this.getServerData4();
- // 获取数据正常状态
- this.$p_api.messageUpdateStatus({
- mine: this.mine
- }).then((res) => {
- // console.log(res.data.data)
- this.status = res.data.data.status
- this.updated_at = res.data.data.updated_at
- })
-
- // this.get_product_data_query_power()
- },
- methods: {
- get_product_data_query_power(){
- this.$p_api.product_data_query_power({
- staff_num: uni.getStorageSync('user').staff_num,
- data_module: "rydw"
- }).then((res)=>{
- if(res.data.content.status){
- console.log("可查看")
- }else{
- uni.showToast({
- icon:"none",
- title:"没有查看权限!"
- })
-
- setTimeout(()=>{
- uni.navigateBack()
- },1000)
- }
- })
- },
-
- // 改变今日部门人数统计的参数
- changeDepart(type) {
- // console.log(type)
- if (type == 1) {
- this.departType = "today"
- } else {
- this.departType = "now"
- }
- console.log(this.departType)
- this.getServerData4();
- },
- // 当前人员统计
- getServerData() {
- this.$p_api.personnel_people_now({
- mine: this.mine
- }).then((res) => {
- // console.log(res)
- this.people_total = res.data.data.people_total
- let Ring = {
- series: [{
- name: '',
- data: 0
- }],
- people_total: 0
- }
- // res.data.data.people_distribute 图例
- Ring.people_total = res.data.data.people_total
- const series = res.data.data.people_distribute
- series.map(function(item, index) {
- //新数组的项,用来盛放每一项中的各个参数,每次清空,这样避免改变sevm的值
- var sevm = {};
- //给每一项中的参数初始化并赋值
- sevm['name'] = item.depart_name;
- sevm['data'] = item.pepole_num;
- //将项放进新的数组
- Ring.series[index] = sevm
- })
- // console.log(Ring)
- _self.showRing("canvasRing", Ring);
- })
- },
- // 职能科室人数统计
- getServerData2() {
- this.$p_api.personnel_office_total({
- mine: this.mine
- }).then((res) => {
- // console.log(res)
- let Ring2 = {
- series: [{
- name: '',
- data: 0
- }],
- people_total: 0
- }
- Ring2.people_total = res.data.people_total
- const series = res.data.data
- series.map(function(item, index) {
- //新数组的项,用来盛放每一项中的各个参数,每次清空,这样避免改变sevm的值
- var sevm = {};
- //给每一项中的参数初始化并赋值
- sevm['id'] = item.depart_id;
- sevm['name'] = item.depart_name;
- sevm['data'] = item.pepole_num;
- //将项放进新的数组
- Ring2.series[index] = sevm
- })
- // console.log(Ring2)
- _self.showRing2("canvasRing2", Ring2);
- })
- },
- // 基层区队人数统计
- getServerData3() {
- this.$p_api.personnel_basic_total({
- mine: this.mine
- }).then((res) => {
- // console.log(res.data.data)
- let Ring3 = {
- series: [{
- name: '',
- data: 0
- }],
- people_total: 0
- }
- Ring3.people_total = res.data.people_total
- const series = res.data.data
- series.map(function(item, index) {
- //新数组的项,用来盛放每一项中的各个参数,每次清空,这样避免改变sevm的值
- var sevm = {};
- //给每一项中的参数初始化并赋值
- sevm['name'] = item.depart_name;
- sevm['data'] = item.pepole_num;
- //将项放进新的数组
- Ring3.series[index] = sevm
- })
- // console.log(Ring3)
- _self.showRing3("canvasRing3", Ring3);
- })
- },
- showRing(canvasId, chartData) {
- canvaRing = new uCharts({
- $this: _self,
- canvasId: canvasId,
- type: 'ring',
- fontSize: 12,
- // 图例配置
- // legend: true,
- legend: {
- position: "right",
- lineHeight: 30,
- },
- title: {
- name: '总人数',
- color: '#666666',
- fontSize: 15 * _self.pixelRatio,
- offsetY: 0 * _self.pixelRatio,
- },
- subtitle: {
- name: chartData.people_total + '人',
- color: '#666666',
- fontSize: 15 * _self.pixelRatio,
- offsetY: 0 * _self.pixelRatio,
- },
- extra: {
- pie: {
- offsetAngle: -45,
- ringWidth: 30 * _self.pixelRatio,
- labelWidth: 20
- }
- },
- background: '#FFFFFF',
- pixelRatio: _self.pixelRatio,
- series: chartData.series,
- animation: true,
- width: _self.cWidth * _self.pixelRatio,
- height: _self.cHeight * _self.pixelRatio,
- disablePieStroke: true,
- // 百分比指示 关
- dataLabel: false,
- });
- },
- touchRing(e) {
- canvaRing.showToolTip(e, {
- // format: function(item) {
- // return item.name + ':' + item.data + '人'
- // },
- format: (item) => {
-
- let _this = this;
- let curTime = new Date().getTime();
- let lastTime = _this.lastTapDiffTime;
- _this.lastTapDiffTime = curTime;
- //两次点击间隔小于300ms, 认为是双击
- let diff = curTime - lastTime;
- if (diff < 300) {
- console.log("双击")
-
- uni.navigateTo({
- url: "./depart-people/depart-people?title=" + item.name + "&id=" + item.name +
- "&mine=" + this.mine
- })
-
- //_this.handleVideo('screen',index)自定义事件
- clearTimeout(_this.lastTapTimeoutFunc); // 成功触发双击事件时,取消单击事件的执行
- } else {
- // 单击事件延时300毫秒执行
- _this.lastTapTimeoutFunc = setTimeout(function() {
- console.log("单击")
- //_this.handleVideo('playOrStop',index)自定义事件
- }, 300);
- }
-
- return item.name + ':' + item.data + '人'
- }
- });
- },
- showRing2(canvasId, chartData) {
- canvaRing2 = new uCharts({
- $this: _self,
- canvasId: canvasId,
- type: 'ring',
- fontSize: 12,
- // 图例配置
- legend: true,
- legend: {
- position: "bottom",
- lineHeight: 30,
- },
- title: {
- name: '总人数',
- color: '#666666',
- fontSize: 15 * _self.pixelRatio,
- offsetY: 0 * _self.pixelRatio,
- },
- subtitle: {
- name: chartData.people_total + '人',
- color: '#666666',
- fontSize: 15 * _self.pixelRatio,
- offsetY: 0 * _self.pixelRatio,
- },
- extra: {
- pie: {
- offsetAngle: -45,
- ringWidth: 30 * _self.pixelRatio,
- labelWidth: 5
- }
- },
- background: '#FFFFFF',
- pixelRatio: _self.pixelRatio,
- series: chartData.series,
- animation: true,
- width: _self.cWidth * _self.pixelRatio,
- height: _self.cHeight3 * _self.pixelRatio,
- disablePieStroke: true,
- // 百分比指示 关
- dataLabel: true,
- });
- },
- touchRing2(e) {
- canvaRing2.showToolTip(e, {
- format: (item) => {
- this.go_depart_people(item)
- return item.name + ':' + item.data + '人'
- }
- });
- console.log(e)
- },
- go_depart_people(item) {
- let _this = this;
- let curTime = new Date().getTime();
- let lastTime = _this.lastTapDiffTime;
- _this.lastTapDiffTime = curTime;
- //两次点击间隔小于300ms, 认为是双击
- let diff = curTime - lastTime;
- if (diff < 300) {
- console.log("双击")
-
- uni.navigateTo({
- url: "./depart-people/depart-people?title=" + item.name + "&id=" + item.id +
- "&mine=" + this.mine
- })
- //_this.handleVideo('screen',index)自定义事件
- clearTimeout(_this.lastTapTimeoutFunc); // 成功触发双击事件时,取消单击事件的执行
- } else {
- // 单击事件延时300毫秒执行
- _this.lastTapTimeoutFunc = setTimeout(function() {
- console.log("单击")
- //_this.handleVideo('playOrStop',index)自定义事件
- }, 300);
- }
- },
- showRing3(canvasId, chartData) {
- canvaRing3 = new uCharts({
- $this: _self,
- canvasId: canvasId,
- type: 'ring',
- fontSize: 12,
- // 图例配置
- legend: true,
- legend: {
- position: "bottom",
- lineHeight: 30,
- },
- title: {
- name: '总人数',
- color: '#666666',
- fontSize: 15 * _self.pixelRatio,
- offsetY: 0 * _self.pixelRatio,
- },
- subtitle: {
- name: chartData.people_total + '人',
- color: '#666666',
- fontSize: 15 * _self.pixelRatio,
- offsetY: 0 * _self.pixelRatio,
- },
- extra: {
- pie: {
- offsetAngle: -45,
- ringWidth: 30 * _self.pixelRatio,
- labelWidth: 15
- }
- },
- background: '#FFFFFF',
- pixelRatio: _self.pixelRatio,
- series: chartData.series,
- animation: true,
- width: _self.cWidth * _self.pixelRatio,
- height: _self.cHeight3 * _self.pixelRatio,
- disablePieStroke: true,
- // 百分比指示 关
- dataLabel: true,
- });
- },
- touchRing3(e) {
- canvaRing3.showToolTip(e, {
- format: (item) => {
- // console.log(item)
- this.go_depart_people_2(item)
- return item.name + ':' + item.data + '人'
- }
- });
- },
- go_depart_people_2(item) {
- let _this = this;
- let curTime = new Date().getTime();
- let lastTime = _this.lastTapDiffTime;
- _this.lastTapDiffTime = curTime;
- //两次点击间隔小于300ms, 认为是双击
- let diff = curTime - lastTime;
- if (diff < 300) {
- console.log("双击")
-
- uni.navigateTo({
- url: "./depart-people-2/depart-people-2?title=" + item.name + "&mine=" + this.mine
- })
- //_this.handleVideo('screen',index)自定义事件
- clearTimeout(_this.lastTapTimeoutFunc); // 成功触发双击事件时,取消单击事件的执行
- } else {
- // 单击事件延时300毫秒执行
- _this.lastTapTimeoutFunc = setTimeout(function() {
- console.log("单击")
- //_this.handleVideo('playOrStop',index)自定义事件
- }, 300);
- }
- },
- // 今日各部门人数统计
- getServerData4() {
- // console.log(this.departType)
- this.$p_api.personnel_depart_today({
- type: this.departType,
- mine: this.mine
- }).then((res) => {
- console.log(res.data.data)
-
- this.table = res.data.data
- let ColumnColumn = {
- "categories": [],
- "seriesData": []
- }
- const categories = res.data.data
- categories.map(function(item, index) {
- //新数组的项,用来盛放每一项中的各个参数,每次清空,这样避免改变sevm的值
- var sevm = {};
- //给每一项中的参数初始化并赋值
- sevm = item.depart_name;
- //将项放进新的数组
- ColumnColumn.categories[index] = sevm
- })
- const seriesData = res.data.data
- seriesData.map(function(item, index) {
- //新数组的项,用来盛放每一项中的各个参数,每次清空,这样避免改变sevm的值
- var sevm = {};
- //给每一项中的参数初始化并赋值
- sevm = item.pepole_num;
- //将项放进新的数组
- ColumnColumn.seriesData[index] = sevm
- })
- // console.log(ColumnColumn)
- _self.showColumnColumn("canvasColumn", ColumnColumn);
- })
- },
- showColumnColumn(canvasId, chartData) {
- canvaColumn = new uCharts({
- $this: _self,
- canvasId: canvasId,
- type: 'column',
- legend: {
- show: false,
- },
- fontSize: 9,
- background: '#FFFFFF',
- pixelRatio: _self.pixelRatio,
- animation: true,
- rotate: true,
- padding: [20, 15, 4, 15],
- // #ifdef MP-ALIPAY || MP-BAIDU
- rotateLock: true, //百度及支付宝需要锁定旋转
- // #endif
- categories: chartData.categories,
- series: [{
- "name": '',
- "data": chartData.seriesData
- }],
- xAxis: {
- disableGrid: true,
- rotateLabel: true,
- },
- yAxis: {
- // disabled:true
- },
- dataLabel: true,
- width: _self.cWidth2 * _self.pixelRatio,
- height: _self.cHeight2 * _self.pixelRatio,
- extra: {
- column: {
- type: 'group',
- // width: _self.cWidth * _self.pixelRatio * 0.45 / chartData.categories.length,
- width: _self.cWidth * _self.pixelRatio * 2 / chartData.categories.length,
- // seriesGap:12,
- meter: {
- //这个是外层边框的宽度
- border: 4,
- //这个是内部填充颜色
- fillColor: '#E5FDC3'
- }
- }
- }
- });
- },
- touchColumn(e) {
- canvaColumn.showToolTip(e, {
- format: (item, category) => {
- let _this = this;
- let curTime = new Date().getTime();
- let lastTime = _this.lastTapDiffTime;
- _this.lastTapDiffTime = curTime;
- //两次点击间隔小于300ms, 认为是双击
- let diff = curTime - lastTime;
- if (diff < 300) {
- console.log("双击")
- uni.navigateTo({
- url: "./depart-people-2/depart-people-2?title=" + category +
- "&departType=" + this.departType + "&mine=" + this.mine
- })
- //_this.handleVideo('screen',index)自定义事件
- clearTimeout(_this.lastTapTimeoutFunc); // 成功触发双击事件时,取消单击事件的执行
- } else {
- // 单击事件延时300毫秒执行
- _this.lastTapTimeoutFunc = setTimeout(function() {
- console.log("单击")
- //_this.handleVideo('playOrStop',index)自定义事件
- }, 300);
- }
- return category + ':' + item.data + item.name
- }
- });
- },
- table_detail(category){
- console.log(category)
- uni.navigateTo({
- url: "./depart-people-2/depart-people-2?title=" + category +
- "&departType=now" + "&mine=" + this.mine
- })
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #f3f3f3;
- }
- .content {
- box-sizing: border-box;
- padding: 0 15rpx;
- background-color: #f3f3f3;
- .section_title {
- text-align: center;
- line-height: 96rpx;
- font-size: 28rpx;
- font-family: PingFangSC-Regular, PingFang SC;
- font-weight: 400;
- color: #232627;
- }
- }
- .tip_box {
- margin-top: 16rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 3rpx 29rpx 0rpx rgba(59, 74, 116, 0.14);
- border-radius: 20rpx;
- box-sizing: border-box;
- padding: 0 50rpx;
- height: 132rpx;
- display: flex;
- justify-content: space-between;
- align-items: center;
- .left {
- display: flex;
- .icon {
- margin-right: 20rpx;
- image {
- width: 52rpx;
- height: 47rpx;
- }
- }
- .text {
- font-size: 34rpx;
- font-weight: 700;
- }
- }
- .right {
- .text {
- font-size: 26rpx;
- color: #999;
- margin-bottom: 20rpx;
- }
- .time {
- font-size: 30rpx;
- }
- }
- }
-
- .overtime_box {
- margin-top: 16rpx;
- background: #FFFFFF;
- box-shadow: 0rpx 3rpx 29rpx 0rpx rgba(59, 74, 116, 0.14);
- border-radius: 20rpx;
-
- box-sizing: border-box;
- padding: 0 50rpx;
-
- height: 110rpx;
-
- display: flex;
- justify-content: space-between;
- align-items: center;
-
- .left {
- display: flex;
-
- .icon {
- margin-right: 20rpx;
-
- image {
- display: block;
- width: 43rpx;
- height: 43rpx;
- }
- }
-
- .text {
- font-size: 34rpx;
- font-weight: 700;
- }
- }
-
- .right {
- display: flex;
- align-items: center;
- .text {
- font-weight: 700;
- color: #FF6A5C;
- font-size: 36rpx;
- }
-
- .icon {
- margin-left: 10rpx;
- }
- }
-
- }
-
- .table {
- .uni-table-th.table--border {
- color: #000000;
- background-color: #F3F6FA;
- }
-
- .uni-table-td.table--border {
- color: #666666;
- }
-
- position: relative;
-
- width: 720rpx;
-
- }
- </style>
|