123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- <template>
- <drawer-tabs-container>
- <div class="project-complete">
- <!-- 列表 -->
- <Table class="tableFill" ref="tableRef" :columns="columns" :data="lists" :loading="loadIng > 0" :no-data-text="noDataText" 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>
- </drawer-tabs-container>
- </template>
- <style lang="scss" scoped>
- .project-complete {
- .tableFill {
- margin: 12px 12px 20px;
- }
- }
- </style>
- <script>
- import DrawerTabsContainer from "../../DrawerTabsContainer";
- import Task from "../../../mixins/task";
- export default {
- name: 'TodoAttention',
- components: {DrawerTabsContainer},
- props: {
- canload: {
- type: Boolean,
- default: true
- },
- },
- mixins: [
- Task
- ],
- data () {
- return {
- loadYet: false,
- loadIng: 0,
- columns: [],
- lists: [],
- listPage: 1,
- listTotal: 0,
- noDataText: "数据加载中.....",
- }
- },
- created() {
- this.columns = [{
- "title": "任务名称",
- "key": 'title',
- "minWidth": 100,
- render: (h, params) => {
- return h('div', [
- h('Icon', {
- props: { type: params.row.complete ? 'md-checkbox-outline' : 'md-square-outline' },
- style: {marginRight: '4px', cursor: 'pointer', fontSize: '15px'},
- on: {
- click: () => {
- this.taskComplete(params.row, !params.row.complete, (detail) => {
- this.$emit("change", detail.complete ? 'complete' : 'unfinished', detail);
- });
- }
- }
- }),
- h('span', {
- style: {cursor: 'pointer'},
- on: {
- click: () => {
- let taskDetail = params.row;
- this.taskDetail(taskDetail, (act, detail) => {
- for (let key in detail) {
- if (detail.hasOwnProperty(key)) {
- this.$set(taskDetail, key, detail[key])
- }
- }
- //
- switch (act) {
- case "username": // 负责人
- case "delete": // 删除任务
- case "archived": // 归档
- this.lists.some((task, i) => {
- if (task.id == detail.id) {
- this.lists.splice(i, 1);
- return true;
- }
- });
- break;
- case "unarchived": // 取消归档
- this.lists.unshift(detail);
- break;
- }
- //
- this.$emit("change", act, detail);
- });
- }
- }
- }, params.row.title)
- ]);
- }
- }, {
- "title": "创建人",
- "key": 'createuser',
- "minWidth": 80,
- }, {
- "title": "负责人",
- "key": 'username',
- "minWidth": 80,
- }, {
- "title": "添加时间",
- "width": 160,
- render: (h, params) => {
- return h('span', $A.formatDate("Y-m-d H:i:s", params.row.inorder));
- }
- }];
- },
- mounted() {
- if (this.canload) {
- this.loadYet = true;
- this.getLists(true);
- }
- },
- watch: {
- canload(val) {
- if (val && !this.loadYet) {
- this.loadYet = true;
- this.getLists(true);
- }
- }
- },
- methods: {
- 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++;
- $A.aAjax({
- url: 'project/task/lists',
- data: {
- attention: 1,
- archived: '全部',
- page: Math.max(this.listPage, 1),
- pagesize: Math.max($A.runNum(this.listPageSize), 10),
- },
- complete: () => {
- this.loadIng--;
- },
- success: (res) => {
- if (res.ret === 1) {
- this.lists = res.data.lists;
- this.listTotal = res.data.total;
- } else {
- this.lists = [];
- this.listTotal = 0;
- this.noDataText = res.msg;
- }
- }
- });
- },
- }
- }
- </script>
|