Commit 6307c231 by Sixong.Zhu

update id to string

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