|
|
@@ -22,12 +22,13 @@
|
|
|
<div class="d-flex j-sb mb-16">
|
|
|
<div><searchTabs v-model="queryParams.isValid" @change="handleQuery" :list="tabs" key-label="name" key-value="type" key-count="num"></searchTabs></div>
|
|
|
<div>
|
|
|
- <el-button type="primary">批量修改有效期</el-button>
|
|
|
- <el-button type="danger">批量删除</el-button>
|
|
|
+ <el-button @click="batchUpdateEndDate" type="primary">批量修改有效期</el-button>
|
|
|
+ <el-button @click="batchDelete" type="danger">批量删除</el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="flex1 ov-hd">
|
|
|
- <vxe-table :loading="loading" border :data="list" min-height="0" max-height="100%">
|
|
|
+ <vxe-table ref="tableRef" :loading="loading" border :data="list" min-height="0" max-height="auto" :column-config="{ resizable: true }" :row-config="{keyField: 'id',isCurrent: true, isHover: true}" :checkbox-config="{ highlight: true, range: true, trigger: 'row', reserve: true }">
|
|
|
+ <vxe-column type="checkbox" width="60"></vxe-column>
|
|
|
<!-- 序号 -->
|
|
|
<vxe-column type="seq" width="60" title="序号" align="center" />
|
|
|
<!-- 企业名称 -->
|
|
|
@@ -49,8 +50,14 @@
|
|
|
<vxe-column title="有效期至" field="endDate" min-width="100" width="110" />
|
|
|
<vxe-column title="操作人" field="createByName" min-width="100" :formatter="colNoData" />
|
|
|
<vxe-column title="操作时间" field="createTime" min-width="100" :formatter="colNoData" />
|
|
|
- <vxe-column title="操作" align="center" field="right" width="220">
|
|
|
- <template #default="{ row }"></template>
|
|
|
+ <vxe-column title="操作" align="center" field="right" width="240">
|
|
|
+ <template #default="{ row }">
|
|
|
+ <el-button @click.stop="router.push({ path: 'station-detail', query: { id: row?.id } })" text type="primary">详情</el-button>
|
|
|
+ <span></span>
|
|
|
+ <el-button @click.stop="updateEndDateItem(row)" text style="color: #0079fe">修改有效期</el-button>
|
|
|
+ <span></span>
|
|
|
+ <el-button @click.stop="deleteItem(row)" text type="danger">删除</el-button>
|
|
|
+ </template>
|
|
|
</vxe-column>
|
|
|
</vxe-table>
|
|
|
</div>
|
|
|
@@ -60,19 +67,22 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<addStation v-model:show="showStation" @sueccess="handleQuery"></addStation>
|
|
|
+ <EditStationEndDate v-if="showEndDate" v-model:show="showEndDate" :infos="infos" @sueccess="handleQuery"></EditStationEndDate>
|
|
|
</template>
|
|
|
<script setup name="price-station" lang="ts">
|
|
|
-import { originCpyList, queryOriginCpyCount } from '@/api/price/station';
|
|
|
+import { deleteOriginCpy, originCpyList, queryOriginCpyCount } from '@/api/price/station';
|
|
|
import { colNoData } from '@/utils/noData';
|
|
|
import { searchTabs } from '@/views/models';
|
|
|
-
|
|
|
import NP from 'number-precision';
|
|
|
-import { addStation } from '../models';
|
|
|
+import { addStation, EditStationEndDate } from '../models';
|
|
|
+const router = useRouter();
|
|
|
+const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const queryParams = ref<any>({
|
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
|
isValid: '1'
|
|
|
});
|
|
|
+const showEndDate = ref(false);
|
|
|
const showStation = ref(false);
|
|
|
const loading = ref(false);
|
|
|
const total = ref(0);
|
|
|
@@ -101,6 +111,53 @@ const getTabs = async () => {
|
|
|
if (!res || res.code !== 200) return;
|
|
|
tabs.value = res.data
|
|
|
};
|
|
|
+const tableRef = ref<any>();
|
|
|
+// 批量删除
|
|
|
+const batchDelete = async () => {
|
|
|
+ const records = tableRef.value?.getCheckboxReserveRecords(true).concat(tableRef.value?.getCheckboxRecords());
|
|
|
+ if (!records.length) {
|
|
|
+ proxy?.$modal.msgWarning('请选择监测点');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ const confirm = await proxy?.$modal.confirm('是否确认删除监测点,删除后企业上报的数据将不再作为专业数据展示,之前上报的数据不受影响。');
|
|
|
+ const ids = records.map((item: any) => item.id);
|
|
|
+ if (confirm === 'confirm') {
|
|
|
+ deleteSubmit(ids)
|
|
|
+ }
|
|
|
+};
|
|
|
+const deleteItem = async (row: any) => {
|
|
|
+ const confirm = await proxy?.$modal.confirm('是否确认删除该监测点,删除后该企业上报的数据将不再作为专业数据展示,之前上报的数据不受影响。');
|
|
|
+ if (confirm === 'confirm') {
|
|
|
+ deleteSubmit([row.id])
|
|
|
+ }
|
|
|
+};
|
|
|
+// 删除提交
|
|
|
+const deleteSubmit = async (ids: string[]) => {
|
|
|
+ proxy?.$modal.loading('删除中...');
|
|
|
+ const res = await deleteOriginCpy(ids).finally(() => {
|
|
|
+ proxy?.$modal.closeLoading();
|
|
|
+ });
|
|
|
+ if (!res || res.code !== 200) return;
|
|
|
+ proxy?.$modal.msgSuccess('删除成功');
|
|
|
+ handleQuery();
|
|
|
+};
|
|
|
+// 修改有效期的检测点
|
|
|
+const infos = ref<any[]>([]);
|
|
|
+// 修改有效期
|
|
|
+const updateEndDateItem = async (row: any) => {
|
|
|
+ infos.value = [row];
|
|
|
+ showEndDate.value = true;
|
|
|
+};
|
|
|
+// 批量修改有效期
|
|
|
+const batchUpdateEndDate = async () => {
|
|
|
+ const records = tableRef.value?.getCheckboxReserveRecords(true).concat(tableRef.value?.getCheckboxRecords());
|
|
|
+ if (!records.length) {
|
|
|
+ proxy?.$modal.msgWarning('请选择监测点');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ infos.value = records;
|
|
|
+ showEndDate.value = true;
|
|
|
+};
|
|
|
onMounted(() => {
|
|
|
getTabs();
|
|
|
handleQuery();
|