InvitationOfficialActivityData.vue 21 KB

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