message.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  1. var h = (T, r, d) => new Promise((R, _) => {
  2. var $ = (s) => {
  3. try {
  4. p(d.next(s));
  5. } catch (w) {
  6. _(w);
  7. }
  8. }, e = (s) => {
  9. try {
  10. p(d.throw(s));
  11. } catch (w) {
  12. _(w);
  13. }
  14. }, p = (s) => s.done ? R(s.value) : Promise.resolve(s.value).then($, e);
  15. p((d = d.apply(T, r)).next());
  16. });
  17. import { ref as D, reactive as N, onMounted as j, resolveComponent as K, openBlock as Y, createBlock as k, withCtx as n, createVNode as o, createElementVNode as y, toDisplayString as u, createCommentVNode as S } from "vue";
  18. import { I as A, dE as F, dF as G, dG as H, dH as L, dI as O, dB as q, dC as x, ai as b } from "./index2.js";
  19. import { T as z, _ as J } from "./index11.js";
  20. import { R as Q } from "./dayjs.js";
  21. const W = ["onClick"], X = !1, oe = {
  22. __name: "message",
  23. setup(T) {
  24. const r = D(null), d = D(0), R = D(0), _ = D(0), $ = D(0), e = N({
  25. activeKey: "1",
  26. searchValue: "",
  27. startRange: [],
  28. beginDate: "",
  29. endDate: "",
  30. completeRange: [],
  31. completeBeginDate: "",
  32. completeEndDate: "",
  33. contentTitle: ""
  34. }), p = 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. ], U = () => r.value.reload(), I = (t) => {
  69. t === "1" || t === "2" ? (e.completeRange = [], e.completeBeginDate = "", e.completeEndDate = "", p.value = s) : p.value = w, U();
  70. }, E = () => h(this, null, function* () {
  71. try {
  72. const t = yield F();
  73. d.value = t.toDealCount || 0, R.value = t.toReadCount || 0, _.value = t.isDealCount || 0, $.value = t.isReadCount || 0;
  74. } catch (t) {
  75. console.warn("[message] 消息数量获取失败:", t);
  76. }
  77. }), M = (t = {}) => e.activeKey === "1" ? G(e, t) : e.activeKey === "2" ? H(e, t) : e.activeKey === "3" ? L(e, t) : O(e, t), C = () => {
  78. e.startRange.length > 0 ? (e.beginDate = b(e.startRange[0]).format("YYYY-MM-DD 00:00:00"), e.endDate = b(e.startRange[1]).format("YYYY-MM-DD 23:59:59")) : (e.beginDate = "", e.endDate = ""), e.completeRange.length > 0 ? (e.completeBeginDate = b(e.completeRange[0]).format("YYYY-MM-DD 00:00:00"), e.completeEndDate = b(e.completeRange[1]).format("YYYY-MM-DD 23:59:59")) : (e.completeBeginDate = "", e.completeEndDate = ""), r.value.reload();
  79. }, B = () => {
  80. e.activeKey = "1", e.searchValue = "", e.startRange = [], e.endDate = "", e.beginDate = "", e.completeRange = [], e.completeBeginDate = "", e.completeEndDate = "", r.value.reload();
  81. }, V = (t = {}) => {
  82. if (e.activeKey === "2" && q([t.id]), t.clientId === "flow") {
  83. const a = {
  84. client_id: `${window.$utils.env.VITE_APP_CLIENT_ID}`,
  85. scope: "snsapi_base"
  86. };
  87. x(a).then((g) => {
  88. const v = g && typeof g == "object" ? g.data : g;
  89. if (!v) {
  90. location.reload();
  91. return;
  92. }
  93. const m = `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 = `${m}${f}`;
  97. c && (c = `&${m}${f}`), window.open(l + c);
  98. } else {
  99. let c = `${m}${f}`;
  100. c && (c = `?${m}${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. return j(() => {
  109. E(), p.value = s;
  110. }), (t, a) => {
  111. const g = A, v = K("s-filter-item"), m = Q, f = K("s-filter-wrap"), l = J, c = z, P = K("s-list-layout");
  112. return Y(), k(P, {
  113. ref_key: "layout",
  114. ref: r,
  115. buttons: [],
  116. onReset: B,
  117. columns: p.value,
  118. loadData: M,
  119. isSelection: X,
  120. title: t.$l("我的消息")
  121. }, {
  122. filter: n(() => [
  123. o(f, null, {
  124. default: n(() => [
  125. o(v, {
  126. label: t.$l("关键字")
  127. }, {
  128. default: n(() => [
  129. o(g, {
  130. value: e.searchValue,
  131. "onUpdate:value": a[0] || (a[0] = (i) => e.searchValue = i),
  132. style: { width: "200px" },
  133. placeholder: t.$l("请输入关键字"),
  134. onPressEnter: C
  135. }, null, 8, ["value", "placeholder"])
  136. ]),
  137. _: 1
  138. }, 8, ["label"]),
  139. o(v, {
  140. label: t.$l("接收日期")
  141. }, {
  142. default: n(() => [
  143. o(m, {
  144. value: e.startRange,
  145. "onUpdate:value": a[1] || (a[1] = (i) => e.startRange = i),
  146. onChange: C
  147. }, null, 8, ["value"])
  148. ]),
  149. _: 1
  150. }, 8, ["label"]),
  151. e.activeKey === "3" || e.activeKey === "4" ? (Y(), k(v, {
  152. key: 0,
  153. label: t.$l("完成日期")
  154. }, {
  155. default: n(() => [
  156. o(m, {
  157. value: e.completeRange,
  158. "onUpdate:value": a[2] || (a[2] = (i) => e.completeRange = i),
  159. onChange: C
  160. }, null, 8, ["value"])
  161. ]),
  162. _: 1
  163. }, 8, ["label"])) : S("", !0)
  164. ]),
  165. _: 1
  166. })
  167. ]),
  168. contentTitle: n(({ record: i }) => [
  169. y("div", null, [
  170. y("a", {
  171. href: "javascript:void(0)",
  172. onClick: (Z) => V(i)
  173. }, u(i.contentTitle), 9, W)
  174. ])
  175. ]),
  176. tabs: n(() => [
  177. o(c, {
  178. activeKey: e.activeKey,
  179. "onUpdate:activeKey": a[3] || (a[3] = (i) => e.activeKey = i),
  180. onChange: I
  181. }, {
  182. default: n(() => [
  183. o(l, { key: "1" }, {
  184. tab: n(() => [
  185. y("span", null, u(t.$l("待处理")) + "(" + u(d.value) + ")", 1)
  186. ]),
  187. _: 1
  188. }),
  189. o(l, { key: "2" }, {
  190. tab: n(() => [
  191. y("span", null, u(t.$l("待阅读")) + "(" + u(R.value) + ")", 1)
  192. ]),
  193. _: 1
  194. }),
  195. o(l, { key: "3" }, {
  196. tab: n(() => [
  197. y("span", null, u(t.$l("已处理")) + "(" + u(_.value) + ")", 1)
  198. ]),
  199. _: 1
  200. }),
  201. o(l, { key: "4" }, {
  202. tab: n(() => [
  203. y("span", null, u(t.$l("已阅读")) + "(" + u($.value) + ")", 1)
  204. ]),
  205. _: 1
  206. })
  207. ]),
  208. _: 1
  209. }, 8, ["activeKey"])
  210. ]),
  211. _: 1
  212. }, 8, ["columns", "title"]);
  213. };
  214. }
  215. };
  216. export {
  217. oe as default
  218. };