|
@@ -11,6 +11,7 @@ let UrlList = reactive(null)
|
|
|
// 获取当前板块接口列表
|
|
|
onMounted(async () => {
|
|
|
UrlList = await getGroupUrl(["prizeSet"]);
|
|
|
+ projectIdQuery();
|
|
|
|
|
|
})
|
|
|
// 组件传参对象
|
|
@@ -24,9 +25,15 @@ const props = defineProps<{
|
|
|
type: Number;
|
|
|
default: 50;
|
|
|
};
|
|
|
+ projectId: {
|
|
|
+ type: Number;
|
|
|
+ default: 0;
|
|
|
+ },
|
|
|
+
|
|
|
}>();
|
|
|
// 表单数据
|
|
|
let UpdateForm = ref({
|
|
|
+ projectId: props.projectId, //项目
|
|
|
prizeName: "", //奖励名称
|
|
|
prizePercent: "", //奖励比例
|
|
|
prizeAmount: "", //奖励固定金额
|
|
@@ -34,16 +41,24 @@ let UpdateForm = ref({
|
|
|
recursionFlag: "", //是否递归
|
|
|
prizeContent: "", //奖励内容
|
|
|
|
|
|
+
|
|
|
});
|
|
|
// 表单实例
|
|
|
const ruleFormRef = ref()
|
|
|
|
|
|
// 传参选项数据
|
|
|
+// 项目选项数据
|
|
|
+const projectIdOptionList = ref([]);
|
|
|
// 条件模式选项数据
|
|
|
const conditionModeOptionList = [
|
|
|
+ { id: 'all', label: '全部满足' },
|
|
|
+ { id: 'one', label: '一个满足' },
|
|
|
]
|
|
|
// 奖励内容选项数据
|
|
|
const prizeContentOptionList = [
|
|
|
+ { id: 'cash', label: '现金' },
|
|
|
+ { id: 'recyc', label: '循环资格' },
|
|
|
+ { id: 'coupon', label: '机具券' },
|
|
|
]
|
|
|
|
|
|
// 选项卡参数(默认值为列表某项的id)
|
|
@@ -71,12 +86,13 @@ const submit = async (formEl) => {
|
|
|
type: "success"
|
|
|
});
|
|
|
UpdateForm.value = {
|
|
|
- prizeName: "", //奖励名称
|
|
|
- prizePercent: "", //奖励比例
|
|
|
- prizeAmount: "", //奖励固定金额
|
|
|
- conditionMode: "", //条件模式
|
|
|
- recursionFlag: "", //是否递归
|
|
|
- prizeContent: "", //奖励内容
|
|
|
+ projectId: props.projectId, //项目
|
|
|
+ prizeName: "", //奖励名称
|
|
|
+ prizePercent: "", //奖励比例
|
|
|
+ prizeAmount: "", //奖励固定金额
|
|
|
+ conditionMode: "", //条件模式
|
|
|
+ recursionFlag: "", //是否递归
|
|
|
+ prizeContent: "", //奖励内容
|
|
|
|
|
|
};
|
|
|
// 关闭新增弹窗;
|
|
@@ -98,11 +114,21 @@ const submit = async (formEl) => {
|
|
|
})
|
|
|
};
|
|
|
|
|
|
+//获取项目数据
|
|
|
+const projectIdQuery = async () => {
|
|
|
+ const { status, data }: any = await http.Request({ method: UrlList.prizeSet.prigetPriProjectDic.method, url: UrlList.prizeSet.prigetPriProjectDic.url, params: {} });
|
|
|
+ if (status === 1) {
|
|
|
+ projectIdOptionList.value = data.records;
|
|
|
+ }
|
|
|
+};
|
|
|
|
|
|
|
|
|
|
|
|
// 表单校验规则
|
|
|
const rules = reactive({
|
|
|
+ projectId: [
|
|
|
+ { required: true, message: '请输入项目', trigger: 'blur' },
|
|
|
+ ],
|
|
|
prizeName: [
|
|
|
{ required: true, message: '请输入奖励名称', trigger: 'blur' },
|
|
|
],
|
|
@@ -119,7 +145,8 @@ const closeFn: any = inject("closeAddVisible");
|
|
|
const closeVisible = () => {
|
|
|
// 清空表单项;
|
|
|
UpdateForm.value = {
|
|
|
- prizeName: "", //奖励名称
|
|
|
+ projectId: props.projectId, //项目
|
|
|
+ prizeName: "", //奖励名称
|
|
|
prizePercent: "", //奖励比例
|
|
|
prizeAmount: "", //奖励固定金额
|
|
|
conditionMode: "", //条件模式
|
|
@@ -138,6 +165,13 @@ const isFullscreen = ref(false)
|
|
|
.main
|
|
|
el-dialog(v-model='props.addVisible' width="50%" :fullscreen="isFullscreen" title="新增" draggable @close="closeVisible")
|
|
|
el-form(:model='UpdateForm' label-position="right" ref="ruleFormRef" :rules="rules" label-width="100px")
|
|
|
+ el-form-item(label="项目", prop="projectId")
|
|
|
+ el-select(
|
|
|
+ v-model="UpdateForm.projectId",
|
|
|
+ placeholder="请选择项目",
|
|
|
+ clearable,
|
|
|
+ )
|
|
|
+ el-option(:label="item.label", :value="item.id" v-for="(item,index) in projectIdOptionList")
|
|
|
el-form-item(label='奖励名称' prop="prizeName")
|
|
|
el-input(v-model='UpdateForm.prizeName' autocomplete='off'
|
|
|
placeholder="请输入奖励名称")
|