myAudit.vue 11 KB

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