소스 검색

申请单,剂型参照完善,字段完善

黄梓星 2 년 전
부모
커밋
fbe96c4613
3개의 변경된 파일341개의 추가작업 그리고 25개의 파일을 삭제
  1. 8 0
      src/api/requisition/basic.js
  2. 269 0
      src/components/PopDialog/dose.vue
  3. 64 25
      src/views/material/requisition/add.vue

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

@@ -78,4 +78,12 @@ export function getLine(data) {
     method: 'post',
     data: data
   })
+}
+// 参照-剂型
+export function getDose(data) {
+  return request({
+    url: `/system/archival/queryDosageForm`,
+    method: 'post',
+    data: data
+  })
 }

+ 269 - 0
src/components/PopDialog/dose.vue

@@ -0,0 +1,269 @@
+<template>
+  <div>
+    <el-dialog
+      title="剂型选择"
+      width="1000px"
+      :close-on-click-modal="false"
+      :append-to-body="true"
+      v-dialogDrag
+      class="userDialog"
+      :visible.sync="visible"
+    >
+      <el-container style="height: 500px">
+        <el-container>
+          <el-header style="text-align: left; font-size: 12px; height: 30px">
+            <el-form
+              size="small"
+              :inline="true"
+              ref="searchForm"
+              :model="searchForm"
+              @keyup.enter.native="refreshList()"
+              @submit.native.prevent
+            >
+              <el-form-item prop="code">
+                <el-input
+                  size="small"
+                  v-model="searchForm.code"
+                  placeholder="编号"
+                  clearable
+                ></el-input>
+              </el-form-item>
+              <el-form-item prop="name">
+                <el-input
+                  size="small"
+                  v-model="searchForm.name"
+                  placeholder="名称"
+                  clearable
+                ></el-input>
+              </el-form-item>
+              <el-form-item>
+                <el-button
+                  type="primary"
+                  @click="refreshList()"
+                  size="small"
+                  icon="el-icon-search"
+                  >查询</el-button
+                >
+                <el-button
+                  @click="resetSearch()"
+                  size="small"
+                  icon="el-icon-refresh-right"
+                >重置</el-button>
+              </el-form-item>
+            </el-form>
+          </el-header>
+          <el-main>
+            <el-table
+              :data="dataList"
+              v-loading="loading"
+              size="small"
+              border
+              ref="contractTable"
+              @select="handleSelectionChange"
+              height="calc(100% - 40px)"
+              style="width: 100%"
+            >
+              <el-table-column
+                type="selection"
+                header-align="center"
+                align="center"
+                width="50"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="id"
+                header-align="center"
+                align="left"
+                sortable="custom"
+                min-width="90"
+                label="id"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="name"
+                header-align="center"
+                align="left"
+                sortable="custom"
+                min-width="90"
+                label="名称"
+              >
+              </el-table-column>
+              <!-- <el-table-column
+                prop="contractAmount"
+                header-align="center"
+                align="left"
+                sortable="custom"
+                min-width="110"
+                label="合同金额"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="oppositeCompany"
+                header-align="center"
+                align="center"
+                sortable="custom"
+                min-width="110"
+                label="对方单位"
+              >
+              </el-table-column>
+              <el-table-column
+                prop="signDate"
+                header-align="center"
+                align="left"
+                sortable="custom"
+                min-width="110"
+                label="签订时间"
+              >
+              </el-table-column> -->
+            </el-table>
+            <el-pagination
+              @size-change="sizeChangeHandle"
+              @current-change="currentChangeHandle"
+              :current-page="pageNo"
+              :page-sizes="[5, 10, 15, 20]"
+              :page-size="pageSize"
+              :total="total"
+              layout="total, sizes, prev, pager, next, jumper"
+            >
+            </el-pagination>
+          </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 { getDose } from '@/api/requisition/basic'
+export default {
+  data() {
+    return {
+      searchForm: {
+        code: '',
+        name: ''
+      },
+      dataListAllSelections: [], // 所有选中的数据包含跨页数据
+      idKey: "id", // 标识列表数据中每一行的唯一键的名称(需要按自己的数据改一下)
+      dataList: [],
+      pageNo: 1,
+      pageSize: 10,
+      total: 0,
+      orders: [],
+      loading: false,
+      visible: false,
+    };
+  },
+  props: {
+    selectData: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
+    // 是否启用单选
+    single: {
+      type: Boolean,
+      default: false
+    }
+  },
+  methods: {
+    init() {
+      this.visible = true;
+      this.$nextTick(() => {
+        this.dataListAllSelections = JSON.parse(JSON.stringify(this.selectData));
+        this.resetSearch();
+      });
+    },
+    // 获取数据列表
+    refreshList() {
+      this.loading = true;
+      getDose({
+        pageNo: 1,
+        size: this.pageSize
+      }).then(({ data }) => {
+        console.log('data',data)
+        this.dataList = data.tableBody;
+        this.total = data.tableBody.length;
+        this.pageNo = data.current;
+        this.loading = false;
+        this.$nextTick(() => {
+          this.setSelectRow();
+        });
+      });
+    },
+    // 每页数
+    sizeChangeHandle(val) {
+      this.pageSize = val;
+      this.pageNo = 1;
+      this.refreshList();
+    },
+    // 当前页
+    currentChangeHandle(val) {
+      this.pageNo = val;
+      this.refreshList();
+    },
+    // 排序
+    resetSearch() {
+      this.$refs.searchForm.resetFields();
+      this.refreshList();
+    },
+    // 选中数据
+    handleSelectionChange(selection, row) {
+      if (this.single && selection.length > 1) {
+        this.$refs.contractTable.clearSelection();
+        this.$refs.contractTable.toggleRowSelection(row);
+      }
+      this.dataListAllSelections = this.single ? [row] : selection
+    },
+    // 设置选中的方法
+    setSelectRow() {
+      this.$refs.contractTable.clearSelection();
+      if (!this.dataListAllSelections || this.dataListAllSelections.length <= 0) {
+        return;
+      }
+      for (let i = 0; i < this.dataList.length; i++) {
+        if (this.dataListAllSelections.some(item => item[this.idKey] == this.dataList[i][this.idKey])) {
+          // 设置选中,记住table组件需要使用ref="table"
+          this.$refs.contractTable.toggleRowSelection(this.dataList[i], true);
+        }
+      }
+    },
+    doSubmit() {
+      this.visible = false;
+      console.log('选择的数据?',this.dataListAllSelections)
+      this.$emit("doSubmit", this.dataListAllSelections);
+    },
+  },
+};
+</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>

+ 64 - 25
src/views/material/requisition/add.vue

@@ -169,7 +169,7 @@
             <el-col :span="8">
               <el-form-item label="B2C物料" prop="isB2c">
                 <el-select
-                    v-model="basicForm.medicineMaterial"
+                    v-model="basicForm.isB2c"
                     placeholder="B2C物料"
                     clearable
                     :disabled="disable"
@@ -255,33 +255,21 @@
             </el-col>
             <el-col :span="8">
               <el-form-item label="有效期" prop="usefulLife">
-                <el-select
-                    v-model="basicForm.usefulLife"
-                    placeholder="有效期"
-                    clearable
-                    :disabled="disable"
-                  >
-                    <el-option
-                      v-for="item in options"
-                      :key="item.value"
-                      :label="item.label"
-                      :value="item.value"
-                    />
-                </el-select>
+                <el-input type="number" :disabled="disable" v-model="basicForm.usefulLife"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
           <el-row :gutter="20">
             <el-col :span="8">
-              <el-form-item label="效期单位" prop="expiryUnitId">
+              <el-form-item label="效期单位" prop="expiryUnitId">
                 <el-select
                     v-model="basicForm.expiryUnitId"
-                    placeholder="效期单位"
+                    placeholder="效期单位"
                     clearable
                     :disabled="disable"
                   >
                     <el-option
-                      v-for="item in options"
+                      v-for="item in dict.type.period_unit"
                       :key="item.value"
                       :label="item.label"
                       :value="item.value"
@@ -298,7 +286,7 @@
                     :disabled="disable"
                   >
                     <el-option
-                      v-for="item in options"
+                      v-for="item in dict.type.expiry_date"
                       :key="item.value"
                       :label="item.label"
                       :value="item.value"
@@ -308,7 +296,7 @@
             </el-col>
             <el-col :span="8">
               <el-form-item label="近效期预警天数" prop="recentWarningPeriod">
-                <el-input :disabled="disable" v-model="basicForm.recentWarningPeriod"></el-input>
+                <el-input type="number" :disabled="disable" v-model="basicForm.recentWarningPeriod"></el-input>
               </el-form-item>
             </el-col>
           </el-row>
@@ -592,9 +580,23 @@
             </el-col>
             <el-col :span="8">
               <el-form-item label="剂型" prop="dosageFrom">
-                <el-input :disabled="disable" v-model="basicForm2.dosageFrom">
+                <el-select
+                    ref="doses"
+                    v-model="basicForm2.dosageFrom"
+                    placeholder="剂型"
+                    :disabled="disable"
+                    @focus="chooseDose"
+                  >
+                    <el-option
+                      v-for="item in doseOptions"
+                      :key="item.id"
+                      :label="item.name"
+                      :value="item.id"
+                    />
+                </el-select>
+                <!-- <el-input :disabled="disable" v-model="basicForm2.dosageFrom">
                   <el-button :disabled="disable" slot="append" icon="el-icon-more" @click="test01"></el-button>
-                </el-input>
+                </el-input> -->
               </el-form-item>
             </el-col>
           </el-row>
@@ -794,6 +796,13 @@
       :selectData="selectData8"
       :single="true"
     />
+
+    <dose
+      ref="dose"
+      @doSubmit="acceptDose"
+      :selectData="selectData9"
+      :single="true"
+    />
   </div>
 </template>
 
@@ -806,17 +815,18 @@ import place from '@/components/PopDialog/place.vue'
 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 { addReq, getReqDetail, editReq } from '@/api/requisition/basic'
 // 调用物料分类详情接口用于数据回显
 import { getDetail } from '@/api/classify/basic';
 // 生产厂商/代理人调用用于回显
 import { getProductFactory } from '@/api/changeApply/basic'
 // 计量单位,产地调用用于回显
-import { getUnit, getPlace, getTax, getStaff, getLine} from '@/api/requisition/basic'
+import { getUnit, getPlace, getTax, getStaff, getLine, getDose} from '@/api/requisition/basic'
 
 export default {
   name: 'requisition_add',
-  dicts: ['sys_storage_condition', 'sys_conditions_carriage', 'sys_medicine', 'medical_instruments', 'curing_type'],
+  dicts: ['sys_storage_condition', 'sys_conditions_carriage', 'sys_medicine', 'medical_instruments', 'curing_type', 'period_unit', 'expiry_date'],
   components: {
     popDialog,
     factory,
@@ -825,7 +835,8 @@ export default {
     place,
     tax,
     staff,
-    serviceline
+    serviceline,
+    dose
   },
   props: ['pageStu', 'row', 'disable'],
   model: {
@@ -841,6 +852,7 @@ export default {
       taxOptions: [],
       staffOptions: [],
       lineOptions: [],
+      doseOptions: [],
       tabValue: 'first',
       basicForm: {
         billCode: '',
@@ -944,7 +956,8 @@ export default {
       selectData5: [],
       selectData6: [],
       selectData7: [],
-      selectData8: []
+      selectData8: [],
+      selectData9: []
     }
   },
   // watch: {
@@ -1115,6 +1128,15 @@ export default {
         }
       })
     },
+    // 剂型回显
+    getDoseDetails(id) {
+      getDose({id:id}).then(res => {
+        console.log('剂型', res)
+        if (res.code === 200 ) {
+          this.doseOptions = res.data.tableBody
+        }
+      })
+    },
     // 如果是详情进入,则调用详情接口
     getDetails(row) {
       getReqDetail(row.id).then(res => {
@@ -1124,10 +1146,16 @@ export default {
           if(res.data.unitId) {
             this.basicForm.unitId = res.data.unitId.toString()
             this.basicForm.manufacturerId = res.data.manufacturerId.toString()
+            this.basicForm.usefulLifeUnitId = res.data.usefulLifeUnitId.toString()
+            this.basicForm.expiryUnitId = res.data.expiryUnitId.toString()
           }
           if(res.data.sysMaterialMedcineApply) {
             this.basicForm2 = res.data.sysMaterialMedcineApply
           }
+          // 剂型回显
+          if (res.data.sysMaterialMedcineApply.dosageFrom) {
+            this.getDoseDetails(res.data.sysMaterialMedcineApply.dosageFrom)
+          }
         }
       })
     },
@@ -1339,6 +1367,17 @@ export default {
       this.$refs.lines.blur()
       this.$refs.line.init()
     },
+    // 选择剂型
+    acceptDose (selections) {
+      this.doseOptions = selections
+      this.basicForm2.dosageFrom = selections[0].id
+      this.getDoseDetails(selections[0].id)
+    },
+    // 业务线显示列表
+    chooseDose () {
+      this.$refs.doses.blur()
+      this.$refs.dose.init()
+    },
   }
 }
 </script>