Kaynağa Gözat

提交技术人员花名册

ljb 11 ay önce
ebeveyn
işleme
f57c28bd93

Dosya farkı çok büyük olduğundan ihmal edildi
+ 10022 - 6013
package-lock.json


+ 2 - 1
package.json

@@ -20,12 +20,13 @@
     "js-base64": "^2.5.1",
     "js-cookie": "^2.2.0",
     "js-md5": "^0.7.3",
-    "sm-crypto": "^0.3.13",
     "mockjs": "^1.0.1-beta3",
+    "moment": "^2.30.1",
     "node-gyp": "^5.0.6",
     "nprogress": "^0.2.0",
     "portfinder": "^1.0.23",
     "script-loader": "^0.7.2",
+    "sm-crypto": "^0.3.13",
     "vue": "^2.6.10",
     "vue-axios": "^2.1.2",
     "vue-i18n": "^8.7.0",

+ 42 - 0
src/api/technicianRoster.js

@@ -0,0 +1,42 @@
+import request from '@/router/axios';
+
+export const getList = (current, size, params) => {
+  return request({
+    url: '/api/kd-scientific/technician/page',
+    method: 'get',
+    params: {
+      ...params,
+      current,
+      size,
+    }
+  })
+}
+
+
+export const add = (row) => {
+  return request({
+    url: '/api/kd-scientific/technician/save',
+    method: 'post',
+    data: row
+  })
+}
+
+
+export const update = (row) => {
+  return request({
+    url: '/api/kd-scientific/technician/update',
+    method: 'post',
+    data: row
+  })
+}
+
+
+export const remove = (ids) => {
+  return request({
+    url: '/api/kd-scientific/technician/remove',
+    method: 'post',
+    params: {
+      ids,
+    }
+  })
+}

+ 118 - 0
src/components/year-month-select/index.vue

@@ -0,0 +1,118 @@
+<template>
+  <div class="year-month-select">
+   <div class="year-warp" style="width: 120px;">
+    <el-date-picker
+      v-model="year"
+      type="year"
+      :clearable="false"
+      placeholder="选择年"
+      size="small"
+    >
+    </el-date-picker>
+   </div>
+   <div class="month-wrap">
+      <div class="month-list">
+        <div
+          :class="[{active: month == item.value}, 'month-list-item']"
+          v-for="item of monthList"
+          :key="item.value"
+          @click="handleMonthClick(item)"
+        >
+          {{ item.name }}
+        </div>
+      </div>
+   </div>
+  </div>
+</template>
+
+<script>
+export default {
+  name: "YearMonthSelect",
+  props: {
+    value: {
+      type: String,
+      default: ''
+    }
+  },
+  data() {
+    return {
+      monthList: [],
+      year: '',
+      month: ''
+    }
+  },
+  watch: {
+    value: {
+      handler(newVal) {
+        if (newVal) {
+          let dateArr = newVal.split('-');
+          this.year = dateArr[0];
+          this.month = dateArr[1];
+        }
+      },
+      immediate: true
+    },
+    year(newVal) {
+      this.$emit('input', newVal+'-'+this.month);
+    }
+  },
+  created() {
+    this.initMonth();
+  },
+  methods: {
+    initMonth() {
+      let list = [];
+      for (let i=0; i<12; i++) {
+        let month = i+1;
+        list.push({
+          name: month+"月",
+          value: month > 9 ? month.toString() : '0'+month,
+        });
+      }
+      list.push({ name: "全年", value: "00" });
+      this.monthList = list;
+    },
+    handleMonthClick(data) {
+      this.month = data.value;
+      this.$emit('input', this.year+'-'+this.month);
+    }
+  }
+}
+</script>
+
+<style lang="scss">
+.year-month-select {
+  display: flex;
+  align-items: center;
+  margin: 12px 0;
+}
+.month-list {
+  display: flex;
+  margin-left: 12px;
+  &-item {
+    width: 60px;
+    height: 30px;
+    line-height: 30px;
+    text-align: center;
+    background-color: #fff;
+    color: #409EFF;
+    border-radius: 4px;
+    margin-right: 8px;
+    border: 1px solid #409EFF;
+    cursor: pointer;
+    font-size: 12px;
+    &.active {
+      background-color: #409EFF;
+      color: #fff;
+    }
+    // &.primary {
+    //   background-color: #409EFF;
+    //   border: 1px solid #409EFF;
+    // }
+    // &.success {
+    //   background-color: #67c23a;
+    //   border-color: #67c23a;
+    // }
+  }
+}
+</style>

+ 363 - 0
src/option/user/technicianRoster.js

@@ -0,0 +1,363 @@
+export default {
+  height: 'auto',
+  calcHeight: 30,
+  tip: false,
+  searchShow: true,
+  searchMenuSpan: 6,
+  border: true,
+  index: true,
+  viewBtn: true,
+  selection: true,
+  searchLabelWidth: 140,
+  labelWidth: 140,
+  menuWidth: 220,
+  dialogClickModal: false,
+  dialogType: "drawer",
+  column: [
+    {
+      label: '姓名',
+      prop: 'name',
+      type: 'input',
+      span: 12,
+      search: true,
+      width: 100,
+      align: 'center',
+      rules: [
+        {
+          required: true,
+          message: '请输入姓名',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '工号',
+      prop: 'number',
+      type: 'input',
+      span: 12,
+      width: 160,
+      align: 'center',
+      search: true,
+      rules: [
+        {
+          required: true,
+          message: '请输入工号',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '身份证号',
+      prop: 'identityCard',
+      type: 'input',
+      span: 12,
+      search: true,
+      width: 160,
+      align: 'center',
+      rules: [
+        {
+          required: true,
+          message: '请输入身份证号',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '性别',
+      prop: 'gender',
+      type: 'select',
+      dicUrl: '/api/kd-system/dict/dictionary?code=sex',
+      props: {
+        label: 'dictValue',
+        value: 'dictKey',
+      },
+      span: 12,
+      width: 50,
+      align: 'center',
+      rules: [
+        {
+          required: true,
+          message: '请选择性别',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '出生日期',
+      prop: 'birthday',
+      type: 'date',
+      span: 12,
+      width: 90,
+      align: 'center',
+      rules: [
+        {
+          required: true,
+          message: '请选择出生日期',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '民族',
+      prop: 'ethnic',
+      type: 'input',
+      span: 12,
+      width: 120,
+      align: 'center',
+      rules: [
+        {
+          required: true,
+          message: '请输入民族',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '所属二级单位',
+      prop: 'secondaryUnit',
+      type: 'input',
+      span: 12,
+      width: 140,
+      search: true,
+      rules: [
+        {
+          required: true,
+          message: '请输入所属二级单位',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '部门/科室/项目部',
+      prop: 'department',
+      type: 'input',
+      span: 12,
+      width: 140,
+      search: true,
+      rules: [
+        {
+          required: true,
+          message: '请输入部门/科室/项目部',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '岗位职务',
+      prop: 'post',
+      type: 'input',
+      span: 12,
+      width: 100,
+      align: 'center',
+      search: true,
+      rules: [
+        {
+          required: true,
+          message: '请输入岗位职务',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '岗位所在地',
+      prop: 'postLocation',
+      type: 'input',
+      span: 12,
+      width: 100,
+      search: true,
+      rules: [
+        {
+          required: true,
+          message: '请输入岗位所在地',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '用工性质',
+      prop: 'nature',
+      type: 'select',
+      span: 12,
+      width: 80,
+      align: 'center',
+      search: true,
+      dicUrl: '/api/kd-system/dict-biz/dictionary?code=yonggongxingzhi',
+      props: {
+        label: 'dictValue',
+        value: 'dictKey',
+      },
+      rules: [
+        {
+          required: true,
+          message: '请选择用工性质',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '入职时间',
+      prop: 'hireDate',
+      type: 'date',
+      span: 12,
+      width: 140,
+      align: 'center',
+      search: true,
+      rules: [
+        {
+          required: true,
+          message: '请选择入职时间',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '最高学历',
+      prop: 'education',
+      type: 'select',
+      span: 12,
+      width: 100,
+      align: 'center',
+      search: true,
+      dicUrl: '/api/kd-system/dict-biz/dictionary?code=xueli',
+      props: {
+        label: 'dictValue',
+        value: 'dictKey',
+      },
+      rules: [
+        {
+          required: true,
+          message: '请选择最高学历',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '最高学位',
+      prop: 'degree',
+      type: 'select',
+      span: 12,
+      width: 90,
+      align: 'center',
+      search: true,
+      dicUrl: '/api/kd-system/dict-biz/dictionary?code=xuewei',
+      props: {
+        label: 'dictValue',
+        value: 'dictKey',
+      },
+      rules: [
+        {
+          required: true,
+          message: '请选择最高学位',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '最高学历学校',
+      prop: 'schoolName',
+      type: 'input',
+      span: 12,
+      width: 160,
+      rules: [
+        {
+          required: true,
+          message: '请输入最高学历学校',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '最高学历专业名称',
+      prop: 'major',
+      type: 'input',
+      span: 12,
+      width: 140,
+      align: 'center',
+      rules: [
+        {
+          required: true,
+          message: '请输入最高学历专业名称',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '职称',
+      prop: 'rank',
+      type: 'select',
+      span: 12,
+      width: 120,
+      align: 'center',
+      search: true,
+      dicUrl: '/api/kd-system/dict-biz/dictionary?code=zhicheng',
+      props: {
+        label: 'dictValue',
+        value: 'dictKey',
+      },
+      rules: [
+        {
+          required: true,
+          message: '请选择职称',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '职业资格',
+      prop: 'practicingRequirement',
+      type: 'input',
+      span: 12,
+      width: 100,
+      align: 'center',
+      rules: [
+        {
+          required: true,
+          message: '请输入职业资格',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '参研情况',
+      prop: 'situation',
+      type: 'select',
+      span: 12,
+      width: 100,
+      align: 'center',
+      search: true,
+      dicUrl: '/api/kd-system/dict-biz/dictionary?code=canyanqingkuang',
+      props: {
+        label: 'dictValue',
+        value: 'dictKey',
+      },
+      rules: [
+        {
+          required: true,
+          message: '请选择参研情况',
+          trigger: 'blur',
+        },
+      ],
+    },
+    {
+      label: '人员类型',
+      prop: 'personnelType',
+      type: 'select',
+      span: 12,
+      width: 100,
+      align: 'center',
+      search: true,
+      dicUrl: '/api/kd-system/dict-biz/dictionary?code=renyuanleixing',
+      props: {
+        label: 'dictValue',
+        value: 'dictKey',
+      },
+      rules: [
+        {
+          required: true,
+          message: '请选择人员类型',
+          trigger: 'blur',
+        },
+      ],
+    },
+  ],
+};

+ 13 - 0
src/styles/element-ui.scss

@@ -69,3 +69,16 @@
 .el-divider--horizontal {
   margin: 12px 0 !important;
 }
+
+.el-table--small .el-table__cell {
+  padding: 4px 0;
+}
+
+.el-table .cell .el-tag {
+  height: 24px !important;
+  line-height: 22px !important;
+}
+
+.avue-crud__search .avue-form, .avue-form__group .el-col {
+  margin-bottom: 0;
+}

+ 359 - 0
src/views/technician-roster/index.vue

@@ -0,0 +1,359 @@
+<template>
+  <basic-container>
+    <avue-crud
+      :option="technicianRosterOption"
+      :table-loading="loading"
+      :data="dataList"
+      :page="page"
+      ref="crud"
+      v-model="form"
+      :permission="permissionList"
+      :before-open="handleBeforeOpen"
+      @row-del="rowDel"
+      @row-update="rowUpdate"
+      @row-save="rowSave"
+      @search-change="searchChange"
+      @search-reset="searchReset"
+      @selection-change="selectionChange"
+      @current-change="currentChange"
+      @size-change="sizeChange"
+      @refresh-change="refreshChange"
+      @on-load="onLoad"
+    >
+      <template slot="menuLeft">
+        <el-button
+          type="danger"
+          size="small"
+          icon="el-icon-delete"
+          plain
+          @click="handleDelete"
+        >
+          删 除
+        </el-button>
+        <el-button
+          type="success"
+          size="small"
+          plain
+          icon="el-icon-upload2"
+          @click="handleImport"
+        >
+          导入
+        </el-button>
+        <el-button
+          type="warning"
+          size="small"
+          plain
+          icon="el-icon-download"
+          @click="handleExport"
+        >
+          导出
+        </el-button>
+        <el-button
+          type="primary"
+          size="small"
+          plain
+          @click="handleReadyLastMonData"
+        >
+          读取上个月人员名单
+        </el-button>
+        <div>
+          <year-month-select v-model="yearAndMonth"></year-month-select>
+        </div>
+      </template>
+      
+    </avue-crud>
+
+    <el-dialog title="行政区划数据导入"
+      append-to-body
+      :visible.sync="excelBox"
+      width="555px">
+      <avue-form :option="excelOption" v-model="excelForm" :upload-after="uploadAfter">
+        <template slot="excelTemplate">
+          <el-button type="primary" @click="handleTemplate">
+            点击下载<i class="el-icon-download el-icon--right"></i>
+          </el-button>
+        </template>
+      </avue-form>
+    </el-dialog>
+  </basic-container>
+</template>
+
+<script>
+import { getList, add, update, remove } from "@/api/technicianRoster";
+import {exportBlob} from "@/api/common";
+import technicianRosterOption from "@/option/user/technicianRoster";
+import { mapGetters } from "vuex";
+import YearMonthSelect from "@/components/year-month-select";
+import moment from "moment";
+import NProgress from 'nprogress';
+import 'nprogress/nprogress.css';
+import {getToken} from "@/util/auth";
+import {downloadXls} from "@/util/util";
+import {dateNow} from "@/util/date";
+
+
+export default {
+  components: {
+    YearMonthSelect,
+  },
+  data() {
+    return {
+      form: {},
+      selectionList: [],
+      query: {},
+      yearAndMonth: moment(new Date()).format('YYYY-MM'),
+      loading: true,
+      page: {
+        pageSize: 10,
+        pageSizes: [10, 30, 50, 100, 200],
+        currentPage: 1,
+        total: 0,
+      },
+      dataList: [],
+      technicianRosterOption,
+
+      excelBox: false,
+      excelForm: {},
+      
+      isSelAnnual: false,
+    };
+  },
+  watch: {
+    yearAndMonth(newVal) {
+      if (newVal && newVal.split('-')[1] == '00') {
+        // 是否勾选未全年
+        this.isSelAnnual = true;
+      } else {
+        this.isSelAnnual = false;
+      }
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+    }
+  },
+  computed: {
+    // permissionList() {
+    //   return {
+    //     addBtn: this.vaildData(this.permission.dictbiz_add, false),
+    //     delBtn: this.vaildData(this.permission.dictbiz_delete, false),
+    //     editBtn: this.vaildData(this.permission.dictbiz_edit, false),
+    //     viewBtn: false,
+    //   };
+    // },
+    ids() {
+      let ids = [];
+      this.selectionList.forEach((ele) => {
+        ids.push(ele.id);
+      });
+      return ids.join(",");
+    },
+    excelOption() {
+      return {
+        submitBtn: false,
+        emptyBtn: false,
+        column: [
+           {
+            label: '上传月份',
+            props: 'yearAndMonth',
+            type: 'input',
+            span: 24,
+            value: this.yearAndMonth,
+            disabled: true,
+          },
+          {
+            label: '模板上传',
+            prop: 'excelFile',
+            type: 'upload',
+            drag: true,
+            loadText: '模板上传中,请稍等',
+            span: 24,
+            propsHttp: {
+              res: 'data'
+            },
+            data: {
+              yearAndMonth: this.yearAndMonth,
+            },
+            tip: '请上传 .xls,.xlsx 标准格式文件',
+            action: '/api/kd-scientific/technician/import?yearAndMonth='+this.yearAndMonth
+          },
+          {
+            label: '模板下载',
+            prop: 'excelTemplate',
+            formslot: true,
+            span: 24,
+          }
+        ]
+      }    
+    },
+  },
+  methods: {
+    handleBeforeOpen(done, type) {
+      if (type == 'add' && this.isSelAnnual) {
+        this.$message.warning('请选择月份');
+        return;
+      }
+      done();
+    },
+    rowSave(row, done, loading) {
+      const form = {
+        ...row,
+      };
+      add(form).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          done();
+        },
+        (error) => {
+          loading();
+        }
+      );
+    },
+    rowUpdate(row, index, done, loading) {
+      update(row).then(
+        () => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          this.onLoad(this.page);
+          done();
+        },
+        (error) => {
+          loading();
+        }
+      );
+    },
+    rowDel(row) {
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(row.id);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+        });
+    },
+    searchReset() {
+      this.query = {};
+      this.onLoad(this.page);
+    },
+    searchChange(params, done) {
+      this.query = params;
+      this.page.currentPage = 1;
+      this.onLoad(this.page, params);
+      done();
+    },
+    selectionChange(list) {
+      this.selectionList = list;
+    },
+    selectionClear() {
+      this.selectionList = [];
+      this.$refs.crud.toggleSelection();
+    },
+    handleDelete() {
+      if (this.selectionList.length === 0) {
+        this.$message.warning("请选择至少一条数据");
+        return;
+      }
+      this.$confirm("确定将选择数据删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(() => {
+          return remove(this.ids);
+        })
+        .then(() => {
+          this.onLoad(this.page);
+          this.$message({
+            type: "success",
+            message: "操作成功!",
+          });
+          this.$refs.crud.toggleSelection();
+        });
+    },
+    currentChange(currentPage) {
+      this.page.currentPage = currentPage;
+    },
+    sizeChange(pageSize) {
+      this.page.pageSize = pageSize;
+    },
+    refreshChange() {
+      this.onLoad(this.page, this.query);
+    },
+    onLoad(page, params = {}) {
+      this.loading = true;
+      let queryParams = Object.assign(params, this.query, { yearAndMonth: this.yearAndMonth });
+      if (queryParams.yearAndMonth && queryParams.yearAndMonth.split('-')[1] == '00') {
+        queryParams.yearAndMonth = queryParams.yearAndMonth.split('-')[0];
+      }
+      getList(
+        page.currentPage,
+        page.pageSize,
+        queryParams
+      ).then((res) => {
+        if (!res.data) {
+          this.loading = false;
+          return;
+        }
+        const data = res.data.data;
+        this.page.total = data.total;
+        this.dataList = data.records.map(item => {
+          if (item.gender) {
+            item.gender = String(item.gender);
+          }
+          return item;
+        });
+        this.loading = false;
+        this.selectionClear();
+      });
+    },
+    handleImport() {
+      if (this.isSelAnnual) {
+        this.$message.warning("请选择月份");
+        return;
+      }
+      this.excelBox = true;
+    },
+    uploadAfter(res, done, loading, column) {
+      this.excelBox = false;
+      this.page.currentPage = 1;
+      this.onLoad(this.page);
+      done();
+    },
+    handleExport() {
+      this.$confirm("是否导出当前月份技术人员花名册?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        NProgress.start();
+        exportBlob(`/api/kd-scientific/technician/export?${this.website.tokenHeader}=${getToken()}`).then(res => {
+          downloadXls(res.data, `技术人员花名册${dateNow()}.xlsx`);
+          NProgress.done();
+        })
+      });
+    },
+    handleTemplate() {
+      this.$message.warning("暂未配置模板");
+      // exportBlob(`/api/kd-system/region/export-template?${this.website.tokenHeader}=${getToken()}`).then(res => {
+      //   downloadXls(res.data, "技术人员花名册.xlsx");
+      // });
+    },
+    handleReadyLastMonData() {
+      this.$message.warning("功能建设中...");
+    },
+  },
+};
+</script>

+ 2 - 2
vue.config.js

@@ -26,9 +26,9 @@ module.exports = {
     proxy: {
       '/api': {
         //本地服务接口地址
-        target: 'http://localhost',
+        target: 'http://rfa45785.natappfree.cc',
         //远程演示服务地址,可用于直接启动项目
-        //target: 'https://saber.bladex.cn/api',
+        // target: 'https://saber.bladex.cn/api',
         ws: true,
         pathRewrite: {
           '^/api': '/'