|
|
@@ -152,12 +152,18 @@
|
|
|
<SelectDeviceDialogApp v-model:visible="showSelectDeviceDialog" @confirm="onDeviceSelected" />
|
|
|
<!-- <SelectCatgory v-model:visible="showSelectDeviceDialog" @confirm="onDeviceSelected" /> -->
|
|
|
<RefuseNotification/>
|
|
|
+ <WarehouseSelectDialog
|
|
|
+ v-model="showWarehouseDialog"
|
|
|
+ :formId="currentApprovalFormId"
|
|
|
+ @confirm="handleWarehouseConfirm"
|
|
|
+ />
|
|
|
</template>
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
import { ref, inject,provide,watch, defineProps, defineEmits, onMounted,computed } from 'vue';
|
|
|
import SelectDeviceDialogApp from './SelectDeviceDialogApp/index.vue';
|
|
|
import RefuseNotification from '../RefuseNotification/index.vue';
|
|
|
+import WarehouseSelectDialog from '../components/WarehouseSelectDialog.vue';
|
|
|
import dayjs from 'dayjs';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
import * as api from '../api';
|
|
|
@@ -222,6 +228,20 @@ const isView = computed(() => props.modelValue?.mode === 'view');
|
|
|
const isAdd = computed(() => props.modelValue?.mode === 'add');
|
|
|
|
|
|
const emit = defineEmits(['update:visible', 'update:modelValue', 'submit']);
|
|
|
+const showWarehouseDialog = ref(false);
|
|
|
+const currentApprovalFormId = ref<number | null>(null);
|
|
|
+
|
|
|
+function openWarehouseDialog() {
|
|
|
+ currentApprovalFormId.value = props.modelValue?.id ?? null;
|
|
|
+ showWarehouseDialog.value = true;
|
|
|
+}
|
|
|
+
|
|
|
+async function handleWarehouseConfirm(data: { formId: number; warehouseId: number }) {
|
|
|
+ await api.BorrowingReview(data.formId, "approve", "同意借用", data.warehouseId);
|
|
|
+ ElMessage.success("审批通过");
|
|
|
+ emit('update:visible', false);
|
|
|
+ crudExpose?.doRefresh();
|
|
|
+}
|
|
|
const visible = ref(props.visible);
|
|
|
const formRef = ref();
|
|
|
|
|
|
@@ -271,6 +291,30 @@ const handleCustomUpload = async ({ file, onProgress, onSuccess, onError }: any)
|
|
|
|
|
|
// import { ElSteps } from 'element-plus';
|
|
|
const steps = ref<any[]>([]);
|
|
|
+// 仓库映射(id -> name)
|
|
|
+const warehouseMap = ref<Record<string, string>>({});
|
|
|
+
|
|
|
+async function loadWarehouses() {
|
|
|
+ try {
|
|
|
+ const res = await request({
|
|
|
+ url: '/api/system/warehouse/',
|
|
|
+ method: 'get',
|
|
|
+ params: { page: 1, limit: 999 }
|
|
|
+ });
|
|
|
+ if (res?.code === 2000 && Array.isArray(res.data)) {
|
|
|
+ warehouseMap.value = Object.fromEntries(
|
|
|
+ res.data.map((w: any) => [String(w.id), w.name])
|
|
|
+ );
|
|
|
+ }
|
|
|
+ } catch (e) {
|
|
|
+ /* empty */
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function getWarehouseName(id: any) {
|
|
|
+ const key = id != null ? String(id) : '';
|
|
|
+ return warehouseMap.value[key] ?? id;
|
|
|
+}
|
|
|
const timeline = ref({
|
|
|
setpstatus:0,
|
|
|
create: '',
|
|
|
@@ -297,7 +341,7 @@ function buildSteps(data: any) {
|
|
|
if (data.status >= 2 &&data.status!=3) {
|
|
|
steps.value.push({
|
|
|
title: '审批通过',
|
|
|
- description: `审批人:${data.approver_info.name},时间:${data.approve_time}`,
|
|
|
+ description: `审批人:${data.approver_info.name},时间:${data.approve_time},仓库:${getWarehouseName(data.warehouse)||'暂无仓库'}`,
|
|
|
status: 'finish'
|
|
|
});
|
|
|
} else if (data.status === 3) {
|
|
|
@@ -383,6 +427,7 @@ const rules = {
|
|
|
|
|
|
// 自动填充用户信息
|
|
|
onMounted(() => {
|
|
|
+ loadWarehouses()
|
|
|
try {
|
|
|
getAllUserList()
|
|
|
const bortype=props.modelValue.borrower_type;
|
|
|
@@ -498,11 +543,7 @@ async function onDanger(formId: number){
|
|
|
}
|
|
|
|
|
|
async function onSucess(){
|
|
|
- const ids=props.modelValue.id;
|
|
|
- await api.BorrowingReview(ids, "approve", "同意借用");
|
|
|
- ElMessage.success("审批通过");
|
|
|
- emit('update:visible', false);
|
|
|
- crudExpose?.doRefresh();
|
|
|
+ openWarehouseDialog();
|
|
|
}
|
|
|
|
|
|
|