Browse Source

优化

master
陈裕财 3 years ago
parent
commit
5a8aed6ba9
  1. 4
      src/views/xm/core/components/XmProductSelect.vue
  2. 211
      src/views/xm/core/xmProduct/XmProductAdd.vue
  3. 595
      src/views/xm/core/xmProduct/XmProductEdit.vue
  4. 4
      src/views/xm/core/xmProduct/XmProductForLinkComplex.vue
  5. 4
      src/views/xm/core/xmProduct/XmProductMng.vue
  6. 22
      src/views/xm/core/xmProject/XmProjectEdit.vue

4
src/views/xm/core/components/XmProductSelect.vue

@ -204,7 +204,7 @@
</el-popover> </el-popover>
<el-dialog append-to-body :visible.sync="addProductVisible" width="70%"> <el-dialog append-to-body :visible.sync="addProductVisible" width="70%">
<xm-product-add
<xm-product-add op-type="add"
:sel-project="{ id: linkProjectId, name: '' }" :sel-project="{ id: linkProjectId, name: '' }"
@cancel="addProductVisible = false" @cancel="addProductVisible = false"
@submit="afterAddSubmit" @submit="afterAddSubmit"
@ -221,7 +221,7 @@ import util from "@/common/js/util"; //全局公共库
import { listXmProductWithState } from "@/api/xm/core/xmProduct"; import { listXmProductWithState } from "@/api/xm/core/xmProduct";
import { mapGetters } from "vuex"; import { mapGetters } from "vuex";
import UsersSelect from "@/views/mdp/sys/user/UsersSelect"; import UsersSelect from "@/views/mdp/sys/user/UsersSelect";
import XmProductAdd from "../xmProduct/XmProductAdd.vue";
import XmProductAdd from "../xmProduct/XmProductEdit.vue";
const map = new Map(); const map = new Map();
export default { export default {

211
src/views/xm/core/xmProduct/XmProductAdd.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;">产品代号为合同上的产品代号甲乙方共享产品内部编号为&nbsp;代号-四位随机码</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>

595
src/views/xm/core/xmProduct/XmProductEdit.vue

@ -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 }} &nbsp;&nbsp;<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>

4
src/views/xm/core/xmProduct/XmProductForLinkComplex.vue

@ -284,7 +284,7 @@
width="60%" width="60%"
:visible.sync="addProductVisible" :visible.sync="addProductVisible"
> >
<xm-product-add
<xm-product-add op-type="add"
@cancel="addProductVisible = false" @cancel="addProductVisible = false"
:sel-project="selProject" :sel-project="selProject"
@submit="afterAddProductSubmit" @submit="afterAddProductSubmit"
@ -314,7 +314,7 @@ import { loadTasksToXmProductState } from "@/api/xm/core/xmProductState";
import { initDicts, editXmProductSomeFields } from "@/api/xm/core/xmProduct"; import { initDicts, editXmProductSomeFields } from "@/api/xm/core/xmProduct";
import { loadTasksToXmMenuState } from "@/api/xm/core/xmMenuState"; import { loadTasksToXmMenuState } from "@/api/xm/core/xmMenuState";
import XmProductEdit from "./XmProductEdit.vue"; import XmProductEdit from "./XmProductEdit.vue";
import XmProductAdd from "./XmProductAdd"; //
import XmProductAdd from "./XmProductEdit"; //
export default { export default {
computed: { computed: {

4
src/views/xm/core/xmProduct/XmProductMng.vue

@ -294,7 +294,7 @@
<!--新增 XmProduct 产品表界面--> <!--新增 XmProduct 产品表界面-->
<el-drawer title="新增产品" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false"> <el-drawer title="新增产品" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-product-add :xm-product="addForm" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-product-add>
<xm-product-add op-type="add" :xm-product="addForm" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-product-add>
</el-drawer> </el-drawer>
<el-drawer title="产品状态数据" :visible.sync="productStateVisible" width="100%" append-to-body :close-on-click-modal="false"> <el-drawer title="产品状态数据" :visible.sync="productStateVisible" width="100%" append-to-body :close-on-click-modal="false">
<xm-product-state-mng :xm-product="editForm" :visible="productStateVisible" @cancel="productStateVisible=false"></xm-product-state-mng> <xm-product-state-mng :xm-product="editForm" :visible="productStateVisible" @cancel="productStateVisible=false"></xm-product-state-mng>
@ -364,7 +364,7 @@
import { listXmProduct,listXmProductWithState, delXmProduct, batchDelXmProduct,copyTo,createProductCode } from '@/api/xm/core/xmProduct'; import { listXmProduct,listXmProductWithState, delXmProduct, batchDelXmProduct,copyTo,createProductCode } from '@/api/xm/core/xmProduct';
import { addXmIterationLink,delXmIterationLink } from '@/api/xm/core/xmIterationLink'; import { addXmIterationLink,delXmIterationLink } from '@/api/xm/core/xmIterationLink';
import { loadTasksToXmProductState } from '@/api/xm/core/xmProductState'; import { loadTasksToXmProductState } from '@/api/xm/core/xmProductState';
import XmProductAdd from './XmProductAdd';//
import XmProductAdd from './XmProductEdit';//
import XmProductEdit from './XmProductEdit';// import XmProductEdit from './XmProductEdit';//
import XmProductTplMng from './XmProductTplMng';// import XmProductTplMng from './XmProductTplMng';//
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'

22
src/views/xm/core/xmProject/XmProjectEdit.vue

@ -16,7 +16,7 @@
<el-button @click.native="createProjectCode">自动生成</el-button> <el-button @click.native="createProjectCode">自动生成</el-button>
<el-tooltip content="项目代号用于签订合同等甲乙方共享的场景;项目编号为内部编号,用于内部流转,生成规则:项目代号+四位随机码 "><i class="el-icon-question"></i></el-tooltip> <el-tooltip content="项目代号用于签订合同等甲乙方共享的场景;项目编号为内部编号,用于内部流转,生成规则:项目代号+四位随机码 "><i class="el-icon-question"></i></el-tooltip>
</el-form-item> </el-form-item>
<el-row class="padding-left padding-right">
<el-row class="padding-left padding-right padding-top">
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="xmType" label-width="0px"> <el-form-item prop="xmType" label-width="0px">
<dict-field label="项目类型" :dict="dicts['projectType']" v-model="editForm.xmType" @change="editXmProjectSomeFields(editForm,'xmType',$event)"></dict-field> <dict-field label="项目类型" :dict="dicts['projectType']" v-model="editForm.xmType" @change="editXmProjectSomeFields(editForm,'xmType',$event)"></dict-field>
@ -25,12 +25,12 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="status" label-width="0px"> <el-form-item prop="status" label-width="0px">
<dict-field label="项目状态" :dict="dicts['projectStatus']" v-model="editForm.priority" @change="editXmProjectSomeFields(editForm,'status',$event)"></dict-field>
<dict-field label="项目状态" :dict="dicts['projectStatus']" v-model="editForm.status" @change="editXmProjectSomeFields(editForm,'status',$event)"></dict-field>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item prop="workType" label-width="0px"> <el-form-item prop="workType" label-width="0px">
<dict-field label="工作方式" :dict="dicts['workType']" v-model="editForm.priority" @change="editXmProjectSomeFields(editForm,'workType',$event)"></dict-field>
<dict-field label="工作方式" :dict="dicts['workType']" v-model="editForm.workType" @change="editXmProjectSomeFields(editForm,'workType',$event)"></dict-field>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -823,8 +823,7 @@
}, },
initData(){ initData(){
this.editForm=Object.assign(this.editForm,this.selProject) this.editForm=Object.assign(this.editForm,this.selProject)
if(this.opType==='add'){
debugger;
if(this.opType==='add'){
this.editForm.pmUserid=this.userInfo.userid this.editForm.pmUserid=this.userInfo.userid
this.editForm.pmUsername=this.userInfo.username this.editForm.pmUsername=this.userInfo.username
this.editForm.admUserid=this.userInfo.userid this.editForm.admUserid=this.userInfo.userid
@ -875,9 +874,20 @@
} }
var params={ids:[row.id]}; var params={ids:[row.id]};
params[fieldName]=$event
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{
params[fieldName]=$event
}
if(fieldName=='description'){ if(fieldName=='description'){
this.$refs.editForm.validateField('description',err=>{ this.$refs.editForm.validateField('description',err=>{
if(err){ if(err){

Loading…
Cancel
Save