Commit 14364681 authored by renjintao's avatar renjintao

Merge branch 'product' of git.mes123.com:zhouyx/mes-ui into product-rjt

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