123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- <template>
- <drawer-tabs-container>
- <div class="report-receive">
- <!-- 搜索 -->
- <Row class="sreachBox">
- <div class="item">
- <div class="item-3">
- <sreachTitle :val="keys.username">发送人</sreachTitle>
- <Input v-model="keys.username" placeholder="用户名"/>
- </div>
- <div class="item-3">
- <sreachTitle :val="keys.type">类型</sreachTitle>
- <Select v-model="keys.type" placeholder="全部">
- <Option value="">全部</Option>
- <Option value="日报">日报</Option>
- <Option value="周报">周报</Option>
- </Select>
- </div>
- <div class="item-3">
- <sreachTitle :val="keys.indate">日期</sreachTitle>
- <Date-picker v-model="keys.indate" type="daterange" placement="bottom" placeholder="日期范围"></Date-picker>
- </div>
- </div>
- <div class="item item-button">
- <Button type="text" v-if="$A.objImplode(keys)!=''" @click="sreachTab(true)">取消筛选</Button>
- <Button type="primary" icon="md-search" :loading="loadIng > 0" @click="sreachTab">搜索</Button>
- </div>
- </Row>
- <!-- 列表 -->
- <Table class="tableFill" ref="tableRef" :columns="columns" :data="lists" :loading="loadIng > 0" :no-data-text="noDataText" @on-sort-change="sortChange" stripe></Table>
- <!-- 分页 -->
- <Page class="pageBox" :total="listTotal" :current="listPage" :disabled="loadIng > 0" @on-change="setPage" @on-page-size-change="setPageSize" :page-size-opts="[10,20,30,50,100]" placement="top" show-elevator show-sizer show-total transfer></Page>
- </div>
- <Modal
- v-model="contentShow"
- :title="contentTitle"
- width="80%"
- :styles="{top: '35px', paddingBottom: '35px'}"
- footerHide>
- <report-content :content="contentText"></report-content>
- </Modal>
- </drawer-tabs-container>
- </template>
- <style lang="scss" scoped>
- .report-receive {
- margin: 0 12px;
- .tableFill {
- margin: 12px 0 20px;
- }
- }
- </style>
- <script>
- import DrawerTabsContainer from "../DrawerTabsContainer";
- import ReportContent from "./content";
- /**
- * 收到的汇报
- */
- export default {
- name: 'ReportReceive',
- components: {ReportContent, DrawerTabsContainer},
- props: {
- canload: {
- type: Boolean,
- default: true
- },
- labelLists: {
- type: Array,
- },
- },
- data() {
- return {
- keys: {},
- sorts: {key:'', order:''},
- loadYet: false,
- loadIng: 0,
- columns: [],
- lists: [],
- listPage: 1,
- listTotal: 0,
- noDataText: "数据加载中.....",
- contentShow: false,
- contentTitle: '',
- contentText: '内容加载中.....',
- }
- },
- created() {
- this.columns = [{
- "title": "标题",
- "key": 'title',
- "minWidth": 120,
- }, {
- "title": "发送人",
- "key": 'username',
- "sortable": true,
- "minWidth": 80,
- "maxWidth": 150,
- }, {
- "title": "创建日期",
- "width": 160,
- "align": 'center',
- render: (h, params) => {
- return h('span', $A.formatDate("Y-m-d H:i:s", params.row.indate));
- }
- }, {
- "title": "类型",
- "key": 'type',
- "width": 80,
- "align": 'center',
- }, {
- "title": "操作",
- "key": 'action',
- "width": 80,
- "align": 'center',
- render: (h, params) => {
- return h('a', {
- style: {padding: '0 2px', fontSize: '12px'},
- on: {
- click: () => {
- this.contentReport(params.row);
- }
- }
- }, '查看');
- }
- }];
- },
- mounted() {
- if (this.canload) {
- this.loadYet = true;
- this.getLists(true);
- }
- },
- watch: {
- canload(val) {
- if (val && !this.loadYet) {
- this.loadYet = true;
- this.getLists(true);
- }
- }
- },
- methods: {
- sreachTab(clear) {
- if (clear === true) {
- this.keys = {};
- }
- this.getLists(true);
- },
- sortChange(info) {
- this.sorts = {key:info.key, order:info.order};
- this.getLists(true);
- },
- setPage(page) {
- this.listPage = page;
- this.getLists();
- },
- setPageSize(size) {
- if (Math.max($A.runNum(this.listPageSize), 10) != size) {
- this.listPageSize = size;
- this.getLists();
- }
- },
- getLists(resetLoad) {
- if (resetLoad === true) {
- this.listPage = 1;
- }
- this.loadIng++;
- let whereData = $A.cloneData(this.keys);
- whereData.page = Math.max(this.listPage, 1);
- whereData.pagesize = Math.max($A.runNum(this.listPageSize), 10);
- whereData.sorts = $A.cloneData(this.sorts);
- this.noDataText = "数据加载中.....";
- $A.aAjax({
- url: 'report/receive',
- data: whereData,
- complete: () => {
- this.loadIng--;
- },
- error: () => {
- this.noDataText = "数据加载失败!";
- },
- success: (res) => {
- if (res.ret === 1) {
- this.lists = res.data.lists;
- this.listTotal = res.data.total;
- this.noDataText = "没有相关的数据";
- } else {
- this.lists = [];
- this.listTotal = 0;
- this.noDataText = res.msg;
- }
- }
- });
- },
- contentReport(row) {
- this.contentShow = true;
- this.contentTitle = row.title;
- this.contentText = '详细内容加载中.....';
- $A.aAjax({
- url: 'report/content?id=' + row.id,
- error: () => {
- alert(this.$L('网络繁忙,请稍后再试!'));
- this.contentShow = false;
- },
- success: (res) => {
- if (res.ret === 1) {
- this.contentText = res.data.content;
- } else {
- this.contentShow = false;
- this.$Modal.error({title: this.$L('温馨提示'), content: res.msg});
- }
- }
- });
- },
- }
- }
- </script>
|