Commit dce5d909 authored by 周远喜's avatar 周远喜

ok

parent b950e4af
<template>
<div class="table-content myBug flex fd">
<div class="table-tools" v-if="tool" ref="tools">
<div class="table-content">
<div class="table-tools" v-if="tool">
<div class="table-search" v-if="easy">
<slot name="easySearch">
<Input
......@@ -11,30 +11,28 @@
v-model="keys"
/>
</slot>
<Button v-if="high" @click="modalSearch=true" type="text">
<Icon type="md-search" />高级
</Button>
</div>
<Button v-if="high" @click="modalSearch=true" type="text">
<Icon type="md-search" />高级
</Button>
<div class="searchBack">
<slot name="searchBack"></slot>
</div>
<div class="btns">
<slot name="buttons"></slot>
<Button v-if="set&&type=='table'" @click="config=!config">
<Icon type="md-build" class="table-set" size="14" title="列设置" />
<Icon type="md-build" title="列设置" />
</Button>
</div>
</div>
<div class="fg" ref="ftable">
<div v-if="type=='card'" class="table-card">
<Row :gutter="gutter">
<Col :span="span" v-for="(row,i) in list" :key="i">
<slot name="card" :row="row">
<span>{{row.id}}</span>
</slot>
</Col>
</Row>
</div>
<div class="table-main" ref="main">
<Row v-if="type=='card'">
<Col :span="span" v-for="(row,i) in list" :key="i">
<slot name="card" :row="row">
<span>{{row.id}}</span>
</slot>
</Col>
</Row>
<Table
v-else
:border="border"
......@@ -42,35 +40,30 @@
:data="list"
:height="tableHeight"
:draggable="draggable"
:size="size"
:row-key="rowKey"
ref="table"
class="tableCommon fg"
class="tableCommon"
@on-expand="expand"
@on-drag-drop="onDragDrop"
@on-selection-change="selectionChange"
@on-select="onSelect"
:loading="loading"
></Table>
<div class="table-footer" ref="footer">
<div>
<slot name="footer"></slot>
</div>&nbsp;
<Page
v-if="page"
:total="search.total"
:current="search.page"
class="mr15 mt15 fr"
show-total
size="small"
show-elevator
show-sizer
:page-size="search.pageSize"
:page-size-opts="pageSizeOpts"
@on-change="pageChange"
@on-page-size-change="pageSizeChange"
/>
</div>
</div>
<div class="table-footer">
<slot name="footer"></slot>
<Page
v-if="page"
:total="search.total"
:current="search.page"
class="fr"
show-total
size="small"
show-elevator
show-sizer
:page-size="search.pageSize"
:page-size-opts="pageSizeOpts"
@on-change="pageChange"
@on-page-size-change="pageSizeChange"
/>
</div>
<Modal v-if="high" v-model="modalSearch" title="高级搜索" draggable width="800" ref="search">
<slot name="searchForm"></slot>
......@@ -107,13 +100,10 @@
</li>
</ul>
</Drawer>
<FooterToolbar style="height:60px" v-if="batch" v-show="footerToolbar">
<div class="tip">
已选{{selectItems.length}}
<slot name="batch"></slot>
</div>
<Button @click="cancelFooterToolbar" class="btn">取消</Button>
<FooterToolbar v-if="batch" v-show="footerToolbar">
<div class="tip">已选{{selectItems.length}}</div>
<slot name="batch"></slot>
<Button @click="footerToolbar=false">取消</Button>
</FooterToolbar>
</div>
</template>
......@@ -141,8 +131,7 @@ export default {
configLoad: false,
userConfig: null, //用户页面配置信息。,
// userId: 1
userId: this.$store.state.userInfo.userId,
loading: false
userId: this.$store.state.userInfo.userId
};
},
props: {
......@@ -165,10 +154,6 @@ export default {
type: String,
default: "请输入关键字"
},
size: {
type: String,
default: "default"
},
height: {
type: Number,
default: 0
......@@ -237,17 +222,9 @@ export default {
return ["table", "card", "list"].indexOf(value) !== -1;
}
},
gutter:{
type:Number,
default:0
},
span: {
type: Number,
default: 24
},
//table控件children子数据控制功能
rowKey: {
type: [String, Number]
}
},
created() {
......@@ -261,28 +238,29 @@ export default {
mounted() {
if (this.data && this.data.length > 0) {
this.list = this.data;
//return;
return;
}
this.keys = "";
this.intY();
if (this.lazy == true) {
return;
}
this.loadUserConfig();
if (this.userId > 0) {
this.loadUserConfig();
} else {
this.easySearch();
}
if (this.height === 0) {
this.tableHeight = this.$refs.main.offsetHeight;
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
// console.log(this.$refs.table)
window.screenHeight = window.innerHeight;
this.tableHeight = window.screenHeight - this.firstY - 60;
this.tableHeight = this.$refs.main.offsetHeight;
})();
};
} else {
this.tableHeight = this.height;
}
//注册拖拽事件。
this.$dragging.$on("dragend", e => {
// console.log("dragend",e);
......@@ -296,20 +274,10 @@ export default {
this.tableHeight = window.innerHeight - this.firstY - 60;
}
if (this.action) {
this.loading = true;
this.$api
.post(this.action, this.search)
.then(r => {
this.list = r.result.items;
this.search.total = r.result.totalCount;
this.loading = false;
})
.catch(
function(err) {
this.loading = false;
this.$Message.error("加载失败");
}.bind(this)
);
this.$api.post(this.action, this.search).then(r => {
this.list = r.result.items;
this.search.total = r.result.totalCount || r.result.count;
});
}
},
columnInit() {
......@@ -401,11 +369,7 @@ export default {
this.$emit("on-drag-drop", a, b);
},
easySearch() {
if (
this.conditions &&
this.conditions.keys &&
this.conditions.keys.default
) {
if (this.conditions && this.conditions.keys.default) {
//判断没有传入条件的用默认的查询
this.conditions.keys.value = this.keys;
}
......@@ -487,10 +451,6 @@ export default {
},
selectAll(status) {
this.$refs.table.selectAll(status);
},
cancelFooterToolbar() {
this.$refs.table.selectAll(false);
this.footerToolbar = false;
}
},
computed: {
......@@ -533,16 +493,6 @@ export default {
});
};
}
if (u.type == "outputTime") {
u.render = (h, params) => {
let values = u.key;
return h("OutputTime", {
props: {
value: params.row[values]
}
});
};
}
return !u.hide;
});
return cols;
......@@ -559,69 +509,51 @@ export default {
};
</script>
<style lang="less" scoped>
<style lang="less">
.table-content {
position: relative;
height: 100%;
.table-tools {
padding-top: 5px;
height: 50px;
overflow: hidden;
.table-search {
float: left;
line-height: 50px;
.ivu-form-item {
margin-bottom: 0;
}
}
.btns {
float: right;
text-align: right;
height: 40px;
}
}
.tableCommon {
width: 100%;
}
display: flex;
flex-direction: column;
.tip {
display: inline;
}
.tableCommon tr th {
line-height: 30px;
font-size: 14px;
background: #f5f6fa;
}
.fg {
overflow: auto;
.table-card{
overflow: hidden;
form {
display: inline-block;
.ivu-form-item {
margin: 0;
vertical-align: middle;
}
}
.tableCommon tr td {
line-height: 25px;
font-size: 14px;
padding: 0 2px;
}
.tableCommon tr td .ivu-table-cell {
padding: 0 5px;
}
.table-card {
.table-main {
width: 100%;
text-align: left;
padding: 0;
display: block;
overflow-y: auto;
flex-grow: 1;
tr td .ivu-table-cell {
padding: 0 5px;
}
}
.table-set {
cursor: pointer;
}
.table-set:hover {
color: orange;
.table-tools {
display: flex;
line-height: 50px;
.table-search {
flex-grow: 1;
}
.btns {
min-width: 200px;
text-align: right;
}
}
.table-footer {
height: 40px;
line-height: 45px;
}
.ivu-footer-toolbar {
text-align: left;
background: rgba(0, 0, 0, 0.7);
color: #fff;
}
}
.table-columns {
......
......@@ -13,15 +13,15 @@
:height="gridHeight"
>
<template slot="easySearch">
<Row style="line-height:32px;">
<Col span="7">
<Form inline >
<FormItem>
<dictionary
code="Test.bug.status"
v-model="easySearch.status.value"
style="width:80px;"
></dictionary>
</Col>
<Col span="17">
</FormItem>
<FormItem>
<Input
search
enter-button
......@@ -29,70 +29,41 @@
@on-search="search"
v-model="easySearch.keys.value"
/>
</Col>
</Row>
</FormItem>
</Form>
</template>
<template slot="searchForm">
<Search />
</template>
<template slot="batch">
<Form :model="formMyCheck" :label-width="5" :rules="ruleValidate" inline ref="formValidate">
<FormItem>
<dictionary
code="Test.but.statusOper"
v-model="selectBatch"
type="radio"
@on-change="statuChange"
ref="dicradio"
></dictionary>
</FormItem>
<FormItem v-if="selectBatch == 5" label prop="selectAlloter">
<UserSelect ref="userSelected" v-model="alloter" @on-change="changeUserSelect" />
</FormItem>
<FormItem>
<Button type="primary" @click="upChange">确定</Button>
</FormItem>
</Form>
</template>
</DataGrid>
<FooterToolbar extra v-if="footerBar" style="height:65px">
<Row>
<dictionary
code="Test.but.statusOper"
v-model="selectBatch"
type="radio"
@on-change="statuChange"
ref="dicradio"
style="float:left"
></dictionary
>&nbsp;&nbsp;&nbsp;&nbsp;
<span style="float:left;color:yellow" v-if="selectBatch == 5"
>指派给:</span
>
<div
style="float:left;width:240px;padding:10px;"
v-if="selectBatch == 5"
>
<Form
:model="formMyCheck"
:label-width="5"
:rules="ruleValidate"
inline
ref="formValidate"
>
<FormItem label="" prop="selectAlloter">
<UserSelect
ref="userSelected"
v-model="alloter"
@on-change="changeUserSelect"
/>
</FormItem>
</Form>
</div>
<Button type="primary" @click="upChange">确定</Button
>&nbsp;&nbsp;&nbsp;&nbsp;
<Button @click="canselFooter">取消</Button>
</Row>
</FooterToolbar>
<Modal
v-model="modalEdit"
fullscreen
title="bug编辑"
@on-cancel="canselModal(1)"
>
<Modal v-model="modalEdit" fullscreen title="bug编辑" @on-cancel="canselModal(1)">
<edit ref="edit" />
<div slot="footer">
<Button @click="canselModal(1)">取消</Button>
<Button type="primary" @click="addSave">确定</Button>
</div>
</Modal>
<Modal
v-model="modalDetail"
fullscreen
title="bug操作"
@on-cancel="canselModal(2)"
>
<Modal v-model="modalDetail" fullscreen title="bug操作" @on-cancel="canselModal(2)">
<detail ref="detail" />
<div slot="footer">
<Button @click="canselModal(2)">取消</Button>
......@@ -109,26 +80,26 @@
</div>
</template>
<script>
import Api from '@/libs/bug'
import edit from './component/add'
import detail from './component/detail'
import Search from './component/search'
import Api from "@/libs/bug";
import edit from "./component/add";
import detail from "./component/detail";
import Search from "./component/search";
export default {
name: 'bug',
name: "bug",
components: {
edit,
detail,
Search
},
data() {
let userInfo=this.$store.state.admin.user.info;
let userInfo = this.$store.state.admin.user.info;
return {
action: Api.index,
easySearch: {
keys: { op: 'title,pagePath', value: '' },
status: { op: 'Equal', value: null },
keys: { op: "title,pagePath", value: "" },
status: { op: "Equal", value: null },
creatorUserId: {
op: 'Equal',
op: "Equal",
value: userInfo.userId
}
},
......@@ -136,40 +107,40 @@ export default {
results: [],
footerBar: false,
modalInfo: false,
gridHeight: '',
gridHeight: "",
totals: 10,
pageSizeOpts: [20, 50, 100],
pageSize: 20,
tabIndex: 1,
columns: [
{
type: 'selection',
type: "selection",
width: 60,
align: 'center'
align: "center"
},
{
key: 'id',
key: "id",
width: 80,
title: this.l('id')
title: this.l("id")
},
{
title: this.l('level'),
key: 'level',
title: this.l("level"),
key: "level",
width: 100
},
{
title: this.l('title'),
key: 'title',
title: this.l("title"),
key: "title",
width: 240,
tooltip: true,
render: (h, params) =>
h(
'a',
"a",
{
style: {},
on: {
click: () => {
this.detailInfo(params.row)
this.detailInfo(params.row);
}
}
},
......@@ -177,17 +148,17 @@ export default {
)
},
{
title: this.l('pagePath'),
key: 'pagePath',
title: this.l("pagePath"),
key: "pagePath",
tooltip: true,
render: (h, params) =>
h(
'a',
"a",
{
style: {},
on: {
click: () => {
window.open(params.row.pagePath, '_blank')
window.open(params.row.pagePath, "_blank");
}
}
},
......@@ -195,98 +166,99 @@ export default {
)
},
{
title: this.l('status'),
key: 'status',
title: this.l("status"),
key: "status",
width: 100,
render: (h, params) => {
return h('state', {
return h("state", {
props: {
code: 'Test.bug.status',
type: 'text',
value: params.row.status + ''
code: "Test.bug.status",
type: "text",
value: params.row.status + ""
}
})
});
}
},
{
title: this.l('creationTime'),
key: 'creationTime',
align: 'center',
title: this.l("creationTime"),
key: "creationTime",
align: "center",
width: 180
},
{
title: this.l('createor'),
key: 'createor',
title: this.l("createor"),
key: "createor",
width: 120
},
{
title: this.l('alloter'),
key: 'alloter',
title: this.l("alloter"),
key: "alloter",
width: 120
},
{
title: this.l('lastModificationTime'),
key: 'lastModificationTime',
align: 'center',
title: this.l("lastModificationTime"),
key: "lastModificationTime",
align: "center",
width: 180
},
{
title: this.l('auditUser'),
align: 'center',
key: 'auditUser',
title: this.l("auditUser"),
align: "center",
key: "auditUser",
width: 120
},
{
title: '操作',
align: 'center',
key:"action",
title: "操作",
align: "center",
width: 180,
render: (h, params) =>
h('div', [
h("div", [
h(
'Button',
"Button",
{
props: {
type: 'text',
size: 'small'
type: "text",
size: "small"
},
style: {
color: 'green'
color: "green"
},
on: {
click: () => {
this.detailInfo(params.row)
this.detailInfo(params.row);
}
}
},
'解决'
"解决"
),
h(
'Button',
"Button",
{
props: {
type: 'text',
size: 'small'
type: "text",
size: "small"
},
style: {
color: 'green'
color: "green"
},
on: {
click: () => {
this.editInfo(params.row)
this.editInfo(params.row);
}
}
},
'编辑'
"编辑"
)
])
}
],
statusList: [
{ name: '确认', value: '1' },
{ name: '解决', value: '2' },
{ name: '冻结', value: '4' },
{ name: '关闭', value: '3' }
{ name: "确认", value: "1" },
{ name: "解决", value: "2" },
{ name: "冻结", value: "4" },
{ name: "关闭", value: "3" }
],
modalEdit: false,
modalDetail: false,
......@@ -298,11 +270,11 @@ export default {
listBatch: {
ids: [],
statusNew: 0,
auditUser: '',
auditUser: "",
workHours: 0,
remark: '',
alloter: '',
alloterId:null
remark: "",
alloter: "",
alloterId: null
},
selectBatch: 100,
auditUser: null,
......@@ -314,215 +286,215 @@ export default {
selectAlloter: [
{
required: true,
message: '请选择驳指派人',
type: 'number',
trigger: 'change'
message: "请选择驳指派人",
type: "number",
trigger: "change"
}
]
}
}
};
},
computed: {},
async fetch({ store, params }) {
await store.dispatch('loadDictionary') // 加载数据字典
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
//选项卡切换
tab(data) {
if (data == '0') {
this.easySearch.creatorUserId.value = this.$store.state.userInfo.userId
if (data == "0") {
this.easySearch.creatorUserId.value = this.$store.state.userInfo.userId;
} else {
this.easySearch.creatorUserId.value = null
this.easySearch.creatorUserId.value = null;
}
this.search()
this.search();
},
search() {
this.$refs.grid.easySearch(this.easySearch)
this.$refs.grid.easySearch(this.easySearch);
},
//打开修改窗口
editInfo(value) {
this.modalEdit = true
this.$refs.edit.editeInfo(value)
this.modalEdit = true;
this.$refs.edit.editeInfo(value);
},
//修改事件
addSave() {
let param = this.$refs.edit.addBugInfo()
param.auditUser = this.$store.state.userInfo.userName
let param = this.$refs.edit.addBugInfo();
param.auditUser = this.$store.state.userInfo.userName;
if (param.id != null) {
//增加确定
this.$http.bug.createorupdate(param).then((res) => {
this.$http.bug.createorupdate(param).then(res => {
if (res.result.status) {
this.$Message.success('修改成功!')
this.search()
this.$Message.success("修改成功!");
this.search();
} else {
this.$Message.error('修改失败!')
this.$Message.error("修改失败!");
}
this.modalEdit = false
})
this.modalEdit = false;
});
} else {
this.$Message.error('修改失败!')
this.$Message.error("修改失败!");
}
},
//打开确定/操作窗口
detailInfo(value) {
this.modalDetail = true
this.$refs.detail.detailInfo(value)
this.modalDetail = true;
this.$refs.detail.detailInfo(value);
},
//确定/关闭操作
detailSave() {
let param = this.$refs.detail.addBugInfo()
param.auditUser = this.$store.state.userInfo.userName
param.ids = [param.id]
let param = this.$refs.detail.addBugInfo();
param.auditUser = this.$store.state.userInfo.userName;
param.ids = [param.id];
if (param.id != null) {
//增加确定
this.$http.bug.doaction(param).then((res) => {
this.$http.bug.doaction(param).then(res => {
if (res.result) {
this.$Message.success('操作成功!')
this.search()
this.$Message.success("操作成功!");
this.search();
} else {
this.$Message.error('操作失败!')
this.$Message.error("操作失败!");
}
this.modalDetail = false
})
this.modalDetail = false;
});
} else {
this.$Message.error('操作失败!')
this.$Message.error("操作失败!");
}
},
//取消窗口,查看状态
canselModal(type) {
let param
let param;
if (type == 1) {
param = this.$refs.edit.addBugInfo()
param = this.$refs.edit.addBugInfo();
} else {
param = this.$refs.detail.addBugInfo()
param = this.$refs.detail.addBugInfo();
}
param.auditUser = this.$store.state.userInfo.userName
param.ids = [param.id]
param.statusNew = 6
param.auditUser = this.$store.state.userInfo.userName;
param.ids = [param.id];
param.statusNew = 6;
if (param.id != null) {
//增加改变状态为6/查看
this.$http.bug.doaction(param).then((res) => {
this.$http.bug.doaction(param).then(res => {
if (res.result) {
//this.search(this.searchForm)
} else {
this.$Message.error('操作失败!')
this.$Message.error("操作失败!");
}
})
});
} else {
this.$Message.error('操作失败!')
this.$Message.error("操作失败!");
}
this.modalDetail = false
this.modalEdit = false
this.modalDetail = false;
this.modalEdit = false;
},
selectInfo(value) {
this.selectList = []
this.selectList = value
let statueArry = []
value.forEach((data) => {
var that = this
statueArry.push(data.id)
})
this.results = []
this.results = statueArry
this.getListId(statueArry)
this.selectList = [];
this.selectList = value;
let statueArry = [];
value.forEach(data => {
var that = this;
statueArry.push(data.id);
});
this.results = [];
this.results = statueArry;
this.getListId(statueArry);
},
//得到需要批量操作的ids
getListId(value) {
this.listBatch.ids = value
this.listBatch.ids = value;
if (this.listBatch.ids.length > 0) {
this.footerBar = true
this.footerBar = true;
//this.showBt = false
this.selectBatch = 100
this.selectBatch = 100;
} else {
this.footerBar = false
this.footerBar = false;
//this.showBt = false
this.selectBatch = 100
this.selectBatch = 100;
}
this.listBatch.auditUser = this.$store.state.userInfo.userName
this.listBatch.auditUser = this.$store.state.userInfo.userName;
},
//批量操作
statuChange(value) {
this.listBatch.statusNew = value
this.listBatch.statusNew = value;
},
upChange() {
if (this.selectBatch != 100) {
if (this.listBatch.ids.length != 0) {
if (this.selectBatch == 5) {
this.$refs['formValidate'].validate((valid) => {
this.$refs["formValidate"].validate(valid => {
if (valid) {
let alloterInfo = this.$refs['userSelected'].getSelectItems()
this.listBatch.alloter = alloterInfo[0].userName
this.listBatch.alloterId=alloterInfo[0].id
this.modalInfo = true
let alloterInfo = this.$refs["userSelected"].getSelectItems();
this.listBatch.alloter = alloterInfo[0].userName;
this.listBatch.alloterId = alloterInfo[0].id;
this.modalInfo = true;
}
})
});
} else {
this.modalInfo = true
this.modalInfo = true;
}
} else {
this.$Message.error('请选择操作列表!')
this.selectBatch = 100
this.$Message.error("请选择操作列表!");
this.selectBatch = 100;
}
} else {
this.$Message.error('请选择操作!')
this.$Message.error("请选择操作!");
}
},
changeUserSelect(val) {
if (val != undefined&&val.length !=''&&val.length != 0) {
this.formMyCheck.selectAlloter = 1
if (val != undefined && val.length != "" && val.length != 0) {
this.formMyCheck.selectAlloter = 1;
} else {
this.formMyCheck.selectAlloter = null
this.listBatch.alloter = ''
this.listBatch.alloterId=null
this.formMyCheck.selectAlloter = null;
this.listBatch.alloter = "";
this.listBatch.alloterId = null;
}
},
upSave() {
//增加确定
this.$http.bug.doaction(this.listBatch).then((res) => {
this.$http.bug.doaction(this.listBatch).then(res => {
if (res.result) {
this.$Message.success('操作成功!')
this.search()
this.footerBar = false
this.showBt = false
this.modalInfo = false
this.selectBatch = 100
this.$Message.success("操作成功!");
this.search();
this.footerBar = false;
this.showBt = false;
this.modalInfo = false;
this.selectBatch = 100;
} else {
this.$Message.error('操作失败!')
this.$Message.error("操作失败!");
}
})
});
},
arry2Name(arryList, values) {
//预警类别转换
var codes = arryList
var name = ''
var codes = arryList;
var name = "";
for (let i in codes) {
if (values == codes[i].value) {
name = codes[i].name
name = codes[i].name;
}
}
return name
return name;
},
canselFooter() {
this.footerBar = false
this.selectBatch = 100
this.footerBar = false;
this.selectBatch = 100;
},
l(key) {
let vkey = 'bug' + '.' + key
return this.$t(vkey) || key
let vkey = "bug" + "." + key;
return this.$t(vkey) || key;
}
},
created() {
window.screenHeight = window.innerHeight
this.gridHeight = window.screenHeight - 250
window.screenHeight = window.innerHeight;
this.gridHeight = window.screenHeight - 250;
},
mounted() {
// this.search(this.searchForm)
window.onresize = () => {
return (() => {
window.screenHeight = window.innerHeight
this.gridHeight = window.screenHeight - 250
})()
}
window.screenHeight = window.innerHeight;
this.gridHeight = window.screenHeight - 250;
})();
};
}
}
};
</script>
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