| | |
| | | import { ref, defineProps, watch, onMounted, nextTick, computed } from "vue"; |
| | | import { ElMessage } from "element-plus"; |
| | | import useUserStore from "@/store/modules/user"; |
| | | import { addOrEditPR } from "@/api/procureMent"; |
| | | import { addOrEditPR,getSupplyList, getCoalInfoList } from "@/api/procureMent"; |
| | | import { getSupply } from "@/api/basicInformation/supplier"; |
| | | import { getCoalInfo } from "@/api/basicInformation/coal"; |
| | | const props = defineProps({ |
| | |
| | | const getDropdownData = async () => { |
| | | try { |
| | | const [supplyRes, coalRes] = await Promise.all([ |
| | | getSupply(), |
| | | getCoalInfo(), |
| | | getSupplyList(), |
| | | getCoalInfoList(), |
| | | ]); |
| | | let supplyData = supplyRes.data.records; |
| | | let coalData = coalRes.data.records; |
| | | console.log(supplyRes, coalRes); |
| | | let supplyData = supplyRes.data; |
| | | let coalData = coalRes.data; |
| | | supplyList.value = supplyData.map((item) => ({ |
| | | value: item.id, |
| | | label: item.supplierName, |
| | |
| | | value: item.id, |
| | | label: item.coal, |
| | | })); |
| | | console.log(supplyList.value, coalList.value); |
| | | } catch (error) { |
| | | console.error("获取下拉数据失败:", error); |
| | | ElMessage.error("获取下拉数据失败,请稍后重试"); |
| | | } |
| | | }; |
| | | |
| | |
| | | onMounted(async () => { |
| | | let res = await userStore.getInfo(); |
| | | userInfo.value = res; |
| | | getDropdownData() |
| | | }); |
| | | const rules = { |
| | | supplierName: [ |
| | |
| | | const formRef = ref(null); |
| | | // 提交表单 |
| | | const handleSubmit = async () => { |
| | | console.log("提交表单", form.value); |
| | | if (!formRef.value) return; |
| | | await formRef.value.validate(async (valid) => { |
| | | if (valid) { |