9 changed files with 848 additions and 442 deletions
-
41src/api/xm/core/xmMyFocus.js
-
7src/views/myWork/my/components/boxCard.vue
-
21src/views/myWork/my/index.vue
-
129src/views/xm/core/xmMyFocus/XmMyFocusAdd.vue
-
178src/views/xm/core/xmMyFocus/XmMyFocusEdit.vue
-
367src/views/xm/core/xmMyFocus/XmMyFocusList.vue
-
520src/views/xm/core/xmMyFocus/XmMyFocusMng.vue
-
23src/views/xm/core/xmProduct/XmProductMng.vue
-
4src/views/xm/core/xmProject/XmProjectMng.vue
@ -1,30 +1,47 @@ |
|||||
import axios from '@/utils/request' |
import axios from '@/utils/request' |
||||
|
|
||||
|
import { getDicts,initSimpleDicts,initComplexDicts } from '@/api/mdp/meta/item';//字典表
|
||||
import config from '@/common/config' |
import config from '@/common/config' |
||||
|
|
||||
let base = config.getCoreBasePath(); |
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关系
|
//普通查询 条件之间and关系
|
||||
export const listXmMyFocus = params => { return axios.get(`${base}/xm/core/xmMyFocus/list`, { params: params }); }; |
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); }; |
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); }; |
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); }; |
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) |
||||
|
}); |
||||
|
} |
||||
|
}; |
||||
@ -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> |
|
||||
@ -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> |
||||
@ -1,238 +1,312 @@ |
|||||
<template> |
<template> |
||||
<section class="page-container padding border"> |
|
||||
|
<section class="page-container border padding"> |
||||
<el-row> |
<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> |
||||
<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-column> |
||||
</el-table> |
</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> |
||||
|
<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> |
</section> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<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> |
</script> |
||||
|
|
||||
<style scoped> |
<style scoped> |
||||
|
|
||||
</style> |
</style> |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue