From 5f700e8cdf48ab2b4db45ba9fb4b0a889f1a7208 Mon Sep 17 00:00:00 2001
From: 唐耀东 <18861537@qq.com>
Date: 星期一, 15 八月 2022 13:22:29 +0800
Subject: [PATCH] 提交代码

---
 src/views/basics/template/index.vue |  354 +++++++++++++++++++++++++
 src/api/oa/manual.js                |   44 +++
 src/views/basics/manual/index.vue   |  357 +++++++++++++++++++++++++
 src/api/oa/template.js              |   44 +++
 4 files changed, 799 insertions(+), 0 deletions(-)

diff --git a/src/api/oa/manual.js b/src/api/oa/manual.js
new file mode 100644
index 0000000..aafa3f5
--- /dev/null
+++ b/src/api/oa/manual.js
@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 鏌ヨ鎵嬪唽绠$悊鍒楄〃
+export function listManual(query) {
+  return request({
+    url: '/oa/manual/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 鏌ヨ鎵嬪唽绠$悊璇︾粏
+export function getManual(id) {
+  return request({
+    url: '/oa/manual/' + id,
+    method: 'get'
+  })
+}
+
+// 鏂板鎵嬪唽绠$悊
+export function addManual(data) {
+  return request({
+    url: '/oa/manual',
+    method: 'post',
+    data: data
+  })
+}
+
+// 淇敼鎵嬪唽绠$悊
+export function updateManual(data) {
+  return request({
+    url: '/oa/manual',
+    method: 'put',
+    data: data
+  })
+}
+
+// 鍒犻櫎鎵嬪唽绠$悊
+export function delManual(id) {
+  return request({
+    url: '/oa/manual/' + id,
+    method: 'delete'
+  })
+}
diff --git a/src/api/oa/template.js b/src/api/oa/template.js
new file mode 100644
index 0000000..de89c07
--- /dev/null
+++ b/src/api/oa/template.js
@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 鏌ヨ妯℃澘绠$悊鍒楄〃
+export function listTemplate(query) {
+  return request({
+    url: '/oa/template/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 鏌ヨ妯℃澘绠$悊璇︾粏
+export function getTemplate(id) {
+  return request({
+    url: '/oa/template/' + id,
+    method: 'get'
+  })
+}
+
+// 鏂板妯℃澘绠$悊
+export function addTemplate(data) {
+  return request({
+    url: '/oa/template',
+    method: 'post',
+    data: data
+  })
+}
+
+// 淇敼妯℃澘绠$悊
+export function updateTemplate(data) {
+  return request({
+    url: '/oa/template',
+    method: 'put',
+    data: data
+  })
+}
+
+// 鍒犻櫎妯℃澘绠$悊
+export function delTemplate(id) {
+  return request({
+    url: '/oa/template/' + id,
+    method: 'delete'
+  })
+}
diff --git a/src/views/basics/manual/index.vue b/src/views/basics/manual/index.vue
new file mode 100644
index 0000000..572870c
--- /dev/null
+++ b/src/views/basics/manual/index.vue
@@ -0,0 +1,357 @@
+<template>
+  <div class="app-container">
+    <!--    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">-->
+    <!--      <el-form-item>-->
+    <!--        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>-->
+    <!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>-->
+    <!--      </el-form-item>-->
+    <!--    </el-form>-->
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['oa:manual:add']"
+        >鏂板
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['oa:manual:edit']"
+        >淇敼
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['oa:manual:remove']"
+        >鍒犻櫎
+        </el-button>
+      </el-col>
+      <!--      <el-col :span="1.5">-->
+      <!--        <el-button-->
+      <!--          type="warning"-->
+      <!--          plain-->
+      <!--          icon="el-icon-download"-->
+      <!--          size="mini"-->
+      <!--          @click="handleExport"-->
+      <!--          v-hasPermi="['oa:manual:export']"-->
+      <!--        >瀵煎嚭</el-button>-->
+      <!--      </el-col>-->
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="manualList" :header-cell-style="{'text-align':'center'}" style="width: 100%"
+              @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="搴忓彿" align="left" width="50">
+        <template slot-scope="scope">
+          <span>{{ scope.$index + (queryParams.pageNum - 1) * queryParams.pageSize + 1 }} </span>
+        </template>
+      </el-table-column>
+      <el-table-column label="鎵嬪唽" align="left" prop="manual">
+        <template slot-scope="scope">
+          <el-link v-if="scope.row.fileUrl" type="primary" :href="scope.row.fileUrl" target="_blank">
+            {{ scope.row.manual }}
+          </el-link>
+          <el-link v-else type="primary">{{ scope.row.manual }}</el-link>
+        </template>
+      </el-table-column>
+      <el-table-column label="鍙戝竷鐗堟湰" align="center" prop="versionCode"/>
+      <el-table-column label="淇鏃ユ湡" align="center" prop="reviseTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.reviseTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <!--      <el-table-column label="闄勪欢" align="center" prop="fileUrl" />-->
+      <el-table-column label="鍙戝竷鏃ユ湡" align="center" prop="createTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['oa:manual:edit']"
+          >淇敼
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-document"
+            @click="handleUpload(scope.row)"
+          >闄勪欢
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            class="del-btn"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['oa:manual:remove']"
+          >鍒犻櫎
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 娣诲姞鎴栦慨鏀规墜鍐岀鐞嗗璇濇 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" :append-to-body="true" :close-on-click-modal="false"
+               :destroy-on-close="true">
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="鎵嬪唽" prop="manual">
+          <el-input v-model="form.manual" maxlength="64" show-word-limit placeholder="璇疯緭鍏ユ墜鍐�"/>
+        </el-form-item>
+        <el-form-item label="鍙戝竷鐗堟湰" prop="versionCode">
+          <el-input v-model="form.versionCode" maxlength="64" show-word-limit placeholder="璇疯緭鍏ュ彂甯冪増鏈�"/>
+        </el-form-item>
+        <el-form-item label="淇鏃ユ湡" prop="reviseTime">
+          <el-date-picker
+            clearable
+            style="width: 100%"
+            size="small"
+            v-model="form.reviseTime"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="閫夋嫨淇鏃ユ湡">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="闄勪欢">
+          <minio-upload v-model="form.fileUrl" :limit="1"
+                        :fileType="[`pdf`]"></minio-upload>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 闄勪欢绐椾綋 -->
+    <el-dialog :title="title" :visible.sync="uploadFlag" width="500px" :append-to-body="true"
+               :close-on-click-modal="false"
+               :destroy-on-close="true">
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="闄勪欢">
+          <minio-upload v-model="form.fileUrl" :limit="1"
+                        :fileType="[`pdf`]"></minio-upload>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {listManual, getManual, delManual, addManual, updateManual} from "@/api/oa/manual";
+import minioUpload from '@/components/FileUpload/minio'
+
+export default {
+  name: "Manual",
+  components: {minioUpload},
+  data() {
+    return {
+      // 鎸夐挳loading
+      buttonLoading: false,
+      // 閬僵灞�
+      loading: true,
+      // 閫変腑鏁扮粍
+      ids: [],
+      // 闈炲崟涓鐢�
+      single: true,
+      // 闈炲涓鐢�
+      multiple: true,
+      // 鏄剧ず鎼滅储鏉′欢
+      showSearch: true,
+      // 鎬绘潯鏁�
+      total: 0,
+      // 鎵嬪唽绠$悊琛ㄦ牸鏁版嵁
+      manualList: [],
+      // 寮瑰嚭灞傛爣棰�
+      title: "",
+      // 鏄惁鏄剧ず寮瑰嚭灞�
+      open: false,
+      // 鏌ヨ鍙傛暟
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+      // 琛ㄥ崟鍙傛暟
+      form: {},
+      // 琛ㄥ崟鏍¢獙
+      rules: {
+        id: [
+          {required: true, message: "涓嶈兘涓虹┖", trigger: "blur"}
+        ],
+        manual: [
+          {required: true, message: "鎵嬪唽涓嶈兘涓虹┖", trigger: "blur"}
+        ],
+        versionCode: [
+          {required: true, message: "鍙戝竷鐗堟湰涓嶈兘涓虹┖", trigger: "blur"}
+        ],
+        reviseTime: [
+          {required: true, message: "淇鏃ユ湡涓嶈兘涓虹┖", trigger: "blur"}
+        ],
+      },
+      uploadFlag: false
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 鏌ヨ鎵嬪唽绠$悊鍒楄〃 */
+    getList() {
+      this.loading = true;
+      listManual(this.queryParams).then(response => {
+        this.manualList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 鍙栨秷鎸夐挳
+    cancel() {
+      this.open = false;
+      this.uploadFlag = false;
+      this.reset();
+    },
+    // 琛ㄥ崟閲嶇疆
+    reset() {
+      this.form = {
+        id: undefined,
+        manual: undefined,
+        versionCode: undefined,
+        reviseTime: undefined,
+        fileUrl: undefined,
+        createBy: undefined,
+        createTime: undefined,
+        updateBy: undefined,
+        updateTime: undefined,
+        delFlag: undefined
+      };
+      this.resetForm("form");
+    },
+    /** 鎼滅储鎸夐挳鎿嶄綔 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 閲嶇疆鎸夐挳鎿嶄綔 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 澶氶�夋閫変腑鏁版嵁
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 鏂板鎸夐挳鎿嶄綔 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "娣诲姞鎵嬪唽绠$悊";
+    },
+    /** 淇敼鎸夐挳鎿嶄綔 */
+    handleUpdate(row) {
+      this.loading = true;
+      this.reset();
+      const id = row.id || this.ids
+      getManual(id).then(response => {
+        this.loading = false;
+        this.form = response.data;
+        this.open = true;
+        this.title = "淇敼鎵嬪唽绠$悊";
+      });
+    },
+    /** 鎻愪氦鎸夐挳 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          this.buttonLoading = true;
+          if (this.form.id != null) {
+            updateManual(this.form).then(response => {
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.open = false;
+              this.uploadFlag = false;
+              this.getList();
+            }).finally(() => {
+              this.buttonLoading = false;
+            });
+          } else {
+            addManual(this.form).then(response => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.open = false;
+              this.getList();
+            }).finally(() => {
+              this.buttonLoading = false;
+            });
+          }
+        }
+      });
+    },
+    /** 鍒犻櫎鎸夐挳鎿嶄綔 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('鏄惁纭鍒犻櫎锛�').then(() => {
+        this.loading = true;
+        return delManual(ids);
+      }).then(() => {
+        this.loading = false;
+        this.getList();
+        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+      }).finally(() => {
+        this.loading = false;
+      });
+    },
+    /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+    handleExport() {
+      this.download('oa/manual/export', {
+        ...this.queryParams
+      }, `manual_${new Date().getTime()}.xlsx`)
+    },
+    handleUpload(row) {
+      this.loading = true;
+      this.reset();
+      const id = row.id || this.ids
+      getManual(id).then(response => {
+        this.loading = false;
+        this.form = response.data;
+        this.uploadFlag = true;
+        this.title = "涓婁紶闄勪欢";
+      });
+    }
+  }
+};
+</script>
diff --git a/src/views/basics/template/index.vue b/src/views/basics/template/index.vue
new file mode 100644
index 0000000..6fe6f5b
--- /dev/null
+++ b/src/views/basics/template/index.vue
@@ -0,0 +1,354 @@
+<template>
+  <div class="app-container">
+    <!--    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">-->
+    <!--      <el-form-item>-->
+    <!--        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">鎼滅储</el-button>-->
+    <!--        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">閲嶇疆</el-button>-->
+    <!--      </el-form-item>-->
+    <!--    </el-form>-->
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['oa:template:add']"
+        >鏂板
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['oa:template:edit']"
+        >淇敼
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['oa:template:remove']"
+        >鍒犻櫎
+        </el-button>
+      </el-col>
+      <!--      <el-col :span="1.5">-->
+      <!--        <el-button-->
+      <!--          type="warning"-->
+      <!--          plain-->
+      <!--          icon="el-icon-download"-->
+      <!--          size="mini"-->
+      <!--          @click="handleExport"-->
+      <!--          v-hasPermi="['oa:template:export']"-->
+      <!--        >瀵煎嚭</el-button>-->
+      <!--      </el-col>-->
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="templateList" :header-cell-style="{'text-align':'center'}" style="width: 100%"
+              @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center"/>
+      <el-table-column label="搴忓彿" align="left" width="50">
+        <template slot-scope="scope">
+          <span>{{ scope.$index + (queryParams.pageNum - 1) * queryParams.pageSize + 1 }} </span>
+        </template>
+      </el-table-column>
+      <el-table-column label="妯℃澘" align="left" prop="templateName">
+        <template slot-scope="scope">
+          <el-link v-if="scope.row.fileUrl" type="primary" :href="scope.row.fileUrl" target="_blank">
+            {{ scope.row.templateName }}
+          </el-link>
+          <el-link v-else type="primary">{{ scope.row.templateName }}</el-link>
+        </template>
+      </el-table-column>
+      <el-table-column label="鍙戝竷鐗堟湰" align="center" prop="versionCode"/>
+      <el-table-column label="淇鏃ユ湡" align="center" prop="reviseTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.reviseTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="鍙戝竷鏃ユ湡" align="center" prop="createTime" width="180">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="鎿嶄綔" align="center" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['oa:template:edit']"
+          >淇敼
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-document"
+            @click="handleUpload(scope.row)"
+          >闄勪欢
+          </el-button>
+          <el-button
+            size="mini"
+            type="text"
+            class="del-btn"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['oa:template:remove']"
+          >鍒犻櫎
+          </el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 娣诲姞鎴栦慨鏀规ā鏉跨鐞嗗璇濇 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" :append-to-body="true" :close-on-click-modal="false"
+               :destroy-on-close="true">
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="妯℃澘" prop="templateName">
+          <el-input v-model="form.templateName" maxlength="64" show-word-limit placeholder="璇疯緭鍏ユā鏉�"/>
+        </el-form-item>
+        <el-form-item label="鍙戝竷鐗堟湰" prop="versionCode">
+          <el-input v-model="form.versionCode" maxlength="64" show-word-limit placeholder="璇疯緭鍏ュ彂甯冪増鏈�"/>
+        </el-form-item>
+        <el-form-item label="淇鏃ユ湡" prop="reviseTime">
+          <el-date-picker
+            style="width: 100%"
+            clearable size="small"
+            v-model="form.reviseTime"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="閫夋嫨淇鏃ユ湡">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="闄勪欢">
+          <minio-upload v-model="form.fileUrl" :limit="1" :fileType="[`pdf`, 'xls', 'xlsx', 'ppt', 'pptx']"></minio-upload>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 闄勪欢绐椾綋 -->
+    <el-dialog :title="title" :visible.sync="uploadFlag" width="500px" :append-to-body="true"
+               :close-on-click-modal="false"
+               :destroy-on-close="true">
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="闄勪欢">
+          <!--          <fileUpload v-model="form.fileUrl" :limit="1" :fileType="[`pdf`]"/>-->
+          <minio-upload v-model="form.fileUrl" :limit="1" :fileType="[`pdf`, 'xls', 'xlsx', 'ppt', 'pptx']"></minio-upload>
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button :loading="buttonLoading" type="primary" @click="submitForm">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import {listTemplate, getTemplate, delTemplate, addTemplate, updateTemplate} from "@/api/oa/template";
+import minioUpload from '@/components/FileUpload/minio'
+
+export default {
+  name: "Template",
+  components: {minioUpload},
+  data() {
+    return {
+      // 鎸夐挳loading
+      buttonLoading: false,
+      // 閬僵灞�
+      loading: true,
+      // 閫変腑鏁扮粍
+      ids: [],
+      // 闈炲崟涓鐢�
+      single: true,
+      // 闈炲涓鐢�
+      multiple: true,
+      // 鏄剧ず鎼滅储鏉′欢
+      showSearch: true,
+      // 鎬绘潯鏁�
+      total: 0,
+      // 妯℃澘绠$悊琛ㄦ牸鏁版嵁
+      templateList: [],
+      // 寮瑰嚭灞傛爣棰�
+      title: "",
+      // 鏄惁鏄剧ず寮瑰嚭灞�
+      open: false,
+      // 鏌ヨ鍙傛暟
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+      },
+      // 琛ㄥ崟鍙傛暟
+      form: {},
+      // 琛ㄥ崟鏍¢獙
+      rules: {
+        id: [
+          {required: true, message: "涓嶈兘涓虹┖", trigger: "blur"}
+        ],
+        templateName: [
+          {required: true, message: "妯℃澘涓嶈兘涓虹┖", trigger: "blur"}
+        ],
+        versionCode: [
+          {required: true, message: "鍙戝竷鐗堟湰涓嶈兘涓虹┖", trigger: "blur"}
+        ],
+        reviseTime: [
+          {required: true, message: "淇鏃ユ湡涓嶈兘涓虹┖", trigger: "blur"}
+        ],
+      },
+      uploadFlag: false
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 鏌ヨ妯℃澘绠$悊鍒楄〃 */
+    getList() {
+      this.loading = true;
+      listTemplate(this.queryParams).then(response => {
+        this.templateList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 鍙栨秷鎸夐挳
+    cancel() {
+      this.open = false;
+      this.uploadFlag = false;
+      this.reset();
+    },
+    // 琛ㄥ崟閲嶇疆
+    reset() {
+      this.form = {
+        id: undefined,
+        templateName: undefined,
+        versionCode: undefined,
+        reviseTime: undefined,
+        fileUrl: undefined,
+        createBy: undefined,
+        createTime: undefined,
+        updateBy: undefined,
+        updateTime: undefined,
+        delFlag: undefined
+      };
+      this.resetForm("form");
+    },
+    /** 鎼滅储鎸夐挳鎿嶄綔 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 閲嶇疆鎸夐挳鎿嶄綔 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 澶氶�夋閫変腑鏁版嵁
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.id)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 鏂板鎸夐挳鎿嶄綔 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "娣诲姞妯℃澘绠$悊";
+    },
+    /** 淇敼鎸夐挳鎿嶄綔 */
+    handleUpdate(row) {
+      this.loading = true;
+      this.reset();
+      const id = row.id || this.ids
+      getTemplate(id).then(response => {
+        this.loading = false;
+        this.form = response.data;
+        this.open = true;
+        this.title = "淇敼妯℃澘绠$悊";
+      });
+    },
+    /** 鎻愪氦鎸夐挳 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          this.buttonLoading = true;
+          if (this.form.id != null) {
+            updateTemplate(this.form).then(response => {
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.open = false;
+              this.uploadFlag = false;
+              this.getList();
+            }).finally(() => {
+              this.buttonLoading = false;
+            });
+          } else {
+            addTemplate(this.form).then(response => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.open = false;
+              this.getList();
+            }).finally(() => {
+              this.buttonLoading = false;
+            });
+          }
+        }
+      });
+    },
+    /** 鍒犻櫎鎸夐挳鎿嶄綔 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('鏄惁纭鍒狅紵').then(() => {
+        this.loading = true;
+        return delTemplate(ids);
+      }).then(() => {
+        this.loading = false;
+        this.getList();
+        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+      }).finally(() => {
+        this.loading = false;
+      });
+    },
+    /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+    handleExport() {
+      this.download('oa/template/export', {
+        ...this.queryParams
+      }, `template_${new Date().getTime()}.xlsx`)
+    },
+    handleUpload(row) {
+      this.loading = true;
+      this.reset();
+      const id = row.id || this.ids
+      getTemplate(id).then(response => {
+        this.loading = false;
+        this.form = response.data;
+        this.uploadFlag = true;
+        this.title = "涓婁紶闄勪欢";
+      });
+    }
+  }
+};
+</script>

--
Gitblit v1.9.1