index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373
  1. <template>
  2. <div class="tenant">
  3. <!-- <Banner /> -->
  4. <div class="content">
  5. <byTable
  6. :source="sourceList.data"
  7. :pagination="sourceList.pagination"
  8. :config="config"
  9. :loading="loading"
  10. highlight-current-row
  11. :selectConfig="selectConfig"
  12. :table-events="{
  13. //element talbe事件都能传
  14. select: select,
  15. }"
  16. :action-list="[]"
  17. @get-list="getList"
  18. >
  19. <template #slotName="{ item }">
  20. {{ item.createTime }}
  21. </template>
  22. </byTable>
  23. </div>
  24. <el-dialog
  25. title="异常跟进"
  26. v-model="dialogVisible"
  27. width="800"
  28. v-loading="loading"
  29. >
  30. <byForm
  31. :formConfig="formConfig"
  32. :formOption="formOption"
  33. v-model="formData.data"
  34. :rules="rules"
  35. ref="byform"
  36. >
  37. </byForm>
  38. <template #footer>
  39. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  40. <el-button
  41. type="primary"
  42. @click="submitForm('byform')"
  43. size="large"
  44. :loading="submitLoading"
  45. >
  46. 确 定
  47. </el-button>
  48. </template>
  49. </el-dialog>
  50. <el-dialog title="跟进记录" v-model="dialogVisibleOne" width="500">
  51. <div>
  52. <el-timeline :reverse="false">
  53. <el-timeline-item
  54. placement="top"
  55. v-for="(activity, index) in activities"
  56. :key="index"
  57. :timestamp="activity.handleTime"
  58. >
  59. <div>
  60. 跟进人:{{ activity.handleUserName }}
  61. <span>({{ activity.status ? "已完成" : "处理中" }})</span>
  62. </div>
  63. <div style="margin-top: 5px">跟进记录: {{ activity.explain }}</div>
  64. </el-timeline-item>
  65. </el-timeline>
  66. </div>
  67. </el-dialog>
  68. </div>
  69. </template>
  70. <script setup>
  71. /* eslint-disable vue/no-unused-components */
  72. import { ElMessage, ElMessageBox } from "element-plus";
  73. import byTable from "@/components/byTable/index";
  74. import byForm from "@/components/byForm/index";
  75. import { computed, defineComponent, ref } from "vue";
  76. import useUserStore from "@/store/modules/user";
  77. const loading = ref(false);
  78. const submitLoading = ref(false);
  79. const sourceList = ref({
  80. data: [],
  81. pagination: {
  82. total: 3,
  83. pageNum: 1,
  84. pageSize: 10,
  85. },
  86. });
  87. let dialogVisible = ref(false);
  88. let dialogVisibleOne = ref(false);
  89. let roomDialogVisible = ref(false);
  90. let modalType = ref("add");
  91. let rules = ref({
  92. status: [
  93. { required: true, message: "请选择跟进结果", trigger: ["blur", "change"] },
  94. ],
  95. handleUser: [{ required: true, message: "请选择跟进人", trigger: "change" }],
  96. handleTime: [
  97. { required: true, message: "请选择跟进时间", trigger: "change" },
  98. ],
  99. processing: [
  100. { required: true, message: "请选择处理方式", trigger: "change" },
  101. ],
  102. explain: [{ required: true, message: "请输入处理说明", trigger: "blur" }],
  103. });
  104. const { proxy } = getCurrentInstance();
  105. const selectConfig = reactive([
  106. {
  107. label: "异常来源",
  108. prop: "type",
  109. data: [],
  110. },
  111. {
  112. label: "处理状态",
  113. prop: "type",
  114. data: [],
  115. },
  116. ]);
  117. const config = computed(() => {
  118. return [
  119. {
  120. attrs: {
  121. label: "异常来源",
  122. prop: "name",
  123. },
  124. render(type) {
  125. return proxy.dictDataEcho(type, warehouseType.value);
  126. },
  127. },
  128. {
  129. attrs: {
  130. label: "异常说明",
  131. prop: "type",
  132. },
  133. },
  134. {
  135. attrs: {
  136. label: "处理状态",
  137. prop: "name",
  138. },
  139. render(type) {
  140. return proxy.dictDataEcho(type, warehouseType.value);
  141. },
  142. },
  143. {
  144. attrs: {
  145. label: "最近操作人",
  146. prop: "keeperName",
  147. },
  148. },
  149. {
  150. attrs: {
  151. label: "最近操作时间",
  152. prop: "remark",
  153. },
  154. },
  155. {
  156. attrs: {
  157. label: "操作",
  158. width: "200",
  159. align: "right",
  160. },
  161. // 渲染 el-button,一般用在最后一列。
  162. renderHTML(row) {
  163. return [
  164. {
  165. attrs: {
  166. label: "跟进",
  167. type: "primary",
  168. text: true,
  169. },
  170. el: "button",
  171. click() {
  172. getDtl(row);
  173. },
  174. },
  175. {
  176. attrs: {
  177. label: "查看关联",
  178. type: "primary",
  179. text: true,
  180. },
  181. el: "button",
  182. click() {},
  183. },
  184. {
  185. attrs: {
  186. label: "跟进记录",
  187. type: "primary",
  188. text: true,
  189. },
  190. el: "button",
  191. click() {
  192. proxy
  193. .post("/abnormalDetails/page", {
  194. abnormalInfoId: row.id,
  195. })
  196. .then((res) => {
  197. if (res.rows.length > 0) {
  198. activities.value = res.rows;
  199. dialogVisibleOne.value = true;
  200. } else
  201. return ElMessage({
  202. message: "暂无跟进记录!",
  203. type: "info",
  204. });
  205. });
  206. },
  207. },
  208. ];
  209. },
  210. },
  211. ];
  212. });
  213. let formData = reactive({
  214. data: {},
  215. treeData: [],
  216. });
  217. const formOption = reactive({
  218. inline: true,
  219. labelWidth: 100,
  220. itemWidth: 100,
  221. rules: [],
  222. });
  223. const byform = ref(null);
  224. const treeData = ref([]);
  225. const formConfig = reactive([
  226. {
  227. type: "radio",
  228. prop: "status",
  229. label: "跟进结果",
  230. required: true,
  231. border: true,
  232. data: [
  233. { label: "完成", value: "1" },
  234. { label: "跟进中", value: "0" },
  235. ],
  236. },
  237. {
  238. type: "select",
  239. prop: "handleUser",
  240. label: "跟进人",
  241. isLoad: {
  242. url: `/tenantUser/list?pageNum=1&pageSize=9999&tenantId=${
  243. useUserStore().user.tenantId
  244. }`,
  245. labelKey: "nickName",
  246. labelVal: "userId",
  247. method: "get",
  248. resUrl: "rows",
  249. },
  250. },
  251. {
  252. type: "select",
  253. prop: "nextHandleUser",
  254. label: "下一跟进人",
  255. isLoad: {
  256. url: `/tenantUser/list?pageNum=1&pageSize=9999&tenantId=${
  257. useUserStore().user.tenantId
  258. }`,
  259. labelKey: "nickName",
  260. labelVal: "userId",
  261. method: "get",
  262. resUrl: "rows",
  263. },
  264. },
  265. {
  266. type: "date",
  267. itemType: "datetime",
  268. prop: "handleTime",
  269. label: "跟进时间",
  270. },
  271. {
  272. type: "select",
  273. prop: "processing",
  274. label: "处理方式",
  275. },
  276. {
  277. type: "input",
  278. itemType: "textarea",
  279. prop: "explain",
  280. label: "处理说明",
  281. },
  282. ]);
  283. const getList = async (req) => {
  284. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  285. loading.value = true;
  286. proxy
  287. .post("/abnormalInfo/page", sourceList.value.pagination)
  288. .then((message) => {
  289. console.log(message);
  290. sourceList.value.data = message.rows;
  291. // sourceList.value.data = [{}];
  292. sourceList.value.pagination.total = message.total;
  293. setTimeout(() => {
  294. loading.value = false;
  295. }, 200);
  296. });
  297. };
  298. const openModal = () => {
  299. dialogVisible.value = true;
  300. modalType.value = "add";
  301. formData.data = {};
  302. };
  303. const activities = ref([]);
  304. const submitForm = () => {
  305. console.log(byform.value);
  306. byform.value.handleSubmit((valid) => {
  307. submitLoading.value = true;
  308. proxy.post("/abnormalDetails/" + modalType.value, formData.data).then(
  309. (res) => {
  310. ElMessage({
  311. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  312. type: "success",
  313. });
  314. dialogVisible.value = false;
  315. submitLoading.value = false;
  316. getList();
  317. },
  318. (err) => (submitLoading.value = false)
  319. );
  320. });
  321. };
  322. const getDtl = (row) => {
  323. modalType.value = "add";
  324. formData.data.status = "0";
  325. dialogVisible.value = true;
  326. // proxy.post("/warehouse/detail", { id: row.id }).then((res) => {
  327. // res.type = res.type + "";
  328. // formData.data = res;
  329. // console.log(formData);
  330. // dialogVisible.value = true;
  331. // });
  332. };
  333. const warehouseType = ref([]);
  334. const getDict = () => {
  335. // // 币种数据
  336. proxy
  337. .post("/dictTenantData/page", {
  338. pageNum: 1,
  339. pageSize: 999,
  340. tenantId: useUserStore().user.tenantId,
  341. dictCode: "warehouse_type",
  342. })
  343. .then((res) => {
  344. warehouseType.value = res.rows;
  345. selectConfig[0].data = res.rows.map((x) => ({
  346. label: x.dictValue,
  347. value: x.dictKey,
  348. }));
  349. formConfig[0].data = res.rows.map((x) => ({
  350. label: x.dictValue,
  351. value: x.dictKey,
  352. }));
  353. });
  354. };
  355. getList();
  356. // getDict();
  357. </script>
  358. <style lang="scss" scoped>
  359. .tenant {
  360. padding: 20px;
  361. }
  362. </style>