applicationExamine-list.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494
  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="typeName"
  158. label="审批类型"
  159. width="100"
  160. ></el-table-column>
  161. <el-table-column prop="level" label="审批等级" width="100">
  162. <template slot-scope="{ row }">
  163. <span v-if="row.level != '' && row.level != null"
  164. >lv.{{ row.level }}</span
  165. >
  166. <span v-else>{{ row.level }}</span>
  167. </template></el-table-column
  168. >
  169. <el-table-column
  170. prop="examineCompanyName"
  171. label="审核人公司"
  172. width="180"
  173. ></el-table-column>
  174. <el-table-column
  175. prop="examineRoleName"
  176. label="审核人角色"
  177. width="150"
  178. ></el-table-column>
  179. <el-table-column
  180. prop="days"
  181. label="请假天数"
  182. width="100"
  183. ></el-table-column>
  184. <el-table-column
  185. prop="remark"
  186. label="备注信息"
  187. width="150"
  188. ></el-table-column>
  189. <el-table-column label="操作" width="130" fixed="right">
  190. <template slot-scope="{ row }">
  191. <el-row>
  192. <el-col :span="12">
  193. <el-link type="primary" @click="handleEdit(row)">编辑</el-link>
  194. </el-col>
  195. <el-col :span="12">
  196. <el-link type="danger" @click="handleDelete(row)">删除</el-link>
  197. </el-col>
  198. </el-row>
  199. </template>
  200. </el-table-column>
  201. </el-table>
  202. <el-pagination
  203. :current-page.sync="pageIndex"
  204. :total="totalElements"
  205. :page-sizes="pageSizeList"
  206. @current-change="changePage"
  207. @size-change="pageSizeChange"
  208. layout="total, sizes, prev, pager, next, jumper"
  209. ></el-pagination>
  210. <applicationExamine-detail
  211. v-if="showModal"
  212. :businessKey="businessKey"
  213. :title="modalTitle"
  214. @close="onDetailModalClose"
  215. ></applicationExamine-detail>
  216. </div>
  217. </template>
  218. <script>
  219. import Constant from "@/constant";
  220. import ApplicationExamineDetail from "./applicationExamine-detail";
  221. import applicationExamineApi from "@/api/base/applicationExamine";
  222. import dataDictionaryApi from "@/api/sys/dataDictionary";
  223. import personRoleInfoApi from "@/api/base/personRoleInfo";
  224. import companyInfoApi from "@/api/base/companyInfo";
  225. import NProgress from "nprogress"; // progress bar
  226. import "nprogress/nprogress.css"; // progress bar style
  227. import SelectTree from "@/components/SelectTree";
  228. export default {
  229. name: "baseApplicationExamineList",
  230. data() {
  231. var self = this;
  232. return {
  233. queryModel: {
  234. applicationRoleId: "",
  235. applicationCompanyId: "",
  236. applicationSubordinate: false,
  237. examineRoleId: "",
  238. examineCompanyId: "",
  239. examineSubordinate: false,
  240. type:"",
  241. level:""
  242. },
  243. loading: false,
  244. tableData: [],
  245. pageIndex: 1,
  246. pageSize: 10,
  247. totalPages: 0,
  248. totalElements: 0,
  249. field: "",
  250. direction: "",
  251. pageSizeList: [10, 20, 30],
  252. multipleSelection: [],
  253. showModal: false,
  254. modalTitle: "",
  255. businessKey: "",
  256. treeData: [],
  257. props: {
  258. // 配置项(必选)
  259. value: "id",
  260. label: "name",
  261. children: "children",
  262. },
  263. companyResult: [],
  264. applicationRoleResult:[],
  265. examineTypeResult:[]
  266. };
  267. },
  268. watch: {
  269. "queryModel.applicationCompanyId": function (val, oldval) {
  270. if (val != null && val != "") {
  271. var self = this;
  272. var formData = new FormData();
  273. formData.append("companyId", val);
  274. personRoleInfoApi.listByCompanyId(formData).then(function (response) {
  275. var jsonData = response.data;
  276. if (jsonData.result) {
  277. if (jsonData.data != null && jsonData.data != "") {
  278. self.applicationRoleResult = jsonData.data;
  279. // applicationCompanyId
  280. // applicationRoleId
  281. // examineCompanyId
  282. // examineRoleId
  283. }
  284. }
  285. });
  286. }
  287. }
  288. },
  289. created() {
  290. var self = this;
  291. companyInfoApi.list().then(function (response) {
  292. var jsonData = response.data;
  293. if (jsonData.result) {
  294. if (jsonData.data != null && jsonData.data != "") {
  295. self.companyResult = jsonData.data;
  296. }
  297. }
  298. });
  299. var formData = new FormData();
  300. formData.append("catalogName", "审批类型");
  301. dataDictionaryApi.findByCatalogName(formData).then((response) => {
  302. var jsonData = response.data;
  303. this.examineTypeResult = jsonData.data;
  304. });
  305. },
  306. methods: {
  307. indexMethod(index) {
  308. return (this.pageIndex - 1) * this.pageSize + (index + 1);
  309. },
  310. changePage(pageIndex) {
  311. var self = this;
  312. self.loading = true;
  313. self.pageIndex = pageIndex;
  314. var formData = new FormData();
  315. formData.append("pageIndex", self.pageIndex);
  316. formData.append("pageSize", self.pageSize);
  317. formData.append("applicationRoleId", self.queryModel.applicationRoleId);
  318. if (self.queryModel.applicationCompanyId == null) {
  319. self.queryModel.applicationCompanyId = "";
  320. }
  321. formData.append(
  322. "applicationCompanyId",
  323. self.queryModel.applicationCompanyId
  324. );
  325. formData.append(
  326. "applicationSubordinate",
  327. self.queryModel.applicationSubordinate
  328. );
  329. formData.append("examineRoleId", self.queryModel.examineRoleId);
  330. if (self.queryModel.examineCompanyId == null) {
  331. self.queryModel.examineCompanyId = "";
  332. }
  333. formData.append("examineCompanyId", self.queryModel.examineCompanyId);
  334. formData.append("examineSubordinate", self.queryModel.examineSubordinate);
  335. if (this.field != null) {
  336. formData.append("field", this.field);
  337. }
  338. if (this.direction != null) {
  339. formData.append("direction", this.direction);
  340. }
  341. if (self.queryModel.type != null) {
  342. formData.append("type", self.queryModel.type);
  343. }
  344. if (self.queryModel.level != null) {
  345. formData.append("level",self.queryModel.level);
  346. }
  347. applicationExamineApi
  348. .pageList(formData)
  349. .then(function (response) {
  350. self.loading = false;
  351. var jsonData = response.data.data;
  352. self.tableData = jsonData.data;
  353. self.totalPages = jsonData.totalPages;
  354. self.totalElements = jsonData.recordsTotal;
  355. })
  356. .catch((error) => {
  357. self.loading = false;
  358. // self.$message.error(error + "");
  359. });
  360. },
  361. pageSizeChange(pageSize) {
  362. this.pageSize = pageSize;
  363. this.$nextTick(() => {
  364. this.changePage(this.pageIndex);
  365. });
  366. },
  367. sortChange(data) {
  368. this.field = data.column.field;
  369. this.direction = data.order;
  370. this.changePage(this.pageIndex);
  371. },
  372. handleSelectionChange(val) {
  373. this.multipleSelection = val;
  374. },
  375. handleReset(name) {
  376. this.$refs[name].resetFields();
  377. },
  378. handleAdd() {
  379. this.modalTitle = "新增";
  380. this.businessKey = "";
  381. this.showModal = true;
  382. },
  383. handleEdit(record) {
  384. this.modalTitle = "编辑";
  385. this.businessKey = record.id;
  386. this.showModal = true;
  387. },
  388. handleDelete(record) {
  389. var self = this;
  390. self
  391. .$confirm("是否确认删除?", "提示", {
  392. confirmButtonText: "确定",
  393. cancelButtonText: "取消",
  394. type: "warning",
  395. })
  396. .then(() => {
  397. applicationExamineApi.remove(record.id).then(function (response) {
  398. var jsonData = response.data;
  399. if (jsonData.result) {
  400. // var index = self.tableData.indexOf(record);
  401. // self.tableData.splice(index, 1);
  402. self.changePage(self.pageIndex);
  403. self.$message({
  404. type: "success",
  405. message: "删除成功!",
  406. });
  407. }
  408. });
  409. });
  410. },
  411. handleBatchDelete() {
  412. var self = this;
  413. var idList = this.multipleSelection.map((record) => {
  414. return record.id;
  415. });
  416. this.$confirm("是否确认删除选中项?", "提示", {
  417. confirmButtonText: "确定",
  418. cancelButtonText: "取消",
  419. type: "warning",
  420. }).then(() => {
  421. applicationExamineApi.batchRemove(idList).then(function (response) {
  422. var jsonData = response.data;
  423. if (jsonData.result) {
  424. self.changePage(self.pageIndex);
  425. self.$message({
  426. type: "success",
  427. message: "删除成功!",
  428. });
  429. }
  430. });
  431. });
  432. },
  433. onDetailModalClose(refreshed) {
  434. //保存成功后回调
  435. this.showModal = false;
  436. if (refreshed) {
  437. this.changePage(this.pageIndex);
  438. }
  439. },
  440. },
  441. mounted: function () {
  442. this.changePage(1);
  443. },
  444. components: {
  445. "applicationExamine-detail": ApplicationExamineDetail,
  446. "el-select-tree": SelectTree,
  447. },
  448. };
  449. </script>
  450. <style lang="scss" scoped>
  451. .el-breadcrumb {
  452. margin: 10px;
  453. line-height: 20px;
  454. }
  455. .el-divider {
  456. margin: 5px 0;
  457. }
  458. .demo-form-inline {
  459. margin-left: 10px;
  460. text-align: left;
  461. }
  462. .button-group {
  463. margin-left: 10px;
  464. text-align: left;
  465. }
  466. </style>