|
@@ -1,44 +1,73 @@
|
|
<template>
|
|
<template>
|
|
<div class="form_center">
|
|
<div class="form_center">
|
|
- <el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="80px">
|
|
|
|
- <el-form-item label="版本名称" prop="versionName">
|
|
|
|
|
|
+ <el-form ref="form" :model="form" :rules="rules" label-position="left" label-width="120px">
|
|
|
|
+ <el-form-item label="版本名称:" prop="versionName">
|
|
<el-input v-model="form.versionName" placeholder="请输入版本名称" maxlength="20" />
|
|
<el-input v-model="form.versionName" placeholder="请输入版本名称" maxlength="20" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="版本号" prop="versionNum">
|
|
|
|
|
|
+ <el-form-item label="版本号:" prop="versionNum">
|
|
<el-input v-model="form.versionNum" placeholder="请输入版本号" maxlength="11" />
|
|
<el-input v-model="form.versionNum" placeholder="请输入版本号" maxlength="11" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="备注" prop="remark">
|
|
|
|
|
|
+ <el-form-item label="备注:" prop="remark">
|
|
<el-input v-model="form.remark" placeholder="请输入备注" maxlength="50" />
|
|
<el-input v-model="form.remark" placeholder="请输入备注" maxlength="50" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
|
|
|
- <el-form-item label="上传文件" class="margin-bottom_0">
|
|
|
|
- <myUpload :file-list="[form.systemFileList]" @on-change="onchangeFile" @on-remove="onRemove" :multiple="false" :limit="1"
|
|
|
|
|
|
+ <el-form-item label="上传文件:" class="margin-bottom_0">
|
|
|
|
+ <myUpload :file-list="form.systemFileList" @on-change="onchangeFile" @on-remove="onRemove" :multiple="false" :limit="1"
|
|
style="height: 185px;" :autoUpload="true">
|
|
style="height: 185px;" :autoUpload="true">
|
|
</myUpload>
|
|
</myUpload>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
-
|
|
|
|
|
|
+
|
|
</el-form>
|
|
</el-form>
|
|
|
|
+ <div style="border:1px solid white;padding:10px;margin:10px 0;border-radius:8px;">
|
|
|
|
+ <div style="height: 500px;" >
|
|
|
|
+ <p>选择功能:</p>
|
|
|
|
+ <funTable ref="functionTable" :applyId="form.applyId" :tableData="tableData" :loading="loading" :checkFunctions="checkFunctions" :expandAll="true">
|
|
|
|
+ <template slot="column">
|
|
|
|
+ <el-table-column label="授权代码" align="center">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-input type="textarea" :value="getCode(scope.row.id,'code1')" @change="(val)=>setCodeList_code(scope.row.id,val,'code1')"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ <el-table-column label="代码" align="center">
|
|
|
|
+ <template slot-scope="scope">
|
|
|
|
+ <el-input type="textarea" :value="getCode(scope.row.id,'code1')" @change="(val)=>setCodeList_code(scope.row.id,val,'code2')"></el-input>
|
|
|
|
+ </template>
|
|
|
|
+ </el-table-column>
|
|
|
|
+ </template>
|
|
|
|
+
|
|
|
|
+ </funTable>
|
|
|
|
+
|
|
|
|
+ </div>
|
|
|
|
+ <div class="pagination" style="margin-top:10px">
|
|
|
|
+ <el-pagination :current-page.sync="queryParams.current" :page-size="queryParams.size" :total="total" @current-change="handleCurrentChange" layout="total, prev, pager, next, jumper" background></el-pagination>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
<div class="button-container">
|
|
<div class="button-container">
|
|
- <el-button type="primary" :loading="btnLoading" @click="submitForm">提 交</el-button>
|
|
|
|
- <el-button @click="resetForm">重 置</el-button>
|
|
|
|
|
|
+ <el-button type="primary" size="small" :loading="btnLoading" @click="submitForm">提 交</el-button>
|
|
|
|
+ <el-button size="small" @click="resetForm">重 置</el-button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
-
|
|
|
|
|
|
+import funTable from './functionTable.vue';
|
|
|
|
|
|
const currentForm = {
|
|
const currentForm = {
|
|
id:null,
|
|
id:null,
|
|
versionName:null,
|
|
versionName:null,
|
|
versionNum:null,
|
|
versionNum:null,
|
|
|
|
+ applicationCode:'4e95e3d926a2a4befa5d913acc0aa9f5',
|
|
|
|
+ applyId:14,
|
|
remark:null,
|
|
remark:null,
|
|
- systemFileList:{}
|
|
|
|
|
|
+ systemFileList:[]
|
|
}
|
|
}
|
|
export default {
|
|
export default {
|
|
- components: {},
|
|
|
|
|
|
+ components: {
|
|
|
|
+ funTable
|
|
|
|
+ },
|
|
props: {
|
|
props: {
|
|
versionId:"",
|
|
versionId:"",
|
|
model:{
|
|
model:{
|
|
@@ -59,13 +88,24 @@ export default {
|
|
versionNum: [
|
|
versionNum: [
|
|
{ required: true, message: "版本号不能为空", trigger: "blur" }
|
|
{ required: true, message: "版本号不能为空", trigger: "blur" }
|
|
]
|
|
]
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ checkFunctions:[223],
|
|
|
|
+ checkFunctions_back_up:[223],
|
|
|
|
+ codeList:[],
|
|
|
|
+ tableData:[],
|
|
|
|
+ queryParams:{
|
|
|
|
+ name:'',
|
|
|
|
+ current:1,
|
|
|
|
+ size:10,
|
|
|
|
+ },
|
|
|
|
+ total:0,
|
|
|
|
+ loading:false,
|
|
};
|
|
};
|
|
},
|
|
},
|
|
watch: {
|
|
watch: {
|
|
versionId(){
|
|
versionId(){
|
|
this.init()
|
|
this.init()
|
|
- }
|
|
|
|
|
|
+ },
|
|
},
|
|
},
|
|
computed: {},
|
|
computed: {},
|
|
created() {},
|
|
created() {},
|
|
@@ -74,14 +114,28 @@ export default {
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
//初始化当前页面
|
|
//初始化当前页面
|
|
- init(){
|
|
|
|
|
|
+ async init(){
|
|
if(this.model == 'add'){
|
|
if(this.model == 'add'){
|
|
this.resetForm()
|
|
this.resetForm()
|
|
|
|
+ await this.getList()
|
|
|
|
+ this.getFunctionId(this.tableData.children,[])
|
|
}else if(this.model == 'edit'){
|
|
}else if(this.model == 'edit'){
|
|
//查询数据并检验
|
|
//查询数据并检验
|
|
this.getById()
|
|
this.getById()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
|
|
+ getFunctionId(data,checkData=[]){
|
|
|
|
+ for(var i = 0;i<data.length;i++){
|
|
|
|
+ checkData.push(data[i].id)
|
|
|
|
+ if(data[i].children && data[i].children.length>0){
|
|
|
|
+ this.getFunctionId(data[i].children,checkData)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ this.checkFunctions = checkData
|
|
|
|
+ this.$nextTick(()=>{
|
|
|
|
+ this.checkFunctions_back_up = [...checkData]
|
|
|
|
+ })
|
|
|
|
+ },
|
|
//查询数据并校验
|
|
//查询数据并校验
|
|
getById(){
|
|
getById(){
|
|
if(!this.versionId){
|
|
if(!this.versionId){
|
|
@@ -94,11 +148,49 @@ export default {
|
|
this.$api.getVersionById(params).then(response=>{
|
|
this.$api.getVersionById(params).then(response=>{
|
|
if(response.code == 200){
|
|
if(response.code == 200){
|
|
this.form = response.data.records
|
|
this.form = response.data.records
|
|
|
|
+ this.getList()
|
|
|
|
+ this.getCodeList()
|
|
}
|
|
}
|
|
}).catch(error=>{
|
|
}).catch(error=>{
|
|
this.resetForm()
|
|
this.resetForm()
|
|
})
|
|
})
|
|
},
|
|
},
|
|
|
|
+ //获取代码集合
|
|
|
|
+ getCodeList(){
|
|
|
|
+ if(!this.form.id){
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.codeList = []
|
|
|
|
+ },
|
|
|
|
+ //获取代码
|
|
|
|
+ getCode(funId,field){
|
|
|
|
+ var index = this.codeList.findIndex(item=>{
|
|
|
|
+ return item.id == funId
|
|
|
|
+ })
|
|
|
|
+ if(index!=-1){
|
|
|
|
+ return this.codeList[index][field]
|
|
|
|
+ }
|
|
|
|
+ return ''
|
|
|
|
+ },
|
|
|
|
+ //改变代码
|
|
|
|
+ setCodeList_code(funId,value,field){
|
|
|
|
+ var index1 = this.checkFunctions.indexOf(funId)
|
|
|
|
+ if(index1 ==-1){
|
|
|
|
+ this.checkFunctions.push(funId)
|
|
|
|
+ }
|
|
|
|
+ var index = this.codeList.findIndex(item=>{
|
|
|
|
+ return item.id == funId
|
|
|
|
+ })
|
|
|
|
+ if(index!=-1){
|
|
|
|
+ this.codeList[index][field] = value
|
|
|
|
+ }else{
|
|
|
|
+ var obj = {
|
|
|
|
+ id:funId,
|
|
|
|
+ }
|
|
|
|
+ obj[field] = value
|
|
|
|
+ this.codeList.push(obj)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
//重置表单
|
|
//重置表单
|
|
resetForm(){
|
|
resetForm(){
|
|
this.form = Object.assign({}, currentForm)
|
|
this.form = Object.assign({}, currentForm)
|
|
@@ -108,6 +200,15 @@ export default {
|
|
submitForm: function() {
|
|
submitForm: function() {
|
|
this.$refs['form'].validate((valid) => {
|
|
this.$refs['form'].validate((valid) => {
|
|
if (valid) {
|
|
if (valid) {
|
|
|
|
+ var fileGuids = this.$commonJS.checkUploadFile(this.form.systemFileList)
|
|
|
|
+ if(!fileGuids){
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.form.fileGuid = fileGuids.length>0?fileGuids[0]:''
|
|
|
|
+ this.form.assoFunctionCodeDTO = this.codeList.filter(item=>{
|
|
|
|
+ return this.checkFunctions.indexOf(item.id) != -1
|
|
|
|
+ })
|
|
|
|
+
|
|
this.btnLoading = true
|
|
this.btnLoading = true
|
|
var a = '添加'
|
|
var a = '添加'
|
|
var api = 'addVersion'
|
|
var api = 'addVersion'
|
|
@@ -119,7 +220,7 @@ export default {
|
|
if (response.code === 200) {
|
|
if (response.code === 200) {
|
|
this.btnLoading = false
|
|
this.btnLoading = false
|
|
this.$message.success( a + '成功');
|
|
this.$message.success( a + '成功');
|
|
- this.resetForm();
|
|
|
|
|
|
+ this.finish()
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.catch(error => {
|
|
.catch(error => {
|
|
@@ -129,18 +230,98 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ finish(){
|
|
|
|
+ if(this.model == 'add'){
|
|
|
|
+ this.resetForm();
|
|
|
|
+ this.checkFunctions_back_up = [...this.checkFunctions]
|
|
|
|
+ this.codeList = []
|
|
|
|
+ }else{
|
|
|
|
+ this.$store.commit('removeHistoryPath',this.$route.path);
|
|
|
|
+ this.$store.commit('removeHistory',this.$route.path);
|
|
|
|
+ this.$router.push(
|
|
|
|
+ {
|
|
|
|
+ path:'/administrator/vision'
|
|
|
|
+ }
|
|
|
|
+ )
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //文件切换
|
|
|
|
+ onchangeFile(file){
|
|
|
|
+ if(file.guid){
|
|
|
|
+ let a = this.form.systemFileList.findIndex(item => {
|
|
|
|
+ return item.uid == file.uid
|
|
|
|
+ })
|
|
|
|
+ if (a != -1) {
|
|
|
|
+ this.form.systemFileList.splice(a,1,file)
|
|
|
|
+ }
|
|
|
|
+ }else{
|
|
|
|
+ this.form.systemFileList.push(file)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //删除文件
|
|
|
|
+ onRemove(file){
|
|
|
|
+ if (file.guid) {
|
|
|
|
+ let a = this.form.systemFileList.findIndex(item => {
|
|
|
|
+ return item.guid == file.guid
|
|
|
|
+ })
|
|
|
|
+ if(a != -1){
|
|
|
|
+ this.form.systemFileList.splice(a, 1)
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ let a = this.form.systemFileList.findIndex(item => {
|
|
|
|
+ return item.uid == file.uid
|
|
|
|
+ })
|
|
|
|
+ this.form.systemFileList.splice(a, 1)
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ //查询功能列表
|
|
|
|
+ async getList() {
|
|
|
|
+ if(!this.form.applyId){
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+ this.queryParams.apply = this.form.applyId
|
|
|
|
+ this.loading = true
|
|
|
|
+ await this.$api.queryFunctionList(this.queryParams).then(response => {
|
|
|
|
+ this.tableData = response.data
|
|
|
|
+ var a = response.data.children
|
|
|
|
+ for(var j = 0;j<a.length;j++){
|
|
|
|
+ function l(data){
|
|
|
|
+ if(data.hasOwnProperty('children')){
|
|
|
|
+ for(var i = 0;i<data.children.length;i++){
|
|
|
|
+
|
|
|
|
+ if(data.hasOwnProperty('last')){
|
|
|
|
+ data.children[i].last=data.last+'/'+data.name
|
|
|
|
+ }else{
|
|
|
|
+ data.children[i].last=data.name
|
|
|
|
+ }
|
|
|
|
+ l(data.children[i])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ l(a[j])
|
|
|
|
+ }
|
|
|
|
+ this.total=response.pageColumn.total
|
|
|
|
+ this.loading = false
|
|
|
|
+ }).catch(error => {
|
|
|
|
+ this.loading = true
|
|
|
|
+ })
|
|
|
|
+ },
|
|
|
|
+ //切换分页
|
|
|
|
+ handleCurrentChange(val){
|
|
|
|
+ this.queryParams.current = val
|
|
|
|
+ this.getList()
|
|
|
|
+ }
|
|
},
|
|
},
|
|
};
|
|
};
|
|
</script>
|
|
</script>
|
|
<style lang="scss">
|
|
<style lang="scss">
|
|
.form_center {
|
|
.form_center {
|
|
- display: flex;
|
|
|
|
- align-items: center;
|
|
|
|
- flex-direction: column;
|
|
|
|
|
|
+ width: 800px;
|
|
|
|
+ margin: 30px auto;
|
|
}
|
|
}
|
|
|
|
|
|
.button-container {
|
|
.button-container {
|
|
display: flex;
|
|
display: flex;
|
|
- justify-content: center;
|
|
|
|
|
|
+ justify-content:flex-end;
|
|
}
|
|
}
|
|
</style>
|
|
</style>
|