|
@@ -1,205 +1,211 @@
|
|
|
<!-- 扫码 -->
|
|
|
<template>
|
|
|
<div class="">
|
|
|
- <el-button el-button type="primary" icon="Camera" @click="showDia">出库</el-button>
|
|
|
- <el-dialog v-model="dialogFormVisible" title="出库" :append-to-body="true" :before-close="closeFun" draggable :close-on-click-modal="false" :close-on-press-escape="false" width="60%">
|
|
|
- <el-form ref="ruleFormRef" :rules="rules" :model="initParam" :inline="true">
|
|
|
- <el-divider content-position="center">药品信息</el-divider>
|
|
|
- <el-form-item :label="item.name" :label-width="formLabelWidth" v-for="(item,index) in data.showDiaData" :key="index" :prop="'medicineInfo.'+item.field_name">
|
|
|
- <el-select v-model="initParam.medicineInfo[item.field_name]" :placeholder="'请选择'+item.name" class="inputWidth" v-if="[1,2,3,4,5].includes(item.type)">
|
|
|
- <el-option :label="itemIt.name" :value="itemIt.id" v-for="itemIt,i in item.list" :key="i"/>
|
|
|
- </el-select>
|
|
|
- <el-input v-model="initParam.medicineInfo[item.field_name]" autocomplete="off" :placeholder="'请输入'+item.name" class="inputWidth" v-if="item.type==6"/>
|
|
|
- <el-input v-model="initParam.medicineInfo[item.field_name]" autocomplete="off" :placeholder="'请输入'+item.name" class="inputWidth" v-if="item.type==7"/>
|
|
|
- <el-input v-model="initParam.medicineInfo[item.field_name]" autocomplete="off" :placeholder="'请输入'+item.name" class="inputWidth" v-if="item.type==8"/>
|
|
|
- <el-date-picker v-model="initParam.medicineInfo[item.field_name]" type="date" value-format="YYYY-MM-DD" :placeholder="'请输入'+item.name" clearable style="width: 200px;" v-if="item.type==9"/>
|
|
|
- <el-date-picker v-model="initParam.medicineInfo[item.field_name]" type="datetime" value-format="YYYY-MM-DD HH:mm:ss" :placeholder="'请输入'+item.name" clearable style="width: 200px;" v-if="item.type==10"/>
|
|
|
- </el-form-item>
|
|
|
- <el-divider content-position="center">出库信息</el-divider>
|
|
|
- <el-form-item class="el-form-item-main" label="数量" :label-width="formLabelWidth" prop="quantity">
|
|
|
- <el-input v-model.number="initParam.quantity" autocomplete="off" class="inputWidth" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item class="el-form-item-main" label="销售单价" :label-width="formLabelWidth">
|
|
|
- <el-input v-model="initParam.unitPrice" autocomplete="off" class="inputWidth"/>
|
|
|
- </el-form-item>
|
|
|
- <el-form-item class="el-form-item-main" label="出库日期" :label-width="formLabelWidth" prop="date">
|
|
|
- <el-date-picker v-model="initParam.date" type="date" placeholder="出库日期" value-format="YYYY-MM-DD" clearable style="width: 200px;" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item class="el-form-item-main" label="收货单位" :label-width="formLabelWidth">
|
|
|
- <el-autocomplete v-model="initParam.forwardingUnit" :fetch-suggestions="querySearch1" clearable class="inputWidth"
|
|
|
- placeholder="收货单位" />
|
|
|
- </el-form-item>
|
|
|
- <el-form-item label="经办人" :label-width="formLabelWidth" prop="operator">
|
|
|
- <!-- <el-select v-model="initParam.operator" placeholder="请选择经办人" class="inputWidth">
|
|
|
- <el-option :label="it" :value="it" v-for="(it,j) in data.itemOpen" :key="j+Math.random()" />
|
|
|
- </el-select> -->
|
|
|
- <el-autocomplete v-model="initParam.operator" :fetch-suggestions="querySearch" clearable class="inputWidth"
|
|
|
- placeholder="经办人" />
|
|
|
- </el-form-item>
|
|
|
- </el-form>
|
|
|
+ <el-button el-button type="primary" icon="Camera" @click="showDia">扫码出库</el-button>
|
|
|
+ <el-dialog v-model="dialogFormVisible" title="扫码出库" :append-to-body="true" draggable :close-on-click-modal="false"
|
|
|
+ :close-on-press-escape="false" width="95%">
|
|
|
+ <inputSearch ref="inputSearchRef" style="margin:0 auto 40px auto;" @inputSearchData="inputSearchfn"></inputSearch>
|
|
|
+ <el-table :data="data.tableData" style="width: 100%" border height="450" :row-class-name="tableRowClassName">
|
|
|
+ <el-table-column :label="item.label" v-for="item, i in data.columns" :key="i" min-width="110" show-overflow-tooltip>
|
|
|
+ <template #default="scope"><!--scope.row.medicineInfo[item.prop] -->
|
|
|
+ {{ findFun(scope.row.medicineInfo[item.prop], item.list) }}
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column :label="item.label" min-width="150" v-for="item,index in scanCodeTableOut" :key="index"
|
|
|
+ :fixed="item.prop == 'operation'&&'right'">
|
|
|
+ <template #default="scope">
|
|
|
+ <el-input v-if="['quantity','unitPrice','operator'].includes(item.prop)" v-model="scope.row[item.prop]" style="width: 100px;"/>
|
|
|
+ <el-date-picker v-if="item.prop == 'date'" v-model="scope.row[item.prop]" type="date" value-format="YYYY-MM-DD" style="width: 120px;"/>
|
|
|
+ <el-autocomplete v-if="item.prop == 'receivingUnit'" v-model="scope.row[item.prop]"
|
|
|
+ :fetch-suggestions="querySearch1" clearable style="width: 120px;" />
|
|
|
+ <el-button v-if="item.prop == 'operation'" type="danger" :icon="Delete" @click="deltable(scope.$index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </el-table>
|
|
|
<template #footer>
|
|
|
<span class="dialog-footer">
|
|
|
- <el-button type="primary" @click="submitForm(ruleFormRef)">加入暂存</el-button>
|
|
|
- <el-button @click="showinnerVisible">查看暂存</el-button>
|
|
|
- <el-button type="danger" @click="resetForm(ruleFormRef)">重置数据</el-button>
|
|
|
+ <el-button @click="dialogFormVisible = false">关闭</el-button>
|
|
|
+ <el-button type="danger" @click="resetForm">重置数据</el-button>
|
|
|
+ <el-button type="primary" :disabled="data.tableData.length==0?true:false" @click="subStock">立即出库</el-button>
|
|
|
</span>
|
|
|
</template>
|
|
|
- <el-dialog v-model="innerVisible" title="出库数据" width="95%" append-to-body draggable :close-on-click-modal="false" :close-on-press-escape="false">
|
|
|
- <el-table :data="data.tableData" style="width: 100%" border max-height="450" :header-cell-style="{'background-color':'#ccc','color': 'white'}">
|
|
|
- <el-table-column :label="item.label" v-for="item,i in data.columns" :key="i" min-width="110" show-overflow-tooltip>
|
|
|
- <template #default="scope"><!--scope.row.medicineInfo[item.prop] -->
|
|
|
- {{ findFun(scope.row.medicineInfo[item.prop],item.list)}}
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column prop="quantity" label="数量" min-width="110" show-overflow-tooltip/>
|
|
|
- <el-table-column prop="unitPrice" label="购进单价" min-width="110" show-overflow-tooltip/>
|
|
|
- <el-table-column prop="forwardingUnit" label="收货单位" min-width="110" show-overflow-tooltip/>
|
|
|
- <el-table-column prop="date" label="出库日期" min-width="110" show-overflow-tooltip/>
|
|
|
- <el-table-column prop="operator" label="经办人" min-width="110" show-overflow-tooltip/>
|
|
|
-
|
|
|
- <el-table-column fixed="right" label="操作" min-width="110">
|
|
|
- <template #default="scope">
|
|
|
- <el-button type="primary" :icon="Edit" @click="handleClick(scope.row,scope.$index)" circle />
|
|
|
- <el-button type="danger" :icon="Delete" @click="delClick(scope.$index)" circle />
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </el-table>
|
|
|
- <template #footer>
|
|
|
- <span class="dialog-footer">
|
|
|
- <el-button @click="innerVisible = false">关闭</el-button>
|
|
|
- <el-button type="primary" @click="subStock">立即出库</el-button>
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- </el-dialog>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
-import { reactive, ref } from 'vue'
|
|
|
-import type { FormInstance, FormRules} from 'element-plus'
|
|
|
-import { ElNotification} from 'element-plus'
|
|
|
-import { syrulesData,columnsTable } from "@/plugins/rulesData";
|
|
|
+import { reactive, ref,nextTick,watch, onMounted} from 'vue'
|
|
|
+import inputSearch from "./inputSearch.vue";
|
|
|
+import { scanCodeTableOut } from "@/plugins/rulesData";
|
|
|
const dialogFormVisible = ref(false)
|
|
|
-const ruleFormRef = ref<FormInstance>()
|
|
|
-
|
|
|
-let rules:any = reactive({})
|
|
|
-
|
|
|
+watch(() => dialogFormVisible.value, (dy: any) => {
|
|
|
+ if(!dy)resetForm()
|
|
|
+})
|
|
|
+const inputSearchRef = ref<InstanceType<typeof inputSearch> | null>(null)
|
|
|
import {
|
|
|
- medicListStockOut,
|
|
|
- stockunit,//发货单位
|
|
|
- operatorList,//经办人
|
|
|
- stockTemplateIn,//单个出库
|
|
|
- stockTemplateBatchOut,//批量出库
|
|
|
+ stockunit,//收发货单位
|
|
|
+ stockCodeOut
|
|
|
} from "@/api";
|
|
|
-const innerVisible = ref(false)
|
|
|
-import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
-import {Delete,Edit,} from '@element-plus/icons-vue'
|
|
|
-const formLabelWidth = '110px'
|
|
|
-
|
|
|
-let initParam:any = reactive({
|
|
|
+import { ElMessage } from 'element-plus'
|
|
|
+import { Delete} from '@element-plus/icons-vue'
|
|
|
+import { syrulesData } from "@/plugins/rulesData";
|
|
|
+import { timesFn } from "@/plugins/settime";
|
|
|
+import {
|
|
|
+ medicListScanCode,
|
|
|
+ medicMsfx
|
|
|
+} from "@/api";
|
|
|
+let data: any = reactive({
|
|
|
+ tableData: [],
|
|
|
+ showDiaData: [],
|
|
|
+ itemPir: [],
|
|
|
+ rules1: {},
|
|
|
+ columns: [],// 渲染表格
|
|
|
+ selectType: [],//表格的下拉对应
|
|
|
+ editStrot: false,
|
|
|
+ editIndex: null,
|
|
|
+ qr:''
|
|
|
+})
|
|
|
+let initParam: any = reactive({
|
|
|
"date": "",
|
|
|
- "forwardingUnit": "",
|
|
|
+ "receivingUnit": "",
|
|
|
"medicineInfo": {},
|
|
|
- "operator":'',
|
|
|
- "quantity": null,
|
|
|
- "unitPrice":null
|
|
|
+ "operator": '',
|
|
|
+ "quantity": '',
|
|
|
+ "unitPrice": null
|
|
|
})
|
|
|
-let data:any = reactive({
|
|
|
- tableData:[],
|
|
|
- showDiaData:[],
|
|
|
- itemPir:[],
|
|
|
- itemOpen:[],
|
|
|
- rules1:{},
|
|
|
- columns:[],// 渲染表格
|
|
|
- selectType:[],//表格的下拉对应
|
|
|
- editStrot:false,
|
|
|
- editIndex:null
|
|
|
-})
|
|
|
-const emit:any = defineEmits(['scanCode'])
|
|
|
-//立即出库
|
|
|
-const subStock = async ()=>{
|
|
|
- const reslut:any = await stockTemplateBatchOut({"stockOutList": data.tableData})
|
|
|
- console.log('返回',reslut)
|
|
|
- if(reslut.code==200 && reslut.msg=='出库成功'){
|
|
|
- ElMessage.success(reslut.msg)
|
|
|
- dialogFormVisible.value = false
|
|
|
- innerVisible.value = false
|
|
|
- emit('scanCode', '')
|
|
|
- data.tableData = []
|
|
|
+
|
|
|
+/**
|
|
|
+ * 当前搜索到的样式
|
|
|
+ * @param param0
|
|
|
+ */
|
|
|
+const tableRowClassName = ({rowIndex}: {
|
|
|
+ rowIndex: number
|
|
|
+}) => {
|
|
|
+ if(data.qr){
|
|
|
+ const i = data.tableData.findIndex((item:any) => item.Qrcode==data.qr)
|
|
|
+ if (rowIndex==i) { return 'success-row' }else{return ''}
|
|
|
+ }else{
|
|
|
+ return ''
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+let rules: any = reactive({})
|
|
|
+const showDia = async () => {
|
|
|
+ dialogFormVisible.value = true
|
|
|
+ medicListStockFun()//获取入库表单
|
|
|
+ itemPirFun()
|
|
|
+ nextTick(()=>{
|
|
|
+ console.log('inputSearchRef',inputSearchRef.value)
|
|
|
+ inputSearchRef.value?.inputFocus()
|
|
|
+ })
|
|
|
+}
|
|
|
//函数
|
|
|
-const findFun = (data:any,list:any)=>{
|
|
|
- if(list){
|
|
|
- const b = list.find((item:any) => item.id==data)
|
|
|
- if(b) return b.name
|
|
|
+const findFun = (data: any, list: any) => {
|
|
|
+ if (list) {
|
|
|
+ const b = list.find((item: any) => item.id == data)
|
|
|
+ if (b) return b.name
|
|
|
else return ''
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return data
|
|
|
}
|
|
|
}
|
|
|
-const resetForm = (formEl: FormInstance | undefined) => {
|
|
|
- if (!formEl) return
|
|
|
- formEl.resetFields()
|
|
|
+
|
|
|
+//获取入库表单Api
|
|
|
+const medicListStockFun = async () => {
|
|
|
+ data.columns = []
|
|
|
+ const reslut: any = await medicListScanCode({})
|
|
|
+ console.log('表格', reslut)
|
|
|
+ if (reslut.code == 200 && reslut.msg == '查询成功') {
|
|
|
+ data.showDiaData = reslut.data?.list
|
|
|
+ data.rules1 = {}
|
|
|
+ data.columns = []
|
|
|
+ reslut.data?.list.forEach((value: any) => { //value设置成key
|
|
|
+ data.columns.push({ prop: value.field_name, label: value.name, list: value.list })
|
|
|
+ initParam.medicineInfo[value.field_name] = ''; // 这里可以根据需要设置其他值作为键的内容
|
|
|
+ });
|
|
|
+ Object.assign(rules, { ...data.rules1, ...syrulesData })
|
|
|
+ dialogFormVisible.value = true
|
|
|
+ }
|
|
|
}
|
|
|
-//加入暂存区
|
|
|
-const submitForm = async (formEl: FormInstance | undefined) => {
|
|
|
- if (!formEl) return
|
|
|
- await formEl.validate((valid, fields) => {
|
|
|
- if (valid) {
|
|
|
- ElNotification({
|
|
|
- title: '暂存成功',
|
|
|
- message: 'ok,加入暂存成功,右下角按钮查看/提交暂存',
|
|
|
- type: 'success',
|
|
|
+const emit: any = defineEmits(['scanCode'])
|
|
|
+const subStock = async ()=>{
|
|
|
+ const ab = data.tableData.every((item:any) => item.quantity != '' && item.operator != '' && item.date != '')
|
|
|
+ if(!ab){ElMessage.error('缺少数据提示:【数量】、【经办人】、【出库日期】是必填项哦!');return;}
|
|
|
+ else{
|
|
|
+ const arr = [...data.tableData]
|
|
|
+ arr.forEach((item:any)=>{
|
|
|
+ item.quantity = Number(item.quantity)
|
|
|
+ item.unitPrice = Number(item.unitPrice)
|
|
|
+
|
|
|
})
|
|
|
- console.log('提交',data.editStrot)
|
|
|
- if(data.editStrot){//编辑状态
|
|
|
- let {date,forwardingUnit,operator,quantity,unitPrice,medicineInfo} = initParam
|
|
|
- data.tableData.splice(data.editIndex,1,{date,forwardingUnit,operator,quantity,unitPrice:unitPrice,medicineInfo:{...medicineInfo}})
|
|
|
- console.log('编辑状态',data.tableData)
|
|
|
- }else{//正常添加
|
|
|
- let {date,forwardingUnit,operator,quantity,unitPrice,medicineInfo} = initParam
|
|
|
- data.tableData.push({date,forwardingUnit,operator,quantity,unitPrice:unitPrice,medicineInfo:{...medicineInfo}})
|
|
|
- console.log('正常添加',data.tableData)
|
|
|
+ const reslut:any = await stockCodeOut({stockOutList:arr})
|
|
|
+ console.log('添加成功')
|
|
|
+ if(reslut.code==200){
|
|
|
+ ElMessage.success(reslut.msg)
|
|
|
+ dialogFormVisible.value = false
|
|
|
+ emit('scanCode', '')
|
|
|
}
|
|
|
- } else {
|
|
|
- ElMessage.error('请完善必填项')
|
|
|
}
|
|
|
- })
|
|
|
}
|
|
|
-
|
|
|
-//函数
|
|
|
-const closeFun = async () => {
|
|
|
- if(data.tableData.length==0){
|
|
|
- dialogFormVisible.value = false
|
|
|
- data.tableData = []
|
|
|
- }else{
|
|
|
- ElMessageBox.confirm('请检查录入数据是否已经提交,该操作将放弃出库信息,是否放弃?', '提示', {
|
|
|
- confirmButtonText: '立即出库',
|
|
|
- cancelButtonText: '放弃数据',
|
|
|
- type: 'warning',
|
|
|
- draggable: true,
|
|
|
- center: true,
|
|
|
- }).then(() => {
|
|
|
- innerVisible.value = true
|
|
|
- }).catch(() => {
|
|
|
- dialogFormVisible.value = false
|
|
|
- ElMessage.success('已放弃出库数据')
|
|
|
- })
|
|
|
+/**
|
|
|
+ * 搜索
|
|
|
+ * @param e 追溯码
|
|
|
+ */
|
|
|
+const inputSearchfn = async (e:any)=>{
|
|
|
+ data.qr = e
|
|
|
+ const j = await SearchFind(e)
|
|
|
+ if (j) {ElMessage.error('提示:重复扫描添加数据了哦');return}
|
|
|
+ const reslut:any = await medicMsfx({code:e})
|
|
|
+ let initParamObj = {...initParam}
|
|
|
+ initParamObj.Qrcode = e
|
|
|
+ if (reslut.code==200 && reslut.msg=='查询成功') {
|
|
|
+ initParamObj.medicineInfo = reslut.data[0] || {}
|
|
|
+ initParamObj.date = timesFn()
|
|
|
+ data.tableData.push(initParamObj)
|
|
|
+ inputSearchRef.value?.inputFocus()
|
|
|
}
|
|
|
}
|
|
|
+/**
|
|
|
+ * 筛选是否已经扫描过
|
|
|
+ * @param j 追溯码
|
|
|
+ */
|
|
|
+const SearchFind = (j:any)=>{
|
|
|
+ return new Promise(resolve=>{
|
|
|
+ const ab = data.tableData.find((item:any) => item.Qrcode==j)
|
|
|
+ ab==undefined?resolve(false):resolve(true)
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 删除
|
|
|
+ * @param index
|
|
|
+ */
|
|
|
+const deltable = async (index:any)=>{
|
|
|
+ data.tableData.splice(index,1)
|
|
|
+ nextTick(()=>{
|
|
|
+ inputSearchRef.value?.inputFocus()
|
|
|
+ })
|
|
|
+}
|
|
|
+
|
|
|
+//收发货单位
|
|
|
+const itemPirFun = async () => {
|
|
|
+ const reslut: any = await stockunit({ type: 2 })
|
|
|
+ const arrMap = reslut.data?.list
|
|
|
+ const arr:any = []
|
|
|
+ arrMap.forEach((item:any)=>{
|
|
|
+ arr.push({ value: item, link: item})
|
|
|
+ })
|
|
|
+ restaurants1.value = arr
|
|
|
+}
|
|
|
interface RestaurantItem {
|
|
|
value: string
|
|
|
link: string
|
|
|
}
|
|
|
-const restaurants = ref<RestaurantItem[]>([])
|
|
|
-const querySearch = (queryString: string, cb: any) => {
|
|
|
+const restaurants1 = ref<RestaurantItem[]>([])
|
|
|
+const querySearch1 = (queryString: string, cb: any) => {
|
|
|
const results = queryString
|
|
|
- ? restaurants.value.filter(createFilter(queryString))
|
|
|
- : restaurants.value
|
|
|
+ ? restaurants1.value.filter(createFilter(queryString))
|
|
|
+ : restaurants1.value
|
|
|
cb(results)
|
|
|
}
|
|
|
const createFilter = (queryString: string) => {
|
|
@@ -209,119 +215,23 @@ const createFilter = (queryString: string) => {
|
|
|
)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-const restaurants1 = ref<RestaurantItem[]>([])
|
|
|
-const querySearch1 = (queryString: string, cb: any) => {
|
|
|
- const results = queryString
|
|
|
- ? restaurants1.value.filter(createFilter(queryString))
|
|
|
- : restaurants1.value
|
|
|
- cb(results)
|
|
|
-}
|
|
|
-//收发货单位
|
|
|
-const itemPirFun = async()=>{
|
|
|
- const reslut:any = await stockunit({ type: 3 })
|
|
|
- const arrMap = reslut.data?.list
|
|
|
- const arr:any = []
|
|
|
- arrMap.forEach((item:any)=>{
|
|
|
- arr.push({ value: item, link: item})
|
|
|
- })
|
|
|
- restaurants1.value = arr
|
|
|
-}
|
|
|
-//经办人Api
|
|
|
-const operatorListApi = async()=>{
|
|
|
- const reslut:any = await operatorList({})
|
|
|
- const arrMap = reslut.data?.list
|
|
|
- const arr:any = []
|
|
|
- arrMap.forEach((item:any)=>{
|
|
|
- arr.push({ value: item, link: item})
|
|
|
- })
|
|
|
- restaurants.value = arr
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-//函数
|
|
|
-const showinnerVisible = async ()=>{
|
|
|
- innerVisible.value = true
|
|
|
- data.editStrot = false
|
|
|
- console.log(data.tableData)
|
|
|
-}
|
|
|
-
|
|
|
-const showDia = async ()=>{
|
|
|
+/**
|
|
|
+ * 重置
|
|
|
+ */
|
|
|
+const resetForm = async ()=>{
|
|
|
data.tableData = []
|
|
|
- data.showDiaData = []
|
|
|
- data.itemPir = []
|
|
|
- data.itemOpen = []
|
|
|
- data.rules1 = []
|
|
|
- data.columns = []
|
|
|
- data.selectType = []
|
|
|
- data.editStrot = false
|
|
|
- resetFun()//复原表单
|
|
|
-
|
|
|
- medicListStockFun()//获取出库表单
|
|
|
- itemPirFun()//发货单位
|
|
|
- operatorListApi()//经办人
|
|
|
-}
|
|
|
-//复原表单
|
|
|
-const resetFun = async ()=>{
|
|
|
- initParam.date = ''
|
|
|
- initParam.forwardingUnit = ''
|
|
|
- initParam.medicineInfo = {}
|
|
|
- initParam.operator = ''
|
|
|
- initParam.quantity = null
|
|
|
- initParam.unitPrice = null
|
|
|
- resetForm(ruleFormRef.value)
|
|
|
-}
|
|
|
-//获取出库表单Api
|
|
|
-const medicListStockFun = async ()=>{
|
|
|
- data.columns = []
|
|
|
- const reslut:any = await medicListStockOut({})
|
|
|
- if(reslut.code==200 && reslut.msg=='查询成功'){
|
|
|
- data.showDiaData = reslut.data?.list
|
|
|
- data.rules1 = {}
|
|
|
- data.columns = []
|
|
|
- data.selectType = []
|
|
|
- reslut.data?.list.forEach((value:any) => { //value设置成key
|
|
|
- data.selectType.push({type:value.type,list:value.list})
|
|
|
- data.columns.push({ prop: value.field_name, label: value.name, list:value.list})
|
|
|
- initParam.medicineInfo[value.field_name] = ''; // 这里可以根据需要设置其他值作为键的内容
|
|
|
- if(['product_id','enterprise_id','spec_id','batch_number','expiry_date','approval_number'].includes(value.field_name)){
|
|
|
- if(value.type==6){
|
|
|
- data.rules1['medicineInfo.'+value.field_name] = [{required: true,message: '必填项',trigger: 'change'}]
|
|
|
- }else if(value.type==7){
|
|
|
- data.rules1['medicineInfo.'+value.field_name] = [{required: true,message: '必填项',trigger: 'change'},{ pattern: /^(?:[1-9]\d*)$/, message: '请输入正整数', trigger: "blur" },]
|
|
|
- }else{
|
|
|
- data.rules1['medicineInfo.'+value.field_name] = [{required: true,message: '必填项',trigger: 'change',}]
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- Object.assign(rules,{...data.rules1,...syrulesData})
|
|
|
- console.log('表格', data.selectType)
|
|
|
- dialogFormVisible.value = true
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-const handleClick = (datas:any,index:any) => {
|
|
|
- data.editStrot = true
|
|
|
- data.editIndex = index
|
|
|
- let {date,forwardingUnit,operator,quantity,unitPrice,medicineInfo} = datas
|
|
|
- Object.assign(initParam,{date,forwardingUnit,operator,quantity,unitPrice,medicineInfo:{...medicineInfo}})
|
|
|
- innerVisible.value = false
|
|
|
-}
|
|
|
-const delClick = (index:any) => {
|
|
|
- ElMessageBox.confirm('删除一条信息,是否继续?','删除',{
|
|
|
- confirmButtonText: '确认删除',
|
|
|
- cancelButtonText: 'Cancel',
|
|
|
- type: 'warning',
|
|
|
- center: true,
|
|
|
- }).then(() => {
|
|
|
- data.tableData.splice(index, 1);
|
|
|
- ElMessage.success('已删除')
|
|
|
- })
|
|
|
+ inputSearchRef?.value?.ClearFn()
|
|
|
+ inputSearchRef.value?.inputFocus()
|
|
|
}
|
|
|
-
|
|
|
</script>
|
|
|
<style lang="scss">
|
|
|
.inputWidth {
|
|
|
width: 200px;
|
|
|
}
|
|
|
+.el-table .warning-row {
|
|
|
+ --el-table-tr-bg-color: var(--el-color-warning-light-9);
|
|
|
+}
|
|
|
+.el-table .success-row {
|
|
|
+ --el-table-tr-bg-color: var(--el-color-success-light-9);
|
|
|
+}
|
|
|
</style>
|