Browse Source

优化

master
陈裕财 4 years ago
parent
commit
dd53a87fa2
  1. 36
      src/views/xm/core/xmIteration/XmIterationAdd.vue
  2. 16
      src/views/xm/core/xmIterationLink/XmIterationLinkForProject.vue

36
src/views/xm/core/xmIteration/XmIterationAdd.vue

@ -2,19 +2,10 @@
<section class="page-container padding border"> <section class="page-container padding border">
<el-row> <el-row>
<!--新增界面 XmIteration 迭代定义--> <!--新增界面 XmIteration 迭代定义-->
<el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm">
<el-form-item v-if="parentIteration" label="上级迭代" prop="pid">
{{parentIteration.seqNo}}&nbsp;&nbsp;{{parentIteration.iterationName}}
</el-form-item>
<el-form-item v-else label="上级迭代" prop="pid">
无上级
</el-form-item>
<el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm">
<el-form-item label="迭代名称" prop="iterationName"> <el-form-item label="迭代名称" prop="iterationName">
<el-input v-model="addForm.iterationName" placeholder="迭代名称" ></el-input> <el-input v-model="addForm.iterationName" placeholder="迭代名称" ></el-input>
</el-form-item> </el-form-item>
<el-form-item label="序号" prop="seqNo">
<el-input v-model="addForm.seqNo" placeholder="如1.0,2.0,1.1.1等" ></el-input> <span v-if="parentIteration" style="color:red;">建议{{parentIteration.seqNo}}.1</span>
</el-form-item>
<el-form-item label="开始时间" prop="startTime"> <el-form-item label="开始时间" prop="startTime">
<el-date-picker type="date" placeholder="选择日期" v-model="addForm.startTime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker> <el-date-picker type="date" placeholder="选择日期" v-model="addForm.startTime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item> </el-form-item>
@ -59,7 +50,7 @@
'userInfo','roles' 'userInfo','roles'
]) ])
}, },
props:['xmIteration','visible','parentIteration'],
props:['xmIteration','visible','parentIteration','selProject','xmProduct'],
watch: { watch: {
'xmIteration':function( xmIteration ) { 'xmIteration':function( xmIteration ) {
this.addForm = xmIteration; this.addForm = xmIteration;
@ -112,22 +103,25 @@
this.$emit('cancel'); this.$emit('cancel');
}, },
//XmIteration @submit="afterAddSubmit" //XmIteration @submit="afterAddSubmit"
addSubmit: function () {
if(!this.roles.some(i=>i.roleid=='iterationAdmin')){
this.$notify({showClose: true, message: "只有迭代管理员可以修改迭代", type: 'error' });
return ;
}
addSubmit: function () {
this.$refs.addForm.validate((valid) => { this.$refs.addForm.validate((valid) => {
if (valid) {
if (valid) {
var links=[];
if(this.xmProduct){
links.push({proId:this.xmProduct.id,ltype:'1'})
}
if(this.selProject){
links.push({proId:this.selProject.id,ltype:'0'})
}
var params={...this.addForm}
params.links=links;
this.$confirm('确认提交吗?', '提示', {}).then(() => { this.$confirm('确认提交吗?', '提示', {}).then(() => {
this.load.add=true
let params = Object.assign({}, this.addForm);
this.load.add=true
addXmIteration(params).then((res) => { addXmIteration(params).then((res) => {
this.load.add=false this.load.add=false
var tips=res.data.tips; var tips=res.data.tips;
if(tips.isOk){
this.$refs['addForm'].resetFields();
if(tips.isOk){
this.$emit('submit',res.data.data);// @submit="afterAddSubmit" this.$emit('submit',res.data.data);// @submit="afterAddSubmit"
} }
this.$notify({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' }); this.$notify({showClose: true, message: tips.msg, type: tips.isOk?'success':'error' });

16
src/views/xm/core/xmIterationLink/XmIterationLinkForProject.vue

@ -3,6 +3,7 @@
<el-row> <el-row>
<el-button type="primary" v-if="xmIteration" @click="projectVisible=true" icon="el-icon-plus" > 选择更多项目加入迭代 </el-button> <el-button type="primary" v-if="xmIteration" @click="projectVisible=true" icon="el-icon-plus" > 选择更多项目加入迭代 </el-button>
<el-button type="primary" v-if="selProject" @click="iterationVisible=true" icon="el-icon-plus" > 选择更多迭代加入项目 </el-button> <el-button type="primary" v-if="selProject" @click="iterationVisible=true" icon="el-icon-plus" > 选择更多迭代加入项目 </el-button>
<el-button type="primary" icon="el-icon-plus" @click="showAdd"> 新增迭代 </el-button>
</el-row> </el-row>
<el-row style="padding-top:10px;"> <el-row style="padding-top:10px;">
<!--列表 XmIterationLink 迭代表与项目表的关联关系一般由迭代管理员将迭代挂接到项目表--> <!--列表 XmIterationLink 迭代表与项目表的关联关系一般由迭代管理员将迭代挂接到项目表-->
@ -28,6 +29,11 @@
<el-drawer title="选择迭代" :visible.sync="iterationVisible" size="50%" append-to-body :close-on-click-modal="false"> <el-drawer title="选择迭代" :visible.sync="iterationVisible" size="50%" append-to-body :close-on-click-modal="false">
<xm-iteration-select @row-click="onIterationSelect"></xm-iteration-select> <xm-iteration-select @row-click="onIterationSelect"></xm-iteration-select>
</el-drawer> </el-drawer>
<!--新增 XmIteration 迭代定义界面-->
<el-drawer title="新增迭代" :visible.sync="addFormVisible" size="50%" append-to-body :close-on-click-modal="false">
<xm-iteration-add :xm-iteration="addForm" :sel-project="selProject" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-iteration-add>
</el-drawer>
</el-row> </el-row>
</section> </section>
</template> </template>
@ -37,12 +43,13 @@
import config from '@/common/config';// import config from '@/common/config';//
import { listOption } from '@/api/mdp/meta/itemOption';// import { listOption } from '@/api/mdp/meta/itemOption';//
import { listXmIterationLinkWithProjectInfo,addXmIterationLink, delXmIterationLink, batchDelXmIterationLink } from '@/api/xm/core/xmIterationLink'; import { listXmIterationLinkWithProjectInfo,addXmIterationLink, delXmIterationLink, batchDelXmIterationLink } from '@/api/xm/core/xmIterationLink';
import XmIterationLinkAdd from './XmIterationLinkAdd';//
import XmIterationLinkEdit from './XmIterationLinkEdit';//
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import XmProjectSelect from '../xmProject/XmProjectSelect.vue'; import XmProjectSelect from '../xmProject/XmProjectSelect.vue';
import XmIterationSelect from '../xmIteration/XmIterationSelect.vue'; import XmIterationSelect from '../xmIteration/XmIterationSelect.vue';
import XmIterationAdd from '../xmIteration/XmIterationAdd';//
export default { export default {
props:['xmIteration','selProject'], props:['xmIteration','selProject'],
watch:{ watch:{
@ -268,11 +275,10 @@
/**end 自定义函数请在上面加**/ /**end 自定义函数请在上面加**/
},//end methods },//end methods
components: {
'xm-iteration-link-add':XmIterationLinkAdd,
'xm-iteration-link-edit':XmIterationLinkEdit,
components: {
XmProjectSelect, XmProjectSelect,
XmIterationSelect, XmIterationSelect,
XmIterationAdd,
}, },
mounted() { mounted() {
this.$nextTick(() => { this.$nextTick(() => {

Loading…
Cancel
Save