message.js 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. var k = (h, m, p) => new Promise((b, _) => {
  2. var R = (s) => {
  3. try {
  4. d(p.next(s));
  5. } catch (w) {
  6. _(w);
  7. }
  8. }, e = (s) => {
  9. try {
  10. d(p.throw(s));
  11. } catch (w) {
  12. _(w);
  13. }
  14. }, d = (s) => s.done ? b(s.value) : Promise.resolve(s.value).then(R, e);
  15. d((p = p.apply(h, m)).next());
  16. });
  17. import { ref as D, reactive as N, onMounted as S, onUnmounted as A, resolveComponent as T, openBlock as M, createBlock as I, withCtx as n, createVNode as o, createElementVNode as y, toDisplayString as u, createCommentVNode as O } from "vue";
  18. import { dM as L, I as Q, dX as X, dY as Z, dZ as q, d_ as x, d$ as z, dQ as F, dR as G, ai as C } from "./index2.js";
  19. import { T as H, _ as J } from "./index12.js";
  20. import { R as W } from "./dayjs.js";
  21. const ee = ["onClick"], te = !1, ce = /* @__PURE__ */ Object.assign({ name: "MessageCenter" }, {
  22. __name: "message",
  23. setup(h) {
  24. const m = D(null), p = D(0), b = D(0), _ = D(0), R = D(0), e = N({
  25. activeKey: "1",
  26. searchValue: "",
  27. startRange: [],
  28. beginDate: "",
  29. endDate: "",
  30. completeRange: [],
  31. completeBeginDate: "",
  32. completeEndDate: "",
  33. contentTitle: ""
  34. }), d = D([]), s = [
  35. {
  36. title: window.$l("标题"),
  37. dataIndex: "contentTitle",
  38. ellipsis: !0,
  39. template: !0
  40. },
  41. {
  42. title: window.$l("接收日期"),
  43. dataIndex: "createDate",
  44. ellipsis: !0,
  45. width: "10%",
  46. template: !1
  47. }
  48. ], w = [
  49. {
  50. title: window.$l("标题"),
  51. dataIndex: "contentTitle",
  52. ellipsis: !0,
  53. template: !0
  54. },
  55. {
  56. title: window.$l("接收日期"),
  57. dataIndex: "createDate",
  58. ellipsis: !0,
  59. width: "10%"
  60. },
  61. {
  62. title: window.$l("完成日期"),
  63. dataIndex: "finishedTime",
  64. ellipsis: !0,
  65. width: "10%",
  66. template: !1
  67. }
  68. ], Y = () => m.value.reload(), E = (t) => {
  69. t === "1" || t === "2" ? (e.completeRange = [], e.completeBeginDate = "", e.completeEndDate = "", d.value = s) : d.value = w, Y();
  70. }, U = () => k(this, null, function* () {
  71. try {
  72. const t = yield X();
  73. p.value = t.toDealCount || 0, b.value = t.toReadCount || 0, _.value = t.isDealCount || 0, R.value = t.isReadCount || 0;
  74. } catch (t) {
  75. console.warn("[message] 消息数量获取失败:", t);
  76. }
  77. }), V = (t = {}) => e.activeKey === "1" ? Z(e, t) : e.activeKey === "2" ? q(e, t) : e.activeKey === "3" ? x(e, t) : z(e, t), K = () => {
  78. e.startRange.length > 0 ? (e.beginDate = C(e.startRange[0]).format("YYYY-MM-DD 00:00:00"), e.endDate = C(e.startRange[1]).format("YYYY-MM-DD 23:59:59")) : (e.beginDate = "", e.endDate = ""), e.completeRange.length > 0 ? (e.completeBeginDate = C(e.completeRange[0]).format("YYYY-MM-DD 00:00:00"), e.completeEndDate = C(e.completeRange[1]).format("YYYY-MM-DD 23:59:59")) : (e.completeBeginDate = "", e.completeEndDate = ""), m.value.reload();
  79. }, B = () => {
  80. e.activeKey = "1", e.searchValue = "", e.startRange = [], e.endDate = "", e.beginDate = "", e.completeRange = [], e.completeBeginDate = "", e.completeEndDate = "", m.value.reload();
  81. }, P = (t = {}) => {
  82. if (e.activeKey === "2" && F([t.id]), t.clientId === "flow") {
  83. const a = {
  84. client_id: `${window.$utils.env.VITE_APP_CLIENT_ID}`,
  85. scope: "snsapi_base"
  86. };
  87. G(a).then((g) => {
  88. const v = g && typeof g == "object" ? g.data : g;
  89. if (!v) {
  90. location.reload();
  91. return;
  92. }
  93. const r = `code=${v}`, f = a.state ? `&state=${a.state}` : "";
  94. let l = "";
  95. if (t.messageTypeCode === "toDeal" && e.activeKey === "1" ? l = t.toDealUrl : t.messageTypeCode === "toRead" && e.activeKey === "2" ? l = t.toReadUrl : (t.messageTypeCode === "Deal" && e.activeKey, l = t.browseUrl), l && l.includes("?")) {
  96. let c = `${r}${f}`;
  97. c && (c = `&${r}${f}`), window.open(l + c);
  98. } else {
  99. let c = `${r}${f}`;
  100. c && (c = `?${r}${f}`), window.open(l + c);
  101. }
  102. });
  103. } else {
  104. let a = "";
  105. t.messageTypeCode === "toDeal" && e.activeKey === "1" ? a = t.toDealUrl : t.messageTypeCode === "toRead" && e.activeKey === "2" ? a = t.toReadUrl : (t.messageTypeCode === "Deal" && e.activeKey, a = t.browseUrl), window.open(a);
  106. }
  107. };
  108. let $ = null;
  109. return S(() => {
  110. U(), d.value = s, $ = L(() => {
  111. U(), Y();
  112. });
  113. }), A(() => {
  114. $ && $(), $ = null;
  115. }), (t, a) => {
  116. const g = Q, v = T("s-filter-item"), r = W, f = T("s-filter-wrap"), l = J, c = H, j = T("s-list-layout");
  117. return M(), I(j, {
  118. ref_key: "layout",
  119. ref: m,
  120. buttons: [],
  121. onReset: B,
  122. columns: d.value,
  123. loadData: V,
  124. isSelection: te,
  125. title: t.$l("我的消息")
  126. }, {
  127. filter: n(() => [
  128. o(f, null, {
  129. default: n(() => [
  130. o(v, {
  131. label: t.$l("关键字")
  132. }, {
  133. default: n(() => [
  134. o(g, {
  135. value: e.searchValue,
  136. "onUpdate:value": a[0] || (a[0] = (i) => e.searchValue = i),
  137. style: { width: "200px" },
  138. placeholder: t.$l("请输入关键字"),
  139. onPressEnter: K
  140. }, null, 8, ["value", "placeholder"])
  141. ]),
  142. _: 1
  143. }, 8, ["label"]),
  144. o(v, {
  145. label: t.$l("接收日期")
  146. }, {
  147. default: n(() => [
  148. o(r, {
  149. value: e.startRange,
  150. "onUpdate:value": a[1] || (a[1] = (i) => e.startRange = i),
  151. onChange: K
  152. }, null, 8, ["value"])
  153. ]),
  154. _: 1
  155. }, 8, ["label"]),
  156. e.activeKey === "3" || e.activeKey === "4" ? (M(), I(v, {
  157. key: 0,
  158. label: t.$l("完成日期")
  159. }, {
  160. default: n(() => [
  161. o(r, {
  162. value: e.completeRange,
  163. "onUpdate:value": a[2] || (a[2] = (i) => e.completeRange = i),
  164. onChange: K
  165. }, null, 8, ["value"])
  166. ]),
  167. _: 1
  168. }, 8, ["label"])) : O("", !0)
  169. ]),
  170. _: 1
  171. })
  172. ]),
  173. contentTitle: n(({ record: i }) => [
  174. y("div", null, [
  175. y("a", {
  176. href: "javascript:void(0)",
  177. onClick: (ae) => P(i)
  178. }, u(i.contentTitle), 9, ee)
  179. ])
  180. ]),
  181. tabs: n(() => [
  182. o(c, {
  183. activeKey: e.activeKey,
  184. "onUpdate:activeKey": a[3] || (a[3] = (i) => e.activeKey = i),
  185. onChange: E
  186. }, {
  187. default: n(() => [
  188. o(l, { key: "1" }, {
  189. tab: n(() => [
  190. y("span", null, u(t.$l("待处理")) + "(" + u(p.value) + ")", 1)
  191. ]),
  192. _: 1
  193. }),
  194. o(l, { key: "2" }, {
  195. tab: n(() => [
  196. y("span", null, u(t.$l("待阅读")) + "(" + u(b.value) + ")", 1)
  197. ]),
  198. _: 1
  199. }),
  200. o(l, { key: "3" }, {
  201. tab: n(() => [
  202. y("span", null, u(t.$l("已处理")) + "(" + u(_.value) + ")", 1)
  203. ]),
  204. _: 1
  205. }),
  206. o(l, { key: "4" }, {
  207. tab: n(() => [
  208. y("span", null, u(t.$l("已阅读")) + "(" + u(R.value) + ")", 1)
  209. ]),
  210. _: 1
  211. })
  212. ]),
  213. _: 1
  214. }, 8, ["activeKey"])
  215. ]),
  216. _: 1
  217. }, 8, ["columns", "title"]);
  218. };
  219. }
  220. });
  221. export {
  222. ce as default
  223. };