Commit feec15d0 authored by 骆瑛's avatar 骆瑛

项目管理成员,动态

parent f39a37ab
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -4938,7 +4938,7 @@ ...@@ -4938,7 +4938,7 @@
"dependencies": { "dependencies": {
"commander": { "commander": {
"version": "2.14.1", "version": "2.14.1",
"resolved": "https://registry.npm.taobao.org/commander/download/commander-2.14.1.tgz?cache=0&sync_timestamp=1595168224685&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.14.1.tgz", "resolved": "http://r.cnpmjs.org/commander/download/commander-2.14.1.tgz",
"integrity": "sha1-IjUSPjevjKPGXfRbAm29NXsBuao=" "integrity": "sha1-IjUSPjevjKPGXfRbAm29NXsBuao="
} }
} }
...@@ -5467,7 +5467,7 @@ ...@@ -5467,7 +5467,7 @@
}, },
"crc-32": { "crc-32": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npm.taobao.org/crc-32/download/crc-32-1.2.0.tgz", "resolved": "http://r.cnpmjs.org/crc-32/download/crc-32-1.2.0.tgz",
"integrity": "sha1-yy224puIUI4y2d0OwWk+e0Ghggg=", "integrity": "sha1-yy224puIUI4y2d0OwWk+e0Ghggg=",
"requires": { "requires": {
"exit-on-epipe": "~1.0.1", "exit-on-epipe": "~1.0.1",
...@@ -7364,7 +7364,7 @@ ...@@ -7364,7 +7364,7 @@
}, },
"exit-on-epipe": { "exit-on-epipe": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npm.taobao.org/exit-on-epipe/download/exit-on-epipe-1.0.1.tgz", "resolved": "http://r.cnpmjs.org/exit-on-epipe/download/exit-on-epipe-1.0.1.tgz",
"integrity": "sha1-C92S6H1ShdJn2qgXHQ6wYVlolpI=" "integrity": "sha1-C92S6H1ShdJn2qgXHQ6wYVlolpI="
}, },
"expand-brackets": { "expand-brackets": {
...@@ -8015,7 +8015,7 @@ ...@@ -8015,7 +8015,7 @@
}, },
"frac": { "frac": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npm.taobao.org/frac/download/frac-1.1.2.tgz", "resolved": "http://r.cnpmjs.org/frac/download/frac-1.1.2.tgz",
"integrity": "sha1-PXT39keMiKG1AgMG10fcYxPHTQs=" "integrity": "sha1-PXT39keMiKG1AgMG10fcYxPHTQs="
}, },
"fragment-cache": { "fragment-cache": {
...@@ -15087,7 +15087,7 @@ ...@@ -15087,7 +15087,7 @@
}, },
"printj": { "printj": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npm.taobao.org/printj/download/printj-1.1.2.tgz", "resolved": "http://r.cnpmjs.org/printj/download/printj-1.1.2.tgz",
"integrity": "sha1-2Q3rKXWoufYA+zoclOP0xTx4oiI=" "integrity": "sha1-2Q3rKXWoufYA+zoclOP0xTx4oiI="
}, },
"private": { "private": {
...@@ -20540,7 +20540,7 @@ ...@@ -20540,7 +20540,7 @@
}, },
"script-loader": { "script-loader": {
"version": "0.7.2", "version": "0.7.2",
"resolved": "https://registry.npm.taobao.org/script-loader/download/script-loader-0.7.2.tgz", "resolved": "http://r.cnpmjs.org/script-loader/download/script-loader-0.7.2.tgz",
"integrity": "sha1-IBbbb4byX1z1baOJFdgzeLsWa6c=", "integrity": "sha1-IBbbb4byX1z1baOJFdgzeLsWa6c=",
"dev": true, "dev": true,
"requires": { "requires": {
...@@ -21128,7 +21128,7 @@ ...@@ -21128,7 +21128,7 @@
}, },
"ssf": { "ssf": {
"version": "0.10.3", "version": "0.10.3",
"resolved": "https://registry.npm.taobao.org/ssf/download/ssf-0.10.3.tgz", "resolved": "http://r.cnpmjs.org/ssf/download/ssf-0.10.3.tgz",
"integrity": "sha1-jq4fwpyQpVLnkhII+BiS1vd6yys=", "integrity": "sha1-jq4fwpyQpVLnkhII+BiS1vd6yys=",
"requires": { "requires": {
"frac": "~1.1.2" "frac": "~1.1.2"
...@@ -23778,7 +23778,7 @@ ...@@ -23778,7 +23778,7 @@
}, },
"wmf": { "wmf": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npm.taobao.org/wmf/download/wmf-1.0.2.tgz", "resolved": "http://r.cnpmjs.org/wmf/download/wmf-1.0.2.tgz",
"integrity": "sha1-fRnWIQcaCMK9xrfmiKnENSmMwto=" "integrity": "sha1-fRnWIQcaCMK9xrfmiKnENSmMwto="
}, },
"word-wrap": { "word-wrap": {
...@@ -23933,7 +23933,7 @@ ...@@ -23933,7 +23933,7 @@
}, },
"xlsx": { "xlsx": {
"version": "0.15.6", "version": "0.15.6",
"resolved": "https://registry.npm.taobao.org/xlsx/download/xlsx-0.15.6.tgz?cache=0&sync_timestamp=1597272342311&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fxlsx%2Fdownload%2Fxlsx-0.15.6.tgz", "resolved": "http://r.cnpmjs.org/xlsx/download/xlsx-0.15.6.tgz",
"integrity": "sha1-Rh+EHW2eoag3XizSRr8jrs4IodU=", "integrity": "sha1-Rh+EHW2eoag3XizSRr8jrs4IodU=",
"requires": { "requires": {
"adler-32": "~1.2.0", "adler-32": "~1.2.0",
...@@ -23948,7 +23948,7 @@ ...@@ -23948,7 +23948,7 @@
"dependencies": { "dependencies": {
"commander": { "commander": {
"version": "2.17.1", "version": "2.17.1",
"resolved": "https://registry.npm.taobao.org/commander/download/commander-2.17.1.tgz?cache=0&sync_timestamp=1595168224685&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcommander%2Fdownload%2Fcommander-2.17.1.tgz", "resolved": "http://r.cnpmjs.org/commander/download/commander-2.17.1.tgz",
"integrity": "sha1-vXerfebelCBc6sxy8XFtKfIKd78=" "integrity": "sha1-vXerfebelCBc6sxy8XFtKfIKd78="
} }
} }
......
import Api from '@/plugins/request' import Api from '@/plugins/request'
export default { export default {
index:`${material}/projectgroupuser/paged`, index: `${material}/projectgroupuser/paged`,
paged(params){ paged(params) {
return Api.post(`${material}/projectgroupuser/paged`,params); return Api.post(`${material}/projectgroupuser/paged`, params);
}, },
list(params){ list(params) {
return Api.post(`${material}/projectgroupuser/list`,params); return Api.post(`${material}/projectgroupuser/list`, params);
},
get(params){
return Api.get(`${material}/projectgroupuser/get`,params);
}, },
create(params){ get(params) {
return Api.post(`${material}/projectgroupuser/create`,params); return Api.get(`${material}/projectgroupuser/get`, params);
}, },
update(params){ create(params) {
return Api.post(`${material}/projectgroupuser/update`,params); return Api.post(`${material}/projectgroupuser/create`, params);
},
update(params) {
return Api.post(`${material}/projectgroupuser/update`, params);
}, },
delete(id) { delete(id) {
return Api.delete(`${material}/projectgroupuser/delete`,{params:{id:id}}); return Api.delete(`${material}/projectgroupuser/delete`, { params: { id: id } });
}, },
deletes(params) { deletes(params) {
return Api.post(`${material}/projectgroupuser/batchdelete`,params); return Api.post(`${material}/projectgroupuser/batchdelete`, params);
} },
} groundPaged(params) {
\ No newline at end of file return Api.post(`${material}/projectgroup/paged`, params);
},
importTeam(params) { //批量添加
return Api.post(`${material}/projectgroupuser/createbatch`, params);
},
allTeams(params) { //添加项目组和成员
return Api.post(`${material}/projectgroupuser/creategroupanduser`, params);
},
}
\ No newline at end of file
<template> <template>
<div> <div>
<Table border :columns="columns" :data="list" ref="table" class="tableCommon" stripe> <Row :gutter="10" class="importWindow" type="flex" align="middle">
<template slot-scope="{ row, index }" slot="userId"> <Col span="5">
<a class="op detail" v-if="edit != index" @click="view(row.id)"><User :value="row.userId"></User></a> <Form :label-width="80" class="forms">
<UserSelect v-else ref="userSelected" v-model="cur.userId" @on-change="setRow"/> <FormItem label="复制团队">
</template> <Select v-model="groupId" @on-change="loadGroup">
<template slot-scope="{ row, index }" slot="role"> <Option :value="v.id" v-for="(v, i) in teams" :key="i">{{
<state v-if="edit != index" code="project.group.role" :value="row.role" type="text"></state> v.title
<Dictionary v-else code="project.group.role" v-model="cur.role"></Dictionary> }}</Option>
</template> </Select>
<template slot-scope="{ row, index }" slot="status"> </FormItem>
<state v-if="edit != index" code="project.group.status" :value="row.status" type="text"></state> </Form>
<Dictionary v-else code="project.group.status" v-model="cur.status"></Dictionary> </Col>
</template> <Col span="2" v-if="groupUsers.length>0">
<template slot-scope="{ row, index }" slot="whour"> <label>可导入人员:{{ groupUsers.length }}</label>
<span v-if="edit != index" v-text="row.whour"></span> <Button type="primary" @click="importBtn">导入</Button>
<InputNumber v-else type="text" v-model.trim="cur.whour" /> </Col>
</template> </Row>
<template slot-scope="{ row, index }" slot="whourpd"> <Table
<span v-if="edit != index" v-text="row.whourpd"></span> border
<InputNumber v-else type="text" v-model.trim="cur.whourpd" /> :columns="columns"
</template> :data="list"
<template slot-scope="{ row, index }" slot="authority"> ref="table"
<state v-if="edit != index" code="project.group.authority" :value="row.authority" type="text"></state> class="tableCommon"
<Dictionary v-else code="project.group.authority" v-model="cur.authority" @on-change="changeAuthority"></Dictionary> stripe
</template> >
<template slot-scope="{ row, index }" slot="note"> <template slot-scope="{ row, index }" slot="userId">
<span v-if="edit != index" v-text="row.note"></span> <a class="op detail" v-if="edit != index" @click="view(row.id)"
<Input v-else type="text" v-model.trim="cur.note" :disabled="true" /> ><User :value="row.userId"></User
</template> ></a>
<template slot-scope="{ row, index }" slot="action"> <UserSelect
<div v-if="edit != index" class="action"> v-else
<op class="edit" @click="editRow(row,index)" :disabled="edit != -1" :style="{'color': edit != -1?'#ccc':'' }">编辑</op> ref="userSelected"
<op class="remove" @click="delRow(row.id)" :disabled="edit != -1" :style="{'color': edit != -1?'#ccc':'' }">删除</op> v-model="cur.userId"
</div> @on-change="setRow"
<div class="action" v-else> />
<op class="edit" @click="save">保存</op> </template>
<op class="remove" @click="remove(row,index)">取消</op> <template slot-scope="{ row, index }" slot="role">
</div> <state
</template> v-if="edit != index"
code="project.group.role"
:value="row.role"
type="text"
></state>
<Dictionary
v-else
code="project.group.role"
v-model="cur.role"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="status">
<state
v-if="edit != index"
code="project.group.status"
:value="row.status"
type="text"
></state>
<Dictionary
v-else
code="project.group.status"
v-model="cur.status"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="whour">
<span v-if="edit != index" v-text="row.whour"></span>
<InputNumber v-else type="text" v-model.trim="cur.whour" />
</template>
<template slot-scope="{ row, index }" slot="whourpd">
<span v-if="edit != index" v-text="row.whourpd"></span>
<InputNumber v-else type="text" v-model.trim="cur.whourpd" />
</template>
<template slot-scope="{ row, index }" slot="authority">
<state
v-if="edit != index"
code="project.group.authority"
:value="row.authority"
type="text"
></state>
<Dictionary
v-else
code="project.group.authority"
v-model="cur.authority"
@on-change="changeAuthority"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="note">
<span v-if="edit != index" v-text="row.note"></span>
<Input v-else type="text" v-model.trim="cur.note" :disabled="true" />
</template>
<template slot-scope="{ row, index }" slot="action">
<div v-if="edit != index" class="action">
<op
class="edit"
@click="editRow(row, index)"
:disabled="edit != -1"
:style="{ color: edit != -1 ? '#ccc' : '' }"
>编辑</op
>
<op
class="remove"
@click="delRow(row.id)"
:disabled="edit != -1"
:style="{ color: edit != -1 ? '#ccc' : '' }"
>删除</op
>
</div>
<div class="action" v-else>
<op class="edit" @click="save">保存</op>
<op class="remove" @click="remove(row, index)">取消</op>
</div>
</template>
</Table> </Table>
<div class="footerWidth"><Button type="primary" long @click="addList" :disabled="edit != -1">新增人员</Button></div> <div class="footerWidth">
<Button type="primary" long @click="addList" :disabled="edit != -1"
>新增人员</Button
>
</div>
<Modal v-model="modal" :title="title" width="1200" footer-hide> <Modal v-model="modal" :title="title" width="1200" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" /> <component :is="detail" :eid="curId" @on-close="cancel" />
</Modal> </Modal>
</div>
</div>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
export default { export default {
name: 'list', name: "list",
head: { head: {
title: "项目成员", title: "项目成员",
author: "henq", author: "henq",
description: "project_group_user 10/21/2020 11:46:56 AM", description: "project_group_user 10/21/2020 11:46:56 AM",
}, },
data() { data() {
return { return {
modal1: false,
modal: false, detail: null,
title: "新增", groupUsers: [],
detail: null, rules: {
curId: '', name: [
edit: -1, {
authorityCount: 0, //列表中权限里是否存在项目经理(列表中唯一) required: true,
authorityCur: 0, //当前行的权限 值 message: "The name cannot be empty",
cur: { trigger: "blur",
id: '', },
userId: null, ],
role: 1, },
status: 1, groupId: null,
whour: 14, modal: false,
whourpd: 7.0, title: "新增",
authority: 2, detail: null,
note: '' curId: "",
}, edit: -1,
columns: [{ authorityCount: 0, //列表中权限里是否存在项目经理(列表中唯一)
type: "index", authorityCur: 0, //当前行的权限 值
title: '编号', cur: {
align: "right", id: "",
width: 80 userId: null,
}, { role: 1,
key: "userId", status: 1,
title: this.l("userId"), whour: 14,
align: "left", whourpd: 7.0,
slot: 'userId' authority: 2,
}, note: "",
{ },
key: "role", columns: [
title: this.l("role"), {
align: "center", type: "index",
width: 180, title: "编号",
slot: 'role' align: "right",
}, width: 80,
{
key: "status",
title: this.l("status"),
align: "center",
width: 150,
slot: 'status'
},
// {
// key: "joindate",
// title: this.l("joindate"),
// align: "center",
// width: 180,
// slot: 'joindate'
// },
{
key: "whour",
title: this.l("whour"),
align: "right",
width: 150,
slot: 'whour'
},
{
key: "whourpd",
title: this.l("whourpd"),
align: "right",
width: 150,
slot: 'whourpd'
},
{
key: "authority",
title: this.l("authority"),
align: "center",
width: 200,
slot: 'authority'
},
// {
// key: "note",
// title: this.l("note"),
// align: "left",
// slot: 'note'
// },
{
title: '操作',
key: 'action',
width: 140,
align: 'center',
slot: 'action',
},
],
list: []
}
},
props: {
eid: String,
projectId:String
},
mounted() {
if (this.eid||this.projectId ) {
this.load()
}
},
async fetch({
store,
params
}) {
await store.dispatch('loadDictionary') // 加载数据字典
},
methods: {
load() {
let params = {
conditions: [{
fieldName: "groupId",
fieldValue: this.eid,
conditionalType: "Equal",
}],
}
if(this.projectId){
params = {
conditions: [{
fieldName: "projectId",
fieldValue: this.projectId,
conditionalType: "Equal",
}],
}
}
Api.list(params).then(r => {
if (r.success) {
this.list = r.result
}
})
}, },
setRow(e,name){ {
this.cur.note=name; key: "userId",
title: this.l("userId"),
align: "left",
slot: "userId",
}, },
//新增 {
addList() { key: "role",
this.edit = this.list.length; title: this.l("role"),
this.cur = { align: "center",
userId: null, width: 180,
role: 0, slot: "role",
status: 1,
joindate: '',
whour: 14,
whourpd: 7.0,
authority: 0,
projectId:this.projectId,
note: ''
};
this.authorityCur = 0
this.list.push(this.cur);
}, },
//编辑 {
editRow(row, index) { key: "status",
this.cur=this.$u.clone(row); title: this.l("status"),
this.edit = index align: "center",
width: 150,
slot: "status",
}, },
changeUser(val, item) { {
this.cur.note = item key: "whour",
title: this.l("whour"),
align: "right",
width: 150,
slot: "whour",
}, },
//选择权限 {
changeAuthority(val) { key: "whourpd",
if (this.authorityCur != 1 && this.authorityCount == 1 && val == 1) { title: this.l("whourpd"),
this.$Message.error("已存在权限:项目经理,请选择其他权限!") align: "right",
this.cur.authority = null width: 150,
} slot: "whourpd",
}, },
//删除 {
delRow(id) { key: "authority",
Api.delete(id).then((r) => { title: this.l("authority"),
if (r.success) { align: "center",
this.load() width: 200,
this.$Message.success('删除成功') slot: "authority",
this.edit = -1;
}
})
}, },
//新增时取消 {
remove(row, index) { title: "操作",
if (!row.id || !row.groupId) { key: "action",
this.list.pop(); width: 140,
} align: "center",
this.edit = -1; slot: "action",
}, },
//新增保存或修改保存 ],
save() { list: [],
this.cur.groupId = this.eid teams: [],
if (!this.cur.userId) { };
this.$Message.error("请选择人员"); },
return; props: {
} eid: String,
var cnt=this.list.filter(u=>{ },
return u.userId==this.cur.userId mounted() {
if (this.eid || this.projectId) {
this.load();
this.groundTeam();
}
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
loadGroup() {
console.log('groupId', this.groupId);
Api.list({
conditions: [
{
fieldName: "groupId",
fieldValue: this.groupId,
conditionalType: "Equal",
},
],
}).then((r) => {
if (r.success) {
let obj = {};
let list = r.result.reduce((cur,next) => {
obj[next.userId] ? "" : obj[next.userId] = true && cur.push(next);
return cur;
},[])
var users = [];
list.map((u) => {
var cnt = this.list.filter((p) => {
return p.userId == u.userId;
}).length; }).length;
if(cnt>1){ if (cnt == 0) {
this.$Message.error("此人已经选择"); delete u.id;
return; delete u.groupId;
} u.groupId = this.eid;
if (!this.cur.role ) { u.authority = 2;
this.$Message.error("请选择人员角色"); u.projectId = this.eid;
return; users.push(u);
} }
if (this.cur.authority == null || this.cur.authority == '') { });
this.$Message.error("请选择人员权限"); this.groupUsers=[];
return; this.groupUsers = users;
} if (this.groupUsers.length == 0) {
if (this.cur.id && this.cur.id != '') { //人员修改 this.$Message.warning("团队已有成员,请勿复制!");
Api.update(this.cur).then((r) => { }
this.disabled = false;
if (r.success) {
this.$Message.success('修改成功')
this.edit = -1
this.load()
} else {
this.$Message.error('修改失败')
}
})
} else { //人员新增
Api.create(this.cur).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success('保存成功')
this.edit = -1
this.load()
} else {
this.$Message.error('保存失败')
}
})
}
},
getFormatDateStart(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 00:00:01";
return resDate;
},
p(s) {
return s < 10 ? "0" + s : s;
},
l(key) {
let vkey = "project_group_user" + "." + key;
return this.$t(vkey) || key
},
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import('./detail')
this.modal = true;
},
editRow1(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import('./edit')
this.modal = true;
},
cancel() {
this.curId = this.eid;
this.modal = false
} }
//old弹框模式方法end });
}, },
watch: { importBtn() {
eid(v) { if (this.groupUsers.length > 0) {
if (v) { Api.importTeam(this.groupUsers).then((r) => {
this.load(); if (r.success) {
} this.load("strat");
}, this.groupUsers=[];
projectId(v) { this.$Message.success("复制成功!");
if (v) { }
this.load(); });
} }
},
groundTeam() {
let data = {
conditions: [],
isDesc: true,
pageIndex: 1,
pageSize: 20,
sortBy: "id",
};
Api.groundPaged(data).then((r) => {
if (r.success) {
this.teams = r.result.items;
} }
} });
} },
load() {
let params = {
conditions: [
{
fieldName: "groupId",
fieldValue: this.eid,
conditionalType: "Equal",
},
],
};
Api.list(params).then((r) => {
if (r.success) {
this.list = r.result;
}
});
},
setRow(e, name) {
this.cur.note = name;
},
//新增
addList() {
this.edit = this.list.length;
this.cur = {
userId: null,
role: 0,
status: 1,
joindate: "",
whour: 14,
whourpd: 7.0,
authority: 0,
projectId: this.projectId,
note: "",
};
this.authorityCur = 0;
this.list.push(this.cur);
},
//编辑
editRow(row, index) {
this.cur = this.$u.clone(row);
this.edit = index;
},
changeUser(val, item) {
this.cur.note = item;
},
//选择权限
changeAuthority(val) {
if (this.authorityCur != 1 && this.authorityCount == 1 && val == 1) {
this.$Message.error("已存在权限:项目经理,请选择其他权限!");
this.cur.authority = null;
}
},
//删除
delRow(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.load();
this.$Message.success("删除成功");
this.edit = -1;
}
});
},
//新增时取消
remove(row, index) {
if (!row.id || !row.groupId) {
this.list.pop();
}
this.edit = -1;
},
//新增保存或修改保存
save() {
this.cur.groupId = this.eid;
if (this.cur.userId === undefined) {
this.$Message.error("请选择人员");
return;
}
var cnt = this.list.filter((u) => {
return u.userId == this.cur.userId;
}).length;
if (cnt > 1) {
this.$Message.error("此人已经选择");
return;
}
if (this.cur.role === undefined) {
this.$Message.error("请选择人员角色");
return;
}
if (this.cur.authority == undefined) {
this.$Message.error("请选择人员权限");
return;
}
if (this.cur.id && this.cur.id != "") {
//人员修改
Api.update(this.cur).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("修改成功");
this.edit = -1;
this.load();
} else {
this.$Message.error("修改失败");
}
});
} else {
//人员新增
Api.create(this.cur).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.edit = -1;
this.load();
} else {
this.$Message.error("保存失败");
}
});
}
},
getFormatDateStart(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 00:00:01";
return resDate;
},
p(s) {
return s < 10 ? "0" + s : s;
},
l(key) {
let vkey = "project_group_user" + "." + key;
return this.$t(vkey) || key;
},
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
},
editRow1(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
cancel() {
this.curId = this.eid;
this.modal = false;
},
//old弹框模式方法end
},
watch: {
eid(v) {
if (v) {
this.load();
}
},
},
};
</script> </script>
<style lang="less"> <style lang="less">
* {
margin: 0;
padding: 0;
}
.importWindow {
height: 50px;
.forms {
margin-top: 8px;
}
Button {
margin-bottom: 15px;
}
}
.footerWidth { .footerWidth {
width: calc(100%); width: calc(100%);
margin-top: 5px; margin-top: 5px;
} }
</style> </style>
<template>
<div>
<Row :gutter="10" class="importWindow" type="flex" align="middle">
<Col span="5">
<Form :label-width="80" class="forms">
<FormItem label="复制团队">
<Select v-model="groupId" @on-change="loadGroup">
<Option :value="v.id" v-for="(v, i) in teams" :key="i">{{
v.title
}}</Option>
</Select>
</FormItem>
</Form>
</Col>
<Col span="2" v-if="groupUsers.length>0">
<label>可导入人员:{{ groupUsers.length }}</label>
<Button type="primary" @click="importBtn">导入</Button>
</Col>
<Col span="1" offset="17">
<Button type="primary" @click="clickTeams">保存</Button>
</Col>
<Modal v-model="modalFormk" :title="title" width="1200" footer-hide>
<Form ref="modalForm" :model="modalForm" :rules="rules" :label-width="90" >
<Row>
<Col :span="12">
<FormItem :label="l('title')" prop="title">
<Input v-model="modalForm.title"> </Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('content')" prop="content">
<Input v-model="modalForm.content"> </Input>
</FormItem>
</Col>
</Row>
<Row v-if="data1 && data1.length > 0">
<Table :columns="columns1" :data="data1" class="tableCommon">
<template slot-scope="{ row, index }" slot="userId">
{{ row.note }}
</template>
<template slot-scope="{ row, index }" slot="role">
<state code="project.group.role" :value="row.role" type="text" ></state>
</template>
<template slot-scope="{ row, index }" slot="status">
<state code="project.group.status" :value="row.status" type="text" ></state>
</template>
<template slot-scope="{ row, index }" slot="whour">
<span v-text="row.whour"></span>
</template>
<template slot-scope="{ row, index }" slot="whourpd">
<span v-text="row.whourpd"></span>
</template>
<template slot-scope="{ row, index }" slot="authority">
<state code="project.group.authority" :value="row.authority" type="text" ></state>
</template>
</Table>
</Row>
<Row type="flex" justify="end" class="footM">
<FormItem>
<Button type="primary" @click="saveBtn('modalForm')">保存</Button>
<Button @click="closeBtn('modalForm')" class="ml20">取消</Button>
</FormItem>
</Row>
</Form>
</Modal>
</Row>
<Table border :columns="columns" :data="list" ref="table" class="tableCommon" stripe >
<template slot-scope="{ row, index }" slot="userId">
<a class="op detail" v-if="edit != index" @click="view(row.id)"
><User :value="row.userId"></User
></a>
<UserSelect
v-else
ref="userSelected"
v-model="cur.userId"
@on-change="setRow"
/>
</template>
<template slot-scope="{ row, index }" slot="role">
<state
v-if="edit != index"
code="project.group.role"
:value="row.role"
type="text"
></state>
<Dictionary
v-else
code="project.group.role"
v-model="cur.role"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="status">
<state
v-if="edit != index"
code="project.group.status"
:value="row.status"
type="text"
></state>
<Dictionary
v-else
code="project.group.status"
v-model="cur.status"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="whour">
<span v-if="edit != index" v-text="row.whour"></span>
<InputNumber v-else type="text" v-model.trim="cur.whour" />
</template>
<template slot-scope="{ row, index }" slot="whourpd">
<span v-if="edit != index" v-text="row.whourpd"></span>
<InputNumber v-else type="text" v-model.trim="cur.whourpd" />
</template>
<template slot-scope="{ row, index }" slot="authority">
<state
v-if="edit != index"
code="project.group.authority"
:value="row.authority"
type="text"
></state>
<Dictionary
v-else
code="project.group.authority"
v-model="cur.authority"
@on-change="changeAuthority"
></Dictionary>
</template>
<template slot-scope="{ row, index }" slot="note">
<span v-if="edit != index" v-text="row.note"></span>
<Input v-else type="text" v-model.trim="cur.note" :disabled="true" />
</template>
<template slot-scope="{ row, index }" slot="action">
<div v-if="edit != index" class="action">
<op
class="edit"
@click="editRow(row, index)"
:disabled="edit != -1"
:style="{ color: edit != -1 ? '#ccc' : '' }"
>编辑</op
>
<op
class="remove"
@click="delRow(row.id)"
:disabled="edit != -1"
:style="{ color: edit != -1 ? '#ccc' : '' }"
>删除</op
>
</div>
<div class="action" v-else>
<op class="edit" @click="save">保存</op>
<op class="remove" @click="remove(row, index)">取消</op>
</div>
</template>
</Table>
<div class="footerWidth">
<Button type="primary" long @click="addList" :disabled="edit != -1"
>新增人员</Button
>
</div>
<Modal v-model="modal" :title="title" width="1200" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" />
</Modal>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "list",
head: {
title: "项目成员",
author: "henq",
description: "project_group_user 10/21/2020 11:46:56 AM",
},
data() {
return {
columns1: [
{
key: "note",
title: this.l("userId"),
align: "center",
easy: true,
high: true,
},
{
key: "role",
title: this.l("role"),
align: "center",
easy: true,
high: true,
slot: "role",
},
{
key: "status",
title: this.l("status"),
align: "center",
width: 150,
slot: "status",
},
{
key: "whour",
title: this.l("whour"),
align: "center",
width: 150,
slot: "whour",
},
{
key: "whourpd",
title: this.l("whourpd"),
align: "center",
width: 150,
slot: "whourpd",
},
{
key: "authority",
title: this.l("authority"),
align: "center",
width: 200,
slot: "authority",
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "center",
high: true,
type: "date",
width: 180,
},
],
data1: [],
groupUsers: [],
modalFormk: false,
detail: null,
modal: false,
modalForm: {
title: "",
content: "",
creationTime: null,
creatorUserId: null,
deleterUserId: null,
deletionTime: null,
isDeleted: null,
lastModificationTime: null,
lastModifierUserId: null,
planId: "",
projectId: "",
},
rules: {
title: [
{
required: true,
message: "必填",
trigger: "blur",
},
],
},
groupId: null,
title: "新增",
curId: "",
edit: -1,
authorityCount: 0, //列表中权限里是否存在项目经理(列表中唯一)
authorityCur: 0, //当前行的权限 值
cur: {
id: "",
userId: null,
role: 1,
status: 1,
whour: 14,
whourpd: 7.0,
authority: 2,
note: "",
},
columns: [
{
type: "index",
title: "编号",
align: "right",
width: 80,
},
{
key: "userId",
title: this.l("userId"),
align: "left",
slot: "userId",
},
{
key: "role",
title: this.l("role"),
align: "center",
width: 180,
slot: "role",
},
{
key: "status",
title: this.l("status"),
align: "center",
width: 150,
slot: "status",
},
{
key: "whour",
title: this.l("whour"),
align: "right",
width: 150,
slot: "whour",
},
{
key: "whourpd",
title: this.l("whourpd"),
align: "right",
width: 150,
slot: "whourpd",
},
{
key: "authority",
title: this.l("authority"),
align: "center",
width: 200,
slot: "authority",
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
slot: "action",
},
],
list: [],
teams: [],
};
},
props: {
eid: String,
projectId: String,
},
mounted() {
if (this.eid || this.projectId) {
this.load("strat");
this.groundTeam();
}
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
loadGroup() {
Api.list({
conditions: [
{
fieldName: "groupId",
fieldValue: this.groupId,
conditionalType: "Equal",
},
],
}).then((r) => {
if (r.success) {
let obj = {};
let list = r.result.reduce((cur,next) => {
obj[next.userId] ? "" : obj[next.userId] = true && cur.push(next);
return cur;
},[])
var users = [];
list.map((u) => {
var cnt = this.list.filter((p) => {
return p.userId == u.userId;
}).length;
if (cnt == 0) {
delete u.id;
delete u.groupId;
u.authority = 2;
u.projectId = this.eid;
users.push(u);
}
});
this.groupUsers=[];
this.groupUsers = users;
if (this.groupUsers.length == 0) {
this.$Message.warning("团队已有成员,请勿复制!");
}
}
});
},
importBtn() {
if (this.groupUsers.length > 0) {
Api.importTeam(this.groupUsers).then((r) => {
if (r.success) {
this.load("strat");
this.groupUsers=[];
this.$Message.success("复制成功!");
}
});
}
},
clickTeams() {
this.modalFormk = true;
this.load("save");
},
saveBtn(name) {
this.$refs[name].validate((valid) => {
if (valid) {
if (this.data1.length > 0) {
this.modalForm.projectId = this.data1[0].projectId;
Api.allTeams(this.modalForm)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.modalFormk = false;
this.$refs[name].resetFields();
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.modalFormk = false;
this.$Message.error("保存失败");
});
}
} else {
this.$Message.error("请填写数据!");
}
});
},
closeBtn(name) {
this.$refs[name].resetFields();
this.modalFormk = false;
},
groundTeam() {
let data = {
conditions: [],
isDesc: true,
pageIndex: 1,
pageSize: 20,
sortBy: "id",
};
Api.groundPaged(data).then((r) => {
if (r.success) {
this.teams = r.result.items;
}
});
},
load(s) {
let params = {
conditions: [
{
fieldName: "projectId",
fieldValue: this.eid,
conditionalType: "Equal",
},
],
};
Api.list(params).then((r) => {
if (r.success) {
if (s == "strat") {
this.list = r.result;
} else {
var date = new Date(); //实例一个时间对象;
var year = date.getFullYear(); //获取系统的年;
var month =
date.getMonth() + 1 < 10
? "0" + (date.getMonth() + 1)
: date.getMonth() + 1; //获取系统月份,由于月份是从0开始计算,所以要加1
var day = change(date.getDate()); //获取系统日
var hour = change(date.getHours()); //获取系统时间
var minute = change(date.getMinutes()); //分
var second = change(date.getSeconds()); //秒
function change(t) {
if (t < 10) {
return "0" + t;
} else {
return t;
}
}
let newTime =
year +
"-" +
month +
"-" +
day +
" " +
hour +
":" +
minute +
":" +
second;
r.result.filter((v) => {
return (v.creationTime = newTime);
});
this.data1 = r.result;
console.log("data1", this.data1);
}
}
});
},
setRow(e, name) {
this.cur.note = name;
},
//新增
addList() {
this.edit = this.list.length;
this.cur = {
userId: null,
role: 0,
status: 1,
joindate: "",
whour: 14,
whourpd: 7.0,
authority: 0,
projectId: this.projectId,
note: "",
};
this.authorityCur = 0;
this.list.push(this.cur);
},
//编辑
editRow(row, index) {
this.cur = this.$u.clone(row);
this.edit = index;
},
changeUser(val, item) {
this.cur.note = item;
},
//选择权限
changeAuthority(val) {
if (this.authorityCur != 1 && this.authorityCount == 1 && val == 1) {
this.$Message.error("已存在权限:项目经理,请选择其他权限!");
this.cur.authority = null;
}
},
//删除
delRow(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.load("strat");
this.$Message.success("删除成功");
this.edit = -1;
}
});
},
//新增时取消
remove(row, index) {
if (!row.id || !row.groupId) {
this.list.pop();
}
this.edit = -1;
},
//新增保存或修改保存
save() {
this.cur.groupId = this.eid;
if (this.cur.userId === undefined) {
this.$Message.error("请选择人员");
return;
}
var cnt = this.list.filter((u) => {
return u.userId == this.cur.userId;
}).length;
if (cnt > 1) {
this.$Message.error("此人已经选择");
return;
}
if (this.cur.role === undefined) {
this.$Message.error("请选择人员角色");
return;
}
if (this.cur.authority === undefined) {
this.$Message.error("请选择人员权限");
return;
}
if (this.cur.id && this.cur.id != "") {
//人员修改
Api.update(this.cur).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("修改成功");
this.edit = -1;
this.load("strat");
} else {
this.$Message.error("修改失败");
}
});
} else {
//人员新增
Api.create(this.cur).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.edit = -1;
this.load("strat");
} else {
this.$Message.error("保存失败");
}
});
}
},
getFormatDateStart(dates) {
const d = new Date(dates);
const resDate =
d.getFullYear() +
"-" +
this.p(d.getMonth() + 1) +
"-" +
this.p(d.getDate()) +
" 00:00:01";
return resDate;
},
p(s) {
return s < 10 ? "0" + s : s;
},
l(key) {
let vkey = "project_group_user" + "." + key;
return this.$t(vkey) || key;
},
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
},
editRow1(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
cancel() {
this.curId = this.eid;
this.modal = false;
},
//old弹框模式方法end
},
watch: {
eid(v) {
if (v) {
this.load("strat");
}
},
projectId(v) {
if (v) {
this.load("strat");
}
},
},
};
</script>
<style lang="less">
.importWindow {
height: 50px;
.forms {
margin-top: 8px;
}
Button {
margin-bottom: 15px;
}
}
.footerWidth {
width: calc(100%);
margin-top: 5px;
}
.footM {
margin-top: 10px;
}
</style>
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12"
><FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker
type="date"
v-model="entity.creationTime"
></DatePicker> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('creatorUserId')" prop="creatorUserId">
<InputNumber v-model="entity.creatorUserId"></InputNumber> </FormItem
></Col>
<Col :span="12"
><FormItem
:label="l('lastModificationTime')"
prop="lastModificationTime"
>
<DatePicker
type="date"
v-model="entity.lastModificationTime"
></DatePicker> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<InputNumber
v-model="entity.lastModifierUserId"
></InputNumber> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('isDeleted')" prop="isDeleted">
<InputNumber v-model="entity.isDeleted"></InputNumber> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('deletionTime')" prop="deletionTime">
<DatePicker
type="date"
v-model="entity.deletionTime"
></DatePicker> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('deleterUserId')" prop="deleterUserId">
<InputNumber v-model="entity.deleterUserId"></InputNumber> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('entity')" prop="entity">
<Input v-model="entity.entity"> </Input> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('entityId')" prop="entityId">
<Input v-model="entity.entityId"> </Input> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('action')" prop="action">
<Dictionary
code="mes.project_log.Action"
v-model="entity.action"
></Dictionary> </FormItem
></Col>
<Col :span="24"
><FormItem :label="l('content')" prop="content">
<Input
v-model="entity.content"
type="textarea"
:rows="5"
></Input> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('upId')" prop="upId">
<Input v-model="entity.upId"> </Input> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('projectId')" prop="projectId">
<Input v-model="entity.projectId"> </Input> </FormItem
></Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled"
>保存</Button
>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
disabled: false,
entity: {
creationTime: null,
creatorUserId: null,
lastModificationTime: null,
lastModifierUserId: null,
isDeleted: null,
deletionTime: null,
deleterUserId: null,
entity: "",
entityId: "",
action: null,
content: "",
upId: "",
projectId: "",
},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: {
v: Object,
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.create(this.entity)
.then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.entity.id = 0;
});
},
l(key) {
key = "project_log" + "." + key;
return this.$t(key);
},
},
watch: {
v() {
this.entity = this.$u.clone(this.v);
},
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
};
</script>
\ No newline at end of file
import Api from '@/plugins/request'
export default {
index: `${material}/projectlog/paged`,
paged(params) {
return Api.post(`${material}/projectlog/paged`, params);
},
get(params) {
return Api.get(`${material}/projectlog/get`, params);
},
create(params) {
return Api.post(`${material}/projectlog/create`, params);
},
update(params) {
return Api.post(`${material}/projectlog/update`, params);
},
delete(id) {
return Api.delete(`${material}/projectlog/delete`, { params: { id: id } });
},
deletes(params) {
return Api.post(`${material}/projectlog/batchdelete`, params);
},
list(params) {
return Api.post(`${material}/projectgroupuser/list`, params);
},
}
\ No newline at end of file
<template>
<div class="detail">
<Row>
<Filed :span="12" :name="l('creationTime')">{{
entity.creationTime
}}</Filed>
<Filed :span="12" :name="l('creatorUserId')">{{
entity.creatorUserId
}}</Filed>
<Filed :span="12" :name="l('lastModificationTime')">{{
entity.lastModificationTime
}}</Filed>
<Filed :span="12" :name="l('lastModifierUserId')">{{
entity.lastModifierUserId
}}</Filed>
<!-- <Filed :span="12" :name="l('isDeleted')">{{ entity.isDeleted }}</Filed> -->
<Filed :span="12" :name="l('deletionTime')">{{
entity.deletionTime
}}</Filed>
<Filed :span="12" :name="l('deleterUserId')">{{
entity.deleterUserId
}}</Filed>
<Filed :span="12" :name="l('entity')">{{ entity.entity }}</Filed>
<Filed :span="12" :name="l('entityId')">{{ entity.entityId }}</Filed>
<Filed :span="12" :name="l('action')">{{ entity.action }}</Filed>
<Filed :span="24" :name="l('content')">{{ entity.content }}</Filed>
<Filed :span="12" :name="l('upId')">{{ entity.upId }}</Filed>
<Filed :span="12" :name="l('projectId')">{{ entity.projectId }}</Filed>
</Row>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: {
eid: String,
},
mounted() {
if (this.eid ) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.$emit("on-load");
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "project_log" + "." + key;
return this.$t(key);
},
},
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
};
</script>
<style lang="less">
.detail{
width: 100%;
}
</style>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12"
><FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker
type="date"
v-model="entity.creationTime"
></DatePicker> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('creatorUserId')" prop="creatorUserId">
<InputNumber v-model="entity.creatorUserId"></InputNumber> </FormItem
></Col>
<Col :span="12"
><FormItem
:label="l('lastModificationTime')"
prop="lastModificationTime"
>
<DatePicker
type="date"
v-model="entity.lastModificationTime"
></DatePicker> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<InputNumber
v-model="entity.lastModifierUserId"
></InputNumber> </FormItem
></Col>
<!-- <Col :span="12"
><FormItem :label="l('isDeleted')" prop="isDeleted">
<InputNumber v-model="entity.isDeleted"></InputNumber> </FormItem
></Col> -->
<Col :span="12"
><FormItem :label="l('deletionTime')" prop="deletionTime">
<DatePicker
type="date"
v-model="entity.deletionTime"
></DatePicker> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('deleterUserId')" prop="deleterUserId">
<InputNumber v-model="entity.deleterUserId"></InputNumber> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('entity')" prop="entity">
<Input v-model="entity.entity"> </Input> </FormItem
></Col>
<Col :span="12">
<FormItem :label="l('entityId')" prop="entityId">
<Input v-model="entity.entityId"> </Input> </FormItem >
</Col>
<Col :span="12"
><FormItem :label="l('action')" prop="action">
<Dictionary
code="mes.project_log.Action"
v-model="entity.action"
></Dictionary>
</FormItem
></Col>
<Col :span="24"
><FormItem :label="l('content')" prop="content">
<Input
v-model="entity.content"
type="textarea"
:rows="5"
></Input> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('upId')" prop="upId">
<Input v-model="entity.upId"> </Input> </FormItem
></Col>
<Col :span="12"
><FormItem :label="l('projectId')" prop="projectId">
<Input v-model="entity.projectId"> </Input> </FormItem
></Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled"
>保存</Button
>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Edit",
data() {
return {
disabled: false,
entity: {
},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
},
};
},
props: {
eid: String,
},
mounted() {
console.log("this.eid",this.eid)
if (this.eid) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
debugger
this.entity = r.result;
});
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.update(this.entity)
.then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "project_log" + "." + key;
return this.$t(key);
},
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
},
},
};
</script>
\ No newline at end of file
<template>
<div>
<DataGrid :columns="columns" ref="grid" :action="action">
<template slot="searchForm">
<Search />
</template>
<!-- <template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template> -->
</DataGrid>
<Modal v-model="modal" :title="title" width="1200" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal>
</div>
</template>
<script>
import Api from "./api";
import Search from "./search";
export default {
name: "list",
components: {
Search,
},
head: {
title: "项目日志",
author: "henq",
description: "project_log 10/20/2020 10:22:04 AM",
},
data() {
return {
action: Api.index,
easySearch: {},
modal: false,
title: "新增",
detail: null,
curId: "",
columns: [
{
key: "id",
title: this.$t("id"),
hide: true,
align: "left",
high: true,
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "left",
high: true,
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true,
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
align: "left",
high: true,
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
align: "left",
high: true,
},
{
key: "isDeleted",
title: this.l("isDeleted"),
align: "left",
high: true,
},
{
key: "deletionTime",
title: this.l("deletionTime"),
align: "left",
high: true,
},
{
key: "deleterUserId",
title: this.l("deleterUserId"),
align: "left",
high: true,
},
{ key: "entity", title: this.l("entity"), align: "left", high: true },
{
key: "entityId",
title: this.l("entityId"),
align: "left",
high: true,
},
{
key: "action",
title: this.l("action"),
align: "left",
high: true,
code: "mes.project_log.Action",
},
{ key: "upId", title: this.l("upId"), align: "left", high: true },
{
key: "projectId",
title: this.l("projectId"),
align: "left",
high: true,
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.view(params.row.id) },
},
"查看"
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) },
},
"编辑"
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) },
},
"删除"
),
]);
},
},
],
};
},
mounted() {
console.log(this);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = "";
},
search() {
this.$refs.grid.reload(this.easySearch);
},
// add() {
// this.curId = 0;
// this.title = "新增";
// this.detail = () => import("./add");
// this.modal = true;
// },
// copy(id) {
// this.curId = id;
// this.title = "克隆";
// this.detail = () => import("./add");
// this.modal = true;
// },
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import("./list");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
cancel() {
this.curId = "";
this.modal = false;
},
l(key) {
/*
project_log:{
creationTime:'创建时间',
creatorUserId:'创建人',
lastModificationTime:'更新时间',
lastModifierUserId:'更新人',
isDeleted:'删除人',
deletionTime:'删除时间',
deleterUserId:'删除人',
entity:'实体',
entityId:'实体的id',
action:'行动',
content:'内容',
upId:'计划或任务id',
projectId:'项目id',
}
*/
let vkey = "project_log" + "." + key;
return this.$t(vkey) || key;
},
},
};
</script>
<style lang="less">
</style>
\ No newline at end of file
<template>
<div>
<div class="formBg">
<Form ref="formInline" :model="easySearch" inline>
<FormItem>
<div class="taskMenu">
<Menu mode="horizontal" active-name="1" @on-select="onSelectTime">
<MenuItem name="0"> 所有 </MenuItem>
<MenuItem name="1"> 今天 </MenuItem>
<MenuItem name="2"> 昨天 </MenuItem>
<MenuItem name="3"> 本周 </MenuItem>
<MenuItem name="4"> 上周 </MenuItem>
<MenuItem name="5"> 本月 </MenuItem>
<MenuItem name="6"> 上月 </MenuItem>
<!-- <Submenu name="7">
<template slot="title"> 按用户查看 </template>
<MenuGroup title="按用户查看">
<MenuItem
v-for="(v, index) in list"
:key="index"
:name="v.userId"
>{{ v.note }}</MenuItem
>
</MenuGroup>
</Submenu> -->
</Menu>
<Dropdown @on-click="onSelectUser">
<a href="javascript:void(0)">
按用户查看
<Icon type="ios-arrow-down"></Icon>
</a>
<DropdownMenu slot="list">
<DropdownItem
v-for="(v, index) in list"
:key="index"
:name="v.userId"
>{{ v.note }}</DropdownItem
>
</DropdownMenu>
</Dropdown>
</div>
</FormItem>
<FormItem style="float: right">
<Button type="primary" @click="add" v-if="false">新增记录</Button>
</FormItem>
</Form>
</div>
<div>
<div class="group">
<Row>
<Col span="4">
<div class="fr boxBoder">
<List>
<ListItem>
<ListItemMeta>
<template slot="title">
<h3>{{ listTitle }}</h3>
</template>
<template slot="description">
{{ listTime }}
</template>
</ListItemMeta>
<template slot="action">
<li>
<Icon
type="md-arrow-dropright"
size="24"
color="#2d8cf0"
/>
</li>
</template>
</ListItem>
</List>
</div>
</Col>
<Col span="2">
<Divider class="dividerpram" />
</Col>
<Col span="18">
<div class="boxBoder">
<Timeline v-if="recordList && recordList.length > 0">
<TimelineItem
v-for="(item, index) in recordList"
:key="index"
v-if="recordList && recordList.length > 0"
>
<p class="TimelineItemli">
<span class="timeSpan">{{ item.creationTime }}</span>
<User :value="item.creatorUserId" />
<state code="mes.project_log.Action" :value="item.action" />
<!-- {{ item.entity }} {{ item.content }} -->
</p>
<!-- <p class="content">{{item.creationTime}}</p>
<p class="content">
<User :value="item.creatorUserId"></User>&nbsp;&nbsp;新增:{{item.title}}&nbsp;&nbsp;
<Tooltip max-width="400" v-if="item.note">
<a>详细信息</a>
<div slot="content">
<div v-html=" item.note"></div>
</div>
</Tooltip>
&nbsp;&nbsp;
</p>
<p v-if="item.note">
<div class="pl10" v-html="item.note"></div>
</p>
<p class="pl10" v-if="item.attachment"><a @click="viewFiles(item.attachment)">查看附件</a></p> -->
</TimelineItem>
</Timeline>
<p class="content" v-else>暂无数据</p>
</div>
</Col>
</Row>
</div>
</div>
<Modal v-model="modal" :title="title" width="1200" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal>
<Modal
v-model="modalFiles"
title="查看附件"
width="800"
footer-hide
:mask-closable="false"
>
<FilesView ref="refFile" :parms="parms" />
</Modal>
</div>
</template>
<script>
import Api from "./api";
import Search from "./search";
export default {
name: "list",
components: {
Search
},
head: {
title: "项目的工作记录",
author: "henq",
description: "project_plan_record 10/20/2020 2:55:13 PM",
},
props: {
eid: String,
projectId: String,
},
data() {
return {
action: Api.index,
easySearch: {
keys: {
op: "title",
value: null,
},
},
list: [],
users: "",
modalFiles: false,
modal: false,
title: "新增",
detail: null,
curId: "",
columns: [
{
key: "id",
title: this.$t("id"),
hide: true,
align: "left",
high: true,
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "left",
high: true,
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true,
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
align: "left",
high: true,
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
align: "left",
high: true,
},
{
key: "isDeleted",
title: this.l("isDeleted"),
align: "left",
high: true,
},
{
key: "deletionTime",
title: this.l("deletionTime"),
align: "left",
high: true,
},
{
key: "deleterUserId",
title: this.l("deleterUserId"),
align: "left",
high: true,
},
{
key: "projectId",
title: this.l("projectId"),
align: "left",
high: true,
},
{
key: "planId",
title: this.l("planId"),
align: "left",
high: true,
},
{
key: "workHour",
title: this.l("workHour"),
align: "left",
high: true,
},
{
key: "status",
title: this.l("status"),
align: "left",
high: true,
code: "mes.project_plan_record.Status",
},
{
key: "title",
title: this.l("title"),
align: "left",
easy: true,
high: true,
},
{
key: "note",
title: this.l("note"),
align: "left",
high: true,
},
{
key: "attachment",
title: this.l("attachment"),
align: "left",
high: true,
},
{
key: "taskId",
title: this.l("taskId"),
align: "left",
high: true,
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h(
"div",
{
class: "action",
},
[
h(
"op",
{
attrs: {
oprate: "detail",
},
on: {
click: () => this.view(params.row.id),
},
},
"查看"
),
//h('op', { attrs: { oprate: 'copy' }, on: { click: () => this.copy(params.row.id) } }, '克隆'),
h(
"op",
{
attrs: {
oprate: "edit",
},
on: {
click: () => this.edit(params.row.id),
},
},
"编辑"
),
h(
"op",
{
attrs: {
oprate: "delete",
},
on: {
click: () => this.remove(params.row.id),
},
},
"删除"
),
]
);
},
},
],
recordList: [],
parms: {
app: "taskRecord",
eid: null,
name: "",
field: "",
},
listTitle: "所有",
listTime: this.$u.getToday(),
startTime: "",
endTime: "",
};
},
mounted() {
if (this.eid) {
this.load();
this.moreGroup();
}
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
moreGroup() {
//按成员查看
let params = {
conditions: [
{
fieldName: "projectId",
fieldValue: this.eid,
conditionalType: "Equal",
},
],
};
if (this.projectId) {
params = {
conditions: [
{
fieldName: "projectId",
fieldValue: this.projectId,
conditionalType: "Equal",
},
],
};
}
Api.list(params).then((r) => {
if (r.success) {
let obj = {};
let list = r.result.reduce((cur, next) => {
obj[next.userId] ? "" : (obj[next.userId] = true && cur.push(next));
return cur;
}, []);
this.list = list;
}
});
},
load() {
var params = {
conditions: [
{
fieldName: "projectId",
fieldValue: this.eid,
conditionalType: "Equal",
},
],
isDesc: true,
pageIndex: 1,
pageSize: 20,
sortBy: "id",
};
if (this.startTime && this.endTime) {
params.conditions.push({
fieldName: "creationTime",
conditionalType: "Range",
fieldValue: `${this.startTime},${this.endTime}`,
});
}
if (this.users) {
params.conditions.push({
fieldName: "userId",
conditionalType: "Equal",
fieldValue: this.users,
});
}
Api.paged(params).then((r) => {
if (r.success) {
this.recordList = r.result.items;
this.recordList.forEach((e) => {
e.creationTime = e.creationTime.slice(11, 16);
});
}
});
},
ok() {
this.load();
this.modal = false;
this.curId = "";
},
search() {
this.$refs.grid.reload(this.easySearch);
},
add() {
this.curId = this.eid;
this.title = "新增记录";
this.detail = () => import("./add");
this.modal = true;
},
copy(id) {
this.curId = id;
this.title = "克隆";
this.detail = () => import("./add");
this.modal = true;
},
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
cancel() {
this.curId = 0;
this.modal = false;
},
viewFiles(val) {
this.parms.eid = val;
this.modalFiles = true;
},
onSelectUser(value) {
this.users = value;
this.load();
},
onSelectTime(name) {
let title = "所有";
let time = this.$u.getToday();
let startTime = "";
let endTime = "";
var date = new Date();
var year = date.getFullYear();
switch (name) {
case "0":
title = "所有";
time = "截止当前:" + this.$u.getToday();
startTime = "";
endTime = "";
break;
case "1":
title = "今天";
time = this.$u.getToday();
startTime = this.$u.getToday() + " 00:00:00";
endTime = this.$u.getToday() + " 23:59:59";
break;
case "2":
title = "昨天";
time = this.$u.getYestoday();
startTime = this.$u.getYestoday() + " 00:00:00";
endTime = this.$u.getYestoday() + " 23:59:59";
break;
case "3":
title = "本周";
time = this.$u.getCurMonday(1) + "--" + this.$u.getToday();
startTime = this.$u.getCurMonday(1) + " 00:00:00";
endTime = this.$u.getToday() + " 23:59:59";
break;
case "4":
title = "上周";
time = this.$u.getCurMonday(-6) + "--" + this.$u.getCurMonday(0);
startTime = this.$u.getCurMonday(-6) + " 00:00:00";
endTime = this.$u.getCurMonday(0) + " 23:59:59";
break;
case "5":
title = "本月";
time = this.$u.getCurMonth(0);
var month = date.getMonth() + 1;
var d = new Date(year, month, 0);
var d1 = new Date(d);
var datetime =
d.getFullYear() +
"-" +
(d.getMonth() + 1) +
"-" +
d.getDate() +
" ";
startTime = this.$u.getCurMonth(0) + "-01 00:00:00";
endTime = datetime + " 23:59:59";
break;
case "6":
title = "上月";
time = this.$u.getCurMonth(-1);
var month = date.getMonth();
var d = new Date(year, month, 0);
var d1 = new Date(d);
var datetime =
d.getFullYear() +
"-" +
(d.getMonth() + 1) +
"-" +
d.getDate() +
" ";
startTime = this.$u.getCurMonth(-1) + "-01 00:00:00";
endTime = datetime + " 23:59:59";
break;
default:
title = "所有";
time = "截止当前:" + this.$u.getToday();
startTime = "";
endTime = "";
break;
}
this.listTitle = title;
this.listTime = time;
this.startTime = startTime;
this.endTime = endTime;
this.load();
},
l(key) {
let vkey = "project_plan_record" + "." + key;
return this.$t(vkey) || key;
},
},
watch: {
eid(v) {
if (v != "" && v != null) {
this.load(v);
}
},
},
};
</script>
<style lang="less">
.formBg {
padding-top: 10px;
background: #f5f5f5;
line-height: 30px;
}
.formBg .taskMenu .ivu-menu-horizontal {
background: #f5f5f5;
}
.taskMenu {
display: inline-flex;
align-items: center;
}
.group {
margin-top: 15px;
}
.group .ivu-row {
border: none;
}
.time {
font-size: 14px;
font-weight: bold;
}
.content {
padding-left: 5px;
}
.boxBoder {
border: 2px solid #2db7f5;
border-radius: 5px;
padding: 10px 20px;
display: flex;
.ivu-timeline {
margin-left: 80px;
}
.TimelineItemli {
position: relative;
.timeSpan {
position: absolute;
left: -98px;
}
}
}
.dividerpram {
background-color: #2db7f5;
height: 2px;
}
</style>
<template>
<Form ref="form" :model="condition" :label-width="90">
<Row>
<Col :span="12" :v-if="condition.id.show"
><FormItem :label="$t('id')" prop="id">
<Input v-model="condition.id.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.creationTime.show"
><FormItem :label="l('creationTime')" prop="creationTime">
<DatePicker
type="daterange"
v-model="condition.creationTime.value"
></DatePicker> </FormItem
></Col>
<Col :span="12" :v-if="condition.creatorUserId.show"
><FormItem :label="l('creatorUserId')" prop="creatorUserId">
<Input v-model="condition.creatorUserId.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.lastModificationTime.show"
><FormItem
:label="l('lastModificationTime')"
prop="lastModificationTime"
>
<DatePicker
type="daterange"
v-model="condition.lastModificationTime.value"
></DatePicker> </FormItem
></Col>
<Col :span="12" :v-if="condition.lastModifierUserId.show"
><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId">
<Input v-model="condition.lastModifierUserId.value">
</Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.deletionTime.show"
><FormItem :label="l('deletionTime')" prop="deletionTime">
<DatePicker
type="daterange"
v-model="condition.deletionTime.value"
></DatePicker> </FormItem
></Col>
<Col :span="12" :v-if="condition.entity.show"
><FormItem :label="l('entity')" prop="entity">
<Input v-model="condition.entity.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.entityId.show"
><FormItem :label="l('entityId')" prop="entityId">
<Input v-model="condition.entityId.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.action.show"
><FormItem :label="l('action')" prop="action">
<Dictionary
code="mes.project_log.Action"
v-model="condition.action.value"
></Dictionary> </FormItem
></Col>
<Col :span="24" :v-if="condition.content.show"
><FormItem :label="l('content')" prop="content">
<Input v-model="condition.content.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.upId.show"
><FormItem :label="l('upId')" prop="upId">
<Input v-model="condition.upId.value"> </Input> </FormItem
></Col>
<Col :span="12" :v-if="condition.projectId.show"
><FormItem :label="l('projectId')" prop="projectId">
<Input v-model="condition.projectId.value"> </Input> </FormItem
></Col>
</Row>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
condition: {
id: { op: "Equal", value: null, show: true },
creationTime: { op: "Range", value: null, show: true },
creatorUserId: { op: "Equal", value: null, show: true },
lastModificationTime: { op: "Range", value: null, show: true },
lastModifierUserId: { op: "Equal", value: null, show: true },
deletionTime: { op: "Range", value: null, show: true },
entity: { op: "Equal", value: null, show: true },
entityId: { op: "Equal", value: null, show: true },
action: { op: "Equal", value: null, show: true },
content: { op: "Equal", value: null, show: true },
upId: { op: "Equal", value: null, show: true },
projectId: { op: "Equal", value: null, show: true },
},
};
},
methods: {
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "project_log" + "." + key;
return this.$t(key);
},
},
};
</script>
\ No newline at end of file
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
<span>|</span> <span>|</span>
</li> </li>
<li> <li>
<a @click="task"> <a @click="log">
<Icon type="md-create" />动态 <Icon type="md-create" />动态
</a> </a>
&nbsp; &nbsp;
...@@ -135,7 +135,12 @@ export default { ...@@ -135,7 +135,12 @@ export default {
}, },
group() { group() {
this.title = "项目成员"; this.title = "项目成员";
this.detail = () => import("../groupUser/index1"); this.detail = () => import("../groupUser/list");
},
log() {
this.curId = this.eid;
this.title = "动态";
this.detail = () => import("../log/list");
}, },
l(key) { l(key) {
key = "project_main" + "." + key; key = "project_main" + "." + key;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment