InvitationOfficialActivityData.vue 26 KB

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