<template>
|
<template>
|
<div>
|
<el-dialog
|
v-model="isShow"
|
title="新增产品"
|
width="1200"
|
@close="closeModal"
|
>
|
<div class="table_list">
|
<el-table :data="tableData"
|
border
|
@selection-change="handleChangeSelection">
|
<el-table-column align="center"
|
type="selection"
|
width="55" />
|
<el-table-column align="center"
|
label="序号"
|
type="index"
|
width="60" />
|
<el-table-column label="产品大类"
|
prop="productCategory" />
|
<el-table-column label="规格型号"
|
prop="specificationModel" />
|
<el-table-column label="单位"
|
prop="unit"
|
width="70" />
|
<el-table-column label="数量"
|
prop="quantity"
|
width="70" />
|
<el-table-column label="库存预警数量"
|
prop="warnNum"
|
width="120"
|
show-overflow-tooltip />
|
<el-table-column label="税率(%)"
|
prop="taxRate"
|
width="80" />
|
<el-table-column label="含税单价(元)"
|
prop="taxInclusiveUnitPrice"
|
:formatter="formattedNumber"
|
width="150" />
|
<el-table-column label="含税总价(元)"
|
prop="taxInclusiveTotalPrice"
|
:formatter="formattedNumber"
|
width="150" />
|
<el-table-column label="不含税总价(元)"
|
prop="taxExclusiveTotalPrice"
|
:formatter="formattedNumber"
|
width="150" />
|
<el-table-column label="是否质检"
|
prop="isChecked"
|
width="150">
|
<template #default="scope">
|
<el-tag :type="scope.row.isChecked ? 'success' : 'info'">
|
{{ scope.row.isChecked ? '是' : '否' }}
|
</el-tag>
|
</template>
|
</el-table-column>
|
</el-table>
|
<pagination v-show="total > 0" :total="total" layout="total, sizes, prev, pager, next, jumper"
|
:page="page.current" :limit="page.size" @pagination="paginationChange" />
|
</div>
|
|
<template #footer>
|
<div class="dialog-footer">
|
<el-button type="primary" :disabled="selectedRows.length === 0" @click="handleSubmit">确认</el-button>
|
<el-button @click="closeModal">取消</el-button>
|
</div>
|
</template>
|
</el-dialog>
|
</div>
|
</template>
|
</template>
|
|
<script setup>
|
import {computed, reactive, ref} from "vue";
|
import {productList} from "@/api/procurementManagement/procurementLedger.js";
|
import {ElMessage} from "element-plus";
|
|
const props = defineProps({
|
visible: {
|
type: Boolean,
|
required: true,
|
},
|
|
purchaseLedgerId: {
|
type: Number,
|
required: true,
|
}
|
});
|
|
const emit = defineEmits(['update:visible', 'completed']);
|
|
const isShow = computed({
|
get() {
|
return props.visible;
|
},
|
set(val) {
|
emit('update:visible', val);
|
},
|
});
|
|
const tableData = ref([])
|
const selectedRows = ref([])
|
const tableLoading = ref(false)
|
const page = reactive({
|
current: 1,
|
size: 100,
|
})
|
const total = ref(0)
|
const formattedNumber = (row, column, cellValue) => {
|
return parseFloat(cellValue).toFixed(2);
|
};
|
|
const paginationChange = (obj) => {
|
page.current = obj.page;
|
page.size = obj.limit;
|
getList()
|
}
|
|
const handleChangeSelection = (val) => {
|
selectedRows.value = val;
|
}
|
|
const fetchData = () => {
|
tableLoading.value = true;
|
productList({salesLedgerId: props.purchaseLedgerId, type: 2}).then((res) => {
|
tableData.value = res.data;
|
}).finally(() => {
|
tableLoading.value = false;
|
})
|
}
|
|
const handleSubmit = () => {
|
if (selectedRows.value.length === 0) {
|
ElMessage.warning("请选择一条产品");
|
return;
|
}
|
|
emit('completed', selectedRows.value);
|
}
|
|
const closeModal = () => {
|
isShow.value = false;
|
};
|
|
onMounted(() => {
|
fetchData()
|
})
|
|
</script>
|