InvitationOfficialActivityData.vue 22 KB

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