Add custom serials

This commit is contained in:
Swift
2024-02-09 22:04:14 +03:30
parent ddb290241d
commit 7438a95166
9 changed files with 48 additions and 22 deletions
+12 -6
View File
@@ -30,17 +30,17 @@
download
target="_blank"
title="برای دانلود کلیک کنید"
:href="scope.row.url + scope.row.name"
:href="scope?.row.url + scope?.row.name"
style="color: blue; display: block; direction: ltr !important; text-align: right"
>
{{ scope.row.name }}
{{ scope?.row.name }}
</a>
</template>
</el-table-column>
<el-table-column v-if="scope.row.length > 1" label="حذف" width="60" align="left">
<el-table-column v-if="scope?.row.length > 1" label="حذف" width="60" align="left">
<template slot-scope="scope">
<CButton :key="scope.row._id" color="danger" variant="outline" @click="del(scope.row.name)">
<CButton :key="scope?.row._id" color="danger" variant="outline" @click="del(scope?.row.name)">
<i class="fal fa-trash-alt"></i>
</CButton>
</template>
@@ -60,9 +60,11 @@ export default {
async asyncData({ $axios, error, query }) {
try {
const type = query?.type
const g = query?.g
if (!type) throw new Error('invalid type')
const files = await $axios.get('/api/admin/serialExels', {
params: { type }
params: { type, g }
})
return {
files: files.data
@@ -74,7 +76,7 @@ export default {
},
data() {
return {
files: null,
files: [],
validation: {}
}
},
@@ -87,6 +89,9 @@ export default {
type() {
return this.$route.query?.type
},
g() {
return this.$route.query?.g
},
title() {
if (this.type === 'guaranteeSerial') return 'فایل اکسل شماره سریال گارانتی'
else return 'فایل اکسل شماره سریال کالا'
@@ -102,6 +107,7 @@ export default {
this.validation = {}
const data = new FormData()
data.append('type', this.type)
data.append('g', this.g)
data.append('file', this.$refs.file.files[0])
this.$axios
.post('/api/admin/addExel', data)
+3 -1
View File
@@ -132,6 +132,7 @@ export default {
inquiryType: 'guaranteeSerial',
checkingSerial: false,
brands:[],
g: 1
}
},
head() {
@@ -178,7 +179,8 @@ export default {
this.checkingSerial = true
const data = {
serial: this.serial,
type: this.inquiryType
type: this.inquiryType,
g: this.g
}
const loading = this.$loading({
lock: true,