index.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <div class="app-container">
  3. <el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
  4. <el-form-item label="审核路径名" label-width="85px" prop="pathName">
  5. <el-input v-model="dataForm.pathName"></el-input>
  6. </el-form-item>
  7. <el-form-item>
  8. <el-button type="cyan" icon="el-icon-search" size="mini" @click="getDataList">搜索</el-button>
  9. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery_s">重置</el-button>
  10. </el-form-item>
  11. <el-row :gutter="10" class="mb8">
  12. <el-col :span="1.5">
  13. <el-button
  14. type="primary"
  15. icon="el-icon-plus"
  16. size="mini"
  17. @click="addOrUpdateHandle()"
  18. >新增
  19. </el-button>
  20. </el-col>
  21. <right-toolbar @queryTable="getDataList"></right-toolbar>
  22. </el-row>
  23. </el-form>
  24. <el-table :data="dataList" v-loading="dataListLoading" style="width: 100%;">
  25. <el-table-column
  26. header-align="center"
  27. align="center"
  28. type="index"
  29. width="80"
  30. label="序号">
  31. </el-table-column>
  32. <el-table-column
  33. prop="pathName"
  34. header-align="center"
  35. align="center"
  36. width="220"
  37. label="审核路径名称">
  38. </el-table-column>
  39. <el-table-column
  40. prop="opUserName"
  41. header-align="center"
  42. align="center"
  43. width="150"
  44. label="维护人">
  45. </el-table-column>
  46. <el-table-column
  47. prop="opDate"
  48. header-align="center"
  49. align="center"
  50. width="150"
  51. label="维护时间">
  52. </el-table-column>
  53. <el-table-column
  54. prop="status"
  55. header-align="center"
  56. align="center"
  57. width="90"
  58. label="状态">
  59. <template slot-scope="scope">
  60. <!-- <span v-if="scope.row.status === 'N'">新建</span>-->
  61. <span v-if="scope.row.status === 'A'">有效</span>
  62. <span v-if="scope.row.status === 'S'">停用</span>
  63. <span v-if="scope.row.status === 'Z'">暂存</span>
  64. </template>
  65. </el-table-column>
  66. <el-table-column
  67. prop="remarks"
  68. header-align="center"
  69. align="center"
  70. label="备注">
  71. </el-table-column>
  72. <el-table-column
  73. fixed="right"
  74. header-align="center"
  75. align="center"
  76. width="150"
  77. label="操作">
  78. <template slot-scope="scope">
  79. <el-button type="text" size="small"
  80. @click="addOrUpdateHandle(scope.row.id)">修改
  81. </el-button>
  82. <el-button type="text" size="small"
  83. @click="deleteHandle(scope.row.id)">删除
  84. </el-button>
  85. </template>
  86. </el-table-column>
  87. </el-table>
  88. <pagination
  89. v-show="total>0"
  90. :total="total"
  91. :page.sync="dataForm.pageNum"
  92. :limit.sync="dataForm.pageSize"
  93. @pagination="getDataList"
  94. />
  95. <!-- 弹窗, 新增 / 修改 -->
  96. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="getDataList" :dataForm="editModel"></add-or-update>
  97. </div>
  98. </template>
  99. <script>
  100. import AddOrUpdate from './auditPaths-add-or-update'
  101. import {addCharge,delCharge} from '@/api/system/toConfigure'
  102. export default {
  103. data () {
  104. return {
  105. loginContractorId: null,
  106. dataForm: {
  107. pathId: null,
  108. pathName: null,
  109. opUserId: null,
  110. opUserName: null,
  111. opDate: null,
  112. status: 'A',
  113. remarks: null,
  114. pageNum: 1,
  115. pageSize: 10
  116. },
  117. total:0,
  118. editModel: {},
  119. dataList: [],
  120. totalPage: 0,
  121. dataListLoading: false,
  122. addOrUpdateVisible: false
  123. }
  124. },
  125. components: {
  126. AddOrUpdate
  127. },
  128. activated () {
  129. // this.$http({
  130. // url: this.$http.adornUrl('/sys/user/getLoginContractorId'),
  131. // method: 'post'
  132. // }).then(({data}) => {
  133. // this.loginContractorId = data.loginContractorId
  134. // })
  135. this.getDataList()
  136. },
  137. methods: {
  138. resetQuery_s(){
  139. this.dataForm = {
  140. pathId: null,
  141. pathName: null,
  142. opUserId: null,
  143. opUserName: null,
  144. opDate: null,
  145. status: 'A',
  146. remarks: null,
  147. pageNum: 1,
  148. pageSize: 10
  149. }
  150. },
  151. // 获取数据列表
  152. getDataList () {
  153. this.dataListLoading = true
  154. addCharge(this.dataForm).then(data => {
  155. this.total = data.total
  156. console.log(data)
  157. if (typeof data.rows !== 'undefined' && data.rows !== null) {
  158. this.dataList = data.rows
  159. this.totalPage = data.rows.total
  160. } else {
  161. this.dataList = []
  162. this.totalPage = 0
  163. }
  164. this.dataListLoading = false
  165. })
  166. },
  167. resetSearch () {
  168. this.dataForm.pathName = null
  169. this.dataForm.opUserName = null
  170. this.dataForm.opDate = null
  171. this.dataForm.current = 1
  172. this.dataForm.size = 10
  173. this.getDataList()
  174. },
  175. // 每页数
  176. sizeChangeHandle (val) {
  177. this.dataForm.size = val
  178. this.dataForm.current = 1
  179. this.getDataList()
  180. },
  181. // 当前页
  182. currentChangeHandle (val) {
  183. this.dataForm.current = val
  184. this.getDataList()
  185. },
  186. // 新增 / 修改
  187. addOrUpdateHandle (val) {
  188. this.addOrUpdateVisible = true
  189. this.$nextTick(() => {
  190. this.$refs.addOrUpdate.init(val)
  191. })
  192. },
  193. // 删除
  194. deleteHandle (id) {
  195. this.$confirm('是否确认删除财务数据主编号为"' + id + '"的数据项?', '警告', {
  196. confirmButtonText: '确定',
  197. cancelButtonText: '取消',
  198. type: 'warning'
  199. }).then(function() {
  200. return delCharge(id)
  201. }).then((res) => {
  202. console.log(res)
  203. this.msgSuccess('删除成功')
  204. this.getDataList()
  205. })
  206. // this.$confirm(`确定进行删除操作?`, '提示', {
  207. // confirmButtonText: '确定',
  208. // cancelButtonText: '取消',
  209. // type: 'warning'
  210. // }).then(() => {
  211. // this.$http({
  212. // url: this.$http.adornUrl('/engineering/auditPaths/delete'),
  213. // method: 'post',
  214. // data: (id)
  215. // }).then(({data}) => {
  216. // if (data && data.code === 0) {
  217. // this.$message({
  218. // message: '操作成功',
  219. // type: 'success',
  220. // duration: 600,
  221. // onClose: () => {
  222. // this.getDataList()
  223. // }
  224. // })
  225. // } else {
  226. // this.$message.error(data.msg)
  227. // }
  228. // })
  229. // }).catch(() => {
  230. // })
  231. }
  232. }
  233. }
  234. </script>