feat: 添加心愿单管理
This commit is contained in:
parent
63993b4a1a
commit
13b4d9bfff
@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<el-dialog v-model="dialogVisible" title="添加心愿单" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row>
|
||||
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="心愿名称" prop="wish_list_name">
|
||||
<el-input v-model='formData.wish_list_name' type="text" placeholder='请输入心愿名称'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="作者" prop="wish_list_author">
|
||||
<el-input v-model='formData.wish_list_author' type="text" placeholder='请输入作者'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
<el-form-item :label-width='labelWidth' label='完成状态' prop='wish_list_status'>
|
||||
<el-switch v-model='formData.wish_list_status' class='mt-2' inline-prompt :inactive-value=1 :active-value=2
|
||||
style='--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949' />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="完成日期" prop="wish_list_complete_date">
|
||||
<el-date-picker :disabled="formData.wish_list_status === 1" v-model="formData.wish_list_complete_date" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="完成日期" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="排序" prop="wish_list_sort">
|
||||
<el-input-number v-model='formData.wish_list_sort' controls-position='right' :min='1'></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="handleAddClick(formRef)">添加</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { addWishList, getDictionary } from "~/service/wish_list";
|
||||
import { useLoginStore } from "~/store";
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
// 字典获取
|
||||
const complete_status = ref([]);
|
||||
async function get_complete_status() {
|
||||
await getDictionary({ dictionary_value: 'complete_status' }).then((res) => {
|
||||
complete_status.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// --基础参数
|
||||
const store = useLoginStore();
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
|
||||
const isBtnLod = ref(false);
|
||||
const formRef = ref();
|
||||
const labelWidth = 90;
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const dialogVisible = ref(props.modelValue);
|
||||
const formData = reactive({});
|
||||
|
||||
const uoloadData = ref({
|
||||
dirName: "WishList"
|
||||
})
|
||||
|
||||
watch(props, (v) => {
|
||||
dialogVisible.value = v.modelValue;
|
||||
});
|
||||
|
||||
const rules = reactive({
|
||||
wish_list_name: [
|
||||
{
|
||||
required: true,
|
||||
message: '心愿名称不能为空'
|
||||
}
|
||||
],
|
||||
wish_list_status: [
|
||||
{
|
||||
required: true,
|
||||
message: '完成状态不能为空'
|
||||
}
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
|
||||
// --基础方法
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
get_complete_status()
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
handleResetClick(formRef.value);
|
||||
dialogVisible.value = false;
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
const handleAddClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
isBtnLod.value = true;
|
||||
|
||||
|
||||
const { code } = await addWishList(formData);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
}
|
||||
isBtnLod.value = flase;
|
||||
});
|
||||
};
|
||||
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
@ -0,0 +1,95 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="心愿单详情" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :disabled="true">
|
||||
<el-row>
|
||||
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="心愿名称" prop="wish_list_name">
|
||||
<el-input v-model='formData.wish_list_name' type="text" placeholder='请输入心愿名称'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="作者" prop="wish_list_author">
|
||||
<el-input v-model='formData.wish_list_author' type="text" placeholder='请输入作者'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
<el-form-item :label-width='labelWidth' label='完成状态' prop='wish_list_status'>
|
||||
<el-switch v-model='formData.wish_list_status' class='mt-2' inline-prompt :inactive-value=1 :active-value=2
|
||||
style='--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949' />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="完成日期" prop="wish_list_complete_date">
|
||||
<el-date-picker :disabled="formData.wish_list_status === 1" v-model="formData.wish_list_complete_date" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="完成日期" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="排序" prop="wish_list_sort">
|
||||
<el-input-number v-model='formData.wish_list_sort' controls-position='right' :min='1'></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { isEmptyObject } from "~/utils/index";
|
||||
import { getDictionary } from '~/service/wish_list';
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
// 字典获取
|
||||
const complete_status = ref([]);
|
||||
async function get_complete_status() {
|
||||
await getDictionary({ dictionary_value: 'complete_status' }).then((res) => {
|
||||
complete_status.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --基础参数
|
||||
const formRef = ref();
|
||||
const labelWidth = 100;
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
|
||||
|
||||
// --基础方法
|
||||
watch(props, (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
|
||||
get_complete_status()
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<el-dialog v-model="props.modelValue" title="编辑心愿单" width="900px" @closed="closeDialog" @open="openDialog">
|
||||
<el-form ref="formRef" :model="formData" :rules="rules">
|
||||
<el-row>
|
||||
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="心愿名称" prop="wish_list_name">
|
||||
<el-input v-model='formData.wish_list_name' type="text" placeholder='请输入心愿名称'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="作者" prop="wish_list_author">
|
||||
<el-input v-model='formData.wish_list_author' type="text" placeholder='请输入作者'></el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span='12'>
|
||||
<el-form-item :label-width='labelWidth' label='完成状态' prop='wish_list_status'>
|
||||
<el-switch v-model='formData.wish_list_status' class='mt-2' inline-prompt :inactive-value=1 :active-value=2
|
||||
style='--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949' />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="完成日期" prop="wish_list_complete_date">
|
||||
<el-date-picker :disabled="formData.wish_list_status === 1" v-model="formData.wish_list_complete_date" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="完成日期" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item :label-width="labelWidth" label="排序" prop="wish_list_sort">
|
||||
<el-input-number v-model='formData.wish_list_sort' controls-position='right' :min='1'></el-input-number>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
</el-row>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button type="primary" @click="handleEditClick(formRef)" :loading="isBtnLod">编辑</el-button>
|
||||
<el-button @click="handleResetClick(formRef)">重置</el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { reactive, ref, watch } from "vue";
|
||||
import { editWishList, getDictionary } from "~/service/wish_list";
|
||||
import { useLoginStore } from "~/store";
|
||||
|
||||
// --业务参数
|
||||
|
||||
|
||||
|
||||
// --业务方法
|
||||
|
||||
// 字典获取
|
||||
const complete_status = ref([]);
|
||||
async function get_complete_status() {
|
||||
await getDictionary({ dictionary_value: 'complete_status' }).then((res) => {
|
||||
complete_status.value = res
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// --基础参数
|
||||
const store = useLoginStore();
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
const isBtnLod = ref(false);
|
||||
const formRef = ref();
|
||||
const labelWidth = 100;
|
||||
const props = defineProps({
|
||||
modelValue: Boolean,
|
||||
data: Object,
|
||||
done: Function,
|
||||
});
|
||||
const emits = defineEmits(["update:modelValue"]);
|
||||
const formData = ref({
|
||||
...props.data,
|
||||
});
|
||||
const uoloadData = ref({
|
||||
dirName: "WishList"
|
||||
})
|
||||
|
||||
|
||||
// --基础方法
|
||||
watch(props, (v) => {
|
||||
formData.value = v.data;
|
||||
|
||||
|
||||
});
|
||||
|
||||
// 打开弹窗时执行
|
||||
const openDialog = () => {
|
||||
get_complete_status()
|
||||
|
||||
};
|
||||
|
||||
const closeDialog = () => {
|
||||
props.done();
|
||||
emits("update:modelValue", false);
|
||||
};
|
||||
|
||||
const rules = reactive({
|
||||
wish_list_name: [
|
||||
{
|
||||
required: true,
|
||||
message: '心愿名称不能为空'
|
||||
}
|
||||
],
|
||||
wish_list_status: [
|
||||
{
|
||||
required: true,
|
||||
message: '完成状态不能为空'
|
||||
}
|
||||
],
|
||||
|
||||
});
|
||||
|
||||
const handleEditClick = async (formEl) => {
|
||||
console.log(formData.value);
|
||||
if (!formEl) return;
|
||||
formEl.validate(async (valid) => {
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
isBtnLod.value = true;
|
||||
|
||||
|
||||
const { code } = await editWishList(formData.value);
|
||||
if (code == 0) {
|
||||
closeDialog();
|
||||
props.done();
|
||||
}
|
||||
isBtnLod.value = false;
|
||||
});
|
||||
};
|
||||
const handleResetClick = async (formEl) => {
|
||||
if (!formEl) return;
|
||||
formEl.resetFields();
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped></style>
|
282
src/pages/index/business/wish_list/index.vue
Normal file
282
src/pages/index/business/wish_list/index.vue
Normal file
@ -0,0 +1,282 @@
|
||||
<template>
|
||||
<!-- 面包屑 -->
|
||||
<el-breadcrumb>
|
||||
<el-breadcrumb-item>心愿单管理</el-breadcrumb-item>
|
||||
<el-breadcrumb-item to="/wish_list/list">心愿单列表</el-breadcrumb-item>
|
||||
</el-breadcrumb>
|
||||
<!-- 搜索 -->
|
||||
<el-form inline :model="params">
|
||||
|
||||
|
||||
<el-form-item label="心愿名称">
|
||||
<el-input v-model='params.wish_list_name' placeholder='请输入心愿名称'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="作者">
|
||||
<el-input v-model='params.wish_list_author' placeholder='请输入作者'></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="tableRef.reload()" icon="ElIconSearch">
|
||||
搜索
|
||||
</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-space style="margin-bottom: 10px;">
|
||||
<!-- 添加心愿单 -->
|
||||
<el-col :span="1">
|
||||
<el-button type="primary" @click="addWishListDialogVisible = true"> 添加 </el-button>
|
||||
</el-col>
|
||||
|
||||
|
||||
<!-- 导出 -->
|
||||
<el-button icon="ElIconDocument" @click="exportExcel(params)">导出</el-button>
|
||||
|
||||
<!-- 导入 -->
|
||||
<el-upload class="upload-demo" :action="importExcel" :headers="headers" :on-success="handleExcelSuccess"
|
||||
:on-progress="uploadLoading" :on-error="closeUploadLoading" style="margin-left: 10px" :show-file-list="false">
|
||||
<el-button type="primary">导入</el-button>
|
||||
</el-upload>
|
||||
|
||||
<!-- 下载导入模板 -->
|
||||
<el-button icon="ElIconDownload" @click="downloadTemplate()">下载导入模板</el-button>
|
||||
|
||||
|
||||
<!-- 下拉操作 -->
|
||||
<el-dropdown v-if="selectionData.length">
|
||||
<el-button type="primary">
|
||||
批量操作<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item @click="handleDelete(selectionData)">
|
||||
批量删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space>
|
||||
<!-- 数据表格 -->
|
||||
<DataTable ref="tableRef" style="width: 100%" :onSelectionChange="data => (selectionData = data)" :column="column"
|
||||
:params="params" :request="params => getWishListList(params)">
|
||||
|
||||
|
||||
<template #wish_list_status='scope'>
|
||||
<el-switch :disabled=scope.row.wish_list_status_bool v-model=scope.row.wish_list_status class=mt-2 inline-prompt
|
||||
:inactive-value=1 :active-value=2 style='--el-switch-on-color: #13ce66; --el-switch-off-color: #ff4949'
|
||||
@click=handleEditShow(scope.row) />
|
||||
</template>
|
||||
|
||||
|
||||
<!-- 排序 -->
|
||||
<template #wish_list_sort='scope'>
|
||||
<el-input-number :disabled='loading' v-model='scope.row.wish_list_sort' :min='1' controls-position='right'
|
||||
@change='handleEditOrder(scope.row)'></el-input-number>
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<template #chaoz="scope">
|
||||
<el-space>
|
||||
<el-button size="small" @click="handleUpdate(scope.row)">
|
||||
编辑
|
||||
</el-button>
|
||||
<el-dropdown @command="handleCommand">
|
||||
<el-button type="primary" size="small">
|
||||
更多<el-icon class="el-icon--right"><arrow-down /></el-icon>
|
||||
</el-button>
|
||||
<template #dropdown>
|
||||
<el-dropdown-menu>
|
||||
<el-dropdown-item :command="{ type: 'detail', row: scope.row }">
|
||||
详情
|
||||
</el-dropdown-item>
|
||||
<el-dropdown-item :command="{ type: 'delete', row: scope.row }">
|
||||
删除
|
||||
</el-dropdown-item>
|
||||
</el-dropdown-menu>
|
||||
</template>
|
||||
</el-dropdown>
|
||||
</el-space>
|
||||
</template>
|
||||
</DataTable>
|
||||
|
||||
<!-- 添加心愿单 -->
|
||||
<AddWishListDialog v-model="addWishListDialogVisible" :done="() => tableRef.reload()"></AddWishListDialog>
|
||||
<!-- 编辑心愿单 -->
|
||||
<EditWishListDialog v-model="EditWishListDialogVisible" :data="EditWishListDialogRow" :done="() => tableRef.reload()">
|
||||
</EditWishListDialog>
|
||||
<!-- 心愿单详情 -->
|
||||
<DetailWishListDialog v-model="DetailWishListDialogVisible" :data="DetailWishListDialogRow"></DetailWishListDialog>
|
||||
</template>
|
||||
<script setup>
|
||||
import { ArrowDown } from '@element-plus/icons-vue';
|
||||
import { ref, reactive, watch } from 'vue';
|
||||
import { useLoginStore } from "~/store";
|
||||
import { getWishListList, editWishList, deleteWishList, getDictionary, exportExcel, downloadTemplate, importExcel } from '~/service/wish_list';
|
||||
import AddWishListDialog from './components/AddWishListDialog.vue';
|
||||
import EditWishListDialog from './components/EditWishListDialog.vue';
|
||||
import DetailWishListDialog from './components/DetailWishListDialog.vue';
|
||||
|
||||
const tableRef = ref();
|
||||
const selectionData = ref([]);
|
||||
const store = useLoginStore();
|
||||
|
||||
const addWishListDialogVisible = ref(false);
|
||||
const EditWishListDialogVisible = ref(false);
|
||||
const EditWishListDialogRow = ref({});
|
||||
const DetailWishListDialogVisible = ref(false);
|
||||
const DetailWishListDialogRow = ref({});
|
||||
|
||||
const headers = {
|
||||
Accept: "application/json",
|
||||
...store.headers,
|
||||
};
|
||||
|
||||
// 查询参数
|
||||
const params = reactive({
|
||||
wish_list_name: "",
|
||||
wish_list_author: "",
|
||||
wish_list_status: "",
|
||||
|
||||
});
|
||||
const column = [
|
||||
|
||||
{
|
||||
fixed: true,
|
||||
type: 'selection'
|
||||
},
|
||||
{
|
||||
prop: "wish_list_name",
|
||||
label: '心愿名称',
|
||||
width: '250'
|
||||
},
|
||||
{
|
||||
prop: "wish_list_author",
|
||||
label: '作者',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "wish_list_status",
|
||||
label: '完成状态',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "wish_list_complete_date",
|
||||
label: '完成日期',
|
||||
width: '150'
|
||||
},
|
||||
{
|
||||
prop: "wish_list_create_time",
|
||||
label: '创建时间',
|
||||
width: '180'
|
||||
},
|
||||
{
|
||||
prop: "wish_list_sort",
|
||||
label: '排序',
|
||||
width: '180'
|
||||
},
|
||||
{
|
||||
label: '操作',
|
||||
prop: 'chaoz',
|
||||
width: '250',
|
||||
fixed: 'right'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
const handleCommand = ({ type, row }) => {
|
||||
switch (type) {
|
||||
case "detail":
|
||||
handleDetail(row);
|
||||
break;
|
||||
case 'delete':
|
||||
handleDelete([row]);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
// 删除数据
|
||||
const handleDelete = data => {
|
||||
ElMessageBox.confirm(`您确定要删除该心愿单吗?`).then(async () => {
|
||||
const res = await deleteWishList({
|
||||
wish_list_guid: data.map(v => v.wish_list_guid).join()
|
||||
});
|
||||
if (res) {
|
||||
tableRef.value.reload();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 修改
|
||||
function handleUpdate(row) {
|
||||
EditWishListDialogVisible.value = true
|
||||
EditWishListDialogRow.value = row
|
||||
}
|
||||
|
||||
// 详情
|
||||
function handleDetail(row) {
|
||||
DetailWishListDialogVisible.value = true
|
||||
DetailWishListDialogRow.value = row
|
||||
}
|
||||
|
||||
|
||||
// 导入方法
|
||||
let loadingImoprt = null;
|
||||
const uploadLoading = () => {
|
||||
loadingImoprt = ElLoading.service({
|
||||
lock: true,
|
||||
text: "正在导入中...",
|
||||
background: "rgba(255, 255, 255, 0.7)",
|
||||
});
|
||||
};
|
||||
const closeUploadLoading = () => loadingImoprt.close();
|
||||
const handleExcelSuccess = (value) => {
|
||||
if (value.code == 0) {
|
||||
ElMessageBox.alert(value.msg, "导入信息", {
|
||||
dangerouslyUseHTMLString: true,
|
||||
confirmButtonText: "确定",
|
||||
});
|
||||
} else {
|
||||
ElMessage.error(value.msg);
|
||||
}
|
||||
closeUploadLoading();
|
||||
tableRef.value.reload();
|
||||
};
|
||||
|
||||
|
||||
|
||||
//排序
|
||||
const loading = ref(false)
|
||||
async function handleEditOrder(data) {
|
||||
loading.value = true
|
||||
const { code } = await editWishList(data);
|
||||
if (code == 0) {
|
||||
loading.value = false
|
||||
tableRef.value.reload()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 展示切换
|
||||
async function handleEditShow(data) {
|
||||
// if (data.wish_list_status === 1) return;
|
||||
|
||||
loading.value = true
|
||||
const { code } = await editWishList(data);
|
||||
if (code == 0) {
|
||||
loading.value = false
|
||||
tableRef.value.reload()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 字典获取
|
||||
const complete_status = ref([]);
|
||||
async function get_complete_status() {
|
||||
await getDictionary({ dictionary_value: 'complete_status' }).then((res) => {
|
||||
complete_status.value = res
|
||||
})
|
||||
}
|
||||
get_complete_status()
|
||||
</script>
|
91
src/service/wish_list.js
Normal file
91
src/service/wish_list.js
Normal file
@ -0,0 +1,91 @@
|
||||
import { api, downloadFile, createApiUrl} from '~/utils/axios';
|
||||
|
||||
|
||||
/**
|
||||
* 导出心愿单
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function exportExcel(data) {
|
||||
downloadFile(createApiUrl('WishList.WishList/exportExcel'), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载心愿单模板
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function downloadTemplate(data) {
|
||||
downloadFile(createApiUrl('WishList.WishList/downloadTemplate'), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入心愿单
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export const importExcel = createApiUrl('WishList.WishList/importExcel');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典值
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function getDictionary(data) {
|
||||
return api.post('Dictionary.Dictionary/getDictionary', data, {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取心愿单列表
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function getWishListList(data) {
|
||||
return api.post('WishList.WishList/getWishListList', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除心愿单
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function deleteWishList(data) {
|
||||
return api.post('WishList.WishList/deleteWishList', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '删除失败'
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加心愿单
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function addWishList(data) {
|
||||
return api.post('WishList.WishList/addWishList', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '添加失败'
|
||||
});
|
||||
}
|
||||
/**
|
||||
* 编辑心愿单
|
||||
* @param {Object} data
|
||||
* @return {Promise} api
|
||||
*/
|
||||
export function editWishList(data) {
|
||||
return api.post('WishList.WishList/editWishList', data, {
|
||||
isTransformResponse: true,
|
||||
isShowSuccessMessage: true,
|
||||
errorMessageText: '编辑失败'
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user