index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div>
  3. <basic-container v-if="isShow">
  4. <avue-crud
  5. ref="crud"
  6. :option="option"
  7. :table-loading="loading"
  8. :data="data"
  9. :page.sync="page"
  10. :search.sync="query"
  11. @search-change="searchChange"
  12. @search-reset="searchReset"
  13. @selection-change="selectionChange"
  14. @current-change="currentChange"
  15. @size-change="sizeChange"
  16. @refresh-change="refreshChange"
  17. @on-load="onLoad"
  18. >
  19. <template slot="menuLeft">
  20. <el-button type="primary" size="small" icon="el-icon-plus" @click="addButton">创建单据 </el-button>
  21. </template>
  22. <template slot="menu" slot-scope="{ row, index }">
  23. <el-button size="small" icon="el-icon-edit" type="text" @click="rowEdit(row)">编辑 </el-button>
  24. <el-button
  25. size="small"
  26. icon="el-icon-delete"
  27. type="text"
  28. @click="rowDel(row, index)"
  29. :disabled="row.status > 0"
  30. >删 除
  31. </el-button>
  32. </template>
  33. <template slot="contractNo" slot-scope="{ row }">
  34. <span style="color: #1e9fff; cursor: pointer" @click="rowEdit(row)">
  35. {{ row.contractNo }}
  36. </span>
  37. </template>
  38. </avue-crud>
  39. </basic-container>
  40. <detailsPage v-if="!isShow" :detailData="detailData" @goBack="goBack"></detailsPage>
  41. </div>
  42. </template>
  43. <script>
  44. // @ts-nocheck
  45. import { getList, remove } from "@/api/salesLead/index";
  46. import detailsPage from "./detailsPage.vue";
  47. import { getToken } from "@/util/auth";
  48. export default {
  49. data() {
  50. return {
  51. isShow: true,
  52. form: {},
  53. query: {},
  54. loading: false,
  55. page: {
  56. pageSize: 10,
  57. currentPage: 1,
  58. total: 0,
  59. },
  60. selectionList: [],
  61. option: {
  62. height: "auto",
  63. calcHeight: 30,
  64. menuWidth: 120,
  65. tip: false,
  66. searchShow: true,
  67. searchMenuSpan: 24,
  68. border: true,
  69. index: true,
  70. addBtn: false,
  71. viewBtn: false,
  72. editBtn: false,
  73. delBtn: false,
  74. selection: true,
  75. searchIcon: true,
  76. align: "center",
  77. searchIndex: 3,
  78. column: [
  79. {
  80. label: "线索编号",
  81. prop: "leadCode",
  82. search: true,
  83. overHidden: true,
  84. },
  85. {
  86. label: "提报客户",
  87. prop: "customerName",
  88. width: 90,
  89. search: true,
  90. overHidden: true,
  91. },
  92. {
  93. label: "联系人姓名",
  94. prop: "contactName",
  95. width: 90,
  96. overHidden: true,
  97. },
  98. {
  99. label: "联系电话",
  100. prop: "contactPhone",
  101. overHidden: true,
  102. },
  103. {
  104. label: "提报题目",
  105. prop: "title",
  106. search: true,
  107. overHidden: true,
  108. },
  109. {
  110. label: "结束时间",
  111. prop: "endTime",
  112. overHidden: true,
  113. },
  114. {
  115. label: "优先级",
  116. prop: "priority",
  117. overHidden: true,
  118. },
  119. {
  120. label: "来源",
  121. prop: "source",
  122. width: 80,
  123. overHidden: true,
  124. },
  125. {
  126. label: "线索组名称",
  127. prop: "groupName",
  128. search: true,
  129. width: 100,
  130. overHidden: true,
  131. },
  132. // {
  133. // label: '索赔金额',
  134. // prop: 'claimAmount',
  135. // overHidden: true
  136. // },
  137. {
  138. label: "线索状态",
  139. prop: "status",
  140. type: "select",
  141. dicData: [
  142. {
  143. label: "待处理",
  144. value: 0,
  145. },
  146. {
  147. label: "跟进中",
  148. value: 1,
  149. },
  150. {
  151. label: "已转化",
  152. value: 2,
  153. },
  154. {
  155. label: "已关闭",
  156. value: 3,
  157. },
  158. ],
  159. overHidden: true,
  160. },
  161. {
  162. label: "关闭原因",
  163. prop: "closeReason",
  164. overHidden: true,
  165. },
  166. {
  167. label: "备注",
  168. prop: "remark",
  169. overHidden: true,
  170. },
  171. {
  172. label: "制单人",
  173. prop: "createUserName",
  174. overHidden: true,
  175. width: 80,
  176. },
  177. {
  178. label: "制单日期",
  179. prop: "createTime",
  180. type: "date",
  181. overHidden: true,
  182. width: 100,
  183. format: "yyyy-MM-dd",
  184. valueFormat: "yyyy-MM-dd HH:mm:ss",
  185. },
  186. {
  187. label: "修改人",
  188. prop: "updateUserName",
  189. overHidden: true,
  190. width: 80,
  191. },
  192. {
  193. label: "修改日期",
  194. prop: "updateTime",
  195. type: "date",
  196. overHidden: true,
  197. width: 100,
  198. format: "yyyy-MM-dd",
  199. valueFormat: "yyyy-MM-dd HH:mm:ss",
  200. },
  201. ],
  202. },
  203. data: [],
  204. };
  205. },
  206. components: {
  207. detailsPage,
  208. },
  209. created() {},
  210. methods: {
  211. addButton() {
  212. this.isShow = false;
  213. },
  214. /**
  215. * @param {{ id: any; }} row
  216. */
  217. rowEdit(row) {
  218. this.detailData = {
  219. id: row.id,
  220. };
  221. this.isShow = false;
  222. },
  223. // 删除
  224. /**
  225. * @param {{ item: number; id: any; }} row
  226. * @param {any} index
  227. */
  228. rowDel(row, index) {
  229. if (row.item == 1) {
  230. return this.$message.error("存在明细不允许删除");
  231. }
  232. this.$confirm("确定将选择数据删除?", {
  233. confirmButtonText: "确定",
  234. cancelButtonText: "取消",
  235. type: "warning",
  236. }).then(() => {
  237. remove({ ids: row.id }).then((res) => {
  238. this.onLoad(this.page, this.query);
  239. this.$message.success("成功删除");
  240. });
  241. });
  242. },
  243. searchReset() {
  244. this.query = this.$options.data().query;
  245. this.onLoad(this.page);
  246. },
  247. // 搜索按钮点击
  248. /**
  249. * @param {any} params
  250. * @param {() => void} done
  251. */
  252. searchChange(params, done) {
  253. this.page.currentPage = 1;
  254. this.onLoad(this.page, this.query);
  255. done();
  256. },
  257. /**
  258. * @param {any} list
  259. */
  260. selectionChange(list) {
  261. this.selectionList = list;
  262. },
  263. /**
  264. * @param {any} currentPage
  265. */
  266. currentChange(currentPage) {
  267. this.page.currentPage = currentPage;
  268. },
  269. /**
  270. * @param {any} pageSize
  271. */
  272. sizeChange(pageSize) {
  273. this.page.pageSize = pageSize;
  274. },
  275. refreshChange() {
  276. this.onLoad(this.page, this.query);
  277. },
  278. /**
  279. * @param {{ currentPage: any; pageSize: any; }} page
  280. */
  281. onLoad(page, params = {}) {
  282. let obj = {};
  283. obj = {
  284. ...Object.assign(params, this.query),
  285. };
  286. this.loading = true;
  287. getList(page.currentPage, page.pageSize, obj)
  288. .then((res) => {
  289. this.data = res.data.data.records;
  290. this.page.total = res.data.data.total;
  291. this.$nextTick(() => {
  292. this.$refs.crud.doLayout();
  293. // this.$refs.crud.dicInit();
  294. });
  295. })
  296. .finally(() => {
  297. this.loading = false;
  298. });
  299. },
  300. // 详情的返回列表
  301. goBack() {
  302. // 初始化数据
  303. if (JSON.stringify(this.$route.query) != "{}") {
  304. this.$router.$avueRouter.closeTag();
  305. this.$router.push({
  306. path: "/boxManagement/buyContainer/index",
  307. });
  308. }
  309. this.detailData = {};
  310. this.isShow = true;
  311. this.onLoad(this.page, this.query);
  312. },
  313. },
  314. };
  315. </script>
  316. <style lang="scss" scoped>
  317. ::v-deep .el-col-md-8 {
  318. width: 24.33333%;
  319. }
  320. ::v-deep .el-table .cell {
  321. padding-right: 0px !important;
  322. }
  323. ::v-deep .avue-crud .el-table .el-button.el-button--small {
  324. padding: 0px !important;
  325. margin-right: 0px !important;
  326. }
  327. </style>