Commit a74751f2 authored by renjintao's avatar renjintao

groupUser

parent d2663a62
......@@ -39,7 +39,7 @@
</div>
</div>
<Select v-else :placeholder="placeholder" v-model="name" @on-change="change" :multiple="multiple" :departmentId="departmentId" clearable filterable>
<Select v-else :placeholder="placeholder" v-model="name" @on-change="change" :multiple="multiple" :departmentId="departmentId" clearable filterable transfer>
<Option v-for="item in datas ? datas : dic" :value="item.value" :key="item.value" :label="item.label">
<div>
{{ item.label }}
......
......@@ -1911,5 +1911,8 @@ export default {
status: '状态',
groupName: '项目组名称',
groupId: '项目组Id',
authority:'权限',
wHour:'可用工日',
wHourPD:'可用工时/天'
}
}
......@@ -97,7 +97,7 @@ export default {
this.entity = this.$u.clone(this.v)
},
eid(v) {
if (v != '') {
if (v != '' && v != null) {
this.load(v);
}
}
......
<template>
<div class="full">
<div>
<DataGrid :columns="columns" ref="grid" :action="action"><template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"><Input placeholder="请输入关键字名称" v-model="easySearch.keys.value" /> </FormItem>
......
......@@ -8,30 +8,16 @@
</Col>
<Col :span="12">
<FormItem :label="l('role')" prop="role">
<Dictionary code="mes.project_group_user.Role" v-model="entity.role"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('projectId')" prop="projectId">
<InputNumber v-model="entity.projectId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('planId')" prop="planId">
<InputNumber v-model="entity.planId"></InputNumber>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('note')" prop="note"> <Input v-model="entity.note"> </Input>
<Dictionary code="project.group.role" v-model="entity.role"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('status')" prop="status">
<Dictionary code="mes.project_group_user.Status" v-model="entity.status"></Dictionary>
<Dictionary code="project.group.status" v-model="entity.status"></Dictionary>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('groupName')" prop="groupName"> <Input v-model="entity.groupName"> </Input>
<FormItem :label="l('note')" prop="note"> <Input v-model="entity.note"> </Input>
</FormItem>
</Col>
<Col :span="12">
......@@ -130,7 +116,7 @@ export default {
this.entity = this.$u.clone(this.v)
},
eid(v) {
if (v > 0) {
if (v != '' && v != null) {
this.load(v);
}
}
......
......@@ -3,7 +3,7 @@
<Row>
<Col :span="12">
<FormItem :label="l('userId')" prop="userId">
<InputNumber v-model="entity.userId"></InputNumber>
<UserSelect ref="userSelected" v-model="entity.userId" />
</FormItem>
</Col>
<Col :span="12">
......@@ -12,14 +12,14 @@
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('note')" prop="note"> <Input v-model="entity.note"> </Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem :label="l('status')" prop="status">
<Dictionary code="project.group.status" v-model="entity.status"></Dictionary>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('note')" prop="note"> <Input v-model="entity.note"> </Input>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
......@@ -41,7 +41,19 @@ export default {
required: true,
message: '必填',
trigger: 'blur'
}]
}],
userId: [{
required: true,
message: "请选择人员",
trigger: "change",
type: "number"
}],
role: [{
required: true,
message: "请选择角色",
trigger: "change",
type: "number"
}],
}
}
},
......
......@@ -2,12 +2,46 @@
<div>
<Table border :columns="columns" :data="list" ref="table" class="tableCommon" stripe>
<template slot-scope="{ row, index }" slot="userId">
<span v-if="edit != index" v-text="row.userId"></span>
<Input v-else type="text" v-model.trim="cur.userId" />
<User v-if="edit != index" :value="row.userId"></User>
<UserSelect v-else ref="userSelected" v-model="cur.userId" />
</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" />
</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">新增人员</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>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal>
......@@ -31,70 +65,75 @@ export default {
detail: null,
curId: '',
edit: -1,
authorityCount: 0, //列表中权限里是否存在项目经理(列表中唯一)
authorityCur: 0, //当前行的权限 值
cur: {
id: '',
userId: null,
role: null,
status: null,
wHour: 14,
wHourPD: 7.0,
authority: null,
note: ''
},
columns: [{
type: "index",
title: '编号',
align: "right",
width: 80
}, {
key: "userId",
title: this.l("userId"),
align: "left",
high: true,
type: 'user',
slot: 'userId'
},
{
key: "role",
title: this.l("role"),
align: "left",
high: true,
code: 'project.group.role'
align: "center",
slot: 'role'
},
{
key: "status",
title: this.l("status"),
align: "left",
high: true,
code: 'project.group.status'
align: "center",
slot: 'status'
},
{
key: "wHour",
title: this.l("wHour"),
align: "center",
slot: 'wHour'
},
{
key: "wHourPD",
title: this.l("wHourPD"),
align: "right",
slot: 'wHourPD'
},
{
key: "authority",
title: this.l("authority"),
align: "center",
slot: 'authority'
},
{
key: "note",
title: this.l("note"),
align: "left",
high: true
high: true,
slot: 'note'
},
{
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)
}
}, '删除')
])
}
slot: 'action',
},
],
list: []
......@@ -115,6 +154,22 @@ export default {
await store.dispatch('loadDictionary') // 加载数据字典
},
methods: {
changeAuthority(val) {
if (this.authorityCur != 1 && this.authorityCount == 1 && val == 1) {
this.$Message.error("已存在项目经理,请选择其他权限!")
this.cur.authority = null
}
},
getAuthority() {
if (this.list.length > 0) {
this.list.forEach(el => {
if (el.authority == 1) {
this.authorityCount = 1
}
})
}
},
load(v) {
let params = {
conditions: [{
......@@ -126,6 +181,7 @@ export default {
Api.list(params).then(r => {
if (r.success) {
this.list = r.result
this.getAuthority()
}
})
},
......@@ -135,7 +191,8 @@ export default {
this.curId = '';
},
add() {
this.curId = 0;
alert(this.eid)
this.curId = '';
this.title = "新增";
this.detail = () => import('./add')
this.modal = true;
......@@ -144,7 +201,14 @@ export default {
this.edit = this.list.length;
this.cur = {
userId: null,
role: null,
status: null,
wHour: 14,
wHourPD: 7.0,
authority: null,
note: ''
};
this.authorityCur = 0
this.list.push(this.cur);
},
copy(id) {
......@@ -159,20 +223,91 @@ export default {
this.detail = () => import('./detail')
this.modal = true;
},
edit(id) {
editRow1(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import('./edit')
this.modal = true;
},
remove(id) {
editRow(row, index) {
let lastListGroupId = this.list[this.list.length - 1].groupId
if (lastListGroupId == undefined) {
this.list.pop();
}
this.cur.id = row.id
this.cur.userId = row.userId
this.cur.role = row.role
this.cur.status = row.status
this.cur.authority = row.authority
this.cur.wHour = row.wHour
this.cur.wHourPD = row.wHourPD
this.cur.note = row.note
this.authorityCur = row.authority
this.edit = index
},
delRow(id) {
Api.delete(id).then((r) => {
if (r.success) {
this.load(this.eid)
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 == null || this.cur.userId == '') {
this.$Message.error("请选择人员");
return;
}
if (this.cur.role == null || this.cur.role == '') {
this.$Message.error("请选择人员角色");
return;
}
if (this.cur.authority == null || this.cur.authority == '') {
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(this.eid)
} else {
this.$Message.error('修改失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('修改失败')
console.warn(err)
})
} else { //人员新增
Api.create(this.cur).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success('保存成功')
this.edit = -1
this.load(this.eid)
} else {
this.$Message.error('保存失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('保存失败')
console.warn(err)
})
}
},
cancel() {
this.curId = this.eid;
this.modal = false
......
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