forked from integrated_whb/integrated_whb_vue
200 lines
6.1 KiB
Vue
200 lines
6.1 KiB
Vue
<template>
|
|
<div>
|
|
<el-card>
|
|
<el-form
|
|
:model="searchForm"
|
|
label-width="100px"
|
|
@submit.prevent="fnResetPagination"
|
|
>
|
|
<el-row>
|
|
<el-col :span="6">
|
|
<el-form-item label="名称" prop="ACTIVITIESNAME">
|
|
<el-input
|
|
v-model="searchForm.ACTIVITIESNAME"
|
|
placeholder="请输入名称"
|
|
/>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="完成状态" prop="COMPLETIONSTATUS">
|
|
<el-select v-model="searchForm.COMPLETIONSTATUS">
|
|
<el-option label="已上传" :value="1" />
|
|
<el-option label="未上传" :value="0" />
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label="有效状态" prop="VALIDSTATUS">
|
|
<el-select v-model="searchForm.VALIDSTATUS">
|
|
<el-option label="正常" :value="0" />
|
|
<el-option label="未生效" :value="1" />
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="6">
|
|
<el-form-item label-width="10px">
|
|
<el-button type="primary" native-type="submit">搜索</el-button>
|
|
<el-button native-type="reset" @click="fnResetPagination">
|
|
重置
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
</el-card>
|
|
<layout-card>
|
|
<layout-table
|
|
ref="tableRef"
|
|
v-model:pagination="pagination"
|
|
:data="list"
|
|
row-key="ACTIVITIES_ID"
|
|
@get-data="fnGetData"
|
|
>
|
|
<el-table-column label="序号" width="60">
|
|
<template #default="{ $index }">
|
|
{{ serialNumber(pagination, $index) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="ACTIVITIESNAME" label="名称" width="250" />
|
|
<el-table-column prop="COMPLETIONSTATUS" label="完成状态" width="250">
|
|
<template #default="{ row }">
|
|
<el-tag v-if="row.COMPLETIONSTATUS === '1'" type="success"
|
|
>已上传</el-tag
|
|
>
|
|
<el-tag v-else-if="row.COMPLETIONSTATUS === '0'" type="warning"
|
|
>未上传</el-tag
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column label="有效状态" prop="VALIDSTATUS">
|
|
<template #default="{ row }">
|
|
<el-tag v-if="row.VALIDSTATUS === '0'" type="success">正常</el-tag>
|
|
<el-tag v-else-if="row.VALIDSTATUS === '1'" type="warning"
|
|
>未生效</el-tag
|
|
>
|
|
</template>
|
|
</el-table-column>
|
|
<!-- <el-table-column prop="CORP_NAME" label="经营企业" width="150" />-->
|
|
<el-table-column prop="EXPIRYDATE" label="到期时间" width="150" />
|
|
<el-table-column prop="CREATETIME" label="创建时间" width="150" />
|
|
<el-table-column prop="OPERATTIME" label="修改时间" width="150" />
|
|
<el-table-column label="操作" width="180">
|
|
<template #default="{ row }">
|
|
<el-button
|
|
type="primary"
|
|
text
|
|
link
|
|
@click="fnView(row.ACTIVITIES_ID)"
|
|
>
|
|
查看
|
|
</el-button>
|
|
<el-button
|
|
type="primary"
|
|
text
|
|
link
|
|
@click="fnAddOrEdit(row.ACTIVITIES_ID, 'edit')"
|
|
>
|
|
编辑
|
|
</el-button>
|
|
<el-button
|
|
text
|
|
link
|
|
type="danger"
|
|
@click="deleteItem(row.ACTIVITIES_ID)"
|
|
>
|
|
删除
|
|
</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<template #button>
|
|
<el-button type="primary" @click="fnAddOrEdit('', 'add')">
|
|
新增
|
|
</el-button>
|
|
</template>
|
|
</layout-table>
|
|
</layout-card>
|
|
<add
|
|
v-model:visible="data.addOrEditDialog.visible"
|
|
v-model:form="data.addOrEditDialog.form"
|
|
:type="data.addOrEditDialog.type"
|
|
:options="[]"
|
|
:loading="false"
|
|
@get-data="fnResetPagination"
|
|
/>
|
|
<view-info
|
|
v-model:visible="data.viewDialog.visible"
|
|
:info="data.viewDialog.info"
|
|
label-name="详情"
|
|
/>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { addingPrefixToFile, serialNumber } from "@/assets/js/utils";
|
|
import useListData from "@/assets/js/useListData.js";
|
|
import Add from "./components/add.vue";
|
|
import { nextTick, reactive } from "vue";
|
|
import ViewInfo from "./components/view.vue";
|
|
import { ElMessage, ElMessageBox } from "element-plus";
|
|
import {
|
|
deleteActivitiesView,
|
|
getSafetyActivitiesList,
|
|
infoActivitiesView,
|
|
} from "@/request/traffic_safety_activities.js";
|
|
|
|
const { list, pagination, searchForm, fnGetData, fnResetPagination } =
|
|
useListData(getSafetyActivitiesList);
|
|
const data = reactive({
|
|
addOrEditDialog: {
|
|
visible: false,
|
|
type: "",
|
|
form: {},
|
|
},
|
|
viewDialog: {
|
|
visible: false,
|
|
info: {},
|
|
},
|
|
});
|
|
const fnAddOrEdit = async (ACTIVITIES_ID = "", type = "add") => {
|
|
data.addOrEditDialog.visible = true;
|
|
data.addOrEditDialog.type = type;
|
|
if (type === "edit" && ACTIVITIES_ID) {
|
|
const resData = await infoActivitiesView({ ACTIVITIES_ID });
|
|
if (resData && resData.pd) {
|
|
data.addOrEditDialog.form = {
|
|
...resData.pd,
|
|
OPERATINGCOMPANY: resData.pd.CORP_NAME,
|
|
EXPIRYDATE: resData.pd.EXPIRYDATE,
|
|
};
|
|
data.addOrEditDialog.form.file = addingPrefixToFile([
|
|
{
|
|
FILEPATH: resData.pd.ATTACHMENT_ROUTE,
|
|
},
|
|
]);
|
|
}
|
|
} else {
|
|
data.addOrEditDialog.form = {};
|
|
}
|
|
await nextTick();
|
|
};
|
|
|
|
const fnView = async (ACTIVITIES_ID) => {
|
|
const resData = await infoActivitiesView({
|
|
ACTIVITIES_ID,
|
|
});
|
|
data.viewDialog.info = resData.pd;
|
|
data.viewDialog.visible = true;
|
|
};
|
|
// 删除事件
|
|
const deleteItem = async (value) => {
|
|
await ElMessageBox.confirm(`确定要删除吗?`, {
|
|
type: "warning",
|
|
});
|
|
await deleteActivitiesView({ ACTIVITIES_ID: value });
|
|
ElMessage.success("删除成功");
|
|
fnGetData();
|
|
};
|
|
</script>
|
|
|
|
<style scoped></style>
|