From 0531f1b6433de86888c84dce794b6943a46c2aef Mon Sep 17 00:00:00 2001
From: xiangpei <xiangpei@timesnew.cn>
Date: 星期一, 04 三月 2024 18:02:25 +0800
Subject: [PATCH] 运维单位、人员

---
 src/views/system/people/index.vue |  299 ++++++++++++++++++++++++
 src/api/system/people.js          |   44 +++
 src/api/system/unit.js            |   44 +++
 src/views/system/unit/index.vue   |  317 ++++++++++++++++++++++++++
 4 files changed, 704 insertions(+), 0 deletions(-)

diff --git a/src/api/system/people.js b/src/api/system/people.js
new file mode 100644
index 0000000..92d797d
--- /dev/null
+++ b/src/api/system/people.js
@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 鏌ヨ杩愮淮浜哄憳鍒楄〃
+export function listPeople(query) {
+  return request({
+    url: '/system/yw-people/page',
+    method: 'get',
+    params: query
+  })
+}
+
+// 鏌ヨ杩愮淮浜哄憳璇︾粏
+export function getPeople(id) {
+  return request({
+    url: '/system/yw-people/' + id,
+    method: 'get'
+  })
+}
+
+// 鏂板杩愮淮浜哄憳
+export function addPeople(data) {
+  return request({
+    url: '/system/yw-people',
+    method: 'post',
+    data: data
+  })
+}
+
+// 淇敼杩愮淮浜哄憳
+export function updatePeople(data) {
+  return request({
+    url: '/system/yw-people',
+    method: 'put',
+    data: data
+  })
+}
+
+// 鍒犻櫎杩愮淮浜哄憳
+export function delPeople(id) {
+  return request({
+    url: '/system/yw-people/' + id,
+    method: 'delete'
+  })
+}
diff --git a/src/api/system/unit.js b/src/api/system/unit.js
new file mode 100644
index 0000000..017bd8e
--- /dev/null
+++ b/src/api/system/unit.js
@@ -0,0 +1,44 @@
+import request from '@/utils/request'
+
+// 鏌ヨ杩愮淮鍗曚綅鍒楄〃
+export function listUnit(query) {
+  return request({
+    url: '/system/yw-unit/page',
+    method: 'get',
+    params: query
+  })
+}
+
+// 鏌ヨ杩愮淮鍗曚綅璇︾粏
+export function getUnit(id) {
+  return request({
+    url: '/system/yw-unit/' + id,
+    method: 'get'
+  })
+}
+
+// 鏂板杩愮淮鍗曚綅
+export function addUnit(data) {
+  return request({
+    url: '/system/yw-unit',
+    method: 'post',
+    data: data
+  })
+}
+
+// 淇敼杩愮淮鍗曚綅
+export function updateUnit(data) {
+  return request({
+    url: '/system/yw-unit',
+    method: 'put',
+    data: data
+  })
+}
+
+// 鍒犻櫎杩愮淮鍗曚綅
+export function delUnit(id) {
+  return request({
+    url: '/system/yw-unit/' + id,
+    method: 'delete'
+  })
+}
diff --git a/src/views/system/people/index.vue b/src/views/system/people/index.vue
new file mode 100644
index 0000000..e8145fa
--- /dev/null
+++ b/src/views/system/people/index.vue
@@ -0,0 +1,299 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="杩愮淮浜哄憳缂栧彿" prop="ywPersonCode">
+        <el-input
+          v-model="queryParams.ywPersonCode"
+          placeholder="璇疯緭鍏ヨ繍缁翠汉鍛樼紪鍙�"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="杩愮淮浜哄憳濮撳悕" prop="ywPersonName">
+        <el-input
+          v-model="queryParams.ywPersonName"
+          placeholder="璇疯緭鍏ヨ繍缁翠汉鍛樺鍚�"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="鎵�灞炶繍缁村崟浣�" prop="belongUnit">
+        <el-input
+          v-model="queryParams.belongUnit"
+          placeholder="璇疯緭鍏ユ墍灞炶繍缁村崟浣�"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <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="['system:people: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="['system:people: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="['system:people: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="['system:people:export']"
+        >瀵煎嚭</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="peopleList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="涓婚敭" align="center" prop="id" />
+      <el-table-column label="杩愮淮浜哄憳缂栧彿" align="center" prop="ywPersonCode" />
+      <el-table-column label="杩愮淮浜哄憳濮撳悕" align="center" prop="ywPersonName" />
+      <el-table-column label="杩愮淮浜哄憳璐﹀彿" align="center" prop="ywPersonAccount" />
+      <el-table-column label="鎵�灞炶繍缁村崟浣�" align="center" prop="belongUnit" />
+      <el-table-column label="鑱旂郴鐢佃瘽" align="center" prop="phone" />
+      <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="['system:people:edit']"
+          >淇敼</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['system:people: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>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="杩愮淮浜哄憳缂栧彿" prop="ywPersonCode">
+          <el-input v-model="form.ywPersonCode" placeholder="璇疯緭鍏ヨ繍缁翠汉鍛樼紪鍙�" />
+        </el-form-item>
+        <el-form-item label="杩愮淮浜哄憳濮撳悕" prop="ywPersonName">
+          <el-input v-model="form.ywPersonName" placeholder="璇疯緭鍏ヨ繍缁翠汉鍛樺鍚�" />
+        </el-form-item>
+        <el-form-item label="杩愮淮浜哄憳璐﹀彿" prop="ywPersonAccount">
+          <el-input v-model="form.ywPersonAccount" placeholder="璇疯緭鍏ヨ繍缁翠汉鍛樿处鍙�" />
+        </el-form-item>
+        <el-form-item label="鎵�灞炶繍缁村崟浣�" prop="belongUnit">
+          <el-input v-model="form.belongUnit" placeholder="璇疯緭鍏ユ墍灞炶繍缁村崟浣�" />
+        </el-form-item>
+        <el-form-item label="鑱旂郴鐢佃瘽" prop="phone">
+          <el-input v-model="form.phone" placeholder="璇疯緭鍏ヨ仈绯荤數璇�" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listPeople, getPeople, delPeople, addPeople, updatePeople } from "@/api/system/people";
+
+export default {
+  name: "People",
+  data() {
+    return {
+      // 閬僵灞�
+      loading: true,
+      // 閫変腑鏁扮粍
+      ids: [],
+      // 闈炲崟涓鐢�
+      single: true,
+      // 闈炲涓鐢�
+      multiple: true,
+      // 鏄剧ず鎼滅储鏉′欢
+      showSearch: true,
+      // 鎬绘潯鏁�
+      total: 0,
+      // 杩愮淮浜哄憳琛ㄦ牸鏁版嵁
+      peopleList: [],
+      // 寮瑰嚭灞傛爣棰�
+      title: "",
+      // 鏄惁鏄剧ず寮瑰嚭灞�
+      open: false,
+      // 鏌ヨ鍙傛暟
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        ywPersonCode: null,
+        ywPersonName: null,
+        belongUnit: null,
+      },
+      // 琛ㄥ崟鍙傛暟
+      form: {},
+      // 琛ㄥ崟鏍¢獙
+      rules: {
+        ywPersonCode: [
+          { required: true, message: "杩愮淮浜哄憳缂栧彿涓嶈兘涓虹┖", trigger: "blur" }
+        ],
+        ywPersonName: [
+          { required: true, message: "杩愮淮浜哄憳濮撳悕涓嶈兘涓虹┖", trigger: "blur" }
+        ],
+        ywPersonAccount: [
+          { required: true, message: "杩愮淮浜哄憳璐﹀彿涓嶈兘涓虹┖", trigger: "blur" }
+        ],
+        belongUnit: [
+          { required: true, message: "鎵�灞炶繍缁村崟浣嶄笉鑳戒负绌�", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 鏌ヨ杩愮淮浜哄憳鍒楄〃 */
+    getList() {
+      this.loading = true;
+      listPeople(this.queryParams).then(response => {
+        this.peopleList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 鍙栨秷鎸夐挳
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 琛ㄥ崟閲嶇疆
+    reset() {
+      this.form = {
+        id: null,
+        ywPersonCode: null,
+        ywPersonName: null,
+        ywPersonAccount: null,
+        belongUnit: null,
+        addWay: null,
+        phone: null,
+        createTime: null,
+        updateTime: null,
+        deleted: null
+      };
+      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.reset();
+      const id = row.id || this.ids
+      getPeople(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "淇敼杩愮淮浜哄憳";
+      });
+    },
+    /** 鎻愪氦鎸夐挳 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updatePeople(this.form).then(response => {
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addPeople(this.form).then(response => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 鍒犻櫎鎸夐挳鎿嶄綔 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('鏄惁纭鍒犻櫎杩愮淮浜哄憳缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() {
+        return delPeople(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+      }).catch(() => {});
+    },
+    /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+    handleExport() {
+      this.download('system/people/export', {
+        ...this.queryParams
+      }, `people_${new Date().getTime()}.xlsx`)
+    }
+  }
+};
+</script>
diff --git a/src/views/system/unit/index.vue b/src/views/system/unit/index.vue
new file mode 100644
index 0000000..cc6f2c8
--- /dev/null
+++ b/src/views/system/unit/index.vue
@@ -0,0 +1,317 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="鍗曚綅缂栫爜" prop="unitCode">
+        <el-input
+          v-model="queryParams.unitCode"
+          placeholder="璇疯緭鍏ュ崟浣嶇紪鐮�"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="鍗曚綅鍚嶇О" prop="unitName">
+        <el-input
+          v-model="queryParams.unitName"
+          placeholder="璇疯緭鍏ュ崟浣嶅悕绉�"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item label="鍒涘缓鏃堕棿">
+        <el-date-picker
+          v-model="daterangeCreateTime"
+          style="width: 240px"
+          value-format="yyyy-MM-dd"
+          type="daterange"
+          range-separator="-"
+          start-placeholder="寮�濮嬫棩鏈�"
+          end-placeholder="缁撴潫鏃ユ湡"
+        ></el-date-picker>
+      </el-form-item>
+      <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="['system:unit: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="['system:unit: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="['system:unit: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="['system:unit:export']"
+        >瀵煎嚭</el-button>
+      </el-col>
+      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="unitList" @selection-change="handleSelectionChange">
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="涓婚敭" align="center" prop="id" />
+      <el-table-column label="鍗曚綅缂栫爜" align="center" prop="unitCode" />
+      <el-table-column label="鍗曚綅鍚嶇О" align="center" prop="unitName" />
+      <el-table-column label="鍗曚綅鑱旂郴浜�" align="center" prop="unitContact" />
+      <el-table-column label="鍗曚綅鑱旂郴浜虹數璇�" align="center" prop="unitContactPhone" />
+      <el-table-column label="鍗曚綅绠$悊鍛樿处鍙�" align="center" prop="unitAdminAccount" />
+      <el-table-column label="澶囨敞" align="center" prop="remark" />
+      <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="['system:unit:edit']"
+          >淇敼</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['system:unit: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>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="鍗曚綅缂栫爜" prop="unitCode">
+          <el-input v-model="form.unitCode" placeholder="璇疯緭鍏ュ崟浣嶇紪鐮�" />
+        </el-form-item>
+        <el-form-item label="鍗曚綅鍚嶇О" prop="unitName">
+          <el-input v-model="form.unitName" placeholder="璇疯緭鍏ュ崟浣嶅悕绉�" />
+        </el-form-item>
+        <el-form-item label="鍗曚綅鑱旂郴浜�" prop="unitContact">
+          <el-input v-model="form.unitContact" placeholder="璇疯緭鍏ュ崟浣嶈仈绯讳汉" />
+        </el-form-item>
+        <el-form-item label="鍗曚綅鑱旂郴浜虹數璇�" prop="unitContactPhone">
+          <el-input v-model="form.unitContactPhone" placeholder="璇疯緭鍏ュ崟浣嶈仈绯讳汉鐢佃瘽" />
+        </el-form-item>
+        <el-form-item label="鍗曚綅绠$悊鍛樿处鍙�" prop="unitAdminAccount">
+          <el-input v-model="form.unitAdminAccount" placeholder="璇疯緭鍏ュ崟浣嶇鐞嗗憳璐﹀彿" />
+        </el-form-item>
+        <el-form-item label="澶囨敞" prop="remark">
+          <el-input v-model="form.remark" placeholder="璇疯緭鍏ュ娉�" />
+        </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">纭� 瀹�</el-button>
+        <el-button @click="cancel">鍙� 娑�</el-button>
+      </div>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listUnit, getUnit, delUnit, addUnit, updateUnit } from "@/api/system/unit";
+
+export default {
+  name: "Unit",
+  data() {
+    return {
+      // 閬僵灞�
+      loading: true,
+      // 閫変腑鏁扮粍
+      ids: [],
+      // 闈炲崟涓鐢�
+      single: true,
+      // 闈炲涓鐢�
+      multiple: true,
+      // 鏄剧ず鎼滅储鏉′欢
+      showSearch: true,
+      // 鎬绘潯鏁�
+      total: 0,
+      // 杩愮淮鍗曚綅琛ㄦ牸鏁版嵁
+      unitList: [],
+      // 寮瑰嚭灞傛爣棰�
+      title: "",
+      // 鏄惁鏄剧ず寮瑰嚭灞�
+      open: false,
+      // 澶囨敞鏃堕棿鑼冨洿
+      daterangeCreateTime: [],
+      // 鏌ヨ鍙傛暟
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        unitCode: null,
+        unitName: null,
+        createTime: null,
+      },
+      // 琛ㄥ崟鍙傛暟
+      form: {},
+      // 琛ㄥ崟鏍¢獙
+      rules: {
+        unitCode: [
+          { required: true, message: "鍗曚綅缂栫爜涓嶈兘涓虹┖", trigger: "blur" }
+        ],
+        unitName: [
+          { required: true, message: "鍗曚綅鍚嶇О涓嶈兘涓虹┖", trigger: "blur" }
+        ],
+        unitContact: [
+          { required: true, message: "鍗曚綅鑱旂郴浜轰笉鑳戒负绌�", trigger: "blur" }
+        ],
+        unitContactPhone: [
+          { required: true, message: "鍗曚綅鑱旂郴浜虹數璇濅笉鑳戒负绌�", trigger: "blur" }
+        ],
+        unitAdminAccount: [
+          { required: true, message: "鍗曚綅绠$悊鍛樿处鍙蜂笉鑳戒负绌�", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 鏌ヨ杩愮淮鍗曚綅鍒楄〃 */
+    getList() {
+      this.loading = true;
+      this.queryParams.params = {};
+      if (null != this.daterangeCreateTime && '' != this.daterangeCreateTime) {
+        this.queryParams.params["beginCreateTime"] = this.daterangeCreateTime[0];
+        this.queryParams.params["endCreateTime"] = this.daterangeCreateTime[1];
+      }
+      listUnit(this.queryParams).then(response => {
+        this.unitList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 鍙栨秷鎸夐挳
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 琛ㄥ崟閲嶇疆
+    reset() {
+      this.form = {
+        id: null,
+        unitCode: null,
+        unitName: null,
+        unitContact: null,
+        unitContactPhone: null,
+        unitAdminAccount: null,
+        remark: null,
+        createTime: null,
+        updateTime: null,
+        deleted: null
+      };
+      this.resetForm("form");
+    },
+    /** 鎼滅储鎸夐挳鎿嶄綔 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 閲嶇疆鎸夐挳鎿嶄綔 */
+    resetQuery() {
+      this.daterangeCreateTime = [];
+      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.reset();
+      const id = row.id || this.ids
+      getUnit(id).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "淇敼杩愮淮鍗曚綅";
+      });
+    },
+    /** 鎻愪氦鎸夐挳 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.id != null) {
+            updateUnit(this.form).then(response => {
+              this.$modal.msgSuccess("淇敼鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addUnit(this.form).then(response => {
+              this.$modal.msgSuccess("鏂板鎴愬姛");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 鍒犻櫎鎸夐挳鎿嶄綔 */
+    handleDelete(row) {
+      const ids = row.id || this.ids;
+      this.$modal.confirm('鏄惁纭鍒犻櫎杩愮淮鍗曚綅缂栧彿涓�"' + ids + '"鐨勬暟鎹」锛�').then(function() {
+        return delUnit(ids);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("鍒犻櫎鎴愬姛");
+      }).catch(() => {});
+    },
+    /** 瀵煎嚭鎸夐挳鎿嶄綔 */
+    handleExport() {
+      this.download('system/unit/export', {
+        ...this.queryParams
+      }, `unit_${new Date().getTime()}.xlsx`)
+    }
+  }
+};
+</script>

--
Gitblit v1.8.0