Commit 6307c231 by Sixong.Zhu

update id to string

parent 3276c499
...@@ -57,179 +57,179 @@ ...@@ -57,179 +57,179 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { Component, Prop, Ref, Vue } from "vue-property-decorator"; import { Component, Prop, Ref, Vue } from "vue-property-decorator";
import { namespace } from "vuex-class"; import { namespace } from "vuex-class";
import * as dto from "../model"; import * as dto from "../model";
import { unique } from "../utils"; import { unique } from "../utils";
import avatar from "@/customer-service/components/avatar.vue"; import avatar from "@/customer-service/components/avatar.vue";
import { ChatStore } from "@/customer-service/store/model"; import { ChatStore } from "@/customer-service/store/model";
import chat from "@/customer-service/xim/index"; import chat from "@/customer-service/xim/index";
import xim from "@/customer-service/xim/xim"; import xim from "@/customer-service/xim/xim";
const chatStoreNamespace = namespace("chatStore"); const chatStoreNamespace = namespace("chatStore");
@Component({ components: { avatar } }) @Component({ components: { avatar } })
export default class WhoReadList extends Vue { export default class WhoReadList extends Vue {
@chatStoreNamespace.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID) @chatStoreNamespace.State(ChatStore.STATE_CHAT_CURRENT_CHAT_ID)
private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID; private readonly chatId!: ChatStore.STATE_CHAT_CURRENT_CHAT_ID;
@chatStoreNamespace.State(ChatStore.STATE_CHAT_MY_ID) @chatStoreNamespace.State(ChatStore.STATE_CHAT_MY_ID)
private readonly chatMyId!: ChatStore.STATE_CHAT_MY_ID; private readonly chatMyId!: ChatStore.STATE_CHAT_MY_ID;
@Prop({ type: Number }) @Prop({ type: Number })
private msgId!: number; private msgId!: number;
@Ref("list-con") @Ref("list-con")
private listCon!: HTMLElement; private listCon!: HTMLElement;
private readlist: { name: string; avatar: string }[] = []; private readlist: { name: string; avatar: string }[] = [];
private unreadlist: { name: string; avatar: string }[] = []; private unreadlist: { name: string; avatar: string }[] = [];
private loading = false; private loading = false;
private tab = 1; private tab = 1;
private get items() { private get items() {
return this.tab === 1 ? this.readlist : this.unreadlist; return this.tab === 1 ? this.readlist : this.unreadlist;
} }
private startLoading() { private startLoading() {
this.loading = true; this.loading = true;
} }
private endLoading() { private endLoading() {
this.loading = false; this.loading = false;
} }
public async created() { public async created() {
this.startLoading(); this.startLoading();
await this.getReader(); await this.getReader();
this.endLoading(); this.endLoading();
} }
public mounted() { public mounted() {
this.enableBlur(); this.enableBlur();
} }
private enableBlur() { private enableBlur() {
this.listCon.setAttribute("tabindex", "-1"); this.listCon.setAttribute("tabindex", "-1");
this.listCon.focus(); this.listCon.focus();
} }
private async getUserNameByid(eid: string) { private async getUserNameByid(eid: string) {
const data = await chat.getSdk().model("user").detail(eid).query(); const data = await chat.getSdk().model("user").detail(eid).query();
return data.row.first_name.value as string; return data.row.first_name.value as string;
} }
private async getReader() { private async getReader() {
if (this.chatId == null) return; if (this.chatId == null) return;
if (this.msgId == null) return; if (this.msgId == null) return;
const data = await xim.fetchMsgInBox(this.chatId, this.msgId); const data = await xim.fetchMsgInBox(this.chatId, this.msgId);
if (data == null) return; if (data == null) return;
const readerlist = this.uniqueReaderList( const readerlist = this.uniqueReaderList(
data.args[0] as dto.OneWhoReadMessage[] data.args[0] as dto.OneWhoReadMessage[]
); );
this.readlist = await Promise.all( this.readlist = await Promise.all(
readerlist readerlist
.filter((k) => k.is_read) .filter((k) => k.is_read)
.filter((k) => k.eid !== this.chatMyId) .filter((k) => k.eid !== this.chatMyId)
.map(async (k) => { .map(async (k) => {
const eid = k.eid; const eid = k.eid;
const name = await this.getUserNameByid(eid); const name = await this.getUserNameByid(eid);
return { return {
eid, eid,
name, name,
avatar: "", avatar: "",
}; };
}) })
); );
this.unreadlist = await Promise.all( this.unreadlist = await Promise.all(
readerlist readerlist
.filter((k) => !k.is_read) .filter((k) => !k.is_read)
.filter((k) => k.eid !== this.chatMyId) .filter((k) => k.eid !== this.chatMyId)
.map(async (k) => { .map(async (k) => {
const eid = k.eid; const eid = k.eid;
const name = await this.getUserNameByid(eid); const name = await this.getUserNameByid(eid);
return { return {
eid, eid,
name, name,
avatar: "", avatar: "",
}; };
}) })
); );
} }
private uniqueReaderList(data: dto.OneWhoReadMessage[]) { private uniqueReaderList(data: dto.OneWhoReadMessage[]) {
return unique(data, function (item, all) { return unique(data, function (item, all) {
return all.findIndex((k) => k.eid === item.eid); return all.findIndex((k) => k.eid === item.eid);
}); });
}
} }
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.who-read-list { .who-read-list {
background-color: #fff; background-color: #fff;
box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2); box-shadow: 0px 0px 6px 0px rgba(0, 0, 0, 0.2);
border-radius: 4px; border-radius: 4px;
border: 1px solid rgba(183, 191, 199, 1); border: 1px solid rgba(183, 191, 199, 1);
min-height: 100px; min-height: 100px;
position: absolute; position: absolute;
color: #000; color: #000;
z-index: 2; z-index: 2;
margin-left: -100px; margin-left: -100px;
width: 125px; width: 125px;
&.offset { &.offset {
margin-left: 0; margin-left: 0;
} }
.number-count { .number-count {
font-size: 14px; font-size: 14px;
color: #333333; color: #333333;
margin-bottom: 15px; margin-bottom: 15px;
}
} }
}
.tabs { .tabs {
border-bottom: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0;
padding: 10px; padding: 10px;
.tab { .tab {
cursor: pointer; cursor: pointer;
span { span {
font-size: 22px; font-size: 22px;
& + span { & + span {
font-size: 12px; font-size: 12px;
}
} }
}
&.selected { &.selected {
color: #4389f8; color: #4389f8;
} }
& + .tab { & + .tab {
margin-left: 30px; margin-left: 30px;
}
} }
} }
}
.items {
.items { padding: 10px;
padding: 10px; padding-top: 0;
padding-top: 0; padding-left: 20px;
padding-left: 20px;
}
.member-item {
margin-top: 10px;
.member-avatar,
.member-name {
display: inline-block;
vertical-align: middle;
} }
.member-avatar {
margin-right: 10px; .member-item {
margin-top: 10px;
.member-avatar,
.member-name {
display: inline-block;
vertical-align: middle;
}
.member-avatar {
margin-right: 10px;
}
} }
}
</style> </style>
...@@ -58,104 +58,99 @@ ...@@ -58,104 +58,99 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { EVENTS } from "@/EventConsts"; import { EVENTS } from "@/EventConsts";
import startProcessDialog from "@/views/workflow2/components/startProcessDialog.vue"; import startProcessDialog from "@/views/workflow2/components/startProcessDialog.vue";
import { Component, Prop, Ref, Vue } from "vue-property-decorator"; import { Component, Prop, Ref, Vue } from "vue-property-decorator";
import Chat from "../xim/index"; import Chat from "../xim/index";
enum WorkFlowStatus { enum WorkFlowStatus {
"未启动" = 0, "未启动" = 0,
"已启动" = 1, "已启动" = 1,
"已完成" = 2, "已完成" = 2,
} }
@Component({ components: { startProcessDialog } }) @Component({ components: { startProcessDialog } })
export default class WorkFlow extends Vue { export default class WorkFlow extends Vue {
@Ref("startProcessDialog") @Ref("startProcessDialog")
private readonly startProcessIns!: startProcessDialog; private readonly startProcessIns!: startProcessDialog;
@Prop({ @Prop({ required: true })
required: true, private readonly model_name!: string;
})
private readonly model_name!: string;
@Prop({ required: true }) @Prop({ required: true })
private readonly id!: string | number; private readonly id!: string | number;
@Prop({ @Prop({ type: String, default: null })
type: String, private readonly name!: string;
default: null,
})
private readonly name!: string;
private processName = ""; private processName = "";
private selectedProcess = []; private selectedProcess = [];
private startDialogConfirm() { private startDialogConfirm() {
console.log("startDialogConfirm"); console.log("startDialogConfirm");
} }
private workFlowstatus = WorkFlowStatus; private workFlowstatus = WorkFlowStatus;
private getStatus(status: WorkFlowStatus) { private getStatus(status: WorkFlowStatus) {
return WorkFlowStatus[status]; return WorkFlowStatus[status];
} }
private flowList = []; private flowList = [];
public async created() { public async created() {
this.flowList = await Chat.getSdk() this.flowList = await Chat.getSdk()
.model(this.model_name) .model(this.model_name)
.workflow2() .workflow2()
.queryProcessByAssociateId(+this.id); .queryProcessByAssociateId(this.id as number);
} }
public start(workflow: any) { public start(workflow: any) {
this.processName = workflow.processName; this.processName = workflow.processName;
this.selectedProcess = [{ id: workflow.id }]; this.selectedProcess = [{ id: workflow.id }];
this.startProcessIns.showDialog(); this.startProcessIns.showDialog();
} }
public goToDetail(workflow: any) { public goToDetail(workflow: any) {
Chat.$emit(EVENTS.ShowModalDialog, { Chat.$emit(EVENTS.ShowModalDialog, {
dialogName: "show_process_detail", dialogName: "show_process_detail",
params: { params: {
modelName: this.model_name, modelName: this.model_name,
selected: JSON.stringify([{ id: workflow.id }]), selected: JSON.stringify([{ id: workflow.id }]),
}, },
}); });
}
} }
}
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>
.workflows { .workflows {
padding: 10px 30px; padding: 10px 30px;
padding-bottom: 0; padding-bottom: 0;
background: #fff; background: #fff;
.workflow { .workflow {
margin: 10px 0; margin: 10px 0;
padding: 10px 0; padding: 10px 0;
&:hover { &:hover {
background-color: #f5f7fa; background-color: #f5f7fa;
}
}
.cell {
display: inline-block;
width: 25%;
}
.workflow-name {
word-break: break-word;
white-space: pre-line;
}
.get-out {
padding: 0;
} }
} }
.cell { .workflow-scrollbar {
display: inline-block; height: calc(100% - 15px);
width: 25%;
}
.workflow-name {
word-break: break-word;
white-space: pre-line;
}
.get-out {
padding: 0;
} }
}
.workflow-scrollbar {
height: calc(100% - 15px);
}
.text-hint { .text-hint {
margin: 20px 0; margin: 20px 0;
} }
</style> </style>
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 sign in to comment