MarketCustomerResourcesHome.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  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: 31%;">
  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: 29.59%;">
  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. this.pageloadData.pageIndex = val;
  223. this.pageloadData.pageSize = this.pageSize;
  224. this.pageload();
  225. },
  226. //多选框选中方法
  227. handleSelect(selection, row) {
  228. },
  229. pageload() {
  230. var that = this;
  231. if (this.userId == 21) {
  232. this.isSelect = false;
  233. }
  234. that.pageloadData.operationUserId = that.userId
  235. //初始化界面数据
  236. console.log(that.pageloadData)
  237. this.$axios.post('/api/MarketCustomerResources/QueryNewClientData', that.pageloadData, {
  238. headers: {
  239. 'Authorization': that.token,
  240. },
  241. }).then(resp => {
  242. if (resp.data.code == 200) {
  243. if (resp.data.data == null) {
  244. that.PageList = [];
  245. that.total = 0;
  246. this.$message.error(resp.data.msg);
  247. } else {
  248. that.principalList = resp.data.data.users; //负责人
  249. that.clientLvList = resp.data.data.level;//客户级别
  250. that.clientTypeList = resp.data.data.customerClass;//客户类别
  251. that.territoryList = resp.data.data.province; //省域数据
  252. that.businessClassList = resp.data.data.serviceClass; //业务归属
  253. that.PageList = resp.data.data.clientTableData.pageSource; //table数据
  254. that.total = resp.data.data.clientTableData.pageCount; //总数
  255. that.groupNumber = resp.data.data.groupNumber; //团组出团总数
  256. console.log(that.pageloadData.pageIndex, parseInt(that.pageloadData.pageIndex), 'that.pageloadData.pageIndex')
  257. that.currentPage = parseInt(that.pageloadData.pageIndex);
  258. }
  259. that.loading = false;
  260. } else if (resp.data.code == 400) {
  261. that.PageList = [];
  262. that.total = 0;
  263. that.loading = false;
  264. that.$message.error('暂无数据!');
  265. }
  266. }).catch(err => {
  267. this.$message.error('网络异常!');
  268. this.loading = false;
  269. })
  270. },
  271. //保存权限
  272. saveData() {
  273. var that = this;
  274. },
  275. QueryData() {
  276. this.pageloadData.pageIndex = this.currentPage;
  277. this.pageloadData.pageSize = this.pageSize;
  278. this.pageloadData.location = this.inputDQ; //地区
  279. this.pageloadData.client = this.inputDW; //单位
  280. this.pageloadData.contact = this.inputLXR; //联系人
  281. this.pageloadData.userid = this.principalSel.toString(); //负责人
  282. this.pageloadData.Range = this.territorySel == '' ? 0 : this.territorySel;//省域
  283. this.pageloadData.lvlid = this.clientLvSel == '' ? 0 : this.clientLvSel; //客户级别
  284. this.pageloadData.Category = this.clientTypeSel == '' ? 0 : this.clientTypeSel;//客户类别
  285. this.pageloadData.business = this.businessClassSel.toString();//业务分类
  286. this.pageloadData.operationUserId = this.userId;//
  287. this.pageload();
  288. },
  289. Edit(row) {
  290. localStorage.setItem("mcrPageData", JSON.stringify({
  291. inputLXR: this.inputLXR,
  292. inputDW: this.inputDW,
  293. inputDQ: this.inputDQ,
  294. principalSel: this.principalSel,
  295. territorySel: this.territorySel,
  296. clientLvSel: this.clientLvSel,
  297. clientTypeSel: this.clientTypeSel,
  298. businessClassSel: this.businessClassSel,
  299. pageSize: this.pageSize,
  300. currentPage: this.currentPage,
  301. }));
  302. this.$router.push('/home/MCROper?id=' + row.id);
  303. },
  304. Del(row) {
  305. var that = this;
  306. var delData = {
  307. "portType": 1,
  308. "id": row.id,
  309. "deleteUserId": this.userId
  310. }
  311. console.log(delData);
  312. this.$axios.post('/api/MarketCustomerResources/NewClientDel', delData, {
  313. headers: {
  314. 'Authorization': that.token,
  315. }
  316. }).then(resp => {
  317. if (resp.data.code == 200) {
  318. that.$message({
  319. message: '删除成功!',
  320. type: 'success'
  321. });
  322. } else {
  323. that.$message.error(resp.data.msg);
  324. }
  325. that.pageload();
  326. });
  327. },
  328. Add(row) {
  329. localStorage.setItem("mcrPageData", JSON.stringify({
  330. inputLXR: this.inputLXR,
  331. inputDW: this.inputDW,
  332. inputDQ: this.inputDQ,
  333. principalSel: this.principalSel,
  334. territorySel: this.territorySel,
  335. clientLvSel: this.clientLvSel,
  336. clientTypeSel: this.clientTypeSel,
  337. businessClassSel: this.businessClassSel,
  338. pageSize: this.pageSize,
  339. currentPage: this.currentPage,
  340. }));
  341. this.$router.push('/home/MCROper?id=' + 0);
  342. }
  343. },
  344. mounted() {
  345. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  346. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  347. var mcrPageData = localStorage.getItem("mcrPageData");
  348. if (mcrPageData) {
  349. try {
  350. console.log(mcrPageData);
  351. var json = JSON.parse(mcrPageData);
  352. this.inputLXR = json.inputLXR;
  353. this.inputDW = json.inputDW;
  354. this.inputDQ = json.inputDQ;
  355. this.principalSel = json.principalSel;
  356. this.territorySel = json.territorySel;
  357. this.clientLvSel = json.clientLvSel;
  358. this.clientTypeSel = json.clientTypeSel;
  359. this.businessClassSel = json.businessClassSel;
  360. this.pageSize = json.pageSize;
  361. this.currentPage = json.currentPage;
  362. localStorage.removeItem("mcrPageData");
  363. this.QueryData();
  364. } catch (e) {
  365. this.pageload();
  366. }
  367. return;
  368. }
  369. this.pageload();
  370. },
  371. created() {
  372. var mcrPageData = localStorage.getItem("mcrPageData");
  373. if (mcrPageData) {
  374. var json = JSON.parse(mcrPageData);
  375. this.currentPage = json.currentPage;
  376. }
  377. },
  378. computed: {
  379. preDele() {
  380. var number = 0;
  381. this.PageList.forEach(element => {
  382. number += element.preDele;
  383. });
  384. return number;
  385. },
  386. finlishedDele() {
  387. var number = 0;
  388. this.PageList.forEach(element => {
  389. number += element.finlishedDele;
  390. });
  391. return number;
  392. }
  393. }
  394. }
  395. </script>
  396. <style>
  397. body {
  398. margin: 0;
  399. padding: 0;
  400. }
  401. .mcr-box {
  402. background-color: #fff;
  403. padding: 10px;
  404. border-radius: 10px;
  405. }
  406. .mcr-table {
  407. margin-top: 10px;
  408. }
  409. .mcr-table .block {
  410. margin-top: 10px;
  411. }
  412. .mcr-table .el-table--enable-row-transition .el-table__body td.el-table__cell {
  413. text-align: center;
  414. }
  415. .mcr-table .el-table--border .el-table__cell:first-child .cell {
  416. text-align: center;
  417. }
  418. .mcr-input {
  419. display: flex;
  420. }
  421. .mcr-input .el-select {
  422. margin-right: 5px;
  423. }
  424. .btnOp {
  425. position: absolute;
  426. right: 6px;
  427. top: -50px;
  428. }
  429. </style>