瓶中沙 2024-05-08 23:16:25 +08:00
parent dc1d9e1995
commit 3cb05f85a2
2 changed files with 132 additions and 3 deletions

102
src/components/PzSet.vue Normal file
View File

@ -0,0 +1,102 @@
<template>
<el-drawer v-model="visible" title="配置管理" direction="rtl" :before-close="closeDialog">
<el-form :model="form" label-width="120px">
<el-form-item label="Activity name">
<el-input v-model="form.name" />
</el-form-item>
<el-form-item label="Activity zone">
<el-select v-model="form.region" placeholder="please select your zone">
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
<el-form-item label="Activity time">
<el-col :span="11">
<el-date-picker v-model="form.date1" type="date" placeholder="Pick a date" style="width: 100%" />
</el-col>
<el-col :span="2" class="text-center">
<span class="text-gray-500">-</span>
</el-col>
<el-col :span="11">
<el-time-picker v-model="form.date2" placeholder="Pick a time" style="width: 100%" />
</el-col>
</el-form-item>
<el-form-item label="Instant delivery">
<el-switch v-model="form.delivery" />
</el-form-item>
<el-form-item label="Activity type">
<el-checkbox-group v-model="form.type">
<el-checkbox label="Online activities" name="type" />
<el-checkbox label="Promotion activities" name="type" />
<el-checkbox label="Offline activities" name="type" />
<el-checkbox label="Simple brand exposure" name="type" />
</el-checkbox-group>
</el-form-item>
<el-form-item label="Resources">
<el-radio-group v-model="form.resource">
<el-radio label="Sponsor" />
<el-radio label="Venue" />
</el-radio-group>
</el-form-item>
<el-form-item label="Activity form">
<el-input v-model="form.desc" type="textarea" />
</el-form-item>
<el-form-item>
<el-button type="primary" @click="onSubmit"></el-button>
<el-button>取消</el-button>
</el-form-item>
</el-form>
</el-drawer>
</template>
<script>
import { onMounted, reactive, ref, toRefs, computed, nextTick } from "vue";
import infoApi from "@/api/infoApi.js";
import { ElMessage, ElMessageBox } from "element-plus";
export default {
props: ["formData", "dialogVisible"],
emits: ["dialogClose", "dialogSuccess"],
setup(props, ctx) {
const ruleFormRef = ref(null);
const state = reactive({
form: {
name: '',
region: '',
date1: '',
date2: '',
delivery: false,
type: [],
resource: '',
desc: '',
}
});
const onSubmit = () => {
console.log('submit!')
}
const visible = computed(() => {
return props.dialogVisible;
});
onMounted(() => {
});
const closeDialog = () => {
ctx.emit("dialogClose");
};
const importData = () => { };
const exportData = () => { };
return {
...toRefs(state),
visible,
closeDialog,
importData,
exportData
};
},
};
</script>
<style lang="scss" scoped></style>

View File

@ -83,6 +83,9 @@
</el-table-column> </el-table-column>
<el-table-column label="操作" align="center" show-overflow-tooltip> <el-table-column label="操作" align="center" show-overflow-tooltip>
<template #default="scope"> <template #default="scope">
<el-button type="primary" @click="openPz(scope.row)">
配置
</el-button>
<el-button type="primary" @click="editData(scope.row)"> <el-button type="primary" @click="editData(scope.row)">
编辑 编辑
</el-button> </el-button>
@ -113,6 +116,13 @@
@dialogSuccess="dialogSuccess1" @dialogSuccess="dialogSuccess1"
> >
</AddSet> </AddSet>
<PzSet
:dialogVisible="dialogVisible2"
v-if="dialogVisible2"
@dialogClose="dialogClose2"
@dialogSuccess="dialogSuccess2"
>
</PzSet>
</el-card> </el-card>
</template> </template>
@ -122,11 +132,13 @@ import infoApi from "@/api/infoApi.js";
import { ElMessage, ElMessageBox } from "element-plus"; import { ElMessage, ElMessageBox } from "element-plus";
import AddData from "@/components/AddData.vue"; import AddData from "@/components/AddData.vue";
import AddSet from "@/components/AddSet.vue"; import AddSet from "@/components/AddSet.vue";
import PzSet from "@/components/PzSet.vue";
export default { export default {
name: "page", name: "page",
components: { components: {
AddData, AddData,
AddSet, AddSet,
PzSet
}, },
setup() { setup() {
const state = reactive({ const state = reactive({
@ -135,7 +147,8 @@ export default {
formData: {}, formData: {},
dialogVisible: false, dialogVisible: false,
dialogVisible1: false, dialogVisible1: false,
type: '0' // 0 1 dialogVisible2: false,//
type: '0', // 0 1
}); });
onMounted(() => { onMounted(() => {
@ -173,11 +186,18 @@ export default {
const dialogClose1 = () => { const dialogClose1 = () => {
state.dialogVisible1 = false; state.dialogVisible1 = false;
}; };
const dialogClose2 = () => {
state.dialogVisible2 = false;
};
const dialogSuccess1 = () => { const dialogSuccess1 = () => {
state.dialogVisible1 = false; state.dialogVisible1 = false;
getTableData(); getTableData();
}; };
const dialogSuccess2 = () => {
state.dialogVisible2 = false;
getTableData();
};
const addData = () => { const addData = () => {
state.formData = { state.formData = {
name: '', name: '',
@ -237,6 +257,10 @@ export default {
} }
}; };
const openPz = (item) => {
state.dialogVisible2 = true;
}
return { return {
...toRefs(state), ...toRefs(state),
addData, addData,
@ -247,7 +271,10 @@ export default {
dialogSuccess, dialogSuccess,
changeStatus, changeStatus,
dialogClose1, dialogClose1,
dialogSuccess1 dialogSuccess1,
dialogClose2,
dialogSuccess2,
openPz
}; };
}, },
}; };