raiAllocationPage.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <div class="container rai-allocation-page">
  3. <div class="dataReport-top">
  4. <a :href="exportExcel" download>
  5. <button class="button-sty act">导出EXCEL</button>
  6. </a>
  7. <button :class="['button-sty', { act: filterObj.month === item.label }]" v-for="item in monthLabel" @click="toggleMonth(item.label)" :key="item.label">
  8. {{ item.label }}
  9. </button>
  10. <date-picker v-model="filterObj.date" type="date" range value-type="format" placeholder="自定义时间段" clearable :editable="false" :disabled-date="disabledBeforeToday" @change="dateChange" />
  11. <el-input placeholder="请输入客户名称" v-model.trim="searchVal" style="width: 400px; margin-left: auto" @input="handleSearch" clearable>
  12. <i slot="prefix" class="el-input__icon el-icon-search"></i>
  13. </el-input>
  14. </div>
  15. <el-card style="margin-top: 20px">
  16. <div style="margin-bottom: 30px">
  17. <el-select v-model="filterObj.type" placeholder="转正类型" style="width: 230px; margin-right: 20px" clearable @change="changeFilter">
  18. <el-option v-for="item in typeArr" :key="item" :label="item.label" :value="item.value"> </el-option>
  19. </el-select>
  20. <el-select v-model="filterObj.contractType" placeholder="合同类型" style="width: 230px; margin-right: 20px" clearable @change="changeFilter">
  21. <el-option v-for="item in contractTypeArr" :key="item" :label="item.label" :value="item.value"> </el-option>
  22. </el-select>
  23. <el-cascader
  24. v-model="filterObj.sale"
  25. placeholder="请选择销售"
  26. style="width: 230px; margin-right: 20px"
  27. :options="salesArr"
  28. :props="defaultSalesProps"
  29. :show-all-levels="false"
  30. collapse-tags
  31. clearable
  32. filterable
  33. @change="changeFilter"
  34. >
  35. </el-cascader>
  36. <el-select v-model="filterObj.status" placeholder="派点状态" style="width: 230px; margin-right: 20px" clearable @change="changeFilter">
  37. <el-option v-for="item in typeArrStatus" :key="item" :label="item.label" :value="item.value"> </el-option>
  38. </el-select>
  39. </div>
  40. <allocation-lable :tableList="tableList" @isPreviewHistoryDetail="isPreviewHistoryDetail" @allocationDetailList="allocationDetailList" @allocationDetail="allocationDetail" />
  41. <el-col :span="24" class="toolbar">
  42. <m-page :total="total" :page_no="page_no" :pageSize="10" @handleCurrentChange="handleCurrentChange" />
  43. </el-col>
  44. </el-card>
  45. <allocation-number :allocationVisible.sync="allocationVisible" :allocationForm.sync="allocationForm" />
  46. <allocation-detail @allocationDetailList="allocationDetailList" :allocationDetailVisible.sync="allocationDetailVisible" :allocationDetailForm.sync="allocationDetailForm" />
  47. <rai-history-contract :isPreview.sync="isPreview" :dealList.sync="dealList" />
  48. </div>
  49. </template>
  50. <script>
  51. import { dataMainInterface, customInterence, contractInterface } from "@/api/api.js";
  52. import AllocationLable from "./components/allocationLable.vue";
  53. import AllocationNumber from "./components/allocationNumber.vue";
  54. import AllocationDetail from "./components/allocationDetail.vue";
  55. import mPage from "@/components/mPage.vue";
  56. import RaiHistoryContract from "./components/raiHistoryContract.vue";
  57. var moment = require("moment");
  58. moment().format();
  59. export default {
  60. name: "",
  61. components: { AllocationLable, AllocationNumber, AllocationDetail, mPage, RaiHistoryContract },
  62. props: {},
  63. data() {
  64. return {
  65. /* 筛选条件 */
  66. filterObj: {
  67. month: "",
  68. date: [],
  69. type: "",
  70. sale: "",
  71. area: "",
  72. status: "",
  73. contractType: "",
  74. },
  75. monthLabel: [
  76. {
  77. label: "近1个月",
  78. },
  79. {
  80. label: "近2个月",
  81. },
  82. {
  83. label: "近3个月",
  84. },
  85. ],
  86. searchVal: "",
  87. typeArr: [
  88. {
  89. value: "非标",
  90. label: "非标合同",
  91. },
  92. {
  93. value: "标准",
  94. label: "标准合同",
  95. },
  96. ],
  97. typeArrStatus: [
  98. {
  99. value: "0",
  100. label: "未派点",
  101. },
  102. {
  103. value: "1",
  104. label: "已派点",
  105. },
  106. ],
  107. salesArr: [], //销售列表
  108. contractTypeArr: [
  109. {
  110. value: "新签合同",
  111. label: "新签合同",
  112. },
  113. {
  114. value: "续约合同",
  115. label: "续约合同",
  116. },
  117. {
  118. value: "补充协议",
  119. label: "补充协议",
  120. },
  121. {
  122. value: "打分派点",
  123. label: "打分派点",
  124. },
  125. ], // 合同类型
  126. statusArr: [], // 派点状态
  127. defaultSalesProps: {
  128. multiple: true,
  129. label: "RealName",
  130. children: "ChildrenList",
  131. value: "AdminId",
  132. }, //销售级联配置
  133. tableList: [],
  134. allocationVisible: false, // 派点
  135. allocationForm: {}, // 派点
  136. allocationDetailVisible: false, // 派点详情
  137. allocationDetailForm: {}, // 派点详情
  138. page_no: 1,
  139. total: 0, //条数
  140. PageSize: 10, //每页显示几条
  141. isPreview: false,
  142. dealList: [],
  143. };
  144. },
  145. computed: {
  146. exportExcel() {
  147. let baseUrl = process.env.API_ROOT + "/cygx/allocation/company_contract_list";
  148. let token = localStorage.getItem("auth") || "";
  149. let paramStr = "";
  150. let salesArr = [];
  151. if (this.filterObj.sale.length) {
  152. salesArr = this.filterObj.sale.map((item) => {
  153. return item[item.length - 1];
  154. });
  155. }
  156. let obj = {
  157. IsExport: true,
  158. FormalType: this.filterObj.type,
  159. ContractType: this.filterObj.contractType,
  160. PageSize: this.PageSize,
  161. CurrentIndex: this.page_no,
  162. Keyword: this.searchVal,
  163. AdminId: salesArr.join(","),
  164. IsAllocation: this.filterObj.status,
  165. StartDate: this.filterObj.date[0] ? this.filterObj.date[0] : "",
  166. EndDate: this.filterObj.date[1] ? this.filterObj.date[1] : "",
  167. };
  168. for (let key in obj) {
  169. paramStr = `${paramStr}&${key}=${obj[key]}`;
  170. }
  171. return `${baseUrl}?${token}${paramStr}`;
  172. },
  173. },
  174. watch: {},
  175. created() {},
  176. mounted() {
  177. this.getSale();
  178. this.getTableData();
  179. },
  180. methods: {
  181. /* 切换月份 */
  182. toggleMonth(label) {
  183. this.filterObj.month = label;
  184. let days = label == "近1个月" ? 1 : label == "近2个月" ? 2 : label == "近3个月" ? 3 : 0;
  185. this.filterDate(days);
  186. },
  187. /* 获取近几个月的日期范围 */
  188. filterDate(month) {
  189. if (month) {
  190. let date_now = moment().format("YYYY-MM-DD");
  191. let date_after = moment().add(-month, "M").format("YYYY-MM-DD");
  192. let date = [date_after, date_now];
  193. this.start_date = date_now;
  194. this.end_date = date_after;
  195. this.filterObj.date = date;
  196. this.page_no = 1;
  197. this.searchVal = "";
  198. this.getTableData();
  199. }
  200. },
  201. /* 获取销售 */
  202. getSale() {
  203. customInterence.getSale().then((res) => {
  204. if (res.Ret === 200) {
  205. this.salesArr = res.Data.List;
  206. }
  207. });
  208. },
  209. async getTableData() {
  210. let salesArr = [];
  211. if (this.filterObj.sale.length) {
  212. salesArr = this.filterObj.sale.map((item) => {
  213. return item[item.length - 1];
  214. });
  215. }
  216. const res = await contractInterface.getAllocationContract({
  217. FormalType: this.filterObj.type,
  218. ContractType: this.filterObj.contractType,
  219. PageSize: this.PageSize,
  220. CurrentIndex: this.page_no,
  221. Keyword: this.searchVal,
  222. AdminId: salesArr.join(","),
  223. IsAllocation: this.filterObj.status,
  224. StartDate: this.filterObj.date[0] ? this.filterObj.date[0] : "",
  225. EndDate: this.filterObj.date[1] ? this.filterObj.date[1] : "",
  226. });
  227. if (res.Ret === 200) {
  228. this.tableList = res.Data.List;
  229. this.total = res.Data.Paging.Totals;
  230. }
  231. },
  232. changeFilter() {
  233. this.page_no = 1;
  234. this.getTableData();
  235. },
  236. handleSearch() {
  237. this.getTableData();
  238. },
  239. //分页
  240. handleCurrentChange(page) {
  241. this.page_no = page;
  242. this.getTableData();
  243. },
  244. // 非标准预览
  245. isPreviewHistoryDetail(res) {
  246. this.isPreview = true;
  247. this.dealList = res.Data.List;
  248. },
  249. // 派点
  250. allocationDetailList(item) {
  251. this.allocationForm = item;
  252. this.allocationVisible = true;
  253. },
  254. // 派点详情
  255. allocationDetail(item) {
  256. this.allocationDetailVisible = true;
  257. this.allocationDetailForm = item;
  258. },
  259. /* 选择日期 */
  260. dateChange(e) {
  261. this.page_no = 1;
  262. this.getTableData();
  263. },
  264. },
  265. };
  266. </script>
  267. <style scoped lang="scss">
  268. .rai-allocation-page {
  269. .dataReport-top {
  270. display: flex;
  271. align-items: center;
  272. border: 1px solid #ececec;
  273. padding: 20px 30px;
  274. background: #fff;
  275. border-radius: 4px;
  276. box-shadow: 0 3px 6px rgba(0, 0, 0, 0.05);
  277. .button-sty {
  278. margin-right: 20px;
  279. border: none;
  280. padding: 6px 12px;
  281. background: #e0eefd;
  282. color: #2d8cf0;
  283. cursor: pointer;
  284. border-radius: 4px;
  285. &.act {
  286. background: #409eff;
  287. color: #fff;
  288. }
  289. }
  290. }
  291. }
  292. </style>