Преглед на файлове

印刷任务批量关联

zhangjie преди 2 години
родител
ревизия
88a324aaac
променени са 3 файла, в които са добавени 26 реда и са изтрити 23 реда
  1. 3 3
      src/modules/print/api.js
  2. 16 11
      src/modules/print/components/PrintPlanBatchLinkPaper.vue
  3. 7 9
      src/modules/print/components/PrintPlanDetail.vue

+ 3 - 3
src/modules/print/api.js

@@ -48,10 +48,10 @@ export const businessTemplateDownload = () => {
   );
 };
 export const planBatchLinkPaper = datas => {
-  return $post("/api/admin/exam/print/todo", datas);
+  return $postParam("/api/admin/exam/print/relate_update_batch", datas);
 };
-export const planAllRelatePaperTypes = printPlanId => {
-  return $post("/api/admin/exam/print/todo", { printPlanId });
+export const planAllRelatePaperTypes = datas => {
+  return $postParam("/api/admin/exam/print/list_relate_common_types", datas);
 };
 // business-data-detail
 export const businessDataDetailListPage = datas => {

+ 16 - 11
src/modules/print/components/PrintPlanBatchLinkPaper.vue

@@ -15,16 +15,17 @@
       :rules="rules"
       label-width="85px"
     >
-      <el-form-item prop="relatePaperType" label="关联类型:">
+      <el-form-item prop="relateType" label="关联类型:">
         <el-select
-          v-model="modalForm.relatePaperType"
+          v-model="modalForm.relateType"
           placeholder="请选择"
           multiple
+          clearable
           style="width:100%"
         >
           <el-option
-            v-for="item in paperTypes"
-            :key="item"
+            v-for="(item, index) in paperTypes"
+            :key="index"
             :value="item"
             :label="item"
           ></el-option>
@@ -46,7 +47,7 @@ import { planBatchLinkPaper, planAllRelatePaperTypes } from "../api";
 export default {
   name: "print-plan-batch-link-paper",
   props: {
-    plan: {
+    filterData: {
       type: Object,
       default() {
         return {};
@@ -57,13 +58,14 @@ export default {
     return {
       modalIsShow: false,
       isSubmit: false,
-      modalForm: {},
+      modalForm: { relateType: [] },
       paperTypes: [],
       rules: {
-        relatePaperType: [
+        relateType: [
           {
             required: true,
             validator: (rule, value, callback) => {
+              console.log(value);
               if (!value || !value.length) {
                 return callback(new Error("请选择关联类型"));
               }
@@ -86,7 +88,7 @@ export default {
       this.modalIsShow = true;
     },
     async getPaperTypes() {
-      const data = planAllRelatePaperTypes(this.plan.id);
+      const data = await planAllRelatePaperTypes(this.filterData);
       this.paperTypes = data || [];
     },
     async submit() {
@@ -95,11 +97,14 @@ export default {
 
       if (this.isSubmit) return;
       this.isSubmit = true;
-      let datas = { printPlanId: this.plan.id, ...this.modalForm };
-      const data = await planBatchLinkPaper(datas).catch(() => {});
+      let datas = { ...this.filterData, ...this.modalForm };
+      let res = true;
+      await planBatchLinkPaper(datas).catch(() => {
+        res = false;
+      });
       this.isSubmit = false;
 
-      if (!data) return;
+      if (!res) return;
 
       this.$message.success("操作成功!");
       this.$emit("modified");

+ 7 - 9
src/modules/print/components/PrintPlanDetail.vue

@@ -181,7 +181,8 @@
     <!-- PrintPlanBatchLinkPaper -->
     <print-plan-batch-link-paper
       ref="PrintPlanBatchLinkPaper"
-      :plan="plan"
+      :filter-data="filterData"
+      @modified="getList"
     ></print-plan-batch-link-paper>
   </div>
 </template>
@@ -218,9 +219,7 @@ export default {
         paperNumber: "",
         userName: ""
       },
-      current: 1,
-      size: this.GLOBAL.pageSize,
-      total: 0,
+      filterData: {},
       dataList: [],
       curRow: {},
       totalInfo: {}
@@ -252,13 +251,12 @@ export default {
     },
     async getList() {
       const datas = {
-        ...this.filter,
-        pageNumber: this.current,
-        pageSize: this.size
+        ...this.filter
       };
       const data = await planLinkPaperListPage(datas);
-      this.dataList = data.records;
-      this.total = data.total;
+      this.dataList = data;
+
+      this.filterData = { ...this.filter };
     },
     toPage(page) {
       this.current = page;