|
@@ -10,46 +10,33 @@
|
|
|
<CusForm labelWidth="100px" @handleEnter="onSearch">
|
|
|
<CusFormColumn
|
|
|
label="席位编号:"
|
|
|
- v-model:param="queryForm.shipId"/>
|
|
|
+ v-model:param="queryForm.seatSerialNumber"/>
|
|
|
<CusFormColumn
|
|
|
- label="单位:"
|
|
|
- link="dept"
|
|
|
- v-model:param="queryForm.shipId"/>
|
|
|
+ label="发布单位:"
|
|
|
+ link="select"
|
|
|
+ v-model:param="queryForm.deptId"
|
|
|
+ :options="$store.state.dictionary.deptList"/>
|
|
|
<CusFormColumn
|
|
|
label="值班员:"
|
|
|
- v-model:param="queryForm.shipId"/>
|
|
|
+ v-model:param="queryForm.dutyPerson"/>
|
|
|
<CusFormColumn
|
|
|
label="联系方式:"
|
|
|
- v-model:param="queryForm.shipId"/>
|
|
|
+ v-model:param="queryForm.linkPhone"/>
|
|
|
<CusFormColumn
|
|
|
label="签卡类型:"
|
|
|
link="select"
|
|
|
- static
|
|
|
- v-model:param="queryForm.shipId"
|
|
|
- labelKey="label"
|
|
|
- valueKey="value"
|
|
|
- :options="[
|
|
|
- {label: '类型一', value: '1'},
|
|
|
- {label: '类型二', value: '2'},
|
|
|
- {label: '类型三', value: '3'},
|
|
|
- ]"/>
|
|
|
+ v-model:param="queryForm.type"
|
|
|
+ :options="$store.state.dictionary.signTypeList"/>
|
|
|
<CusFormColumn
|
|
|
label="签卡状态:"
|
|
|
link="select"
|
|
|
- static
|
|
|
- v-model:param="queryForm.shipId"
|
|
|
- labelKey="label"
|
|
|
- valueKey="value"
|
|
|
- :options="[
|
|
|
- {label: '类型一', value: '1'},
|
|
|
- {label: '类型二', value: '2'},
|
|
|
- {label: '类型三', value: '3'},
|
|
|
- ]"/>
|
|
|
+ v-model:param="queryForm.status"
|
|
|
+ :options="$store.state.dictionary.signStatusList"/>
|
|
|
<CusFormColumn
|
|
|
label="签卡时间:"
|
|
|
link="datetime"
|
|
|
type="datetimerange"
|
|
|
- v-model:param="queryForm.shipId"/>
|
|
|
+ v-model:param="queryForm.signTime"/>
|
|
|
<CusSearchButtons
|
|
|
@handleReset="handleReset"
|
|
|
@handleSearch="onSearch"
|
|
@@ -57,7 +44,7 @@
|
|
|
</CusForm>
|
|
|
</template>
|
|
|
<template #buttons>
|
|
|
- <div class="__cus-button_submit __hover">
|
|
|
+ <div class="__cus-button_submit __hover" @click="onExport">
|
|
|
<SvgIcon name="export" size="16"/>导出
|
|
|
</div>
|
|
|
</template>
|
|
@@ -70,9 +57,15 @@
|
|
|
:total="queryResult.total"
|
|
|
:page="queryPage.pageNum"
|
|
|
:pageSize="queryPage.pageSize"
|
|
|
+ v-model:selected="selected"
|
|
|
@handlePage="handlePage"
|
|
|
- @handleSort="handleSort"
|
|
|
>
|
|
|
+ <template #type-column-value="{ scope }">
|
|
|
+ {{$store.state.dictionary.signTypeMap.get(scope.row.type) || scope.row.type}}
|
|
|
+ </template>
|
|
|
+ <template #status-column-value="{ scope }">
|
|
|
+ <span :style="`color: ${$store.state.dictionary.signStatusColor.get(scope.row.status)};`">{{$store.state.dictionary.signStatusMap.get(scope.row.status) || scope.row.status}}</span>
|
|
|
+ </template>
|
|
|
</CusTable>
|
|
|
</template>
|
|
|
</CusContent>
|
|
@@ -95,6 +88,9 @@ import {
|
|
|
} from 'vue'
|
|
|
import {useStore} from 'vuex'
|
|
|
import {useRouter, useRoute} from 'vue-router'
|
|
|
+import {ElMessage} from "element-plus";
|
|
|
+import {getSignList, signExport} from "@/api/modules/sign";
|
|
|
+import {downLoadBlob} from "@/utils/downLoadUrl";
|
|
|
|
|
|
export default defineComponent({
|
|
|
name: '',
|
|
@@ -121,22 +117,24 @@ export default defineComponent({
|
|
|
queryForm: <any>{},
|
|
|
// 查询表单参数备份
|
|
|
back_queryForm: {},
|
|
|
- // 查询表格排序
|
|
|
- querySort: {},
|
|
|
// 表格表头
|
|
|
tableHead: [
|
|
|
- {value: "p1", label: "席位编号", show: true},
|
|
|
- {value: "p1", label: "单位", show: true},
|
|
|
- {value: "p1", label: "值班员", show: true},
|
|
|
- {value: "p1", label: "联系方式", show: true},
|
|
|
- {value: "p1", label: "签卡类型", show: true},
|
|
|
- {value: "p1", label: "签卡状态", show: true},
|
|
|
- {value: "p1", label: "签卡时间", show: true, width: 180},
|
|
|
+ {value: "seatSerialNumber", label: "席位编号", show: true},
|
|
|
+ {value: "unitName", label: "单位", show: true},
|
|
|
+ {value: "dutyPerson", label: "值班员", show: true},
|
|
|
+ {value: "linkPhone", label: "联系方式", show: true, width: 120},
|
|
|
+ {value: "type", label: "签卡类型", show: true},
|
|
|
+ {value: "status", label: "签卡状态", show: true},
|
|
|
+ {value: "time", label: "签卡时间", show: true, width: 180},
|
|
|
],
|
|
|
+ selected: []
|
|
|
});
|
|
|
const ref_cusTable = ref()
|
|
|
// 获取字典
|
|
|
const initDictionary = () => {
|
|
|
+ store.dispatch('dictionary/LOAD_DEPT')
|
|
|
+ store.dispatch('dictionary/LOAD_DICT_LIST', 'sign_type')
|
|
|
+ store.dispatch('dictionary/LOAD_DICT_LIST', 'sign_status')
|
|
|
}
|
|
|
// 查询分页参数改变处理方法
|
|
|
const handlePage = ({page, pageSize}: any) => {
|
|
@@ -144,15 +142,12 @@ export default defineComponent({
|
|
|
state.queryPage.pageSize = pageSize
|
|
|
handleSearch(page, pageSize)
|
|
|
}
|
|
|
- // 查询排序参数改变处理方法
|
|
|
- const handleSort = ({key, value}: any) => {
|
|
|
- state.querySort = key ? {key: value} : {}
|
|
|
- handleSearch()
|
|
|
- }
|
|
|
// 重置查询表单方法
|
|
|
const handleReset = () => {
|
|
|
state.queryForm = {}
|
|
|
state.back_queryForm = JSON.parse(JSON.stringify(state.queryForm))
|
|
|
+ state.queryPage.pageNum = 1
|
|
|
+ state.queryPage.pageSize = 10
|
|
|
handleSearch()
|
|
|
}
|
|
|
// 查询方法
|
|
@@ -161,41 +156,30 @@ export default defineComponent({
|
|
|
const queryParams: any = {
|
|
|
pageNum: page,
|
|
|
pageSize: pageSize,
|
|
|
- sort: {},
|
|
|
- text: ''
|
|
|
- }
|
|
|
- // 添加排序参数
|
|
|
- for (const [k, v] of Object.entries(state.querySort)) {
|
|
|
- that.$util.isValue(v) ? (queryParams.sort[k] = v) : null;
|
|
|
}
|
|
|
// 添加表单参数
|
|
|
for (const [k, v] of Object.entries(state.back_queryForm)) {
|
|
|
- that.$util.isValue(v) ? (queryParams[k] = v) : null;
|
|
|
+ if (that.$util.isValue(v)) {
|
|
|
+ if (k === 'signTime') {
|
|
|
+ queryParams['beginTime'] = v[0]
|
|
|
+ queryParams['endTime'] = v[1]
|
|
|
+ } else {
|
|
|
+ queryParams[k] = v
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- // 添加复合查询参数
|
|
|
state.loading = true
|
|
|
-
|
|
|
- // mock
|
|
|
- const arr = []
|
|
|
- for (let i = 0; i < 77; i++) {
|
|
|
- arr.push({p1: '阿三顶顶顶顶顶顶顶顶顶顶顶顶顶'})
|
|
|
- }
|
|
|
- state.queryResult.tableData = arr
|
|
|
- state.queryResult.total = arr.length
|
|
|
- state.loading = false
|
|
|
- // that.$api.patrolBoatList(that.$util.formatGetParam(queryParams)).then((res: { code: number; rows: never[]; total: number; }) => {
|
|
|
- // if (res.code === 200) {
|
|
|
- // state.queryResult.tableData = res.rows
|
|
|
- // state.queryResult.total = res.total
|
|
|
- // }
|
|
|
- // setTimeout(() => {
|
|
|
- // state.loading = false
|
|
|
- // }, 1000)
|
|
|
- // }).catch(() => {
|
|
|
- // setTimeout(() => {
|
|
|
- // state.loading = false
|
|
|
- // }, 1000)
|
|
|
- // })
|
|
|
+ that.$api.getSignList(queryParams).then((res: any) => {
|
|
|
+ if (res.code === 200) {
|
|
|
+ state.queryResult.tableData = res.rows
|
|
|
+ state.queryResult.total = res.total
|
|
|
+ } else {
|
|
|
+ ElMessage.error(res.message)
|
|
|
+ }
|
|
|
+ state.loading = false
|
|
|
+ }).catch(() => {
|
|
|
+ state.loading = false
|
|
|
+ })
|
|
|
}
|
|
|
// 点击查询按钮后
|
|
|
const onSearch = () => {
|
|
@@ -204,6 +188,31 @@ export default defineComponent({
|
|
|
state.queryPage.pageNum = 1
|
|
|
handleSearch()
|
|
|
}
|
|
|
+ const onExport = () => {
|
|
|
+ const queryParams: any = {
|
|
|
+ }
|
|
|
+ if (state.selected.length > 0) {
|
|
|
+ queryParams['ids'] = state.selected.map(v => v.id)
|
|
|
+ } else {
|
|
|
+ // 添加表单参数
|
|
|
+ for (const [k, v] of Object.entries(state.back_queryForm)) {
|
|
|
+ if (that.$util.isValue(v)) {
|
|
|
+ if (k === 'signTime') {
|
|
|
+ queryParams['beginTime'] = v[0]
|
|
|
+ queryParams['endTime'] = v[1]
|
|
|
+ } else {
|
|
|
+ queryParams[k] = v
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ that.$api.signExport(queryParams).then(res => {
|
|
|
+ downLoadBlob(res, '签卡记录.xlsx')
|
|
|
+ ElMessage.success('导出成功!')
|
|
|
+ }).catch(() => {
|
|
|
+ ElMessage.error('导出失败!')
|
|
|
+ })
|
|
|
+ }
|
|
|
onMounted(() => {
|
|
|
state.back_queryForm = JSON.parse(JSON.stringify(state.queryForm))
|
|
|
initDictionary()
|
|
@@ -214,9 +223,9 @@ export default defineComponent({
|
|
|
...toRefs(state),
|
|
|
handleSearch,
|
|
|
handlePage,
|
|
|
- handleSort,
|
|
|
handleReset,
|
|
|
onSearch,
|
|
|
+ onExport
|
|
|
}
|
|
|
},
|
|
|
})
|