6 changed files with 385 additions and 455 deletions
-
4src/views/xm/core/components/XmProductSelect.vue
-
211src/views/xm/core/xmProduct/XmProductAdd.vue
-
355src/views/xm/core/xmProduct/XmProductEdit.vue
-
4src/views/xm/core/xmProduct/XmProductForLinkComplex.vue
-
4src/views/xm/core/xmProduct/XmProductMng.vue
-
20src/views/xm/core/xmProject/XmProjectEdit.vue
@ -1,211 +0,0 @@ |
|||||
<template> |
|
||||
<section class="page-container padding border"> |
|
||||
<el-row class="page-main "> |
|
||||
<!--新增界面 XmProduct 产品表--> |
|
||||
<el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm"> |
|
||||
|
|
||||
<el-form-item label="产品名称" prop="productName"> |
|
||||
<el-input v-model="addForm.productName" placeholder="产品名称" ></el-input> |
|
||||
</el-form-item> |
|
||||
|
|
||||
<el-form-item label="产品代号" prop="code"> |
|
||||
<el-input v-model="addForm.code" placeholder="产品代号,不可为空" > |
|
||||
<template slot="append"> |
|
||||
<el-button type="text" @click="createProductCode">自动生成</el-button> |
|
||||
</template> |
|
||||
</el-input> |
|
||||
|
|
||||
<font color="blue" style="font-size:10px;">产品代号为合同上的产品代号,甲乙方共享;产品内部编号为 代号-四位随机码</font> |
|
||||
</el-form-item> |
|
||||
<el-row> |
|
||||
<el-col :span="8"> |
|
||||
<el-form-item label="总监" prop="admUserid"> |
|
||||
<el-input readonly v-model="addForm.admUsername" @click.native="showUserVisible('admUserid')"></el-input> |
|
||||
<font style="font-size:12px;" color="blue"></font> |
|
||||
</el-form-item> |
|
||||
</el-col> |
|
||||
<el-col :span="8"> |
|
||||
<el-form-item label="产品经理" prop="pmUserid"> |
|
||||
<el-input readonly v-model="addForm.pmUsername" @click.native="showUserVisible('pmUserid')"></el-input> |
|
||||
<font style="font-size:12px;" color="blue"></font> |
|
||||
</el-form-item> |
|
||||
</el-col> |
|
||||
<el-col :span="8"> |
|
||||
<el-form-item label="副经理、助理" prop="assUserid"> |
|
||||
<el-input readonly v-model="addForm.assUsername" @click.native="showUserVisible('assUserid')"></el-input> |
|
||||
<font style="font-size:12px;" color="blue"></font> |
|
||||
</el-form-item> |
|
||||
</el-col> |
|
||||
</el-row> |
|
||||
<el-form-item label="备注" prop="remark"> |
|
||||
<el-input v-model="addForm.remark" type="textarea" :autosize="{ minRows: 4, maxRows: 20}" placeholder="备注" ></el-input> |
|
||||
</el-form-item> |
|
||||
</el-form> |
|
||||
|
|
||||
|
|
||||
<el-drawer title="选择员工" :visible.sync="userSelectVisible" size="60%" append-to-body> |
|
||||
<users-select @confirm="onUserSelected" ref="usersSelect"></users-select> |
|
||||
</el-drawer> |
|
||||
</el-row> |
|
||||
<el-row style="float:right;"> |
|
||||
<el-button @click.native="handleCancel">取消</el-button> |
|
||||
<el-button v-loading="load.add" type="primary" @click.native="addSubmit" :disabled="load.add==true">提交</el-button> |
|
||||
</el-row> |
|
||||
</section> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
import util from '@/common/js/util';//全局公共库 |
|
||||
import { initSimpleDicts } from '@/api/mdp/meta/item';//下拉框数据查询 |
|
||||
import { addXmProduct,createProductCode } from '@/api/xm/core/xmProduct'; |
|
||||
import { mapGetters } from 'vuex' |
|
||||
import UsersSelect from "@/views/mdp/sys/user/UsersSelect"; |
|
||||
|
|
||||
|
|
||||
export default { |
|
||||
computed: { |
|
||||
...mapGetters([ |
|
||||
'userInfo','roles' |
|
||||
]) |
|
||||
}, |
|
||||
props:['xmProduct','visible','selProject'], |
|
||||
watch: { |
|
||||
'xmProduct':function( xmProduct ) { |
|
||||
this.addForm = xmProduct; |
|
||||
}, |
|
||||
'visible':function(visible) { |
|
||||
if(visible==true){ |
|
||||
this.addForm.pmUserid=this.userInfo.userid |
|
||||
this.addForm.pmUsername=this.userInfo.username |
|
||||
this.addForm.admUserid=this.userInfo.userid |
|
||||
this.addForm.admUsername=this.userInfo.username |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
data() { |
|
||||
return { |
|
||||
dicts:{xmProductPstatus:[]},//下拉选择框的所有静态数据 params=[{categoryId:'0001',itemCode:'sex'}] 返回结果 {'sex':[{optionValue:'1',optionName:'男',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'女',seqOrder:'2',fp:'',isDefault:'0'}]} |
|
||||
load:{ list: false, edit: false, del: false, add: false },//查询中... |
|
||||
addFormRules: { |
|
||||
productName: [ |
|
||||
{ required: true, message: '产品名称不能为空', trigger: 'change' }, |
|
||||
{ min:2,max:250, message: '名称长度在2-250个字符', trigger: 'change' } |
|
||||
], |
|
||||
|
|
||||
code: [ |
|
||||
{ required: true, message: '产品代号不能为空', trigger: 'change' } |
|
||||
], |
|
||||
|
|
||||
pmUserid: [ |
|
||||
{ required: true, message: '产品经理不能为空', trigger: 'change' } |
|
||||
], |
|
||||
|
|
||||
admUserid: [ |
|
||||
{ required: true, message: '产品总监不能为空', trigger: 'change' } |
|
||||
], |
|
||||
remark:[ |
|
||||
{ min:0,max:250, message: '备注长度在10-250个字符', trigger: 'change' } |
|
||||
] |
|
||||
}, |
|
||||
//新增界面数据 产品表 |
|
||||
addForm: { |
|
||||
id:'',productName:'',branchId:'',remark:'',version:'',pmUserid:'',pmUsername:'',ctime:'',deptid:'',pstatus:'',startTime:'',endTime:'',deptName:'',admUserid:'',admUsername:'',assUserid:'',assUsername:'',bizProcInstId:'',bizFlowState:'',isTpl:'',baselineId:'',baseTime:'',code:'',pbudgetWorkload:'',pbudgetAmount:'',pmenuBudgetWorkload:'',pmenuBudgetAmount:'',budgetCtrl:'',phaseBudgetCtrl:'',phaseActCtrl:'',locked:'',del:'',ltime:'' |
|
||||
}, |
|
||||
userSelectVisible:false, |
|
||||
/**begin 在下面加自定义属性,记得补上面的一个逗号**/ |
|
||||
currUserType:'', |
|
||||
/**end 在上面加自定义属性**/ |
|
||||
}//end return |
|
||||
},//end data |
|
||||
methods: { |
|
||||
// 取消按钮点击 父组件监听@cancel="addFormVisible=false" 监听 |
|
||||
handleCancel:function(){ |
|
||||
this.$emit('cancel'); |
|
||||
}, |
|
||||
//新增提交XmProduct 产品表 父组件监听@submit="afterAddSubmit" |
|
||||
addSubmit: function () { |
|
||||
|
|
||||
this.$refs.addForm.validate((valid) => { |
|
||||
if (valid) { |
|
||||
var msg=this.selProject&&this.selProject.id?'将自动关联项目【'+this.selProject.name?this.selProject.name:this.selProject.id+'】':''; |
|
||||
this.$confirm('确认提交吗?'+msg, '提示', {}).then(() => { |
|
||||
this.load.add=true |
|
||||
let params = Object.assign({}, this.addForm); |
|
||||
if(this.selProject &&this.selProject.id){ |
|
||||
params.links=[{projectId:this.selProject.id}] |
|
||||
} |
|
||||
params.branchId=this.userInfo.branchId |
|
||||
addXmProduct(params).then((res) => { |
|
||||
this.load.add=false |
|
||||
var tips=res.data.tips; |
|
||||
if(tips.isOk){ |
|
||||
//this.$refs['addForm'].resetFields(); |
|
||||
this.$emit('submit',res.data.data);// @submit="afterAddSubmit" |
|
||||
} |
|
||||
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' }); |
|
||||
}).catch( err => this.load.add=false); |
|
||||
}); |
|
||||
}else{ |
|
||||
this.$notify({position:'bottom-left',showClose:true,message: "表单检查不通过", type: 'error' }); |
|
||||
} |
|
||||
}); |
|
||||
}, |
|
||||
createProductCode(){ |
|
||||
createProductCode({}).then(res=>{ |
|
||||
var tips=res.data.tips; |
|
||||
if(tips.isOk){ |
|
||||
this.addForm.code=res.data.data |
|
||||
} |
|
||||
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' }); |
|
||||
}) |
|
||||
}, |
|
||||
showUserVisible(userType){ |
|
||||
this.currUserType=userType |
|
||||
this.userSelectVisible=true; |
|
||||
}, |
|
||||
//选择人员 |
|
||||
onUserSelected: function(users) { |
|
||||
this.userSelectVisible = false; |
|
||||
var user={userid:'',username:''}; |
|
||||
if(users && users.length>0){ |
|
||||
user=users[0] |
|
||||
} |
|
||||
|
|
||||
if(this.currUserType=='admUserid'){ |
|
||||
this.addForm.admUserid=user.userid |
|
||||
this.addForm.admUsername=user.username |
|
||||
}else if(this.currUserType=='assUserid'){ |
|
||||
this.addForm.assUserid=user.userid |
|
||||
this.addForm.assUsername=user.username |
|
||||
}else if(this.currUserType=='pmUserid'){ |
|
||||
this.addForm.pmUserid=user.userid |
|
||||
this.addForm.pmUsername=user.username |
|
||||
} |
|
||||
this.currUserType=""; |
|
||||
|
|
||||
}, |
|
||||
/**begin 在下面加自定义方法,记得补上面的一个逗号**/ |
|
||||
|
|
||||
/**end 在上面加自定义方法**/ |
|
||||
|
|
||||
},//end method |
|
||||
components: { |
|
||||
//在下面添加其它组件 'xm-product-edit':XmProductEdit |
|
||||
UsersSelect |
|
||||
}, |
|
||||
mounted() { |
|
||||
this.addForm=Object.assign(this.addForm, this.xmProduct); |
|
||||
this.addForm.pmUserid=this.userInfo.userid |
|
||||
this.addForm.pmUsername=this.userInfo.username |
|
||||
this.addForm.admUserid=this.userInfo.userid |
|
||||
this.addForm.admUsername=this.userInfo.username |
|
||||
/**在下面写其它函数***/ |
|
||||
|
|
||||
}//end mounted |
|
||||
} |
|
||||
|
|
||||
</script> |
|
||||
|
|
||||
<style scoped> |
|
||||
|
|
||||
</style> |
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue