Commit 1aa01846 authored by 周远喜's avatar 周远喜

ok

parent c154d911
<template> <template>
<div class="table-content"> <div class="table-content">
<div class="table-tools" v-if="tool"> <div class="table-tools" v-if="tool">
<div class="table-search" > <div class="table-search">
<slot name="easySearch" v-if="easy"> <slot name="easySearch" v-if="easy">
<Form inline> <Form inline>
<FormItem> <FormItem>
...@@ -129,7 +129,7 @@ export default { ...@@ -129,7 +129,7 @@ export default {
search: { search: {
pageIndex: 1, pageIndex: 1,
pageSize: 20, pageSize: 20,
conditions: [] conditions: [],
}, },
pageSizeOpts: [20, 50, 100], pageSizeOpts: [20, 50, 100],
tableHeight: 0, tableHeight: 0,
...@@ -140,122 +140,122 @@ export default { ...@@ -140,122 +140,122 @@ export default {
configLoad: false, configLoad: false,
userConfig: null, //用户页面配置信息。, userConfig: null, //用户页面配置信息。,
// userId: 1 // userId: 1
userId: this.$store.state.userInfo.userId userId: this.$store.state.userInfo.userId,
}; };
}, },
props: { props: {
border: { border: {
//是否显示边框 //是否显示边框
type: Boolean, type: Boolean,
default: true default: true,
}, },
batch: { batch: {
//是否批量操作 //是否批量操作
type: Boolean, type: Boolean,
default: true default: true,
}, },
format: { format: {
type: Function, type: Function,
default: null default: null,
}, },
initsearch: { initsearch: {
type: Function, type: Function,
default: null default: null,
}, },
lazy: { lazy: {
//懒加载设置,设置为真时候,默认不加载数据。 //懒加载设置,设置为真时候,默认不加载数据。
type: Boolean, type: Boolean,
default: false default: false,
}, },
placeholder: { placeholder: {
type: String, type: String,
default: "请输入关键字" default: "请输入关键字",
}, },
height: { height: {
type: Number, type: Number,
default: 0 default: 0,
}, },
tool: { tool: {
//是否显示工具栏 //是否显示工具栏
type: Boolean, type: Boolean,
default: true default: true,
}, },
easy: { easy: {
//是否显示简单搜索 //是否显示简单搜索
type: Boolean, type: Boolean,
default: true default: true,
}, },
high: { high: {
//是否显示高级搜索 //是否显示高级搜索
type: Boolean, type: Boolean,
default: true default: true,
}, },
draggable: { draggable: {
//是否可以拖拽 //是否可以拖拽
type: Boolean, type: Boolean,
default: false default: false,
}, },
set: { set: {
//是否显示列设置 //是否显示列设置
type: Boolean, type: Boolean,
default: true default: true,
}, },
page: { page: {
//是否分页 //是否分页
type: Boolean, type: Boolean,
default: true default: true,
}, },
data: { data: {
// 当作table使用,直接显示数据 // 当作table使用,直接显示数据
type: Array, type: Array,
default: function() { default: function () {
return []; return [];
} },
}, },
columns: { columns: {
//要显示的字段 //要显示的字段
type: Array, type: Array,
default: [] default: [],
}, },
action: { action: {
//接口地址 //接口地址
type: String, type: String,
default: "" default: "",
}, },
conditions: { conditions: {
//查询条件 //查询条件
type: Object, type: Object,
default: function() { default: function () {
return { return {
keys: { op: "name", value: "", default: true } keys: { op: "name", value: "", default: true },
}; };
} },
}, },
type: { type: {
type: String, type: String,
default: "table", default: "table",
validator: function(value) { validator: function (value) {
// 这个值必须匹配下列字符串中的一个 // 这个值必须匹配下列字符串中的一个
return ["table", "card", "list"].indexOf(value) !== -1; return ["table", "card", "list"].indexOf(value) !== -1;
} },
}, },
span: { span: {
//栅格数 //栅格数
type: Number, type: Number,
default: 24 default: 24,
}, },
//table控件children子数据控制功能 //table控件children子数据控制功能
rowKey: { rowKey: {
type: [String, Number] type: [String, Number],
}, },
gutter: { gutter: {
//间距 //间距
type: Number, type: Number,
default: 40 default: 40,
} },
}, },
created() { created() {
this.columns.forEach(u => { this.columns.forEach((u) => {
if (!u.hide) { if (!u.hide) {
u.hide = false; u.hide = false;
} }
...@@ -272,23 +272,27 @@ export default { ...@@ -272,23 +272,27 @@ export default {
if (this.lazy == true) { if (this.lazy == true) {
return; return;
} }
if (this.userId > 0&& this.set) { if (this.userId > 0 && this.set) {
this.loadUserConfig(); this.loadUserConfig();
} else { } else {
this.easySearch(); this.easySearch();
} }
if (this.height === 0) { if (this.height === 0) {
this.$nextTick(() => { this.$nextTick(() => {
this.tableHeight = this.$refs.main.offsetHeight; this.tableHeight = this.$refs.main.offsetHeight;
if (this.tableHeight < 300) { if (this.tableHeight < 300) {
this.tableHeight = window.screen.availHeight -this.$refs.main.offsetTop-200; this.tableHeight =
window.screen.availHeight - this.$refs.main.offsetTop - 200;
} }
window.onresize = () => { window.onresize = () => {
///浏览器窗口大小变化 ///浏览器窗口大小变化
return (() => { return (() => {
this.tableHeight = this.$refs.main.offsetHeight; if (this.$refs.main && this.$refs.main.offsetHeight) {
if (this.tableHeight < 300) { this.tableHeight = this.$refs.main.offsetHeight;
this.tableHeight = window.screen.availHeight -this.$refs.main.offsetTop-150; if (this.tableHeight < 300) {
this.tableHeight =
window.screen.availHeight - this.$refs.main.offsetTop - 150;
}
} }
})(); })();
}; };
...@@ -297,7 +301,7 @@ export default { ...@@ -297,7 +301,7 @@ export default {
this.tableHeight = this.height; this.tableHeight = this.height;
} }
//注册拖拽事件。 //注册拖拽事件。
this.$dragging.$on("dragend", e => { this.$dragging.$on("dragend", (e) => {
this.saveUserconfig(); this.saveUserconfig();
}); });
}, },
...@@ -309,7 +313,7 @@ export default { ...@@ -309,7 +313,7 @@ export default {
if (this.initsearch) { if (this.initsearch) {
this.initsearch(this.search); this.initsearch(this.search);
} }
this.$api.post(this.action, this.search).then(r => { this.$api.post(this.action, this.search).then((r) => {
if (this.format) { if (this.format) {
this.list = this.format(r.result.items); this.list = this.format(r.result.items);
} else { } else {
...@@ -324,8 +328,8 @@ export default { ...@@ -324,8 +328,8 @@ export default {
var curColumns = []; var curColumns = [];
var config = JSON.parse(this.userConfig.content); var config = JSON.parse(this.userConfig.content);
if (config.length == this.columnsCur.length) { if (config.length == this.columnsCur.length) {
config.map(u => { config.map((u) => {
var item = this.columnsCur.filter(c => { var item = this.columnsCur.filter((c) => {
return c.key == u.key; return c.key == u.key;
}); });
if (item[0]) { if (item[0]) {
...@@ -343,22 +347,22 @@ export default { ...@@ -343,22 +347,22 @@ export default {
{ {
fieldName: "creatorUserId", fieldName: "creatorUserId",
fieldValue: this.userId, fieldValue: this.userId,
conditionalType: "Equal" conditionalType: "Equal",
}, },
{ {
fieldName: "component", fieldName: "component",
fieldValue: "Grid", fieldValue: "Grid",
conditionalType: "Equal" conditionalType: "Equal",
}, },
{ {
fieldName: "page", fieldName: "page",
fieldValue: window.location.pathname, fieldValue: window.location.pathname,
conditionalType: "Equal" conditionalType: "Equal",
} },
], ],
pageSize: 1 pageSize: 1,
}; };
this.$api.post(`${window.systemUrl}/config/list`, query).then(r => { this.$api.post(`${window.systemUrl}/config/list`, query).then((r) => {
if (r.success) { if (r.success) {
if (r.result.length == 1) { if (r.result.length == 1) {
this.userConfig = r.result[0]; this.userConfig = r.result[0];
...@@ -374,10 +378,10 @@ export default { ...@@ -374,10 +378,10 @@ export default {
saveUserconfig() { saveUserconfig() {
let url = `${window.systemUrl}/config/update`; let url = `${window.systemUrl}/config/update`;
var content = []; var content = [];
this.columnsCur.map(u => { this.columnsCur.map((u) => {
content.push({ content.push({
key: u.key, key: u.key,
hide: u.hide hide: u.hide,
}); });
}); });
if (!this.userConfig) { if (!this.userConfig) {
...@@ -386,9 +390,9 @@ export default { ...@@ -386,9 +390,9 @@ export default {
page: window.location.pathname, page: window.location.pathname,
component: "Grid", component: "Grid",
key: this.$u.guid(), key: this.$u.guid(),
content: JSON.stringify(content) content: JSON.stringify(content),
}; };
this.$api.post(url, data).then(r => { this.$api.post(url, data).then((r) => {
this.loadUserConfig(); this.loadUserConfig();
}); });
} else { } else {
...@@ -421,7 +425,7 @@ export default { ...@@ -421,7 +425,7 @@ export default {
this.saveUserconfig(); this.saveUserconfig();
}, },
complexSearch() { complexSearch() {
var search = this.$refs.search.$children.filter(u => { var search = this.$refs.search.$children.filter((u) => {
return u.condition; return u.condition;
}); });
if (search) { if (search) {
...@@ -432,13 +436,13 @@ export default { ...@@ -432,13 +436,13 @@ export default {
reload(conditions) { reload(conditions) {
var where = []; var where = [];
if (conditions) { if (conditions) {
Object.keys(conditions).forEach(u => { Object.keys(conditions).forEach((u) => {
let v = conditions[u].value; let v = conditions[u].value;
let op = conditions[u].op; let op = conditions[u].op;
if (!this.$u.isNull(v)) { if (!this.$u.isNull(v)) {
if (op == "Range" && Array.isArray(v)) { if (op == "Range" && Array.isArray(v)) {
let times = []; let times = [];
v.map(u => { v.map((u) => {
if (!this.$u.isNull(u)) { if (!this.$u.isNull(u)) {
times.push(this.$u.toTime(u)); times.push(this.$u.toTime(u));
} }
...@@ -451,7 +455,7 @@ export default { ...@@ -451,7 +455,7 @@ export default {
where.push({ where.push({
fieldName: u, fieldName: u,
fieldValue: v, fieldValue: v,
conditionalType: op conditionalType: op,
}); });
} }
} }
...@@ -496,11 +500,11 @@ export default { ...@@ -496,11 +500,11 @@ export default {
cancelBatch() { cancelBatch() {
this.footerToolbar = false; this.footerToolbar = false;
this.$refs.table.selectAll(false); this.$refs.table.selectAll(false);
} },
}, },
computed: { computed: {
columnsNow() { columnsNow() {
var cols = this.columnsCur.filter(u => { var cols = this.columnsCur.filter((u) => {
if (u.code) { if (u.code) {
u.render = (h, params) => { u.render = (h, params) => {
let values = u.key; let values = u.key;
...@@ -512,8 +516,8 @@ export default { ...@@ -512,8 +516,8 @@ export default {
props: { props: {
code: u.code, code: u.code,
type: type, type: type,
value: params.row[values] + "" value: params.row[values] + "",
} },
}); });
}; };
} }
...@@ -523,20 +527,20 @@ export default { ...@@ -523,20 +527,20 @@ export default {
if (params.row[values]) { if (params.row[values]) {
return h("User", { return h("User", {
props: { props: {
value: params.row[values] value: params.row[values],
} },
}); });
} }
}; };
} }
if (u.type == "workShopName") { if (u.type == "workShopName") {
u.render = (h, params) => { u.render = (h, params) => {
let values = u.key; let values = u.key;
if (params.row[values]) { if (params.row[values]) {
return h("WorkShopName", { return h("WorkShopName", {
props: { props: {
value: params.row[values] value: params.row[values],
} },
}); });
} }
}; };
...@@ -547,15 +551,15 @@ export default { ...@@ -547,15 +551,15 @@ export default {
return h("DTSpan", { return h("DTSpan", {
props: { props: {
type: u.type, type: u.type,
value: params.row[values] value: params.row[values],
} },
}); });
}; };
} }
return !u.hide; return !u.hide;
}); });
return cols; return cols;
} },
}, },
watch: { watch: {
"data.length"() { "data.length"() {
...@@ -565,14 +569,14 @@ export default { ...@@ -565,14 +569,14 @@ export default {
this.tableHeight = this.height; this.tableHeight = this.height;
}, },
"columns.length"() { "columns.length"() {
this.columns.forEach(u => { this.columns.forEach((u) => {
if (!u.hide) { if (!u.hide) {
u.hide = false; u.hide = false;
} }
}); });
this.columnsCur = this.$u.clone(this.columns); this.columnsCur = this.$u.clone(this.columns);
} },
} },
}; };
</script> </script>
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
<div v-if="items.length>0" class="fg list_box" v-for="(li,a) in items" :class="a%2 == 1?'dip_bg':''" :key="a"> <div v-if="items.length>0" class="fg list_box" v-for="(li,a) in items" :class="a%2 == 1?'dip_bg':''" :key="a">
<ul class="right_ul"> <ul class="right_ul">
<li class="right_ul_title"> <li class="right_ul_title">
<span class="case">方案一{{a}}</span> <span class="case">{{li.scheduleId}}</span>
<span class="case_time">2020-03-22 13:26:35</span> <span class="case_time">2020-03-22 13:26:35</span>
</li> </li>
<li>{{li.deferNum}}&nbsp;</li> <li>{{li.deferNum}}&nbsp;</li>
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
items(){ items(){
var items=[]; var items=[];
this.schemas.map(p=>{ this.schemas.map(p=>{
var info=this.list.filter(u=>u.schedule_Id==p.scheduleId)[0]; var info=this.list.filter(u=>u.scheduleId==p.schedule_Id)[0];
items.push(info); items.push(info);
}) })
return items; return items;
......
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