index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <template>
  2. <div class="content">
  3. <el-form :inline="true" :model="sourceList.pagination" class="demo-form-inline">
  4. <el-form-item label="销售合同号:" prop="code">
  5. <el-input v-model="sourceList.pagination.code" placeholder="请输入销售合同号" />
  6. </el-form-item>
  7. <el-form-item label="业务员:" prop="userId">
  8. <el-select v-model="sourceList.pagination.userId" placeholder="请选择业务员">
  9. <el-option v-for="item in userList" :key="item.value" :label="item.label" :value="item.value"> </el-option>
  10. </el-select>
  11. </el-form-item>
  12. <el-form-item>
  13. <el-button type="primary" @click="getList">搜索</el-button>
  14. </el-form-item>
  15. </el-form>
  16. <div style="padding: 10px 20px; width: 100%; box-sizing: border-box">
  17. <div style="width: 100%; display: flex; padding-bottom: 5px; overflow-x: auto" class="topScrollDom" @scroll="handleScroll($event, true)">
  18. <div v-for="(item, index) in purchaseTrackType" :key="index" style="display: flex; align-items: center">
  19. <div style="width: 200px; height: 80px; position: relative" @click="selectRegion(item)">
  20. <div :class="selectRecordDocumentaryId === item.id ? 'regionSelect' : 'regionNoSelect'" style="cursor: pointer">
  21. <div style="color: #333333; font-size: 13px; font-weight: 700">{{ item.count }}</div>
  22. <div style="color: #333333; font-size: 12px; font-weight: 700">{{ item.name }}</div>
  23. <div class="right-bottom" style="position: absolute; right: 0; bottom: 0">
  24. {{ index + 1 }}
  25. </div>
  26. </div>
  27. <el-icon class="beacon" v-if="index < purchaseTrackType.length - 1"><CaretRight /></el-icon>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. <div class="main-content" v-loading="loading">
  33. <el-card class="box-card" v-for="(item, index) in sourceList.data" :key="index" style="margin-bottom: 20px">
  34. <template #header>
  35. <el-row>
  36. <el-col :span="4">
  37. <span>销售合同号: </span>
  38. <span style="cursor: pointer; color: #66b1ff">
  39. {{ item.code }}
  40. </span>
  41. </el-col>
  42. <el-col :span="4">
  43. <span>业务员: {{ item.userName }}</span>
  44. </el-col>
  45. <el-col :span="4">
  46. <span>客户名称: {{ item.customerName }}</span>
  47. </el-col>
  48. <el-col :span="12">
  49. <span>合同金额: {{ item.currency }}{{ item.amount }}</span>
  50. </el-col>
  51. </el-row>
  52. </template>
  53. <div style="overflow-x: auto; width: 100%" class="scrollDom" @scroll="handleScroll($event, false, index)">
  54. <el-steps :space="200" align-center>
  55. <el-step v-for="(itemType, key) in purchaseTrackType" :key="key" :title="itemType.name" :status="getStatus(itemType, item)" />
  56. </el-steps>
  57. <div style="display: flex">
  58. <div v-for="(itemType, key) in purchaseTrackType" :key="key" style="width: 200px !important; min-width: 200px !important">
  59. <div style="padding: 8px 0; text-align: center">
  60. <el-icon style="color: #409eff; cursor: pointer" @click="clickAdd(item, itemType)"><EditPen /></el-icon>
  61. </div>
  62. <div style="text-align: center" v-if="item.documentaryRecord && item.documentaryRecord[itemType.id]">
  63. <el-tooltip class="box-item" effect="light" placement="bottom">
  64. <template #content>
  65. <div style="max-width: 400px; max-height: 50vh; overflow-y: auto">
  66. <el-timeline>
  67. <el-timeline-item
  68. v-for="(activity, index) in item.documentaryRecord[itemType.id]"
  69. :key="index"
  70. :timestamp="activity.createTime"
  71. :hide-timestamp="true">
  72. <div style="background-color: #e2fbe8; padding: 8px">
  73. <div style="font-size: 12px">{{ activity.createTime }}</div>
  74. <div style="font-size: 12px" v-html="getStyle(activity.remark)"></div>
  75. <div v-if="activity.fileList && activity.fileList.length > 0">
  76. <div v-for="(file, index) in activity.fileList" :key="index">
  77. <a style="color: #409eff; cursor: pointer" @click="openFile(file.fileUrl)">{{ file.fileName }}</a>
  78. </div>
  79. </div>
  80. </div>
  81. </el-timeline-item>
  82. </el-timeline>
  83. </div>
  84. </template>
  85. <span style="color: #409eff; cursor: pointer; padding: 8px 0; font-size: 12px">跟单详情</span>
  86. </el-tooltip>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </el-card>
  92. </div>
  93. <el-row style="padding-top: 20px" justify="end" type="flex">
  94. <el-pagination
  95. background
  96. layout="total, sizes, prev, pager, next, jumper"
  97. :current-page="sourceList.pagination.pageNum"
  98. :page-size="sourceList.pagination.pageSize"
  99. :total="sourceList.pagination.total"
  100. @size-change="handleSizeChange"
  101. @current-change="handlePageChange" />
  102. </el-row>
  103. <el-dialog :title="title" v-if="dialogVisible" v-model="dialogVisible" width="600" v-loading="loadingDialog">
  104. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
  105. <template #completionTime>
  106. <div>
  107. <el-date-picker v-model="formData.data.completionTime" type="datetime" placeholder="请选择完成时间" value-format="YYYY-MM-DD HH:mm:ss" />
  108. </div>
  109. </template>
  110. <template #file>
  111. <div style="width: 100%">
  112. <el-upload
  113. v-model:fileList="fileList"
  114. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  115. :data="uploadData"
  116. multiple
  117. :before-upload="uploadFile"
  118. :on-preview="onPreviewFile">
  119. <el-button>选择</el-button>
  120. </el-upload>
  121. </div>
  122. </template>
  123. </byForm>
  124. <template #footer>
  125. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  126. <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
  127. </template>
  128. </el-dialog>
  129. </div>
  130. </template>
  131. <script setup>
  132. import { ref, computed } from "vue";
  133. import useUserStore from "@/store/modules/user";
  134. import byForm from "@/components/byForm/index";
  135. import { ElMessage } from "element-plus";
  136. const { proxy } = getCurrentInstance();
  137. const userList = ref([]);
  138. const purchaseTrackType = ref([]);
  139. const sourceList = ref({
  140. data: [],
  141. pagination: {
  142. total: 0,
  143. pageNum: 1,
  144. pageSize: 10,
  145. code: "",
  146. userId: "",
  147. },
  148. });
  149. const timer = ref(null);
  150. const loading = ref(false);
  151. const handleScroll = (event, flag, index) => {
  152. const listDom = document.querySelectorAll(".scrollDom");
  153. let scroll_left;
  154. if (index !== " " && index !== undefined) {
  155. scroll_left = listDom[index].scrollLeft;
  156. }
  157. if (timer.value) {
  158. clearTimeout(timer.value);
  159. }
  160. if (flag) {
  161. timer.value = setTimeout(() => {
  162. const list = document.querySelectorAll(".scrollDom");
  163. for (let i = 0; i < list.length; i++) {
  164. const ele = list[i];
  165. ele.scrollLeft = event.target.scrollLeft;
  166. }
  167. }, 200);
  168. } else {
  169. timer.value = setTimeout(() => {
  170. const topScroll = document.querySelector(".topScrollDom");
  171. topScroll.scrollLeft = scroll_left;
  172. const list = document.querySelectorAll(".scrollDom");
  173. for (let i = 0; i < list.length; i++) {
  174. const ele = list[i];
  175. ele.scrollLeft = scroll_left;
  176. }
  177. }, 200);
  178. }
  179. };
  180. const getDict = () => {
  181. proxy.get("/tenantUser/list", { pageNum: 1, pageSize: 10000, tenantId: useUserStore().user.tenantId }).then((res) => {
  182. if (res.rows && res.rows.length > 0) {
  183. userList.value = res.rows.map((item) => {
  184. return {
  185. label: item.nickName,
  186. value: item.userId,
  187. };
  188. });
  189. }
  190. });
  191. };
  192. const selectRecordDocumentaryId = ref("");
  193. const getList = () => {
  194. loading.value = true;
  195. proxy
  196. .post("/documentaryRecord/info", {
  197. type: "1",
  198. pageNum: sourceList.value.pagination.pageNum,
  199. pageSize: sourceList.value.pagination.pageSize,
  200. condition: {
  201. code: sourceList.value.pagination.code,
  202. userId: sourceList.value.pagination.userId,
  203. },
  204. noRecordDocumentaryId: selectRecordDocumentaryId.value,
  205. })
  206. .then(
  207. (res) => {
  208. purchaseTrackType.value = res.documentaryList;
  209. sourceList.value.data = res.page.rows;
  210. sourceList.value.pagination.total = res.page.total;
  211. setTimeout(() => {
  212. loading.value = false;
  213. }, 200);
  214. },
  215. (err) => {
  216. console.log(err);
  217. loading.value = false;
  218. }
  219. );
  220. };
  221. getDict();
  222. getList();
  223. const handleSizeChange = (val) => {
  224. sourceList.value.pagination.pageNum = 1;
  225. sourceList.value.pagination.pageSize = val;
  226. getList();
  227. };
  228. const handlePageChange = (val) => {
  229. sourceList.value.pagination.pageSize = val;
  230. getList();
  231. };
  232. const selectRegion = (item) => {
  233. sourceList.value.pagination.pageNum = 1;
  234. if (selectRecordDocumentaryId.value && selectRecordDocumentaryId.value === item.id) {
  235. selectRecordDocumentaryId.value = "";
  236. } else {
  237. selectRecordDocumentaryId.value = item.id;
  238. }
  239. getList();
  240. };
  241. const getStatus = (typeItem, row) => {
  242. if (row.documentaryRecord && row.documentaryRecord[typeItem.id] && row.documentaryRecord[typeItem.id].length > 0) {
  243. return "success";
  244. }
  245. return "process";
  246. };
  247. const title = ref("");
  248. const dialogVisible = ref(false);
  249. const loadingDialog = ref(false);
  250. const submit = ref(null);
  251. const formOption = reactive({
  252. inline: true,
  253. labelWidth: 100,
  254. itemWidth: 100,
  255. rules: [],
  256. });
  257. const formData = reactive({
  258. data: {
  259. fileList: [],
  260. },
  261. });
  262. const fileList = ref([]);
  263. const uploadData = ref({});
  264. const formConfig = computed(() => {
  265. return [
  266. {
  267. type: "slot",
  268. prop: "completionTime",
  269. slotName: "completionTime",
  270. label: "完成时间",
  271. },
  272. {
  273. type: "slot",
  274. prop: "file",
  275. slotName: "file",
  276. label: "上传附件",
  277. },
  278. {
  279. type: "input",
  280. prop: "remark",
  281. label: "摘要",
  282. itemType: "textarea",
  283. },
  284. ];
  285. });
  286. const rules = ref({
  287. completionTime: [{ required: true, message: "请选择完成时间", trigger: "change" }],
  288. });
  289. const clickAdd = (item, row) => {
  290. title.value = "编辑: " + row.name;
  291. formData.data = {
  292. documentaryId: row.id,
  293. businessId: item.id,
  294. completionTime: "",
  295. remark: "",
  296. fileList: [],
  297. };
  298. loadingDialog.value = false;
  299. dialogVisible.value = true;
  300. };
  301. const uploadFile = async (file) => {
  302. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  303. uploadData.value = res.uploadBody;
  304. file.id = res.id;
  305. file.fileName = res.fileName;
  306. file.fileUrl = res.fileUrl;
  307. return true;
  308. };
  309. const onPreviewFile = (file) => {
  310. window.open(file.raw.fileUrl, "_blank");
  311. };
  312. const submitForm = () => {
  313. submit.value.handleSubmit(() => {
  314. if (fileList.value && fileList.value.length > 0) {
  315. formData.data.fileList = fileList.value.map((item) => {
  316. return {
  317. id: item.raw.id,
  318. fileName: item.raw.fileName,
  319. fileUrl: item.raw.fileUrl,
  320. };
  321. });
  322. }
  323. loadingDialog.value = true;
  324. proxy.post("/documentaryRecord/add", formData.data).then(
  325. () => {
  326. ElMessage({
  327. message: "编辑成功",
  328. type: "success",
  329. });
  330. dialogVisible.value = false;
  331. getList();
  332. },
  333. (err) => {
  334. console.log(err);
  335. loadingDialog.value = false;
  336. }
  337. );
  338. });
  339. };
  340. const getStyle = (text) => {
  341. if (text) {
  342. return text.replace(/\n|\r\n/g, "<br>");
  343. } else {
  344. return "";
  345. }
  346. };
  347. const openFile = (path) => {
  348. window.open(path, "_blank");
  349. };
  350. </script>
  351. <style lang="scss" scoped>
  352. .content {
  353. margin: 20px;
  354. padding: 20px;
  355. background-color: white;
  356. height: calc(100vh - 140px);
  357. }
  358. .right-bottom {
  359. color: #fff;
  360. width: 20px;
  361. height: 20px;
  362. line-height: 20px;
  363. text-align: center;
  364. background: url("/img/jc.png") no-repeat;
  365. background-size: 20px 20px;
  366. }
  367. .topScrollDom {
  368. .regionSelect {
  369. background: linear-gradient(#ffd9d9, #eff6ff);
  370. border-radius: 10px;
  371. flex: 1;
  372. width: 160px;
  373. height: 80px;
  374. text-align: center;
  375. display: flex;
  376. flex-direction: column;
  377. justify-content: space-around;
  378. position: relative;
  379. margin-left: 20px;
  380. }
  381. .regionNoSelect {
  382. background: linear-gradient(#d9edff, #eff6ff);
  383. border-radius: 10px;
  384. flex: 1;
  385. width: 160px;
  386. height: 80px;
  387. text-align: center;
  388. display: flex;
  389. flex-direction: column;
  390. justify-content: space-around;
  391. position: relative;
  392. margin-left: 20px;
  393. }
  394. .beacon {
  395. margin: 0px 10px;
  396. color: #46a6ff;
  397. width: 20px;
  398. height: 20px;
  399. line-height: 20px;
  400. text-align: center;
  401. background-color: #eff6ff;
  402. border-radius: 10px;
  403. position: absolute;
  404. right: -20px;
  405. top: 30px;
  406. }
  407. }
  408. .main-content {
  409. margin-top: 20px;
  410. height: calc(100vh - 140px - 232px - 52px);
  411. overflow: auto;
  412. &::-webkit-scrollbar {
  413. width: 0px;
  414. height: 0px;
  415. }
  416. }
  417. .scrollDom {
  418. &::-webkit-scrollbar {
  419. width: 0px;
  420. height: 0px;
  421. }
  422. }
  423. ::v-deep(.el-card__header) {
  424. background-color: #f4f4f5;
  425. padding: 14px 15px !important;
  426. font-size: 14px !important;
  427. }
  428. .el-steps {
  429. display: block !important;
  430. }
  431. ::v-deep(.el-step__title) {
  432. width: 200px;
  433. }
  434. ::v-deep(.el-timeline) {
  435. padding: 8px !important;
  436. }
  437. </style>