MarketCustomerResourcesHome.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading">
  3. <div class="mcr-box">
  4. <div class="mcr-head">
  5. <!-- 预计出团量 -->
  6. <!-- <div style="display: flex;margin-bottom: 10px;">
  7. <div style="width:24%">
  8. 预计出团:<span>{{ preDele }}</span>
  9. </div>
  10. <div style="width:24%">
  11. 预计出团总量:<span>{{ groupNumber.preDeleAll }}</span>
  12. </div>
  13. <div style="width:24%">
  14. 已出团:<span>{{ finlishedDele }}</span>
  15. </div>
  16. <div style="width:24%">
  17. 已出团总量:<span>{{ groupNumber.finlishedDeleAll }}</span>
  18. </div>
  19. </div> -->
  20. <div>
  21. <el-select v-model="principalSel" :disabled='isSelect' clearable placeholder="负责人" style="width
  22. :18%">
  23. <el-option v-for="item in principalList" :key="item.id" :label="item.name" :value="item.id">
  24. </el-option>
  25. </el-select>
  26. <el-select v-model="territorySel" clearable placeholder="省 域" style="width
  27. :18%">
  28. <el-option v-for="item in territoryList" :key="item.id" :label="item.name" :value="item.id">
  29. </el-option>
  30. </el-select>
  31. <el-select v-model="clientLvSel" clearable placeholder="客户级别" style="width
  32. :18%">
  33. <el-option v-for="item in clientLvList" :key="item.id" :label="item.name" :value="item.id">
  34. </el-option>
  35. </el-select>
  36. <el-select v-model="clientTypeSel" clearable placeholder="客户类别" style="width
  37. :18%">
  38. <el-option v-for="item in clientTypeList" :key="item.id" :label="item.name" :value="item.id">
  39. </el-option>
  40. </el-select>
  41. <el-select v-model="businessClassSel" clearable placeholder="业务分类" style="width
  42. :18%">
  43. <el-option v-for="item in businessClassList" :key="item.id" :label="item.name" :value="item.id">
  44. </el-option>
  45. </el-select>
  46. </div>
  47. <!-- textbox框 -->
  48. <div style="display: flex;margin-top: 10px;position: relative;">
  49. <div style="width: 30%;">
  50. <el-input v-model="inputLXR" placeholder="联系人"></el-input>
  51. </div>
  52. &nbsp;
  53. <div style="width: 30%;">
  54. <el-input v-model="inputDQ" placeholder="地区"></el-input>
  55. </div>
  56. &nbsp;
  57. <div style="width: 30%;">
  58. <el-input v-model="inputDW" placeholder="单位"></el-input>
  59. </div>
  60. &nbsp;
  61. <div class="btnOp">
  62. <div>
  63. <el-button type="primary" @click="QueryData">查 询</el-button>
  64. </div>
  65. <div style="height: 10px;">
  66. </div>
  67. <div>
  68. <el-button type="primary" @click="Add">新 增</el-button>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <div class="mcr-table">
  74. <el-table :data="PageList" border @select="handleSelect" style="width: 100%">
  75. <el-table-column prop="weight" label="权重" width="50">
  76. <template slot-scope="scope">
  77. <span v-if="scope.row.weight == '393'">A</span>
  78. <span v-else-if="scope.row.weight == '392'">B</span>
  79. <span v-else-if="scope.row.weight == '391'">C</span>
  80. </template>
  81. </el-table-column>
  82. <el-table-column prop="client" label="单位" width="230">
  83. </el-table-column>
  84. <el-table-column prop="contact" label="联系人" width="90">
  85. </el-table-column>
  86. <el-table-column prop="job" label="职位" width="110">
  87. </el-table-column>
  88. <el-table-column prop="telephone" label="手机号" width="120">
  89. </el-table-column>
  90. <el-table-column prop="phone" label="座机号" width="120">
  91. </el-table-column>
  92. <el-table-column prop="location" label="所在区域" width="130">
  93. </el-table-column>
  94. <!-- <el-table-column prop="birthday" label="生日">
  95. </el-table-column> -->
  96. <el-table-column prop="ascribedDepartment" label="业务归属" width="80">
  97. <template slot-scope="scope">
  98. <el-tooltip class="item" effect="dark" placement="top">
  99. <span style="color:royalblue">查看</span>
  100. <div slot="content">
  101. <div v-for="(yw, index) in scope.row.ascribedDepartment" :key="index"
  102. style="text-align: center; width: 100px;padding: 5px;">
  103. {{ yw.name }}
  104. </div>
  105. </div>
  106. </el-tooltip>
  107. </template>
  108. </el-table-column>
  109. <el-table-column prop="ascribedUser" label="负责人" width="85">
  110. <template slot-scope="scope">
  111. <!-- <el-tooltip class="item" effect="dark" placement="top">
  112. <span style="color:royalblue">查看</span>
  113. <div slot="content">
  114. <div v-for="yw in scope.row.ascribedUser"
  115. style="text-align: center; width: 100px;padding: 5px;">
  116. {{ yw.cnName }}
  117. </div>
  118. </div>
  119. </el-tooltip> -->
  120. <div v-for="(yw, index) in scope.row.ascribedUser" :key="index" style="text-align: center;">
  121. {{ yw.cnName }}
  122. </div>
  123. </template>
  124. </el-table-column>
  125. <el-table-column prop="remark" label="备注">
  126. <template slot-scope="scope">
  127. <div id="remark">
  128. <el-tooltip v-show="scope.row.remark != ''" class="item" effect="dark"
  129. :content="scope.row.remark" placement="top">
  130. <span v-if="scope.row.remark.length > 10">{{ scope.row.remark.slice(0, 10) + "..."
  131. }}</span>
  132. <span v-else>{{ scope.row.remark }}</span>
  133. <div slot="content">
  134. <div style="width: 300px;">
  135. {{ scope.row.remark }}
  136. </div>
  137. </div>
  138. </el-tooltip>
  139. </div>
  140. </template>
  141. </el-table-column>
  142. <!-- <el-table-column prop="preDele" label="预计出团">
  143. </el-table-column>
  144. <el-table-column prop="finlishedDele" label="已出团">
  145. </el-table-column> -->
  146. <el-table-column label="操作" width="200">
  147. <template slot-scope="scope">
  148. <el-button type="primary" size="mini" @click="Edit(scope.row)">编
  149. 辑</el-button>
  150. <el-button type="danger" size="mini" @click="Del(scope.row)">删
  151. 除</el-button>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. <div class="block">
  156. <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  157. :current-page.sync="currentPage" :page-sizes="[10, 20]" :page-size="pageSize"
  158. layout="total, sizes, prev, pager, next" :total="total">
  159. </el-pagination>
  160. </div>
  161. </div>
  162. </div>
  163. </div>
  164. </template>
  165. <script>
  166. export default {
  167. data() {
  168. return {
  169. total: 0, //总行数
  170. principalSel: '',
  171. principalList: [],//负责人数据
  172. territorySel: '',
  173. territoryList: [],//省域数据
  174. clientLvSel: '',
  175. clientLvList: [],//客户级别数据
  176. clientTypeSel: '',
  177. clientTypeList: [],//客户类别数据]
  178. businessClassSel: '',
  179. businessClassList: [],//业务分类
  180. PageList: [], //页面数据
  181. currentPage: 1, // 当前页码
  182. pageSize: 10,// 每页的数据条数
  183. loading: true,
  184. inputLXR: '', //联系人
  185. inputDQ: '', //地区
  186. inputDW: '', //单位
  187. pageloadData: {
  188. "portType": 1,
  189. "pageIndex": 1,
  190. "pageSize": 10,
  191. "contact": "",
  192. "location": "",
  193. "client": "",
  194. "userid": "",
  195. "lvlid": 0,
  196. "business": "",
  197. "Range": 0,
  198. "Category": 0,
  199. "operationUserId": 0
  200. },
  201. groupNumber: {
  202. preDeleAll: '',
  203. finlishedDeleAll: ''
  204. },
  205. userId: 0,
  206. token: '',
  207. isSelect: true
  208. }
  209. },
  210. methods: {
  211. //每页条数改变时触发 选择一页显示多少行
  212. handleSizeChange(val) {
  213. this.currentPage = 1;
  214. this.pageSize = val;
  215. this.pageloadData.pageIndex = this.currentPage;
  216. this.pageloadData.pageSize = this.pageSize;
  217. this.pageload();
  218. },
  219. //当前页改变时触发 跳转其他页
  220. handleCurrentChange(val) {
  221. this.loading = true;
  222. console.log("this.currentPage update", this.currentPage)
  223. this.pageloadData.pageIndex = val;
  224. this.pageloadData.pageSize = this.pageSize;
  225. this.pageload();
  226. },
  227. //多选框选中方法
  228. handleSelect(selection, row) {
  229. },
  230. pageload() {
  231. var that = this;
  232. if (this.userId == 21) {
  233. this.isSelect = false;
  234. }
  235. that.pageloadData.operationUserId = that.userId
  236. //初始化界面数据
  237. console.log(that.pageloadData)
  238. this.$axios.post('/api/MarketCustomerResources/QueryNewClientData', that.pageloadData, {
  239. headers: {
  240. 'Authorization': that.token,
  241. },
  242. }).then(resp => {
  243. if (resp.data.code == 200) {
  244. if (resp.data.data == null) {
  245. that.PageList = [];
  246. that.total = 0;
  247. this.$message.error(resp.data.msg);
  248. } else {
  249. that.principalList = resp.data.data.users; //负责人
  250. that.clientLvList = resp.data.data.level;//客户级别
  251. that.clientTypeList = resp.data.data.customerClass;//客户类别
  252. that.territoryList = resp.data.data.province; //省域数据
  253. that.businessClassList = resp.data.data.serviceClass; //业务归属
  254. that.PageList = resp.data.data.clientTableData.pageSource; //table数据
  255. that.total = resp.data.data.clientTableData.pageCount; //总数
  256. that.groupNumber = resp.data.data.groupNumber; //团组出团总数
  257. console.log(that.pageloadData.pageIndex, parseInt(that.pageloadData.pageIndex), 'that.pageloadData.pageIndex')
  258. that.currentPage = parseInt(that.pageloadData.pageIndex);
  259. }
  260. that.loading = false;
  261. } else if (resp.data.code == 400) {
  262. that.PageList = [];
  263. that.total = 0;
  264. that.loading = false;
  265. that.$message.error('暂无数据!');
  266. }
  267. }).catch(err => {
  268. this.$message.error('网络异常!');
  269. this.loading = false;
  270. })
  271. },
  272. //保存权限
  273. saveData() {
  274. var that = this;
  275. },
  276. QueryData() {
  277. this.pageloadData.pageIndex = this.currentPage;
  278. this.pageloadData.pageSize = this.pageSize;
  279. this.pageloadData.location = this.inputDQ; //地区
  280. this.pageloadData.client = this.inputDW; //单位
  281. this.pageloadData.contact = this.inputLXR; //联系人
  282. this.pageloadData.userid = this.principalSel.toString(); //负责人
  283. this.pageloadData.Range = this.territorySel == '' ? 0 : this.territorySel;//省域
  284. this.pageloadData.lvlid = this.clientLvSel == '' ? 0 : this.clientLvSel; //客户级别
  285. this.pageloadData.Category = this.clientTypeSel == '' ? 0 : this.clientTypeSel;//客户类别
  286. this.pageloadData.business = this.businessClassSel.toString();//业务分类
  287. this.pageloadData.operationUserId = this.userId;//
  288. this.pageload();
  289. },
  290. Edit(row) {
  291. localStorage.setItem("mcrPageData", JSON.stringify({
  292. inputLXR: this.inputLXR,
  293. inputDW: this.inputDW,
  294. inputDQ: this.inputDQ,
  295. principalSel: this.principalSel,
  296. territorySel: this.territorySel,
  297. clientLvSel: this.clientLvSel,
  298. clientTypeSel: this.clientTypeSel,
  299. businessClassSel: this.businessClassSel,
  300. pageSize: this.pageSize,
  301. currentPage: this.currentPage,
  302. }));
  303. this.$router.push('/home/MCROper?id=' + row.id);
  304. },
  305. Del(row) {
  306. var that = this;
  307. var delData = {
  308. "portType": 1,
  309. "id": row.id,
  310. "deleteUserId": this.userId
  311. }
  312. console.log(delData);
  313. this.$axios.post('/api/MarketCustomerResources/NewClientDel', delData, {
  314. headers: {
  315. 'Authorization': that.token,
  316. }
  317. }).then(resp => {
  318. if (resp.data.code == 200) {
  319. that.$message({
  320. message: '删除成功!',
  321. type: 'success'
  322. });
  323. } else {
  324. that.$message.error(resp.data.msg);
  325. }
  326. that.pageload();
  327. });
  328. },
  329. Add(row) {
  330. localStorage.setItem("mcrPageData", JSON.stringify({
  331. inputLXR: this.inputLXR,
  332. inputDW: this.inputDW,
  333. inputDQ: this.inputDQ,
  334. principalSel: this.principalSel,
  335. territorySel: this.territorySel,
  336. clientLvSel: this.clientLvSel,
  337. clientTypeSel: this.clientTypeSel,
  338. businessClassSel: this.businessClassSel,
  339. pageSize: this.pageSize,
  340. currentPage: this.currentPage,
  341. }));
  342. this.$router.push('/home/MCROper?id=' + 0);
  343. }
  344. },
  345. mounted() {
  346. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  347. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  348. var mcrPageData = localStorage.getItem("mcrPageData");
  349. if (mcrPageData) {
  350. try {
  351. console.log(mcrPageData);
  352. var json = JSON.parse(mcrPageData);
  353. this.inputLXR = json.inputLXR;
  354. this.inputDW = json.inputDW;
  355. this.inputDQ = json.inputDQ;
  356. this.principalSel = json.principalSel;
  357. this.territorySel = json.territorySel;
  358. this.clientLvSel = json.clientLvSel;
  359. this.clientTypeSel = json.clientTypeSel;
  360. this.businessClassSel = json.businessClassSel;
  361. this.pageSize = json.pageSize;
  362. this.currentPage = json.currentPage;
  363. localStorage.removeItem("mcrPageData");
  364. this.QueryData();
  365. } catch (e) {
  366. this.pageload();
  367. }
  368. return;
  369. }
  370. this.pageload();
  371. },
  372. computed: {
  373. preDele() {
  374. var number = 0;
  375. this.PageList.forEach(element => {
  376. number += element.preDele;
  377. });
  378. return number;
  379. },
  380. finlishedDele() {
  381. var number = 0;
  382. this.PageList.forEach(element => {
  383. number += element.finlishedDele;
  384. });
  385. return number;
  386. }
  387. }
  388. }
  389. </script>
  390. <style>
  391. body {
  392. margin: 0;
  393. padding: 0;
  394. }
  395. .mcr-box {
  396. background-color: #fff;
  397. padding: 10px;
  398. border-radius: 10px;
  399. }
  400. .mcr-table {
  401. margin-top: 10px;
  402. }
  403. .mcr-table .block {
  404. margin-top: 10px;
  405. }
  406. .mcr-table .el-table--enable-row-transition .el-table__body td.el-table__cell {
  407. text-align: center;
  408. }
  409. .mcr-table .el-table--border .el-table__cell:first-child .cell {
  410. text-align: center;
  411. }
  412. .mcr-input {
  413. display: flex;
  414. }
  415. .mcr-input .el-select {
  416. margin-right: 5px;
  417. }
  418. .btnOp {
  419. position: absolute;
  420. right: 6px;
  421. top: -50px;
  422. }
  423. </style>