Browse Source

优化

master
陈裕财 4 years ago
parent
commit
7ec819e9ba
  1. 41
      src/api/xm/core/xmMyFocus.js
  2. 7
      src/views/myWork/my/components/boxCard.vue
  3. 21
      src/views/myWork/my/index.vue
  4. 129
      src/views/xm/core/xmMyFocus/XmMyFocusAdd.vue
  5. 178
      src/views/xm/core/xmMyFocus/XmMyFocusEdit.vue
  6. 367
      src/views/xm/core/xmMyFocus/XmMyFocusList.vue
  7. 520
      src/views/xm/core/xmMyFocus/XmMyFocusMng.vue
  8. 23
      src/views/xm/core/xmProduct/XmProductMng.vue
  9. 4
      src/views/xm/core/xmProject/XmProjectMng.vue

41
src/api/xm/core/xmMyFocus.js

@ -1,30 +1,47 @@
import axios from '@/utils/request'
import { getDicts,initSimpleDicts,initComplexDicts } from '@/api/mdp/meta/item';//字典表
import config from '@/common/config'
let base = config.getCoreBasePath();
/**-------------------------与后端通讯接口------------------请写在下面-------------------------------------------- */
/**
* xm_my_focus
*1 默认只开放普通查询所有查询只要上传 分页参数 {currentPage:当前页码从1开始,pageSize:每页记录数,total:总记录数如果是0后台会自动计算总记录数非0不会自动计算}后台都会自动按分页查询 其它 api用到再打开没用到的api请注释掉
*2 查询新增修改的参数格式 params={id:'主键 主键',userid:'用户编号',username:'用户名称',taskId:'关注的任务主键',focusType:'对象类型项目-project/任务-task',projectId:'项目编号',projectName:'项目名称',taskName:'任务名称'}
* 我关注的项目或者任务
*1 默认只开放普通查询所有查询只要上传 分页参数 {pageNum:当前页码从1开始,pageSize:每页记录数,total:总记录数如果是0后台会自动计算总记录数非0不会自动计算}后台都会自动按分页查询 其它 api用到再打开没用到的api请注释掉
*2 查询新增修改的参数格式 params={userid:'用户编号 主键',bizId:'关注的对象主键 主键',pbizId:'对象上级编号,项目时填项目编号,任务时填项目编号,产品时填产品编号,需求时填产品编号,bug时填产品编号 主键',username:'用户名称',focusType:'对象类型:项目-1/任务-2/产品-3/需求-4/bug-5',bizName:'任务名称',pbizName:'对象上级名称',ftime:'关注时间',ubranchId:'用户归属机构'}
**/
//普通查询 条件之间and关系
export const listXmMyFocus = params => { return axios.get(`${base}/xm/core/xmMyFocus/list`, { params: params }); };
//模糊查询xm_my_focus 条件之间or关系
//export const listXmMyFocusKey = params => { return axios.get(`${base}/xm/core/xmMyFocus/listKey`, { params: params }); };
//删除一条xm_my_focus params={id:'主键 主键'}
//删除一条我关注的项目或者任务 params={userid:'用户编号 主键',bizId:'关注的对象主键 主键',pbizId:'对象上级编号,项目时填项目编号,任务时填项目编号,产品时填产品编号,需求时填产品编号,bug时填产品编号 主键'}
export const delXmMyFocus = params => { return axios.post(`${base}/xm/core/xmMyFocus/del`,params); };
//批量删除xm_my_focus params=[{id:'主键 主键'}]
//批量删除我关注的项目或者任务 params=[{userid:'用户编号 主键',bizId:'关注的对象主键 主键',pbizId:'对象上级编号,项目时填项目编号,任务时填项目编号,产品时填产品编号,需求时填产品编号,bug时填产品编号 主键'}]
export const batchDelXmMyFocus = params => { return axios.post(`${base}/xm/core/xmMyFocus/batchDel`, params); };
//修改一条xm_my_focus记录
//修改一条我关注的项目或者任务记录
export const editXmMyFocus = params => { return axios.post(`${base}/xm/core/xmMyFocus/edit`, params); };
//新增一条xm_my_focus
export const addXmMyFocus = params => { return axios.post(`${base}/xm/core/xmMyFocus/add`, params); };
//新增一条我关注的项目或者任务
export const addXmMyFocus = params => { return axios.post(`${base}/xm/core/xmMyFocus/add`, params); };
//批量修改某些字段
export const editSomeFieldsXmMyFocus = params => { return axios.post(`${base}/xm/core/xmMyFocus/editSomeFields`, params); };
//普通查询 条件之间and关系
export const myFocusForIndex = params => { return axios.get(`${base}/xm/core/xmMyFocus/myFocusForIndex`, { params: params }); };
/**-------------------------前端mng|add|edit界面公共函数---------------请写在下面----------------------------------------------- */
//初始化页面上的字典
export const initDicts = (that) => {
var itemCodes=[];//在此添加要加载的字典 如['sex','grade','lvl']
if(itemCodes.length>0){
initSimpleDicts('all',itemCodes).then(res=>{
Object.assign(that.dicts,res.data.data)
});
}
};

7
src/views/myWork/my/components/boxCard.vue

@ -30,6 +30,7 @@
<wdrw source="GZT" v-if="item.menuid == 'wdrw'"></wdrw>
<wdcp source="GZT" v-if="item.menuid == 'wdcp'"></wdcp>
<wdxm source="GZT" v-if="item.menuid == 'wdxm'"></wdxm>
<my-focus source="GZT" v-if="item.menuid == 'myFocus'"></my-focus>
</grid-item>
</grid-layout>
</div>
@ -41,6 +42,8 @@ import dsp from '@/views/mdp/workflow/ru/task/TaskListAssigneeToMe.vue';
import wdrw from '@/views/xm/core/xmTask/xmMyTaskCenter.vue';
import wdcp from '@/views/xm/core/xmProduct/XmProductAllMng.vue';
import wdxm from '@/views/xm/core/xmProject/XmProjectMng';
import myFocus from '@/views/xm/core/xmMyFocus/XmMyFocusList';
import VueGridLayout from 'vue-grid-layout';
import { mapGetters } from 'vuex'
@ -50,6 +53,7 @@ export default {
wdrw,
wdcp,
wdxm,
myFocus,
GridLayout: VueGridLayout.GridLayout,
GridItem: VueGridLayout.GridItem
},
@ -68,6 +72,7 @@ export default {
val.forEach((element, index) => {
this.addItem(element, index);
});
this.addItem({menuid:'myFocus',menuname:'我的关注'}, val.length+1);
}
}
},
@ -100,7 +105,7 @@ export default {
mounted() {
this.$nextTick(() => {
this.$store.dispatch('getUserFavoriteMenu', {userid: this.userInfo.displayUserid});
this.$store.dispatch('getUserFavoriteMenu', {userid: this.userInfo.userid});
})
},

21
src/views/myWork/my/index.vue

@ -3,12 +3,13 @@
<div class="m_content">
<div class="m_top">
<el-avatar class="m_avatar" :src="userInfo.headimgurl">
<img src="../../../assets/image/user_img.gif"/>
<img src="../../../assets/image/user_img.gif"/>
</el-avatar>
<div class="m_msg">
<p>{{getDate}}</p>
<p>{{getTimeStatus}}{{userInfo.username}}今天也要元气满满哦</p>
</div>
</div>
<el-button class="m_btn" type="primary" @click="moduleSetVisible = true">模块编辑</el-button>
</div>
<div class="m_middle">
@ -47,8 +48,10 @@
<span>缺陷管理</span>
</div>
</div>
</div>
</div>
</div>
<box-card />
</div>
<module-set v-model="moduleSetVisible" />
</div>
</template>
@ -57,14 +60,14 @@ import NProgress from 'nprogress' // progress bar
import moduleSet from './components/moduleSet'
import boxCard from './components/boxCard'
import { mapGetters } from 'vuex'
import { mapGetters } from 'vuex'
import dayjs from 'dayjs'
export default {
components: {moduleSet, boxCard},
computed: {
...mapGetters([
'userInfo'
'userInfo'
]),
getDate() {
return dayjs().format('YYYY/M/D');
@ -101,14 +104,14 @@ export default {
window.open(prefixUrl+path)
NProgress.done() // if current page is login will not trigger afterEach hook, so manually handle it
}
},
},
mounted() {
}
}
</script>
@ -116,4 +119,4 @@ export default {
<style lang="scss" scoped>
@import '../common.scss';
@import './index.scss';
</style>
</style>

129
src/views/xm/core/xmMyFocus/XmMyFocusAdd.vue

@ -1,129 +0,0 @@
<template>
<section class="page-container padding border">
<el-row>
<!--新增界面 XmMyFocus xm_my_focus-->
<el-form :model="addForm" label-width="120px" :rules="addFormRules" ref="addForm">
<el-form-item label="用户编号" prop="userid">
<el-input v-model="addForm.userid" placeholder="用户编号" ></el-input>
</el-form-item>
<el-form-item label="用户名称" prop="username">
<el-input v-model="addForm.username" placeholder="用户名称" ></el-input>
</el-form-item>
<el-form-item label="关注的任务主键" prop="taskId">
<el-input v-model="addForm.taskId" placeholder="关注的任务主键" ></el-input>
</el-form-item>
<el-form-item label="对象类型项目-project/任务-task" prop="focusType">
<el-input v-model="addForm.focusType" placeholder="对象类型项目-project/任务-task" ></el-input>
</el-form-item>
<el-form-item label="项目编号" prop="projectId">
<el-input v-model="addForm.projectId" placeholder="项目编号" ></el-input>
</el-form-item>
<el-form-item label="主键" prop="id">
<el-input v-model="addForm.id" placeholder="主键" ></el-input>
</el-form-item>
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="addForm.projectName" placeholder="项目名称" ></el-input>
</el-form-item>
<el-form-item label="任务名称" prop="taskName">
<el-input v-model="addForm.taskName" placeholder="任务名称" ></el-input>
</el-form-item>
<el-form-item>
<el-col :span="24" :offset="8">
<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-col>
</el-form-item>
</el-form>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
//import { initSimpleDicts } from '@/api/mdp/meta/item';//
import { addXmMyFocus } from '@/api/xm/core/xmMyFocus';
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters([
'userInfo','roles'
])
},
props:['xmMyFocus','visible'],
watch: {
'xmMyFocus':function( xmMyFocus ) {
this.addForm = xmMyFocus;
},
'visible':function(visible) {
if(visible==true){
//
}
}
},
data() {
return {
dicts:{},// 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: {
id: [
//{ required: true, message: '', trigger: 'blur' }
]
},
// xm_my_focus
addForm: {
userid:'',username:'',taskId:'',focusType:'',projectId:'',id:'',projectName:'',taskName:''
}
/**begin 在下面加自定义属性,记得补上面的一个逗号**/
/**end 在上面加自定义属性**/
}//end return
},//end data
methods: {
// @cancel="addFormVisible=false"
handleCancel:function(){
this.$refs['addForm'].resetFields();
this.$emit('cancel');
},
//XmMyFocus xm_my_focus @submit="afterAddSubmit"
addSubmit: function () {
this.$refs.addForm.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
this.load.add=true
let params = Object.assign({}, this.addForm);
addXmMyFocus(params).then((res) => {
this.load.add=false
var tips=res.data.tips;
if(tips.isOk){
this.$refs['addForm'].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.add=false);
});
}
});
}
/**begin 在下面加自定义方法,记得补上面的一个逗号**/
/**end 在上面加自定义方法**/
},//end method
components: {
// 'xm-my-focus-edit':XmMyFocusEdit
},
mounted() {
this.addForm=Object.assign(this.addForm, this.xmMyFocus);
/**在下面写其它函数***/
}//end mounted
}
</script>
<style scoped>
</style>

178
src/views/xm/core/xmMyFocus/XmMyFocusEdit.vue

@ -1,119 +1,169 @@
<template>
<section class="page-container padding border">
<el-row>
<!--编辑界面 XmMyFocus xm_my_focus-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editForm">
<section class="page-container padding">
<el-row class="page-header">
</el-row>
<el-row class="page-main" :style="{overflowX:'auto',height:maxTableHeight+'px'}" ref="table">
<!--编辑界面 XmMyFocus 我关注的项目或者任务-->
<el-form :model="editForm" label-width="120px" :rules="editFormRules" ref="editFormRef">
<el-form-item label="用户编号" prop="userid">
<el-input v-model="editForm.userid" placeholder="用户编号"></el-input>
<el-input v-model="editForm.userid" placeholder="用户编号" :maxlength="50" @change="editSomeFields(editForm,'userid',$event)"></el-input>
</el-form-item>
<el-form-item label="用户名称" prop="username">
<el-input v-model="editForm.username" placeholder="用户名称"></el-input>
<el-input v-model="editForm.username" placeholder="用户名称" :maxlength="255" @change="editSomeFields(editForm,'username',$event)"></el-input>
</el-form-item>
<el-form-item label="关注的任务主键" prop="taskId">
<el-input v-model="editForm.taskId" placeholder="关注的任务主键"></el-input>
<el-form-item label="关注的对象主键" prop="bizId">
<el-input v-model="editForm.bizId" placeholder="关注的对象主键" :maxlength="50" @change="editSomeFields(editForm,'bizId',$event)"></el-input>
</el-form-item>
<el-form-item label="对象类型项目-project/任务-task" prop="focusType">
<el-input v-model="editForm.focusType" placeholder="对象类型项目-project/任务-task"></el-input>
<el-form-item label="对象类型:项目-1/任务-2/产品-3/需求-4/bug-5" prop="focusType">
<el-input v-model="editForm.focusType" placeholder="对象类型:项目-1/任务-2/产品-3/需求-4/bug-5" :maxlength="1" @change="editSomeFields(editForm,'focusType',$event)"></el-input>
</el-form-item>
<el-form-item label="项目编号" prop="projectId">
<el-input v-model="editForm.projectId" placeholder="项目编号"></el-input>
<el-form-item label="对象上级编号,项目时填项目编号,任务时填项目编号,产品时填产品编号,需求时填产品编号,bug时填产品编号" prop="pbizId">
<el-input v-model="editForm.pbizId" placeholder="对象上级编号,项目时填项目编号,任务时填项目编号,产品时填产品编号,需求时填产品编号,bug时填产品编号" :maxlength="50" @change="editSomeFields(editForm,'pbizId',$event)"></el-input>
</el-form-item>
<el-form-item label="主键" prop="id">
<el-input v-model="editForm.id" placeholder="主键"></el-input>
<el-form-item label="任务名称" prop="bizName">
<el-input v-model="editForm.bizName" placeholder="任务名称" :maxlength="50" @change="editSomeFields(editForm,'bizName',$event)"></el-input>
</el-form-item>
<el-form-item label="项目名称" prop="projectName">
<el-input v-model="editForm.projectName" placeholder="项目名称"></el-input>
<el-form-item label="对象上级名称" prop="pbizName">
<el-input v-model="editForm.pbizName" placeholder="对象上级名称" :maxlength="255" @change="editSomeFields(editForm,'pbizName',$event)"></el-input>
</el-form-item>
<el-form-item label="任务名称" prop="taskName">
<el-input v-model="editForm.taskName" placeholder="任务名称"></el-input>
<el-form-item label="关注时间" prop="ftime">
<el-date-picker type="date" placeholder="选择日期" v-model="editForm.ftime" value-format="yyyy-MM-dd HH:mm:ss" format="yyyy-MM-dd"></el-date-picker>
</el-form-item>
<el-form-item>
<el-col :span="24" :offset="8">
<el-button @click.native="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click.native="editSubmit" :disabled="load.edit==true">提交</el-button>
</el-col>
<el-form-item label="用户归属机构" prop="ubranchId">
<el-input v-model="editForm.ubranchId" placeholder="用户归属机构" :maxlength="50" @change="editSomeFields(editForm,'ubranchId',$event)"></el-input>
</el-form-item>
</el-form>
</el-row>
<el-row v-if="opType=='add'" class="page-bottom bottom-fixed">
<el-button @click.native="handleCancel">取消</el-button>
<el-button v-loading="load.edit" type="primary" @click.native="saveSubmit" :disabled="load.edit==true">提交</el-button>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
//import { initSimpleDicts } from '@/api/mdp/meta/item';//
import { editXmMyFocus } from '@/api/xm/core/xmMyFocus';
import config from "@/common/config"; //import
import { initDicts, addXmMyFocus,editXmMyFocus,editSomeFieldsXmMyFocus } from '@/api/xm/core/xmMyFocus';
import { mapGetters } from 'vuex'
export default {
export default {
name:'xmMyFocusEdit',
components: {
},
computed: {
...mapGetters([
'userInfo','roles'
])
...mapGetters([ 'userInfo' ]),
},
props:['xmMyFocus','visible'],
props:['xmMyFocus','visible','opType'],
watch: {
'xmMyFocus':function( xmMyFocus ) {
this.editForm = xmMyFocus;
if(xmMyFocus){
this.editForm = {...xmMyFocus};
}
},
'visible':function(visible) {
if(visible==true){
//
this.initData()
}
}
},
data() {
return {
dicts:{},// 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 },//...
currOpType:'add',//add/edit
load:{ list: false, edit: false, del: false, add: false },//...
dicts:{},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
editFormRules: {
id: [
//{ required: true, message: '', trigger: 'blur' }
userid: [
//{ required: true, message: '', trigger: 'blur' }
]
},
// XmMyFocus xm_my_focus
editForm: {
userid:'',username:'',taskId:'',focusType:'',projectId:'',id:'',projectName:'',taskName:''
}
/**begin 在下面加自定义属性,记得补上面的一个逗号**/
/**end 在上面加自定义属性**/
userid:'',username:'',bizId:'',focusType:'',pbizId:'',bizName:'',pbizName:'',ftime:'',ubranchId:''
},
maxTableHeight:300,
}//end return
},//end data
methods: {
...util,
// @cancel="editFormVisible=false"
handleCancel:function(){
this.$refs['editForm'].resetFields();
this.$refs['editFormRef'].resetFields();
this.$emit('cancel');
},
//XmMyFocus xm_my_focus@submit="afterEditSubmit"
editSubmit: function () {
this.$refs.editForm.validate((valid) => {
//XmMyFocus @submit="afterEditSubmit"
saveSubmit: function () {
this.$refs.editFormRef.validate((valid) => {
if (valid) {
this.$confirm('确认提交吗?', '提示', {}).then(() => {
this.load.edit=true
let params = Object.assign({}, this.editForm);
editXmMyFocus(params).then((res) => {
this.load.edit=false
var tips=res.data.tips;
if(tips.isOk){
this.$refs['editForm'].resetFields();
this.$emit('submit');// @submit="afterEditSubmit"
}
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err =>this.load.edit=false);
let params = Object.assign({}, this.editForm);
var func=addXmMyFocus
if(this.currOpType=='edit'){
func=editXmMyFocus
}
func(params).then((res) => {
this.load.edit=false
var tips=res.data.tips;
if(tips.isOk){
this.editForm=res.data.data
this.initData()
this.currOpType="edit";
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({ showClose:true, message: "表单验证不通过,请修改表单数据再提交", type: 'error' });
}
});
}
/**begin 在下面加自定义方法,记得补上面的一个逗号**/
/**end 在上面加自定义方法**/
},
initData: function(){
this.currOpType=this.opType
if(this.xmMyFocus){
this.editForm = Object.assign({},this.xmMyFocus);
}
if(this.opType=='edit'){
}else{
}
this.editFormBak={...this.editForm}
},
editSomeFields(row,fieldName,$event){
if(this.opType=='add'){
return;
}
let params={};
params['pkList']=[row].map(i=>{ return { userid:i.userid, bizId:i.bizId, pbizId:i.pbizId}})
params[fieldName]=$event
var func = editSomeFieldsXmMyFocus
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
this.editFormBak=[...this.editForm]
}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 method
components: {
// 'xm-my-focus-edit':XmMyFocusEdit
},
mounted() {
this.editForm=Object.assign(this.editForm, this.xmMyFocus);
this.$nextTick(() => {
initDicts(this);
this.initData()
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.table.$el)
});
}
}

367
src/views/xm/core/xmMyFocus/XmMyFocusList.vue

@ -0,0 +1,367 @@
<template>
<section>
<el-row :gutter="20">
<el-col :span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="avatar-container">
<div class="avatar-wrapper">
<img class="user-avatar" src="../../../myWork/img/cp.png">
<span class="username"> 产品</span>
</div>
</div>
</div>
<div v-for="(o,index) in cps" :key="index" class="list-item">
<el-link @click="toBizPage(o)">{{o.bizName }}</el-link>
<div class="tool-bar">
<span class="u-btn">
<el-button type="text" @click="handleDel(o,index)" icon="el-icon-remove-outline" title="取消关注" >取消关注 </el-button>
</span>
</div>
</div>
</el-card>
</el-col>
<el-col :span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="avatar-container">
<div class="avatar-wrapper">
<img class="user-avatar" src="../../../myWork/img/xmgl.png">
<span class="username"> 项目</span>
</div>
</div>
</div>
<div v-for="(o,index) in xms" :key="index" class="list-item">
<el-link @click="toBizPage(o)">{{o.bizName }}</el-link>
<div class="tool-bar">
<span class="u-btn">
<el-button type="text" circle @click="handleDel(o,index)" icon="el-icon-remove-outline" title="取消关注">取消关注 </el-button>
</span>
</div>
</div>
</el-card>
</el-col>
<el-col :span="8">
<el-card class="box-card">
<div slot="header" class="clearfix">
<div class="avatar-container">
<div class="avatar-wrapper">
<img class="user-avatar" src="../../../myWork/img/xqgl.png">
<span class="username">需求任务缺陷</span>
</div>
</div>
</div>
<div v-for="(o,index) in oths" :key="index" class="list-item">
<el-link @click="toBizPage(o)">{{o.bizName }}</el-link>
<div class="tool-bar">
<span class="u-btn">
<el-button type="text" @click="handleDel(o,index)" icon="el-icon-remove-outline" title="取消关注"> 取消关注</el-button>
</span>
</div>
</div>
</el-card>
</el-col>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,myFocusForIndex, delXmMyFocus, batchDelXmMyFocus,editSomeFieldsXmMyFocus } from '@/api/xm/core/xmMyFocus';
import XmMyFocusEdit from './XmMyFocusEdit';//
import { mapGetters } from 'vuex'
export default {
name:'xmMyFocusMng',
components: {
XmMyFocusEdit,
},
props:['visible'],
computed: {
...mapGetters(['userInfo']),
cps(){
return this.xmMyFocuss.filter(k=>k.focusType=='3')
},
xms(){
return this.xmMyFocuss.filter(k=>k.focusType=='1')
},
oths(){
return this.xmMyFocuss.filter(k=>k.focusType!='1' && k.focusType!='3')
}
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmMyFocuss()
}
}
},
data() {
return {
filters: {
key: ''
},
xmMyFocuss: [],//
pageInfo:{//
total:0,//0>0
pageSize:10,//
count:false,//
pageNum:1,//1
orderFields:[],// ['sex','student_id']
orderDirs:[]// asc,desc ['asc','desc']
},
load:{ list: false, edit: false, del: false, add: false },//...
sels: [],//
dicts:{
//sex: [{id:'1',name:''},{id:'2',name:''}]
},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
addFormVisible: false,//xmMyFocus
addForm: {
userid:'',username:'',bizId:'',focusType:'',pbizId:'',bizName:'',pbizName:'',ftime:'',ubranchId:''
},
editFormVisible: false,//
editForm: {
userid:'',username:'',bizId:'',focusType:'',pbizId:'',bizName:'',pbizName:'',ftime:'',ubranchId:''
},
maxTableHeight:300,
}
},//end data
methods: {
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmMyFocuss();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmMyFocuss();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
if(obj.order==null){
this.pageInfo.orderFields=[];
this.pageInfo.orderDirs=[];
}else{
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
this.pageInfo.orderFields=[util.toLine(obj.prop)];
this.pageInfo.orderDirs=[dir];
}
this.getXmMyFocuss();
},
searchXmMyFocuss(){
this.pageInfo.count=true;
this.getXmMyFocuss();
},
// XmMyFocus
getXmMyFocuss() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count
};
if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
let orderBys=[];
for(var i=0;i<this.pageInfo.orderFields.length;i++){
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
}
params.orderBy= orderBys.join(",")
}
if(this.filters.key){
params.key=this.filters.key
}
this.load.list = true;
myFocusForIndex(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmMyFocuss = res.data.data;
}else{
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
// XmMyFocus
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
toBizPage(bizObj){
if(bizObj.focusType=='1'){
this.$router.push({path:'/xm/core/xmProject/XmProjectInfoRoute',query:{id:bizObj.bizId}})
}else if(bizObj.focusType=='3'){
this.$router.push({path:'/xm/core/xmProduct/XmProductInfoRoute',query:{id:bizObj.bizId}})
}
},
// XmMyFocus
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmMyFocuss();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmMyFocus
selsChange: function (sels) {
this.sels = sels;
},
//xmMyFocus
handleDel: function (row,index) {
this.load.del=true;
let params = { userid:row.userid, bizId:row.bizId, pbizId:row.pbizId };
delXmMyFocus(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchXmMyFocuss();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
},
//xmMyFocus
batchDel: function () {
if(this.sels.length<=0){
return;
}
var params=this.sels.map(i=>{
return { userid:i.userid, bizId:i.bizId, pbizId:i.pbizId}
})
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmMyFocus(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.searchXmMyFocuss();
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.del=false );
});
},
editSomeFields(row,fieldName,$event){
let params={};
if(this.sels.length>0){
if(!this.sels.some(k=> k.userid==row.userid && k.bizId==row.bizId && k.pbizId==row.pbizId)){
this.$notify({position:'bottom-left',showClose:true,message:'请编辑选中的行',type:'warning'})
Object.assign(this.editForm,this.editFormBak)
return;
}
params['pkList']=this.sels.map(i=>{ return { userid:i.userid, bizId:i.bizId, pbizId:i.pbizId}})
}else{
params['pkList']=[row].map(i=>{ return { userid:i.userid, bizId:i.bizId, pbizId:i.pbizId}})
}
params[fieldName]=$event
var func = editSomeFieldsXmMyFocus
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
if(this.sels.length>0){
this.searchXmMyFocuss();
}
this.editFormBak=[...this.editForm]
}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))
},
rowClick: function(row, event, column){
this.editForm=row
this.editFormBak={...row};
this.$emit('row-click',row, event, column);// @row-click="rowClick"
},
initData: function(){
},
},//end methods
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.searchXmMyFocuss();
//this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmMyFocusTable.$el)
});
}
}
</script>
<style lang="scss" scoped>
.box-card{
height: 450px;
}
.avatar-container {
height: 20px;
display: flex;
align-items: center;
.avatar-wrapper {
cursor: pointer;
display: flex;
flex-direction: row;
align-items: center;
.user-avatar {
height: 34px;
width: 34px;
border-radius: 50%;
margin-right: 12px;
}
.username{
color: #7D7D7D;
font-size: 18px;
margin-right: 2px;
}
.el-icon-caret-bottom {
font-size: 22px;
}
}
}
.tool-bar{
visibility: hidden;
float: right;
}
.list-item{
margin-bottom: 20px;
}
.list-item:hover{
.tool-bar{
visibility: visible;
.u-btn{
float: right;
}
}
}
</style>

520
src/views/xm/core/xmMyFocus/XmMyFocusMng.vue

@ -1,238 +1,312 @@
<template>
<section class="page-container padding border">
<section class="page-container border padding">
<el-row>
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询"></el-input>
<el-button type="primary" v-loading="load.list" :disabled="load.list==true" v-on:click="searchXmMyFocuss">查询</el-button>
<el-button type="primary" @click="showAdd">+xm_my_focus</el-button>
<el-button type="danger" v-loading="load.del" @click="batchDel" :disabled="this.sels.length===0 || load.del==true">批量删除</el-button>
<el-input v-model="filters.key" style="width: 20%;" placeholder="模糊查询"></el-input>
<el-button v-loading="load.list" :disabled="load.list==true" @click="searchXmMyFocuss" icon="el-icon-search">查询</el-button>
<span style="float:right;">
<el-button type="primary" @click="showAdd" icon="el-icon-plus" plain> </el-button>
<el-button type="danger" v-loading="load.del" @click="batchDel" :disabled="this.sels.length===0 || load.del==true" icon="el-icon-delete" plain></el-button>
</span>
</el-row>
<el-row class="page-main ">
<!--列表 XmMyFocus xm_my_focus-->
<el-table :data="xmMyFocuss" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table-column sortable type="selection" width="40"></el-table-column>
<el-table-column sortable type="index" width="40"></el-table-column>
<el-table-column prop="userid" label="用户编号" min-width="80" ></el-table-column>
<el-table-column prop="username" label="用户名称" min-width="80" ></el-table-column>
<el-table-column prop="taskId" label="关注的任务主键" min-width="80" ></el-table-column>
<el-table-column prop="focusType" label="对象类型项目-project/任务-task" min-width="80" ></el-table-column>
<el-table-column prop="projectId" label="项目编号" min-width="80" ></el-table-column>
<el-table-column prop="id" label="主键" min-width="80" ></el-table-column>
<el-table-column prop="projectName" label="项目名称" min-width="80" ></el-table-column>
<el-table-column prop="taskName" label="任务名称" min-width="80" ></el-table-column>
<el-table-column label="操作" width="160" fixed="right" >
<template slot-scope="scope">
<el-button @click="showEdit( scope.row,scope.$index)"></el-button>
<el-button type="danger" @click="handleDel(scope.row,scope.$index)"></el-button>
</template>
<el-row class="padding-top">
<!--列表 XmMyFocus 我关注的项目或者任务-->
<el-table ref="xmMyFocusTable" :data="xmMyFocuss" :height="maxTableHeight" @sort-change="sortChange" highlight-current-row v-loading="load.list" border @selection-change="selsChange" @row-click="rowClick" style="width: 100%;">
<el-table-column type="selection" width="55" show-overflow-tooltip fixed="left"></el-table-column>
<el-table-column sortable type="index" width="55" show-overflow-tooltip fixed="left"></el-table-column>
<!--
<el-table-column sortable prop="username" width="55" show-overflow-tooltip fixed="left">
<span class="cell-text"> {{scope.row.username}}} </span>
<span class="cell-bar"><el-input style="display:inline;" v-model="scope.row.username" placeholder="" @change="editSomeFields(scope.row,'username',$event)" :maxlength="22"></el-input></span>
</el-table-column>
-->
<el-table-column prop="userid" label="用户编号" min-width="120" show-overflow-tooltip fixed="left"></el-table-column> <el-table-column prop="bizId" label="" min-width="120" show-overflow-tooltip fixed="left"></el-table-column> <el-table-column prop="pbizId" label=",bug" min-width="120" show-overflow-tooltip fixed="left"></el-table-column>
<el-table-column prop="username" label="用户名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.username}} </span>
</template>
</el-table-column>
<el-table-column prop="focusType" label="对象类型:项目-1/任务-2/产品-3/需求-4/bug-5" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.focusType}} </span>
</template>
</el-table-column>
<el-table-column prop="bizName" label="任务名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.bizName}} </span>
</template>
</el-table-column>
<el-table-column prop="pbizName" label="对象上级名称" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.pbizName}} </span>
</template>
</el-table-column>
<el-table-column prop="ftime" label="关注时间" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.ftime}} </span>
</template>
</el-table-column>
<el-table-column prop="ubranchId" label="用户归属机构" min-width="120" show-overflow-tooltip>
<template slot-scope="scope">
<span> {{scope.row.ubranchId}} </span>
</template>
</el-table-column>
<el-table-column label="操作" width="180" fixed="right">
<template scope="scope">
<el-button type="primary" @click="showEdit( scope.row,scope.$index)" icon="el-icon-edit" plain></el-button>
<el-button type="danger" @click="handleDel(scope.row,scope.$index)" icon="el-icon-delete" plain></el-button>
</template>
</el-table-column>
</el-table>
<el-pagination layout="total, sizes, prev, pager, next" @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10,20, 50, 100, 500]" :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :total="pageInfo.total" style="float:right;"></el-pagination>
<!--编辑 XmMyFocus xm_my_focus界面-->
<el-drawer title="编辑xm_my_focus" :visible.sync="editFormVisible" size="50%" append-to-body :close-on-click-modal="false">
<xm-my-focus-edit :xm-my-focus="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-my-focus-edit>
</el-drawer>
<!--新增 XmMyFocus xm_my_focus界面-->
<el-drawer title="新增xm_my_focus" :visible.sync="addFormVisible" size="50%" append-to-body :close-on-click-modal="false">
<xm-my-focus-add :xm-my-focus="addForm" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-my-focus-add>
</el-drawer>
<el-pagination layout="total, sizes, prev, pager, next" @current-change="handleCurrentChange" @size-change="handleSizeChange" :page-sizes="[10,20, 50, 100, 500]" :current-page="pageInfo.pageNum" :page-size="pageInfo.pageSize" :total="pageInfo.total" style="float:right;"></el-pagination>
</el-row>
<el-row>
<!--编辑 XmMyFocus 我关注的项目或者任务界面-->
<el-drawer title="编辑我关注的项目或者任务" :visible.sync="editFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-my-focus-edit op-type="edit" :xm-my-focus="editForm" :visible="editFormVisible" @cancel="editFormVisible=false" @submit="afterEditSubmit"></xm-my-focus-edit>
</el-drawer>
<!--新增 XmMyFocus 我关注的项目或者任务界面-->
<el-drawer title="新增我关注的项目或者任务" :visible.sync="addFormVisible" size="60%" append-to-body :close-on-click-modal="false">
<xm-my-focus-edit op-type="add" :visible="addFormVisible" @cancel="addFormVisible=false" @submit="afterAddSubmit"></xm-my-focus-edit>
</el-drawer>
</el-row>
</section>
</template>
<script>
import util from '@/common/js/util';//
//import Sticky from '@/components/Sticky' // header
//import { initSimpleDicts } from '@/api/mdp/meta/item';//
import { listXmMyFocus, delXmMyFocus, batchDelXmMyFocus } from '@/api/xm/core/xmMyFocus';
import XmMyFocusAdd from './XmMyFocusAdd';//
import XmMyFocusEdit from './XmMyFocusEdit';//
import { mapGetters } from 'vuex'
export default {
computed: {
...mapGetters([
'userInfo','roles'
])
},
data() {
return {
filters: {
key: ''
},
xmMyFocuss: [],//
pageInfo:{//
total:0,//0>0
pageSize:10,//
count:false,//
pageNum:1,//1
orderFields:[],// ['sex','student_id']
orderDirs:[]// asc,desc ['asc','desc']
},
load:{ list: false, edit: false, del: false, add: false },//...
sels: [],//
dicts:{},// params=[{categoryId:'0001',itemCode:'sex'}] {'sex':[{optionValue:'1',optionName:'',seqOrder:'1',fp:'',isDefault:'0'},{optionValue:'2',optionName:'',seqOrder:'2',fp:'',isDefault:'0'}]}
addFormVisible: false,//xmMyFocus
//xmMyFocus
addForm: {
userid:'',username:'',taskId:'',focusType:'',projectId:'',id:'',projectName:'',taskName:''
},
editFormVisible: false,//
//xmMyFocus
editForm: {
userid:'',username:'',taskId:'',focusType:'',projectId:'',id:'',projectName:'',taskName:''
}
/**begin 自定义属性请在下面加 请加备注**/
/**end 自定义属性请在上面加 请加备注**/
}
},//end data
methods: {
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmMyFocuss();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmMyFocuss();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
if(obj.prop=='xxx'){
this.pageInfo.orderFields=['xxx'];
this.pageInfo.orderDirs=[dir];
}
this.getXmMyFocuss();
},
searchXmMyFocuss(){
this.pageInfo.count=true;
this.getXmMyFocuss();
},
// XmMyFocus xm_my_focus
getXmMyFocuss() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count
};
if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
let orderBys=[];
for(var i=0;i<this.pageInfo.orderFields.length;i++){
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
}
params.orderBy= orderBys.join(",")
}
if(this.filters.key!==""){
//params.xxx=this.filters.key
}else{
//params.xxx=xxxxx
}
this.load.list = true;
listXmMyFocus(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmMyFocuss = res.data.data;
}else{
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
// XmMyFocus xm_my_focus
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmMyFocus xm_my_focus
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmMyFocuss();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmMyFocus
selsChange: function (sels) {
this.sels = sels;
},
//xmMyFocus
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { id: row.id };
delXmMyFocus(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.count=true;
this.getXmMyFocuss();
}
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmMyFocus
batchDel: function () {
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmMyFocus(this.sels).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.pageInfo.count=true;
this.getXmMyFocuss();
}
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.del=false );
});
},
rowClick: function(row, event, column){
this.$emit('row-click',row, event, column);// @row-click="rowClick"
}
/**begin 自定义函数请在下面加**/
/**end 自定义函数请在上面加**/
},//end methods
components: {
'xm-my-focus-add':XmMyFocusAdd,
'xm-my-focus-edit':XmMyFocusEdit,
//
},
mounted() {
this.$nextTick(() => {
this.getXmMyFocuss();
});
}
}
import util from '@/common/js/util';//
import config from '@/common/config';//
import { initDicts,listXmMyFocus, delXmMyFocus, batchDelXmMyFocus,editSomeFieldsXmMyFocus } from '@/api/xm/core/xmMyFocus';
import XmMyFocusEdit from './XmMyFocusEdit';//
import { mapGetters } from 'vuex'
export default {
name:'xmMyFocusMng',
components: {
XmMyFocusEdit,
},
props:['visible'],
computed: {
...mapGetters(['userInfo']),
},
watch:{
visible(val){
if(val==true){
this.initData();
this.searchXmMyFocuss()
}
}
},
data() {
return {
filters: {
key: ''
},
xmMyFocuss: [],//
pageInfo:{//
total:0,//0>0
pageSize:10,//
count:false,//
pageNum:1,//1
orderFields:[],// ['sex','student_id']
orderDirs:[]// asc,desc ['asc','desc']
},
load:{ list: false, edit: false, del: false, add: false },//...
sels: [],//
dicts:{
//sex: [{id:'1',name:''},{id:'2',name:''}]
},// params={categoryId:'all',itemCodes:['sex']} {sex: [{id:'1',name:''},{id:'2',name:''}]}
addFormVisible: false,//xmMyFocus
addForm: {
userid:'',username:'',bizId:'',focusType:'',pbizId:'',bizName:'',pbizName:'',ftime:'',ubranchId:''
},
editFormVisible: false,//
editForm: {
userid:'',username:'',bizId:'',focusType:'',pbizId:'',bizName:'',pbizName:'',ftime:'',ubranchId:''
},
maxTableHeight:300,
}
},//end data
methods: {
...util,
handleSizeChange(pageSize) {
this.pageInfo.pageSize=pageSize;
this.getXmMyFocuss();
},
handleCurrentChange(pageNum) {
this.pageInfo.pageNum = pageNum;
this.getXmMyFocuss();
},
// obj.order=ascending/descending, asc/desc ; obj.prop=,
sortChange( obj ){
if(obj.order==null){
this.pageInfo.orderFields=[];
this.pageInfo.orderDirs=[];
}else{
var dir='asc';
if(obj.order=='ascending'){
dir='asc'
}else{
dir='desc';
}
this.pageInfo.orderFields=[util.toLine(obj.prop)];
this.pageInfo.orderDirs=[dir];
}
this.getXmMyFocuss();
},
searchXmMyFocuss(){
this.pageInfo.count=true;
this.getXmMyFocuss();
},
// XmMyFocus
getXmMyFocuss() {
let params = {
pageSize: this.pageInfo.pageSize,
pageNum: this.pageInfo.pageNum,
total: this.pageInfo.total,
count:this.pageInfo.count
};
if(this.pageInfo.orderFields!=null && this.pageInfo.orderFields.length>0){
let orderBys=[];
for(var i=0;i<this.pageInfo.orderFields.length;i++){
orderBys.push(this.pageInfo.orderFields[i]+" "+this.pageInfo.orderDirs[i])
}
params.orderBy= orderBys.join(",")
}
if(this.filters.key){
params.key=this.filters.key
}
this.load.list = true;
listXmMyFocus(params).then((res) => {
var tips=res.data.tips;
if(tips.isOk){
this.pageInfo.total = res.data.total;
this.pageInfo.count=false;
this.xmMyFocuss = res.data.data;
}else{
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: 'error' });
}
this.load.list = false;
}).catch( err => this.load.list = false );
},
// XmMyFocus
showEdit: function ( row,index ) {
this.editFormVisible = true;
this.editForm = Object.assign({}, row);
},
// XmMyFocus
showAdd: function () {
this.addFormVisible = true;
//this.addForm=Object.assign({}, this.editForm);
},
afterAddSubmit(){
this.addFormVisible=false;
this.pageInfo.count=true;
this.getXmMyFocuss();
},
afterEditSubmit(){
this.editFormVisible=false;
},
//xmMyFocus
selsChange: function (sels) {
this.sels = sels;
},
//xmMyFocus
handleDel: function (row,index) {
this.$confirm('确认删除该记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
let params = { userid:row.userid, bizId:row.bizId, pbizId:row.pbizId };
delXmMyFocus(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if(tips.isOk){
this.searchXmMyFocuss();
}
this.$notify({ position:'bottom-left', showClose:true, message: tips.msg, type: tips.isOk?'success':'error' });
}).catch( err => this.load.del=false );
});
},
//xmMyFocus
batchDel: function () {
if(this.sels.length<=0){
return;
}
var params=this.sels.map(i=>{
return { userid:i.userid, bizId:i.bizId, pbizId:i.pbizId}
})
this.$confirm('确认删除选中记录吗?', '提示', {
type: 'warning'
}).then(() => {
this.load.del=true;
batchDelXmMyFocus(params).then((res) => {
this.load.del=false;
var tips=res.data.tips;
if( tips.isOk ){
this.searchXmMyFocuss();
}
this.$notify({ position:'bottom-left',showClose:true, message: tips.msg, type: tips.isOk?'success':'error'});
}).catch( err => this.load.del=false );
});
},
editSomeFields(row,fieldName,$event){
let params={};
if(this.sels.length>0){
if(!this.sels.some(k=> k.userid==row.userid && k.bizId==row.bizId && k.pbizId==row.pbizId)){
this.$notify({position:'bottom-left',showClose:true,message:'请编辑选中的行',type:'warning'})
Object.assign(this.editForm,this.editFormBak)
return;
}
params['pkList']=this.sels.map(i=>{ return { userid:i.userid, bizId:i.bizId, pbizId:i.pbizId}})
}else{
params['pkList']=[row].map(i=>{ return { userid:i.userid, bizId:i.bizId, pbizId:i.pbizId}})
}
params[fieldName]=$event
var func = editSomeFieldsXmMyFocus
func(params).then(res=>{
let tips = res.data.tips;
if(tips.isOk){
if(this.sels.length>0){
this.searchXmMyFocuss();
}
this.editFormBak=[...this.editForm]
}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))
},
rowClick: function(row, event, column){
this.editForm=row
this.editFormBak={...row};
this.$emit('row-click',row, event, column);// @row-click="rowClick"
},
initData: function(){
},
},//end methods
mounted() {
this.$nextTick(() => {
initDicts(this);
this.initData()
this.searchXmMyFocuss();
this.maxTableHeight = util.calcTableMaxHeight(this.$refs.xmMyFocusTable.$el)
});
}
}
</script>
<style scoped>
</style>

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

@ -227,9 +227,10 @@
<el-table-column label="操作" width="200" fixed="right">
<template slot-scope="scope">
<el-button v-if="menukey=='myFocus'" type="primary" @click.stop="focusOrUnfocus(scope.row)" >取消关注</el-button>
<el-button v-else type="text" @click.stop="focusOrUnfocus(scope.row)" >关注</el-button>
<el-button id="guider-five" type="text" title="通过复制创建新的产品" @click="onCopyToBtnClick(scope.row)" :disabled="load.add" v-loading="load.add">复制</el-button>
<el-button type="text" @click="intoInfo(scope.row)" icon="el-icon-s-data">视图</el-button>
<el-button type="text" v-loading="load.del" @click="handleDel(scope.row)" :disabled="load.del==true" icon="el-icon-delete">删除</el-button>
<el-button type="text" v-loading="load.del" @click="handleDel(scope.row)" :disabled="load.del==true" icon="el-icon-delete">删除</el-button>
</template>
</el-table-column>
</el-table>
@ -319,6 +320,7 @@
import UsersSelect from "@/views/mdp/sys/user/UsersSelect";
import XmIterationSelect from '@/views/xm/core/components/XmIterationSelect.vue';
import XmProductSelect from '@/views/xm/core/components/XmProductSelect.vue';
import { addXmMyFocus , delXmMyFocus } from '@/api/xm/core/xmMyFocus';
import Guider from '@/components/Guider/Index.js';
@ -712,6 +714,23 @@
guiderStart(forceDisplayWhileClosed) { //
Guider.startByName('xmProductMng',forceDisplayWhileClosed);
},
focusOrUnfocus:function(row){
if(this.menukey=="myFocus"){
delXmMyFocus({pbizId:row.id,bizId:row.id}).then(res=>{
var tips=res.data.tips;
if(tips.isOk){
this.getXmProjects();
}
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' });
})
}else{
addXmMyFocus({pbizId:row.id,focusType:'3',bizId:row.id,bizName:row.productName}).then(res=>{
var tips=res.data.tips;
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' });
})
}
},
},//end methods
components: {
'xm-product-add':XmProductAdd,

4
src/views/xm/core/xmProject/XmProjectMng.vue

@ -761,7 +761,7 @@
},
focusOrUnfocus:function(row){
if(this.menukey=="myFocus"){
delXmMyFocus({projectId:row.id,focusType:'project',userid:this.userInfo.userid,username:this.userInfo.username}).then(res=>{
delXmMyFocus({pbizId:row.id,focusType:'1',bizId:row.id,bizName:row.name}).then(res=>{
var tips=res.data.tips;
if(tips.isOk){
this.getXmProjects();
@ -769,7 +769,7 @@
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' });
})
}else{
addXmMyFocus({projectId:row.id,focusType:'project',projectName:row.name,userid:this.userInfo.userid,username:this.userInfo.username}).then(res=>{
addXmMyFocus({pbizId:row.id,focusType:'1',bizId:row.id,bizName:row.name}).then(res=>{
var tips=res.data.tips;
this.$notify({position:'bottom-left',showClose:true,message: tips.msg, type: tips.isOk?'success':'error' });
})

Loading…
Cancel
Save