Преглед изворни кода

Merge branch 'dev' into 'purchaseDev'

Dev

See merge request new-business/drp-web!161
黄梓星 пре 2 година
родитељ
комит
f3a73159e8
2 измењених фајлова са 118 додато и 11 уклоњено
  1. 94 9
      src/views/material/requisition/add.vue
  2. 24 2
      src/views/material/requisition/index.vue

+ 94 - 9
src/views/material/requisition/add.vue

@@ -607,7 +607,7 @@
     <div class="btn_group">
       <el-col :span="1.5">
         <el-button type="primary" size="small" plain @click="save"
-          v-if="pageStu == 'add' || pageStu == 'edit'">保存</el-button>
+          v-if="pageStu == 'add' || pageStu == 'edit' || pageStu ==='copy' ">保存</el-button>
       </el-col>
       <el-col :span="1.5" style="margin: 0 10px;">
         <el-button type="primary" size="small" plain @click="submit" v-if="pageStu == 'edit'">提交</el-button>
@@ -898,7 +898,7 @@ export default {
   //   }
   // },
   mounted() {
-    // console.log('页面状态',this.pageStu)
+    console.log('页面状态',this.pageStu)
     if (this.pageStu == 'check') {
       // alert('详情页面:')
       console.log('页面状态', this.pageStu)
@@ -943,7 +943,7 @@ export default {
       if (this.row.innerPackingUnit) {
         this.getInnerPackingUnitDetails(this.row.innerPackingUnit)
       }
-    } else if (this.pageStu == 'edit') {
+    } else if (this.pageStu == 'edit' ) {
       // alert('修改页面')
       console.log('页面状态', this.pageStu)
       console.log('数据', this.row)
@@ -1001,6 +1001,58 @@ export default {
     } else if (this.pageStu == 'add') {
       // alert('新增页面')
       console.log('页面状态', this.pageStu)
+    }else if(this.pageStu === 'copy'){
+      this.getDetails(this.row)
+      // 控制效期单位后面的是否可填写
+      if (this.row.expiryDateManagerment == '0') {
+        this.isExp = false
+      } else {
+        this.isExp = true
+      }
+      // 控制业务部门是否能够填写
+      if (this.row.purchasingOrganization) {
+        this.orgControl = false
+      } else {
+        this.orgControl = true
+      }
+      // 控制医药属性是否能够填写
+      if (this.row.isMedicine == '0') {
+        this.isControl = false
+      } else {
+        this.isControl = true
+      }
+      // 生产厂家代理人用于回显
+      if (this.row.manufacturerId) {
+        this.getFactoryDetails(this.row.manufacturerId)
+      }
+      // 计量单位回显
+      if (this.row.unitId) {
+        this.getUnitDetails(this.row.unitId)
+      }
+      // 产地回显
+      if (this.row.originPlace) {
+        this.getPlaceDetails(this.row.originPlace)
+      }
+      // 物料税类回显
+      if (this.row.materialRate) {
+        this.getTaxDetails(this.row.materialRate)
+      }
+      // 物料税类回显
+      if (this.row.puPersonnelId) {
+        this.getStaffDetails(this.row.puPersonnelId)
+      }
+      // 业务线回显
+      if (this.row.businessLine) {
+        this.getLineDetails(this.row.businessLine)
+      }
+      // 中包装单位回显
+      if (this.row.mediumPackageUnitId) {
+        this.getMidPackDetails(this.row.mediumPackageUnitId)
+      }
+      // 内包装单位回显
+      if (this.row.innerPackingUnit) {
+        this.getInnerPackingUnitDetails(this.row.innerPackingUnit)
+      }
     }
   },
   methods: {
@@ -1164,7 +1216,36 @@ export default {
       getReqDetail(row.id).then(res => {
         console.log('res', res)
         if (res.code === 200) {
-          this.basicForm = res.data
+
+          this.basicForm = res.data;
+
+          if(this.pageStu === 'copy'){
+
+            this.basicForm.id = '';
+
+            this.basicForm.billCode = '';
+
+            this.basicForm.diCode = '';
+
+            this.basicForm.status = '0';
+
+            this.basicForm.sysMaterialMedcineApply.id = '';
+
+            this.basicForm.sysMaterialMedcineItemApply.length &&
+
+            this.basicForm.sysMaterialMedcineItemApply.forEach(item =>(item.id = ''));
+
+            this.basicForm.createName = '';
+
+            this.basicForm.createTime = '';
+
+            this.basicForm.updateName = '';
+
+            this.basicForm.updateTime = '';
+
+
+          }
+
           // 获取树形详情
           if (res.data.classifyId) {
             this.getTreeDetails(res.data.classifyId)
@@ -1196,8 +1277,8 @@ export default {
       })
     },
     save() {
-      let sparams = { ...this.basicForm, ...{ status: 0 } }
-      console.log(sparams, 'sparams');
+      // let sparams = { ...this.basicForm, ...{ status: 0 } }
+      // console.log(sparams, 'sparams');
       if (this.pageStu == 'edit') {
         if (!this.basicForm.proposerId) {
           this.basicForm.proposerId = this.$store.state.user.name
@@ -1228,13 +1309,17 @@ export default {
           })
         })
       } else {
+
         // alert('保存传status:0')
         if (!this.basicForm.proposerId) {
           this.basicForm.proposerId = this.$store.state.user.name
         }
-        let sparams = { ...this.basicForm, ...{ status: 0 } }
-        sparams.sysMaterialMedcineApply = this.basicForm2
-        sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
+        let sparams = { ...this.basicForm, ...{ status: 0 } };
+
+        sparams.sysMaterialMedcineApply = this.basicForm2;
+
+        sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply;
+
         console.log('保存参数', sparams)
         const form1 = new Promise((resolve, reject) => {
           this.$refs['basic'].validate(valid => {

+ 24 - 2
src/views/material/requisition/index.vue

@@ -57,6 +57,9 @@
       <el-col :span="1.5">
         <el-button type="primary" size="small" plain @click="newAdd">新增</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button size="small" :disabled="checkedList.length != 1" @click="handleCopy">复制</el-button>
+      </el-col>
       <!-- <el-col :span="1.5">
         <el-button type="primary" size="small" plain>导入</el-button>
       </el-col>
@@ -78,8 +81,9 @@
         fit
         max-height="680"
         @selection-change="handleSelectionChange"
+        @select="handleSelect"
       >
-        <!-- <el-table-column type="selection" width="55" /> -->
+      <el-table-column type="selection" width="45" ></el-table-column>
         <el-table-column label="序号" align="center" type="index" width="50"/>
         <el-table-column label="所属组织" align="center" width="200" prop="orgName" />
         <el-table-column label="单据编码" align="center" width="200" prop="billCode" />
@@ -157,7 +161,8 @@ export default {
       // 页面状态
       page: '',
       rowDetail: {},
-      disable: false
+      disable: false,
+      checkedList:[],
     }
   },
   created() {
@@ -180,6 +185,22 @@ export default {
       this.page = 'add'
       this.disable = false
     },
+    // 复制
+    handleCopy(){
+      this.isList = false;
+      this.isComponent = 'addReq';
+      this.page = 'copy';
+      this.rowDetail =  this.checkedList[0];
+      this.disable = false;
+    },
+    // Select框
+    handleSelect(selection, row) {
+
+      this.checkedList = selection;
+
+      console.log(this.checkedList, 'this.checkedList');
+
+    },
     getList(val) {
       console.log('val',val)
       getReqList(val).then(res => {
@@ -188,6 +209,7 @@ export default {
           this.total = res.total
         }
       })
+      this.checkedList = [];
     },
     // 表格内状态栏判断值
     statusJug(row) {