Add custom serials
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user