Commit 2859c83b by hanxuehong

feat: 应用版本管理接口联调

parent 0eaf30c8
// api/erpProductionAssistantManage/uploadToLocal
import axios from '../axios'
export function erpProductionAssistantManage(data) {
return axios.post('/erpProductionAssistantManage/uploadToLocal', data)
return axios.post('/erpProductionAssistantManage/uploadToLocal', data, {
headers: {
'Content-Type': 'multipart/form-data'
}
})
}
export function erpProductionAssistantManageListPage(data) {
return axios.post('/erpProductionAssistantManage/list_page', data)
}
export function deleteErpProductionAssistantManage(data) {
return axios.get('/erpProductionAssistantManage/delete?ids=' + data)
}
\ No newline at end of file
......@@ -28,7 +28,18 @@
:sourceData='sourceData'
></table-view>
</div>
<div class="pagination">
<el-pagination
layout="sizes, total, prev, pager, next, jumper"
background
:total="total"
:page-size="pageSize"
:current-page="currentPage"
@size-change="sizeChange"
@current-change="onCurrentChange"
>
</el-pagination>
</div>
<el-dialog
title="新增"
:visible.sync='dialogVisible'
......@@ -60,14 +71,14 @@
</el-radio-group>
</el-form-item>
<!-- 上传多个app文件 -->
<el-form-item class="title_width" label="上传文件">
<el-form-item label="上传文件">
<!-- accept=".apk,.ipa" -->
<el-upload
action
:http-request="handleCustom"
:on-change="handleChange"
:on-remove="handleRemove"
:auto-upload="false"
:before-upload="beforeUpload"
:file-list="fileList"
list-type="text"
>
......@@ -97,7 +108,7 @@
</template>
<script>
import tableView from '@/common/components/base/tableView.vue'
import { erpProductionAssistantManage } from '../../common/api/production/assistantManage'
import { erpProductionAssistantManage, erpProductionAssistantManageListPage, deleteErpProductionAssistantManage } from '../../common/api/production/assistantManage'
export default {
name: 'saasMenu',
......@@ -141,7 +152,10 @@ export default {
content: [
{ required: true, message: '请输入更新内容', trigger: 'blur' },
],
}
},
total: 1,
currentPage: 1,
pageSize: 10,
}
},
computed: {
......@@ -199,9 +213,50 @@ export default {
]
},
},
mounted() {
created() {
this.getProductionAssistantList()
},
methods: {
async getProductionAssistantList() {
this.loading = true
try {
const { data: erpProductionAssistantManageRes, code } = await erpProductionAssistantManageListPage({
currentPage: this.currentPage,
pageSize: this.pageSize,
})
if (code === 200) {
console.log('erpProductionAssistantManageRes:>>', erpProductionAssistantManageRes)
this.sourceData = erpProductionAssistantManageRes.records
this.total = erpProductionAssistantManageRes.total
}
} catch (error) {
console.log('error:>>', error)
} finally {
this.loading = false
}
},
async deleteProductionAssistant(ids) {
const deleteProductionRes = await deleteErpProductionAssistantManage(ids)
if (deleteProductionRes.code === 200) {
this.$message({
type: 'success',
message: '删除成功!',
})
setTimeout(() => {
this.getProductionAssistantList()
}, 1000)
}
},
formFile(fileList, reset) {
const formData = new FormData()
fileList.forEach(file => {
formData.append('fileList', file.raw)
})
for (const key in reset) {
formData.append(key, reset[key])
}
return formData
},
showDialog() {
this.dialogVisible = true
},
......@@ -223,30 +278,33 @@ export default {
this.resetForm()
this.dialogVisible = false
},
async submit() {
submit() {
// 验证表单
this.$refs.editForm.validate(valid => {
this.$refs.editForm.validate(async valid => {
if (valid) {
// 提交表单
console.log('验证表单:>>> ', this.editForm, '\n上传的文件列表:>>> ', this.fileList)
if (this.fileList?.length === 0) {
return this.$message({
type: 'warning',
message: '请上传文件!',
})
}
const productionAssistantParams = {
...this.editForm,
fileList: this.fileList
const productionAssistantParams = this.formFile(this.fileList, { ...this.editForm, businessType: 'production_assistant' })
try {
const res = await erpProductionAssistantManage(productionAssistantParams)
console.log('提交表单:>>> ', res, '\nproductionAssistantParams:>>', productionAssistantParams)
if (res.code === 200) {
this.$message({
type: 'success',
message: '保存成功!',
})
this.resetForm()
this.getProductionAssistantList()
this.dialogVisible = false
}
} catch (error) {
console.log('error:>>', error)
}
const res = erpProductionAssistantManage(productionAssistantParams)
console.log('提交表单:>>> ', res)
this.$message({
type: 'success',
message: '保存成功!',
})
// this.resetForm()
// this.dialogVisible = false
}
})
},
......@@ -260,12 +318,7 @@ export default {
cancelButtonText: '取消',
type: 'warning',
}).then(() => {
// 删除的相关操作
this.sourceData = this.sourceData.filter(item => item.id !== id)
this.$message({
type: 'success',
message: '删除成功!',
})
this.deleteProductionAssistant(id)
})
},
handleCustom(file) {
......@@ -277,9 +330,25 @@ export default {
handleChange(file, fileList) {
this.fileList = fileList
},
beforeUpload(file) {
const isLt2M = file.size / 1024 / 1024 < 50
if (!isLt2M) {
this.$message.error('上传文件大小不能超过 50MB!')
return false
}
return isLt2M
},
handleRemove(file, fileList) {
this.fileList = fileList
},
sizeChange(pageSize) {
this.pageSize = pageSize
this.getProductionAssistantList()
},
onCurrentChange(currentPage) {
this.currentPage = currentPage
this.getProductionAssistantList()
},
},
}
</script>
......@@ -298,7 +367,9 @@ export default {
}
}
.table-wrap {
background: #fff;
flex: 1;
overflow: hidden;
}
.system-menu:deep() .el-form-item__content {
......
......@@ -8,9 +8,9 @@ module.exports = defineConfig({
'/api': {
target: 'http://10.168.31.188:8096',
changeOrigin: true,
pathRewrite: {
'^/api': '',
},
// pathRewrite: {
// '^/api': '',
// },
},
},
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment