applicationExamine-list.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. <template>
  2. <div>
  3. <el-breadcrumb separator=">">
  4. <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  5. <el-breadcrumb-item>
  6. <a href="#">系统管理</a>
  7. </el-breadcrumb-item>
  8. <el-breadcrumb-item>
  9. <a href="/applicationExamine">审批角色管理</a>
  10. </el-breadcrumb-item>
  11. </el-breadcrumb>
  12. <el-divider></el-divider>
  13. <!--
  14. 要resetFields起作用,必须配置:model和prop
  15. -->
  16. <el-form
  17. ref="queryForm"
  18. :model="queryModel"
  19. inline
  20. class="demo-form-inline"
  21. >
  22. <el-form-item label="申请者公司" prop="applicationCompanyId">
  23. <el-select-tree
  24. :props="props"
  25. :options="companyResult"
  26. v-model="queryModel.applicationCompanyId"
  27. size=""
  28. height="200"
  29. ></el-select-tree
  30. >&nbsp;
  31. <el-checkbox v-model="queryModel.applicationSubordinate"
  32. >是否包含下级单位</el-checkbox
  33. >
  34. </el-form-item>
  35. <el-form-item label="审核人公司" prop="examineCompanyId">
  36. <el-select-tree
  37. :props="props"
  38. :options="companyResult"
  39. v-model="queryModel.examineCompanyId"
  40. size=""
  41. height="200"
  42. ></el-select-tree
  43. >&nbsp;
  44. <el-checkbox v-model="queryModel.examineSubordinate"
  45. >是否包含下级单位</el-checkbox
  46. >
  47. </el-form-item>
  48. <el-form-item>
  49. <el-button
  50. type="primary"
  51. size="mini"
  52. icon="ios-search"
  53. @click="changePage(1)"
  54. :loading="loading"
  55. >查询</el-button
  56. >&nbsp;
  57. <el-button
  58. type="info"
  59. size="mini"
  60. style="margin-left: 8px"
  61. @click="handleReset('queryForm')"
  62. >重置</el-button
  63. >&nbsp;
  64. </el-form-item>
  65. </el-form>
  66. <el-divider></el-divider>
  67. <el-row class="button-group">
  68. <el-button
  69. type="primary"
  70. size="small"
  71. plain
  72. icon="el-icon-circle-plus"
  73. @click="handleAdd"
  74. >新增</el-button
  75. >
  76. <el-button
  77. type="primary"
  78. size="small"
  79. plain
  80. icon="el-icon-circle-plus"
  81. :disabled="multipleSelection.length == 0"
  82. @click="handleBatchDelete"
  83. >删除选中项</el-button
  84. >
  85. </el-row>
  86. <el-table
  87. :data="tableData"
  88. style="min-height: 400px"
  89. v-loading="loading"
  90. stripe
  91. @sort-change="sortChange"
  92. @selection-change="handleSelectionChange"
  93. >
  94. <el-table-column type="selection" width="55"></el-table-column>
  95. <el-table-column
  96. type="index"
  97. label="序号"
  98. :index="indexMethod"
  99. width="50"
  100. ></el-table-column>
  101. <el-table-column
  102. prop="applicationCompanyName"
  103. label="申请者公司"
  104. width="180"
  105. ></el-table-column>
  106. <el-table-column
  107. prop="applicationRoleName"
  108. label="申请者角色"
  109. width="180"
  110. ></el-table-column>
  111. <el-table-column
  112. prop="examineCompanyName"
  113. label="审核人公司"
  114. width="180"
  115. ></el-table-column>
  116. <el-table-column
  117. prop="examineRoleName"
  118. label="审核人角色"
  119. width="180"
  120. ></el-table-column>
  121. <el-table-column
  122. prop="remark"
  123. label="备注信息"
  124. width="180"
  125. ></el-table-column>
  126. <el-table-column label="操作">
  127. <template slot-scope="{ row }">
  128. <el-button size="mini" type="warning" @click="handleEdit(row)"
  129. >编辑</el-button
  130. >
  131. <el-button size="mini" type="danger" @click="handleDelete(row)"
  132. >删除</el-button
  133. >
  134. </template>
  135. </el-table-column>
  136. </el-table>
  137. <el-pagination
  138. :current-page.sync="pageIndex"
  139. :total="totalElements"
  140. :page-sizes="pageSizeList"
  141. @current-change="changePage"
  142. @size-change="pageSizeChange"
  143. layout="total, sizes, prev, pager, next, jumper"
  144. ></el-pagination>
  145. <applicationExamine-detail
  146. v-if="showModal"
  147. :businessKey="businessKey"
  148. :title="modalTitle"
  149. @close="onDetailModalClose"
  150. ></applicationExamine-detail>
  151. </div>
  152. </template>
  153. <script>
  154. import Constant from "@/constant";
  155. import ApplicationExamineDetail from "./applicationExamine-detail";
  156. import applicationExamineApi from "@/api/base/applicationExamine";
  157. import companyInfoApi from "@/api/base/companyInfo";
  158. import NProgress from "nprogress"; // progress bar
  159. import "nprogress/nprogress.css"; // progress bar style
  160. import SelectTree from "@/components/SelectTree";
  161. export default {
  162. name: "baseApplicationExamineList",
  163. data() {
  164. var self = this;
  165. return {
  166. queryModel: {
  167. applicationRoleId: "",
  168. applicationCompanyId: "",
  169. applicationSubordinate: false,
  170. examineRoleId: "",
  171. examineCompanyId: "",
  172. examineSubordinate: false,
  173. },
  174. loading: false,
  175. tableData: [],
  176. pageIndex: 1,
  177. pageSize: 10,
  178. totalPages: 0,
  179. totalElements: 0,
  180. field: "",
  181. direction: "",
  182. pageSizeList: [10, 20, 30],
  183. multipleSelection: [],
  184. showModal: false,
  185. modalTitle: "",
  186. businessKey: "",
  187. treeData: [],
  188. props: {
  189. // 配置项(必选)
  190. value: "id",
  191. label: "name",
  192. children: "children",
  193. },
  194. companyResult: []
  195. };
  196. },
  197. created() {
  198. var self = this;
  199. companyInfoApi.list().then(function (response) {
  200. var jsonData = response.data;
  201. if (jsonData.result) {
  202. if (jsonData.data != null && jsonData.data != "") {
  203. self.companyResult = jsonData.data;
  204. }
  205. }
  206. });
  207. },
  208. methods: {
  209. indexMethod(index) {
  210. return (this.pageIndex - 1) * this.pageSize + (index + 1);
  211. },
  212. changePage(pageIndex) {
  213. var self = this;
  214. self.loading = true;
  215. self.pageIndex = pageIndex;
  216. var formData = new FormData();
  217. formData.append("pageIndex", self.pageIndex);
  218. formData.append("pageSize", self.pageSize);
  219. formData.append("applicationRoleId", self.queryModel.applicationRoleId);
  220. if (self.queryModel.applicationCompanyId == null) {
  221. self.queryModel.applicationCompanyId = "";
  222. }
  223. formData.append(
  224. "applicationCompanyId",
  225. self.queryModel.applicationCompanyId
  226. );
  227. formData.append("applicationSubordinate", self.queryModel.applicationSubordinate);
  228. formData.append("examineRoleId", self.queryModel.examineRoleId);
  229. if (self.queryModel.examineCompanyId == null) {
  230. self.queryModel.examineCompanyId = "";
  231. }
  232. formData.append("examineCompanyId", self.queryModel.examineCompanyId);
  233. formData.append("examineSubordinate", self.queryModel.examineSubordinate);
  234. if (this.field != null) {
  235. formData.append("field", this.field);
  236. }
  237. if (this.direction != null) {
  238. formData.append("direction", this.direction);
  239. }
  240. applicationExamineApi
  241. .pageList(formData)
  242. .then(function (response) {
  243. self.loading = false;
  244. var jsonData = response.data.data;
  245. self.tableData = jsonData.data;
  246. self.totalPages = jsonData.totalPages;
  247. self.totalElements = jsonData.recordsTotal;
  248. })
  249. .catch((error) => {
  250. self.loading = false;
  251. // self.$message.error(error + "");
  252. });
  253. },
  254. pageSizeChange(pageSize) {
  255. this.pageSize = pageSize;
  256. this.$nextTick(() => {
  257. this.changePage(this.pageIndex);
  258. });
  259. },
  260. sortChange(data) {
  261. this.field = data.column.field;
  262. this.direction = data.order;
  263. this.changePage(this.pageIndex);
  264. },
  265. handleSelectionChange(val) {
  266. this.multipleSelection = val;
  267. },
  268. handleReset(name) {
  269. this.$refs[name].resetFields();
  270. },
  271. handleAdd() {
  272. this.modalTitle = "新增";
  273. this.businessKey = "";
  274. this.showModal = true;
  275. },
  276. handleEdit(record) {
  277. this.modalTitle = "编辑";
  278. this.businessKey = record.id;
  279. this.showModal = true;
  280. },
  281. handleDelete(record) {
  282. var self = this;
  283. self
  284. .$confirm("是否确认删除?", "提示", {
  285. confirmButtonText: "确定",
  286. cancelButtonText: "取消",
  287. type: "warning",
  288. })
  289. .then(() => {
  290. applicationExamineApi.remove(record.id).then(function (response) {
  291. var jsonData = response.data;
  292. if (jsonData.result) {
  293. // var index = self.tableData.indexOf(record);
  294. // self.tableData.splice(index, 1);
  295. self.changePage(self.pageIndex);
  296. self.$message({
  297. type: "success",
  298. message: "删除成功!",
  299. });
  300. }
  301. });
  302. });
  303. },
  304. handleBatchDelete() {
  305. var self = this;
  306. var idList = this.multipleSelection.map((record) => {
  307. return record.id;
  308. });
  309. this.$confirm("是否确认删除选中项?", "提示", {
  310. confirmButtonText: "确定",
  311. cancelButtonText: "取消",
  312. type: "warning",
  313. }).then(() => {
  314. applicationExamineApi.batchRemove(idList).then(function (response) {
  315. var jsonData = response.data;
  316. if (jsonData.result) {
  317. self.changePage(self.pageIndex);
  318. self.$message({
  319. type: "success",
  320. message: "删除成功!",
  321. });
  322. }
  323. });
  324. });
  325. },
  326. onDetailModalClose(refreshed) {
  327. //保存成功后回调
  328. this.showModal = false;
  329. if (refreshed) {
  330. this.changePage(this.pageIndex);
  331. }
  332. },
  333. },
  334. mounted: function () {
  335. this.changePage(1);
  336. },
  337. components: {
  338. "applicationExamine-detail": ApplicationExamineDetail,
  339. "el-select-tree": SelectTree,
  340. },
  341. };
  342. </script>
  343. <style lang="scss" scoped>
  344. .el-breadcrumb {
  345. margin: 10px;
  346. line-height: 20px;
  347. }
  348. .el-divider {
  349. margin: 5px 0;
  350. }
  351. .demo-form-inline {
  352. margin-left: 10px;
  353. text-align: left;
  354. }
  355. .button-group {
  356. margin-left: 10px;
  357. text-align: left;
  358. }
  359. </style>