index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <template>
  2. <div class="app-container">
  3. <el-row :gutter="24">
  4. <!--用户数据-->
  5. <el-col :span="24" :xs="24">
  6. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="68px">
  7. <el-form-item label="审核状态" prop="approveStatus">
  8. <el-select
  9. v-model="queryParams.approveStatus"
  10. placeholder="请选择审核状态"
  11. clearable
  12. style="width: 240px"
  13. >
  14. <el-option
  15. v-for="item in approveStatusOptions"
  16. :key="item.value"
  17. :label="item.label"
  18. :value="item.value">
  19. </el-option>
  20. </el-select>
  21. </el-form-item>
  22. <el-form-item label="审核结果" prop="approveResult">
  23. <el-select
  24. v-model="queryParams.approveResult"
  25. placeholder="请选择审核结果"
  26. clearable
  27. style="width: 240px"
  28. >
  29. <el-option
  30. v-for="item in approveResultOptions"
  31. :key="item.value"
  32. :label="item.label"
  33. :value="item.value">
  34. </el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item>
  38. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  39. </el-form-item>
  40. </el-form>
  41. <div style="padding-top: 10px">
  42. <vxe-table
  43. ref="xTable"
  44. align="center"
  45. :loading="loading"
  46. class="mytable-style"
  47. auto-resize
  48. border
  49. resizable
  50. export-config
  51. highlight-current-row
  52. show-overflow
  53. max-height="700"
  54. :data="approveList"
  55. :radio-config="{trigger: 'row'}"
  56. >
  57. <vxe-table-column field="moduleName" title="模块名称"/>
  58. <vxe-table-column field="operation" title="执行操作" :formatter="operationFormat"/>
  59. <vxe-table-column field="approveStatus" title="审核状态" :formatter="approveStatusFormat"/>
  60. <vxe-table-column field="createTime" title="提交时间"/>
  61. <vxe-table-column field="parameterContent" title="内容"/>
  62. <vxe-table-column field="approveResult" title="审核结果" :formatter="approveResultFormat"/>
  63. <vxe-table-column title="操作" width="320">
  64. <template slot-scope="scope" v-if="scope.row.approveStatus == 0">
  65. <el-button
  66. size="mini"
  67. type="text"
  68. icon="el-icon-check"
  69. @click="handleApprove(scope.row,0)"
  70. v-hasPermi="['approveManager:approve:submitApprove']"
  71. >通过
  72. </el-button>
  73. <el-button
  74. size="mini"
  75. type="text"
  76. icon="el-icon-close"
  77. @click="handleApprove(scope.row,1)"
  78. v-hasPermi="['approveManager:approve:submitApprove']"
  79. >未通过
  80. </el-button>
  81. </template>
  82. </vxe-table-column>
  83. </vxe-table>
  84. <vxe-pager
  85. v-show="showTable"
  86. perfect
  87. :current-page.sync="currentPage"
  88. :page-size.sync="pageSize"
  89. :total="total"
  90. :page-sizes="[10,50,100]"
  91. :layouts="['PrevJump', 'PrevPage','JumpNumber', 'NextPage', 'NextJump', 'Sizes', 'FullJump', 'Total']"
  92. @page-change="handlePageChange"
  93. >
  94. </vxe-pager>
  95. </div>
  96. </el-col>
  97. </el-row>
  98. </div>
  99. </template>
  100. <script>
  101. import {debounce} from 'lodash'
  102. export default {
  103. name: "User",
  104. data() {
  105. return {
  106. approveStatusOptions: [
  107. {value: '0', label: '待审核'},
  108. {value: '1', label: '已审核'}
  109. ],
  110. approveResultOptions: [
  111. {value: '0', label: '通过'},
  112. {value: '1', label: '未通过'}
  113. ],
  114. operationOptions: [
  115. {value: '0', label: '新增'},
  116. {value: '1', label: '修改'},
  117. {value: '2', label: '注销'},
  118. {value: '3', label: '授权'}
  119. ],
  120. // 遮罩层
  121. loading: true,
  122. showTable: true,
  123. // 选中数组
  124. ids: [],
  125. // 非单个禁用
  126. single: true,
  127. // 非多个禁用
  128. multiple: true,
  129. currentPage: 1,
  130. pageSize: 10,
  131. // 总条数
  132. total: 0,
  133. // 表格数据
  134. approveList: null,
  135. // 弹出层标题
  136. title: "",
  137. // 是否显示弹出层
  138. open: false,
  139. // 表单参数
  140. form: {},
  141. // 查询参数
  142. queryParams: {
  143. approveStatus: undefined,
  144. approveResult: undefined
  145. },
  146. edit: false
  147. };
  148. },
  149. watch: {},
  150. created() {
  151. this.getList()
  152. },
  153. methods: {
  154. handlePageChange({currentPage, pageSize}) {
  155. this.currentPage = currentPage
  156. this.pageSize = pageSize
  157. this.getList()
  158. },
  159. // 列表状态格式化
  160. operationFormat({cellValue}) {
  161. let belongTo = '未知的类型'
  162. for (let i = 0; i < this.operationOptions.length; i++) {
  163. if (cellValue == "0") {
  164. belongTo = "新增"
  165. } else if (cellValue == "1") {
  166. belongTo = "修改"
  167. } else if (cellValue == "2") {
  168. belongTo = "注销"
  169. } else if (cellValue == "3") {
  170. belongTo = "授权"
  171. }
  172. }
  173. return belongTo
  174. },
  175. approveStatusFormat({cellValue}) {
  176. let belongTo = '未知的类型'
  177. for (let i = 0; i < this.approveStatusOptions.length; i++) {
  178. if (cellValue == "0") {
  179. belongTo = "待审批"
  180. } else if (cellValue == "1") {
  181. belongTo = "已审批"
  182. }
  183. }
  184. return belongTo
  185. },
  186. approveResultFormat({cellValue}) {
  187. let belongTo = ''
  188. for (let i = 0; i < this.approveResultOptions.length; i++) {
  189. if (cellValue == "0") {
  190. belongTo = "通过"
  191. } else if (cellValue == "1") {
  192. belongTo = "未通过"
  193. }
  194. }
  195. return belongTo
  196. },
  197. /** 查询用户列表 */
  198. async getList() {
  199. let sysTime
  200. let lk
  201. await this.$axios.get('/sysPolicyController/getLicenseKey').then((res) => {
  202. sysTime = res.data.sysTime
  203. lk = res.data.lk
  204. }).catch((error) => {
  205. })
  206. this.loading = true;
  207. var searchParams = {
  208. currentPage: this.currentPage,
  209. pageSize: this.pageSize,
  210. approveStatus: this.queryParams.approveStatus,
  211. approveResult: this.queryParams.approveResult,
  212. sysTime: sysTime,
  213. lk: lk
  214. }
  215. await this.$axios.get('/sysApproveController/getAll',
  216. {params: searchParams}).then((res) => {
  217. this.approveList = res.data.records
  218. this.total = res.data.total
  219. if (res.data.records == '') {
  220. this.showTable = false
  221. } else {
  222. this.showTable = true
  223. }
  224. this.loading = false
  225. }).catch((error) => {
  226. this.loading = false;
  227. // this.$message.error(error)
  228. })
  229. },
  230. /** 搜索按钮操作 */
  231. handleQuery: debounce(function () {
  232. this.currentPage = 1
  233. this.pageSize = 10
  234. this.getList()
  235. }, 1000),
  236. handleApprove(row, val) {
  237. let tips = ''
  238. if (val == 0) {
  239. tips = '【通过】'
  240. } else {
  241. tips = '【未通过】'
  242. }
  243. this.$confirm('确认审核结果' + tips + '?', '提示', {
  244. confirmButtonText: '确定',
  245. cancelButtonText: '取消',
  246. type: 'warning'
  247. }).then(() => {
  248. row.approveResult = val
  249. this.submitApprove(row)
  250. }).catch(() => {
  251. });
  252. },
  253. /** 提交按钮 */
  254. submitApprove: debounce(async function (row) {
  255. let sysTime
  256. let lk
  257. await this.$axios.get('/sysPolicyController/getLicenseKey').then((res) => {
  258. sysTime = res.data.sysTime
  259. lk = res.data.lk
  260. }).catch((error) => {
  261. })
  262. row.sysTime = sysTime
  263. row.lk = lk
  264. await this.$axios.post('/sysApproveController/submitApprove', row).then((res) => {
  265. if (res.code == 0) {
  266. this.$message.success('审核成功')
  267. this.getList();
  268. }
  269. if (res.code == 1) {
  270. this.$message.error(res.data)
  271. this.getList();
  272. }
  273. }).catch((error) => {
  274. // this.$message.error(error)
  275. this.getList();
  276. })
  277. }, 1000)
  278. }
  279. };
  280. </script>