12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- export default {
- methods: {
- taskComplete(taskDetail, complete, callback = null) {
- if (taskDetail['loadIng'] === true) {
- return;
- }
- this.$set(taskDetail, 'loadIng', true);
- this.$set(taskDetail, 'complete', !!complete);
- $A.aAjax({
- url: 'project/task/edit',
- data: {
- act: complete ? 'complete' : 'unfinished',
- taskid: taskDetail.id,
- },
- complete: () => {
- this.$set(taskDetail, 'loadIng', false);
- },
- error: () => {
- this.$set(taskDetail, 'complete', !complete);
- alert(this.$L('网络繁忙,请稍后再试!'));
- },
- success: (res) => {
- if (res.ret === 1) {
- this.$Message.success(res.msg);
- typeof callback === "function" && callback(res.data);
- } else {
- this.$set(taskDetail, 'complete', !complete);
- this.$Modal.error({title: this.$L('温馨提示'), content: res.msg});
- }
- }
- });
- },
- renderTaskTitle(h, params, callback) {
- let taskDetail = params.row;
- 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);
- typeof callback === "function" && callback(detail.complete ? 'complete' : 'unfinished', detail);
- });
- }
- }
- }),
- h('span', {
- style: {cursor: 'pointer'},
- on: {
- click: () => {
- this.taskDetail(taskDetail, (act, detail) => {
- for (let key in detail) {
- if (detail.hasOwnProperty(key)) {
- this.$set(taskDetail, key, detail[key])
- }
- }
- //
- if (typeof callback === "function") {
- callback(act, detail);
- } else {
- 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": // 取消归档
- let has = false;
- this.lists.some((task) => {
- if (task.id == detail.id) {
- return has = true;
- }
- });
- if (!has) {
- this.lists.unshift(detail);
- }
- break;
- }
- }
- //
- this.$emit("change", act, detail);
- });
- }
- }
- }, taskDetail.title)
- ]);
- }
- }
- }
|