feat(material): 基础信息(Odoo)补回「发起采购申请」入口

buyOdoo.vue 是 list.vue 的手工副本。31903bd 给 list.vue 弹窗加了
「发起采购申请」,未同步到 Odoo 页,两个页面的编辑弹窗头部不一致。

补上弹窗头部链接、createPurchaseForMaterial 函数及 ShoppingCart 图标。
This commit is contained in:
yueli
2026-09-18 10:07:24 +08:00
parent f2bb95becc
commit 825c088e98

View File

@ -434,6 +434,15 @@
>
<el-icon style="margin-right: 4px"><Plus /></el-icon>加入或查看BOM
</el-link>
<el-link
v-if="form.id"
type="warning"
:underline="false"
style="font-size: 14px;"
@click="createPurchaseForMaterial"
>
<el-icon style="margin-right: 4px"><ShoppingCart /></el-icon>发起采购申请
</el-link>
</div>
</div>
</template>
@ -748,7 +757,7 @@
<script setup lang="ts">
import { ref, reactive, onMounted, nextTick, computed, watch } from 'vue';
import { Plus, Document, DocumentCopy, Refresh, Setting, Rank, Camera, Download, Bell, CircleCheck, Files, ZoomIn, Delete, Picture, FolderOpened, Loading, Upload } from '@element-plus/icons-vue';
import { Plus, Document, DocumentCopy, Refresh, Setting, Rank, Camera, Download, Bell, CircleCheck, Files, ZoomIn, Delete, Picture, FolderOpened, Loading, Upload, ShoppingCart } from '@element-plus/icons-vue';
import { ElMessage, ElMessageBox, ElLoading } from 'element-plus';
import type { FormInstance, FormRules } from 'element-plus';
import { useUserStore } from '@/stores/user';
@ -1483,6 +1492,21 @@ const createBomForMaterial = () => {
window.open(routeUrl.href, '_blank');
};
// 编辑弹窗里的「发起采购申请」:带物料信息跳采购管理并自动预填(与 list.vue 对齐)
const createPurchaseForMaterial = () => {
if (!form.value.id) return ElMessage.warning('请先保存物料基础信息后再操作');
const routeUrl = router.resolve({
path: '/purchase',
query: {
material_id: String(form.value.id),
name: form.value.name,
spec: form.value.spec,
unit: form.value.unit
}
});
window.open(routeUrl.href, '_blank');
};
const resetForm = () => {
form.value = JSON.parse(JSON.stringify(initForm));
fileListImage.value = []; fileListManual.value = [];