zhgdyun/src/views/jxjadmin/operateManage.vue

361 lines
9.5 KiB
Vue

<template>
<div class="fullHeight whiteBlock">
<div class="table_wrap whiteBlock">
<el-table class="tables" :data="tableData">
<el-table-column
type="index"
width="50"
align="center"
label="序号"
></el-table-column>
<el-table-column
prop="versionName"
label="版本名称"
align="center"
width="180"
></el-table-column>
<el-table-column
prop="versionNo"
label="版本号"
align="center"
width="180"
></el-table-column>
<el-table-column
prop="versionDescribe"
label="版本描述"
align="center"
width="550px"
></el-table-column>
<el-table-column
prop="diffDay"
label="apk地址"
align="center"
width="500px"
>
<template slot-scope="scope">
<!-- <a href="">下载</a> -->
<span
@click="downloadFn(scope.row.downloadUrl)"
class="hovers primaryText"
>下载</span
>
<span
@click="copyFn(scope.row)"
class="hovers primaryText"
style="margin-left: 20px"
>复制apk地址</span
>
<input
id="copy_content"
type="text"
value=""
style="
position: absolute;
top: 0;
left: 0;
opacity: 0;
z-index: -10;
"
/>
</template>
</el-table-column>
<el-table-column
prop="address"
label="操作"
align="center"
width="410px"
>
<template slot-scope="scope">
<div @click="configuration(scope.row)" class="operationText">
<img
src="@/assets/images/icon-edit.png"
width="15px"
height="15px"
/>
<span>更新版本</span>
</div>
</template>
</el-table-column>
</el-table>
</div>
<el-dialog
:modal-append-to-body="false"
title="更新版本"
:visible.sync="authorizedDialog"
width="667px"
>
<div class="dialog_content">
<el-form
:model="ruleForm"
:rules="rules"
size="medium"
ref="ruleForm"
label-width="100px"
class="demo-ruleForm"
>
<el-form-item label="版本名称" prop="versionName">
<el-input
v-model="ruleForm.versionName"
placeholder="和版本号一致"
></el-input>
</el-form-item>
<el-form-item label="版本号" prop="versionNo">
<el-input
v-model="ruleForm.versionNo"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="版本描述" prop="versionDescribe">
<el-input
type="textarea"
v-model="ruleForm.versionDescribe"
placeholder="请输入"
></el-input>
</el-form-item>
<el-form-item label="上传apk" prop="downloadUrl">
<el-upload
class="upload-demo"
name="files"
:action="$store.state.UPLOADURL"
:on-remove="handleRemove"
:on-success="(res, file) => handleSuccess(res, file)"
:limit="1"
:file-list="fileList"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</el-form-item>
</el-form>
<div class="dialog-footer">
<el-button
class="cancleBtn"
@click="authorizedDialog = false"
icon="el-icon-circle-close"
size="medium"
>取 消</el-button
>
<el-button
type="primary"
icon="el-icon-circle-check"
@click="submitForm('ruleForm')"
size="medium"
>确 定</el-button
>
</div>
</div>
</el-dialog>
</div>
</template>
<script>
import { getappVersionListApi, editappVersionApi } from "@/assets/js/api/jxjadmin.js";
export default {
name: "registerAudit",
data() {
return {
checkAll: false,
isIndeterminate: false,
cityOptions: [],
moduleInfo: { moduleId: '' },
companyArr: [],
count: 0,
searchForm: {
companyName: "",
useState: "",
},
total: 0,
pageNo: 1,
pageSize: 10,
tableData: [],
checkList: [],
authorizedDialog: false,
isEnable: 0,
time: "",
ruleForm: {
"describe": "",
"downloadUrl": "",
"versionName": "",
"versionNo": ""
},
projectNum: 1,
fileList: [],
rules: {
versionNo: [
{ required: true, message: '请输入版本号', trigger: 'blur' }
],
downloadUrl: [
{ required: true, message: '请上传apk', trigger: 'change' }
],
}
};
},
created() {
this.getListData();
},
methods: {
copyFn(item) {
//获取点击的值
// var clickContent = this.$store.state.FILEURL + JSON.parse(item.downloadUrl)[0].url
var clickContent = JSON.parse(item.downloadUrl)[0].url
// var clickContent = ElementObj.innerText;
//获取要赋值的input的元素
var inputElement = document.getElementById("copy_content");
//给input框赋值
inputElement.value = clickContent;
//选中input框的内容
inputElement.select();
// 执行浏览器复制命令
document.execCommand("Copy");
//提示已复制
alert('已复制');
},
downloadFn(val) {
console.log('点击下载的数据:', val);
if (val == '[]') {
this.$message.error('未查询到附件')
} else {
let arr = []
arr = JSON.parse(val)
arr.forEach(element => {
const fileName = element.name.substring(0,element.name.lastIndexOf("."));
let url = this.$http.defaults.baseURL + 'xmgl/upload/getRenameFile?fileUrl=' + element.url + '&fileName=' + fileName
// console.log(url, fileName);
window.location.href = url;
});
}
// console.log('点击下载的数据:',item);
// var url = this.$store.state.FILEURL+JSON.parse(item.downloadUrl)[0].url
// window.open(url,'_blank')
},
handleRemove(file, fileList) {
this.fileList = fileList
},
handleSuccess(res, file) {
if (res.status == 'SUCCESS') {
this.fileList.push({
name: file.name,
url: this.$store.state.FILEURL + file.response.data[0].imageUrl
})
this.ruleForm.downloadUrl = JSON.stringify(this.fileList)
}
},
submitForm(formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
// if(this.fileList.length==0){
// this.$message.success('请上传apk')
// return
// }
// this.ruleForm.downloadUrl=JSON.stringify(this.fileList)
editappVersionApi(this.ruleForm).then(res => {
this.authorizedDialog = false;
this.getListData();
this.$message.success('更新成功!')
})
} else {
console.log('error submit!!');
return false;
}
});
},
//获取列表数据
getListData() {
let data = {};
// let data = this.searchForm;
data.pageNo = this.pageNo;
data.pageSize = this.pageSize;
getappVersionListApi(data).then((res) => {
console.log(res);
this.tableData = res.result.records
this.total = res.result.total
});
},
resetForm() {
this.$refs['searchForm'].resetFields();
this.getListData();
},
//显示 -- 授权配置弹窗
configuration(item) {
this.authorizedDialog = true
this.ruleForm = JSON.parse(JSON.stringify(item))
this.fileList = JSON.parse(this.ruleForm.downloadUrl)
// this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// this.$message({
// type: 'success',
// message: '删除成功!'
// });
// }).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// });
// });
},
//查看条数
handleSizeChange(val) {
this.pageSize = val;
this.getListData();
},
//查看页
handleCurrentChange(val) {
this.pageNo = val;
this.getListData();
},
}
};
</script>
<style lang="less" scoped>
.dialogTable {
display: flex;
align-items: center;
width: 100%;
border: 1px solid #f5f4f5;
margin: 0 auto;
border-bottom: none;
}
.dialogTable:last-child {
border-bottom: 1px solid #f5f4f5;
}
.dialogTable_l {
width: 120px;
text-align: center;
}
.dialogTable_r {
width: 94%;
padding: 5px 0;
padding-left: 30px;
border-left: 1px solid #f5f4f5;
}
.el-checkbox {
width: 46%;
margin: 10px 0;
}
.zdy-checkbox {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
> label {
width: 30%;
}
}
.CheckboxTitle {
font-size: 14px;
width: 100%;
}
</style>