ClusterResult.vue 36.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041
<template>
    <div class="containter">
        <a-form :model="queryForm" layout="inline" :label-col="{ style: { width: '70px' } }">
            <a-form-item label="集团:" style="padding: 5px 0">
                <a-select v-model:value="queryForm.account_id"
                          style="width: 240px"
                          mode="multiple"
                          :maxTagCount="1"
                          @change="onAccountChange"
                          :options="accountList"
                          optionFilterProp="label"
                          show-search
                >
                </a-select>
            </a-form-item>
            <a-form-item label="广场:" style="padding: 5px 0">
                <a-select v-model:value="queryForm.plaza_id"
                          style="width: 240px"
                          mode="multiple"
                          :maxTagCount="1"
                          @change="onPlazaChange"
                          :options="plazaList"
                          optionFilterProp="label"
                          show-search
                >
                </a-select>
            </a-form-item>
            <a-form-item label="出入类型:" style="padding: 5px 0">
                <a-select v-model:value="queryForm.type" style="width: 240px">
                    <a-select-option :value="0">全场</a-select-option>
                    <a-select-option :value="1">广场出入口</a-select-option>
                    <a-select-option :value="2">楼层出入口</a-select-option>
                    <a-select-option :value="3">店铺出入口</a-select-option>
                    <a-select-option :value="4">其他</a-select-option>
                </a-select>
            </a-form-item>
            <a-form-item label="区域信息:" style="padding: 5px 0">
                <a-select v-model:value="queryForm.zone_id"
                          style="width: 240px"
                          mode="multiple"
                          :maxTagCount="1"
                          @change="onZoneChange"
                          :options="zoneList"
                          optionFilterProp="label"
                          show-search
                >
                </a-select>
            </a-form-item>
            <a-form-item label="监控点:" style="padding: 5px 0">
                <a-select v-model:value="queryForm.gate_id"
                          style="width: 240px"
                          mode="multiple"
                          :maxTagCount="1"
                          :options="gateList"
                          optionFilterProp="label"
                          show-search
                >

                </a-select>
            </a-form-item>
            <a-form-item label="方向:" style="padding: 5px 0">
                <a-select v-model:value="queryForm.direction"
                          mode="multiple"
                          :maxTagCount="1"
                          style="width: 240px">
                    <a-select-option :value="1"></a-select-option>
                    <a-select-option :value="-1"></a-select-option>
                    <a-select-option :value="0">横穿</a-select-option>
										<a-select-option :value="2">过店</a-select-option>
                </a-select>
            </a-form-item>
            <a-form-item label="抓拍类型:" style="padding: 5px 0">
                <a-select v-model:value="queryForm.picType" style="width: 240px">
                    <a-select-option :value="1">半身照</a-select-option>
                    <a-select-option :value="2">全身照</a-select-option>
                </a-select>
            </a-form-item>
            <a-form-item label="人员类型:" style="padding: 5px 0">
                <a-select v-model:value="queryForm.personType"
                          mode="multiple"
                          :maxTagCount="1"
                          style="width: 240px">
                    <a-select-option :value="1">店员</a-select-option>
                    <a-select-option :value="0">顾客</a-select-option>
                    <a-select-option :value="-99">未知</a-select-option>
                </a-select>
            </a-form-item>
            <a-form-item label="年龄类型:" style="padding: 5px 0">
                <a-select v-model:value="queryForm.childAdult"
                          mode="multiple"
                          :maxTagCount="1"
                          style="width: 240px">
                    <a-select-option :value="1">成人</a-select-option>
                    <a-select-option :value="0">儿童</a-select-option>
                    <a-select-option :value="-1">未知</a-select-option>
                </a-select>
            </a-form-item>
            <a-form-item label="选择日期:" style="padding: 5px 0">
                <a-date-picker v-model:value="queryForm.date" :format="'YYYY-MM-DD'" :allowClear="false" style="width: 240px"/>
            </a-form-item>
            <a-form-item label="选择时间:" style="padding: 5px 0">
                <a-time-picker format="HH:mm:ss" valueFormat="HH:mm:ss" v-model:value="queryForm.startTime" style="width: 140px"/>
                <a-time-picker format="HH:mm:ss" valueFormat="HH:mm:ss" v-model:value="queryForm.endTime" style="width: 140px"/>
            </a-form-item>
            <a-form-item label="图片数量:" style="padding: 5px 0">
                <a-input v-model:value="queryForm.minPic" style="width: 129px"/>

                <a-input v-model:value="queryForm.maxPic" style="width: 129px"/>
            </a-form-item>
            <a-form-item style="padding: 5px 0">
                <a-button type="primary" @click="clickSearch" :loading="isLoading">查询</a-button>
            </a-form-item>
        	<a-form-item style="padding: 5px 0">
        			<a-button type="primary" @click="comparativeFun">特征对比</a-button>
        	</a-form-item>
        	<a-form-item style="padding: 5px 0">
        			<a-button type="primary" @click="singleComparativeFun">单张特征对比</a-button>
        	</a-form-item>
        	<a-form-item style="padding: 5px 0">
        			<a-button type="primary" @click="clerkComparativeFun">店员特征对比</a-button>
        	</a-form-item>
					<a-form-item style="padding: 5px 0">
							<a-button type="primary" @click="personnelComparativeFun">人员特征对比</a-button>
					</a-form-item>
          <a-form-item style="padding: 0px 5px;border: 1px solid #ccc;border-radius: 6px;">
            <a-button type="primary" @click="handleMutipleOperation">{{mutipleOperationText}}</a-button>
            <i class="el-icon-arrow-right" style="margin: 0px 10px;"></i>
            <el-button type="text" :disabled="!isMultipleOperation" @click="movePersonRecord(person)">移动</el-button>
            <a-popconfirm
                title="将从本组中剔除,您确认吗?"
                ok-text="是"
                cancel-text="否"
                @confirm="deletePersonRecord(person)"
            >
              <el-button type="text" :disabled="!isMultipleOperation">剔除</el-button>
            </a-popconfirm>
            <a-popconfirm
                title="将彻底删除,您确认吗?"
                ok-text="是"
                cancel-text="否"
                @confirm="deleteRealPersonRecord(person)"
            >
              <el-button type="text" :disabled="!isMultipleOperation">删除</el-button>
            </a-popconfirm>
          </a-form-item>
        </a-form>

        <div v-loading="isLoading">
            <div class="resultContent" :style="{'height':contentHeight+'px'}">
                <template v-for="person in dataList">
                    <div class="classBox" :class="person.expand?'expand':''">
                        <div :class="person.checked?'checked':''">
                            <div class="boxInfo">
                                <span class="iconExpand" v-show="!person.expand"></span>
                                <span class="iconExpand" v-show="person.expand"></span>

                                <span class="expandWord" @click='expandChange(person)'>{{person.expand?'收起':'展开'}}</span>
                                <!--修正组类型数据-->
                                <span class="expandWord" @click='updatePersonInfoByGroup(person)'>类型修正</span>
                                <span class="expandWord" @click='searchPersonInfoByGroup(person)'>搜索</span>

                                <el-checkbox class="checkBox" v-model="person.checked" @change='checkChange(person)'></el-checkbox>
                                人id:{{ '   ' + person.person_unid }}
                                图片数量:{{ person.perrsonList.length }}
                            </div>
                            <el-row v-for="row in getPagedList(person.perrsonList, 8)">
                                <el-col :span="3" v-for="item in row">
                                    <div
                                        style="margin: 0 5px"
                                        :class="[(currentItemId==item.id)?'actived':'', isSelectedPerson(item.id)?'actived-red':'']"
                                        @click="handleClick(item, $event)"
                                    >
                                        <div style="">
                                            <span @click="downloadTrajectoryFile(item.track_url)"
                                                  class="downBtn">
                                                轨迹
                                            </span>
                                            <span @click="downloadFile(item.features_url)"
                                                  class="downBtn downBtn1">
                                                特征
                                            </span>
                                        </div>
                                        <el-image :src="item.picture_url"
                                                  :fit="'fill'"
                                                  class="single-image">
                                        </el-image>
                                        <div>时间:{{ item.counttime }}</div>
                        				<div>人员类型:{{ item.person_type==1?'店员':(item.person_type==0?'顾客':'未知') }}({{ item.childAdult==1?'成人':(item.childAdult==0?'儿童':'未知') }})</div>
                                        <div>性别:{{ formatGender(item.gender) }}({{item.age}})</div>
                                        <div class="direction" :class="'direction'+item.direction">方向:{{ formatDirection(item.direction) }}</div>
                                        <div>地点:{{ item.gate_name }}</div>
                                    </div>
                                </el-col>
                            </el-row>
                        </div>
                    </div>
                </template>
            </div>
            <a-pagination
                v-model:current="pageNum"
                v-model:pageSize="pageSize"
                :total="total"
                :show-total="total => `共 ${total} 条`"
                :pageSizeOptions="['10', '20', '40', '80']"
                @change="onPageNumChange"
                @showSizeChange="onPageSizeChange"
                show-size-changer
                show-quick-jumper
                style="text-align:center;margin-top: 10px;"
            />
        </div>
    </div>
    <!-- <imgDialog ref='imgModelRef'></imgDialog> -->
	<DetailDialog ref="DetailDialogRef" />
	<PersonnelDialog ref="personnelDialogRef" />
	<DetailDialogComparison ref="DetailDialogComparisonRef" />
	<singleImgComparisonDialog ref="singleImgComparisonRef"></singleImgComparisonDialog>

  <PersonGroupEditor ref='personGroupEditorRef' @refresh="handleRefresh" />
  <PersonGroupMover ref='personGroupMoverRef' :data-params="currentSearchCondition" :data-list="dataList" @refresh="handleRefresh" />
  <PersonGroupDialog ref='personGroupDialogRef' :query-form="queryForm" @refresh="handleRefresh" />
</template>

<script>
import {computed, reactive, ref, toRaw} from 'vue'
import clusterResultApi from '@/views/SnapshotCluster/ClusterResult/ClusterResultApi'
import {isArray} from '@/PublicUtil/Judgment'
import moment from 'moment'
import {filterEmptyValueInObject, formatDate, formatTime, getPagedList} from '@/PublicUtil/PublicUtil'
// import imgDialog from '../imgDialog.vue'
import {ElMessage} from 'element-plus'
import DetailDialog from "../../ComparisonCapturedPictures/DetailDialog.vue";
import PersonnelDialog from "../../ComparisonCapturedPictures/PersonnelDialog.vue";
import DetailDialogComparison from "../../ComparisonCapturedPictures/DetailDialogComparisonNew.vue";
import singleImgComparisonDialog from "../singleImgComparisonDialog.vue";
import PersonGroupEditor from "./PersonGroupEditor.vue";
import PersonGroupDialog from "./PersonGroupDialog.vue";
import PersonGroupMover from "./PersonGroupMover.vue";

export default {
    components:{
      PersonGroupEditor,
      PersonGroupDialog,
      PersonGroupMover,
      // imgDialog
		DetailDialog,
		PersonnelDialog,
		DetailDialogComparison,
		singleImgComparisonDialog
    },
    setup() {
        // scalar
        const pageNum = ref(1)
        const pageSize = ref(10)
        const total = ref()
        const isLoading = ref(false)
		const currobj = ref({})
		const currentItemId = ref()
        // sequence
        const dataList = ref([])
        const accountList = ref([])
        const plazaList = ref([])
        const zoneList = ref([])
        const gateList = ref([])
        // const imgModelRef = ref();
        const pagedTableDataList = computed(
            () => {
                return getPagedList(dataList.value, 8)
            }
        )
		const DetailDialogRef = ref();
		const personnelDialogRef = ref();
		const DetailDialogComparisonRef = ref();
		const singleImgComparisonRef = ref()
        const queryForm = reactive(
            {
                account_id: [],
                plaza_id: [],
                zone_id: [],
                gate_id: [],
                type: 0,
                direction: [1, -1, 0],
                picType: 2,
                personType: [1, 0],
                date: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),
                startTime: '00:00:00',
                endTime: '23:59:59',
                minPic: 0,
                maxPic: 100,
                childAdult:[],
            }
        )
        const searchCondition = ref({})
        if(window.localStorage.getItem('searchCondition')){
            searchCondition.value = JSON.parse(window.localStorage.getItem('searchCondition'));
            queryForm.type = searchCondition.value.type;
            queryForm.zone_id = searchCondition.value.zone_id;
            queryForm.gate_id = searchCondition.value.gate_id;
            queryForm.direction = searchCondition.value.direction;
						queryForm.childAdult = searchCondition.value.childAdult;
            queryForm.picType = searchCondition.value.picType;
            queryForm.date = searchCondition.value.date;
            queryForm.startTime = searchCondition.value.startTime;
            queryForm.endTime = searchCondition.value.endTime;
            queryForm.minPic = searchCondition.value.minPic||0;
            queryForm.maxPic = searchCondition.value.maxPic||100;
        }
        // function
        const onPageNumChange = function(num) {
            pageNum.value = num
            confirmSearch()
        }

        const onPageSizeChange = function(current, size) {
            pageNum.value = 1
            pageSize.value = size
            confirmSearch()
        }

        const onAccountChange = function() {
            getPlazaList(1)
            // getZoneList()
            // getGateList()
        }

        const onPlazaChange = function() {
            getZoneList()
            getGateList()
        }

        const onZoneChange = function() {
            getGateList()
        }

        const getPlazaList = function(val) {
            queryForm.plaza_id = []
            plazaList.value = []
            clusterResultApi.getPlazaList(
                {
                    account_id: queryForm.account_id?queryForm.account_id.toString():''
                }
            ).then(
                (r) => {
                    if (isArray(r))
                    {
                        for (const item of r)
                        {
                            plazaList.value.push(
                                {
                                    value: item.id,
                                    label: item.name,
                                }
                            )
                        }
						if(plazaList.value.length>0){
							if(!val&&searchCondition.value.plaza_id && searchCondition.value.plaza_id.length>0){
							    queryForm.plaza_id = searchCondition.value.plaza_id
							}else{
							    queryForm.plaza_id.push(plazaList.value[0].value)
							}
							getZoneList(1)
							getGateList(1)
							confirmSearch()
						}
                    }
                }
            )
        }

        const getZoneList = function(val) {
            zoneList.value = []
            clusterResultApi.getZoneList(
                {
                    account_id: queryForm.account_id?queryForm.account_id.toString():'',
                    plaza_id: queryForm.plaza_id?queryForm.plaza_id.toString():'',
                }
            ).then(
                (r) => {
                    if (isArray(r))
                    {
                        for (const item of r)
                        {
                            zoneList.value.push(
                                {
                                    value: item.id,
                                    label: item.name,
                                }
                            )
                        }
                        if(zoneList.value.length){
                            if(val&&searchCondition.value.zone_id && searchCondition.value.zone_id.length>0){
                                queryForm.zone_id = searchCondition.value.zone_id
                            }else{
                                queryForm.zone_id = []
                            }
                        }else{
                            queryForm.zone_id = []
                        }
                    }
                }
            )
        }

        const getGateList = function(val) {
            gateList.value = []
            clusterResultApi.getGateList(
                {
                    account_id: queryForm.account_id?queryForm.account_id.toString():'',
                    plaza_id: queryForm.plaza_id?queryForm.plaza_id.toString():'',
                    zone_id: queryForm.zone_id?queryForm.zone_id.toString():'',
                    type: queryForm.type,
                }
            ).then(
                (r) => {
                    if (isArray(r.data))
                    {
                        for (const item of r.data)
                        {
                            gateList.value.push(
                                {
                                    value: item.id,
                                    label: item.name,
                                }
                            )
                        }
                        if(gateList.value.length){
                            if(val&&searchCondition.value.gate_id && searchCondition.value.gate_id.length>0){
                                queryForm.gate_id = searchCondition.value.gate_id
                            }else{
                                queryForm.gate_id = []
                            }
                        }else{
                            queryForm.gate_id = []
                        }
                    }
                }
            )
        }

        const getAccountList = function() {
            queryForm.account_id = []
            accountList.value = []
            clusterResultApi.getAccountList().then(
                (r) => {
                    if (isArray(r))
                    {
                        for (const item of r)
                        {
                            accountList.value.push(
                                {
                                    value: item.id,
                                    label: item.name,
                                }
                            )
                        }
						if(accountList.value.length){
                            if(searchCondition.value.account_id && searchCondition.value.account_id.length>0){
                                queryForm.account_id = searchCondition.value.account_id
                            }else{
                                queryForm.account_id.push(accountList.value[0].value)
                            }
							getPlazaList()
						}
                    }
                }
            )
        }
		const clickSearch = function() {
			pageNum.value = 1
			confirmSearch()
		}
    const handleRefresh = function() {
      isMultipleOperation.value = false
      selectedPersonList.value = []
      confirmSearch()
    }
        const currentSearchCondition = ref()
        const confirmSearch = function() {
            isLoading.value = true
            const rawData = toRaw(queryForm)
            const data = filterEmptyValueInObject(
                {
                    account_id: rawData.account_id?rawData.account_id.toString():'',
                    type: rawData.type,
                    plaza_id: rawData.plaza_id?rawData.plaza_id.toString():'',
                    zone_id: rawData.zone_id?rawData.zone_id.toString():'',
                    gate_id: rawData.gate_id?rawData.gate_id.toString():'',
                    direction: rawData.direction?rawData.direction.toString():'',
                    picType: rawData.picType,
                    personType: rawData.personType?rawData.personType.toString():'',
                    startTime: formatDate(rawData.date) + ' ' + rawData.startTime,
                    endTime: formatDate(rawData.date) + ' ' + rawData.endTime,
                    minPic: rawData.minPic,
                    maxPic: rawData.maxPic,
                    page: pageNum.value - 1,
                    pageSize: pageSize.value,
                    childAdult: rawData.childAdult?rawData.childAdult.toString():'',
                }
            )
            const storageData = filterEmptyValueInObject(
                {
                    account_id: rawData.account_id,
                    type: rawData.type,
                    plaza_id: rawData.plaza_id,
                    zone_id: rawData.zone_id,
                    gate_id: rawData.gate_id,
                    direction: rawData.direction,
                    picType: rawData.picType,
                    personType: rawData.personType,
										childAdult: rawData.childAdult,
                    date: rawData.date,
                    minPic: rawData.minPic,
                    maxPic: rawData.maxPic,
                    startTime: rawData.startTime,
                    endTime: rawData.endTime,
                }
            )
						let searchCondition = JSON.parse(window.localStorage.getItem('searchCondition'));
						let newSearchCondition = {
							...searchCondition,
							...storageData
						}
            window.localStorage.setItem('searchCondition',JSON.stringify(newSearchCondition))
            clusterResultApi.getClusterResultList(data).then(
                (r) => {
                    isLoading.value = false
                    sortDataList(r.data.persons)
                    r.data.persons.forEach((itemPerson)=>{
                        itemPerson.checked = false
                        itemPerson.expand = false
                        itemPerson.perrsonList.forEach((item)=>{
                            if (item.features_url) {
                                item.features_url = window._baseImgUrl + item.features_url
                            }
                            if (item.picture_url) {
                                item.picture_url = window._baseImgUrl + item.picture_url
                            }
                            if (item.track_url) {
                                item.track_url = window._baseImgUrl + item.track_url
                            }
                        })
                    })
                    dataList.value = r.data.persons
                    total.value = r.data.pageNum
                    document.getElementsByClassName('resultContent')[0].scrollTop = 0
                    currentSearchCondition.value = data
                }
            )
        }
        const formatGender = function(number){
            switch (number)
            {
                case 1:
                {
                    return '男'
                }
                case -1:
                {
                    return '未知'
                }
                case 0:
                {
                    return '女'
                }
                default:
                {

                    break
                }
            }
        }
        const formatDirection = function(number) {
            switch (number)
            {
                case 1:
                {
                    return '进'
                }
                case -1:
                {
                    return '出'
                }
                case 0:
                {
                    return '横穿'
                }
                default:
                {

                    break
                }
            }
        }
        const sortDataList = function(list) {
            list.sort(
                (a, b) => {
                    return (b.perrsonList.length - a.perrsonList.length)
                }
            )
        }

        // 人员类型修正
        const personGroupEditorRef = ref();
        // const isShowGroupEditor = ref(false)
        const updatePersonInfoByGroup = function(data) {
          console.log('updatePersonInfoByGroup', data)
          // isShowGroupEditor.value = true
          personGroupEditorRef.value.initDialog(data);
        }

        // 批量操作
        const isMultipleOperation = ref(false)
        const handleMutipleOperation = () => {
          // 在当前组操作,批量按钮
          if (isMultipleOperation.value) {
            // 已经是多选状态
            isMultipleOperation.value = false
            selectedPersonList.value = []
          } else {
            // 非多选状态
            isMultipleOperation.value = true
          }
        }
        const mutipleOperationText = computed(() => {
          if (isMultipleOperation.value) {
            return '取消操作'
          } else {
            return '批量操作'
          }
        })

        const isSelectedPerson = (id) => {
          return selectedPersonList.value.some(item => item.id === id)
        }
        // 剔除人员
        const selectedPersonList = ref([]) // 批量操作,选中的图片
        const deletePersonRecord = () => {
          console.log('deletePersonRecord', selectedPersonList)
          if (selectedPersonList.value.length < 1) {
            ElMessage({
              message: `至少选择一条数据`,
              type: 'error'
            })
            return
          }

          const unidList = selectedPersonList.value.map(item => item.unid)
          const params = {
            unid: unidList.join(','),
            personUnid: '',
            countdate: selectedPersonList.value[0].counttime
          }
          clusterResultApi.updateRecognition(params).then(
              (r) => {
                if(r.msg_code==200){
                  ElMessage({
                    message: `剔除成功`,
                    type: 'success'
                  })
                  selectedPersonList.value = []
                  // 刷新列表
                  handleRefresh()
                } else {
                  ElMessage({
                    message: `剔除失败`,
                    type: 'error'
                  })
                }
              }
          )
        }
        // 删除人员
        const deleteRealPersonRecord = () => {
          console.log('deletePersonRecord', selectedPersonList)
          if (selectedPersonList.value.length < 1) {
            ElMessage({
              message: `至少选择一条数据`,
              type: 'error'
            })
            return
          }

          const strIdList = selectedPersonList.value.map(item => item.id).join(',')
          const params = {
            id: strIdList,
          }

          clusterResultApi.deleteRecognition(params).then(
              (r) => {
                if(r.msg_code==200){
                  ElMessage({
                    message: `删除成功`,
                    type: 'success'
                  })
                  selectedPersonList.value = []
                  // 刷新列表
                  handleRefresh()
                } else {
                  ElMessage({
                    message: `删除失败`,
                    type: 'error'
                  })
                }
              }
          )
        }
        // 移动人员
        const personGroupMoverRef = ref();
        const movePersonRecord = () => {
          console.log('movePersonRecord')
          if (selectedPersonList.value.length < 1) {
            ElMessage({
              message: `至少选择一条数据`,
              type: 'error'
            })
            return
          }

          personGroupMoverRef.value.initDialog(selectedPersonList.value);
        }
        // 查询组
        const personGroupDialogRef = ref();
        const searchPersonInfoByGroup = function(data) {
          console.log('searchPersonInfoByGroup', data)
          /* let parmas = {
            // person_unid: currobj.value.person_unid,
            pic_type: data.picType,
            endTime:formatDate(rawData.date) + ' ' + rawData.endTime,
            startTime:formatDate(rawData.date) + ' ' + rawData.startTime,
            countdate:formatDate(rawData.date),
            pic_id:currobj.value.id,
            ip:window._baseImgUrl,
            plaza_id:currobj.value.mall_id
          } */
          // singleImgComparisonRef.value.initDialog(parmas);

          personGroupDialogRef.value.initDialog(data);
        }

        const downloadFile = function(url) {
            window.open(url)
        }
        const downloadTrajectoryFile = function(url){
            window.open(url)
        }
        const handleClick = function(data, event){
          console.log('handleClick', data, event)
          // 多选。只有设置为多选状态的组,才可以选中
          if (isMultipleOperation.value) {
            selectedPersonList.value.push(data)
          } else {
            currentItemId.value = data.id
            currobj.value = data;
            // 清空多选
            selectedPersonList.value = []
          }
        }
		const checkChange = function(data){
			console.log(data)
		}
        const expandChange = function(data){
            dataList.value.forEach(item=>{
            	if (data.person_unid == item.person_unid) {
            		item.expand = !item.expand
            	}
            })
        }
		// 特征对比
        const comparativeFun = function(){
			const rawData = toRaw(queryForm)
			if(!currobj.value.id){
				ElMessage(
					{
						message: `请选择图片`,
						type: 'warning'
					}
				)
				return
			}
			if(!currobj.value.picture_url){
				ElMessage(
					{
						message: `该图片没有特征,请选择有效的图片`,
						type: 'warning'
					}
				)
				return
			}
			let parmas = {
				mall_id:currobj.value.mall_id,
				picType:rawData.picType,
				pic_id:currobj.value.id,
				countdate:formatDate(rawData.date),
				dataList:[]
			}
			dataList.value.forEach(item=>{
				if (item.checked && item.checked == true) {
					parmas.dataList.push(item)
				}
			})
			if(parmas.dataList && parmas.dataList.length > 0){
				DetailDialogComparisonRef.value.initDialog(currobj.value,parmas);
			}else{
				ElMessage(
					{
						message: `请选择聚类图片`,
						type: 'warning'
					}
				)
				return
			}
        }
		//单张特征对比
		const singleComparativeFun = function(){
			if(!currobj.value.id){
				ElMessage(
					{
						message: `请选择图片`,
						type: 'warning'
					}
				)
				return
			}
			if(!currobj.value.picture_url){
				ElMessage(
					{
						message: `该图片没有特征,请选择有效的图片`,
						type: 'warning'
					}
				)
				return
			}
			const rawData = toRaw(queryForm)
			console.log(queryForm)
			console.log(rawData)
			let parmas = {
			    person_unid:currobj.value.person_unid,
			    pic_type:rawData.picType,
					endTime:formatDate(rawData.date) + ' ' + rawData.endTime,
					startTime:formatDate(rawData.date) + ' ' + rawData.startTime,
			    countdate:formatDate(rawData.date),
			    pic_id:currobj.value.id,
			    ip:window._baseImgUrl,
				plaza_id:currobj.value.mall_id
			}
			singleImgComparisonRef.value.initDialog(parmas);
		}
		// 店员特征对比
		const clerkComparativeFun = function(){
			const rawData = toRaw(queryForm)
			if(!currobj.value.id){
					ElMessage(
						{
							message: `请选择图片进行对比`,
							type: 'warning'
						}
					)
					return
			}
			if(!currobj.value.picture_url){
					ElMessage(
						{
							message: `该图片没有特征,请选择有效的图片`,
							type: 'warning'
						}
					)
					return
			}
			let parmas = {
					plaza_id:currobj.value.mall_id,
					pic_type:rawData.picType,
					pic_id:currobj.value.id,
					ip:window._baseImgUrl,
					countdate:formatDate(rawData.date)
			}
			DetailDialogRef.value.initDialog(currobj.value,parmas);
		}
		// 人员特征对比
		const personnelComparativeFun = function(){
			const rawData = toRaw(queryForm)
			if(!currobj.value.id){
					ElMessage(
						{
							message: `请选择图片进行对比`,
							type: 'warning'
						}
					)
					return
			}
			if(!currobj.value.picture_url){
					ElMessage(
						{
							message: `该图片没有特征,请选择有效的图片`,
							type: 'warning'
						}
					)
					return
			}
			let parmas = {
					plaza_id:currobj.value.mall_id,
					pic_type:rawData.picType,
					pic_id:currobj.value.id,
					ip:window._baseImgUrl,
					countdate:formatDate(rawData.date)
			}
			personnelDialogRef.value.initDialog(currobj.value,parmas);
		}

        const contentHeight = ref(0)
        const __main = function() {
            getAccountList()
            contentHeight.value = window.innerHeight - 280
        }

        __main()

        return {
            // scalar
            isLoading,
            pageNum,
            pageSize,
            total,
			currentItemId,
			currobj,
            // sequence
            accountList,
            plazaList,
            zoneList,
            gateList,
            pagedTableDataList,
            dataList,
            contentHeight,
            // mapping
            queryForm,
            // function
            onPageNumChange,
            onPageSizeChange,
            onAccountChange,
            onPlazaChange,
            onZoneChange,
            confirmSearch,
            formatDirection,
            downloadFile,
            getPagedList,
            handleClick,
			comparativeFun,
			checkChange,
            expandChange,
            updatePersonInfoByGroup,
            deletePersonRecord,
            movePersonRecord,
            searchPersonInfoByGroup,
            isSelectedPerson,
            selectedPersonList,
			clerkComparativeFun,
			personnelComparativeFun,
			singleComparativeFun,
            formatGender,
            downloadTrajectoryFile,
			clickSearch,
          handleRefresh,
          currentSearchCondition,
            // ref
            // imgModelRef,
			DetailDialogRef,
			personnelDialogRef,
      personGroupDialogRef,
      personGroupEditorRef,
			DetailDialogComparisonRef,
			singleImgComparisonRef,
      personGroupMoverRef,

          isMultipleOperation,
          handleMutipleOperation,
          mutipleOperationText,
          deleteRealPersonRecord,
        }
    }
}
</script>

<style lang="less" scoped>
@import "./ClusterResult";
.actived{
        border: 3px solid #1890ff;
    }
.actived-red {
  border: 3px solid red;
}
	.checkBox{
		margin-left: 10px;
	}
    .boxInfo{
        line-height: 28px;
        margin-bottom: 10px;
    }
    .classBox{
        margin: 10px 0;
        border: solid 1px black;
        height: 485px;
        overflow-y: hidden;
    }
    .expand{
        height: auto;
        overflow: auto;
    }
    .expandWord{
        color: #1890ff;
        margin-right: 5px;
        cursor: pointer;
        float: right;
    }
    .iconExpand{
        cursor: pointer;
        float: right;
        color: #1890ff;
        margin-right: 20px;
    }
    .checked{
        background-color: #bbb;
    }
    .resultContent{
        overflow: auto;
        min-height: 500px;
    }
    .downBtn{
        color: #409EFF;
        font-size: 15px;
        cursor: pointer;
        display: inline-block;
        width: auto;
    }
    .downBtn1{
        float: right;
    }
    .multiple-operation {
      display: inline-block;
      margin-left: 20px;
    }
</style>