raiAllocationPage.vue 9.1 KB

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