Commit 4f114e5e authored by 仇晓婷's avatar 仇晓婷

卡片列表无数据提醒

parent b0829f67
<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>
<Input search enter-button :placeholder="placeholder" @on-search="easySearch" v-width="300" v-model="keys" /> <Input
search
enter-button
:placeholder="placeholder"
@on-search="easySearch"
v-width="300"
v-model="keys"
/>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button v-if="high" @click="modalSearch=true" type="text"> <Button v-if="high" @click="modalSearch = true" type="text">
<Icon type="md-search" />高级 <Icon type="md-search" />高级
</Button> </Button>
</FormItem> </FormItem>
...@@ -21,34 +28,86 @@ ...@@ -21,34 +28,86 @@
</div> </div>
<div class="btns"> <div class="btns">
<slot name="buttons"></slot> <slot name="buttons"></slot>
<Button @click="export2Excel" v-if="exportTitle.length>0">导出</Button> <Button @click="export2Excel" v-if="exportTitle.length > 0"
<Button v-if="set&&type=='table'" @click="config=!config"> >导出</Button
>
<Button v-if="set && type == 'table'" @click="config = !config">
<Icon type="md-build" title="列设置" /> <Icon type="md-build" title="列设置" />
</Button> </Button>
</div> </div>
</div> </div>
<div class="table-main" ref="main"> <div class="table-main" ref="main">
<Row v-if="type=='card'" :gutter="40"> <Row v-if="type == 'card'" :gutter="40">
<Col :span="span" v-for="(row,i) in list" :key="i"> <Col :span="span" v-for="(row, i) in list" :key="i">
<slot name="card" :row="row"> <slot name="card" :row="row">
<span>{{row.id}}</span> <span>{{ row.id }}</span>
</slot> </slot>
</Col> </Col>
<Col v-if="list.length == 0" span="24" class="zan-wu">
<h4>暂无数据</h4>
</Col>
</Row> </Row>
<Table v-else :border="border" :columns="columnsNow" :data="list" :height="tableHeight" :draggable="draggable" ref="table" class="tableCommon" @on-expand="expand" @on-drag-drop="onDragDrop" @on-selection-change="selectionChange" @on-select="onSelect" @on-select-all="allChange" :row-key="rowKey" stripe></Table> <Table
v-else
:border="border"
:columns="columnsNow"
:data="list"
:height="tableHeight"
:draggable="draggable"
ref="table"
class="tableCommon"
@on-expand="expand"
@on-drag-drop="onDragDrop"
@on-selection-change="selectionChange"
@on-select="onSelect"
@on-select-all="allChange"
:row-key="rowKey"
stripe
></Table>
</div> </div>
<div class="table-footer"> <div class="table-footer">
<slot name="footer"></slot> <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" /> <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> </div>
<Modal v-if="high" v-model="modalSearch" title="高级搜索" draggable width="800" ref="search"> <Modal
v-if="high"
v-model="modalSearch"
title="高级搜索"
draggable
width="800"
ref="search"
>
<slot name="searchForm"></slot> <slot name="searchForm"></slot>
<div slot="footer"> <div slot="footer">
<Button @click="modalSearch=false" style="margin-left:20px;">取消</Button> <Button @click="modalSearch = false" style="margin-left: 20px"
<Button @click="complexSearch" type="primary" style="margin-left:10px;">查询</Button> >取消</Button
>
<Button @click="complexSearch" type="primary" style="margin-left: 10px"
>查询</Button
>
</div> </div>
</Modal> </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"
>
<div slot="header"> <div slot="header">
列设置 列设置
<a @click="undoConfig" class="ml50"> <a @click="undoConfig" class="ml50">
...@@ -56,10 +115,18 @@ ...@@ -56,10 +115,18 @@
</a> </a>
</div> </div>
<ul class="table-columns"> <ul class="table-columns">
<li v-for="(li,index) in columnsCur" :key="index" v-dragging="{ item: li, list: columnsCur, group: 'li' }"> <li
<label @click="columnChange(li,index)" :class="{dis:li.hide}"> v-for="(li, index) in columnsCur"
<Icon :type="li.hide?'md-eye-off':'md-eye'" size="16" class="mr10" /> :key="index"
<span>{{li.title}}</span> v-dragging="{ item: li, list: columnsCur, group: 'li' }"
>
<label @click="columnChange(li, index)" :class="{ dis: li.hide }">
<Icon
:type="li.hide ? 'md-eye-off' : 'md-eye'"
size="16"
class="mr10"
/>
<span>{{ li.title }}</span>
</label> </label>
<Icon type="ios-move" class="move" size="18" /> <Icon type="ios-move" class="move" size="18" />
</li> </li>
...@@ -67,11 +134,11 @@ ...@@ -67,11 +134,11 @@
</Drawer> </Drawer>
<FooterToolbar v-if="batch" v-show="footerToolbar" class="ftball"> <FooterToolbar v-if="batch" v-show="footerToolbar" class="ftball">
<div class="tip">已选{{selectItems.length}}</div> <div class="tip">已选{{ selectItems.length }}</div>
<slot name="batch"></slot> <slot name="batch"></slot>
<Button @click="cancelBatch">取消</Button> <Button @click="cancelBatch">取消</Button>
</FooterToolbar> </FooterToolbar>
</div> </div>
</template> </template>
<script> <script>
...@@ -102,7 +169,7 @@ export default { ...@@ -102,7 +169,7 @@ export default {
treeData: [], //物料数据 treeData: [], //物料数据
codeRuleData: [], //物料编码 codeRuleData: [], //物料编码
routingHeaderData: [], //工艺规程 routingHeaderData: [], //工艺规程
allUser: [] //所有user allUser: [], //所有user
}; };
}, },
props: { props: {
...@@ -318,7 +385,8 @@ export default { ...@@ -318,7 +385,8 @@ export default {
}, },
loadUserConfig() { loadUserConfig() {
var query = { var query = {
conditions: [{ conditions: [
{
fieldName: "creatorUserId", fieldName: "creatorUserId",
fieldValue: this.userId, fieldValue: this.userId,
conditionalType: "Equal", conditionalType: "Equal",
...@@ -476,33 +544,33 @@ export default { ...@@ -476,33 +544,33 @@ export default {
}, },
//获取所有用户信息 //获取所有用户信息
getAllUser() { getAllUser() {
this.$api.post(`${systemUrl}/user/paged`, { this.$api
.post(`${systemUrl}/user/paged`, {
conditions: [], conditions: [],
pageIndex: 1, pageIndex: 1,
pageSize: 100000, pageSize: 100000,
}) })
.then((r) => { .then((r) => {
if (r.success) { if (r.success) {
let tempUserInfo = r.result.items let tempUserInfo = r.result.items;
tempUserInfo.forEach(ele => { tempUserInfo.forEach((ele) => {
let temObj = { let temObj = {
userId: ele.id, userId: ele.id,
name: ele.userName name: ele.userName,
} };
this.allUser.push(temObj) this.allUser.push(temObj);
}) });
} }
}) });
}, },
getUserName(id) { getUserName(id) {
let name = '' let name = "";
this.allUser.forEach(ele => { this.allUser.forEach((ele) => {
if (id == ele.userId) { if (id == ele.userId) {
name = ele.name name = ele.name;
} }
}) });
return name return name;
}, },
//批量取消 //批量取消
cancelBatch() { cancelBatch() {
...@@ -602,33 +670,41 @@ export default { ...@@ -602,33 +670,41 @@ export default {
// ); // );
// }); // });
tempCol.forEach((elem) => { tempCol.forEach((elem) => {
if (e[elem.key] && e[elem.key] != "" && e[elem.key] != null) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值。
let codeArr = [];
let keyValue = e[elem.key];
if ( if (
e[elem.key] && keyValue.length > 0 &&
e[elem.key] != "" && (keyValue.indexOf(",") > -1 || keyValue.indexOf(",") > -1)
e[elem.key] != null
) { ) {
//如果数据字典项对应的DirName字段存在,通过name查询到对应的code,然后赋值。 //如果对应的数据包含多个数据字典项,比如包含“,”或“,”
let codeArr = [] if (keyValue.indexOf(",") > -1) {
let keyValue = e[elem.key] codeArr = keyValue.split(",");
if (keyValue.length > 0 && (keyValue.indexOf(',') > -1 || keyValue.indexOf(',') > -1)) { //如果对应的数据包含多个数据字典项,比如包含“,”或“,”
if (keyValue.indexOf(',') > -1) {
codeArr = keyValue.split(',')
} }
if (keyValue.indexOf > -1) { if (keyValue.indexOf > -1) {
codeArr = keyValue.split(',') codeArr = keyValue.split(",");
} }
} }
if (codeArr.length <= 1) { //对应的数据包含一个数据字典项 if (codeArr.length <= 1) {
//对应的数据包含一个数据字典项
e[elem.key] = this.$u.dirName( e[elem.key] = this.$u.dirName(
this.$store.getters.dictionaryByKey(elem.code), this.$store.getters.dictionaryByKey(elem.code),
e[elem.key] e[elem.key]
); );
} else { //对应的数据包含多个数据字典项 } else {
let codeInfo = '' //对应的数据包含多个数据字典项
codeArr.forEach(el => { let codeInfo = "";
codeInfo = codeInfo + this.$u.dirName(this.$store.getters.dictionaryByKey(elem.code), el) + ","; codeArr.forEach((el) => {
}) codeInfo =
e[elem.key] = codeInfo.substr(0, codeInfo.length - 1) codeInfo +
this.$u.dirName(
this.$store.getters.dictionaryByKey(elem.code),
el
) +
",";
});
e[elem.key] = codeInfo.substr(0, codeInfo.length - 1);
} }
} }
}); });
...@@ -649,15 +725,11 @@ export default { ...@@ -649,15 +725,11 @@ export default {
} }
}); });
//导出username相关信息 //导出username相关信息
tempColUser.forEach(eluser => { tempColUser.forEach((eluser) => {
if ( if (e[eluser.key] && e[eluser.key] != "" && e[eluser.key] != null) {
e[eluser.key] && e[eluser.key] = this.getUserName(e[eluser.key]);
e[eluser.key] != "" &&
e[eluser.key] != null
) {
e[eluser.key] = this.getUserName(e[eluser.key])
} }
}) });
}); });
let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss let nowDate = this.$u.getNowTime(); //年月日时分秒yyyyMMddhhmmss
...@@ -858,6 +930,11 @@ export default { ...@@ -858,6 +930,11 @@ export default {
} }
overflow-x: hidden; overflow-x: hidden;
.zan-wu {
height: 600px;
line-height: 600px;
text-align: center;
}
} }
.table-tools { .table-tools {
......
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