OPgroup.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. <template>
  2. <div v-loading="fullscreenLoading">
  3. <el-dialog top="35vh" width="640px" title="文件下载" :visible.sync="contractVisible" :close-on-click-modal="false">
  4. <el-button @click="DownGroupContractFile(hetonggroupId,1)" type="primary">预付款80%合同</el-button>
  5. <el-button @click="DownGroupContractFile(hetonggroupId,2)" type="primary">团组结束后付款合同</el-button>
  6. <el-button @click="GroupQuotationsFileDown(hetonggroupId)" type="primary">报价单(收款单)</el-button>
  7. <el-button @click="GroupQuotationsDetailFileDown(hetonggroupId)" type="primary">报价细项单</el-button>
  8. </el-dialog>
  9. <el-dialog top="35vh" width="400px" title="团组清单下载" :visible.sync="groupVisible" :close-on-click-modal="false">
  10. <el-date-picker
  11. style="width:100%;"
  12. v-model="downloadtime"
  13. type="daterange"
  14. align="right"
  15. unlink-panels
  16. range-separator="至"
  17. start-placeholder="开始日期"
  18. end-placeholder="结束日期"
  19. :picker-options="pickerOptions">
  20. </el-date-picker>
  21. <div class="group-dialog-btn">
  22. <el-button @click="groupVisible=false">取消</el-button>
  23. <el-button @click="GroupListFile" type="primary">下载</el-button>
  24. </div>
  25. </el-dialog>
  26. <div class="group-list">
  27. <div class="group-box">
  28. <div>
  29. <el-select style="width:250px" v-model="value" clearable placeholder="请选择" @change="filterStatus(value)">
  30. <el-option
  31. v-for="item in options"
  32. :key="item.value"
  33. :label="item.label"
  34. :value="item.value">
  35. </el-option>
  36. </el-select>
  37. <el-select style="width:150px" v-model="customertype" clearable placeholder="请选择" @change="filterStatus">
  38. <el-option
  39. v-for="item in customertypeoptions"
  40. :key="item.value"
  41. :label="item.value"
  42. :value="item.value">
  43. </el-option>
  44. </el-select>
  45. <el-select style="width:150px" v-model="customerlevel" clearable placeholder="请选择" @change="filterStatus">
  46. <el-option
  47. v-for="item in customerleveloptions"
  48. :key="item.id"
  49. :label="item.name"
  50. :value="item.id">
  51. </el-option>
  52. </el-select>
  53. <el-input
  54. style="width:200px;"
  55. placeholder="请输入查询内容"
  56. v-model="input"
  57. clearable>
  58. </el-input>
  59. <el-button @click="Inquireclick()" type="primary">查 询</el-button>
  60. </div>
  61. <div>
  62. <el-button v-if="evocationdownloadqx" @click="evocationdownload" type="primary">团组清单下载</el-button>
  63. <el-button @click="addgroup()" type="primary">新增团组</el-button>
  64. </div>
  65. </div>
  66. <div class="group-title">
  67. <div>团组列表</div>
  68. </div>
  69. <template>
  70. <el-table
  71. :data="groupDatas"
  72. border
  73. style="width: 100%">
  74. <el-table-column
  75. prop="num"
  76. label="序 号"
  77. width="55">
  78. <template slot-scope="scope">
  79. {{(currentPage - 1) * pageSize + scope.$index + 1}}
  80. </template>
  81. </el-table-column>
  82. <el-table-column
  83. prop="department"
  84. width="100"
  85. label="所属部门">
  86. <template slot-scope="scope">
  87. <div v-if="scope.row.department=='市场部'" style="background-color: #67C23A;color:#fff;border-radius: 5px;">市场客户</div>
  88. <div v-if="scope.row.department=='国交部'||scope.row.department=='策划部'" style="background-color: #409EFF;color:#fff;border-radius: 5px;">公司客户</div>
  89. <div v-if="scope.row.department!='国交部'&&scope.row.department!='市场部'&&scope.row.department!='策划部'">{{ scope.row.department }}</div>
  90. </template>
  91. </el-table-column>
  92. <el-table-column
  93. prop="teamLev"
  94. label="级 别"
  95. width="80">
  96. <template slot-scope="scope">
  97. {{ scope.row.teamLev=='暂未定级'?'-':scope.row.teamLev }}
  98. </template>
  99. </el-table-column>
  100. <!-- <el-table-column
  101. prop="tourCode"
  102. width="100"
  103. label="团 号">
  104. </el-table-column> -->
  105. <!-- <el-table-column
  106. width="100"
  107. prop="salesQuoteNo"
  108. label="销售报价号">
  109. </el-table-column> -->
  110. <el-table-column
  111. prop="teamType"
  112. label="团组类型"
  113. width="110">
  114. </el-table-column>
  115. <el-table-column
  116. prop="teamName"
  117. label="团队名称"
  118. >
  119. <template slot-scope="scope">
  120. <span @click="tofile(scope.row)" style="color: #409EFF;cursor:pointer;">{{scope.row.teamName}}</span>
  121. </template>
  122. </el-table-column>
  123. <el-table-column
  124. prop="clientName"
  125. label="客户名称"
  126. width="100">
  127. </el-table-column>
  128. <el-table-column
  129. prop="clientUnit"
  130. label="客户单位">
  131. </el-table-column>
  132. <el-table-column
  133. prop="visitDate"
  134. :formatter="filteryear"
  135. label="出访时间"
  136. width="110">
  137. </el-table-column>
  138. <el-table-column
  139. prop="visitDays"
  140. label="天数"
  141. width="50">
  142. </el-table-column>
  143. <el-table-column
  144. prop="visitPNumber"
  145. label="人数"
  146. width="50">
  147. </el-table-column>
  148. <el-table-column
  149. prop="jietuanOperator"
  150. label="成单人"
  151. width="110">
  152. </el-table-column>
  153. <el-table-column
  154. prop="operatorLabel"
  155. width="100"
  156. label="各部门操作人">
  157. <template slot-scope="scope">
  158. <el-popover placement="top" width="300" trigger="hover">
  159. <div style="white-space: pre-wrap;">{{scope.row.operatorLabel}}</div>
  160. <span
  161. style="display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp:1; overflow: hidden;cursor: pointer;color: #48a2ff;"
  162. slot="reference">移上查看</span>
  163. </el-popover>
  164. </template>
  165. </el-table-column>
  166. <!-- <el-table-column
  167. prop="tourCode"
  168. width="100"
  169. label="进 度">
  170. </el-table-column> -->
  171. <el-table-column label="操作" width="250">
  172. <template slot-scope="scope">
  173. <el-button
  174. size="mini"
  175. title="编辑"
  176. @click="handleEdit(scope.$index, scope.row)"><i class="el-icon-edit"></i></el-button>
  177. <el-button
  178. size="mini"
  179. title="合同下载"
  180. @click="contracton(scope.row)"><i class="el-icon-document"></i></el-button>
  181. <el-button
  182. size="mini"
  183. title="删除"
  184. type="danger"
  185. @click="handleDelete(scope.$index, scope.row,groupDatas)"><i class="el-icon-delete"></i></el-button>
  186. <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>
  187. <el-button
  188. v-if="scope.row.tourCode!=''"
  189. :type="scope.row.step==2?'primary':''"
  190. @click="EnterpriseWeChatNotificationAsyncBaoPi(scope.$index, scope.row)"
  191. size="mini"
  192. :title="scope.row.step==2?'已通知开始业务操作':'通知国交部各岗位可以开始业务操作'"
  193. ><i class="el-icon-check"></i></el-button>
  194. </template>
  195. </el-table-column>
  196. </el-table>
  197. </template>
  198. <div class="block">
  199. <el-pagination align='center'
  200. @size-change="handleSizeChange"
  201. @current-change="handleCurrentChange"
  202. :current-page="currentPage"
  203. :page-sizes="[10,12,15,20]"
  204. :page-size="pageSize"
  205. layout="total, sizes, prev, pager, next"
  206. :total="count">
  207. </el-pagination>
  208. </div>
  209. </div>
  210. </div>
  211. </template>
  212. <script>
  213. export default {
  214. beforeRouteLeave(to, from, next) {
  215. if(to.name!='Groupedit'){
  216. localStorage.removeItem('tzczval');
  217. }
  218. next()
  219. },
  220. // beforeRouteLeave(to, from, next) {
  221. // console.log(to);
  222. // console.log(from);
  223. // if(to.name!='Groupedit'){
  224. // from.meta.keepAlive = false;
  225. // }
  226. // next()
  227. // },
  228. data() {
  229. return {
  230. options: [
  231. {
  232. value: '-1',
  233. label: '全部'
  234. }, {
  235. value: '0',
  236. label: '未完成'
  237. }, {
  238. value: '1',
  239. label: '已完成'
  240. }
  241. ],
  242. value: '-1',
  243. groupDatas:[],
  244. groupData: [],
  245. groupDatass:[],
  246. count:0,//总条数
  247. currentPage: 1, // 当前页码
  248. pageSize: 10 ,// 每页的数据条数
  249. input:'',
  250. token:'',
  251. fullscreenLoading:false,
  252. userid:'',
  253. pageId:'',
  254. groupVisible:false,
  255. //下载团组清单时间
  256. downloadtime:'',
  257. pickerOptions: {
  258. shortcuts: [{
  259. text: '最近一周',
  260. onClick(picker) {
  261. const end = new Date();
  262. const start = new Date();
  263. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  264. picker.$emit('pick', [start, end]);
  265. }
  266. }, {
  267. text: '最近一个月',
  268. onClick(picker) {
  269. const end = new Date();
  270. const start = new Date();
  271. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  272. picker.$emit('pick', [start, end]);
  273. }
  274. }, {
  275. text: '最近三个月',
  276. onClick(picker) {
  277. const end = new Date();
  278. const start = new Date();
  279. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  280. picker.$emit('pick', [start, end]);
  281. }
  282. }]
  283. },
  284. evocationdownloadqx:false,
  285. customerlevel:'',
  286. customertype:'',
  287. customertypeoptions:[],
  288. customerleveloptions:[],
  289. contractVisible:false,
  290. hetonggroupId:0,
  291. }
  292. },
  293. activated() {
  294. if(!this.$route.meta.isBack){
  295. // 如果isBack是false,表明需要获取新数据,否则就不再请求,直接使用缓存的数据
  296. console.log("表明需要获取新数据")
  297. }
  298. // 恢复成默认的false,避免isBack一直是true,导致下次无法获取数据
  299. this.$route.meta.isBack=false
  300. },
  301. methods:{
  302. //处理时间
  303. disposeTime(val){
  304. var date = new Date(val);
  305. var y = date.getFullYear();
  306. var m = date.getMonth() + 1;
  307. m = m < 10 ? ('0' + m) : m;
  308. var d = date.getDate();
  309. d = d < 10 ? ('0' + d) : d;
  310. let time = y + '-' + m + '-' + d;
  311. return time
  312. },
  313. //分页api
  314. PostGroupPageList(){
  315. var url = "/api/Groups/PostGroupPageList"
  316. var that = this
  317. this.$axios({
  318. method: 'post',
  319. url: url,
  320. headers: {
  321. Authorization: 'Bearer ' + this.token
  322. },
  323. data: {
  324. portType: 1,
  325. pageId:that.pageId,
  326. userId:that.userid,
  327. pageIndex: that.currentPage,
  328. pageSize: that.pageSize,
  329. isSure: that.value,
  330. searchCriteria: that.input,
  331. department: that.customertype,
  332. rank: that.customerlevel+'',
  333. }
  334. }).then(function (res) {
  335. console.log(res)
  336. if (res.data.code == 200) {
  337. that.groupDatas=res.data.data.data
  338. that.count=res.data.count
  339. }
  340. console.log(that.count)
  341. })
  342. },
  343. //合同下载
  344. DownGroupContractFile(val,vals){
  345. var url = "/api/Groups/DownGroupContractFile"
  346. var that = this
  347. this.$axios({
  348. method: 'post',
  349. url: url,
  350. headers: {
  351. Authorization: 'Bearer '
  352. },
  353. data: {
  354. groupId:val,
  355. fileType:vals,
  356. userId:that.userid,
  357. }
  358. }).then(function (res) {
  359. if (res.data.code == 200) {
  360. that.$message({
  361. message:res.data.msg ,
  362. type: 'success',
  363. });
  364. window.open(res.data.data.url);
  365. that.contractVisible=false;
  366. }else{
  367. that.$message.error(res.data.msg);
  368. that.contractVisible=false;
  369. }
  370. })
  371. },
  372. //报价word
  373. GroupQuotationsFileDown(val){
  374. var url = "/api/Groups/GroupQuotationsFileDown"
  375. var that = this
  376. this.$axios({
  377. method: 'post',
  378. url: url,
  379. headers: {
  380. Authorization: 'Bearer '
  381. },
  382. data: {
  383. diid:val,
  384. }
  385. }).then(function (res) {
  386. if (res.data.code == 200) {
  387. that.$message({
  388. message:res.data.msg ,
  389. type: 'success',
  390. });
  391. window.open(res.data.data.url);
  392. that.contractVisible=false;
  393. }else{
  394. that.$message.error(res.data.msg);
  395. }
  396. })
  397. },
  398. //报价word
  399. GroupQuotationsFileDown(val){
  400. var url = "/api/Groups/GroupQuotationsFileDown"
  401. var that = this
  402. this.$axios({
  403. method: 'post',
  404. url: url,
  405. headers: {
  406. Authorization: 'Bearer '
  407. },
  408. data: {
  409. diid:val,
  410. }
  411. }).then(function (res) {
  412. if (res.data.code == 200) {
  413. that.$message({
  414. message:res.data.msg ,
  415. type: 'success',
  416. });
  417. window.open(res.data.data.url);
  418. that.contractVisible=false;
  419. }else{
  420. that.$message.error(res.data.msg);
  421. }
  422. })
  423. },
  424. //报批
  425. EnterpriseWeChatNotificationAsyncBaoPi(index, row){
  426. if (row.step==2) {
  427. this.$message.error("已通知开始业务操作,无需重复操作!");
  428. return
  429. }
  430. var url = "/api/Groups/EnterpriseWeChatNotificationAsyncBaoPi"
  431. var that = this
  432. this.$axios({
  433. method: 'post',
  434. url: url,
  435. headers: {
  436. Authorization: 'Bearer '
  437. },
  438. data: {
  439. currUserId:that.userid,
  440. diid:row.id,
  441. }
  442. }).then(function (res) {
  443. if (res.data.code == 200) {
  444. that.$message({
  445. message:res.data.msg ,
  446. type: 'success',
  447. });
  448. }else{
  449. that.$message.error(res.data.msg);
  450. }
  451. })
  452. },
  453. contracton(val){
  454. this.hetonggroupId=0;
  455. this.hetonggroupId=val.id;
  456. this.contractVisible=true
  457. },
  458. //每页条数改变时触发 选择一页显示多少行
  459. handleSizeChange(val) {
  460. this.currentPage = 1;
  461. this.pageSize = val;
  462. this.PostGroupPageList()
  463. },
  464. //当前页改变时触发 跳转其他页
  465. handleCurrentChange(val) {
  466. this.currentPage = val;
  467. this.PostGroupPageList()
  468. },
  469. Inquireclick(){
  470. this.currentPage=1;
  471. this.PostGroupPageList()
  472. },
  473. //唤起团组清单下载
  474. evocationdownload(){
  475. this.downloadtime="";
  476. this.groupVisible=true;
  477. },
  478. //跳转到文件
  479. tofile(val){
  480. this.$router.push({path: '/home/SharedFile?diId='+val.id});
  481. },
  482. //团组清单下载
  483. GroupListFile(){
  484. if (this.downloadtime==null||this.downloadtime=="") {
  485. this.$message.error("请选择时间!");
  486. return
  487. }
  488. var url = "/api/Groups/GroupListFile?beginDt="+this.disposeTime(this.downloadtime[0])+"&endDt="+this.disposeTime(this.downloadtime[1])
  489. var that = this
  490. this.$axios({
  491. method: 'get',
  492. url: url,
  493. headers: {
  494. Authorization: 'Bearer '
  495. }
  496. }).then(function (res) {
  497. if (res.data.code == 200) {
  498. that.$message({
  499. message:res.data.msg ,
  500. type: 'success',
  501. });
  502. window.open(res.data.data);
  503. that.groupVisible=false;
  504. }else{
  505. that.$message.error(res.data.msg);
  506. }
  507. })
  508. },
  509. addgroup(){
  510. this.$router.push({path: '/home/Groupedit'});
  511. },
  512. filteryear(val){
  513. let gstime=val.visitDate.split(' ')[0]
  514. return gstime;
  515. },
  516. //筛选状态
  517. filterStatus(){
  518. this.currentPage=1;
  519. this.PostGroupPageList()
  520. },
  521. //获取基础数据
  522. PostGroupPageListInit(){
  523. var url="/api/Groups/PostGroupPageListInit"
  524. var that=this
  525. this.$axios({
  526. method: 'post',
  527. url:url,
  528. headers:{
  529. Authorization:'Bearer '
  530. },
  531. }).then(function(res){
  532. if(res.data.code==200){
  533. that.customertypeoptions=res.data.data.depData;
  534. that.customerleveloptions=res.data.data.rankData;
  535. }else{
  536. that.$message({
  537. message:res.data.msg ,
  538. type: 'warning',
  539. offset:50
  540. });
  541. }
  542. })
  543. },
  544. //编辑
  545. handleEdit(index, row,rows) {
  546. var tzczval={
  547. currentPage:this.currentPage,
  548. value:this.value,
  549. input:this.input,
  550. }
  551. localStorage.setItem('tzczval', JSON.stringify(tzczval));
  552. this.$router.push({path: '/home/Groupedit?id=' + row.id +''});
  553. },
  554. confirmDeparture(index, row){
  555. console.log(row)
  556. this.$confirm('此操作将会确认出团, 是否继续?', '提示', {
  557. confirmButtonText: '确定',
  558. cancelButtonText: '取消',
  559. type: 'warning'
  560. }).then(() => {
  561. var url="/api/Groups/SetConfirmationGroup"
  562. var that=this
  563. this.$axios({
  564. method: 'post',
  565. url:url,
  566. headers:{
  567. Authorization:'Bearer '+this.token
  568. },
  569. data:{
  570. portType: 1,
  571. groupId:row.id,
  572. groupsOperator:that.userid
  573. }
  574. }).then(function(res){
  575. console.log(res)
  576. if(res.data.code==200){
  577. that.$message({
  578. message:res.data.msg ,
  579. type: 'success',
  580. offset:50
  581. });
  582. row.tourCode=res.data.data;
  583. // rows.splice(index, 1);
  584. }else{
  585. row.tourCode=res.data.msg;
  586. that.$message({
  587. message:res.data.msg ,
  588. type: 'warning',
  589. offset:50
  590. });
  591. }
  592. })
  593. }).catch(() => {
  594. this.$message({
  595. type: 'info',
  596. message: '已取消确认出团'
  597. });
  598. });
  599. },
  600. //删除
  601. handleDelete(index, row,rows) {
  602. this.$confirm('此操作将删除该条信息, 是否继续?', '提示', {
  603. confirmButtonText: '确定',
  604. cancelButtonText: '取消',
  605. type: 'warning'
  606. }).then(() => {
  607. var url="/api/Groups/GroupDel"
  608. var that=this
  609. this.$axios({
  610. method: 'post',
  611. url:url,
  612. headers:{
  613. Authorization:'Bearer '+this.token
  614. },
  615. data:{
  616. portType: 1,
  617. id:row.id,
  618. userId:that.userid
  619. }
  620. }).then(function(res){
  621. if(res.data.code==200){
  622. that.$message({
  623. message:res.data.msg ,
  624. type: 'success',
  625. offset:50
  626. });
  627. rows.splice(index, 1);
  628. }else{
  629. that.$message({
  630. message:res.data.msg ,
  631. type: 'warning',
  632. offset:50
  633. });
  634. }
  635. })
  636. }).catch(() => {
  637. this.$message({
  638. type: 'info',
  639. message: '已取消删除'
  640. });
  641. });
  642. }
  643. },
  644. created(){
  645. this.PostGroupPageListInit();
  646. if(JSON.parse(localStorage.getItem('tzczval'))){
  647. this.currentPage=JSON.parse(localStorage.getItem('tzczval')).currentPage;
  648. this.value=JSON.parse(localStorage.getItem('tzczval')).value;
  649. this.input=JSON.parse(localStorage.getItem('tzczval')).input;
  650. }
  651. },
  652. mounted(){
  653. //权限
  654. let authData=JSON.parse(localStorage.getItem('userinif')).authData;
  655. let Permissions=[];
  656. for(let k=0;k<authData.length;k++){
  657. for(let m=0;m<authData[k].pageList.length;m++){
  658. if (authData[k].pageList[m].webUrl=='/OPgroup') {
  659. Permissions=authData[k].pageList[m].pageAuth;
  660. }
  661. }
  662. }
  663. for (let r = 0; r < Permissions.length; r++) {
  664. if (Permissions[r].funid==4) {
  665. this.evocationdownloadqx=true;
  666. }
  667. }
  668. this.token=JSON.parse(localStorage.getItem('userinif')).token;
  669. this.pageId=Number(localStorage.getItem('indexs').split('-')[1]);//页面id
  670. this.userid=JSON.parse(localStorage.getItem('userinif')).userInfo.userId;
  671. this.PostGroupPageList();
  672. }
  673. }
  674. </script>
  675. <style>
  676. .group-list{
  677. background-color: #fff;
  678. padding: 10px;
  679. box-shadow: 0 0 5px #0005;
  680. border-radius: 10px;
  681. min-height: 830px;
  682. }
  683. .group-title{
  684. display: flex;
  685. font-size: 17px;
  686. font-weight:600 ;
  687. color: #555;
  688. margin-top: 8px;
  689. margin-bottom: 2px;
  690. justify-content: space-between;
  691. align-items: center;
  692. }
  693. .group-box{
  694. display: flex;
  695. justify-content: space-between;
  696. }
  697. .group-box>button{
  698. margin-left: 10px;
  699. padding: 8px 20px;
  700. }
  701. .el-table td.el-table__cell, .el-table th.el-table__cell.is-leaf{
  702. text-align: center;
  703. }
  704. .group-box>.el-input{
  705. margin-left: 10px;
  706. }
  707. .group-dialog-btn{
  708. text-align: right;
  709. margin-top: 30px;
  710. }
  711. </style>