index.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option"
  4. :data="dataList"
  5. ref="crud"
  6. v-model="form"
  7. :page.sync="page"
  8. :search.sync="search"
  9. :table-loading="loading"
  10. @search-change="searchChange"
  11. @search-reset="searchReset"
  12. @selection-change="selectionChange"
  13. @current-change="currentChange"
  14. @size-change="sizeChange"
  15. @refresh-change="refreshChange"
  16. @on-load="onLoad">
  17. <template slot="corpsIdSearch">
  18. <select-component
  19. v-model="search.corpsId"
  20. :configuration="configuration"
  21. ></select-component>
  22. </template>
  23. <template slot="menuLeft">
  24. <el-button size="small"
  25. type="success"
  26. :disabled="selectionList.length == 0 "
  27. @click.stop="batchCheck"
  28. >批量审批
  29. </el-button>
  30. <el-button size="small"
  31. type="info"
  32. :disabled="true"
  33. @click.stop=""
  34. >报表
  35. </el-button>
  36. </template>
  37. <template slot-scope="scope" slot="menu">
  38. <el-button
  39. type="text"
  40. size="small"
  41. :disabled="scope.row.operate"
  42. @click.stop="jumpPage(scope.row)"
  43. >查看
  44. </el-button>
  45. <el-button
  46. type="text"
  47. size="small"
  48. :disabled="scope.row.auditStatus != 'S'"
  49. @click.stop="openCheck(scope.row)"
  50. >审核
  51. </el-button>
  52. </template>
  53. </avue-crud>
  54. <el-dialog
  55. append-to-body
  56. title="审批"
  57. class="el-dialogDeep"
  58. :visible.sync="checkDialog"
  59. width="50%"
  60. :close-on-click-modal="false"
  61. :destroy-on-close="true"
  62. :close-on-press-escape="false"
  63. v-dialog-drag
  64. >
  65. <check
  66. :checkData="checkData"
  67. @choceCheckFun="choceCheckFun"
  68. >
  69. </check>
  70. </el-dialog>
  71. </basic-container>
  72. </template>
  73. <script>
  74. import option from "./configuration/mainList.json";
  75. import { getList,approvePass } from "@/api/approveData/main";
  76. import { batchOperation } from "@/api/approveData/main"
  77. import check from "@/components/check/check";
  78. import _ from "lodash";
  79. export default {
  80. components:{
  81. check
  82. },
  83. data() {
  84. return {
  85. loading : false,
  86. form: {},
  87. search:{},
  88. show:true,
  89. checkDialog:false,
  90. detailData:{},
  91. option: option,
  92. parentId:0,
  93. checkData:{},
  94. dataList: [],
  95. selectionList:[],
  96. page: {
  97. pageSize: 10,
  98. pagerCount: 5,
  99. total: 0,
  100. },
  101. query:{},
  102. configuration:{
  103. multipleChoices:false,
  104. multiple:false,
  105. disabled:false,
  106. searchShow:true,
  107. collapseTags:false,
  108. clearable:true,
  109. placeholder:'请点击右边按钮选择',
  110. dicData:[]
  111. },
  112. }
  113. },
  114. created() {
  115. },
  116. mounted() {
  117. // option.height = window.innerHeight - 200 ;
  118. },
  119. methods: {
  120. batchCheck(){
  121. let idList = [];
  122. for(let i=0;i<this.selectionList.length;i++){
  123. if(this.selectionList[i].auditStatus != "S"){
  124. return this.$message.error("审核状态必须都为待审核状态!")
  125. }else{
  126. idList.push(this.selectionList[i].id)
  127. }
  128. }
  129. this.$confirm('确定进行批量操作吗?', '提示', {
  130. confirmButtonText: '审核通过',
  131. cancelButtonText: '取消',
  132. type: 'warning',
  133. distinguishCancelAndClose : false
  134. }).then(() => {
  135. //批量通过
  136. batchOperation(idList.join(","),"1").then(res=>{
  137. if(res.data.success){
  138. this.$message.success("操作成功!")
  139. this.refreshChange();
  140. }
  141. })
  142. })
  143. },
  144. //跳转页面
  145. jumpPage(row){
  146. if(row.url){
  147. this.$router.$avueRouter.closeTag(row.url);
  148. this.$router.push({
  149. path: row.url,
  150. query: {check : row},
  151. });
  152. }
  153. },
  154. //审批通过
  155. pass(row,operate){
  156. row.operate = operate
  157. this.loading = true;
  158. approvePass(row).then(res=>{
  159. this.$message.success("操作成功!")
  160. this.refreshChange()
  161. }).finally(()=>{
  162. this.loading = false
  163. })
  164. },
  165. openCheck(row){
  166. this.checkDialog = true
  167. this.checkData = row
  168. },
  169. choceCheckFun(){
  170. this.checkDialog = false;
  171. this.refreshChange()
  172. },
  173. //新单打开
  174. addReceipt(row){
  175. },
  176. //编辑打开
  177. editOpen(row, status){
  178. this.detailData = {
  179. id: row.id,
  180. status: status
  181. };
  182. this.show = false;
  183. },
  184. rowDel(row, index, done) {
  185. if(row.id){
  186. this.$confirm("确定将选择数据删除?", {
  187. confirmButtonText: "确定",
  188. cancelButtonText: "取消",
  189. type: "warning"
  190. }).then(() => {
  191. remove(row.id).then(res =>{
  192. if(res.data.success){
  193. this.$message.success("操作成功!");
  194. this.onLoad(this.page);
  195. }
  196. })
  197. });
  198. }
  199. },
  200. //点击搜索按钮触发
  201. searchChange(params, done) {
  202. this.query = params;
  203. this.page.currentPage = 1;
  204. this.onLoad(this.page, params);
  205. done()
  206. },
  207. searchReset() {
  208. console.log('1')
  209. },
  210. selectionChange(list) {
  211. this.selectionList = list
  212. },
  213. currentChange() {
  214. console.log('1')
  215. },
  216. sizeChange() {
  217. console.log('1')
  218. },
  219. refreshChange() {
  220. this.onLoad(this.page);
  221. },
  222. onLoad(page, params = {}) {
  223. this.loading = true;
  224. if(!params.auditStatus && this.search.auditStatus != ""){
  225. params.auditStatus = "S";
  226. }
  227. getList(page.currentPage, page.pageSize,params).then(res=>{
  228. this.dataList = res.data.data.records
  229. this.page.total = res.data.data.total
  230. this.loading = false;
  231. })
  232. },
  233. goBack() {
  234. this.detailData=this.$options.data().detailData
  235. this.show = true;
  236. }
  237. }
  238. }
  239. </script>
  240. <style scoped>
  241. </style>