pendingAudit.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <div>
  3. <el-row class="handle-box" style="margin-bottom: 10px">
  4. <el-col :span="24">
  5. <!-- <el-input v-model="cusName" placeholder="客户/储备项目名称" size="small" class="ch-input ch-input-size" @keyup.enter.native="handleSearch()" />-->
  6. <el-input v-model="proName" placeholder="客户/储备项目名称" size="small" class="ch-input ch-input-size" @keyup.enter.native="handleSearch()" />
  7. <el-select v-model="auditStatus" placeholder="审核结果" size="small">
  8. <el-option
  9. v-for="item in dc_flow_status"
  10. :key="item.value"
  11. :label="item.label"
  12. :value="item.value"
  13. />
  14. </el-select>
  15. <el-select v-model="auditType" placeholder="流程来源" size="small">
  16. <el-option
  17. v-for="item in AUDIT_TYPE"
  18. :key="item.value"
  19. :label="item.label"
  20. :value="item.value"
  21. />
  22. </el-select>
  23. <el-select v-model="applyBy" placeholder="申请人" size="small">
  24. <el-option
  25. v-for="item in UserData"
  26. :key="item.value"
  27. :label="item.label"
  28. :value="item.value"
  29. />
  30. </el-select>
  31. <el-button class="ch-button-warning" size="small" @click="handleReset()"><i class="el-icon-refresh" />&nbsp;重置</el-button>
  32. <el-button class="ch-button" size="small" @click="handleSearch()"><i class="el-icon-search" />&nbsp;搜索</el-button>
  33. </el-col>
  34. </el-row>
  35. <el-row class="handle-box">
  36. <el-col :span="24">
  37. <el-table v-loading="loading" :data="AllData" stripe row-class-name="g_table_row">
  38. <el-table-column type="index" width="60" />
  39. <el-table-column label="流程来源" prop="auditType" />
  40. <el-table-column label="储备项目名称" prop="proName" />
  41. <el-table-column label="客户名称" prop="cusName" />
  42. <el-table-column label="申请人" prop="applyBy" />
  43. <el-table-column label="申请日期" prop="createdAt" />
  44. <el-table-column label="审核日期" prop="updatedAt" />
  45. <el-table-column label="审核结果" prop="auditStatus" />
  46. <el-table-column label="操作" header-align="center" align="center" width="120">
  47. <template scope="scope">
  48. <el-button size="mini" type="primary" @click="handleAudit(scope.row)">审核</el-button>
  49. </template>
  50. </el-table-column>
  51. </el-table>
  52. <div class="table-page">
  53. <el-pagination
  54. :current-page.sync="currentPage"
  55. :page-size="pageSize"
  56. background
  57. layout="total, prev, pager, next"
  58. :total="allpage"
  59. @current-change="handleCurrentChange"
  60. />
  61. </div>
  62. </el-col>
  63. </el-row>
  64. <el-dialog :title="dialogTitle" :visible.sync="dialogVisible" :close-on-click-modal="false" :close-on-press-escape="false" width="70%" top="50px">
  65. <audit-detail :audit-id="currAuditId" @handleAuditClose="handleAuditClose" @handleAuditCommit="handleAuditCommit" />
  66. </el-dialog>
  67. </div>
  68. </template>
  69. <script>
  70. import channel from '../../static/utils/channel'
  71. import Constant from '../../static/utils/constant'
  72. import AuditDetail from './comps/AuditDetail'
  73. import common from '@/static/utils/common'
  74. export default {
  75. name: 'PendingAudit',
  76. components: {
  77. AuditDetail
  78. },
  79. data() {
  80. return {
  81. // 通用字典项
  82. dc_flow_status: Constant.dc_flow_status,
  83. AUDIT_TYPE: [],
  84. dc_map: {},
  85. // 列表相关
  86. cusName: '',
  87. auditStatus: '',
  88. auditType: '',
  89. proName: '',
  90. applyBy: '',
  91. AllData: [],
  92. loading: false,
  93. UserData: [],
  94. UserMap: {},
  95. // 分页
  96. currentPage: 1,
  97. allpage: 0,
  98. pageSize: 12,
  99. // 弹框相关
  100. currAuditId: '',
  101. dialogVisible: false,
  102. dialogTitle: '新增',
  103. isAdd: true,
  104. detailList: [],
  105. rules: {}
  106. }
  107. },
  108. mounted() {
  109. this.generateDcMap()
  110. this.initUser().then(() => {
  111. this.getData()
  112. })
  113. },
  114. methods: {
  115. handleAuditCommit: function() {
  116. this.getData()
  117. this.dialogVisible = false
  118. },
  119. handleAuditClose: function() {
  120. this.dialogVisible = false
  121. },
  122. getData: function() {
  123. const _this = this
  124. _this.loading = true
  125. _this.AllData = []
  126. const postData = {
  127. cusName: _this.cusName,
  128. auditStatus: _this.auditStatus,
  129. auditType: _this.auditType,
  130. referenceContent: _this.proName,
  131. applyBy: _this.applyBy,
  132. currAuditBy: _this.$common.currUser() ? _this.$common.currUser().id : '',
  133. pageNum: _this.currentPage,
  134. pageSize: _this.pageSize
  135. }
  136. const currUser = _this.$common.currUser()
  137. if (currUser && currUser.groupId) {
  138. postData.groupId = common.currUser().groupId
  139. }
  140. this.baseRequest('list', postData).then((res) => {
  141. if (res.data.rows) {
  142. res.data.rows.forEach(function(item) {
  143. const json = {
  144. auditType: _this.dc_map.AUDIT_TYPE[item.auditType],
  145. auditStatus: _this.dc_map.dc_flow_status[item.auditStatus],
  146. applyBy: _this.UserMap[item.applyBy],
  147. createdAt: _this.$common.transDate(item.createdAt, Constant.DATE_PATTERN.DATE_TIME_h),
  148. updatedAt: _this.$common.transDate(item.updatedAt, Constant.DATE_PATTERN.DATE_TIME_h),
  149. id: item.id
  150. }
  151. const referenceContent = _this.$common.castEval(item.referenceContent)
  152. if (referenceContent) {
  153. json.proName = referenceContent.proName
  154. json.cusName = referenceContent.cusName
  155. }
  156. _this.AllData.push(json)
  157. })
  158. _this.allpage = res.data.total
  159. }
  160. _this.loading = false
  161. }).catch(() => {
  162. })
  163. },
  164. handleSearch: function() {
  165. this.getData()
  166. },
  167. handleReset: function() {
  168. this.cusName = ''
  169. this.auditStatus = ''
  170. this.auditType = ''
  171. this.proName = ''
  172. this.applyBy = ''
  173. },
  174. /* 编辑*/
  175. handleAudit: function(val) {
  176. this.isAdd = false
  177. this.dialogVisible = true
  178. this.dialogTitle = '申请详情'
  179. this.currAuditId = val.id
  180. },
  181. confirmSubmit: function() {
  182. },
  183. /* 删除*/
  184. handleDel: function(val) {
  185. const _this = this
  186. _this.$confirm('是否确认删除?', '提示', {
  187. confirmButtonText: '确定',
  188. cancelButtonText: '取消',
  189. type: 'warning'
  190. }).then(function() {
  191. const deleting = _this.$notify({
  192. title: '正在删除,请稍等',
  193. type: 'warning'
  194. })
  195. _this.baseRequest('remove/' + val.id, '').then((res) => {
  196. _this.getData()
  197. deleting.close()
  198. _this.$notify({
  199. title: '删除成功',
  200. type: 'info'
  201. })
  202. }).catch((err) => {
  203. deleting.close()
  204. _this.$alert(err)
  205. })
  206. }).catch(function(error) {
  207. console.error(error)
  208. })
  209. },
  210. /* 分页设定*/
  211. handleSizeChange: function(val) {
  212. this.currentPage = val
  213. this.getData()
  214. },
  215. handleCurrentChange: function(val) {
  216. this.currentPage = val
  217. this.getData()
  218. },
  219. /* 辅助相关*/
  220. initUser: function() {
  221. const _this = this
  222. this.UserData = []
  223. this.UserMap = {}
  224. return channel.globleRequest('SysUserExtendController', 'listAll', '', 'Pending Audit').then((res) => {
  225. if (res.data) {
  226. res.data.forEach(function(item) {
  227. const json = {
  228. label: item.truename,
  229. value: item.id
  230. }
  231. _this.UserData.push(json)
  232. _this.UserMap[json.value] = json.label
  233. })
  234. }
  235. }).catch(() => {
  236. })
  237. },
  238. generateDcMap: function() {
  239. this.AUDIT_TYPE = []
  240. for (const key in Constant.AUDIT_TYPE) {
  241. const json = {
  242. label: Constant.AUDIT_TYPE[key].name,
  243. value: Constant.AUDIT_TYPE[key].key
  244. }
  245. this.AUDIT_TYPE.push(json)
  246. }
  247. this.dc_map['dc_flow_status'] = this.$common.transDcMap(Constant.dc_flow_status)
  248. this.dc_map['AUDIT_TYPE'] = this.$common.transDcMap(this.AUDIT_TYPE)
  249. },
  250. addRecord: function(postData, isRefresh) {
  251. return this.opRecord(postData, 'add', isRefresh)
  252. },
  253. updateRecord: function(postData, isRefresh) {
  254. return this.opRecord(postData, 'edit', isRefresh)
  255. },
  256. opRecord: function(postData, soaUrl, isRefresh) {
  257. console.log('postData/soaUrl/isRefresh', postData, soaUrl, isRefresh)
  258. if (isRefresh === undefined) {
  259. isRefresh = true
  260. }
  261. const _this = this
  262. const acting = this.$notify({
  263. title: '正在处理,请稍等',
  264. type: 'warning'
  265. })
  266. return this.baseRequest(soaUrl, postData).then((res) => {
  267. acting.close()
  268. if (isRefresh) {
  269. _this.getData()
  270. _this.dialogVisible = false
  271. _this.$notify({
  272. title: '处理成功',
  273. type: 'info'
  274. })
  275. }
  276. }).catch((err) => {
  277. acting.close()
  278. _this.$alert(err)
  279. })
  280. },
  281. baseRequest(opUrl, postData) {
  282. return channel.globleRequest('FlowAuditController', opUrl, postData, 'project')
  283. }
  284. }
  285. }
  286. </script>
  287. <style scoped>
  288. .ch-input .el-input__inner {
  289. border-radius: 0px;
  290. border-color: #32323A;
  291. }
  292. .ch-input-size {
  293. width: 150px;
  294. }
  295. .ch-button {
  296. border-radius: 0px;
  297. border-color: #32323A;
  298. background-color: #32323A;
  299. color: #fff;
  300. }
  301. .ch-button-warning {
  302. margin-left: 10px;
  303. border-radius: 0px;
  304. border-color: #E75B5B;
  305. background-color: #E75B5B;
  306. color: #fff;
  307. }
  308. </style>