zhangjie пре 3 година
родитељ
комит
f3c3833262

+ 130 - 0
src/components/UploadFetchFile.vue

@@ -0,0 +1,130 @@
+<template>
+  <div class="upload-file-view">
+    <el-input
+      :style="{ width: inputWidth }"
+      v-model.trim="attachmentName"
+      placeholder="文件名称"
+      readonly
+    ></el-input>
+    <el-upload
+      action="upload-url"
+      :on-change="handleFileChange"
+      :show-file-list="false"
+      :auto-upload="false"
+      :disabled="disabled"
+      style="display:inline-block;margin: 0 10px;"
+      ref="UploadComp"
+    >
+      <el-button type="primary" :disabled="disabled" :loading="loading"
+        >选择</el-button
+      >
+    </el-upload>
+  </div>
+</template>
+
+<script>
+import { fileMD5 } from "@/plugins/md5";
+
+export default {
+  name: "upload-file-view",
+  props: {
+    inputWidth: {
+      type: String,
+      default: "200px"
+    },
+    format: {
+      type: Array,
+      default() {
+        return ["xls", "xlsx"];
+      }
+    },
+    maxSize: {
+      type: Number,
+      default: 20 * 1024 * 1024
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    }
+  },
+  data() {
+    return {
+      attachmentName: "",
+      canUpload: false,
+      loading: false,
+      res: {}
+    };
+  },
+  methods: {
+    checkFileFormat(fileType) {
+      const _file_format = fileType
+        .split(".")
+        .pop()
+        .toLocaleLowerCase();
+      return this.format.some(
+        item => item.toLocaleLowerCase() === _file_format
+      );
+    },
+    async handleFileChange(file) {
+      console.log(file);
+      this.attachmentName = file.name;
+      this.canUpload = file.status === "ready";
+
+      if (file.size > this.maxSize) {
+        this.handleExceededSize();
+        return Promise.reject();
+      }
+
+      if (!this.checkFileFormat(file.name)) {
+        this.handleFormatError();
+        return Promise.reject();
+      }
+      this.$emit("valid-change", { success: true });
+
+      const md5 = await fileMD5(file.raw);
+
+      this.$emit("file-change", {
+        md5,
+        filename: file.name,
+        file: file.raw
+      });
+    },
+    // upload(options) {
+    //   let formData = new FormData();
+    //   Object.entries(options.data).forEach(([k, v]) => {
+    //     formData.append(k, v);
+    //   });
+    //   formData.append("file", options.file);
+    //   this.$emit("uploading");
+
+    //   return $post(options.action, formData, { headers: options.headers });
+    // },
+    handleFormatError() {
+      const content = "只支持文件格式为" + this.format.join("/");
+      this.res = {
+        success: false,
+        message: content
+      };
+      this.$emit("valid-change", this.res);
+    },
+    handleExceededSize() {
+      const content =
+        "文件大小不能超过" + Math.floor(this.maxSize / 1024) + "M";
+      this.res = {
+        success: false,
+        message: content
+      };
+      this.$emit("valid-change", this.res);
+    },
+    setAttachmentName(name) {
+      this.attachmentName = name;
+    }
+  }
+};
+</script>
+
+<style scoped>
+.upload-file-view {
+  display: inline-block;
+}
+</style>

+ 2 - 2
src/components/base/PrintRoomSelect.vue

@@ -20,7 +20,7 @@
 </template>
 
 <script>
-import { printRoomQuery } from "../../modules/base/api";
+import { organizationFindByTypeList } from "../../modules/base/api";
 
 export default {
   name: "campus-select",
@@ -49,7 +49,7 @@ export default {
   },
   methods: {
     async search() {
-      const res = await printRoomQuery();
+      const res = await organizationFindByTypeList("PRINTING_HOUSE");
       this.optionList = res;
     },
     select() {

+ 2 - 2
src/components/base/TeachingRoomSelect.vue

@@ -20,7 +20,7 @@
 </template>
 
 <script>
-import { teachingRoomQuery } from "../../modules/base/api";
+import { organizationFindByTypeList } from "../../modules/base/api";
 
 export default {
   name: "teaching-room-select",
@@ -49,7 +49,7 @@ export default {
   },
   methods: {
     async search() {
-      const res = await teachingRoomQuery();
+      const res = await organizationFindByTypeList("TEACHING_ROOM");
       this.optionList = res;
     },
     select() {

+ 6 - 9
src/modules/base/api.js

@@ -130,6 +130,12 @@ export const flowListPage = datas => {
 export const flowPublish = id => {
   return $post("/api/admin/flow/publish", { id });
 };
+export const flowEnd = flowId => {
+  return $post("/api/admin/flow/end", { flowId });
+};
+export const flowRegister = (datas, headers) => {
+  return $post("/api/admin/flow/register", datas, { headers });
+};
 // approve-record
 export const approveRecordListPage = datas => {
   return $postParam("/api/admin/flow/approve/list", datas);
@@ -149,15 +155,6 @@ export const deleteCampus = id => {
 export const updateCampus = datas => {
   return $post("/api/admin/basic/campus/save", datas);
 };
-// print-room-manage
-export const printRoomQuery = () => {
-  return $postParam("/api/admin/basic/print_room/list", {});
-};
-
-// staff-room-manage
-export const teachingRoomQuery = () => {
-  return $postParam("/api/admin/basic/staff_room/list", {});
-};
 
 // student-manage
 export const studentListQuery = datas => {

+ 1 - 1
src/modules/base/components/ModifyStudent.vue

@@ -20,7 +20,7 @@
       <el-form-item prop="studentName" label="姓名:">
         <el-input
           v-model.trim="modalForm.studentName"
-          placeholder="请输入课程名称"
+          placeholder="请输入姓名"
           clearable
         ></el-input>
       </el-form-item>

+ 156 - 0
src/modules/base/components/RegistFlowDialog.vue

@@ -0,0 +1,156 @@
+<template>
+  <el-dialog
+    class="regist-flow-dialog"
+    :visible.sync="modalIsShow"
+    title="新增流程"
+    top="10vh"
+    width="600px"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    @open="visibleChange"
+  >
+    <div class="part-box part-box-pad part-box-border">
+      <!-- apply-customer -->
+      <el-form
+        ref="modalFormComp"
+        :model="modalForm"
+        :rules="rules"
+        label-width="90px"
+      >
+        <el-form-item prop="name" label="名称:">
+          <el-input
+            style="width:300px"
+            v-model.trim="modalForm.name"
+            placeholder="请输入名称"
+          ></el-input>
+        </el-form-item>
+        <el-form-item label="是否发布:">
+          <el-switch
+            v-model="modalForm.publish"
+            active-color="#23c4b9"
+            inactive-color="#dcdfe6"
+          >
+          </el-switch>
+        </el-form-item>
+        <el-form-item prop="uploadData" label="上传文件:">
+          <upload-fetch-file
+            input-width="300px"
+            :format="format"
+            @valid-change="validChange"
+            @file-change="fileChange"
+            ref="UploadFetchFile"
+          ></upload-fetch-file>
+          <p class="tips-info">
+            上传的文件只支持{{ format.join(",") }},大小不超过2M
+          </p>
+        </el-form-item>
+      </el-form>
+    </div>
+    <div slot="footer">
+      <el-button type="primary" :disabled="isSubmit" @click="confirm"
+        >确定</el-button
+      >
+      <el-button type="danger" @click="cancel" plain>返回</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+import UploadFetchFile from "@/components/UploadFetchFile";
+import { flowRegister } from "../api";
+
+export default {
+  name: "regist-flow-dialog-view",
+  props: {
+    data: {
+      type: Object,
+      default() {
+        return {};
+      }
+    }
+  },
+  components: { UploadFetchFile },
+  data() {
+    return {
+      modalIsShow: false,
+      isSubmit: false,
+      modalForm: {
+        name: "",
+        publish: false
+      },
+      rules: {
+        name: [
+          {
+            required: true,
+            message: "请输入名称",
+            trigger: "change"
+          }
+        ],
+        uploadData: [
+          {
+            required: true,
+            validator: (rule, value, callback) => {
+              if (this.uploadData) {
+                callback();
+              } else {
+                return callback(new Error(`请选择合适的文件`));
+              }
+            },
+            trigger: "change"
+          }
+        ]
+      },
+      // upload
+      format: ["bpmn"],
+      maxSize: 2 * 1024 * 1024,
+      uploadData: null
+    };
+  },
+  methods: {
+    visibleChange() {
+      this.modalForm = { name: "", publish: false };
+    },
+    cancel() {
+      this.modalIsShow = false;
+    },
+    open() {
+      this.modalIsShow = true;
+    },
+    validChange(result) {
+      if (!result.success) {
+        this.uploadData = null;
+        this.$notify.error({ title: "错误提示", message: result.message });
+        this.$refs.modalFormComp.validateField("uploadData");
+      }
+    },
+    fileChange(data) {
+      this.uploadData = data;
+      this.$refs.modalFormComp.validateField("uploadData");
+    },
+    async confirm() {
+      const valid = await this.$refs.modalFormComp.validate().catch(() => {});
+      if (!valid) return;
+
+      if (this.isSubmit) return;
+      this.isSubmit = true;
+
+      let formData = new FormData();
+      Object.entries(this.modalForm).forEach(([k, v]) => {
+        formData.append(k, v);
+      });
+      formData.append("file", this.uploadData.file);
+
+      const data = await flowRegister(formData, {
+        md5: this.uploadData.md5
+      }).catch(() => {});
+      this.isSubmit = false;
+      if (!data) return;
+
+      this.$message.success("添加成功!");
+      this.cancel();
+      this.$emit("modified");
+    }
+  }
+};
+</script>

+ 6 - 0
src/modules/base/router.js

@@ -9,6 +9,7 @@ import CommonCardTemplate from "./views/CommonCardTemplate.vue";
 import ParamPrintTemplate from "./views/ParamPrintTemplate.vue";
 import CommonPrintTemplate from "./views/CommonPrintTemplate.vue";
 import PrintPlanPushManage from "./views/PrintPlanPushManage.vue";
+import FlowManage from "./views/FlowManage.vue";
 import ApproveRecordManage from "./views/ApproveRecordManage.vue";
 // dict
 import CampusManage from "./views/CampusManage.vue";
@@ -61,6 +62,11 @@ export default [
     name: "PrintPlanPushManage",
     component: PrintPlanPushManage
   },
+  {
+    path: "/base/flow-manage",
+    name: "FlowManage",
+    component: FlowManage
+  },
   {
     path: "/base/approve-record-manage",
     name: "ApproveRecordManage",

+ 1 - 1
src/modules/base/views/ApproveRecordManage.vue

@@ -102,7 +102,7 @@ export default {
       dataList: []
     };
   },
-  created() {
+  mounted() {
     this.toPage(1);
   },
   methods: {

+ 1 - 1
src/modules/base/views/CampusManage.vue

@@ -60,7 +60,7 @@ export default {
       curRow: {}
     };
   },
-  created() {
+  mounted() {
     this.getList();
   },
   methods: {

+ 1 - 1
src/modules/base/views/CardRuleManage.vue

@@ -172,7 +172,7 @@ export default {
       ABLE_TYPE
     };
   },
-  created() {
+  mounted() {
     this.getList();
     this.getExamRule();
   },

+ 1 - 1
src/modules/base/views/CourseManage.vue

@@ -154,7 +154,7 @@ export default {
       curCourse: {}
     };
   },
-  created() {
+  mounted() {
     this.getList();
   },
   methods: {

+ 27 - 14
src/modules/base/views/FlowManage.vue

@@ -24,7 +24,7 @@
       </el-form>
       <div class="part-box-action">
         <el-button
-          v-if="checkPrivilege('button', 'add')"
+          v-if="!checkPrivilege('button', 'add')"
           type="primary"
           icon="el-icon-circle-plus-outline"
           @click="toAdd"
@@ -55,20 +55,21 @@
         >
           <template slot-scope="scope">
             <el-button
-              v-if="checkPrivilege('link', 'publish')"
+              v-if="checkPrivilege('link', 'publish') && !scope.row.publish"
               class="btn-table-icon"
               type="text"
               icon="icon icon-edit"
               @click="toPublish(scope.row)"
               title="发布"
             ></el-button>
-            <!-- <el-button
+            <el-button
+              v-if="checkPrivilege('link', 'delete')"
               class="btn-table-icon"
               type="text"
               icon="icon icon-delete"
               @click="toDelete(scope.row)"
               title="删除"
-            ></el-button> -->
+            ></el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -84,23 +85,22 @@
         </el-pagination>
       </div>
     </div>
-    <!-- ModifyRole -->
-    <modify-role
-      ref="ModifyRole"
-      :instance="curFlow"
+    <!-- RegistFlowDialog -->
+    <regist-flow-dialog
+      ref="RegistFlowDialog"
       @modified="getList"
-    ></modify-role>
+    ></regist-flow-dialog>
   </div>
 </template>
 
 <script>
-import { flowListPage, flowPublish } from "../api";
-import ModifyRole from "../components/ModifyRole";
+import { flowListPage, flowPublish, flowEnd } from "../api";
+import RegistFlowDialog from "../components/RegistFlowDialog";
 
 export default {
   name: "flow-manage",
   components: {
-    ModifyRole
+    RegistFlowDialog
   },
   data() {
     return {
@@ -114,7 +114,7 @@ export default {
       curFlow: {}
     };
   },
-  created() {
+  mounted() {
     this.toPage(1);
   },
   methods: {
@@ -136,7 +136,7 @@ export default {
     },
     toAdd() {
       this.curFlow = {};
-      this.$refs.ModifyRole.open();
+      this.$refs.RegistFlowDialog.open();
     },
     toPublish(row) {
       if (row.publish) return;
@@ -152,6 +152,19 @@ export default {
           row.publish = !row.publish;
         })
         .catch(() => {});
+    },
+    toDelete(row) {
+      this.$confirm(`确定要删除流程【${row.name}】吗?`, "提示", {
+        cancelButtonClass: "el-button--danger is-plain",
+        confirmButtonClass: "el-button--primary",
+        type: "warning"
+      })
+        .then(async () => {
+          await flowEnd(row.id);
+          this.$message.success("操作成功!");
+          this.getList();
+        })
+        .catch(() => {});
     }
   }
 };

+ 1 - 1
src/modules/base/views/RoleManage.vue

@@ -150,7 +150,7 @@ export default {
       ROLE_TYPE: {}
     };
   },
-  created() {
+  mounted() {
     this.toPage(1);
   },
   methods: {

+ 1 - 1
src/modules/base/views/StudentManage.vue

@@ -123,7 +123,7 @@ export default {
       dfilename: "学生导入模板.xlsx"
     };
   },
-  created() {
+  mounted() {
     this.getList();
   },
   methods: {

+ 1 - 1
src/modules/base/views/TemplateManage.vue

@@ -211,7 +211,7 @@ export default {
       pickerOptions
     };
   },
-  created() {
+  mounted() {
     this.getList();
   },
   methods: {

+ 1 - 1
src/modules/base/views/UserManage.vue

@@ -204,7 +204,7 @@ export default {
       dfilename: "用户导入模板.xlsx"
     };
   },
-  created() {
+  mounted() {
     this.getRoleList();
     this.getList();
   },

+ 1 - 1
src/modules/customer/views/CustomerCard.vue

@@ -209,7 +209,7 @@ export default {
       return this.filter.status === "SUBMIT";
     }
   },
-  created() {
+  mounted() {
     this.initData();
   },
   methods: {

+ 1 - 1
src/modules/exam/views/DataTaskManage.vue

@@ -171,7 +171,7 @@ export default {
       loading: false
     };
   },
-  created() {
+  mounted() {
     this.toPage(1);
   },
   methods: {

+ 1 - 1
src/modules/exam/views/ExamTaskManage.vue

@@ -274,7 +274,7 @@ export default {
       pickerOptions
     };
   },
-  created() {
+  mounted() {
     this.getList();
   },
   methods: {

+ 1 - 1
src/modules/exam/views/TaskReviewManage.vue

@@ -318,7 +318,7 @@ export default {
       return this.auditStatus === "AUDITED";
     }
   },
-  created() {
+  mounted() {
     this.toPage(1);
   },
   methods: {

+ 1 - 1
src/modules/print/views/BusinessDataDetail.vue

@@ -156,7 +156,7 @@ export default {
       curRow: {}
     };
   },
-  created() {
+  mounted() {
     this.search();
   },
   methods: {

+ 1 - 1
src/modules/print/views/BusinessDataExport.vue

@@ -217,7 +217,7 @@ export default {
       );
     }
   },
-  created() {
+  mounted() {
     this.search();
   },
   methods: {

+ 1 - 1
src/modules/print/views/PlanLinkPaper.vue

@@ -166,7 +166,7 @@ export default {
       RELATE_TYPE
     };
   },
-  created() {
+  mounted() {
     this.search();
   },
   methods: {

+ 1 - 1
src/modules/print/views/PrintPlanManage.vue

@@ -194,7 +194,7 @@ export default {
       pickerOptions
     };
   },
-  created() {
+  mounted() {
     this.search();
   },
   methods: {

+ 1 - 1
src/modules/print/views/PrintTaskManage.vue

@@ -344,7 +344,7 @@ export default {
       pickerOptions
     };
   },
-  created() {
+  mounted() {
     this.search();
   },
   methods: {