-
zhangwei
9 小时以前 85adc3faa522b5cab8dbdfe9a052700c24909b2a
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
<script lang="ts" setup name="aDPenalty">
import { ref, reactive, onMounted } from "vue";
import { auth } from '/@/utils/authFunction';
import { ElMessageBox, ElMessage } from "element-plus";
import { downloadStreamFile } from "/@/utils/download";
import { useADPenaltyApi } from '/@/api/ADPenalty/aDPenalty';
import editDialog from '/@/views/ADPenalty/aDPenalty/component/editDialog.vue'
import printDialog from '/@/views/system/print/component/hiprint/preview.vue'
import ModifyRecord from '/@/components/table/modifyRecord.vue';
import commonFunction from "/@/utils/commonFunction";
 
const { dateFormatYMD } = commonFunction();
const aDPenaltyApi = useADPenaltyApi();
const printDialogRef = ref();
const editDialogRef = ref();
const state = reactive({
  exportLoading: false,
  tableLoading: false,
  stores: {},
  showAdvanceQueryUI: false,
  dropdownData: {} as any,
  selectData: [] as any[],
  tableQueryParams: {} as any,
 tableParams: {
        page: 1,
        pageSize: 20,
        total: 0,
        field: 'decisionDate', // 默认的排序字段
        order: 'descending', // 排序方向
        descStr: 'descending', // 降序排序的关键字符
    },
  tableData: [],
});
 
// 页面加载时
onMounted(async () => {
});
 
// 查询操作
const handleQuery = async (params: any = {}) => {
  state.tableLoading = true;
  state.tableParams = Object.assign(state.tableParams, params);
  const result = await aDPenaltyApi.page(Object.assign(state.tableQueryParams, state.tableParams)).then(res => res.data.result);
  state.tableParams.total = result?.total;
  state.tableData = result?.items ?? [];
  state.tableLoading = false;
};
 
// 列排序
const sortChange = async (column: any) => {
  state.tableParams.field = column.prop;
  state.tableParams.order = column.order;
  await handleQuery();
};
 
// 删除
const delADPenalty = (row: any) => {
  ElMessageBox.confirm(`确定要删除吗?`, "提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  }).then(async () => {
    await aDPenaltyApi.delete({ id: row.id });
    handleQuery();
    ElMessage.success("删除成功");
  }).catch(() => {});
};
 
// 批量删除
const batchDelADPenalty = () => {
  ElMessageBox.confirm(`确定要删除${state.selectData.length}条记录吗?`, "提示", {
    confirmButtonText: "确定",
    cancelButtonText: "取消",
    type: "warning",
  }).then(async () => {
    await aDPenaltyApi.batchDelete(state.selectData.map(u => ({ id: u.id }) )).then(res => {
      ElMessage.success(`成功批量删除${res.data.result}条记录`);
      handleQuery();
    });
  }).catch(() => {});
};
 
handleQuery();
</script>
<template>
  <div class="aDPenalty-container" v-loading="state.exportLoading">
    <el-card shadow="hover" :body-style="{ paddingBottom: '0' }"> 
      <el-form :model="state.tableQueryParams" ref="queryForm" labelWidth="90">
        <el-row>
          <!-- <el-col :xs="24" :sm="12" :md="12" :lg="8" :xl="4" class="mb10">
            <el-form-item label="关键字">
              <el-input v-model="state.tableQueryParams.keyword" clearable placeholder="请输入模糊查询关键字"/>
            </el-form-item>
          </el-col> -->
          <el-col :xs="24" :sm="12" :md="12" :lg="4" :xl="4" class="mb10">
            <el-form-item label="决定日期">
              <el-date-picker type="daterange" v-model="state.tableQueryParams.decisionDateRange"  value-format="YYYY-MM-DD HH:mm:ss" start-placeholder="开始日期" end-placeholder="结束日期" :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]" />
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="4" :xl="4" class="mb10" v-if="state.showAdvanceQueryUI">
            <el-form-item label="当事人">
              <el-input v-model="state.tableQueryParams.parties" clearable placeholder="请输入当事人"/>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="4" :xl="4" class="mb10" v-if="state.showAdvanceQueryUI">
            <el-form-item label="采购监督部门">
              <el-input v-model="state.tableQueryParams.supervisionDepartment" clearable placeholder="请输入采购监督部门"/>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="4" :xl="4" class="mb10" v-if="state.showAdvanceQueryUI">
            <el-form-item label="案由">
              <el-input v-model="state.tableQueryParams.caseReason" clearable placeholder="请输入案由"/>
            </el-form-item>
          </el-col>
          <el-col :xs="24" :sm="12" :md="12" :lg="4" :xl="4" class="mb10" v-if="state.showAdvanceQueryUI">
            <el-form-item label="处理决定">
              <el-input v-model="state.tableQueryParams.disposalDecision" clearable placeholder="请输入处理决定"/>
            </el-form-item>
          </el-col>
          
          <el-col :xs="24" :sm="12" :md="12" :lg="12" :xl="12" class="mb10">
            <el-form-item >
              <el-button-group style="display: flex; align-items: center;">
                <el-button type="primary"  icon="ele-Search" @click="handleQuery" v-auth="'aDPenalty:page'" v-reclick="1000"> 查询 </el-button>
                <el-button icon="ele-Refresh" @click="() => state.tableQueryParams = {}"> 重置 </el-button>
                <el-button icon="ele-ZoomIn" @click="() => state.showAdvanceQueryUI = true" v-if="!state.showAdvanceQueryUI" style="margin-left:5px;"> 高级查询 </el-button>
                <el-button icon="ele-ZoomOut" @click="() => state.showAdvanceQueryUI = false" v-if="state.showAdvanceQueryUI" style="margin-left:5px;"> 隐藏 </el-button>
                <el-button type="danger" style="margin-left:5px;" icon="ele-Delete" @click="batchDelADPenalty" :disabled="state.selectData.length == 0" v-auth="'aDPenalty:batchDelete'"> 删除 </el-button>
                <el-button type="primary" style="margin-left:5px;" icon="ele-Plus" @click="editDialogRef.openDialog(null, '新增行政处罚')" v-auth="'aDPenalty:add'"> 新增 </el-button>
              </el-button-group>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </el-card>
    <el-card class="full-table" shadow="hover" style="margin-top: 5px">
      <el-table :data="state.tableData" @selection-change="(val: any[]) => { state.selectData = val; }" style="width: 100%" v-loading="state.tableLoading" :default-sort="{ prop: 'decisionDate', order: 'descending' }" tooltip-effect="light" row-key="id" @sort-change="sortChange" border>
        <el-table-column type="selection" width="40" align="center" v-if="auth('aDPenalty:batchDelete') || auth('aDPenalty:export')" />
        <el-table-column type="index" label="序号" width="55" align="center"/>
         <el-table-column prop='decisionDate' label='决定日期' width="90" show-overflow-tooltip sortable >
          <template #default="{ row }">
            <span>{{dateFormatYMD(null,null,row.decisionDate)}}</span>
          </template>
        </el-table-column>
        <el-table-column prop='parties' label='当事人' show-overflow-tooltip />
        <el-table-column prop='caseReason' label='案由' show-overflow-tooltip />
        <el-table-column prop='disposalDecision' label='处理决定' show-overflow-tooltip />
        <el-table-column prop='supervisionDepartment' width="130" label='采购监督部门' show-overflow-tooltip />
        <el-table-column prop='url' label='线上地址' show-overflow-tooltip >
          <template #default="{ row }">
            <el-link underline :href='row.url' target='_blank'>{{row.url}}</el-link>
          </template>
        </el-table-column>
        <!-- <el-table-column label="修改记录" width="100" align="center" show-overflow-tooltip>
          <template #default="scope">
            <ModifyRecord :data="scope.row" />
          </template>
        </el-table-column> -->
        <el-table-column label="操作" width="80" align="center" fixed="right" show-overflow-tooltip v-if="auth('aDPenalty:update') || auth('aDPenalty:delete')">
          <template #default="scope">
            <el-button icon="ele-Edit" size="small" text type="primary" @click="editDialogRef.openDialog(scope.row, '编辑行政处罚')" v-auth="'aDPenalty:update'">  </el-button>
            <el-button icon="ele-Delete" size="small" text type="primary" @click="delADPenalty(scope.row)" v-auth="'aDPenalty:delete'">  </el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-pagination 
              v-model:currentPage="state.tableParams.page"
              v-model:page-size="state.tableParams.pageSize"
              @size-change="(val: any) => handleQuery({ pageSize: val })"
              @current-change="(val: any) => handleQuery({ page: val })"
              layout="total, sizes, prev, pager, next, jumper"
              :page-sizes="[10, 20, 50, 100, 200, 500]"
              :total="state.tableParams.total"
              size="small"
              background />
      <printDialog ref="printDialogRef" :title="'打印行政处罚'" @reloadTable="handleQuery" />
      <editDialog ref="editDialogRef" @reloadTable="handleQuery" />
    </el-card>
  </div>
</template>
<style scoped>
:deep(.el-input), :deep(.el-select), :deep(.el-input-number) {
  width: 100%;
}
</style>