InvitationOfficialActivityData.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584
  1. <template>
  2. <div>
  3. <div class="communal-list">
  4. <div class="communal-title">
  5. <div>邀请/公务活动资料</div>
  6. </div>
  7. <div>
  8. <div class="communal-box" style="margin-top: 10px;">
  9. <el-autocomplete style="margin-right: 15px;" class="inline-input" v-model="Country" :fetch-suggestions="querySearchCountry"
  10. placeholder="请输入国家" clearable></el-autocomplete>
  11. <el-autocomplete style="margin-right: 10px;" class="inline-input" v-model="UnitName" :fetch-suggestions="querySearchUnitName"
  12. placeholder="请输入邀请方" clearable></el-autocomplete>
  13. <el-autocomplete style="margin-right: 10px;" class="inline-input" v-model="Contact" :fetch-suggestions="querySearchContact"
  14. placeholder="联系人" clearable></el-autocomplete>
  15. <el-select v-model="Delegation" clearable filterable placeholder="团组名称" style="width: 20%;margin-right: 15px;">
  16. <el-option v-for="(items,index) in restaurantDelegation" :key="index" :label="items.teamName"
  17. :value="items.id">
  18. </el-option>
  19. </el-select>
  20. <el-select style="margin-right: 10px;width:218px;" v-model="CreateUserId" placeholder="录入者" filterable clearable>
  21. <el-option v-for="item in CreateUserList" :key="item.id" :label="item.cnName" :value="item.id">
  22. </el-option>
  23. </el-select>
  24. <el-date-picker style="width:448px;margin-right: 10px;" v-model="InviteTime" type="daterange" align="right" unlink-panels format="yyyy-MM-dd"
  25. value-format="yyyy-MM-dd" range-separator="至" start-placeholder="邀请开始日期" end-placeholder="邀请结束日期"
  26. :picker-options="pickerOptions">
  27. </el-date-picker>
  28. <el-autocomplete class="inline-input" v-model="Field" :fetch-suggestions="querySearchField"
  29. placeholder="领域" clearable></el-autocomplete>
  30. <div>
  31. <el-button type="primary" @click="QueryData" style="margin-left: 10px;">查询</el-button>
  32. </div>
  33. <div>
  34. <router-link to='/home/OpInvitationOfficialActivityData'>
  35. <el-button type="primary" style="margin-left: 10px;">新增</el-button>
  36. </router-link>
  37. </div>
  38. </div>
  39. <div class="communal-box" style="margin-top: 10px;">
  40. <!-- <el-button type="primary" @click="QueryCount" style="margin-left: 10px;">查询录入数量</el-button> -->
  41. <!-- <div style="display: flex;align-items: center;justify-content: center">
  42. 查询结果:该人员在以上条件共录入<span style="color: red;">{{ dataCount }}</span>条数据
  43. </div> -->
  44. </div>
  45. </div>
  46. <template>
  47. <el-table height="680" :data="tableData" border
  48. style="width: 100%;margin-top: 10px;" v-loading="loading" element-loading-text="拼命加载中...">
  49. <el-table-column prop="num" label="序 号" width="55">
  50. <template slot-scope="scope">
  51. {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
  52. </template>
  53. </el-table-column>
  54. <el-table-column prop="country" width="100" label="国家">
  55. <template slot-scope="scope">
  56. {{scope.row.country|filter_emptyAcquiesce}}
  57. </template>
  58. </el-table-column>
  59. <el-table-column prop="city" label="城市">
  60. <template slot-scope="scope">
  61. {{scope.row.city|filter_emptyAcquiesce}}
  62. </template>
  63. </el-table-column>
  64. <el-table-column prop="unitName" label="邀请方名称">
  65. <template slot-scope="scope">
  66. {{scope.row.unitName|filter_emptyAcquiesce}}
  67. </template>
  68. </el-table-column>
  69. <el-table-column prop="field" label="涉及领域">
  70. <template slot-scope="scope">
  71. {{scope.row.field|filter_emptyAcquiesce}}
  72. </template>
  73. </el-table-column>
  74. <el-table-column prop="contact" width="100" label="联系人">
  75. <template slot-scope="scope">
  76. {{scope.row.contact|filter_emptyAcquiesce}}
  77. </template>
  78. </el-table-column>
  79. <el-table-column prop="job" label="职务">
  80. <template slot-scope="scope">
  81. {{scope.row.job|filter_emptyAcquiesce}}
  82. </template>
  83. </el-table-column>
  84. <el-table-column prop="tel" width="120px" label="手机">
  85. <template slot-scope="scope">
  86. {{scope.row.tel|filter_emptyAcquiesce}}
  87. </template>
  88. </el-table-column>
  89. <el-table-column prop="delegationStr" label="关联团组">
  90. <template slot-scope="scope">
  91. <div id="delegationStr">
  92. <el-tooltip v-show="scope.row.delegationStr != ''" class="item" effect="dark"
  93. :content="scope.row.delegationStr" placement="top">
  94. <span v-if="scope.row.delegationStr.length > 9">{{ scope.row.delegationStr.slice(0, 9) + "..."
  95. }}</span>
  96. <span v-else>{{ scope.row.delegationStr }}</span>
  97. <div slot="content">
  98. <div style="width: 300px;">
  99. {{ scope.row.delegationStr }}
  100. </div>
  101. </div>
  102. </el-tooltip>
  103. </div>
  104. </template>
  105. <!-- <template slot-scope="Str">
  106. <div :title="Str.row.delegationStr" class="title">{{ Str.row.delegationStr }}</div>
  107. </template> -->
  108. </el-table-column>
  109. <el-table-column width="80" prop="createUserName" label="录入者">
  110. </el-table-column>
  111. <el-table-column prop="createTime" label="录入时间">
  112. </el-table-column>
  113. <el-table-column label="操作">
  114. <template slot-scope="scope">
  115. <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
  116. <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
  117. </template>
  118. </el-table-column>
  119. </el-table>
  120. </template>
  121. <div class="block">
  122. <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  123. :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
  124. layout="total, sizes, prev, pager, next" :total="dataCount">
  125. </el-pagination>
  126. </div>
  127. </div>
  128. </div>
  129. </template>
  130. <script>
  131. export default {
  132. beforeRouteLeave(to, from, next) {
  133. if(to.name!='OpInvitationOfficialActivityData'){
  134. from.meta.keepAlive = false;
  135. }
  136. next()
  137. },
  138. data() {
  139. return {
  140. loading: false,
  141. tableData: [],
  142. tableDatas: [],
  143. currentPage: 1, // 当前页码
  144. pageSize: 10,// 每页的数据条数
  145. dataCount: 0,//总条数
  146. Country: "",
  147. restaurantsCountry: [],
  148. UnitName: "",
  149. restaurantsUnitName: [],
  150. Contact: "",
  151. restaurantContact: [],
  152. Delegation: "",
  153. restaurantDelegation: [],
  154. Field: "",
  155. restaurantField: [],
  156. CreateUserId: "",
  157. CreateUserList: [],
  158. InviteTime: "",
  159. StartCreateTime: "",
  160. EndCreateTime: "",
  161. input: '',
  162. token: '',
  163. pickerOptions: {
  164. shortcuts: [{
  165. text: '最近一周',
  166. onClick(picker) {
  167. const end = new Date();
  168. const start = new Date();
  169. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  170. picker.$emit('pick', [start, end]);
  171. }
  172. }, {
  173. text: '最近一个月',
  174. onClick(picker) {
  175. const end = new Date();
  176. const start = new Date();
  177. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  178. picker.$emit('pick', [start, end]);
  179. }
  180. }, {
  181. text: '最近三个月',
  182. onClick(picker) {
  183. const end = new Date();
  184. const start = new Date();
  185. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  186. picker.$emit('pick', [start, end]);
  187. }
  188. }]
  189. },
  190. }
  191. },
  192. beforeRouteLeave(to,from,next) {
  193. if(to.name=='OpInvitationOfficialActivityData'){
  194. next();
  195. }else{
  196. this.$store.state.Termsofinvitation={};
  197. next();
  198. }
  199. console.log(this.$store.state.Termsofinvitation)
  200. },
  201. methods: {
  202. //每页条数改变时触发 选择一页显示多少行
  203. handleSizeChange(val) {
  204. this.currentPage = 1;
  205. this.pageSize = val;
  206. this.QueryInvitationOfficialActivityData()
  207. },
  208. //当前页改变时触发 跳转其他页
  209. handleCurrentChange(val) {
  210. this.currentPage = val;
  211. this.QueryInvitationOfficialActivityData()
  212. },
  213. //国家搜索框处理
  214. querySearchCountry(queryString, cb) {
  215. //数据去重处理
  216. var arr = this.restaurantsCountry;
  217. for (var i = 0; i < arr.length - 1; i++) {
  218. for (var j = i + 1; j < arr.length; j++) {
  219. if (arr[i].value == arr[j].value) {
  220. arr.splice(j, 1);
  221. //因为数组长度减小1,所以直接 j++ 会漏掉一个元素,所以要 j--
  222. j--;
  223. }
  224. }
  225. }
  226. var restaurantsCountry = arr;
  227. var results = queryString ? restaurantsCountry.filter(this.createFilter(queryString)) : restaurantsCountry;
  228. // 调用 callback 返回建议列表的数据
  229. cb(results);
  230. },
  231. //邀请方搜索框处理
  232. querySearchUnitName(queryString, cb) {
  233. var arr = this.restaurantsUnitName;
  234. for (var i = 0; i < arr.length - 1; i++) {
  235. for (var j = i + 1; j < arr.length; j++) {
  236. if (arr[i].value == arr[j].value) {
  237. arr.splice(j, 1);
  238. //因为数组长度减小1,所以直接 j++ 会漏掉一个元素,所以要 j--
  239. j--;
  240. }
  241. }
  242. }
  243. var restaurantsUnitName = arr;
  244. var results = queryString ? restaurantsUnitName.filter(this.createFilter(queryString)) : restaurantsUnitName;
  245. // 调用 callback 返回建议列表的数据
  246. cb(results);
  247. },
  248. //联系人搜索框处理
  249. querySearchContact(queryString, cb) {
  250. var arr = this.restaurantContact;
  251. for (var i = 0; i < arr.length - 1; i++) {
  252. for (var j = i + 1; j < arr.length; j++) {
  253. if (arr[i].value == arr[j].value) {
  254. arr.splice(j, 1);
  255. //因为数组长度减小1,所以直接 j++ 会漏掉一个元素,所以要 j--
  256. j--;
  257. }
  258. }
  259. }
  260. var restaurantContact = arr;
  261. var results = queryString ? restaurantContact.filter(this.createFilter(queryString)) : restaurantContact;
  262. // 调用 callback 返回建议列表的数据
  263. cb(results);
  264. },
  265. //领域搜索框处理
  266. querySearchField(queryString, cb) {
  267. var arr = this.restaurantField;
  268. for (var i = 0; i < arr.length - 1; i++) {
  269. for (var j = i + 1; j < arr.length; j++) {
  270. if (arr[i].value == arr[j].value) {
  271. arr.splice(j, 1);
  272. //因为数组长度减小1,所以直接 j++ 会漏掉一个元素,所以要 j--
  273. j--;
  274. }
  275. }
  276. }
  277. var restaurantField = arr;
  278. var results = queryString ? restaurantField.filter(this.createFilter(queryString)) : restaurantField;
  279. // 调用 callback 返回建议列表的数据
  280. cb(results);
  281. },
  282. createFilter(queryString) {
  283. return (restaurant) => {
  284. return (restaurant.value.toLowerCase().indexOf(queryString.toLowerCase()) === 0);
  285. };
  286. },
  287. //查询添加vuex
  288. QueryData() {
  289. this.$store.state.Termsofinvitation = {
  290. Country:this.Country,
  291. UnitName:this.UnitName,
  292. Contact:this.Contact,
  293. Delegation:this.Delegation,
  294. CreateUserId:this.CreateUserId,
  295. InviteTime:this.InviteTime,
  296. Field:this.Field,
  297. };
  298. this.currentPage = 1;
  299. this.QueryInvitationOfficialActivityData()
  300. },
  301. //判断全局变量是否有值
  302. estimatevuex(){
  303. console.log(this.$store.state.Termsofinvitation);
  304. this.Country=this.$store.state.Termsofinvitation.Country?this.$store.state.Termsofinvitation.Country:'';
  305. this.UnitName=this.$store.state.Termsofinvitation.UnitName?this.$store.state.Termsofinvitation.UnitName:'';
  306. this.Contact=this.$store.state.Termsofinvitation.Contact?this.$store.state.Termsofinvitation.Contact:'';
  307. this.Delegation=this.$store.state.Termsofinvitation.Delegation?this.$store.state.Termsofinvitation.Delegation:'';
  308. this.CreateUserId=this.$store.state.Termsofinvitation.CreateUserId?this.$store.state.Termsofinvitation.CreateUserId:'';
  309. this.InviteTime=this.$store.state.Termsofinvitation.InviteTime?this.$store.state.Termsofinvitation.InviteTime:'';
  310. this.Field=this.$store.state.Termsofinvitation.Field?this.$store.state.Termsofinvitation.Field:'';
  311. this.currentPage=this.$store.state.Termsofinvitation.pgindex?this.$store.state.Termsofinvitation.pgindex:1;
  312. this.pageSize=this.$store.state.Termsofinvitation.pageSize?this.$store.state.Termsofinvitation.pageSize:10;
  313. },
  314. //基础数据
  315. QueryIOAInitData() {
  316. var url = "/api/Resource/QueryIOAInitData"
  317. var that = this
  318. this.$axios({
  319. method: 'post',
  320. url: url,
  321. headers: {
  322. Authorization: 'Bearer ' + that.token
  323. },
  324. data: {
  325. PortType: 1
  326. }
  327. }).then(function (res) {
  328. console.log(res)
  329. if (res.data.code == 200) {
  330. res.data.data.countryData.forEach(function (item, index) {
  331. that.restaurantsCountry.push({
  332. value: item,
  333. });
  334. });
  335. res.data.data.contactData.forEach(function (item, index) {
  336. that.restaurantContact.push({
  337. value: item,
  338. });
  339. });
  340. res.data.data.inviterData.forEach(function (item, index) {
  341. that.restaurantsUnitName.push({
  342. value: item,
  343. });
  344. });
  345. res.data.data.domainData.forEach(function (item, index) {
  346. that.restaurantField.push({
  347. value: item,
  348. });
  349. });
  350. that.restaurantDelegation=res.data.data.groupNameData;
  351. that.CreateUserList=res.data.data.userNameData;
  352. }else{
  353. that.$message.error(res.data.msg);
  354. }
  355. }).catch(function (error) {
  356. that.$message.error(error);
  357. });
  358. },
  359. QueryInvitationOfficialActivityData() {
  360. console.log(this.Delegation)
  361. var CreateUser = 0;
  362. if (this.CreateUserId == "" || this.CreateUserId == undefined || this.CreateUserId == null) {
  363. CreateUser = 0
  364. } else {
  365. CreateUser = this.CreateUserId
  366. }
  367. if (this.InviteTime != "" && this.InviteTime != undefined && this.InviteTime != null) {
  368. this.StartCreateTime = this.InviteTime[0]
  369. this.EndCreateTime = this.InviteTime[1]
  370. } else {
  371. this.StartCreateTime = ""
  372. this.EndCreateTime = ""
  373. }
  374. this.loading = true
  375. var url = "/api/Resource/QueryInvitationOfficialActivityData"
  376. var that = this
  377. this.$axios({
  378. method: 'post',
  379. url: url,
  380. headers: {
  381. Authorization: 'Bearer ' + this.token
  382. },
  383. data: {
  384. portType: 1,
  385. pageIndex: that.currentPage,
  386. pageSize: that.pageSize,
  387. Country: that.Country,
  388. UnitName: that.UnitName,
  389. Contact: that.Contact,
  390. Delegation: that.Delegation.toString(),
  391. Field: that.Field,
  392. CreateUserId: CreateUser,
  393. StartCreateTime: that.StartCreateTime,
  394. EndCreateTime: that.EndCreateTime
  395. }
  396. }).then(function (res) {
  397. console.log(res)
  398. if (res.data.code == 200) {
  399. //#endregion
  400. that.tableData = res.data.data;
  401. that.dataCount=res.data.count;
  402. } else {
  403. that.tableDatas = [];
  404. }
  405. that.loading = false
  406. }).catch(function (error) {
  407. that.loading = false
  408. that.$message.error(error);
  409. });
  410. },
  411. QueryCount() {
  412. var CreateUser = 0;
  413. if (this.CreateUserId == "" || this.CreateUserId == undefined || this.CreateUserId == null) {
  414. CreateUser = 0
  415. } else {
  416. CreateUser = this.CreateUserId
  417. }
  418. if (this.InviteTime != "" && this.InviteTime != undefined && this.InviteTime != null) {
  419. this.StartCreateTime = this.InviteTime[0]
  420. this.EndCreateTime = this.InviteTime[1]
  421. } else {
  422. this.StartCreateTime = ""
  423. this.EndCreateTime = ""
  424. }
  425. this.loading = true
  426. var url = "/api/Resource/QueryInvitationOfficialActivityData"
  427. var that = this
  428. this.$axios({
  429. method: 'post',
  430. url: url,
  431. headers: {
  432. Authorization: 'Bearer ' + this.token
  433. },
  434. data: {
  435. portType: 1,
  436. pageIndex: 0,
  437. pageSize: 0,
  438. Country: '',
  439. UnitName: '',
  440. Contact: '',
  441. Delegation: '',
  442. Field: '',
  443. CreateUserId: CreateUser,
  444. StartCreateTime: that.StartCreateTime,
  445. EndCreateTime: that.EndCreateTime
  446. }
  447. }).then(function (res) {
  448. console.log(res)
  449. if (res.data.code == 200) {
  450. that.tableData = res.data.data;
  451. that.tableDatas = that.tableData
  452. if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
  453. if (that.currentPage > 1) {
  454. that.currentPage = that.currentPage - 1;
  455. }
  456. }
  457. if (that.CreateUserId != 0 && that.CreateUserId != "") {
  458. that.dataCount = that.tableDatas.length
  459. }
  460. } else {
  461. that.tableDatas = [];
  462. }
  463. that.loading = false
  464. }).catch(function (error) {
  465. that.loading = false
  466. that.$message.error("网络错误,请稍后重试");
  467. });
  468. },
  469. del(index, row) {
  470. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  471. confirmButtonText: '确定',
  472. cancelButtonText: '取消',
  473. type: 'warning'
  474. }).then(() => {
  475. var url = "/api/Resource/DelInvitationOfficialActivity"
  476. var that = this
  477. this.$axios({
  478. method: 'post',
  479. url: url,
  480. headers: {
  481. Authorization: 'Bearer ' + this.token
  482. },
  483. data: {
  484. Id: row.id,
  485. DeleteUserId: this.userId
  486. }
  487. }).then(function (res) {
  488. console.log(res)
  489. if (res.data.code == 200) {
  490. that.$message({
  491. message: '删除成功',
  492. type: 'success'
  493. });
  494. that.QueryInvitationOfficialActivityData();
  495. } else {
  496. that.$message.error('删除失败!');
  497. }
  498. that.loading = false
  499. }).catch(function (error) {
  500. that.loading = false
  501. that.$message.error("网络错误,请稍后重试");
  502. });
  503. }).catch(() => {
  504. this.$message({
  505. type: 'info',
  506. message: '操作已取消!'
  507. });
  508. });
  509. },
  510. upDate(index, row) {
  511. this.$store.state.Termsofinvitation.pgindex=this.currentPage;
  512. this.$store.state.Termsofinvitation.pageSize=this.pageSize;
  513. this.$router.push({
  514. path: "/home/OpInvitationOfficialActivityData",
  515. query: { id: row.id }
  516. })
  517. },
  518. },
  519. filters:{
  520. //空默认值
  521. filter_emptyAcquiesce(value) {
  522. let fhz= value==""?"--":value
  523. return fhz
  524. },
  525. },
  526. created(){
  527. this.estimatevuex()
  528. },
  529. mounted() {
  530. this.QueryIOAInitData();
  531. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  532. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  533. this.QueryInvitationOfficialActivityData();
  534. }
  535. }
  536. </script>
  537. <style>
  538. .communal-list {
  539. background-color: #fff;
  540. padding: 10px;
  541. box-shadow: 0 0 5px #0005;
  542. border-radius: 10px;
  543. min-height: 830px;
  544. }
  545. .communal-list .block{
  546. margin-top: 15px;
  547. }
  548. .communal-title {
  549. display: flex;
  550. font-size: 17px;
  551. font-weight: 600;
  552. color: #555;
  553. margin-top: 8px;
  554. margin-bottom: 10px;
  555. justify-content: space-between;
  556. align-items: center;
  557. }
  558. .communal-box {
  559. display: flex;
  560. }
  561. .communal-box>button {
  562. margin-left: 10px;
  563. padding: 8px 20px;
  564. }
  565. .title {
  566. width: 80px;
  567. overflow: hidden;
  568. text-overflow: ellipsis;
  569. white-space: nowrap;
  570. cursor: pointer;
  571. }
  572. </style>