Commit 22a1e71a authored by renjintao's avatar renjintao

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

parents 1fe4d028 30622fe2
......@@ -21,9 +21,7 @@ ul,
li {
list-style: none;
}
.ivu-drawer-wrap{
z-index: 12000;
}
div::-webkit-scrollbar {
width: 10px;
height: 10px;
......
......@@ -23,6 +23,9 @@
background-color: @primary-color;
border-color: @primary-color;
}
.ivu-drawer-wrap,.tree-drawer{
z-index: 12000;
}
.ivu-btn-group:not(.ivu-btn-group-vertical) .ivu-btn-primary:first-child:not(:last-child) {
border-right-color: @primary-color;
......
......@@ -17,7 +17,7 @@
<thead>
<tr>
<th
v-for="(column, index) in columns"
v-for="(column, index) in columnNow"
:key="index"
:style="tdStyle(column)"
>
......@@ -62,7 +62,7 @@
>
<!-- -->
<td
v-for="(column, snum) in columns"
v-for="(column, snum) in columnNow"
:key="column.key"
:style="tdStyle(column)"
>
......@@ -75,7 +75,6 @@
v-model="item._checked"
:indeterminate="item._indeterminate"
></Checkbox>
{{ item._checked }}
</label>
<Icon
......@@ -148,7 +147,6 @@
</table>
</div>
</div>
<div class="table-footer">
<slot name="footer"></slot>
<Page
......@@ -190,9 +188,9 @@
>
<div slot="header">
列设置
<a @click="undoConfig" class="ml50">
<!-- <a @click="undoConfig" class="ml50">
<Icon type="md-refresh" title="恢复初始设置" />
</a>
</a> -->
</div>
<ul class="table-columns">
<li
......@@ -396,11 +394,12 @@ export default {
columnsCur: [], // 处理后的表头数据
checkGroup: [], // 复选框数组
checks: false, // 全选
tdsWidth: 0, // td总宽
timer: false, // 控制监听时长
dataLength: 0, // 树形数据长度
dragIndex: -1, //拖拽开始的序号
allUser: [], //所有user
userConfig: null,
userId: this.$store.state.userInfo.userId,
};
},
computed: {
......@@ -410,6 +409,14 @@ export default {
}).length;
return 0 < checkeds && checkeds < this.trs.length;
},
columnNow() {
// return this.columnsCur;
var now=this.columnsCur.filter((u) => {
return !u.hide||u.hide==false;
});
console.log("cols",now,this.columnsCur,this.columns)
return now;
},
},
watch: {
items() {
......@@ -428,11 +435,12 @@ export default {
this.exportTitle = v;
},
},
created(){
this.columnsCur = this.makeColumns();
},
mounted() {
this.getAllUser(); //获取所有用户
if (this.items && this.items.length > 0) {
this.trs = this.treeToList(this.items);
this.columnsCur = this.makeColumns();
}
},
methods: {
......@@ -498,8 +506,8 @@ export default {
// 有无多选框折叠位置优化
treeColumn() {
var num = 0;
for (let i = 0, len = this.columns.length; i < len; i++) {
if (this.columns[i].tree) {
for (let i = 0, len = this.columnNow.length; i < len; i++) {
if (this.columnNow[i].tree) {
num = i;
}
}
......@@ -542,13 +550,6 @@ export default {
// 处理表头数据
makeColumns() {
const columns = this.$u.clone(this.columns);
this.tdsWidth = 0;
columns.forEach((column, index) => {
column._index = index;
column._width = column.width ? column.width : "";
column._sortType = "normal";
this.tdsWidth += column.width ? parseFloat(column.width) : 0;
});
return columns;
},
// // 隐藏显示
......@@ -588,35 +589,13 @@ export default {
}
return parents;
},
open(index, item) {
if (item.children) {
item.children.forEach((child, childIndex) => {
child.isShow = true;
if (child.children && child.expanded) {
this.open(index + childIndex + 1, child);
}
});
}
},
close(index, item) {
if (item.children) {
item.children.forEach((child, childIndex) => {
child.isShow = false;
child.expanded = false;
if (child.children) {
this.close(index + childIndex + 1, child);
}
});
}
},
// 点击check勾选框,判断是否有children节点 如果有就一并勾选
rowChecked(data, index, event) {
// this.$set(this.trs, index, data);
this.$set(this.trs, index, data);
console.log("rowChecked",data,this.trs[index])
var boys = this.getChildrens(data);
if(boys.length){
}
this.trs.forEach((u, i) => {
if (boys.length>0) {
this.trs.forEach((u, i) => {
var items = boys.filter((b) => {
return b[this.keyname] == u[this.keyname];
});
......@@ -624,6 +603,8 @@ export default {
this.$set(this.trs[i], "_checked", !data._checked);
}
});
}
this.checkAll =
this.trs.length >
this.trs.filter((u) => {
......@@ -658,12 +639,12 @@ export default {
},
selectionChange() {
var items = this.trs.filter((u) => {
return u._checked === true;
return u._checked;
});
this.selectItems = items;
this.$emit("on-selection-change", items, this.trs);
this.footerToolbar = items.length > 0;
console.log("footerToolbar", items, this.trs);
console.log("footerToolbar", items);
},
// 数组去重
getArray(a) {
......@@ -740,205 +721,42 @@ export default {
columnChange(item, i) {
item.hide = !item.hide;
this.$set(this.columnsCur, item, i);
this.saveUserconfig();
},
onSelect(rows, row) {
this.$emit("on-change", rows, row);
},
allChange(items) {
this.$emit("all-change", items);
// this.saveUserconfig();
},
undoConfig() {
//列设置恢复初始化
this.columnsCur = this.$u.clone(this.columns);
// this.saveUserconfig();
},
//批量取消
cancelBatch() {
this.footerToolbar = false;
// this.$refs.table.selectAll(false);
},
//导出excel
export2Excel() {
//当前显示数据
let list = [];
list = this.trs;
const tHeader = []; // 设置Excel的表格第一行的标题
const filterVal = []; //list里对象的属性
var tempCol = [];
var tempCol1 = []; //存放物料相关表头
var tempCol2 = []; //存放工艺规程相关表头
var tempColUser = []; //存放type=user的表头
var tempColUsers = []; //存放type=users的表头
var columnsCur = this.$u.clone(this.columns); //导出列标题信息griddata this.$refs.grid.columnsCur
columnsCur.forEach((el) => {
if (el.export) {
if (el.code) {
tempCol.push({
key: el.key,
code: el.code,
}); //临时存放code数据字典的字段及对应的数据字典code
}
if (el.materialKey) {
tempCol1.push({
key: el.key,
code: el.materialKey,
}); //临时存放物料管理大类和子类列表
}
if (el.techKey) {
tempCol2.push({
key: el.key,
code: el.techKey,
}); //临时存放工艺规程相关转换
}
if (el.type && el.type == "user") {
tempColUser.push({
key: el.key,
code: el.type,
}); //临时存放user列
}
if (el.type && el.type == "users") {
tempColUsers.push({
key: el.key,
code: el.type,
}); //临时存放user列
}
tHeader.push(el.title);
filterVal.push(el.key);
}
});
list.forEach((e) => {
tempCol.forEach((elem) => {
if (
(e[elem.key] && e[elem.key] != "" && e[elem.key] != null) ||
e[elem.key] == 0
) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值。
let codeArr = [];
let keyValue = e[elem.key];
if (
keyValue.length > 0 &&
(keyValue.indexOf(",") > -1 || keyValue.indexOf(",") > -1)
) {
//如果对应的数据包含多个数据字典项,比如包含“,”或“,”
if (keyValue.indexOf(",") > -1) {
codeArr = keyValue.split(",");
}
if (keyValue.indexOf > -1) {
codeArr = keyValue.split(",");
}
}
if (codeArr.length <= 1) {
//对应的数据包含一个数据字典项
e[elem.key] = this.$u.dirName(
this.$store.getters.dictionaryByKey(elem.code),
e[elem.key]
);
} else {
//对应的数据包含多个数据字典项
let codeInfo = "";
codeArr.forEach((el) => {
codeInfo =
codeInfo +
this.$u.dirName(
this.$store.getters.dictionaryByKey(elem.code),
el
) +
",";
});
e[elem.key] = codeInfo.substr(0, codeInfo.length - 1);
}
}
});
//导出数据增加对应的物料管理信息 code: 1【rootCategoryId 大类】 2【categoryId 大类】 3【codeRuleId 编码名称】
tempCol1.forEach((elcol1) => {
if (elcol1.code == 1) {
e[elcol1.key] = this.getType1(e[elcol1.key]);
} else if (elcol1.code == 2) {
e[elcol1.key] = this.getType2(e[elcol1.key]);
} else if (elcol1.code == 3) {
e[elcol1.key] = this.getType3(e[elcol1.key]);
}
saveUserconfig() {
let url = `${window.systemUrl}/config/update`;
var content = [];
this.columnsCur.map((u) => {
content.push({
key: u.key,
hide: u.hide,
});
//导出工艺规程相关转换表头信息
tempCol2.forEach((elcol2) => {
if (elcol2.code == 1) {
e[elcol2.key] = this.getRoutingHeaderName(e[elcol2.key]);
}
});
//导出username相关信息
tempColUser.forEach((eluser) => {
if (Array.isArray(e[eluser.key]) && e[eluser.key].length > 0) {
let temUsers = this.$u.clone(e[eluser.key]);
let temUserName = "";
temUsers.forEach((u) => {
temUserName = temUserName + this.getUserName(u);
});
e[eluser.key] = temUserName;
}
if (
e[eluser.key] &&
typeof e[eluser.key] == "string" &&
e[eluser.key] != "" &&
e[eluser.key] != null
) {
e[eluser.key] = this.getUserName(e[eluser.key]);
}
});
tempColUsers.forEach((elusers) => {
if (e[elusers.key].length > 0) {
let temUsers = this.$u.clone(e[elusers.key]);
let temUserName = "";
temUsers.forEach((u) => {
temUserName = temUserName + this.getUserName(u) + ",";
});
e[elusers.key] = temUserName.substr(0, temUserName.length - 1);
}
});
});
let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss
//获取导出数据结束
this.$nextTick(() => {
this.$u.outExcel(
this.exportTitle + "(" + nowDate + ")",
tHeader,
filterVal,
list
);
});
},
//获取所有用户信息
getAllUser() {
this.$api
.post(`${systemUrl}/user/paged`, {
conditions: [],
pageIndex: 1,
pageSize: 100000,
})
.then((r) => {
if (r.success) {
let tempUserInfo = r.result.items;
tempUserInfo.forEach((ele) => {
let temObj = {
userId: ele.id,
name: ele.userName,
};
this.allUser.push(temObj);
});
}
if (!this.userConfig) {
url = `${window.systemUrl}/config/create`;
var data = {
page: window.location.pathname,
component: "Grid",
key: this.$u.guid(),
content: JSON.stringify(content),
};
this.$api.post(url, data).then((r) => {
this.loadUserConfig();
});
} else {
this.userConfig.content = JSON.stringify(content);
this.$api.post(url, this.userConfig);
}
},
getUserName(id) {
let name = "";
this.allUser.forEach((ele) => {
if (id == ele.userId) {
name = ele.name;
}
});
return name;
//批量取消
cancelBatch() {
this.footerToolbar = false;
// this.$refs.table.selectAll(false);
},
},
};
......
......@@ -51,7 +51,7 @@
<Button @click="complexSearch" type="primary" style="margin-left: 10px">查询</Button>
</div>
</Modal>
<Drawer title="列设置" v-if="set" v-model="config" :scrollable="true" placement="left" :mask="false">
<Drawer title="列设置" v-if="set" v-model="config" :scrollable="true" placement="left" :mask="false" class-name="tree-drawer">
<div slot="header">
列设置
<a @click="undoConfig" class="ml50">
......
......@@ -132,7 +132,7 @@ henq.toTree = (list, rootId, format, parentFiledName) => {
function toTree(data, parentId, level) {
let parents = data.filter(u => {
if(u[upId]=='')
if(u[upId]==='')
{
u[upId]=null
}
......
......@@ -26,6 +26,9 @@ export default {
}
});
},
batch(ids) {
return Api.post(`${material}/projectplan/batchdelete`,ids);
},
///projecttemplate/list
templates(params){
return Api.post(`${material}/projecttemplate/list`,params)
......
<template>
<div>
<Card>
<EditGrid :columns="columns" ref="grid" :batch="true" :items="list" :level="8" :drag="true" :exportTitle="exportTl">
<EditGrid :columns="columns" ref="grid" :batch="true" :items="list" :level="8" :drag="true" :exportTitle="exportTl" @on-selection-change="batchChange">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"><Input placeholder="请输入关键字标题" v-model="easySearch.keys.value" />
......@@ -30,6 +30,9 @@
</DropdownMenu>
</Dropdown>
</template>
<template slot="batch">
<Button type="primary" @click="bacthRemove()">批量删除</Button>
</template>
</EditGrid>
</Card>
<Submenus :show="showStatu" :data="tempItems" :params="params"></Submenus>
......@@ -70,6 +73,7 @@ export default {
data() {
return {
entity: {},
batchItems:[],
row: {},
action: Api.index,
easySearch: {
......@@ -88,13 +92,15 @@ export default {
key: "drag",
type: "drag",
width: 50,
align: 'center'
align: 'center',
title: '移动',
},
{
key: "upId",
width: 50,
type: "selection",
align: 'center'
align: 'center',
title: '选择',
},
{
key: "upTitle",
......@@ -466,6 +472,21 @@ export default {
}
];
},
batchChange(items,list){
this.batchItems=items;
},
bacthRemove(){
var ids=this.batchItems.map(u=>{
return u.id;
})
if(ids.length>0){
Api.batch(ids).then(r=>{
if(r.success){
this.search();
}
})
}
},
//批量导入start
//导入功能
openModalIm() {
......
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