| | |
| | | </el-form> |
| | | <el-card> |
| | | <!-- 操作按钮区 --> |
| | | <el-row :gutter="24" class="table-toolbar"> |
| | | <el-row :gutter="24" class="table-toolbar" justify="space-between"> |
| | | <el-button type="primary" :icon="Plus" @click="handleAdd" |
| | | >新建 |
| | | </el-button> |
| | | <el-button type="danger" :icon="Delete" @click="handleDelete" |
| | | >删除 |
| | | <el-button type="primary" :icon="Plus" @click="handleAddPayable"> |
| | | 添加应付款 |
| | | </el-button> |
| | | <!-- <el-button type="danger" :icon="Delete" @click="handleDelete" |
| | | >删除 |
| | | </el-button> --> |
| | | </el-row> |
| | | <!-- 表格组件 --> |
| | | <data-table |
| | |
| | | @success="handleSuccess" |
| | | ref="productionDialogs" |
| | | /> |
| | | <PayableDialog |
| | | v-model:dialogPayableFormVisible="dialogPayableFormVisible" |
| | | v-model:form="formPayable" |
| | | :title="title" |
| | | @submit="handleSubmit" |
| | | @success="payableHandleSuccess" |
| | | ref="productionDialogs"> |
| | | </PayableDialog>> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import DataTable from "@/components/Table/ETable.vue"; |
| | | import Pagination from "@/components/Pagination"; |
| | | import ProductionDialog from "./components/ProductionDialog.vue"; |
| | | import PayableDialog from "../payable/components/PayableDialog.vue"; |
| | | |
| | | import { |
| | | purchaseRegistration, |
| | | getSupplyList, |
| | |
| | | delPR |
| | | } from "@/api/procureMent"; |
| | | import { useDelete } from "@/hooks/useDelete"; |
| | | |
| | | const userStore = useUserStore(); |
| | | const dictStore = useDictStore() |
| | | import useUserStore from "@/store/modules/user"; |
| | | import useDictStore from "@/store/modules/dict" |
| | | |
| | | let userList = ref([]); |
| | | userStore.getUserList().then((res) => { |
| | | userList.value = res; |
| | | }); |
| | | |
| | | // 引入字典数据 |
| | | |
| | | const { proxy } = getCurrentInstance(); |
| | | const dialogFormVisible = ref(false); |
| | | const form = ref({}); |
| | | const dialogPayableFormVisible = ref(false); |
| | | const form = ref({ |
| | | taxRate: 13, |
| | | freight: 20, |
| | | }); |
| | | const title = ref(""); |
| | | // 状态变量 |
| | | const loading = ref(false); |
| | |
| | | const pageSize = ref(10); |
| | | const selectedRows = ref([]); |
| | | const copyForm = ref({}); |
| | | const formPayable = ref({}); |
| | | // 查询参数 |
| | | const queryParams = reactive({ |
| | | searchAll: "", |
| | |
| | | // 方法定义 |
| | | const handleQuery = () => { |
| | | loading.value = true; |
| | | current.value = 1; |
| | | pageSize.value = 10; |
| | | // 这里添加实际的查询逻辑 |
| | | getList(); |
| | | }; |
| | | const userStore = useUserStore(); |
| | | |
| | | // 获取用户信息 |
| | | const userInfo = ref({}); |
| | | onMounted(async () => { |
| | |
| | | }, |
| | | }, |
| | | { |
| | | prop: "type", |
| | | label: "煤料类型", |
| | | minWidth: 120, |
| | | formatter: (row) => { |
| | | return row.type === 1 ? "成品" : "原料"; |
| | | }, |
| | | }, |
| | | { |
| | | prop: "coalId", |
| | | label: "煤种类型", |
| | | minWidth: 120, |
| | |
| | | { prop: "purchaseQuantity", label: "采购数量", minWidth: 100 }, |
| | | { prop: "priceIncludingTax", label: "单价(含税)", minWidth: 150 }, |
| | | { prop: "totalPriceIncludingTax", label: "总价(含税)", minWidth: 100 }, |
| | | { prop: "freight", label: "运费", minWidth: 100 }, |
| | | { prop: "taxRate", label: "税率", minWidth: 100 }, |
| | | { prop: "priceExcludingTax", label: "不含税单价", minWidth: 100 }, |
| | | { prop: "registrantId", label: "登记人", minWidth: 100 }, |
| | | { prop: "registrantId", label: "登记人", minWidth: 100, |
| | | formatter: (row) => { |
| | | // 匹配用户信息 |
| | | const user = userList.value.find((user) => user.userId === row.registrantId); |
| | | return user ? user.nickName : "未知用户"; |
| | | }, |
| | | }, |
| | | { prop: "purchaseType", label: "类型", minWidth: 100 , |
| | | formatter: (row) => { |
| | | if (row.purchaseType == null) { |
| | | return "" |
| | | } |
| | | const dictItem = dictStore.getDictDataByTypeAndValue("purchase_type", row.purchaseType); |
| | | return dictItem ? dictItem.label : ""; } |
| | | }, |
| | | { prop: "registrationDate", label: "登记日期", minWidth: 100 }, |
| | | ]); |
| | | |
| | |
| | | addOrEdit.value = "add"; |
| | | handleAddEdit(); |
| | | }; |
| | | const handleAddPayable = () => { |
| | | // 只有选择一行的时候进行操作 |
| | | |
| | | if (selectedRows.value.length !== 1) { |
| | | ElMessage.error("请选中一行进行填写") |
| | | return |
| | | } |
| | | |
| | | formPayable.value = { |
| | | purchaseRegistrationId: selectedRows.value[0].id, |
| | | registrantId: userInfo.value.userId, |
| | | ticketNo:"", |
| | | paymentAmount:"", |
| | | payableType:"", |
| | | attachUpload:"", |
| | | registrationDate: new Date().toISOString().split("T")[0], |
| | | fileList:[] |
| | | } |
| | | dialogPayableFormVisible.value = true |
| | | |
| | | }; |
| | | |
| | | // 新增编辑 |
| | | const productionDialogs = ref(null); // 添加ref声明 |
| | | |
| | |
| | | totalPriceExcludingTax: "", |
| | | priceIncludingTax: "", |
| | | totalPriceIncludingTax: "", |
| | | taxRate: "", |
| | | registrantId: userInfo.value.userName, |
| | | taxRate: 13, |
| | | freight:20, |
| | | registrantId: userInfo.value.userId, |
| | | registrationDate: new Date().toISOString().split("T")[0], |
| | | purchaseType: "" |
| | | }; |
| | | // 新建时也需要设置 copyForm 用于重置功能 |
| | | copyForm.value = JSON.parse(JSON.stringify(form.value)); |
| | |
| | | }); |
| | | const handleDeleteSuccess = (row) => { |
| | | ElMessage.success("删除成功:" + row.supplierName); |
| | | handleQuery() |
| | | }; |
| | | // 成功 |
| | | const handleSuccess = (val) => { |
| | |
| | | total.value = tableData.value.length; |
| | | ElMessage.success("操作成功"); |
| | | }; |
| | | |
| | | const payableHandleSuccess = (val) => { |
| | | ElMessage.success("操作成功"); |
| | | dialogPayableFormVisible.value = false; |
| | | } |
| | | |
| | | const getList = async () => { |
| | | loading.value = true; |
| | | try { |