index.vue 8.1 KB

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