applicationExamine-list.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  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-row>
  23. <el-form-item label="申请者公司" prop="applicationCompanyId">
  24. <el-select-tree
  25. :props="props"
  26. :options="companyResult"
  27. v-model="queryModel.applicationCompanyId"
  28. size="mini"
  29. height="200"
  30. ></el-select-tree
  31. >&nbsp;
  32. <el-checkbox v-model="queryModel.applicationSubordinate"
  33. >是否包含下级单位</el-checkbox
  34. >
  35. </el-form-item>
  36. <el-form-item label="申请者角色" prop="applicationRoleId">
  37. <el-select
  38. v-model="queryModel.applicationRoleId"
  39. filterable
  40. clearable
  41. placeholder="请选择"
  42. style="width: 200"
  43. size="mini"
  44. >
  45. <el-option
  46. v-for="role in applicationRoleResult"
  47. :key="role.id"
  48. :label="role.personRoleName"
  49. :value="role.id"
  50. ></el-option>
  51. </el-select>
  52. </el-form-item>
  53. <el-form-item label="审批类型" prop="type">
  54. <el-select
  55. v-model="queryModel.type"
  56. filterable
  57. size="mini"
  58. clearable
  59. placeholder="请选择"
  60. style="width: 200px"
  61. >
  62. <el-option
  63. v-for="result in examineTypeResult"
  64. :key="result.value"
  65. :label="result.name"
  66. :value="result.value"
  67. ></el-option>
  68. </el-select>
  69. </el-form-item>
  70. </el-row>
  71. <el-row>
  72. <el-form-item label="审核人公司" prop="examineCompanyId">
  73. <el-select-tree
  74. :props="props"
  75. :options="companyResult"
  76. v-model="queryModel.examineCompanyId"
  77. size="mini"
  78. height="200"
  79. ></el-select-tree
  80. >&nbsp;
  81. <el-checkbox v-model="queryModel.examineSubordinate"
  82. >是否包含下级单位</el-checkbox
  83. >
  84. </el-form-item>
  85. <el-form-item label="审批等级" prop="level">
  86. <el-input
  87. size="mini"
  88. v-model="queryModel.level"
  89. style="width: 80px"
  90. ></el-input>
  91. </el-form-item>
  92. <el-form-item>
  93. <el-button
  94. type="primary"
  95. size="mini"
  96. icon="ios-search"
  97. @click="changePage(1)"
  98. :loading="loading"
  99. >查询</el-button
  100. >&nbsp;
  101. <el-button
  102. type="info"
  103. size="mini"
  104. style="margin-left: 8px"
  105. @click="handleReset('queryForm')"
  106. >重置</el-button
  107. >&nbsp;
  108. </el-form-item>
  109. </el-row>
  110. </el-form>
  111. <el-divider></el-divider>
  112. <el-row class="button-group">
  113. <el-button
  114. type="primary"
  115. size="small"
  116. plain
  117. icon="el-icon-circle-plus"
  118. @click="handleAdd"
  119. >新增</el-button
  120. >
  121. <el-button
  122. type="primary"
  123. size="small"
  124. plain
  125. icon="el-icon-circle-plus"
  126. :disabled="multipleSelection.length == 0"
  127. @click="handleBatchDelete"
  128. >删除选中项</el-button
  129. >
  130. </el-row>
  131. <el-table
  132. :data="tableData"
  133. style="min-height: 400px"
  134. v-loading="loading"
  135. stripe
  136. @sort-change="sortChange"
  137. @selection-change="handleSelectionChange"
  138. >
  139. <el-table-column type="selection" width="55"></el-table-column>
  140. <el-table-column
  141. type="index"
  142. label="序号"
  143. :index="indexMethod"
  144. width="50"
  145. ></el-table-column>
  146. <el-table-column
  147. prop="applicationCompanyName"
  148. label="申请者公司"
  149. width="180"
  150. ></el-table-column>
  151. <el-table-column
  152. prop="applicationRoleName"
  153. label="申请者角色"
  154. width="150"
  155. ></el-table-column>
  156. <el-table-column
  157. prop="includeSubordinate"
  158. label="是否包括下级单位"
  159. width="100"
  160. >
  161. </el-table-column>
  162. <el-table-column
  163. prop="typeName"
  164. label="审批类型"
  165. width="100"
  166. ></el-table-column>
  167. <el-table-column prop="level" label="审批等级" width="100">
  168. <template slot-scope="{ row }">
  169. <span v-if="row.level != '' && row.level != null">lv.{{ row.level }}</span>
  170. <span v-else>{{ row.level }}</span>
  171. </template></el-table-column
  172. >
  173. <el-table-column
  174. prop="examineCompanyName"
  175. label="审核人公司"
  176. width="180"
  177. ></el-table-column>
  178. <el-table-column
  179. prop="examineRoleName"
  180. label="审核人角色"
  181. width="150"
  182. ></el-table-column>
  183. <el-table-column
  184. prop="days"
  185. label="请假天数"
  186. width="100"
  187. ></el-table-column>
  188. <el-table-column
  189. prop="remark"
  190. label="备注信息"
  191. ></el-table-column>
  192. <el-table-column label="操作" width="130" fixed="right">
  193. <template slot-scope="{ row }">
  194. <el-row>
  195. <el-col :span="12">
  196. <el-link type="primary" @click="handleEdit(row)">编辑</el-link>
  197. </el-col>
  198. <el-col :span="12">
  199. <el-link type="danger" @click="handleDelete(row)">删除</el-link>
  200. </el-col>
  201. </el-row>
  202. </template>
  203. </el-table-column>
  204. </el-table>
  205. <el-pagination
  206. :current-page.sync="pageIndex"
  207. :total="totalElements"
  208. :page-sizes="pageSizeList"
  209. @current-change="changePage"
  210. @size-change="pageSizeChange"
  211. layout="total, sizes, prev, pager, next, jumper"
  212. ></el-pagination>
  213. <applicationExamine-detail
  214. v-if="showModal"
  215. :businessKey="businessKey"
  216. :title="modalTitle"
  217. @close="onDetailModalClose"
  218. ></applicationExamine-detail>
  219. </div>
  220. </template>
  221. <script>
  222. import Constant from "@/constant";
  223. import ApplicationExamineDetail from "./applicationExamine-detail";
  224. import applicationExamineApi from "@/api/base/applicationExamine";
  225. import dataDictionaryApi from "@/api/sys/dataDictionary";
  226. import personRoleInfoApi from "@/api/base/personRoleInfo";
  227. import companyInfoApi from "@/api/base/companyInfo";
  228. import NProgress from "nprogress"; // progress bar
  229. import "nprogress/nprogress.css"; // progress bar style
  230. import SelectTree from "@/components/SelectTree";
  231. export default {
  232. name: "baseApplicationExamineList",
  233. data() {
  234. var self = this;
  235. return {
  236. queryModel: {
  237. applicationRoleId: "",
  238. applicationCompanyId: "",
  239. applicationSubordinate: false,
  240. examineRoleId: "",
  241. examineCompanyId: "",
  242. examineSubordinate: false,
  243. type:"",
  244. level:""
  245. },
  246. loading: false,
  247. tableData: [],
  248. pageIndex: 1,
  249. pageSize: 10,
  250. totalPages: 0,
  251. totalElements: 0,
  252. field: "",
  253. direction: "",
  254. pageSizeList: [10, 20, 30],
  255. multipleSelection: [],
  256. showModal: false,
  257. modalTitle: "",
  258. businessKey: "",
  259. treeData: [],
  260. props: {
  261. // 配置项(必选)
  262. value: "id",
  263. label: "name",
  264. children: "children",
  265. },
  266. companyResult: [],
  267. applicationRoleResult:[],
  268. examineTypeResult:[]
  269. };
  270. },
  271. watch: {
  272. "queryModel.applicationCompanyId": function (val, oldval) {
  273. if (val != null && val != "") {
  274. var self = this;
  275. var formData = new FormData();
  276. formData.append("companyId", val);
  277. personRoleInfoApi.listByCompanyId(formData).then(function (response) {
  278. var jsonData = response.data;
  279. if (jsonData.result) {
  280. if (jsonData.data != null && jsonData.data != "") {
  281. self.applicationRoleResult = jsonData.data;
  282. // applicationCompanyId
  283. // applicationRoleId
  284. // examineCompanyId
  285. // examineRoleId
  286. }
  287. }
  288. });
  289. }
  290. }
  291. },
  292. created() {
  293. var self = this;
  294. companyInfoApi.list().then(function (response) {
  295. var jsonData = response.data;
  296. if (jsonData.result) {
  297. if (jsonData.data != null && jsonData.data != "") {
  298. self.companyResult = jsonData.data;
  299. }
  300. }
  301. });
  302. var formData = new FormData();
  303. formData.append("catalogName", "审批类型");
  304. dataDictionaryApi.findByCatalogName(formData).then((response) => {
  305. var jsonData = response.data;
  306. this.examineTypeResult = jsonData.data;
  307. });
  308. },
  309. methods: {
  310. indexMethod(index) {
  311. return (this.pageIndex - 1) * this.pageSize + (index + 1);
  312. },
  313. changePage(pageIndex) {
  314. var self = this;
  315. self.loading = true;
  316. self.pageIndex = pageIndex;
  317. var formData = new FormData();
  318. formData.append("pageIndex", self.pageIndex);
  319. formData.append("pageSize", self.pageSize);
  320. formData.append("applicationRoleId", self.queryModel.applicationRoleId);
  321. if (self.queryModel.applicationCompanyId == null) {
  322. self.queryModel.applicationCompanyId = "";
  323. }
  324. formData.append(
  325. "applicationCompanyId",
  326. self.queryModel.applicationCompanyId
  327. );
  328. formData.append(
  329. "applicationSubordinate",
  330. self.queryModel.applicationSubordinate
  331. );
  332. formData.append("examineRoleId", self.queryModel.examineRoleId);
  333. if (self.queryModel.examineCompanyId == null) {
  334. self.queryModel.examineCompanyId = "";
  335. }
  336. formData.append("examineCompanyId", self.queryModel.examineCompanyId);
  337. formData.append("examineSubordinate", self.queryModel.examineSubordinate);
  338. if (this.field != null) {
  339. formData.append("field", this.field);
  340. }
  341. if (this.direction != null) {
  342. formData.append("direction", this.direction);
  343. }
  344. if (self.queryModel.type != null) {
  345. formData.append("type", self.queryModel.type);
  346. }
  347. if (self.queryModel.level != null) {
  348. formData.append("level",self.queryModel.level);
  349. }
  350. applicationExamineApi
  351. .pageList(formData)
  352. .then(function (response) {
  353. self.loading = false;
  354. var jsonData = response.data.data;
  355. self.tableData = jsonData.data;
  356. self.totalPages = jsonData.totalPages;
  357. self.totalElements = jsonData.recordsTotal;
  358. })
  359. .catch((error) => {
  360. self.loading = false;
  361. // self.$message.error(error + "");
  362. });
  363. },
  364. pageSizeChange(pageSize) {
  365. this.pageSize = pageSize;
  366. this.$nextTick(() => {
  367. this.changePage(this.pageIndex);
  368. });
  369. },
  370. sortChange(data) {
  371. this.field = data.column.field;
  372. this.direction = data.order == "ascending" ? "asc" : "desc";
  373. this.changePage(this.pageIndex);
  374. },
  375. handleSelectionChange(val) {
  376. this.multipleSelection = val;
  377. },
  378. handleReset(name) {
  379. this.$refs[name].resetFields();
  380. },
  381. handleAdd() {
  382. this.modalTitle = "新增";
  383. this.businessKey = "";
  384. this.showModal = true;
  385. },
  386. handleEdit(record) {
  387. this.modalTitle = "编辑";
  388. this.businessKey = record.id;
  389. this.showModal = true;
  390. },
  391. handleDelete(record) {
  392. var self = this;
  393. self
  394. .$confirm("是否确认删除?", "提示", {
  395. confirmButtonText: "确定",
  396. cancelButtonText: "取消",
  397. type: "warning",
  398. })
  399. .then(() => {
  400. applicationExamineApi.remove(record.id).then(function (response) {
  401. var jsonData = response.data;
  402. if (jsonData.result) {
  403. // var index = self.tableData.indexOf(record);
  404. // self.tableData.splice(index, 1);
  405. self.changePage(self.pageIndex);
  406. self.$message({
  407. type: "success",
  408. message: "删除成功!",
  409. });
  410. }
  411. });
  412. });
  413. },
  414. handleBatchDelete() {
  415. var self = this;
  416. var idList = this.multipleSelection.map((record) => {
  417. return record.id;
  418. });
  419. this.$confirm("是否确认删除选中项?", "提示", {
  420. confirmButtonText: "确定",
  421. cancelButtonText: "取消",
  422. type: "warning",
  423. }).then(() => {
  424. applicationExamineApi.batchRemove(idList).then(function (response) {
  425. var jsonData = response.data;
  426. if (jsonData.result) {
  427. self.changePage(self.pageIndex);
  428. self.$message({
  429. type: "success",
  430. message: "删除成功!",
  431. });
  432. }
  433. });
  434. });
  435. },
  436. onDetailModalClose(refreshed) {
  437. //保存成功后回调
  438. this.showModal = false;
  439. if (refreshed) {
  440. this.changePage(this.pageIndex);
  441. }
  442. },
  443. },
  444. mounted: function () {
  445. this.changePage(1);
  446. },
  447. components: {
  448. "applicationExamine-detail": ApplicationExamineDetail,
  449. "el-select-tree": SelectTree,
  450. },
  451. };
  452. </script>
  453. <style lang="scss" scoped>
  454. .el-breadcrumb {
  455. margin: 10px;
  456. line-height: 20px;
  457. }
  458. .el-divider {
  459. margin: 5px 0;
  460. }
  461. .demo-form-inline {
  462. margin-left: 10px;
  463. text-align: left;
  464. }
  465. .button-group {
  466. margin-left: 10px;
  467. text-align: left;
  468. }
  469. </style>