定制项目提交一波

This commit is contained in:
aixianling
2022-07-04 14:48:21 +08:00
parent d046ca1dd6
commit 7cf7d41c23
2 changed files with 46 additions and 20 deletions

View File

@@ -10,18 +10,29 @@
<el-input v-model="form.name" placeholder="请输入" clearable/>
</el-form-item>
<el-row type="flex">
<el-form-item label="系统类型" prop="type" class="half">
<div class="fill">
<el-form-item label="系统类型" prop="type">
<ai-select v-model="form.type" :selectList="dict.getDict('systemType')"/>
</el-form-item>
<el-form-item label="定制项目根目录" prop="customPath" class="half">
<el-form-item label="更新项目路径" prop="dist">
<el-input v-model="form.dist" placeholder="常填写nginx路径,下载包从这里取" clearable/>
</el-form-item>
</div>
<div class="fill mar-l16">
<el-form-item label="库项目根路径" prop="customPath">
<el-input v-model="form.customPath" placeholder="请输入" clearable/>
</el-form-item>
<el-form-item label="版本号" prop="version">
<el-input v-model="form.version" placeholder="请输入" clearable/>
</el-form-item>
</div>
</el-row>
</template>
</ai-card>
<ai-card title="主库应用">
<template #content>
<ai-lib-table v-if="form.type" v-model="form.apps" :action="`/node/wechatapps/list?type=${form.type}`" multiple searchKey="name" v-bind="$props"/>
<ai-lib-table v-if="form.type" v-model="form.apps" v-bind="$props" multiple searchKey="name"
:action="`/node/wechatapps/list?type=${form.type}&isMain=1`"/>
<ai-empty v-else>请先选择系统类型</ai-empty>
</template>
</ai-card>
@@ -98,12 +109,8 @@ export default {
.add {
height: 100%;
.half {
width: 50%;
& + .half {
.mar-l16 {
margin-left: 16px;
}
}
}
</style>

View File

@@ -17,7 +17,7 @@
<template slot-scope="{row}">
<el-button type="text" @click="handleAdd(row.id)">编辑</el-button>
<el-button type="text" @click="handleAdd(row.id)">打包更新</el-button>
<el-button type="text" @click="handleAdd(row.id)">下载</el-button>
<el-button type="text" @click="handleDownload(row)">下载</el-button>
<el-button type="text" @click="handleDelete(row.id)">删除</el-button>
</template>
</el-table-column>
@@ -41,9 +41,11 @@ export default {
page: {current: 1, size: 10, total: 0},
tableData: [],
colConfigs: [
{prop: "name", label: "项目/系统名称"},
{prop: "customPath", label: "产品定制内容根路径"},
{prop: "type", label: "系统类型", dict: 'systemType'}
{prop: "name", label: "项目/系统名称", width: 200},
{prop: "type", label: "系统类型", dict: 'systemType', width: 120},
{prop: "version", label: "版本号", width: 120},
{prop: "customPath", label: "库项目根路径", width: 120},
{prop: "dist", label: "更新路径"},
],
}
},
@@ -73,9 +75,26 @@ export default {
})
}).catch(() => 0)
},
handleDownload(id){
handleDownload(row) {
let {id} = row
this.instance.post("/node/custom/download", null, {
params: {id},
responseType: "blob"
}).then(res => {
if (res?.code == 1) {
this.$message.error(res.err)
} else {
const link = document.createElement('a')
let blob = new Blob([res], {type: 'application/zip'})
link.style.display = 'none'
link.href = URL.createObjectURL(blob)
link.setAttribute('download', row.name + '.zip')
document.body.appendChild(link)
link.click()
document.body.removeChild(link)
}
})
},
},
created() {
this.getTableData()