OPgroup.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <div v-loading="fullscreenLoading">
  3. <div class="group-list">
  4. <div class="group-title">
  5. <div>团组列表</div>
  6. <div class="group-box">
  7. <el-select v-model="value" clearable placeholder="请选择" @change="filterStatus(value)">
  8. <el-option
  9. v-for="item in options"
  10. :key="item.value"
  11. :label="item.label"
  12. :value="item.value">
  13. </el-option>
  14. </el-select>
  15. <el-input
  16. style="width:200px;"
  17. @input="Inquireclick()"
  18. placeholder="请输入查询内容"
  19. v-model="input"
  20. clearable>
  21. </el-input>
  22. <el-button @click="addgroup()" type="primary">新增团组</el-button>
  23. </div>
  24. </div>
  25. <template>
  26. <el-table
  27. :data="groupDatas.slice((currentPage-1)*pageSize,currentPage*pageSize)"
  28. border
  29. style="width: 100%">
  30. <el-table-column
  31. prop="num"
  32. label="序 号"
  33. width="55">
  34. <template slot-scope="scope">
  35. {{(currentPage - 1) * pageSize + scope.$index + 1}}
  36. </template>
  37. </el-table-column>
  38. <el-table-column
  39. prop="tourCode"
  40. width="100"
  41. label="团 号">
  42. </el-table-column>
  43. <el-table-column
  44. width="100"
  45. prop="salesQuoteNo"
  46. label="销售报价号">
  47. </el-table-column>
  48. <el-table-column
  49. prop="teamType"
  50. label="团组类型"
  51. width="150">
  52. </el-table-column>
  53. <!-- <el-table-column
  54. prop="teamLev"
  55. label="级 别"
  56. width="80">
  57. </el-table-column> -->
  58. <el-table-column
  59. prop="teamName"
  60. label="团队名称"
  61. >
  62. </el-table-column>
  63. <el-table-column
  64. prop="clientName"
  65. label="客户名称"
  66. width="100">
  67. </el-table-column>
  68. <el-table-column
  69. prop="clientUnit"
  70. label="客户单位">
  71. </el-table-column>
  72. <el-table-column
  73. prop="visitDate"
  74. :formatter="filteryear"
  75. label="出访时间"
  76. width="100">
  77. </el-table-column>
  78. <el-table-column
  79. prop="visitDays"
  80. label="出访天数"
  81. width="80">
  82. </el-table-column>
  83. <el-table-column
  84. prop="visitPNumber"
  85. label="出访人数"
  86. width="80">
  87. </el-table-column>
  88. <el-table-column
  89. prop="jietuanOperator"
  90. label="接团操作人"
  91. width="110">
  92. </el-table-column>
  93. <el-table-column label="操作">
  94. <template slot-scope="scope">
  95. <el-button
  96. size="mini"
  97. title="编辑"
  98. @click="handleEdit(scope.$index, scope.row)"><i class="el-icon-edit"></i></el-button>
  99. <el-button
  100. size="mini"
  101. title="删除"
  102. type="danger"
  103. @click="handleDelete(scope.$index, scope.row,groupDatas)"><i class="el-icon-delete"></i></el-button>
  104. <el-button v-if="scope.row.tourCode==''" size="mini" title="确认出团" type="primary" @click="confirmDeparture(scope.$index, scope.row)"><i class="el-icon-check"></i></el-button>
  105. <el-button
  106. v-if="scope.row.tourCode!=''"
  107. size="mini"
  108. title="已出团"
  109. ><i class="el-icon-check"></i></el-button>
  110. </template>
  111. </el-table-column>
  112. </el-table>
  113. </template>
  114. <div class="block">
  115. <el-pagination align='center'
  116. @size-change="handleSizeChange"
  117. @current-change="handleCurrentChange"
  118. :current-page="currentPage"
  119. :page-sizes="[10,12,15,20]"
  120. :page-size="pageSize"
  121. layout="total, sizes, prev, pager, next"
  122. :total="groupDatas.length">
  123. </el-pagination>
  124. </div>
  125. </div>
  126. </div>
  127. </template>
  128. <script>
  129. import { co, el } from '@fullcalendar/core/internal-common';
  130. export default {
  131. data() {
  132. return {
  133. options: [
  134. {
  135. value: '0',
  136. label: '全部'
  137. }, {
  138. value: '1',
  139. label: '已完成'
  140. }, {
  141. value: '2',
  142. label: '未完成'
  143. }
  144. ],
  145. value: '0',
  146. groupDatas:[],
  147. groupData: [
  148. ],
  149. groupDatass:[],
  150. currentPage: 1, // 当前页码
  151. pageSize: 12 ,// 每页的数据条数
  152. input:'',
  153. token:'',
  154. fullscreenLoading:false,
  155. userid:''
  156. }
  157. },
  158. methods:{
  159. //每页条数改变时触发 选择一页显示多少行
  160. handleSizeChange(val) {
  161. this.currentPage = 1;
  162. this.pageSize = val;
  163. },
  164. //当前页改变时触发 跳转其他页
  165. handleCurrentChange(val) {
  166. this.currentPage = val;
  167. },
  168. Inquireclick(){
  169. var newarr=[];
  170. if(this.input==""){
  171. if(this.value=="0"){
  172. newarr=this.groupData;
  173. }else{
  174. newarr=this.groupDatass;
  175. }
  176. }else{
  177. for(var i=0;i<this.groupDatas.length;i++){
  178. if(this.groupDatas[i].clientName.indexOf(this.input)!=-1){
  179. newarr.push(this.groupDatas[i]);
  180. }
  181. else if(this.groupDatas[i].clientUnit.indexOf(this.input)!=-1){
  182. newarr.push(this.groupDatas[i]);
  183. }
  184. else if(this.groupDatas[i].jietuanOperator.indexOf(this.input)!=-1){
  185. newarr.push(this.groupDatas[i]);
  186. }
  187. else if(this.groupDatas[i].salesQuoteNo.indexOf(this.input)!=-1){
  188. newarr.push(this.groupDatas[i]);
  189. }
  190. else if(this.groupDatas[i].teamLev.indexOf(this.input)!=-1){
  191. newarr.push(this.groupDatas[i]);
  192. }
  193. else if(this.groupDatas[i].teamName.indexOf(this.input)!=-1){
  194. newarr.push(this.groupDatas[i]);
  195. }
  196. else if(this.groupDatas[i].teamType.indexOf(this.input)!=-1){
  197. newarr.push(this.groupDatas[i]);
  198. }
  199. else if(this.groupDatas[i].tourCode.indexOf(this.input)!=-1){
  200. newarr.push(this.groupDatas[i]);
  201. }else if(this.groupDatas[i].visitDate.indexOf(this.input)!=-1){
  202. newarr.push(this.groupDatas[i]);
  203. }
  204. }
  205. }
  206. this.currentPage=1;
  207. this.groupDatas=newarr;
  208. },
  209. addgroup(){
  210. this.$router.push({path: '/home/Groupedit'});
  211. },
  212. //
  213. Grouplist(){
  214. var url="/api/Groups/GetGroupList"
  215. var that=this
  216. that.fullscreenLoading = true;
  217. this.$axios({
  218. method: 'post',
  219. url:url,
  220. headers:{
  221. Authorization:'Bearer '+this.token
  222. },
  223. data:{
  224. portType: 1,
  225. }
  226. }).then(function(res){
  227. if(res.data.code==200){
  228. that.groupData=res.data.data
  229. that.groupData.forEach(item=>{
  230. if(item.clientName==null){
  231. item.clientName = ''
  232. }
  233. if(item.clientUnit==null){
  234. item.clientUnit = ''
  235. }
  236. if(item.id==null){
  237. item.id = ''
  238. }
  239. if(item.isSure==null){
  240. item.isSure = ''
  241. }
  242. if(item.jietuanOperator==null){
  243. item.jietuanOperator = ''
  244. }
  245. if(item.salesQuoteNo==null){
  246. item.salesQuoteNo = ''
  247. }
  248. if(item.teamName==null){
  249. item.teamName = ''
  250. }
  251. if(item.teamType==null){
  252. item.teamType = ''
  253. }
  254. if(item.tourCode==null){
  255. item.tourCode = ''
  256. }
  257. if(item.visitDate==null){
  258. item.visitDate = ''
  259. }
  260. if(item.visitDays==null){
  261. item.visitDays = ''
  262. }
  263. if(item.visitPNumber==null){
  264. item.visitPNumber = ''
  265. }
  266. })
  267. that.groupDatas=that.groupData;
  268. console.log(that.groupData)
  269. that.fullscreenLoading = false;
  270. }
  271. })
  272. },
  273. filteryear(val){
  274. let gstime=val.visitDate.split(' ')[0]
  275. return gstime;
  276. },
  277. //筛选状态
  278. filterStatus(val){
  279. var newgroup=[];
  280. if(this.input==""){
  281. if(val=="0"||val==""){
  282. newgroup=this.groupData;
  283. }else if(val=="1"){
  284. for(var j=0;j<this.groupData.length;j++){
  285. if(this.groupData[j].isSure==1){
  286. newgroup.push(this.groupData[j])
  287. }
  288. }
  289. }else if(val=="2"){
  290. for(var j=0;j<this.groupData.length;j++){
  291. if(this.groupData[j].isSure==0){
  292. newgroup.push(this.groupData[j])
  293. }
  294. }
  295. }
  296. this.currentPage=1;
  297. this.groupDatas=newgroup
  298. this.groupDatass=newgroup
  299. }else{
  300. if(val=="0"||val==""){
  301. newgroup=this.groupData
  302. }else if(val=="1"){
  303. for(var j=0;j<this.groupData.length;j++){
  304. if(this.groupData[j].isSure==1){
  305. newgroup.push(this.groupData[j])
  306. }
  307. }
  308. }else if(val=="2"){
  309. for(var j=0;j<this.groupData.length;j++){
  310. if(this.groupData[j].isSure==0){
  311. newgroup.push(this.groupData[j])
  312. }
  313. }
  314. }
  315. this.currentPage=1;
  316. this.groupDatas=newgroup
  317. this.groupDatass=newgroup
  318. this.Inquireclick()
  319. }
  320. },
  321. //编辑
  322. handleEdit(index, row,rows) {
  323. this.$router.push({path: '/home/Groupedit?id=' + row.id +''});
  324. },
  325. confirmDeparture(index, row){
  326. console.log(row)
  327. this.$confirm('此操作将会确认出团, 是否继续?', '提示', {
  328. confirmButtonText: '确定',
  329. cancelButtonText: '取消',
  330. type: 'warning'
  331. }).then(() => {
  332. var url="/api/Groups/SetConfirmationGroup"
  333. var that=this
  334. this.$axios({
  335. method: 'post',
  336. url:url,
  337. headers:{
  338. Authorization:'Bearer '+this.token
  339. },
  340. data:{
  341. portType: 1,
  342. groupId:row.id,
  343. groupsOperator:that.userid
  344. }
  345. }).then(function(res){
  346. console.log(res)
  347. if(res.data.code==200){
  348. that.$message({
  349. message:res.data.msg ,
  350. type: 'success',
  351. offset:50
  352. });
  353. row.tourCode=res.data.data.tourCode;
  354. rows.splice(index, 1);
  355. }else{
  356. that.$message({
  357. message:res.data.msg ,
  358. type: 'warning',
  359. offset:50
  360. });
  361. }
  362. })
  363. }).catch(() => {
  364. this.$message({
  365. type: 'info',
  366. message: '已取消确认出团'
  367. });
  368. });
  369. },
  370. //删除
  371. handleDelete(index, row,rows) {
  372. this.$confirm('此操作将删除该条信息, 是否继续?', '提示', {
  373. confirmButtonText: '确定',
  374. cancelButtonText: '取消',
  375. type: 'warning'
  376. }).then(() => {
  377. var url="/api/Groups/GroupDel"
  378. var that=this
  379. this.$axios({
  380. method: 'post',
  381. url:url,
  382. headers:{
  383. Authorization:'Bearer '+this.token
  384. },
  385. data:{
  386. portType: 1,
  387. id:row.id,
  388. userId:that.userid
  389. }
  390. }).then(function(res){
  391. if(res.data.code==200){
  392. that.$message({
  393. message:res.data.msg ,
  394. type: 'success',
  395. offset:50
  396. });
  397. rows.splice(index, 1);
  398. }else{
  399. that.$message({
  400. message:res.data.msg ,
  401. type: 'warning',
  402. offset:50
  403. });
  404. }
  405. })
  406. }).catch(() => {
  407. this.$message({
  408. type: 'info',
  409. message: '已取消删除'
  410. });
  411. });
  412. }
  413. },
  414. mounted(){
  415. this.token=JSON.parse(localStorage.getItem('userinif')).token;
  416. this.userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  417. this.Grouplist();
  418. }
  419. }
  420. </script>
  421. <style>
  422. .group-list{
  423. background-color: #fff;
  424. padding: 10px;
  425. box-shadow: 0 0 5px #0005;
  426. border-radius: 10px;
  427. }
  428. .group-title{
  429. display: flex;
  430. font-size: 17px;
  431. font-weight:600 ;
  432. color: #555;
  433. margin-top: 8px;
  434. margin-bottom: 2px;
  435. justify-content: space-between;
  436. align-items: center;
  437. }
  438. .group-box{
  439. display: flex;
  440. }
  441. .group-box>button{
  442. margin-left: 10px;
  443. padding: 8px 20px;
  444. }
  445. .el-table td.el-table__cell, .el-table th.el-table__cell.is-leaf{
  446. text-align: center;
  447. }
  448. .group-box>.el-input{
  449. margin-left: 10px;
  450. }
  451. </style>