公告,活动,投诉接口对接完成
This commit is contained in:
174
src/views/system/HandleLog/addHandleLog.vue
Normal file
174
src/views/system/HandleLog/addHandleLog.vue
Normal file
@@ -0,0 +1,174 @@
|
||||
<template>
|
||||
<div class="ResidentMainBox p-2 w-full">
|
||||
<PageHeader title="办事编辑"></PageHeader>
|
||||
<div class="ResidentMainBody">
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="title">基本信息</div>
|
||||
</template>
|
||||
<div class="addBuildingFormBody">
|
||||
<div class="formbox">
|
||||
<el-form ref="formRef" :model="form" :rules="rules" label-width="120px">
|
||||
<el-row>
|
||||
<el-col>
|
||||
<el-form-item label="办事内容" prop="content">
|
||||
<editor
|
||||
@update:model-value="handleContent"
|
||||
:model-value="form.content"
|
||||
:height="500"
|
||||
:min-height="300"
|
||||
:read-only="false"
|
||||
:file-size="5"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="求助人姓名" prop="seekName">
|
||||
<el-input v-model.trim="form.seekName" placeholder="请输入求助人姓名" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系方式" prop="phone">
|
||||
<el-input v-model.trim="form.phone" placeholder="请输入联系方式" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="办事时间" prop="handleTime">
|
||||
<el-date-picker
|
||||
format="YYYY-MM-DD HH:mm"
|
||||
value-format="YYYY-MM-DD HH:mm"
|
||||
v-model="form.handleTime"
|
||||
type="datetime"
|
||||
placeholder="请选择"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="办事地点" prop="handlePosition">
|
||||
<el-input v-model.trim="form.handlePosition" placeholder="请输入办事地点" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
<el-button @click="handleBack">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { addHandleLog, getHandleLog, updateHandleLog } from '@/api/system/HandleLog';
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const formRef = ref();
|
||||
const form = ref({
|
||||
'id': null,
|
||||
'content': '',
|
||||
'seekName': '',
|
||||
'phone': '',
|
||||
'handleTime': '',
|
||||
'handlePosition': ''
|
||||
});
|
||||
const rules = {
|
||||
content: [{ required: true, message: '请输入办事内容', trigger: 'blur' }],
|
||||
seekName: [{ required: true, message: '请选择求助人', trigger: 'blur' }],
|
||||
handlePosition: [{ required: true, message: '请输入办事地点', trigger: 'blur' }],
|
||||
handleTime: [{ required: true, message: '请输入办事时间', trigger: 'blur' }]
|
||||
};
|
||||
const userid = ref();
|
||||
// ! 富文本 =============================================================================================================
|
||||
function handleContent(val: string) {
|
||||
form.value.content = val.trim();
|
||||
}
|
||||
// ! 富文本 =============================================================================================================
|
||||
|
||||
// ! 初始 ====================================================================================================
|
||||
function init() {
|
||||
getHandleLog(userid.value).then((res) => {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
console.log(form.value);
|
||||
});
|
||||
}
|
||||
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
init();
|
||||
}
|
||||
|
||||
// 提交
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (userid.value) {
|
||||
updateHandleLog(form.value).then(() => {
|
||||
ElMessage.success('编辑成功');
|
||||
handleBack();
|
||||
});
|
||||
} else {
|
||||
addHandleLog(form.value).then(() => {
|
||||
ElMessage.success('添加成功');
|
||||
handleBack();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 返回
|
||||
function handleBack() {
|
||||
router.push({
|
||||
path: '/repair/handlelog'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.ResidentMainBox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.ResidentMainBody {
|
||||
margin-top: 20px;
|
||||
flex: 1;
|
||||
|
||||
.formbox {
|
||||
width: 1000px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
:deep(.el-date-editor.el-input, .el-date-editor.el-input__wrapper) {
|
||||
width: 380px;
|
||||
}
|
||||
&:deep(div.el-step__head.is-process) {
|
||||
& > div.el-step__line {
|
||||
width: 0;
|
||||
border: 1px dashed gray;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
&:deep(.el-step.is-vertical .el-step__line) {
|
||||
top: 20px;
|
||||
}
|
||||
&:deep(div.el-step__head.is-finish) {
|
||||
& > div.el-step__line {
|
||||
width: 0;
|
||||
border: 1px solid var(--el-color-primary);
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
177
src/views/system/HandleLog/index.vue
Normal file
177
src/views/system/HandleLog/index.vue
Normal file
@@ -0,0 +1,177 @@
|
||||
<template>
|
||||
<div class="flex flex-col h-full p-2">
|
||||
<pageheader title="办事记录"></pageheader>
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" :model="queryParams" :inline="true">
|
||||
<el-form-item label="求助人" prop="seekName">
|
||||
<el-input v-model="queryParams.seekName" placeholder="请输入求助人" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card class="flex-1" shadow="never">
|
||||
<template #header>
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['handleLog:handleLog:add']">新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="success" plain icon="Edit" :disabled="single" @click="handleUpdate()" v-hasPermi="['handleLog:handleLog:edit']"
|
||||
>修改</el-button
|
||||
>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button type="danger" plain icon="Delete" :disabled="multiple" @click="handleDelete()" v-hasPermi="['handleLog:handleLog:remove']"
|
||||
>删除</el-button
|
||||
>
|
||||
</el-col>
|
||||
<right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<el-table v-loading="loading" border :data="handleLogList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="办事内容" align="center" prop="content">
|
||||
<template #default="scope">
|
||||
<div class="color-blue" v-html="scope.row.content"></div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="求助人" align="center" prop="seekName" width="120" />
|
||||
<el-table-column label="联系方式" align="center" prop="phone" width="120" />
|
||||
<el-table-column label="办事时间" align="center" prop="handleTime" width="120">
|
||||
<template #default="scope">
|
||||
<span>{{ parseTime(scope.row.handleTime, '{y}-{m}-{d}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="办事地点" align="center" prop="handlePosition" />
|
||||
<el-table-column label="操作" width="200" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['handleLog:handleLog:edit']">修改</el-button>
|
||||
<el-button link type="primary" @click="handleDelete(scope.row)" v-hasPermi="['handleLog:handleLog:remove']">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="HandleLog" lang="ts">
|
||||
import { listHandleLog, getHandleLog, delHandleLog, addHandleLog, updateHandleLog } from '@/api/system/HandleLog/index';
|
||||
import { HandleLogVO, HandleLogQuery, HandleLogForm } from '@/api/system/HandleLog/type';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
|
||||
const handleLogList = ref<HandleLogVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const handleLogFormRef = ref<ElFormInstance>();
|
||||
|
||||
const initFormData: HandleLogForm = {
|
||||
id: undefined,
|
||||
content: undefined,
|
||||
seekName: undefined,
|
||||
phone: undefined,
|
||||
handleTime: undefined,
|
||||
handlePosition: undefined
|
||||
};
|
||||
const data = reactive<PageData<HandleLogForm, HandleLogQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
content: undefined,
|
||||
seekName: undefined,
|
||||
phone: undefined,
|
||||
handleTime: undefined,
|
||||
handlePosition: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '办事记录表id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
/** 查询办事记录列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res = await listHandleLog(queryParams.value);
|
||||
handleLogList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: HandleLogVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
const router = useRouter();
|
||||
/** 新增按钮操作 */
|
||||
const handleAdd = () => {
|
||||
router.push({
|
||||
path: '/repair/addHandleLog'
|
||||
});
|
||||
};
|
||||
|
||||
/** 修改按钮操作 */
|
||||
const handleUpdate = async (row?: HandleLogVO) => {
|
||||
router.push({
|
||||
path: '/repair/addHandleLog',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: HandleLogVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('该信息删除后无法恢复,确定要删除吗?').finally(() => (loading.value = false));
|
||||
await delHandleLog(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-table {
|
||||
height: calc(100% - 80px);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user