6 changed files with 385 additions and 455 deletions
-
4src/views/xm/core/components/XmProductSelect.vue
-
211src/views/xm/core/xmProduct/XmProductAdd.vue
-
595src/views/xm/core/xmProduct/XmProductEdit.vue
-
4src/views/xm/core/xmProduct/XmProductForLinkComplex.vue
-
4src/views/xm/core/xmProduct/XmProductMng.vue
-
22src/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> |
|
||||
@ -1,244 +1,375 @@ |
|||||
<template> |
<template> |
||||
<section class="padding border"> |
|
||||
<el-row class="page-main"> |
|
||||
<!--新增界面 XmProduct 产品表--> |
|
||||
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editForm"> |
|
||||
<el-form-item label="名称" prop="productName"> |
|
||||
<el-input v-model="editForm.productName" placeholder="产品名称" ></el-input> |
|
||||
</el-form-item> |
|
||||
<el-row> |
|
||||
<el-col :span="8"> |
|
||||
<el-form-item label="编号" prop="id"> |
|
||||
{{editForm.code}} |
|
||||
</el-form-item> |
|
||||
</el-col> |
|
||||
<el-col :span="8"> |
|
||||
<el-form-item label="产品代号" prop="code"> |
|
||||
{{editForm.code}} |
|
||||
</el-form-item> |
|
||||
</el-col> |
|
||||
<el-col :span="8"> |
|
||||
<el-form-item label="状态" prop="pstatus"> |
|
||||
<el-select v-model="editForm.pstatus" placeholder="状态" @change="editSomeFields(editForm,'pstatus',$event)"> |
|
||||
<el-option v-for="(item,index) in dicts['xmProductPstatus']" :label="item.name" :value="item.id" :key="index"></el-option> |
|
||||
</el-select> |
|
||||
</el-form-item> |
|
||||
</el-col> |
|
||||
</el-row> |
|
||||
<el-row> |
|
||||
<el-col :span="8"> |
|
||||
<el-form-item label="总监" prop="admUserid"> |
|
||||
<el-input readonly v-model="editForm.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="editForm.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="editForm.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="editForm.remark" :rows="10" type="textarea" :autosize="{ minRows: 4, maxRows: 20}" placeholder="备注" @change="editSomeFields(editForm,'remark',$event)"></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> |
|
||||
</section> |
|
||||
|
<section class="padding border"> |
||||
|
<el-row> |
||||
|
<!--新增界面 XmProduct 产品表--> |
||||
|
<el-form |
||||
|
:model="editForm" |
||||
|
label-width="120px" |
||||
|
:rules="editFormRules" |
||||
|
label-position="left" |
||||
|
ref="editForm" |
||||
|
> |
||||
|
<el-row v-if="opType !== 'add'" class="padding-top"> |
||||
|
<span class="label-font-color">产品代号:</span> |
||||
|
{{ editForm.code }} <span class="label-font-color" |
||||
|
>产品编号:</span |
||||
|
> |
||||
|
{{ editForm.id }} |
||||
|
<el-tooltip |
||||
|
content="产品代号用于签订合同等甲乙方共享的场景;产品编号为内部编号,用于内部流转,编号生成规则:产品代号+四位随机码 " |
||||
|
><i class="el-icon-question"></i |
||||
|
></el-tooltip> |
||||
|
</el-row> |
||||
|
<el-form-item prop="productName" label-width="0px"> |
||||
|
<my-input |
||||
|
v-model="editForm.productName" |
||||
|
placeholder="产品名称" |
||||
|
@change="editSomeFields(editForm, 'productName', $event)" |
||||
|
></my-input> |
||||
|
</el-form-item> |
||||
|
<el-form-item label="产品代号" prop="code" v-if="opType === 'add'"> |
||||
|
<el-input |
||||
|
v-model="editForm.code" |
||||
|
style="width: 200px" |
||||
|
placeholder="产品代号,不可为空" |
||||
|
> |
||||
|
</el-input> |
||||
|
<el-button @click.native="createProductCode">自动生成</el-button> |
||||
|
<el-tooltip |
||||
|
content="产品代号用于签订合同等甲乙方共享的场景;产品编号为内部编号,用于内部流转,生成规则:产品代号+四位随机码 " |
||||
|
><i class="el-icon-question"></i |
||||
|
></el-tooltip> |
||||
|
</el-form-item> |
||||
|
<el-row class="padding padding-top"> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item prop="admUserid" label-width="0px"> |
||||
|
<user-field |
||||
|
label=" 产品总控" |
||||
|
userid-key="admUserid" |
||||
|
username-key="admUsername" |
||||
|
v-model="editForm" |
||||
|
@change="editSomeFields(editForm, 'admUserid', $event)" |
||||
|
></user-field> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item prop="pmUserid" label-width="0px"> |
||||
|
<user-field |
||||
|
label=" 产品经理" |
||||
|
userid-key="pmUserid" |
||||
|
username-key="pmUsername" |
||||
|
v-model="editForm" |
||||
|
@change="editSomeFields(editForm, 'pmUserid', $event)" |
||||
|
></user-field> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
<el-col :span="8"> |
||||
|
<el-form-item prop="assUserid" label-width="0px"> |
||||
|
<user-field |
||||
|
label=" 副经理、助理" |
||||
|
userid-key="assUserid" |
||||
|
username-key="assUsername" |
||||
|
v-model="editForm" |
||||
|
@change="editSomeFields(editForm, 'assUserid', $event)" |
||||
|
></user-field> |
||||
|
</el-form-item> |
||||
|
</el-col> |
||||
|
</el-row> |
||||
|
<el-divider></el-divider> |
||||
|
<el-form-item label="备注" prop="remark"> |
||||
|
<el-input |
||||
|
v-model="editForm.remark" |
||||
|
:rows="10" |
||||
|
type="textarea" |
||||
|
:autosize="{ minRows: 4, maxRows: 20 }" |
||||
|
placeholder="备注" |
||||
|
@change="editSomeFields(editForm, 'remark', $event)" |
||||
|
></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> |
||||
|
</section> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import util from '@/common/js/util';//全局公共库 |
|
||||
import { initDicts,editXmProduct,editXmProductSomeFields } from '@/api/xm/core/xmProduct'; |
|
||||
import { mapGetters } from 'vuex' |
|
||||
import UsersSelect from "@/views/mdp/sys/user/UsersSelect"; |
|
||||
|
import util from "@/common/js/util"; //全局公共库 |
||||
|
import { |
||||
|
initDicts, |
||||
|
editXmProduct, |
||||
|
editSomeFields, |
||||
|
} from "@/api/xm/core/xmProduct"; |
||||
|
import { mapGetters } from "vuex"; |
||||
|
import UsersSelect from "@/views/mdp/sys/user/UsersSelect"; |
||||
|
|
||||
|
export default { |
||||
|
computed: { |
||||
|
...mapGetters(["userInfo", "roles"]), |
||||
|
calcXmProductPstatusStep() { |
||||
|
if (this.dicts["xmProductPstatus"]) { |
||||
|
var index = this.dicts["xmProductPstatus"].findIndex((i) => { |
||||
|
if (i.id == this.editForm.pstatus) { |
||||
|
return true; |
||||
|
} else { |
||||
|
return false; |
||||
|
} |
||||
|
}); |
||||
|
return index + 1; |
||||
|
} else { |
||||
|
return 0; |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
props: ["xmProduct", "visible", "opType"], |
||||
|
watch: { |
||||
|
xmProduct: { |
||||
|
handler() { |
||||
|
this.editForm = this.xmProduct; |
||||
|
this.editFormBak = { ...this.editForm }; |
||||
|
}, |
||||
|
deep: true, |
||||
|
}, |
||||
|
visible: function (visible) { |
||||
|
if (visible == true) { |
||||
|
//从新打开页面时某些数据需要重新加载,可以在这里添加 |
||||
|
} |
||||
|
}, |
||||
|
}, |
||||
|
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, add: false, del: false, edit: false }, //查询中... |
||||
|
editFormRules: { |
||||
|
productName: [ |
||||
|
{ required: true, message: "产品名称不能为空", trigger: "change" }, |
||||
|
{ |
||||
|
min: 2, |
||||
|
max: 250, |
||||
|
message: "名称长度在10-250个字符", |
||||
|
trigger: "change", |
||||
|
}, |
||||
|
], |
||||
|
|
||||
|
id: [ |
||||
|
{ required: true, message: "产品编号不能为空", trigger: "change" }, |
||||
|
], |
||||
|
code: [ |
||||
|
{ required: true, message: "产品代号不能为空", trigger: "change" }, |
||||
|
], |
||||
|
|
||||
|
|
||||
export default { |
|
||||
computed: { |
|
||||
...mapGetters([ |
|
||||
'userInfo','roles' |
|
||||
]), |
|
||||
calcXmProductPstatusStep(){ |
|
||||
if(this.dicts['xmProductPstatus']){ |
|
||||
var index=this.dicts['xmProductPstatus'].findIndex(i=>{ |
|
||||
if(i.id==this.editForm.pstatus){ |
|
||||
return true; |
|
||||
}else{ |
|
||||
return false; |
|
||||
} |
|
||||
}) |
|
||||
return index+1; |
|
||||
}else{ |
|
||||
return 0; |
|
||||
} |
|
||||
}, |
|
||||
}, |
|
||||
props:['xmProduct','visible'], |
|
||||
watch: { |
|
||||
|
pmUserid: [ |
||||
|
{ required: true, message: "产品经理不能为空", trigger: "change" }, |
||||
|
], |
||||
|
|
||||
'xmProduct': { |
|
||||
handler(){ |
|
||||
this.editForm = this.xmProduct; |
|
||||
this.editFormBak={...this.editForm} |
|
||||
}, |
|
||||
deep:true, |
|
||||
|
|
||||
}, |
|
||||
'visible':function(visible) { |
|
||||
if(visible==true){ |
|
||||
//从新打开页面时某些数据需要重新加载,可以在这里添加 |
|
||||
} |
|
||||
} |
|
||||
}, |
|
||||
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, add: false, del: false, edit: false },//查询中... |
|
||||
editFormRules: { |
|
||||
productName: [ |
|
||||
{ required: true, message: '产品名称不能为空', trigger: 'change' }, |
|
||||
{ min:2,max:250, message: '名称长度在10-250个字符', trigger: 'change' } |
|
||||
], |
|
||||
|
|
||||
id: [ |
|
||||
{ required: true, message: '产品编号不能为空', 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' } |
|
||||
] |
|
||||
}, |
|
||||
//新增界面数据 产品表 |
|
||||
editForm: { |
|
||||
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:'' |
|
||||
}, |
|
||||
editFormBak: { |
|
||||
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 在下面加自定义属性,记得补上面的一个逗号**/ |
|
||||
|
|
||||
/**end 在上面加自定义属性**/ |
|
||||
}//end return |
|
||||
},//end data |
|
||||
methods: { |
|
||||
// 取消按钮点击 父组件监听@cancel="editFormVisible=false" 监听 |
|
||||
handleCancel:function(){ |
|
||||
this.$refs['editForm'].resetFields(); |
|
||||
this.$emit('cancel'); |
|
||||
}, |
|
||||
//新增提交XmProduct 产品表 父组件监听@submit="afterAddSubmit" |
|
||||
editSubmit: function () { |
|
||||
this.$refs.editForm.validate((valid) => { |
|
||||
if (valid) { |
|
||||
|
|
||||
this.$confirm('确认提交吗?', '提示', {}).then(() => { |
|
||||
this.load.edit=true |
|
||||
let params = Object.assign({}, this.editForm); |
|
||||
params.branchId=this.userInfo.branchId |
|
||||
editXmProduct(params).then((res) => { |
|
||||
this.load.edit=false |
|
||||
var tips=res.data.tips; |
|
||||
if(tips.isOk){ |
|
||||
//this.$refs['editForm'].resetFields(); |
|
||||
this.$emit('submit');// @submit="afterAddSubmit" |
|
||||
} |
|
||||
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' }); |
|
||||
}).catch( err => this.load.edit=false); |
|
||||
}); |
|
||||
}else{ |
|
||||
this.$notify({position:'bottom-left',showClose:true,message: "表单验证不通过,请修改后提交", type: '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] |
|
||||
} |
|
||||
this.editSomeFields(this.editForm,this.currUserType,user) |
|
||||
this.currUserType=""; |
|
||||
|
|
||||
}, |
|
||||
|
admUserid: [ |
||||
|
{ required: true, message: "产品总监不能为空", trigger: "change" }, |
||||
|
], |
||||
|
remark: [ |
||||
|
{ |
||||
|
min: 0, |
||||
|
max: 250, |
||||
|
message: "备注长度在10-250个字符", |
||||
|
trigger: "change", |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
//新增界面数据 产品表 |
||||
|
editForm: { |
||||
|
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: "", |
||||
|
}, |
||||
|
editFormBak: { |
||||
|
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 在下面加自定义属性,记得补上面的一个逗号**/ |
||||
|
|
||||
editSomeFields(row,fieldName,$event){ |
|
||||
let params={}; |
|
||||
params['ids']=[row].map(i=>i.id) |
|
||||
if(fieldName=='adminUserid'){ |
|
||||
params['adminUserid']=$event.userid |
|
||||
params['adminUsername']=$event.username |
|
||||
}else if(fieldName=='assUserid'){ |
|
||||
params['assUserid']=$event.userid |
|
||||
params['assUsername']=$event.username |
|
||||
}else if(fieldName=='pmUserid'){ |
|
||||
params['pmUserid']=$event.userid |
|
||||
params['pmUsername']=$event.username |
|
||||
}else if(fieldName=='startTime'){ |
|
||||
params['startTime']=row.startTime |
|
||||
params['endTime']=row.endTime |
|
||||
}else{ |
|
||||
params[fieldName]=$event |
|
||||
} |
|
||||
|
|
||||
var func = editXmProductSomeFields |
|
||||
func(params).then(res=>{ |
|
||||
let tips = res.data.tips; |
|
||||
if(tips.isOk){ |
|
||||
this.editFormBak=[...this.editForm] |
|
||||
Object.assign(this.editForm,params) |
|
||||
this.$emit('edit-fields',params) |
|
||||
}else{ |
|
||||
Object.assign(this.editForm,this.editFormBak) |
|
||||
this.$notify({position:'bottom-left',showClose:true,message:tips.msg,type:tips.isOk?'success':'error'}) |
|
||||
} |
|
||||
}).catch((e)=>Object.assign(this.editForm,this.editFormBak)) |
|
||||
}, |
|
||||
/**end 在上面加自定义方法**/ |
|
||||
|
|
||||
},//end method |
|
||||
components: { |
|
||||
//在下面添加其它组件 'xm-product-edit':XmProductEdit |
|
||||
UsersSelect |
|
||||
}, |
|
||||
mounted() { |
|
||||
this.editForm= this.xmProduct; |
|
||||
this.editFormBak={...this.editForm} |
|
||||
initDicts(this) |
|
||||
/**在下面写其它函数***/ |
|
||||
|
|
||||
}//end mounted |
|
||||
} |
|
||||
|
/**end 在上面加自定义属性**/ |
||||
|
}; //end return |
||||
|
}, //end data |
||||
|
methods: { |
||||
|
// 取消按钮点击 父组件监听@cancel="editFormVisible=false" 监听 |
||||
|
handleCancel: function () { |
||||
|
this.$refs["editForm"].resetFields(); |
||||
|
this.$emit("cancel"); |
||||
|
}, |
||||
|
//新增提交XmProduct 产品表 父组件监听@submit="afterAddSubmit" |
||||
|
editSubmit: function () { |
||||
|
this.$refs.editForm.validate((valid) => { |
||||
|
if (valid) { |
||||
|
this.$confirm("确认提交吗?", "提示", {}).then(() => { |
||||
|
this.load.edit = true; |
||||
|
let params = Object.assign({}, this.editForm); |
||||
|
params.branchId = this.userInfo.branchId; |
||||
|
editXmProduct(params) |
||||
|
.then((res) => { |
||||
|
this.load.edit = false; |
||||
|
var tips = res.data.tips; |
||||
|
if (tips.isOk) { |
||||
|
//this.$refs['editForm'].resetFields(); |
||||
|
this.$emit("submit"); // @submit="afterAddSubmit" |
||||
|
} |
||||
|
this.$notify({ |
||||
|
position: "bottom-left", |
||||
|
showClose: true, |
||||
|
message: tips.msg, |
||||
|
type: tips.isOk ? "success" : "error", |
||||
|
}); |
||||
|
}) |
||||
|
.catch((err) => (this.load.edit = false)); |
||||
|
}); |
||||
|
} else { |
||||
|
this.$notify({ |
||||
|
position: "bottom-left", |
||||
|
showClose: true, |
||||
|
message: "表单验证不通过,请修改后提交", |
||||
|
type: "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]; |
||||
|
} |
||||
|
this.editSomeFields(this.editForm, this.currUserType, user); |
||||
|
this.currUserType = ""; |
||||
|
}, |
||||
|
|
||||
|
editSomeFields(row, fieldName, $event) { |
||||
|
let params = {}; |
||||
|
params["ids"] = [row].map((i) => i.id); |
||||
|
if (fieldName == "adminUserid") { |
||||
|
params["adminUserid"] = $event[0].userid; |
||||
|
params["adminUsername"] = $event[0].username; |
||||
|
} else if (fieldName == "assUserid") { |
||||
|
params["assUserid"] = $event[0].userid; |
||||
|
params["assUsername"] = $event[0].username; |
||||
|
} else if (fieldName == "pmUserid") { |
||||
|
params["pmUserid"] = $event[0].userid; |
||||
|
params["pmUsername"] = $event[0].username; |
||||
|
} else if (fieldName == "startTime") { |
||||
|
params["startTime"] = row.startTime; |
||||
|
params["endTime"] = row.endTime; |
||||
|
} else { |
||||
|
params[fieldName] = $event; |
||||
|
} |
||||
|
|
||||
|
var func = editSomeFields; |
||||
|
func(params) |
||||
|
.then((res) => { |
||||
|
let tips = res.data.tips; |
||||
|
if (tips.isOk) { |
||||
|
this.editFormBak = [...this.editForm]; |
||||
|
Object.assign(this.editForm, params); |
||||
|
this.$emit("edit-fields", params); |
||||
|
} else { |
||||
|
Object.assign(this.editForm, this.editFormBak); |
||||
|
this.$notify({ |
||||
|
position: "bottom-left", |
||||
|
showClose: true, |
||||
|
message: tips.msg, |
||||
|
type: tips.isOk ? "success" : "error", |
||||
|
}); |
||||
|
} |
||||
|
}) |
||||
|
.catch((e) => Object.assign(this.editForm, this.editFormBak)); |
||||
|
}, |
||||
|
/**end 在上面加自定义方法**/ |
||||
|
}, //end method |
||||
|
components: { |
||||
|
//在下面添加其它组件 'xm-product-edit':XmProductEdit |
||||
|
UsersSelect, |
||||
|
}, |
||||
|
mounted() { |
||||
|
this.editForm = this.xmProduct; |
||||
|
this.editFormBak = { ...this.editForm }; |
||||
|
initDicts(this); |
||||
|
/**在下面写其它函数***/ |
||||
|
}, //end mounted |
||||
|
}; |
||||
</script> |
</script> |
||||
|
|
||||
<style scoped> |
<style scoped> |
||||
|
|
||||
</style> |
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue