Bladeren bron

人员选择器加上工号和身份证号

ljb 9 maanden geleden
bovenliggende
commit
73aa3c5399

+ 97 - 0
src/components/person-select/index.vue

@@ -0,0 +1,97 @@
+<template>
+  <el-select
+    v-model="currPerson"
+    filterable
+    :placeholder="placeholder"
+    :disabled="disabled"
+    :multiple="multiple"
+    style="width: 100%;"
+    @change="handleChange"
+  >
+    <el-option
+      v-for="item in personList"
+      :key="item.value"
+      :label="item.label"
+      :value="item.value">
+    </el-option>
+  </el-select>
+</template>
+
+<script>
+import { getList } from "@/api/basicResource/technicianRoster";
+
+
+export default {
+  name: 'ProjectSelect',
+  props: {
+    placeholder: {
+      type: String,
+      default: '请选择 姓名'
+    },
+    value: [String, Number],
+    valueKey: {
+      type: [Number, String],
+      default: 'unicode'
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    },
+    // 是否多选
+    multiple: {
+      type: Boolean,
+      default: false
+    },
+    yearAndMonth: {
+      type: [String, Number]
+    }
+  },
+  data() {
+    return {
+      currPerson: '',
+      personList: []
+    }
+  },
+  watch: {
+    value(newVal) {
+      this.currPerson = newVal;
+    },
+    yearAndMonth: {
+      handler(newVal) {
+        if (!newVal) {
+          this.currPerson = '';
+          this.$emit('input', '');
+          this.personList = [];
+          return;
+        }
+        this.getPersonList();
+      },
+      immediate: true,
+      deep: true
+    }
+  },
+  methods: {
+    handleChange(e) {
+      this.$emit('input', e);
+    },
+    getPersonList() {
+      if (!this.yearAndMonth) {
+        return;
+      }
+      this.personList = [];
+      getList(1, 99999, { yearAndMonth: this.yearAndMonth }).then(({ data }) => {
+        if (data.success) {
+          this.currPerson = this.value;
+          this.personList = data.data.records.map(item => {
+            let nameArr = [item.name, item.number || '-', item.idCard || '-'];
+            return {
+              label: nameArr.join(' \\ '),
+              value: item[this.valueKey]
+            }
+          });
+        }
+      })
+    },
+  }
+}
+</script>

+ 98 - 0
src/components/project-person-select/index.vue

@@ -0,0 +1,98 @@
+<template>
+  <el-select
+    v-model="currPerson"
+    filterable
+    :placeholder="placeholder"
+    :disabled="disabled"
+    :multiple="multiple"
+    style="width: 100%;"
+    @change="handleChange"
+  >
+    <el-option
+      v-for="item in personList"
+      :key="item.value"
+      :label="item.label"
+      :value="item.value">
+    </el-option>
+  </el-select>
+</template>
+
+<script>
+import { getListByProDate } from "@/api/basicResource/technicianRoster";
+
+export default {
+  name: 'ProjectSelect',
+  props: {
+    placeholder: {
+      type: String,
+      default: '请选择 姓名'
+    },
+    value: [String, Number],
+    valueKey: {
+      type: [Number, String],
+      default: 'unicode'
+    },
+    disabled: {
+      type: Boolean,
+      default: false
+    },
+    // 是否多选
+    multiple: {
+      type: Boolean,
+      default: false
+    },
+    startDate: {
+      type: [String, Number]
+    }
+  },
+  data() {
+    return {
+      currPerson: '',
+      personList: []
+    }
+  },
+  watch: {
+    value(newVal) {
+      this.currPerson = newVal;
+    },
+    startDate: {
+      handler(newVal) {
+        if (!newVal) {
+          this.currPerson = '';
+          this.$emit('input', '');
+          this.personList = [];
+          return;
+        }
+        this.getPersonList();
+      },
+      immediate: true,
+      deep: true
+    }
+  },
+  methods: {
+    handleChange(e) {
+      this.$emit('input', e);
+    },
+    getPersonList() {
+      if (!this.startDate) {
+        return;
+      }
+      this.personList = [];
+      getListByProDate(1, 99999, this.startDate, this.startDate).then(({ data }) => {
+        if (data.success) {
+          this.currPerson = this.value;
+          console.log(this.currPerson)
+          this.personList = data.data.records.map(item => {
+            let nameArr = [item.name, item.number || '-', item.idCard || '-'];
+            return {
+              label: nameArr.join(' \\ '),
+              value: item[this.valueKey]
+            }
+          });
+          console.log(this.personList)
+        }
+      })
+    },
+  }
+}
+</script>

+ 13 - 17
src/option/projectManage/personCost.js

@@ -21,27 +21,23 @@ export default {
       prop: 'technicianId',
       type: 'select',
       span: 24,
-      width: 100,
       align: 'center',
       showOverflowTooltip: true,
-      dicUrl: '',
-      dicFormatter:(res)=>{
-        return res.data.records
-      },
-      dicQuery: {
-        current: 1,
-        size: 99999,
-      },
-      props: {
-        label: 'name',
-        value: 'id',
-      },
-      dicFlag: true,
+      hide: true,
       rules: [{
         required: true,
-        message: '请选择姓名',
-        trigger: 'change',
-      }],
+        message: '请输入',
+        trigger: 'blur',
+      }]
+    },
+    {
+      label: '姓名',
+      prop: 'name',
+      span: 24,
+      width: 160,
+      align: 'center',
+      display: false,
+      showOverflowTooltip: true,
     },
     {
       label: '工号',

+ 1 - 1
src/option/projectManage/wxzctxCost.js

@@ -24,7 +24,7 @@ export default {
       span: 24,
       dicUrl: '/api/kd-scientific/asset/simple/list',
       dicFormatter:(res)=>{
-        return res.data.filter(item => "软件,专利权,非专利技术,其他".indexOf(item.zclb) > -1)
+        return res.data.filter(item => "软件,专利权,非专利技术,其他".indexOf(item.zclb) > -1)
       },
       props: {
         label: 'zcmc',

+ 24 - 31
src/views/project-manage/components/apply-form.vue

@@ -74,13 +74,7 @@
             <span style="color: red; padding-right: 3px; font-size: 16px;">*</span>项目负责人
           </td>
           <td class="doc-input">
-            <avue-select
-              v-model="formData.xmfzr"
-              placeholder="请选择"
-              :dic="fzrList"
-              style="width: 100%"
-              :disabled="isEdit"
-            ></avue-select>
+            <person-select v-model="formData.xmfzr" :yearAndMonth="xmStartDateYearAndMonth" valueKey="id" :disabled="isEdit" style="width: 100%" />
           </td>
           <td class="doc-label">
             <span style="color: red; padding-right: 3px; font-size: 16px;">*</span>研究类型
@@ -193,6 +187,7 @@
 
 <script>
 import secondUnitCascader from "@/components/second-unit-cascader";
+import personSelect from "@/components/person-select";
 import { getDictionary } from "@/api/system/dictbiz";
 import { getList as getTechnicanRosterList } from "@/api/basicResource/technicianRoster";
 import { add, update, getDetail } from "@/api/projectManage/projectList";
@@ -204,6 +199,7 @@ import { getDetail as getTenantDetail } from '@/api/system/tenant';
 
 export default {
   components: {
+    personSelect,
     secondUnitCascader
   },
   props: {
@@ -243,13 +239,9 @@ export default {
   watch: {
     'formData.xmkssj'(newVal) {
       this.yearList = this.getDateRangeYear(newVal, this.formData.xmjssj);
-      if (!newVal) {
-        return;
-      }
-      let cMonth = moment(newVal).format('yyyyMM');
+      let cMonth = newVal ? moment(newVal).format('yyyyMM') : '';
       if (cMonth != this.xmStartDateYearAndMonth) {
         this.xmStartDateYearAndMonth = cMonth;
-        this.getTechnicanRosterListFunc(cMonth)
       }
     },
     'formData.xmjssj'(newVal) {
@@ -355,11 +347,12 @@ export default {
       return tit;
     },
     getXmfzrName() {
-      if (this.formData.xmfzr) {
-        let fzrObj = this.fzrList.find(item => item.value == this.formData.xmfzr);
-        return fzrObj ? fzrObj.label : "";
-      }
-      return;
+      // if (this.formData.xmfzr) {
+      //   let fzrObj = this.fzrList.find(item => item.value == this.formData.xmfzr);
+      //   return fzrObj ? fzrObj.label : "";
+      // }
+
+      return this.formData.xmfzrxm;
     },
     getXmDateRange() {
       if (this.formData.xmkssj && this.formData.xmjssj) {
@@ -402,7 +395,7 @@ export default {
         this.loading = false;
         if (data.code == 200) {
           let beanData = { ...data.data };
-          beanData.xmfzr = String(beanData.xmfzr || '');
+          beanData.xmfzr = beanData.xmfzr.toString();
           beanData.yqcgxs = beanData.yqcgxs.split(",");
           beanData.xmjsjjmb = beanData.xmjsjjmb.split(",");
           beanData.lxpw = beanData.lxpw ? JSON.parse(beanData.lxpw) : [];
@@ -464,19 +457,19 @@ export default {
     /**
      * 获取人员花名册
      */
-    getTechnicanRosterListFunc(yearAndMonth) {
-      if (!yearAndMonth) {
-        this.fzrList = [];
-        return;
-      }
-      getTechnicanRosterList(1, 99999, { yearAndMonth }).then(res => {
-        if (res.data.success) {
-          this.fzrList = res.data.data.records.map(item => {
-            return { label: item.name, value: item.id };
-          });
-        }
-      });
-    },
+    // getTechnicanRosterListFunc(yearAndMonth) {
+    //   if (!yearAndMonth) {
+    //     this.fzrList = [];
+    //     return;
+    //   }
+    //   getTechnicanRosterList(1, 99999, { yearAndMonth }).then(res => {
+    //     if (res.data.success) {
+    //       this.fzrList = res.data.data.records.map(item => {
+    //         return { label: item.name, value: item.id };
+    //       });
+    //     }
+    //   });
+    // },
     validForm() {
       let errorText = '';
       if (!this.formData.xmmc) {

+ 35 - 17
src/views/project-manage/components/change-form.vue

@@ -61,14 +61,18 @@
               @change="handleEndDateChange"
             ></el-date-picker>
             <!-- 项目负责人 -->
-            <avue-select
-              v-if="formData.zdmc === 'xmfzr'"
-              v-model="formData.bghdz"
-              placeholder="请选择"
-              :dic="fzrList"
-              style="width: 100%"
-              :disabled="disabled"
-            ></avue-select>
+            <template v-if="formData.zdmc === 'xmfzr'">
+              <person-select
+                v-if="!disabled"
+                v-model="formData.bghdz"
+                :yearAndMonth="projectStartMonth"
+                valueKey="id"
+                :disabled="disabled"
+                style="width: 100%"
+              />
+              <span v-else>{{ formData.bghdz }}</span>
+            </template>
+            
             <!-- 项目状态 -->
             <avue-select
               v-if="formData.zdmc === 'status'"
@@ -79,13 +83,17 @@
               :disabled="disabled"
             ></avue-select>
             <!-- 所属二级单位 -->
-            <second-unit-cascader
-              v-if="formData.zdmc === 'xmsqdwid'"
-              v-model="formData.bghdz"
-              :disabled="disabled"
-              :yearAndMonth="currProjectYear"
-              style="width: 100%;"
-            />
+             <template v-if="formData.zdmc === 'xmsqdwid'">
+              <second-unit-cascader
+                v-if="!disabled"
+                v-model="formData.bghdz"
+                :disabled="disabled"
+                :yearAndMonth="currProjectYear"
+                style="width: 100%;"
+              />
+              <span v-else>{{ formData.bghdz }}</span>
+            </template>
+            
             <!-- 项目预算明细 -->
             <div v-if="formData.zdmc === 'xmyszemx'" class="year-list">
               <div style="height: 31px; line-height: 31px; border-bottom: 1px solid #000;">总计:{{ newXmysTotal }}万元</div>
@@ -188,6 +196,7 @@ import { save } from "@/api/projectManage/change";
 import moment from "moment";
 import projectSelect from "@/components/project-select";
 import secondUnitCascader from "@/components/second-unit-cascader";
+import personSelect from "@/components/person-select";
 import Decimal from "decimal.js";
 
 export default {
@@ -201,7 +210,8 @@ export default {
   },
   components: {
     projectSelect,
-    secondUnitCascader
+    secondUnitCascader,
+    personSelect
   },
   data() {
     return {
@@ -224,7 +234,10 @@ export default {
       // 变更前预算明细
       oldXmyszemxList: [],
       // 变更后预算明细
-      newXmyszemxList: []
+      newXmyszemxList: [],
+
+      // 项目开始月份
+      projectStartMonth: ""
     };
   },
   watch: {
@@ -245,6 +258,10 @@ export default {
     },
     // 获取变更前的值
     getChangeBeforeVal() {
+      if (this.disabled) {
+        return this.formData.bgqdz;
+      }
+      
       if (this.formData.zdmc === 'xmfzr') {
         return this.selProject.xmfzrxm;
       } else if (this.formData.zdmc === 'xmsqdwid') {
@@ -314,6 +331,7 @@ export default {
     handleProjectChange(data) {
       this.selProject = data;
 
+      this.projectStartMonth = moment(data.xmkssj).format("yyyyMM");
       if (!this.disabled) {
         this.oldXmyszemxList = JSON.parse(data.xmyszemx);
         this.newXmyszemxList = JSON.parse(data.xmyszemx);

+ 8 - 11
src/views/project-manage/components/person-cost.vue

@@ -51,8 +51,8 @@
         <print-table-btn @click="printTable" />
       </template>
 
-      <template slot="technicianId" slot-scope="scope">
-        <span>{{ scope.row.name }}</span>
+      <template slot="technicianIdForm">
+        <project-person-select v-model="form.technicianId" valueKey="id" :startDate="projectStartMonth" />
       </template>
       
     </avue-crud>
@@ -74,6 +74,7 @@
 import {exportBloByPost} from "@/api/common";
 import UploadExcelDialog from "@/components/upload-excel-dialog";
 import projectSelect from "@/components/project-select";
+import projectPersonSelect from "@/components/project-person-select";
 import {getToken} from "@/util/auth";
 import {downloadXls} from "@/util/util";
 import Decimal from "decimal.js";
@@ -86,6 +87,7 @@ export default window.$crudCommon({
   },
   components: {
     projectSelect,
+    projectPersonSelect,
     UploadExcelDialog,
   },
   data() {
@@ -98,6 +100,7 @@ export default window.$crudCommon({
       wideTableColumns: [],
       printTitle: "",
 
+      projectStartMonth: ""
     };
   },
   created() {
@@ -116,15 +119,6 @@ export default window.$crudCommon({
         this.$message.warning("请选择项目!");
         return;
       }
-      this.option.column.forEach(item => {
-        if (item.prop == "technicianId") {
-          let startDate = this.selProject.xmkssj || new Date();
-          let endDate = this.selProject.xmkssj || new Date();
-          item.dicUrl = '/api/kd-scientific/technician/page/date-interval';
-          item.dicQuery.startDate = moment(startDate).format("yyyyMM");
-          item.dicQuery.endDate = moment(endDate).format("yyyyMM");
-        }
-      });
 
       done();
     },
@@ -139,6 +133,8 @@ export default window.$crudCommon({
     },
     handleProjectChange(data) {
       this.selProject = data;
+
+      this.projectStartMonth = moment(data.xmkssj).format("yyyyMM");
     },
     handleImport() {
       if (!this.params.xmId) {
@@ -186,6 +182,7 @@ export default window.$crudCommon({
       item.isWp = item.nature === '在职' ? '是' : '否';
       return item;
     });
+
     return data;
   },
 });

+ 9 - 19
src/views/tech-person/month-cjcyry.vue

@@ -39,18 +39,12 @@
         </div>
       </template>
 
-      <!-- <template slot="xmmcSearch">
-        <project-select ref="projectSelectRef" placeholder="请选择项目名称" multiple v-model="params.xmId"></project-select>
-      </template> -->
-
       <template slot="xmIdForm">
-        <project-select placeholder="请选择项目名称" v-model="form.xmId" :params="{ yearAndMonth: params.yearAndMonth }" @change="handleProjectChange"></project-select>
+        <project-select placeholder="请选择项目名称" v-model="form.xmId" :params="{ yearAndMonth: params.yearAndMonth }" :noDetail="true" @change="handleProjectChange"></project-select>
       </template>
 
       <template slot="unicodeForm">
-        <el-select placeholder="请选择 参研人员姓名" v-model="form.unicode" :disabled="!form.xmId">
-          <el-option v-for="item of technicianList" :key="item.unicode" :value="item.unicode" :label="item.name"></el-option>
-        </el-select>
+        <project-person-select v-model="form.unicode" :startDate="projectStartMonth" :disabled="!form.xmId" />
       </template>
       
     </avue-crud>
@@ -75,14 +69,15 @@ import 'nprogress/nprogress.css';
 import {getToken} from "@/util/auth";
 import {downloadXls} from "@/util/util";
 import projectSelect from "@/components/project-select";
-import {getListByProDate} from "@/api/basicResource/technicianRoster";
+import projectPersonSelect from "@/components/project-person-select";
 import {yyysbmd} from "@/api/techPerson/monthSjcyry"
 
 
 export default window.$crudCommon({
   components: {
     YearMonthSelect,
-    projectSelect
+    projectSelect,
+    projectPersonSelect
   },
   data() {
     return {
@@ -94,6 +89,9 @@ export default window.$crudCommon({
 
       wideTableColumns: [],
       printTitle: "",
+
+      // 项目开始月份
+      projectStartMonth: ''
     };
   },
   watch: {
@@ -137,15 +135,7 @@ export default window.$crudCommon({
       });
     },
     handleProjectChange(data) {
-      this.technicianList = [];
-      let startDate = moment(data.xmkssj).format('yyyyMM');
-      let endDate = moment(data.xmkssj).format('yyyyMM');
-
-      getListByProDate(startDate, endDate).then(({ data }) => {
-        if (data.code == 200) {
-          this.technicianList = data.data.records;
-        }
-      });
+      this.projectStartMonth = moment(data.xmkssj).format('yyyyMM');
     },
     handleExport() {
       this.$confirm("是否导出吗?", "提示", {

+ 12 - 4
src/views/yf-cost-manage/basic-data-setting/wxzc-details.vue

@@ -109,9 +109,9 @@
         >
           <el-option
             v-for="item in cyPersonList"
-            :key="item.unicode"
-            :label="item.name"
-            :value="item.unicode">
+            :key="item.value"
+            :label="item.label"
+            :value="item.value">
           </el-option>
         </el-select>
       </template>
@@ -237,7 +237,15 @@ export default window.$crudCommon({
     getCyPersonListFunc(xmmc) {
       getCyPersonList(1, 99999, { xmmc, yearAndMonth: this.params.yearAndMonth }).then(({ data }) => {
         if (data.code == 200) {
-          this.cyPersonList = data.data.records && data.data.records.length ? data.data.records[0].technicianList : [];
+          let list = data.data.records && data.data.records.length ? data.data.records[0].technicianList : [];
+          this.cyPersonList = list.map(item => {
+            let nameArr = [item.name, item.number || '-', item.idCard || '-'];
+            return {
+              label: nameArr.join(' \\ '),
+              value: item.unicode,
+              ...item
+            }
+          });
         }
       });
     }