This commit is contained in:
ChenQiuYu 2025-04-25 16:05:28 +08:00
parent e1ead5394f
commit 570a0962f8
5 changed files with 108 additions and 103 deletions

View File

@ -1,6 +1,5 @@
<template>
<div class="edit-panel" v-loading="isLoading" element-loading-text="正在保存......">
<div class="top">
<el-form :model="inventory_order_data" :rules="formRules" ref="orderForm">
<el-descriptions title="采购订单" border>
@ -149,6 +148,7 @@ import Mask from "@/components/common/Mask.vue";
import {ElMessage} from "element-plus";
import GoodsSearch from "@/components/inventory/GoodsSearch.vue";
import CloseBtn from "@/components/CloseBtn.vue";
const orderForm = ref()
const formRules = ref({
shippingCode: [{required: true, message: '请输入货单号', trigger: 'blur'}],
@ -171,20 +171,22 @@ let inventory_order_data = ref({
const checkProductionDate = (row: any) => {
if (!row.productionDate) {
ElMessage.error('生产日期不能为空');
return;
return false;
}
const productionDate = new Date(row.productionDate);
const currentDate = new Date();
if (productionDate > currentDate) {
ElMessage.error('生产日期不能晚于当前日期');
row.productionDate = null; //
return false;
}
return true;
};
const checkExpiryDate = (row: any) => {
if (!row.expiryDate) {
ElMessage.error('有效期不能为空');
return;
return false;
}
const productionDate = new Date(row.productionDate);
const expiryDate = new Date(row.expiryDate);
@ -193,10 +195,13 @@ const checkExpiryDate = (row: any) => {
if (expiryDate <= currentDate) {
ElMessage.error('有效期不能早于当前日期');
row.expiryDate = null; //
return false;
} else if (expiryDate <= productionDate) {
ElMessage.error('有效期必须晚于生产日期');
row.expiryDate = null; //
return false;
}
return true;
};
const isLoading = ref(false)
@ -239,19 +244,22 @@ let confirm = async () => {
}
//
table_list.value.forEach((item: any) => {
checkProductionDate(item)
checkExpiryDate(item);
});
for (let i = 0; i < table_list.value.length; i++) {
if (!checkProductionDate(table_list.value[i])) {
return
}
if (!checkExpiryDate(table_list.value[i])) {
return
}
}
let data = {
inventoryOrder: JSON.parse(JSON.stringify(inventory_order_data.value)),
inventoryOrderGoodsList: JSON.parse(JSON.stringify(table_list.value))
}
isLoading.value = true
post("inventory/order/create", data).then((res: any) => {
exit()
isLoading.value = true
})
} catch (error) {
@ -375,6 +383,7 @@ onMounted(() => {
right: 10px;
bottom: 10px;
}
.error {
background-color: #F00;
}

View File

@ -9,69 +9,56 @@
show-word-limit
:autosize="{ minRows: 8, maxRows: 20 }"
type="textarea"
@input="parsing"
/>
<div class="btn">
<el-button type="primary" @click="save">保存</el-button>
</div>
</el-form>
<el-descriptions title="解析后的数据" size="small" :column="2" border v-if="flag">
<el-descriptions-item
align="center"
label="定点机构编码"
:span="2"
>
{{ decryptedText.fixmedinsCode }}
</el-descriptions-item>
<el-descriptions title="解析后的数据" size="small" :column="2" border>
<!-- <el-descriptions-item-->
<!-- align="center"-->
<!-- label="定点机构编码"-->
<!-- :span="2"-->
<!-- >-->
<!-- {{ decryptedText.fixmedinsCode }}-->
<!-- </el-descriptions-item>-->
<el-descriptions-item
align="center"
label="证书创建时间"
>
{{ decryptedText.createDate }}
{{ formatDate(decryptedText.createDate) }}
</el-descriptions-item>
<el-descriptions-item
align="center"
label="证书过期时间"
>
{{ decryptedText.expiryDate }}
{{ formatDate(decryptedText.expiryDate) }}
</el-descriptions-item>
</el-descriptions>
</div>
</template>
<script setup lang="ts">
import {post} from "@/utils/request.ts";
import {onMounted, onUnmounted, ref} from "vue";
import {onMounted, ref} from "vue";
import {ElMessage} from "element-plus";
import {formatDate} from "@/utils/dateUtils.ts";
const decryptedText = ref<any>({})
const ciphertext = ref<string>('')
const flag = ref<any>(false)
const parsing = () => {
if (ciphertext.value) {
post("common/config/parsing", {ciphertext: ciphertext.value}).then((res: any) => {
decryptedText.value = res;
flag.value = true;
})
} else {
flag.value = false;
}
}
const ciphertext = ref<any>('')
const save = () => {
if (ciphertext.value) {
post("common/config/setcert", {encryptedText: ciphertext.value}).then((res: any) => {
post("common/auth/set", {ciphertext: ciphertext.value}).then(() => {
ElMessage.success("保存成功")
init()
})
}
}
const get = () => {
const init = async () => {
ciphertext.value=await post("common/auth/get");
decryptedText.value=await post("common/auth/check");
}
onMounted(async () => {
post("common/config/get", {key: 'common_cert'}).then((res: any) => {
ciphertext.value = res.val;
parsing()
})
await init()
})

View File

@ -67,7 +67,7 @@ const showAuth = () => {
</div>
</div>
</div>
<Mask :is-show="isShowAuth" @close="isShowAuth=false" :width="600" :height="600" title="授权">
<Mask :is-show="isShowAuth" @close="isShowAuth=false" :width="600" :height="450" title="授权">
<Auth></Auth>
</Mask>
</template>

View File

@ -32,10 +32,10 @@
</div>
</div>
<Mask :width="1200" :height="500" :is-show="showAdd" :top="100" @close="showAdd = false">
<Add @close="showAdd = false"/>
<Add @close="showAdd = false;getCheck()"/>
</Mask>
<Mask :width="1200" :height="500" :is-show="showDetail" :top="100" @close="showDetail = false">
<Detail :id="id" @close="showDetail = false"/>
<Detail :id="id" @close="showDetail = false;getCheck()"/>
</Mask>
</template>
<script setup lang="ts">

View File

@ -46,7 +46,8 @@
/>
</div>
</div>
<Mask :width="1200" :height="700" :top="100" :is-show="is_add" @close="is_add=false" :title="open_code?'编辑':'新增'">
<Mask :width="1200" :top="100" :is-show="is_add" @close="is_add=false"
:title="open_code?'编辑':'新增'">
<AddOrder v-if="!open_code" @close="closeAddOrder"/>
<EditOrder v-else :code="open_code" @close="is_add=false" @updateOrderDetail="init"/>
</Mask>
@ -70,8 +71,12 @@ onMounted(() => {
init()
})
let open_add = (row: any) => {
open_code.value = row.code
is_add.value = true
if (row!=null) {
open_code.value = row.code
}else{
open_code.value = null
}
}
@ -112,6 +117,7 @@ const formatDate = (isoStr: any) => {
</script>
<style scoped lang="scss">
@use "@/assets/scss/base.scss";
.container-wrapper {
box-sizing: border-box;
padding: 24px;
@ -119,12 +125,14 @@ const formatDate = (isoStr: any) => {
display: flex;
flex-direction: column;
height: 100%;
.content_list {
width: 100%;
flex: 1;
overflow: hidden;
margin-top: base.$margin-base;
}
.bottom {
width: 100%;
height: 60px;
@ -138,6 +146,7 @@ const formatDate = (isoStr: any) => {
align-items: center;
}
}
.full_screen {
position: fixed;
left: 0;