lcl 7 months ago
parent
commit
25571e4076

+ 41 - 7
src/views/pri/priList/components/add/index.vue

@@ -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="请输入奖励名称")

+ 7 - 7
src/views/pri/priList/components/updatePriList/index.vue

@@ -72,12 +72,12 @@ const submit = async (formEl) => {
           type: "success"
         });
         UpdateForm.value = {
-                prizeName: "", //奖励名称
-      prizePercent: "", //奖励比例
-      prizeAmount: "", //奖励固定金额
-      conditionMode: "", //条件模式
-      recursionFlag: "", //是否递归
-      prizeContent: "", //奖励内容
+          prizeName: "", //奖励名称
+          prizePercent: "", //奖励比例
+          prizeAmount: "", //奖励固定金额
+          conditionMode: "", //条件模式
+          recursionFlag: "", //是否递归
+          prizeContent: "", //奖励内容
 
         };
         // 关闭修改弹窗;
@@ -119,7 +119,7 @@ const rules = reactive({
 const closeFn: any = inject('closeEditUpdatePriListVisible');
 const openVisible = async () => {
   //通过ID获取表格数据
-  const { status, data }: any = await http.Request({ method: UrlList.prizeSet.prigetPriListQuery.method, url: UrlList.prizeSet.prigetPriListQuery.url, params: { id: props.formData.id }});
+  const { status, data }: any = await http.Request({ method: UrlList.prizeSet.prigetPriListQuery.method, url: UrlList.prizeSet.prigetPriListQuery.url, params: { id: props.formData.id } });
   if (status === 1) {
     UpdateForm.value = data;
 

+ 38 - 2
src/views/pri/priList/hook.tsx

@@ -1,4 +1,6 @@
-import { reactive, onMounted, ref, ElMessage, ElMessageBox, http, getGroupUrl, RegularVerification, verification, PaginationProps } from "@/utils/importUsed"
+import { reactive, onMounted, ref, ElMessage, ElMessageBox, http, getGroupUrl, RegularVerification, verification, PaginationProps } from "@/utils/importUsed";
+import { useRoute } from "vue-router";
+import router from "@/router";
 // 表单实例
 const ruleFormRef = ref()
 export function usePriList() {
@@ -6,15 +8,21 @@ export function usePriList() {
   let UrlList = reactive(null)
   // 获取当前板块接口列表
   onMounted(async () => {
+    const route = useRoute();
+    form.projectId = route.query.projectId.toString();
+
     UrlList = await getGroupUrl(["prizeSet"]);
     onSearch(ruleFormRef.value);
-  
+  projectIdQuery();
+
   });
   let form = reactive({
+  projectId:"", //项目
   prizeName:"", //奖励名称
   conditionMode:"", //条件模式
   prizeContent:"", //奖励内容
 
+
   });
   const dataList = ref([]);
   const loading = ref(false);
@@ -38,6 +46,11 @@ export function usePriList() {
       width: 70,
       hide: ({ checkList }) => !checkList.includes("序号列")
     },
+    {
+      label: "ID",
+      prop: "id",
+      minWidth: 200
+    },
     {
       label: "奖励名称",
       prop: "prizeName",
@@ -130,9 +143,30 @@ export function usePriList() {
       }
     })
   }
+    // 项目选项数据
+    const projectIdOptionList = ref([]);
+  //获取项目数据
+  async function projectIdQuery() {
+    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 conditionModeOptionList = [
+    { id: 'all', label: '全部满足' },
+    { id: 'one', label: '一个满足' },
+  ]
+  // 奖励内容选项数据
+  const prizeContentOptionList = [
+    { id: 'cash', label: '现金' },
+    { id: 'recyc', label: '循环资格' },
+    { id: 'coupon', label: '机具券' },
+  ]
 
 
 
+  
     // 删除
   function handleDelete(row) {
     ElMessageBox.confirm(
@@ -186,6 +220,8 @@ export function usePriList() {
     handleCurrentChange,
     handleSelectionChange,
     ruleFormRef,
+    projectIdQuery,
+    projectIdOptionList,
 
     handleAdd,
     addVisible,

+ 11 - 2
src/views/pri/priList/index.vue

@@ -28,6 +28,7 @@ const {
   handleCurrentChange,
   handleSelectionChange,
   ruleFormRef,
+  projectIdOptionList,
   handleAdd,
   addVisible,
   handleUpdatePriList,
@@ -64,6 +65,13 @@ provide('closeEditUpdatePriListVisible', closeEditUpdatePriListVisible)
       ref="ruleFormRef"
       :rules="rules"
     )
+      el-form-item(label="项目", prop="projectId")
+        el-select(
+          v-model="form.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='form.prizeName' autocomplete='off'
           placeholder="请输入奖励名称")
@@ -119,7 +127,7 @@ provide('closeEditUpdatePriListVisible', closeEditUpdatePriListVisible)
               type="primary"
               size="small"
               @click="handleUpdatePriList(row)"
-              :icon="useRenderIcon(Delete)"
+              :icon="useRenderIcon(EditPen)"
               v-if="hasAuth(['updatePriList'])"
             ) 编辑
             el-button.reset-margin(
@@ -132,7 +140,8 @@ provide('closeEditUpdatePriListVisible', closeEditUpdatePriListVisible)
             ) 删除
 
 
-    Add(:addVisible="addVisible")
+
+    Add(:addVisible="addVisible" :projectId="form.projectId")
     EditUpdatePriList(:editVisible="editUpdatePriListVisible" :formData="editUpdatePriListFormData")
 
                     

+ 2 - 0
src/views/pri/priProject/components/add/index.vue

@@ -24,6 +24,7 @@ const props = defineProps<{
     type: Number;
     default: 50;
   };
+
 }>();
 // 表单数据
 let UpdateForm = ref({
@@ -35,6 +36,7 @@ let UpdateForm = ref({
   requestUrl: "", //请求地址
   returnType: "", //返回数据类型
 
+
 });
 // 表单实例
 const ruleFormRef = ref()

+ 12 - 5
src/views/pri/priProject/hook.tsx

@@ -1,6 +1,6 @@
+import { reactive, onMounted, ref, ElMessage, ElMessageBox, http, getGroupUrl, RegularVerification, verification, PaginationProps } from "@/utils/importUsed";
+import { useRoute } from "vue-router";
 import router from "@/router";
-import { reactive, onMounted, ref, ElMessage, ElMessageBox, http, getGroupUrl, RegularVerification, verification, PaginationProps } from "@/utils/importUsed"
-
 // 表单实例
 const ruleFormRef = ref()
 export function usePriProject() {
@@ -8,6 +8,8 @@ export function usePriProject() {
   let UrlList = reactive(null)
   // 获取当前板块接口列表
   onMounted(async () => {
+    const route = useRoute();
+
     UrlList = await getGroupUrl(["prizeSet"]);
     onSearch(ruleFormRef.value);
 
@@ -16,6 +18,7 @@ export function usePriProject() {
     projectName: "", //项目名称
     requestMode: "", //调用方式
 
+
   });
   const dataList = ref([]);
   const loading = ref(false);
@@ -132,8 +135,11 @@ export function usePriProject() {
     })
   }
 
-  function test(row) {
-    router.push({ path: '../../api/apiGroup/index', query: { id: row.id } });
+
+
+  //跳转到奖励配置
+  function linkToPriList(row) {
+    router.push({ path: '../../pri/priList/index', query: { id: row.id } });
   }
 
   // 删除
@@ -196,6 +202,7 @@ export function usePriProject() {
     editUpdatePriProjectVisible,
     editUpdatePriProjectFormData,
     handleDelete,
-    test,
+    linkToPriList,
+
   };
 }

+ 16 - 8
src/views/pri/priProject/index.vue

@@ -34,7 +34,8 @@ const {
   editUpdatePriProjectVisible,
   editUpdatePriProjectFormData,
   handleDelete,
-  test,
+  linkToPriList,
+
 } = usePriProject();
 // 关闭添加
 const closeAddVisible = () => {
@@ -123,15 +124,22 @@ provide('closeEditUpdatePriProjectVisible', closeEditUpdatePriProjectVisible)
               :icon="useRenderIcon(Delete)"
               v-if="hasAuth(['delete'])"
             ) 删除
-            el-button.reset-margin(
-              link
-              type="primary"
-              size="small"
-              :icon="useRenderIcon(EditPen)"
-              @click="test(row)"
-            ) 测试
 
 
+            el-dropdown(trigger="click", :hide-on-click="false")
+              el-button.ml-3(class="mt-[2px]" link type='primary' :size='size' :icon='useRenderIcon(More)')
+              template(#dropdown)
+                el-dropdown-menu
+                  el-dropdown-item
+                    el-button.reset-margin.edit-btn(
+                      link
+                      type="primary"
+                      size="small"
+                      @click="linkToPriList(row)"
+                      :icon="useRenderIcon(EditPen)"
+                      v-if="hasAuth(['linkToPriList'])"
+                    ) 奖励配置
+
     Add(:addVisible="addVisible")
     EditUpdatePriProject(:editVisible="editUpdatePriProjectVisible" :formData="editUpdatePriProjectFormData")