|
@@ -1,122 +1,187 @@
|
|
|
<!-- -->
|
|
|
<template>
|
|
|
<div class="medicineManage">
|
|
|
- <searchAdd isButtom="查询" :inline="true" @event="eventFun">
|
|
|
+ <searchAdd isButtom="查询" :inline="true" @event="eventFun">
|
|
|
<template #searchConter>
|
|
|
- <el-form-item label="日期">
|
|
|
- <el-date-picker v-model="data.datePicker" type="daterange" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
|
|
|
- start-placeholder="开始时间" end-placeholder="结束时间" clearable style="width: 200px;" @change="changeTime"/>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="品种">
|
|
|
- <el-select v-model="data.initParam.productId" placeholder="品种" clearable @clear="data.initParam.productId=null">
|
|
|
- <el-option :label="item.name" :value="item.id" v-for="item,index in data.prodOptions" :key="index"/>
|
|
|
+ <el-form-item label="生产企业">
|
|
|
+ <el-select v-model.number="data.initParam.enterprise" filterable remote reserve-keyword placeholder="生产企业"
|
|
|
+ :remote-method="remoteMethod1" :loading="loading" clearable @clear="data.initParam.enterprise = null"
|
|
|
+ @click="click1" style="width: 200px;">
|
|
|
+ <el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.label" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="购货单位">
|
|
|
- <el-select v-model="data.initParam.receivingUnit" filterable remote reserve-keyword placeholder="购货单位"
|
|
|
- :remote-method="remoteMethod" :loading="loading" @click="click2" clearable style="width: 200px;">
|
|
|
- <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ <el-form-item label="品名">
|
|
|
+ <el-select v-model.number="data.initParam.product" filterable remote reserve-keyword placeholder="品名"
|
|
|
+ :remote-method="remoteMethod2" :loading="loading" clearable @clear="data.initParam.product = null"
|
|
|
+ @click="click2" style="width: 200px;">
|
|
|
+ <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.label" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
+ <el-form-item label="规格">
|
|
|
+ <el-input v-model="data.initParam.spec" placeholder="规格" clearable style="width: 200px;" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="批号">
|
|
|
+ <el-input v-model="data.initParam.batchNumber" placeholder="批号" clearable style="width: 200px;" />
|
|
|
+ </el-form-item>
|
|
|
</template>
|
|
|
</searchAdd>
|
|
|
<bg istitle="基本信息">
|
|
|
+ <template #btn>
|
|
|
+ <Scaninquire ref="scanRef" @scanFun="scanFun"></Scaninquire>
|
|
|
+ </template>
|
|
|
<template #bg>
|
|
|
- <tables ref="TableRef" :requestApi="salesList" :columns="columns" :initParam="data.initParam">
|
|
|
+ <tables ref="TableRef" :requestApi="medicineList" :columns="columns" :initParam="data.initParam">
|
|
|
+ <template #imgUrl="{ row }">
|
|
|
+ <el-image
|
|
|
+ style="width: 30px; height: 30px"
|
|
|
+ :src="row.imgUrl"
|
|
|
+ :zoom-rate="1.2"
|
|
|
+ :max-scale="7"
|
|
|
+ :min-scale="0.2"
|
|
|
+ :preview-src-list="row.crcList"
|
|
|
+ :initial-index="4"
|
|
|
+ fit="cover">
|
|
|
+ </el-image>
|
|
|
+ </template>
|
|
|
<template #right="{ row }">
|
|
|
- <el-button link type="primary" size="small">查看</el-button>
|
|
|
- <el-button link type="danger" size="small" @click="filesFn">上传</el-button>
|
|
|
+ <!-- <el-button link type="primary" size="small" @click="showImgFn(row)">查看</el-button> -->
|
|
|
+ <el-button link type="primary" size="small" @click="filesFn(row)">上传</el-button>
|
|
|
</template>
|
|
|
</tables>
|
|
|
</template>
|
|
|
</bg>
|
|
|
- <files ref="FilesRef"></files>
|
|
|
+ <files ref="FilesRef" @upTable="upTableFun"></files>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { reactive, ref, onMounted,nextTick} from 'vue'
|
|
|
-import { medicineList,prodList,stockunit,salesList} from "@/api";
|
|
|
-
|
|
|
+import { medicineList,
|
|
|
+ enterpriseList,//生产企业
|
|
|
+ prodList} from "@/api";
|
|
|
import tables from "@/components/table.vue";
|
|
|
-import files from "@/components/files.vue";
|
|
|
+import files from "./files.vue";
|
|
|
+import Scaninquire from "./Scaninquire.vue";
|
|
|
+
|
|
|
+
|
|
|
import searchAdd from "@/components/searchAdd.vue";
|
|
|
import bg from '@/components/bg.vue'
|
|
|
const TableRef = ref()
|
|
|
const FilesRef = ref()
|
|
|
|
|
|
-//函数
|
|
|
-const filesFn = async ()=>{
|
|
|
+
|
|
|
+//上传图片
|
|
|
+const filesFn = async (row:any)=>{
|
|
|
FilesRef.value.showDrawer()
|
|
|
+ FilesRef.value.initParam.id = row.id
|
|
|
}
|
|
|
-const loading = ref(false)
|
|
|
-interface ListItem {
|
|
|
- value: string
|
|
|
- label: string
|
|
|
+//函数
|
|
|
+const upTableFun = async ()=>{
|
|
|
+ TableRef.value?.getTableList()
|
|
|
}
|
|
|
-const list = ref<ListItem[]>([])
|
|
|
-const options = ref<ListItem[]>([])
|
|
|
- const click2 = async ()=>{options.value = list.value }
|
|
|
+const loading = ref(false)
|
|
|
+
|
|
|
+
|
|
|
onMounted(async() => {
|
|
|
- prodListApi()
|
|
|
- const result:any = await stockunit({type:2,name:''})
|
|
|
- let arr = result.data?.list || []
|
|
|
- list.value = arr.map((item:any) => {
|
|
|
- return { value: item, label: item}
|
|
|
- })
|
|
|
+ const result1: any = await enterpriseList({ age: 1, pageSize: 999 })//生产企业
|
|
|
+ list1.value = findMap(result1.data?.list || [], 'obj')
|
|
|
+
|
|
|
+ const result2: any = await prodList({ age: 1, pageSize: 999 })//品名
|
|
|
+ list2.value = findMap(result2.data?.list || [], 'obj')
|
|
|
})
|
|
|
-//品名
|
|
|
-const prodListApi = async ()=>{
|
|
|
- const result:any = await prodList({"page": 1,"pageSize": 99999})
|
|
|
- data.prodOptions = result.data?.list
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+interface ListItem {
|
|
|
+ value: string
|
|
|
+ label: string
|
|
|
}
|
|
|
-const remoteMethod = async(query: string) => {
|
|
|
- if (query) {
|
|
|
- loading.value = true
|
|
|
- setTimeout(() => {
|
|
|
- loading.value = false
|
|
|
- options.value = list.value.filter((item:any) => {
|
|
|
- return item.label.toLowerCase().includes(query.toLowerCase())
|
|
|
- })
|
|
|
- }, 200)
|
|
|
- } else {
|
|
|
- options.value = []
|
|
|
- }
|
|
|
+//筛选出option需要的数据格式
|
|
|
+const findMap = (arr: any, obj: any) => {
|
|
|
+ return arr.map((item: any) => {
|
|
|
+ return { value: obj == 'obj' ? item.id : item, label: obj == 'obj' ? item.name : item }
|
|
|
+ })
|
|
|
}
|
|
|
+const list1 = ref<ListItem[]>([])//生产企业
|
|
|
+const list2 = ref<ListItem[]>([])//品名
|
|
|
+
|
|
|
+
|
|
|
+const options1 = ref<ListItem[]>([])//生产企业
|
|
|
+const options2 = ref<ListItem[]>([])//品名
|
|
|
+
|
|
|
+
|
|
|
+const click1 = async () => { options1.value = list1.value }//生产企业
|
|
|
+const click2 = async () => { options2.value = list2.value }//品名
|
|
|
+
|
|
|
+
|
|
|
+const remoteMethod1 = async (query: string) => {//生产企业
|
|
|
+ if (query) {
|
|
|
+ loading.value = true
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false
|
|
|
+ options1.value = list1.value.filter((item: any) => {
|
|
|
+ return item.label.toLowerCase().includes(query.toLowerCase())
|
|
|
+ })
|
|
|
+ }, 200)
|
|
|
+ } else {
|
|
|
+ options1.value = []
|
|
|
+ }
|
|
|
+}
|
|
|
+const remoteMethod2 = async (query: string) => {//品名
|
|
|
+ if (query) {
|
|
|
+ loading.value = true
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false
|
|
|
+ options2.value = list2.value.filter((item: any) => {
|
|
|
+ return item.label.toLowerCase().includes(query.toLowerCase())
|
|
|
+ })
|
|
|
+ }, 200)
|
|
|
+ } else {
|
|
|
+ options2.value = []
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
// 渲染表格
|
|
|
const columns: any = [
|
|
|
- { prop: 'date', label: '名称', width: 120 },
|
|
|
- { prop: 'receiving_unit', label: '批号', width: 120},
|
|
|
- { prop: 'product_name', label: '失效日期', width: 120},
|
|
|
- { prop: 'enterprise_name', label: '生产日期', width: 120},
|
|
|
- { prop: 'spec_name', label: '批准文号', width: 120},
|
|
|
- { prop: 'dosage_form_name', label: '生产企业', width: 120},
|
|
|
- { prop: 'batch_number', label: '规格(剂/粒/支)', width: 150},
|
|
|
- { prop: 'unit_name', label: '单位', width: 120},
|
|
|
- { prop: 'quantity', label: '剂型', width: 120},
|
|
|
- { prop: 'unit_price', label: '批签发合格编号', width: 150},
|
|
|
- { prop: 'operation', label: '图片', fixed: 'right', 'min-width': 150 }
|
|
|
+ { prop: 'product', label: '名称', width: 150 },
|
|
|
+ { prop: 'batchNumber', label: '批号', width: 120},
|
|
|
+ { prop: 'expiryDate', label: '失效日期', width: 120},
|
|
|
+ { prop: 'productionDate', label: '生产日期', width: 120},
|
|
|
+ { prop: 'approvalNumber', label: '批准文号', width: 150},
|
|
|
+ { prop: 'enterprise', label: '生产企业', width: 150},
|
|
|
+ { prop: 'spec', label: '规格(剂/粒/支)', width: 150},
|
|
|
+ { prop: 'unit', label: '单位', width: 120},
|
|
|
+ { prop: 'dosageForm', label: '剂型', width: 120},
|
|
|
+ { prop: 'qualificationNumber', label: '批签发合格编号', width: 150},
|
|
|
+ { prop: 'imgurl', label: '预览', width: 150, name: 'imgUrl' },
|
|
|
+ { prop: 'operation', label: '操作', fixed: 'right', 'min-width': 150 }
|
|
|
]
|
|
|
|
|
|
//请求参数
|
|
|
const data:any = reactive({
|
|
|
- datePicker: [],//时间选择
|
|
|
- prodOptions:[],
|
|
|
initParam: {
|
|
|
- "endDate": "",
|
|
|
- "startDate": "",
|
|
|
- "productId":null,
|
|
|
- "receivingUnit": ""
|
|
|
+ "enterprise": "",//生产企业
|
|
|
+ "product": "",//品名
|
|
|
+ "spec": "",//规格
|
|
|
+ "batchNumber": ""//批号
|
|
|
}
|
|
|
})
|
|
|
|
|
|
-//函数
|
|
|
-const changeTime = async () => {
|
|
|
- if(data.datePicker){data.initParam.startDate = data.datePicker[0];data.initParam.endDate = data.datePicker[1]}
|
|
|
- else {data.initParam.startDate='';data.initParam.endDate = ''}
|
|
|
+//扫码搜索
|
|
|
+const scanFun = async (obj:any)=>{
|
|
|
+ data.initParam.enterprise = obj.enterprise_name
|
|
|
+ data.initParam.product = obj.product_name
|
|
|
+ data.initParam.spec = obj.spec_name
|
|
|
+ data.initParam.batchNumber = obj.batch_number
|
|
|
+ eventFun()
|
|
|
}
|
|
|
+
|
|
|
//搜索
|
|
|
const eventFun = async ()=>{
|
|
|
nextTick(() => {
|