AskData.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <template>
  2. <div>
  3. <div class="communal-list">
  4. <div>
  5. <div class="communal-title">
  6. <div>请示数据库</div>
  7. </div>
  8. <div style="display: flex;">
  9. <div style="width: 60%;display: flex;">
  10. <div style="width: 25%;">
  11. <el-input clearable placeholder="国家" v-model="Country">
  12. </el-input>
  13. </div>
  14. <div style="width: 25%;">
  15. <el-input clearable placeholder="地区" v-model="Area">
  16. </el-input>
  17. </div>
  18. <div style="width: 25%;">
  19. <el-input clearable placeholder="领域" v-model="Field">
  20. </el-input>
  21. </div>
  22. <div style="width: 25%;">
  23. <el-button type="primary" style="margin-left: 10px;" @click="QueryAskData">查询</el-button>
  24. </div>
  25. </div>
  26. <div style="width: 40%;">
  27. <el-select v-model="DiId" placeholder="团组选择" clearable filterable>
  28. <el-option v-for="item in delegationInfoList" :key="item.id" :label="item.teamName"
  29. :value="item.id">
  30. </el-option>
  31. </el-select>
  32. <el-button type="primary" style="margin-left: 10px;">省外办请示</el-button>
  33. <el-button type="primary" style="margin-left: 10px;">市外办请示</el-button>
  34. ||
  35. <router-link :to="{ path: '/home/OpAskData' }">
  36. <el-button type="primary" style="margin-left: 10px;">新增</el-button>
  37. </router-link>
  38. </div>
  39. </div>
  40. </div>
  41. <hr style='background-color:#5555; height:1px; border:none;' />
  42. <template>
  43. <el-table :data="tableDatas.slice((currentPage - 1) * pageSize, currentPage * pageSize)" border
  44. style="width: 100%" v-loading="loading" element-loading-text="拼命加载中..."
  45. @selection-change="handleSelectionChange">
  46. <el-table-column type="selection" width="55">
  47. </el-table-column>
  48. <el-table-column prop="num" label="序 号" width="55">
  49. <template slot-scope="scope">
  50. {{ (currentPage - 1) * pageSize + scope.$index + 1 }}
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="deleName" label="所属团组">
  54. </el-table-column>
  55. <el-table-column prop="country" label="国家">
  56. </el-table-column>
  57. <el-table-column prop="area" label="地区">
  58. </el-table-column>
  59. <el-table-column prop="unitName" label="公务方名称">
  60. </el-table-column>
  61. <el-table-column prop="field" label="涉及领域">
  62. </el-table-column>
  63. <el-table-column prop="talkCase" label="请示范例">
  64. <template slot-scope="r">
  65. <div :title="r.row.talkCase" class="title">{{ r.row.talkCase }}</div>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="操作" width="280">
  69. <template slot-scope="scope">
  70. <el-button size="mini" @click="upDate(scope.$index, scope.row)">编辑</el-button>
  71. <el-button size="mini" type="danger" @click="del(scope.$index, scope.row)">删除</el-button>
  72. </template>
  73. </el-table-column>
  74. </el-table>
  75. </template>
  76. <div class="block">
  77. <el-pagination align='center' @size-change="handleSizeChange" @current-change="handleCurrentChange"
  78. :current-page="currentPage" :page-sizes="[10, 12, 15, 20]" :page-size="pageSize"
  79. layout="total, sizes, prev, pager, next" :total="tableDatas.length">
  80. </el-pagination>
  81. </div>
  82. </div>
  83. </div>
  84. </template>
  85. <script>
  86. export default {
  87. data() {
  88. return {
  89. loading: false,
  90. tableDatas: [],
  91. tableData: [],
  92. currentPage: 1, // 当前页码
  93. pageSize: 12,// 每页的数据条数
  94. input: '',
  95. token: '',
  96. userId: 0,
  97. DiId: '',
  98. Country: "",
  99. Area: "",
  100. Field: "",
  101. delegationInfoList: [],
  102. }
  103. },
  104. methods: {
  105. //每页条数改变时触发 选择一页显示多少行
  106. handleSizeChange(val) {
  107. this.currentPage = 1;
  108. this.pageSize = val;
  109. },
  110. //当前页改变时触发 跳转其他页
  111. handleCurrentChange(val) {
  112. this.currentPage = val;
  113. },
  114. //页面初始化
  115. QueryAskData() {
  116. var url = "/api/Resource/QueryAskData"
  117. var that = this
  118. this.$axios({
  119. method: 'post',
  120. url: url,
  121. headers: {
  122. Authorization: 'Bearer ' + this.token
  123. },
  124. data: {
  125. Country: that.Country,
  126. Area: that.Area,
  127. Field: that.Field,
  128. }
  129. }).then(function (res) {
  130. if (res.data.code == 200) {
  131. debugger
  132. that.delegationInfoList = res.data.data.delegationInfo;
  133. that.DiId = that.delegationInfoList[0].id;
  134. that.tableDatas = res.data.data.askDatd;
  135. that.tableData = that.tableDatas
  136. if (that.tableDatas.length != 0) {
  137. if (that.tableDatas.slice((that.currentPage - 1) * that.pageSize, that.currentPage * that.pageSize).length == 0) {
  138. if (that.currentPage > 1) {
  139. that.currentPage = that.currentPage - 1;
  140. }
  141. }
  142. }
  143. }
  144. }).catch(function (error) {
  145. that.$message.error("网络错误,请稍后重试");
  146. });
  147. },
  148. upDate(index, row) {
  149. this.$router.push({
  150. path: "/home/OpAskData",
  151. query: {
  152. id: row.id
  153. }
  154. })
  155. },
  156. del(index, row) {
  157. this.$confirm('此操作将删除该数据, 是否继续?', '提示', {
  158. confirmButtonText: '确定',
  159. cancelButtonText: '取消',
  160. type: 'warning'
  161. }).then(() => {
  162. var url = "/api/Resource/DelAskData"
  163. var that = this
  164. this.$axios({
  165. method: 'post',
  166. url: url,
  167. headers: {
  168. Authorization: 'Bearer ' + this.token
  169. },
  170. data: {
  171. Id: row.id,
  172. DeleteUserId: this.userId
  173. }
  174. }).then(function (res) {
  175. console.log(res)
  176. if (res.data.code == 200) {
  177. that.$message({
  178. message: '删除成功',
  179. type: 'success'
  180. });
  181. that.QueryOfficialActivitiesByDiId();
  182. } else {
  183. that.$message.error('删除失败!');
  184. }
  185. that.loading = false
  186. }).catch(function (error) {
  187. that.loading = false
  188. that.$message.error("网络错误,请稍后重试");
  189. });
  190. }).catch(() => {
  191. this.$message({
  192. type: 'info',
  193. message: '操作已取消!'
  194. });
  195. });
  196. },
  197. handleSelectionChange(val) {
  198. console.log(val)
  199. },
  200. },
  201. mounted() {
  202. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  203. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  204. this.QueryAskData();
  205. //this.AirTicketResList()
  206. }
  207. }
  208. </script>
  209. <style>
  210. .communal-list {
  211. background-color: #fff;
  212. padding: 10px;
  213. box-shadow: 0 0 5px #0005;
  214. border-radius: 10px;
  215. }
  216. .communal-title {
  217. display: flex;
  218. font-size: 17px;
  219. font-weight: 600;
  220. color: #555;
  221. margin-top: 8px;
  222. margin-bottom: 10px;
  223. justify-content: space-between;
  224. align-items: center;
  225. }
  226. .communal-box {
  227. display: flex;
  228. }
  229. .communal-box>button {
  230. margin-left: 10px;
  231. padding: 8px 20px;
  232. }
  233. .title {
  234. width: 90%;
  235. overflow: hidden;
  236. text-overflow: ellipsis;
  237. white-space: nowrap;
  238. cursor: pointer;
  239. }
  240. </style>