| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-card class="search-card" shadow="never"> |
| | | <el-form :model="searchForm" :inline="true"> |
| | | <el-form-item label="éè´§åå·ï¼" style="width: 300px;"> |
| | | <el-input v-model="searchForm.returnNo" placeholder="请è¾å
¥éè´§åå·" clearable /> |
| | | </el-form-item> |
| | | <el-form-item label="éè´§ç±»åï¼" style="width: 300px;"> |
| | | <el-select v-model="searchForm.returnType" placeholder="è¯·éæ©ç±»å" clearable> |
| | | <el-option label="éè´éè´§" value="purchase" /> |
| | | <el-option label="è´¨æ£éè´§" value="quality" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="handleSearch">æç´¢</el-button> |
| | | <el-button @click="resetSearch">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <el-card class="table-card" shadow="never"> |
| | | <div class="table-header"> |
| | | <el-button type="primary" @click="openDialog('add')">æ°å¢éè´§å</el-button> |
| | | <el-button type="danger" @click="handleBatchDelete">æ¹éå é¤</el-button> |
| | | </div> |
| | | |
| | | <el-table :data="tableData" border v-loading="loading" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="éè´§åå·" prop="returnNo" width="180" /> |
| | | <el-table-column label="å
³èåå·" prop="relatedNo" width="180" /> |
| | | <el-table-column label="éè´§ç±»å" prop="returnType" width="100"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="row.returnType === 'purchase' ? 'danger' : 'warning'"> |
| | | {{ getReturnTypeText(row.returnType) }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="ä¾åºååç§°" prop="supplierName" /> |
| | | <el-table-column label="éè´§ç¶æ" prop="status" width="100"> |
| | | <template #default="{ row }"> |
| | | <el-tag :type="getStatusType(row.status)">{{ getStatusText(row.status) }}</el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="å建æ¶é´" prop="createTime" width="180" /> |
| | | <el-table-column label="æä½" width="200" align="center"> |
| | | <template #default="{ row }"> |
| | | <el-button type="primary" link @click="openDialog('edit', row)">ç¼è¾</el-button> |
| | | <el-button type="success" link @click="handleApprove(row)" v-if="row.status === 'pending'">å®¡æ ¸</el-button> |
| | | <el-button type="danger" link @click="handleDelete(row)">å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <!-- å页 --> |
| | | <pagination |
| | | :total="total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="pagination.current" |
| | | :limit="pagination.size" |
| | | @pagination="handleCurrentChange" |
| | | /> |
| | | </el-card> |
| | | |
| | | <FormDialog v-model="dialogVisible" :title="dialogType === 'add' ? 'æ°å¢éè´§å' : 'ç¼è¾éè´§å'" :width="'600px'" :operation-type="dialogType" @close="dialogVisible = false" @confirm="handleSubmit" @cancel="dialogVisible = false"> |
| | | <el-form :model="formData" label-width="120px"> |
| | | <el-form-item label="éè´§ç±»å"> |
| | | <el-select v-model="formData.returnType" placeholder="è¯·éæ©éè´§ç±»å" style="width: 100%"> |
| | | <el-option label="éè´éè´§" value="purchase" /> |
| | | <el-option label="è´¨æ£éè´§" value="quality" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="å
³èåå·"> |
| | | <el-select v-model="formData.relatedNo" placeholder="è¯·éæ©å
³èåå·" style="width: 100%"> |
| | | <el-option v-for="item in onList" :key="item.arrivalNo" :label="item.arrivalNo" :value="item.arrivalNo" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="ä¾åºååç§°"> |
| | | <el-input v-model="formData.supplierName" placeholder="请è¾å
¥ä¾åºååç§°" /> |
| | | </el-form-item> |
| | | <el-form-item label="éè´§åå "> |
| | | <el-select v-model="formData.returnReason" placeholder="è¯·éæ©éè´§åå " style="width: 100%"> |
| | | <el-option label="è´¨éé®é¢" value="quality" /> |
| | | <el-option label="è§æ ¼ä¸ç¬¦" value="specification" /> |
| | | <el-option label="æ°éé误" value="quantity" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="夿³¨"> |
| | | <el-input v-model="formData.remark" type="textarea" :rows="3" placeholder="请è¾å
¥å¤æ³¨ä¿¡æ¯" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | </FormDialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup> |
| | | import FormDialog from '@/components/Dialog/FormDialog.vue'; |
| | | import { ref, reactive,onMounted } from 'vue' |
| | | import { ElMessage, ElMessageBox } from 'element-plus' |
| | | import Pagination from '@/components/PIMTable/Pagination.vue' |
| | | import {listPage,add,update,del} from "@/api/procurementManagement/returnManagement.js" |
| | | import {listPageCopy} from "@/api/procurementManagement/arrivalManagement.js" |
| | | |
| | | onMounted(() => { |
| | | getList() |
| | | list() |
| | | }) |
| | | const onList = ref([]) |
| | | const list = () =>{ |
| | | listPageCopy({current:-1}).then(res=>{ |
| | | if(res.code === 200){ |
| | | onList.value = res.data.records |
| | | } |
| | | }) |
| | | } |
| | | const tableData = ref([]) |
| | | const getList = () => { |
| | | loading.value = true |
| | | listPage({...searchForm,...pagination}).then(res =>{ |
| | | if(res.code === 200){ |
| | | tableData.value = res.data.records |
| | | console.log(tableData.value) |
| | | total.value = res.data.total |
| | | loading.value = false |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const loading = ref(false) |
| | | const dialogVisible = ref(false) |
| | | const dialogType = ref('add') |
| | | const selectedRows = ref([]) |
| | | |
| | | |
| | | const pagination = reactive({ |
| | | current: 1, |
| | | size: 10 |
| | | }) |
| | | |
| | | const total = ref(0) |
| | | |
| | | const searchForm = reactive({ |
| | | returnNo: '', |
| | | returnType: '' |
| | | }) |
| | | |
| | | const formData = reactive({ |
| | | returnType: '', |
| | | relatedNo: '', |
| | | supplierName: '', |
| | | returnReason: '', |
| | | remark: '', |
| | | status: '' |
| | | }) |
| | | |
| | | const getReturnTypeText = (type) => { |
| | | const typeMap = { purchase: 'éè´éè´§', quality: 'è´¨æ£éè´§' } |
| | | return typeMap[type] || 'æªç¥' |
| | | } |
| | | |
| | | const getStatusType = (status) => { |
| | | const statusMap = { pending: 'warning', approved: 'success', returned: 'info' } |
| | | return statusMap[status] || 'info' |
| | | } |
| | | |
| | | const getStatusText = (status) => { |
| | | const statusMap = { pending: 'å¾
å®¡æ ¸', approved: 'å·²å®¡æ ¸', returned: 'å·²éè´§' } |
| | | return statusMap[status] || 'æªç¥' |
| | | } |
| | | |
| | | const handleSearch = () => { |
| | | loading.value = true |
| | | getList() |
| | | } |
| | | |
| | | const resetSearch = () => { |
| | | Object.assign(searchForm, { returnNo: '', returnType: '' }) |
| | | } |
| | | |
| | | const openDialog = (type, row = {}) => { |
| | | dialogType.value = type |
| | | obj.id = row.id |
| | | if (type === 'edit' && row.id) { |
| | | Object.assign(formData, { |
| | | returnType: row.returnType, |
| | | relatedNo: row.relatedNo, |
| | | supplierName: row.supplierName, |
| | | returnReason: row.returnReason, |
| | | remark: row.remark, |
| | | status: row.status |
| | | }) |
| | | } else { |
| | | Object.assign(formData, { |
| | | returnType: '', |
| | | relatedNo: '', |
| | | supplierName: '', |
| | | returnReason: '', |
| | | remark: '', |
| | | status: 'pending' |
| | | }) |
| | | } |
| | | dialogVisible.value = true |
| | | } |
| | | const obj = reactive({ |
| | | id: '' |
| | | }) |
| | | const handleSubmit = () => { |
| | | if (dialogType.value === 'add') { |
| | | formData.status = 'pending' |
| | | add(formData).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('æ°å¢æå') |
| | | getList() |
| | | } |
| | | }) |
| | | }else{ |
| | | update({...formData,...obj}).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('ä¿®æ¹æå') |
| | | getList() |
| | | } |
| | | }) |
| | | } |
| | | dialogVisible.value = false |
| | | } |
| | | |
| | | const handleApprove = (row) => { |
| | | row.status = 'approved' |
| | | update(row).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('å®¡æ ¸æå') |
| | | getList() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleDelete = (row) => { |
| | | ElMessageBox.confirm('ç¡®å®è¦å é¤è¿æ¡è®°å½åï¼', 'æç¤º', { |
| | | confirmButtonText: 'ç¡®å®', |
| | | cancelButtonText: 'åæ¶', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | let ids = [row.id] |
| | | del(ids).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('å 餿å') |
| | | getList() |
| | | } |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | const handleBatchDelete = () => { |
| | | let ids = selectedRows.value.map(item => item.id) |
| | | del(ids).then(res => { |
| | | if(res.code === 200){ |
| | | ElMessage.success('æ¹éå 餿å') |
| | | getList() |
| | | } |
| | | }) |
| | | } |
| | | |
| | | const handleSelectionChange = (rows) => { |
| | | selectedRows.value = rows |
| | | } |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .app-container { padding: 20px; } |
| | | .search-card { margin-bottom: 20px; } |
| | | .table-card { margin-bottom: 20px; } |
| | | .table-header { margin-bottom: 20px; } |
| | | </style> |