Commit 86c7be32 by Tianqing Liu

feat: 新批量搜索布局

1 parent e874b15a
......@@ -96,7 +96,7 @@
</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'" style="width: 240px"/>
<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"/>
......@@ -119,6 +119,27 @@
<a-form-item style="padding: 5px 0">
<a-button type="primary" @click="clerkComparativeFun">店员特征对比</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">批量操作</a-button>
<i class="el-icon-arrow-right" style="margin: 0px 10px;"></i>
<el-button type="text" @click="movePersonRecord(person)">移动</el-button>
<a-popconfirm
title="将从本组中剔除,您确认吗?"
ok-text="是"
cancel-text="否"
@confirm="deletePersonRecord(person)"
>
<el-button type="text" :disabled="mutipleOperationDisabled || !isCurrentGroup(person)">剔除</el-button>
</a-popconfirm>
<a-popconfirm
title="将彻底删除,您确认吗?"
ok-text="是"
cancel-text="否"
@confirm="deleteRealPersonRecord(person)"
>
<el-button type="text" :disabled="mutipleOperationDisabled || !isCurrentGroup(person)">删除</el-button>
</a-popconfirm>
</a-form-item>
</a-form>
<div v-loading="isLoading">
......
......@@ -94,7 +94,7 @@
</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'" style="width: 280px"/>
<a-date-picker v-model:value="queryForm.date" :format="'YYYY-MM-DD'" :allowClear="false" style="width: 280px"/>
</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"/>
......
<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" :maxTagCount="1" :options="plazaList" optionFilterProp="label" show-search>
</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'" 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" />
<span style="padding: 0 4px"></span>
<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-number v-model:value="queryForm.minNum" :min="0" :max="100000000" style="width: 140px"/> <span style="padding: 0 4px"></span> <a-input-number v-model:value="queryForm.maxNum" :min="queryForm.maxNum||0" :max="100000000" style="width: 140px"/> </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="concatBatches">合并</a-button> </a-form-item> <a-form-item style="padding: 5px 0"> <a-button type="primary" @click="deleteBatches">删除</a-button> </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>
<el-checkbox class="checkBox" v-model="person.checked" @change='checkChange(person)'></el-checkbox>
批次id:{{ ' ' + person.groupUnid }}
<span style="margin-left: 20px;">图片数量:{{ person.personRecordList.length }}</span>
</div>
<el-row v-for="row in getPagedList(person.personRecordList, 8)">
<el-col :span="3" v-for="item in row">
<div style="margin: 0 2px;border: 3px solid transparent;" @click="handleClick(item)" :class="currentItemId==item.id?'actived':''">
<el-image :src="item.faceRecognitionVo.picture_url" :fit="'fill'" class="single-image">
</el-image>
<div style="padding-left: 5px;padding-right: 5px;">
<div style="width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">unid:{{ item.faceRecognitionVo.unid||'--' }}</div>
<div style="width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">personid:{{ item.faceRecognitionVo.person_unid||'--' }}</div>
<div>时间:{{ item.faceRecognitionVo.counttime }}</div>
<div>类型:{{ item.faceRecognitionVo.person_type==1?'店员':(item.faceRecognitionVo.person_type==0?'顾客':'未知') }}({{ item.faceRecognitionVo.childAdult==1?'成人':(item.faceRecognitionVo.childAdult==0?'儿童':'未知') }})</div>
<div>性别:{{ formatGender(item.faceRecognitionVo.gender) }}({{item.age}})</div>
<div>地点:{{ item.faceRecognitionVo.gate_name }}</div>
</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" />
</div>
</div>
</template>
<script>
import {
reactive,
ref,
toRaw
} from 'vue'
import batchesResultApi from '@/views/SnapshotCluster/batchesResult/batchesResultApi'
import {
isArray
} from '@/PublicUtil/Judgment'
import moment from 'moment'
import {
filterEmptyValueInObject,
formatDate,
getPagedList
} from '@/PublicUtil/PublicUtil'
import {ElMessage,ElMessageBox} from 'element-plus'
export default {
components: {
},
setup() {
// scalar
const pageNum = ref(1)
const pageSize = ref(10)
const total = ref()
const isLoading = ref(false)
const dataList = ref([])
const accountList = ref([])
const plazaList = ref([])
const currobj = ref({})
const currentItemId = ref()
const queryForm = reactive({
account_id: [],
plaza_id: '',
date: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),
startTime: '00:00:00',
endTime: '23:59:59',
minNum: 0,
maxNum: 100000,
})
const searchCondition = ref({})
if (window.localStorage.getItem('searchCondition')) {
searchCondition.value = JSON.parse(window.localStorage.getItem('searchCondition'));
queryForm.startTime = searchCondition.value.startTime;
queryForm.endTime = searchCondition.value.endTime;
queryForm.minNum = searchCondition.value.minNum || 0;
queryForm.maxNum = searchCondition.value.maxNum || 100000;
queryForm.date = searchCondition.value.date;
}
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)
}
const getPlazaList = function(val) {
queryForm.plaza_id = ''
plazaList.value = []
batchesResultApi.getPlazaList({
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[0]
} else {
queryForm.plaza_id = plazaList.value[0].value
}
confirmSearch()
}
}
}
)
}
const getAccountList = function() {
queryForm.account_id = []
accountList.value = []
batchesResultApi.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 confirmSearch = function() {
isLoading.value = true
const rawData = toRaw(queryForm)
const data = filterEmptyValueInObject({
mallId: rawData.plaza_id,
countDate: formatDate(rawData.date),
startTime: formatDate(rawData.date) + ' ' + rawData.startTime,
endTime: formatDate(rawData.date) + ' ' + rawData.endTime,
minNum: rawData.minNum,
maxNum: rawData.maxNum,
pageNum: pageNum.value,
pageSize: pageSize.value,
})
const storageData = filterEmptyValueInObject({
account_id: rawData.account_id,
plaza_id: [rawData.plaza_id],
date: rawData.date,
minNum: rawData.minNum,
maxNum: rawData.maxNum,
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))
batchesResultApi.getBatchesResultList(data).then(
(r) => {
isLoading.value = false
if(r.data&&r.data.pageData) {
sortDataList(r.data.pageData)
r.data.pageData.forEach((itemPerson) => {
itemPerson.checked = false
itemPerson.expand = false
itemPerson.personRecordList.forEach((item) => {
if (item.faceRecognitionVo&&item.faceRecognitionVo.picture_url) {
item.faceRecognitionVo.picture_url = window._baseImgUrl + item.faceRecognitionVo.picture_url
}
if (item.faceRecognitionVo&&item.faceRecognitionVo.features_url) {
item.faceRecognitionVo.features_url = window._baseImgUrl + item.faceRecognitionVo.features_url
}
})
})
dataList.value = r.data.pageData
console.log(dataList.value)
total.value = r.data.total
}
document.getElementsByClassName('resultContent')[0].scrollTop = 0
}
)
}
const formatGender = 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.personRecordList.length - a.personRecordList.length)
}
)
}
const checkChange = function(data) {
console.log(data)
}
const expandChange = function(data) {
dataList.value.forEach(item => {
if (data.groupUnid == item.groupUnid) {
item.expand = !item.expand
}
})
}
// 批次合并
const concatBatches = function() {
const rawData = toRaw(queryForm)
let selectArr = []
dataList.value.forEach(item => {
if (item.checked && item.checked == true) {
selectArr.push(item)
}
})
if (selectArr.length != 2) {
ElMessage({
message: `请选择两个批次分组进行合并`,
type: 'warning'
})
return
}
console.log(selectArr)
let parmas = {
countDate: formatDate(rawData.date),
sourceGroupUnid:selectArr[0].groupUnid,
targetGroupUnid:selectArr[1].groupUnid,
mallId: rawData.plaza_id,
}
ElMessageBox.confirm('是否合并选中的两个批次分组?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
}).then(() => {
batchesResultApi.concatTwoBatches(parmas).then(
(res) => {
if(res.code == 200) {
ElMessage({
message: `合并成功`,
type: 'success'
})
confirmSearch()
} else {
ElMessage({
message: `删除失败`,
type: 'warning'
})
}
}
)
}).catch(() => {})
}
//删除批次记录
const deleteBatches = function(){
if(!currentItemId.value){
ElMessage(
{
message: `请选择图片`,
type: 'warning'
}
)
return
}
if(!currobj.value.picture_url){
ElMessage(
{
message: `请选择有效的图片`,
type: 'warning'
}
)
return
}
ElMessageBox.confirm('是否确认删除该批次记录?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
}).then(() => {
batchesResultApi.deleteOneBatches({id:currentItemId.value}).then(
(res) => {
console.log(res)
if(res.code == 200) {
ElMessage({
message: `删除成功`,
type: 'success'
})
confirmSearch()
currentItemId.value = ''
currobj.value = {};
} else {
ElMessage({
message: `删除失败`,
type: 'warning'
})
}
}
)
}).catch(() => {})
}
const handleClick = function(data){
currentItemId.value = data.id
currobj.value = data;
}
const contentHeight = ref(0)
const __main = function() {
getAccountList()
contentHeight.value = window.innerHeight - 310
}
__main()
return {
isLoading,
pageNum,
pageSize,
total,
accountList,
plazaList,
dataList,
contentHeight,
currentItemId,
currobj,
handleClick,
queryForm,
onPageNumChange,
onPageSizeChange,
onAccountChange,
confirmSearch,
getPagedList,
checkChange,
expandChange,
formatGender,
clickSearch,
concatBatches,
deleteBatches,
}
}
}
</script>
<style lang="less" scoped>
@import "./batchesResult";
.actived {
border: 3px solid #1890ff!important;
}
.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;
}
</style>
\ No newline at end of file
<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" :maxTagCount="1" :options="plazaList" optionFilterProp="label" show-search>
</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" />
<span style="padding: 0 4px"></span>
<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-number v-model:value="queryForm.minNum" :min="0" :max="100000000" style="width: 140px"/>
<span style="padding: 0 4px"></span>
<a-input-number v-model:value="queryForm.maxNum" :min="queryForm.maxNum||0" :max="100000000" style="width: 140px"/>
</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="concatBatches">合并</a-button>
</a-form-item>
<a-form-item style="padding: 5px 0">
<a-button type="primary" @click="deleteBatches">删除</a-button>
</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>
<el-checkbox class="checkBox" v-model="person.checked" @change='checkChange(person)'></el-checkbox>
批次id:{{ ' ' + person.groupUnid }}
<span style="margin-left: 20px;">图片数量:{{ person.personRecordList.length }}</span>
</div>
<el-row v-for="row in getPagedList(person.personRecordList, 8)">
<el-col :span="3" v-for="item in row">
<div style="margin: 0 2px;border: 3px solid transparent;" @click="handleClick(item)" :class="currentItemId==item.id?'actived':''">
<el-image :src="item.faceRecognitionVo.picture_url" :fit="'fill'" class="single-image">
</el-image>
<div style="padding-left: 5px;padding-right: 5px;">
<div style="width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">unid:{{ item.faceRecognitionVo.unid||'--' }}</div>
<div style="width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">personid:{{ item.faceRecognitionVo.person_unid||'--' }}</div>
<div>时间:{{ item.faceRecognitionVo.counttime }}</div>
<div>类型:{{ item.faceRecognitionVo.person_type==1?'店员':(item.faceRecognitionVo.person_type==0?'顾客':'未知') }}({{ item.faceRecognitionVo.childAdult==1?'成人':(item.faceRecognitionVo.childAdult==0?'儿童':'未知') }})</div>
<div>性别:{{ formatGender(item.faceRecognitionVo.gender) }}({{item.age}})</div>
<div>地点:{{ item.faceRecognitionVo.gate_name }}</div>
</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" />
</div>
</div>
</template>
<script>
import {
reactive,
ref,
toRaw
} from 'vue'
import batchesResultApi from '@/views/SnapshotCluster/batchesResult/batchesResultApi'
import {
isArray
} from '@/PublicUtil/Judgment'
import moment from 'moment'
import {
filterEmptyValueInObject,
formatDate,
getPagedList
} from '@/PublicUtil/PublicUtil'
import {ElMessage,ElMessageBox} from 'element-plus'
export default {
components: {
},
setup() {
// scalar
const pageNum = ref(1)
const pageSize = ref(10)
const total = ref()
const isLoading = ref(false)
const dataList = ref([])
const accountList = ref([])
const plazaList = ref([])
const currobj = ref({})
const currentItemId = ref()
const queryForm = reactive({
account_id: [],
plaza_id: '',
date: moment(moment().format('YYYY-MM-DD'), 'YYYY-MM-DD'),
startTime: '00:00:00',
endTime: '23:59:59',
minNum: 0,
maxNum: 100000,
})
const searchCondition = ref({})
if (window.localStorage.getItem('searchCondition')) {
searchCondition.value = JSON.parse(window.localStorage.getItem('searchCondition'));
queryForm.startTime = searchCondition.value.startTime;
queryForm.endTime = searchCondition.value.endTime;
queryForm.minNum = searchCondition.value.minNum || 0;
queryForm.maxNum = searchCondition.value.maxNum || 100000;
queryForm.date = searchCondition.value.date;
}
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)
}
const getPlazaList = function(val) {
queryForm.plaza_id = ''
plazaList.value = []
batchesResultApi.getPlazaList({
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[0]
} else {
queryForm.plaza_id = plazaList.value[0].value
}
confirmSearch()
}
}
}
)
}
const getAccountList = function() {
queryForm.account_id = []
accountList.value = []
batchesResultApi.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 confirmSearch = function() {
isLoading.value = true
const rawData = toRaw(queryForm)
const data = filterEmptyValueInObject({
mallId: rawData.plaza_id,
countDate: formatDate(rawData.date),
startTime: formatDate(rawData.date) + ' ' + rawData.startTime,
endTime: formatDate(rawData.date) + ' ' + rawData.endTime,
minNum: rawData.minNum,
maxNum: rawData.maxNum,
pageNum: pageNum.value,
pageSize: pageSize.value,
})
const storageData = filterEmptyValueInObject({
account_id: rawData.account_id,
plaza_id: [rawData.plaza_id],
date: rawData.date,
minNum: rawData.minNum,
maxNum: rawData.maxNum,
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))
batchesResultApi.getBatchesResultList(data).then(
(r) => {
isLoading.value = false
if(r.data&&r.data.pageData) {
sortDataList(r.data.pageData)
r.data.pageData.forEach((itemPerson) => {
itemPerson.checked = false
itemPerson.expand = false
itemPerson.personRecordList.forEach((item) => {
if (item.faceRecognitionVo&&item.faceRecognitionVo.picture_url) {
item.faceRecognitionVo.picture_url = window._baseImgUrl + item.faceRecognitionVo.picture_url
}
if (item.faceRecognitionVo&&item.faceRecognitionVo.features_url) {
item.faceRecognitionVo.features_url = window._baseImgUrl + item.faceRecognitionVo.features_url
}
})
})
dataList.value = r.data.pageData
console.log(dataList.value)
total.value = r.data.total
}
document.getElementsByClassName('resultContent')[0].scrollTop = 0
}
)
}
const formatGender = 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.personRecordList.length - a.personRecordList.length)
}
)
}
const checkChange = function(data) {
console.log(data)
}
const expandChange = function(data) {
dataList.value.forEach(item => {
if (data.groupUnid == item.groupUnid) {
item.expand = !item.expand
}
})
}
// 批次合并
const concatBatches = function() {
const rawData = toRaw(queryForm)
let selectArr = []
dataList.value.forEach(item => {
if (item.checked && item.checked == true) {
selectArr.push(item)
}
})
if (selectArr.length != 2) {
ElMessage({
message: `请选择两个批次分组进行合并`,
type: 'warning'
})
return
}
console.log(selectArr)
let parmas = {
countDate: formatDate(rawData.date),
sourceGroupUnid:selectArr[0].groupUnid,
targetGroupUnid:selectArr[1].groupUnid,
mallId: rawData.plaza_id,
}
ElMessageBox.confirm('是否合并选中的两个批次分组?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
}).then(() => {
batchesResultApi.concatTwoBatches(parmas).then(
(res) => {
if(res.code == 200) {
ElMessage({
message: `合并成功`,
type: 'success'
})
confirmSearch()
} else {
ElMessage({
message: `删除失败`,
type: 'warning'
})
}
}
)
}).catch(() => {})
}
//删除批次记录
const deleteBatches = function(){
if(!currentItemId.value){
ElMessage(
{
message: `请选择图片`,
type: 'warning'
}
)
return
}
if(!currobj.value.picture_url){
ElMessage(
{
message: `请选择有效的图片`,
type: 'warning'
}
)
return
}
ElMessageBox.confirm('是否确认删除该批次记录?', {
confirmButtonText: '确认',
cancelButtonText: '取消',
}).then(() => {
batchesResultApi.deleteOneBatches({id:currentItemId.value}).then(
(res) => {
console.log(res)
if(res.code == 200) {
ElMessage({
message: `删除成功`,
type: 'success'
})
confirmSearch()
currentItemId.value = ''
currobj.value = {};
} else {
ElMessage({
message: `删除失败`,
type: 'warning'
})
}
}
)
}).catch(() => {})
}
const handleClick = function(data){
currentItemId.value = data.id
currobj.value = data;
}
const contentHeight = ref(0)
const __main = function() {
getAccountList()
contentHeight.value = window.innerHeight - 310
}
__main()
return {
isLoading,
pageNum,
pageSize,
total,
accountList,
plazaList,
dataList,
contentHeight,
currentItemId,
currobj,
handleClick,
queryForm,
onPageNumChange,
onPageSizeChange,
onAccountChange,
confirmSearch,
getPagedList,
checkChange,
expandChange,
formatGender,
clickSearch,
concatBatches,
deleteBatches,
}
}
}
</script>
<style lang="less" scoped>
@import "./batchesResult";
.actived {
border: 3px solid #1890ff!important;
}
.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;
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!