|
@@ -1,118 +1,88 @@
|
|
|
-<template>
|
|
|
- <!-- <el-button el-button type="primary" icon="Download" @click="showdialog">收发登记表</el-button> -->
|
|
|
+<template>
|
|
|
<el-button el-button type="primary" icon="Download" @click="showdialogdialog">运输登记表</el-button>
|
|
|
- <el-dialog v-model="dialogFormVisible" title="收发登记表" :append-to-body="true" draggable width="30%">
|
|
|
- <el-form :model="initParam" ref="ruleFormRef" :rules="rules">
|
|
|
- <el-form-item label="品名" :label-width="formLabelWidth" prop="productId">
|
|
|
- <el-select v-model.number="initParam.productId" filterable remote reserve-keyword placeholder="品名"
|
|
|
- :remote-method="remoteMethod1" :loading="loading" clearable style="width: 100%;"
|
|
|
- @clear="initParam.productId = null" @click="click1">
|
|
|
- <el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="生产企业" :label-width="formLabelWidth" prop="enterpriseId">
|
|
|
- <el-select v-model.number="initParam.enterpriseId" filterable remote reserve-keyword placeholder="生产企业"
|
|
|
- :remote-method="remoteMethod2" :loading="loading" clearable style="width: 100%;"
|
|
|
- @clear="initParam.enterpriseId = null" @click="click2">
|
|
|
- <el-option v-for="item in options2" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="规格" :label-width="formLabelWidth" prop="specId">
|
|
|
- <el-select v-model.number="initParam.specId" filterable remote reserve-keyword placeholder="规格"
|
|
|
- :remote-method="remoteMethod3" :loading="loading" clearable style="width: 100%;"
|
|
|
- @clear="initParam.specId = null" @click="click3">
|
|
|
- <el-option v-for="item in options3" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="批号" :label-width="formLabelWidth" prop="batchNumber">
|
|
|
- <!-- <el-select v-model="initParam.batchNumber" class="m-2" placeholder="Select" style="width: 100%;">
|
|
|
- <el-option v-for="item in options5" :key="item" :label="item" :value="item" />
|
|
|
- </el-select> -->
|
|
|
- <el-autocomplete v-model="initParam.batchNumber" :fetch-suggestions="querySearch" clearable
|
|
|
- class="inputWidth" placeholder="批号" style="width: 100%;"/>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <template #footer>
|
|
|
- <span class="dialog-footer">
|
|
|
- <el-button @click="dialogFormVisible = false">Cancel</el-button>
|
|
|
- <el-button type="primary" @click="submitForm(ruleFormRef,'excel')">导出</el-button>
|
|
|
- <el-button type="primary" @click="submitForm(ruleFormRef,'pdf')">打印</el-button>
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- </el-dialog>
|
|
|
- <el-dialog v-model="dialogFormVisible1" title="运输登记表" :append-to-body="true" draggable width="30%">
|
|
|
- <el-form :model="initParamWord" ref="ruleFormRef1" :rules="rules1">
|
|
|
- <el-form-item label="出库日期" :label-width="formLabelWidth" prop="date">
|
|
|
- <el-date-picker v-model="initParamWord.date" type="date" value-format="YYYY-MM-DD" clearable
|
|
|
- style="width: 100%;" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="收货单位" :label-width="formLabelWidth" prop="receivingUnit">
|
|
|
- <!-- <el-select v-model.number="initParamWord.receivingUnit" filterable remote reserve-keyword placeholder="收货单位"
|
|
|
- :remote-method="remoteMethod4" :loading="loading" clearable style="width: 100%;"
|
|
|
- @clear="initParamWord.receivingUnit = null" @click="click4">
|
|
|
- <el-option v-for="item in options4" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
- </el-select> -->
|
|
|
-
|
|
|
- <el-autocomplete v-model="initParamWord.receivingUnit" :fetch-suggestions="querySearch1" clearable class="inputWidth"
|
|
|
- placeholder="收货单位" style="width: 100%;" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="品名" :label-width="formLabelWidth">
|
|
|
- <el-select v-model.number="initParamWord.productId" filterable remote reserve-keyword placeholder="品名"
|
|
|
- :remote-method="remoteMethod1" :loading="loading" clearable style="width: 100%;"
|
|
|
- @clear="initParamWord.productId = null" @click="click1">
|
|
|
- <el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
- <template #footer>
|
|
|
- <span class="dialog-footer">
|
|
|
- <el-button @click="dialogFormVisible1 = false">Cancel</el-button>
|
|
|
- <el-button type="primary" @click="submitForm1(ruleFormRef1,'word')">导出</el-button>
|
|
|
- <el-button type="primary" @click="submitForm1(ruleFormRef1,'pdf')">打印</el-button>
|
|
|
-
|
|
|
- </span>
|
|
|
- </template>
|
|
|
+ <el-dialog :destroy-on-close="true" v-model="dialogFormVisible" title="运输登记表" :append-to-body="true" draggable width="80%">
|
|
|
+ <div style="display: flex;justify-content: space-between;align-items: center;flex-wrap: wrap">
|
|
|
+ <div>
|
|
|
+ <el-form :model="initParam" ref="ruleFormRef" :inline="true">
|
|
|
+ <el-form-item label="出库日期" prop="date">
|
|
|
+ <el-date-picker v-model="initParam.date" :clearable='false' class="inputWidth" type="date" value-format="YYYY-MM-DD"
|
|
|
+ style="width: 100%;" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item label="收货单位" prop="receivingUnit">
|
|
|
+ <el-autocomplete v-model="initParam.receivingUnit" :fetch-suggestions="querySearch1"
|
|
|
+ class="inputWidth" placeholder="收货单位" style="width: 100%;" />
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item>
|
|
|
+ <el-button type="primary" icon="Search" @click="searchFn">搜索</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ <!-- <el-form-item label="品名" :label-width="formLabelWidth">
|
|
|
+ <el-select v-model.number="initParam.productId" filterable remote reserve-keyword placeholder="品名"
|
|
|
+ :remote-method="remoteMethod1" :loading="loading" clearable style="width: 100%;"
|
|
|
+ @clear="initParam.productId = null" @click="click1">
|
|
|
+ <el-option v-for="item in options1" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
+ </el-select>
|
|
|
+ </el-form-item> -->
|
|
|
+ </el-form>
|
|
|
+ </div>
|
|
|
+ <div style="max-width: 200px;margin-bottom: 18px;">
|
|
|
+ <el-button type="primary" @click="submitForm('word')">导出</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm('pdf')">打印</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <el-table :data="tableData" border style="margin-top: 40px;width: 100%"
|
|
|
+ @selection-change="handleSelectionChange">
|
|
|
+ <el-table-column type="selection" width="40" />
|
|
|
+ <el-table-column property="qrcode" label="条码" min-width="120" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column property="product_name" label="品种" width="120" show-overflow-tooltip />
|
|
|
+ <el-table-column property="enterprise_name" label="生产企业" width="120" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column property="approval_number" label="批准文号" min-width="120" show-overflow-tooltip />
|
|
|
+ <el-table-column property="qualification_number" label="批签发合格编号" min-width="150" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column property="spec_name" label="规格(剂/支或粒)" width="150" show-overflow-tooltip />
|
|
|
+ <el-table-column property="produced_date" label="生产日期" width="120" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column property="batch_number" label="批号" width="100" show-overflow-tooltip />
|
|
|
+ <el-table-column property="expiry_date" label="失效日期" width="110" show-overflow-tooltip></el-table-column>
|
|
|
+ <el-table-column property="quantity" label="数量" width="70" show-overflow-tooltip />
|
|
|
+ <el-table-column property="unit_name" label="单位" width="70" show-overflow-tooltip/>
|
|
|
+ <el-table-column property="date" label="出库日期" width="110" show-overflow-tooltip />
|
|
|
+ <el-table-column property="receiving_unit" label="收货单位" width="90" show-overflow-tooltip/>
|
|
|
+ </el-table>
|
|
|
</el-dialog>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { inventoryExcel, transportWord,stockunit } from "@/api";
|
|
|
-import { gradeName, enterpriseFun, stockunitFun, specification, LotNumber,shoubat } from "@/plugins/selectData";
|
|
|
+import {transportWord, transportrecordList } from "@/api";
|
|
|
+import { gradeName, enterpriseFun, stockunitFun, specification, LotNumber, shoubat } from "@/plugins/selectData";
|
|
|
import { reactive, ref, onMounted } from 'vue'
|
|
|
import { downPDF, downloadExcelFun } from "@/utils/download";
|
|
|
-import type { FormInstance } from 'element-plus'
|
|
|
+import type { FormInstance, ElTable } from 'element-plus'
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
+import { tableinterface,RuleForm,RuleForm1,ListItem,RestaurantItem,RuleFormdown} from "./js/interface";
|
|
|
const dialogFormVisible = ref(false)
|
|
|
-const dialogFormVisible1 = ref(false)
|
|
|
const ruleFormRef = ref<FormInstance>()
|
|
|
-const ruleFormRef1 = ref<FormInstance>()
|
|
|
-const formLabelWidth = '80px'
|
|
|
-const loading = ref(false)
|
|
|
-interface RuleForm {
|
|
|
- batchNumber: any,
|
|
|
- enterpriseId?: any,
|
|
|
- productId?: any,
|
|
|
- specId: any,
|
|
|
- type: string
|
|
|
-}
|
|
|
-const initParam = reactive<RuleForm>({//请求参数
|
|
|
- "batchNumber":'',
|
|
|
- "enterpriseId": null,
|
|
|
- "productId": null,
|
|
|
- "specId": null,
|
|
|
- "type": ''
|
|
|
-})
|
|
|
-interface RuleForm1 {
|
|
|
- date: any,
|
|
|
- receivingUnit?: any,
|
|
|
- productId?: any,
|
|
|
- type: string
|
|
|
+
|
|
|
+const multipleSelection:any = ref([])
|
|
|
+const handleSelectionChange = (val: any) => {
|
|
|
+ multipleSelection.value = val
|
|
|
+ let arrMap = [...val]
|
|
|
+ expinitParam.stockOutIds = arrMap.map(item=> item.stock_out_id )
|
|
|
}
|
|
|
-const initParamWord = reactive<RuleForm1>({//请求参数
|
|
|
+
|
|
|
+let tableData = ref([])
|
|
|
+const initParam = reactive<RuleForm1>({//请求参数
|
|
|
"date": null,
|
|
|
- "receivingUnit": '',
|
|
|
- "productId": null,
|
|
|
- "type": ''
|
|
|
+ "receivingUnit": ''
|
|
|
})
|
|
|
+//函数
|
|
|
+const searchFn = async ()=>{
|
|
|
+ const reslut:any = await transportrecordList(initParam)
|
|
|
+ if(reslut.code==200){
|
|
|
+ tableData.value = reslut.data.list || []
|
|
|
+ }
|
|
|
+ console.log('搜索',reslut)
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
const result1: any = await gradeName()//疫苗名称
|
|
|
const result2: any = await enterpriseFun()//生产企业
|
|
@@ -130,15 +100,8 @@ const findMap = (arr: any, obj: any) => {
|
|
|
return { value: obj == 'obj' ? item.id : item, label: obj == 'obj' ? item.name : item }
|
|
|
})
|
|
|
}
|
|
|
-interface ListItem {
|
|
|
- value: string
|
|
|
- label: string
|
|
|
-}
|
|
|
|
|
|
-const click1 = async () => { options1.value = list1.value }
|
|
|
-const click2 = async () => { options2.value = list2.value }
|
|
|
-const click3 = async () => { options3.value = list3.value }
|
|
|
-const click4 = async () => { options4.value = list4.value }
|
|
|
+
|
|
|
|
|
|
|
|
|
const list1 = ref<ListItem[]>([])//疫苗名称
|
|
@@ -147,99 +110,17 @@ const list3 = ref<ListItem[]>([])//收发货单位
|
|
|
const list4 = ref<ListItem[]>([])//收发货单位
|
|
|
|
|
|
|
|
|
-const options1 = ref<ListItem[]>([])
|
|
|
-const options2 = ref<ListItem[]>([])
|
|
|
-const options3 = ref<ListItem[]>([])
|
|
|
-const options4 = ref<ListItem[]>([])
|
|
|
|
|
|
|
|
|
|
|
|
-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) => {
|
|
|
- console.log('第一个', query, item)
|
|
|
- return item.label.toLowerCase().includes(query.toLowerCase())
|
|
|
- })
|
|
|
- }, 200)
|
|
|
- } else {
|
|
|
- options2.value = []
|
|
|
- }
|
|
|
-}
|
|
|
-const remoteMethod3 = async (query: string) => {
|
|
|
- if (query) {
|
|
|
- loading.value = true
|
|
|
- setTimeout(() => {
|
|
|
- loading.value = false
|
|
|
- options3.value = list3.value.filter((item: any) => {
|
|
|
- return item.label.toLowerCase().includes(query.toLowerCase())
|
|
|
- })
|
|
|
- }, 200)
|
|
|
- } else {
|
|
|
- options3.value = []
|
|
|
- }
|
|
|
-}
|
|
|
-const remoteMethod4 = async (query: string) => {
|
|
|
- if (query) {
|
|
|
- loading.value = true
|
|
|
- setTimeout(() => {
|
|
|
- loading.value = false
|
|
|
- options4.value = list4.value.filter((item: any) => {
|
|
|
- return item.label.toLowerCase().includes(query.toLowerCase())
|
|
|
- })
|
|
|
- }, 200)
|
|
|
- } else {
|
|
|
- options3.value = []
|
|
|
- }
|
|
|
-}
|
|
|
-//函数
|
|
|
-const showdialog = async ()=>{
|
|
|
- dialogFormVisible.value = true
|
|
|
- const reslut:any = await LotNumber()
|
|
|
- console.log('数据1',reslut)
|
|
|
- const arrMap = reslut
|
|
|
- const arr:any = []
|
|
|
- arrMap.forEach((item:any)=>{
|
|
|
- arr.push({ value: item, link: item})
|
|
|
- })
|
|
|
- restaurants.value = arr
|
|
|
- console.log('数据2',restaurants.value)
|
|
|
-}
|
|
|
-
|
|
|
-interface RestaurantItem {
|
|
|
- value: string
|
|
|
- link: string
|
|
|
-}
|
|
|
-const restaurants = ref<RestaurantItem[]>([])
|
|
|
-const querySearch = (queryString: string, cb: any) => {
|
|
|
- const results = queryString
|
|
|
- ? restaurants.value.filter(createFilter(queryString))
|
|
|
- : restaurants.value
|
|
|
- cb(results)
|
|
|
-}
|
|
|
|
|
|
|
|
|
const createFilter = (queryString: string) => {
|
|
|
- return (restaurant: RestaurantItem) => {
|
|
|
- return (
|
|
|
- restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
|
|
|
- )
|
|
|
- }
|
|
|
+ return (restaurant: RestaurantItem) => {
|
|
|
+ return (
|
|
|
+ restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0
|
|
|
+ )
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -247,62 +128,43 @@ const createFilter = (queryString: string) => {
|
|
|
|
|
|
|
|
|
//显示运输登记
|
|
|
-const showdialogdialog = async ()=>{
|
|
|
- dialogFormVisible1.value = true
|
|
|
- const reslut:any = await shoubat()
|
|
|
- console.log('数据1',reslut)
|
|
|
+const showdialogdialog = async () => {
|
|
|
+ dialogFormVisible.value = true
|
|
|
+ const reslut: any = await shoubat()
|
|
|
+ console.log('数据1', reslut)
|
|
|
const arrMap = reslut
|
|
|
- const arr:any = []
|
|
|
- arrMap.forEach((item:any)=>{
|
|
|
- arr.push({ value: item, link: item})
|
|
|
+ const arr: any = []
|
|
|
+ arrMap.forEach((item: any) => {
|
|
|
+ arr.push({ value: item, link: item })
|
|
|
})
|
|
|
- restaurants1.value = arr
|
|
|
- console.log('数据2',restaurants1.value)
|
|
|
+ restaurants.value = arr
|
|
|
}
|
|
|
-const restaurants1 = ref<RestaurantItem[]>([])
|
|
|
+const restaurants = ref<RestaurantItem[]>([])
|
|
|
const querySearch1 = (queryString: string, cb: any) => {
|
|
|
- const results = queryString
|
|
|
- ? restaurants1.value.filter(createFilter(queryString))
|
|
|
- : restaurants1.value
|
|
|
- cb(results)
|
|
|
+ const results = queryString
|
|
|
+ ? restaurants.value.filter(createFilter(queryString))
|
|
|
+ : restaurants.value
|
|
|
+ cb(results)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-const rules = reactive({
|
|
|
- batchNumber: [{ required: true, message: '必填项', trigger: 'change' }],
|
|
|
- enterpriseId: [{ required: true, message: '必填项', trigger: 'change' }],
|
|
|
- productId: [{ required: true, message: '必填项', trigger: 'change' }],
|
|
|
- specId: [{ required: true, message: '必填项', trigger: 'change' }],
|
|
|
-})
|
|
|
-const submitForm = async (formEl: FormInstance | undefined,ty:string) => {
|
|
|
- if (!formEl) return
|
|
|
- await formEl.validate(async (valid, fields) => {
|
|
|
- if (valid) {
|
|
|
- initParam.type = ty
|
|
|
- const result = await inventoryExcel(initParam)
|
|
|
- ty=='excel'?downloadExcelFun(result):downPDF(result)
|
|
|
- } else {
|
|
|
- console.log('error submit!', fields)
|
|
|
- }
|
|
|
- })
|
|
|
-}
|
|
|
-const rules1 = reactive({
|
|
|
- date: [{ required: true, message: '必填项', trigger: 'change' }],
|
|
|
- receivingUnit: [{ required: true, message: '必填项', trigger: 'change' }],
|
|
|
+let expinitParam:any = reactive<RuleFormdown>({
|
|
|
+ "stockOutIds": [],
|
|
|
+ "type": ''
|
|
|
})
|
|
|
-const submitForm1 = async (formEl: FormInstance | undefined,ty:any) => {
|
|
|
- if (!formEl) return
|
|
|
- await formEl.validate(async (valid, fields) => {
|
|
|
- if (valid) {
|
|
|
- initParamWord.type = ty
|
|
|
- const result:any = await transportWord(initParamWord)
|
|
|
-
|
|
|
- console.log('result',result,ty)
|
|
|
- ty=='word'?downloadExcelFun(result):downPDF(result)
|
|
|
- } else {
|
|
|
- console.log('error submit!', fields)
|
|
|
- }
|
|
|
- })
|
|
|
+const submitForm = async ( ty: any) => {
|
|
|
+ const b = Object.values(initParam).some(item => item==null || item=='')
|
|
|
+ console.log('b',b)
|
|
|
+ if(b){
|
|
|
+ ElMessage.error('请选择出库日期跟收货单位')
|
|
|
+ return
|
|
|
+ }else{
|
|
|
+ expinitParam.type = ty
|
|
|
+ expinitParam = {...expinitParam,...initParam}
|
|
|
+ const result: any = await transportWord(expinitParam)
|
|
|
+ console.log('result', result, ty)
|
|
|
+ ty == 'word' ? downloadExcelFun(result) : downPDF(result)
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
</script>
|
|
|
<style lang="scss">
|