index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422
  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-dialog :title="title" v-if="dialogVisible" v-model="dialogVisible" width="600" v-loading="loadingDialog">
  94. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
  95. <template #completionTime>
  96. <div>
  97. <el-date-picker v-model="formData.data.completionTime" type="datetime" placeholder="请选择完成时间" value-format="YYYY-MM-DD HH:mm:ss" />
  98. </div>
  99. </template>
  100. <template #file>
  101. <div style="width: 100%">
  102. <el-upload
  103. v-model:fileList="fileList"
  104. action="https://winfaster.obs.cn-south-1.myhuaweicloud.com"
  105. :data="uploadData"
  106. multiple
  107. :before-upload="uploadFile"
  108. :on-preview="onPreviewFile">
  109. <el-button>选择</el-button>
  110. </el-upload>
  111. </div>
  112. </template>
  113. </byForm>
  114. <template #footer>
  115. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  116. <el-button type="primary" @click="submitForm()" size="large">确 定</el-button>
  117. </template>
  118. </el-dialog>
  119. </div>
  120. </template>
  121. <script setup>
  122. import { ref, computed } from "vue";
  123. import useUserStore from "@/store/modules/user";
  124. import byForm from "@/components/byForm/index";
  125. import { ElMessage } from "element-plus";
  126. const { proxy } = getCurrentInstance();
  127. const userList = ref([]);
  128. const purchaseTrackType = ref([]);
  129. const sourceList = ref({
  130. data: [],
  131. pagination: {
  132. total: 0,
  133. pageNum: 1,
  134. pageSize: 10,
  135. code: "",
  136. userId: "",
  137. },
  138. });
  139. const timer = ref(null);
  140. const loading = ref(false);
  141. const handleScroll = (event, flag, index) => {
  142. const listDom = document.querySelectorAll(".scrollDom");
  143. let scroll_left;
  144. if (index !== " " && index !== undefined) {
  145. scroll_left = listDom[index].scrollLeft;
  146. }
  147. if (timer.value) {
  148. clearTimeout(timer.value);
  149. }
  150. if (flag) {
  151. timer.value = setTimeout(() => {
  152. const list = document.querySelectorAll(".scrollDom");
  153. for (let i = 0; i < list.length; i++) {
  154. const ele = list[i];
  155. ele.scrollLeft = event.target.scrollLeft;
  156. }
  157. }, 200);
  158. } else {
  159. timer.value = setTimeout(() => {
  160. const topScroll = document.querySelector(".topScrollDom");
  161. topScroll.scrollLeft = scroll_left;
  162. const list = document.querySelectorAll(".scrollDom");
  163. for (let i = 0; i < list.length; i++) {
  164. const ele = list[i];
  165. ele.scrollLeft = scroll_left;
  166. }
  167. }, 200);
  168. }
  169. };
  170. const getDict = () => {
  171. proxy.get("/tenantUser/list", { pageNum: 1, pageSize: 10000, tenantId: useUserStore().user.tenantId }).then((res) => {
  172. if (res.rows && res.rows.length > 0) {
  173. userList.value = res.rows.map((item) => {
  174. return {
  175. label: item.userName,
  176. value: item.userId,
  177. };
  178. });
  179. }
  180. });
  181. };
  182. const selectRecordDocumentaryId = ref("");
  183. const getList = () => {
  184. loading.value = true;
  185. proxy
  186. .post("/documentaryRecord/info", {
  187. type: "1",
  188. pageNum: sourceList.value.pagination.pageNum,
  189. pageSize: sourceList.value.pagination.pageSize,
  190. condition: {
  191. code: sourceList.value.pagination.code,
  192. userId: sourceList.value.pagination.userId,
  193. },
  194. noRecordDocumentaryId: selectRecordDocumentaryId.value,
  195. })
  196. .then(
  197. (res) => {
  198. purchaseTrackType.value = res.documentaryList;
  199. sourceList.value.data = res.page.rows;
  200. sourceList.value.pagination.total = res.page.total;
  201. setTimeout(() => {
  202. loading.value = false;
  203. }, 200);
  204. },
  205. (err) => {
  206. console.log(err);
  207. loading.value = false;
  208. }
  209. );
  210. };
  211. getDict();
  212. getList();
  213. const selectRegion = (item) => {
  214. sourceList.value.pagination.pageNum = 1;
  215. if (selectRecordDocumentaryId.value && selectRecordDocumentaryId.value === item.id) {
  216. selectRecordDocumentaryId.value = "";
  217. } else {
  218. selectRecordDocumentaryId.value = item.id;
  219. }
  220. getList();
  221. };
  222. const getStatus = (typeItem, row) => {
  223. if (row.documentaryRecord && row.documentaryRecord[typeItem.id] && row.documentaryRecord[typeItem.id].length > 0) {
  224. return "success";
  225. }
  226. return "process";
  227. };
  228. const title = ref("");
  229. const dialogVisible = ref(false);
  230. const loadingDialog = ref(false);
  231. const submit = ref(null);
  232. const formOption = reactive({
  233. inline: true,
  234. labelWidth: 100,
  235. itemWidth: 100,
  236. rules: [],
  237. });
  238. const formData = reactive({
  239. data: {
  240. fileList: [],
  241. },
  242. });
  243. const fileList = ref([]);
  244. const uploadData = ref({});
  245. const formConfig = computed(() => {
  246. return [
  247. {
  248. type: "slot",
  249. prop: "completionTime",
  250. slotName: "completionTime",
  251. label: "完成时间",
  252. },
  253. {
  254. type: "slot",
  255. prop: "file",
  256. slotName: "file",
  257. label: "上传附件",
  258. },
  259. {
  260. type: "input",
  261. prop: "remark",
  262. label: "摘要",
  263. itemType: "textarea",
  264. },
  265. ];
  266. });
  267. const rules = ref({
  268. completionTime: [{ required: true, message: "请选择完成时间", trigger: "change" }],
  269. });
  270. const clickAdd = (item, row) => {
  271. title.value = "编辑: " + row.name;
  272. formData.data = {
  273. documentaryId: row.id,
  274. businessId: item.id,
  275. completionTime: "",
  276. remark: "",
  277. fileList: [],
  278. };
  279. loadingDialog.value = false;
  280. dialogVisible.value = true;
  281. };
  282. const uploadFile = async (file) => {
  283. const res = await proxy.post("/fileInfo/getSing", { fileName: file.name });
  284. uploadData.value = res.uploadBody;
  285. file.id = res.id;
  286. file.fileName = res.fileName;
  287. file.fileUrl = res.fileUrl;
  288. return true;
  289. };
  290. const onPreviewFile = (file) => {
  291. window.open(file.raw.fileUrl, "_blank");
  292. };
  293. const submitForm = () => {
  294. submit.value.handleSubmit(() => {
  295. if (fileList.value && fileList.value.length > 0) {
  296. formData.data.fileList = fileList.value.map((item) => {
  297. return {
  298. id: item.raw.id,
  299. fileName: item.raw.fileName,
  300. fileUrl: item.raw.fileUrl,
  301. };
  302. });
  303. }
  304. loadingDialog.value = true;
  305. proxy.post("/documentaryRecord/add", formData.data).then(
  306. () => {
  307. ElMessage({
  308. message: "编辑成功",
  309. type: "success",
  310. });
  311. dialogVisible.value = false;
  312. getList();
  313. },
  314. (err) => {
  315. console.log(err);
  316. loadingDialog.value = false;
  317. }
  318. );
  319. });
  320. };
  321. const getStyle = (text) => {
  322. if (text) {
  323. return text.replace(/\n|\r\n/g, "<br>");
  324. } else {
  325. return "";
  326. }
  327. };
  328. const openFile = (path) => {
  329. window.open(path, "_blank");
  330. };
  331. </script>
  332. <style lang="scss" scoped>
  333. .content {
  334. margin: 20px;
  335. padding: 20px;
  336. background-color: white;
  337. height: calc(100vh - 140px);
  338. }
  339. .right-bottom {
  340. color: #fff;
  341. width: 20px;
  342. height: 20px;
  343. line-height: 20px;
  344. text-align: center;
  345. background: url("/img/jc.png") no-repeat;
  346. background-size: 20px 20px;
  347. }
  348. .topScrollDom {
  349. .regionSelect {
  350. background: linear-gradient(#ffd9d9, #eff6ff);
  351. border-radius: 10px;
  352. flex: 1;
  353. width: 160px;
  354. height: 80px;
  355. text-align: center;
  356. display: flex;
  357. flex-direction: column;
  358. justify-content: space-around;
  359. position: relative;
  360. margin-left: 20px;
  361. }
  362. .regionNoSelect {
  363. background: linear-gradient(#d9edff, #eff6ff);
  364. border-radius: 10px;
  365. flex: 1;
  366. width: 160px;
  367. height: 80px;
  368. text-align: center;
  369. display: flex;
  370. flex-direction: column;
  371. justify-content: space-around;
  372. position: relative;
  373. margin-left: 20px;
  374. }
  375. .beacon {
  376. margin: 0px 10px;
  377. color: #46a6ff;
  378. width: 20px;
  379. height: 20px;
  380. line-height: 20px;
  381. text-align: center;
  382. background-color: #eff6ff;
  383. border-radius: 10px;
  384. position: absolute;
  385. right: -20px;
  386. top: 30px;
  387. }
  388. }
  389. .main-content {
  390. margin-top: 20px;
  391. height: calc(100vh - 140px - 232px);
  392. overflow: auto;
  393. &::-webkit-scrollbar {
  394. width: 0px;
  395. height: 0px;
  396. }
  397. }
  398. .scrollDom {
  399. &::-webkit-scrollbar {
  400. width: 0px;
  401. height: 0px;
  402. }
  403. }
  404. ::v-deep(.el-card__header) {
  405. background-color: #f4f4f5;
  406. padding: 14px 15px !important;
  407. font-size: 14px !important;
  408. }
  409. .el-steps {
  410. display: block !important;
  411. }
  412. ::v-deep(.el-step__title) {
  413. width: 200px;
  414. }
  415. ::v-deep(.el-timeline) {
  416. padding: 8px !important;
  417. }
  418. </style>