|
@@ -1,96 +1,104 @@
|
|
|
<template>
|
|
|
- <div class="form_center">
|
|
|
- <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-form-item>
|
|
|
-
|
|
|
- <el-form-item label="版本号:" prop="versionNum">
|
|
|
- <el-input v-model="form.versionNum" placeholder="请输入版本号" maxlength="11" />
|
|
|
- </el-form-item>
|
|
|
+ <div>
|
|
|
+ <div class="button-container" v-if="model != 'detail'">
|
|
|
+ <el-button type="primary" size="small" :loading="btnLoading" @click="submitForm">提 交</el-button>
|
|
|
+ <el-button size="small" @click="init">重 置</el-button>
|
|
|
+ </div>
|
|
|
+ <div class="form_center">
|
|
|
+ <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-form-item>
|
|
|
|
|
|
- <el-form-item label="版本状态:" prop="versionNum">
|
|
|
- <el-select v-model="form.status" placeholder="请选择版本状态">
|
|
|
- <el-option :label="'已保存'" :value="1"></el-option>
|
|
|
- <el-option :label="'调试'" :value="2"></el-option>
|
|
|
- <el-option :label="'已发布'" :value="3"></el-option>
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
-
|
|
|
- <el-form-item label="备注:" prop="remark">
|
|
|
- <el-input v-model="form.remark" placeholder="请输入备注" maxlength="50" />
|
|
|
- </el-form-item>
|
|
|
+ <el-form-item label="版本号:" prop="versionNum">
|
|
|
+ <el-input v-model="form.versionNum" placeholder="请输入版本号" maxlength="11" />
|
|
|
+ </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"
|
|
|
- style="height: 185px;" :autoUpload="true">
|
|
|
- </myUpload>
|
|
|
- </el-form-item>
|
|
|
+ <el-form-item label="版本状态:" prop="status">
|
|
|
+ <el-radio-group v-model="form.status">
|
|
|
+ <el-radio v-for="(item, key) in status" :key="key" :label="parseInt(key)">{{item}}</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </el-form-item>
|
|
|
|
|
|
- </el-form>
|
|
|
- <div style="border:1px solid white;padding:10px;margin:10px 0;border-radius:8px;">
|
|
|
- <div style="height: 500px;" >
|
|
|
- <p style="display:flex;align-items:center;justify-content:space-between">
|
|
|
- 选择功能:
|
|
|
- <el-button type="primary" size="small" @click="addFunction(1,form)">添加功能</el-button>
|
|
|
- </p>
|
|
|
- <funTable ref="functionTable" :tableData="tableData" :loading="loading" :reload="reload" :defaultChecked="true">
|
|
|
- <template slot="column">
|
|
|
- <el-table-column label="授权代码" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <value-input v-if="!scope.row.children || scope.row.children == 0" type="textarea" :value="getCode(scope.row,2)" @change="(val)=>setCodeList_code(scope.row,val,2)"></value-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="代码" align="center">
|
|
|
- <template slot-scope="scope">
|
|
|
- <value-input v-if="!scope.row.children || scope.row.children == 0" type="textarea" :value="getCode(scope.row,1)" @change="(val)=>setCodeList_code(scope.row,val,1)"></value-input>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- <el-table-column label="操作" align="center" width="100px">
|
|
|
- <template slot-scope="scope">
|
|
|
- <div>
|
|
|
- <el-button type="text" size="small" @click="addFunction(2,scope.row)">新增子功能</el-button>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </el-table-column>
|
|
|
- </template>
|
|
|
- </funTable>
|
|
|
+ <el-form-item label="备注:" prop="remark">
|
|
|
+ <el-input v-model="form.remark" placeholder="请输入备注" maxlength="50" />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ <el-form-item label="上传文件:" class="margin-bottom_0">
|
|
|
+ <myUpload :file-list="(form.systemFile && form.systemFile.guid)?[form.systemFile]:[]" @on-change="onchangeFile" @on-remove="onRemove" :multiple="false" :limit="1"
|
|
|
+ style="height: 185px;" :autoUpload="true">
|
|
|
+ </myUpload>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <div style="border:1px solid white;padding:10px;margin:10px 0;border-radius:8px;">
|
|
|
+ <div style="height: 500px;" >
|
|
|
+ <p style="display:flex;align-items:center;justify-content:space-between">
|
|
|
+ 选择功能:
|
|
|
+ <el-button v-if="model != 'detail'" type="primary" size="small" @click="addFunction(1,form)">添加功能</el-button>
|
|
|
+ </p>
|
|
|
+ <funTable ref="functionTable" :tableData="tableData" :loading="loading" :reload="reload" :defaultChecked="true">
|
|
|
+ <template slot="column">
|
|
|
+ <el-table-column label="授权代码" align="center">
|
|
|
+ <template slot-scope="scope" v-if="!scope.row.children || scope.row.children == 0">
|
|
|
+ <span v-if="model == 'detail'">
|
|
|
+ {{ getCode(scope.row,2) }}
|
|
|
+ </span>
|
|
|
+ <value-input v-else type="textarea" :value="getCode(scope.row,2)" @change="(val)=>setCodeList_code(scope.row,val,2)"></value-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="未授权代码" align="center">
|
|
|
+ <template slot-scope="scope" v-if="!scope.row.children || scope.row.children == 0">
|
|
|
+ <span v-if="model == 'detail'">
|
|
|
+ {{ getCode(scope.row,1) }}
|
|
|
+ </span>
|
|
|
+ <value-input v-else type="textarea" :value="getCode(scope.row,1)" @change="(val)=>setCodeList_code(scope.row,val,1)"></value-input>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" align="center" width="120px" v-if="model != 'detail'">
|
|
|
+ <template slot-scope="scope">
|
|
|
+ <div>
|
|
|
+ <el-button type="text" size="small" @click="addFunction(2,scope.row)">新增子功能</el-button>
|
|
|
+ <el-button type="text" size="small" @click="remove(scope.row)">移除</el-button>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ </template>
|
|
|
+ </funTable>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- <div class="button-container">
|
|
|
- <el-button type="primary" size="small" :loading="btnLoading" @click="submitForm">提 交</el-button>
|
|
|
- <el-button size="small" @click="resetForm">重 置</el-button>
|
|
|
- </div>
|
|
|
-
|
|
|
<addFunctionDialog ref="addFunctionDialog" @getNewFunction="getNewFunction"></addFunctionDialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import funTable from './functionTable.vue';
|
|
|
-import functionData from './mixins/functionData';
|
|
|
+import funTable from '../functionTable.vue';
|
|
|
+import functionData from '../mixins/functionData';
|
|
|
+import commonData from '../mixins/commonData';
|
|
|
const currentForm = {
|
|
|
id:null,
|
|
|
versionName:null,
|
|
|
versionNum:null,
|
|
|
- status: null,
|
|
|
+ fileGuid:null,
|
|
|
+ status: 1,
|
|
|
applicationCode:'4e95e3d926a2a4befa5d913acc0aa9f5',
|
|
|
applyId:14,
|
|
|
remark:null,
|
|
|
- systemFileList:[]
|
|
|
+ systemFile:null,
|
|
|
+ assoFunctionCodeDTOS:[]
|
|
|
}
|
|
|
export default {
|
|
|
components: {
|
|
|
funTable
|
|
|
},
|
|
|
- mixins:[functionData],
|
|
|
+ mixins:[functionData,commonData],
|
|
|
props: {
|
|
|
versionId:"",
|
|
|
model:{
|
|
|
type:String,
|
|
|
default:"add"
|
|
|
- }
|
|
|
+ },
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -106,22 +114,20 @@ export default {
|
|
|
{ required: true, message: "版本号不能为空", trigger: "blur" }
|
|
|
]
|
|
|
},
|
|
|
- checkFunctions:[],
|
|
|
- checkFunctions_back_up:[],
|
|
|
- codeList:[],
|
|
|
+ // checkFunctions:[],
|
|
|
+ // checkFunctions_back_up:[],
|
|
|
+ // codeList:[],
|
|
|
tableData:{},
|
|
|
- queryParams:{
|
|
|
- name:'',
|
|
|
- current:1,
|
|
|
- size:10000,
|
|
|
- },
|
|
|
- total:0,
|
|
|
loading:false,
|
|
|
reload:true,
|
|
|
+
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
|
|
versionId(){
|
|
|
+ if(this.$route.path != '/administrator/editVersion'){
|
|
|
+ return
|
|
|
+ }
|
|
|
this.init()
|
|
|
},
|
|
|
},
|
|
@@ -135,9 +141,16 @@ export default {
|
|
|
async init(){
|
|
|
if(this.model == 'add'){
|
|
|
this.resetForm()
|
|
|
- }else if(this.model == 'edit'){
|
|
|
+ }else if(this.model == 'edit' || this.model == 'detail'){
|
|
|
+ if( this.model == 'detail'){
|
|
|
+ this.reload = false
|
|
|
+ }
|
|
|
this.getById()
|
|
|
}
|
|
|
+ this.reload = false
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.reload = true
|
|
|
+ })
|
|
|
await this.getList()
|
|
|
},
|
|
|
//查询数据并校验
|
|
@@ -147,11 +160,14 @@ export default {
|
|
|
return
|
|
|
}
|
|
|
var params = {
|
|
|
- id: this.versionId,
|
|
|
+ ids: [this.versionId],
|
|
|
};
|
|
|
- this.$api.getVersionById(params).then(response=>{
|
|
|
+ this.$api.getVersionList(params).then(response=>{
|
|
|
if(response.code == 200){
|
|
|
- this.form = response.data.records
|
|
|
+ var data = response.data.records
|
|
|
+ if(data && data.length>0){
|
|
|
+ this.form = data[0]
|
|
|
+ }
|
|
|
}
|
|
|
}).catch(error=>{
|
|
|
this.resetForm()
|
|
@@ -161,10 +177,6 @@ export default {
|
|
|
resetForm(){
|
|
|
this.form = Object.assign({}, currentForm)
|
|
|
this.$refs['form'].resetFields();
|
|
|
- this.reload = false
|
|
|
- this.$nextTick(()=>{
|
|
|
- this.reload = true
|
|
|
- })
|
|
|
},
|
|
|
//获取所有的功能及代码
|
|
|
getAllFunCode(data,funCode){
|
|
@@ -187,14 +199,14 @@ export default {
|
|
|
submitForm: function() {
|
|
|
this.$refs['form'].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- var fileGuids = this.$commonJS.checkUploadFile(this.form.systemFileList)
|
|
|
+ var fileGuids = this.$commonJS.checkUploadFile([this.form.systemFile])
|
|
|
if(!fileGuids){
|
|
|
return
|
|
|
}
|
|
|
this.form.fileGuid = fileGuids.length>0?fileGuids[0]:''
|
|
|
var assoFunctionCodeDTO = []
|
|
|
this.getAllFunCode(this.tableData.children,assoFunctionCodeDTO)
|
|
|
- this.form.assoFunctionCodeDTO = assoFunctionCodeDTO
|
|
|
+ this.form.assoFunctionCodeDTOS = assoFunctionCodeDTO
|
|
|
this.btnLoading = true
|
|
|
var a = '添加'
|
|
|
var api = 'addVersion'
|
|
@@ -233,45 +245,26 @@ export default {
|
|
|
//文件切换
|
|
|
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)
|
|
|
+ this.$set(this.form,'systemFile',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)
|
|
|
- }
|
|
|
+ this.$set(this.form,'systemFile',null)
|
|
|
},
|
|
|
//查询功能列表
|
|
|
async getList() {
|
|
|
- if(!this.form.applyId){
|
|
|
- return false
|
|
|
- }
|
|
|
- this.queryParams.apply = this.form.applyId
|
|
|
- if(this.model == 'edit'){
|
|
|
- this.queryParams.versonId = 1
|
|
|
+ var params = {}
|
|
|
+ if(this.model != 'add'){
|
|
|
+ params.versionId = this.versionId
|
|
|
}
|
|
|
this.loading = true
|
|
|
- await this.$api.queryFunctionList(this.queryParams).then(response => {
|
|
|
- this.tableData = response.data
|
|
|
- var a = response.data.children
|
|
|
+ await this.$api.queryFunctionCode(params).then(response => {
|
|
|
+ this.tableData = {
|
|
|
+ applyId:this.form.applyId,
|
|
|
+ children:response.data
|
|
|
+ }
|
|
|
+ var a = response.data
|
|
|
for(var j = 0;j<a.length;j++){
|
|
|
function l(data){
|
|
|
if(data.hasOwnProperty('children')){
|
|
@@ -288,7 +281,6 @@ export default {
|
|
|
}
|
|
|
l(a[j])
|
|
|
}
|
|
|
- this.total=response.pageColumn.total
|
|
|
this.loading = false
|
|
|
}).catch(error => {
|
|
|
this.loading = true
|
|
@@ -364,7 +356,11 @@ export default {
|
|
|
}
|
|
|
|
|
|
.button-container {
|
|
|
+ max-width: 1200px;
|
|
|
display: flex;
|
|
|
justify-content:flex-end;
|
|
|
+ margin: 10px auto;
|
|
|
+ position:sticky;
|
|
|
+ top:10px,
|
|
|
}
|
|
|
</style>
|