Browse Source

修改bug,申请单新增物料分类维护

黄梓星 2 năm trước cách đây
mục cha
commit
fa1b14b8c6

BIN
public/favicon_bak.ico


+ 8 - 0
src/api/requisition/basic.js

@@ -95,4 +95,12 @@ export function getOrgs(data) {
     method: 'get',
     params: data
   })
+}
+// 参照-药品类别(子表)
+export function getDrug(data) {
+  return request({
+    url: `/system/archival/queryMedcineItemDrug`,
+    method: 'post',
+    data: data
+  })
 }

+ 128 - 0
src/components/PopDialog/drug.vue

@@ -0,0 +1,128 @@
+<template>
+  <div>
+    <el-dialog
+      title="药品类别"
+      width="500px"
+      :close-on-click-modal="false"
+      :append-to-body="true"
+      v-dialogDrag
+      class="userDialog"
+      :visible.sync="visible"
+    >
+      <el-container style="height: 500px">
+        <el-container>
+          <el-main>
+            <el-row :gutter="10" class="content">
+              <el-col :span="12">
+                <el-input
+                  placeholder="输入关键字进行过滤"
+                  size="small"
+                  v-model="filterText">
+                </el-input>
+
+                <el-tree
+                  class="filter-tree"
+                  :data="threedata"
+                  :props="defaultProps"
+                  node-key="id"
+                  highlight-current
+                  @node-click="clickTree"
+                  :filter-node-method="filterNode"
+                  ref="tree">
+                </el-tree>
+              </el-col>
+            </el-row>
+          </el-main>
+        </el-container>
+      </el-container>
+      <span slot="footer" class="dialog-footer">
+        <el-button
+          size="small"
+          @click="visible = false"
+          icon="el-icon-circle-close"
+          >关闭</el-button
+        >
+        <el-button
+          size="small"
+          type="primary"
+          icon="el-icon-circle-check"
+          @click="doSubmit()"
+          >确定</el-button
+        >
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getDrug } from '@/api/requisition/basic'
+export default {
+  data() {
+    return {
+      loading: false,
+      visible: false,
+      filterText: '',
+      threedata: [],
+      defaultProps: {
+        children: 'childrens',
+        label: 'name'
+      },
+      // 判断是否为最末级节点
+      // isLast: false,
+      // 选中的节点
+      choosePoint: {}
+    };
+  },
+  props: {},
+  methods: {
+    init() {
+      this.visible = true;
+      this.$nextTick(() => {
+        this.refreshList()
+      });
+    },
+    // 获取数据列表
+    refreshList(data) {
+      this.loading = true;
+      getDrug({}).then(res => {
+        console.log('res',res)
+        if(res.code === 200) {
+          this.threedata = res.data.tableBody
+        }
+        this.loading = false;
+      });
+    },
+    clickTree(data) {
+      console.log('树形节点信息:',data)
+      this.choosePoint = data
+    },
+    filterNode(value, data) {
+      console.log('value', value)
+      console.log('data', data)
+        if (!value) return true;
+        return data.label.indexOf(value) !== -1;
+    },
+    doSubmit() {
+      console.log('子组件选择的数据',this.choosePoint)
+      this.$emit("doSubmit", this.choosePoint);
+      this.visible = false;
+    },
+  },
+};
+</script>
+<style lang="scss">
+.userDialog {
+  .el-dialog__body {
+    padding: 10px 0px 0px 10px;
+    color: #606266;
+    font-size: 14px;
+    word-break: break-all;
+  }
+  .el-main {
+    padding: 20px 20px 5px 20px;
+    .el-pagination {
+      margin-top: 5px;
+    }
+  }
+}
+</style>

+ 1 - 1
src/views/material/changeApply/add.vue

@@ -391,7 +391,7 @@ export default {
       isControl: true,
       basicForm: {
         code: '',
-        orgId: '',
+        orgId: '德荣医疗科技股份有限公司',
         // 物料id
         materialId:'',
         materialCode: '',

+ 91 - 62
src/views/material/requisition/add.vue

@@ -32,9 +32,6 @@
                       :value="item.id"
                     />
                 </el-select>
-                <!-- <el-input :disabled="disable" v-model="basicForm.classifyId">
-                  <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="chooseFourClass"></el-button>
-                </el-input> -->
               </el-form-item>
             </el-col>
           </el-row>
@@ -107,9 +104,6 @@
                       :value="item.id"
                     />
                 </el-select>
-                <!-- <el-input :disabled="disable" v-model="basicForm.unitId">
-                  <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="chooseUnit"></el-button>
-                </el-input> -->
               </el-form-item>
             </el-col>
             <el-col :span="8">
@@ -129,9 +123,6 @@
                       :value="item.id"
                     />
                 </el-select>
-                <!-- <el-input :disabled="disable" v-model="basicForm.manufacturerId">
-                  <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="chooseFactory"></el-button>
-                </el-input> -->
               </el-form-item>
             </el-col>
           </el-row>
@@ -522,7 +513,6 @@
                       :value="item.id"
                     />
                 </el-select>
-                <!-- <el-input disabled v-model="basicForm.purchasingOrganization"></el-input> -->
               </el-form-item>
             </el-col>
             <el-col :span="8">
@@ -542,7 +532,6 @@
                       :value="item.id"
                     />
                 </el-select>
-                <!-- <el-input :disabled = "disable || orgControl" v-model="basicForm.businessDepartment"></el-input> -->
               </el-form-item>
             </el-col>
             <el-col :span="8">
@@ -661,40 +650,42 @@
             </el-col>
           </el-row>
         </el-form>
-        <!-- <el-row style="margin-bottom: 12px;">
+        <el-row style="margin-bottom: 12px;">
           <span>物料类别</span>
         </el-row>
         <el-row style="margin-bottom: 12px;">
-          <el-button type="primary" size="small" plain @click="addLine">新增</el-button>
-          <el-button type="primary" size="small" plain @click="handleDelete">删除</el-button>
-          <el-button type="primary" size="small" plain @click="testsave">暂存</el-button>
-        </el-row> -->
-        <!-- <el-row>
+          <el-button :disabled="disable || isControl" type="primary" size="small" plain @click="addLine">新增</el-button>
+          <el-button :disabled="disable || isControl" type="primary" size="small" plain @click="handleDelete">删除</el-button>
+          <!-- <el-button :disabled="disable || isControl" type="primary" size="small" plain @click="testsave">暂存</el-button> -->
+        </el-row>
+        <el-row>
           <el-col :span="12">
             <el-table 
-            :data="basicForm2.medicineTypeChanges"
+            :data="sysMaterialMedcineItemApply"
             class="request-table"
             @selection-change="handleSelectionChange"
             >
               <el-table-column type="selection" width="55" />
-              <el-table-column label="序号" align="center" prop="sort">
+              <el-table-column label="物料类别ID" align="center" prop="sort">
                 <template slot-scope="scope">
-                  <el-input v-model="scope.row.sort"></el-input>
+                  <el-input readonly v-model="scope.row.drugId">
+                    <!-- <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="chooseDrug"></el-button> -->
+                  </el-input>
                 </template>
               </el-table-column>
-              <el-table-column label="物料类别" align="center" prop="medicineCode">
+              <el-table-column label="物料类别code" align="center" prop="medicineCode">
                 <template slot-scope="scope">
-                  <el-input v-model="scope.row.medicineCode"></el-input>
+                  <el-input readonly v-model="scope.row.drugCode"></el-input>
                 </template>
               </el-table-column>
-              <el-table-column label="类别名称" align="center" prop="medicineName">
+              <el-table-column label="物料类别名称" align="center" prop="medicineName">
                 <template slot-scope="scope">
-                  <el-input v-model="scope.row.medicineName"></el-input>
+                  <el-input readonly v-model="scope.row.drugName"></el-input>
                 </template>
               </el-table-column>
             </el-table>
           </el-col>
-        </el-row> -->
+        </el-row>
       </el-tab-pane>
 
       <el-tab-pane label="单据信息" name="fourth">
@@ -847,6 +838,14 @@
       :selectData="selectData11"
       :single="true"
     />
+
+    <drug
+      ref="drug"
+      @doSubmit="acceptDrug"
+      :selectData="selectData12"
+      :single="true"
+    />
+
   </div>
 </template>
 
@@ -859,9 +858,12 @@ import tax from '@/components/PopDialog/tax.vue'
 import staff from '@/components/PopDialog/staff.vue'
 import serviceline from '@/components/PopDialog/serviceline.vue'
 import dose from '@/components/PopDialog/dose.vue'
+// 公用一个树形(组织部门传值不同)
 import orgs from '@/components/PopDialog/organization.vue'
 import depart from '@/components/PopDialog/organization.vue'
-// 公用一个树形
+// 药品类别子别
+import drug from '@/components/PopDialog/drug.vue'
+
 import { addReq, getReqDetail, editReq } from '@/api/requisition/basic'
 // 调用物料分类详情接口用于数据回显
 import { getDetail } from '@/api/classify/basic';
@@ -883,7 +885,8 @@ export default {
     serviceline,
     dose,
     orgs,
-    depart
+    depart,
+    drug
   },
   props: ['pageStu', 'row', 'disable'],
   model: {
@@ -1024,6 +1027,8 @@ export default {
         // medicineTypeChanges:[
         // ],
       },
+      // 医药属性子表
+      sysMaterialMedcineItemApply: [],
       
       // tableList: [],
       // 子表选中
@@ -1040,7 +1045,8 @@ export default {
       selectData8: [],
       selectData9: [],
       selectData10: [],
-      selectData11: []
+      selectData11: [],
+      selectData12: []
     }
   },
   // watch: {
@@ -1291,6 +1297,10 @@ export default {
           if (res.data.sysMaterialMedcineApply && res.data.sysMaterialMedcineApply.dosageFrom) {
             this.getDoseDetails(res.data.sysMaterialMedcineApply.dosageFrom)
           }
+          // 物料类别回显
+          if (res.data.sysMaterialMedcineItemApply) {
+            this.sysMaterialMedcineItemApply = res.data.sysMaterialMedcineItemApply
+          }
         }
       })
     },
@@ -1298,6 +1308,7 @@ export default {
       if(this.pageStu == 'edit') {
         let sparams = {...this.basicForm, ...{status: 0}}
         sparams.sysMaterialMedcineApply = this.basicForm2
+        sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
         console.log('提交参数', sparams)
         this.$refs['basic'].validate((valid) => {
           if (valid) {
@@ -1316,6 +1327,7 @@ export default {
         // alert('保存传status:0')
         let sparams = {...this.basicForm, ...{status: 0}}
         sparams.sysMaterialMedcineApply = this.basicForm2
+        sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
         console.log('保存参数', sparams)
         this.$refs['basic'].validate((valid) => {
           if(valid) {
@@ -1336,6 +1348,7 @@ export default {
       // alert('提交传status:1')
       let sparams = {...this.basicForm, ...{status: 1}}
       sparams.sysMaterialMedcineApply = this.basicForm2
+      sparams.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
       console.log('提交参数', sparams)
       this.$refs['basic'].validate((valid) => {
         if(valid) {
@@ -1360,39 +1373,42 @@ export default {
       this.$emit('refresh', queryParams)
     },
     // 子表增删行
-    // handleSelectionChange(val) {
-    //   this.ids = val
-    //   console.log('this.ids',this.ids)
-    // },
-    // addLine() {
-    //   //添加行数
-    //   let newValue = {
-    //     sort:'',
-    //     medicineCode: '',
-    //     medicineName: '',
-    //   };
-    //   this.basicForm2.medicineTypeChanges.push(newValue);
-    // },
-    // handleDelete(index) {
-    //   if(this.ids.length == 0) {
-    //     this.$message({
-    //       message: '请选择删除条目',
-    //       type: 'warning'
-    //     });
-    //   } else {
-    //     // console.log('index',index)
-    //     // this.basicForm2.medicineTypeChanges.splice(index, 1);
-    //     this.basicForm2.medicineTypeChanges = this.basicForm2.medicineTypeChanges.filter(item =>
-    //      !this.ids.some(ele =>
-    //      ele.sort == item.sort))
-    //   }
-    // },
-    // testsave() {
-    //   console.log('暂存表格:', this.basicForm2.medicineTypeChanges)
-    //   console.log('暂存表单1', this.basicForm)
-    //   let params = {...this.basicForm, ...this.basicForm2}
-    //   console.log('暂存总表单', params)
-    // },
+    handleSelectionChange(val) {
+      this.ids = val
+      console.log('this.ids',this.ids)
+    },
+    addLine() {
+      //添加行数
+      // let newValue = {
+      //   drugId:'',
+      //   drugCode: '',
+      //   drugName: '',
+      // };
+      // this.sysMaterialMedcineItemApply.push(newValue);
+      this.chooseDrug()
+    },
+    handleDelete(index) {
+      if(this.ids.length == 0) {
+        this.$message({
+          message: '请选择删除条目',
+          type: 'warning'
+        });
+      } else {
+        // console.log('index',index)
+        // this.basicForm2.medicineTypeChanges.splice(index, 1);
+        this.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply.filter(item =>
+         !this.ids.some(ele =>
+         ele.drugId == item.drugId))
+      }
+    },
+    testsave() {
+      console.log('暂存表格:', this.sysMaterialMedcineItemApply)
+      console.log('暂存表单1', this.basicForm)
+      let params = {...this.basicForm}
+      params.sysMaterialMedcineApply = this.basicForm2
+      params.sysMaterialMedcineItemApply = this.sysMaterialMedcineItemApply
+      console.log('暂存总表单', params)
+    },
 
     // 选择生产厂家/代理人
     acceptFactory (selections) {
@@ -1510,7 +1526,20 @@ export default {
     chooseDepart () {
       this.$refs.departs.blur()
       this.$refs.depart.init('0')
-    }
+    },
+    // 选择医药类别
+    acceptDrug (selections) {
+      console.log('接收的物料类别', selections)
+      const sleObj = {}
+      sleObj.drugId = selections.id
+      sleObj.drugCode = selections.code
+      sleObj.drugName = selections.name
+      this.sysMaterialMedcineItemApply.push(sleObj)
+    },
+    // 医药类别子表的显示列表
+    chooseDrug () {
+      this.$refs.drug.init()
+    },
   }
 }
 </script>