myApply.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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" :close-on-click-modal="false" :close-on-press-escape="false" width="70%" top="50px">
  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. referenceContent: _this.cusName,
  116. auditStatus: _this.auditStatus,
  117. auditType: _this.auditType,
  118. applyBy: _this.$common.currUser() ? _this.$common.currUser().id : '',
  119. pageNum: _this.currentPage,
  120. pageSize: _this.pageSize
  121. }
  122. const currUser = _this.$common.currUser()
  123. if (currUser && currUser.groupId) {
  124. postData.groupId = common.currUser().groupId
  125. }
  126. this.baseRequest('list', postData).then((res) => {
  127. if (res.data.rows) {
  128. res.data.rows.forEach(function(item) {
  129. const json = {
  130. auditType: _this.dc_map.AUDIT_TYPE[item.auditType],
  131. auditStatus: _this.dc_map.dc_flow_status[item.auditStatus],
  132. applyBy: _this.UserMap[item.applyBy],
  133. createdAt: _this.$common.transDate(item.createdAt, Constant.DATE_PATTERN.DATE_TIME_h),
  134. updatedAt: _this.$common.transDate(item.updatedAt, Constant.DATE_PATTERN.DATE_TIME_h),
  135. id: item.id
  136. }
  137. const referenceContent = _this.$common.castEval(item.referenceContent)
  138. if (referenceContent) {
  139. json.proName = referenceContent.proName
  140. json.cusName = referenceContent.cusName
  141. }
  142. _this.AllData.push(json)
  143. })
  144. _this.allpage = res.data.total
  145. }
  146. _this.loading = false
  147. }).catch(() => {
  148. })
  149. },
  150. handleSearch: function() {
  151. this.getData()
  152. },
  153. handleReset: function() {
  154. this.cusName = ''
  155. this.auditStatus = ''
  156. this.auditType = ''
  157. this.proName = ''
  158. this.applyBy = ''
  159. },
  160. /* 编辑*/
  161. handleAudit: function(val) {
  162. this.isAdd = false
  163. this.dialogVisible = true
  164. this.dialogTitle = '申请详情'
  165. this.currAuditId = val.id
  166. },
  167. confirmSubmit: function() {
  168. },
  169. /* 删除*/
  170. handleDel: function(val) {
  171. const _this = this
  172. _this.$confirm('是否确认删除?', '提示', {
  173. confirmButtonText: '确定',
  174. cancelButtonText: '取消',
  175. type: 'warning'
  176. }).then(function() {
  177. const deleting = _this.$notify({
  178. title: '正在删除,请稍等',
  179. type: 'warning'
  180. })
  181. _this.baseRequest('remove/' + val.id, '').then((res) => {
  182. _this.getData()
  183. deleting.close()
  184. _this.$notify({
  185. title: '删除成功',
  186. type: 'info'
  187. })
  188. }).catch((err) => {
  189. deleting.close()
  190. _this.$alert(err)
  191. })
  192. }).catch(function(error) {
  193. console.error(error)
  194. })
  195. },
  196. /* 分页设定*/
  197. handleSizeChange: function(val) {
  198. this.currentPage = val
  199. this.getData()
  200. },
  201. handleCurrentChange: function(val) {
  202. this.currentPage = val
  203. this.getData()
  204. },
  205. /* 辅助相关*/
  206. initUser: function() {
  207. const _this = this
  208. this.UserData = []
  209. this.UserMap = {}
  210. const postData = {
  211. pageNum: 1,
  212. pageSize: 1000
  213. }
  214. return channel.globleRequest('SysUserExtendController', 'listAll', postData, 'Pending Audit').then((res) => {
  215. if (res.data) {
  216. res.data.forEach(function(item) {
  217. const json = {
  218. label: item.truename,
  219. value: item.id
  220. }
  221. _this.UserData.push(json)
  222. _this.UserMap[json.value] = json.label
  223. })
  224. }
  225. }).catch(() => {
  226. })
  227. },
  228. generateDcMap: function() {
  229. this.AUDIT_TYPE = []
  230. for (const key in Constant.AUDIT_TYPE) {
  231. const json = {
  232. label: Constant.AUDIT_TYPE[key].name,
  233. value: Constant.AUDIT_TYPE[key].key
  234. }
  235. this.AUDIT_TYPE.push(json)
  236. }
  237. this.dc_map['dc_flow_status'] = this.$common.transDcMap(Constant.dc_flow_status)
  238. this.dc_map['AUDIT_TYPE'] = this.$common.transDcMap(this.AUDIT_TYPE)
  239. },
  240. addRecord: function(postData, isRefresh) {
  241. return this.opRecord(postData, 'add', isRefresh)
  242. },
  243. updateRecord: function(postData, isRefresh) {
  244. return this.opRecord(postData, 'edit', isRefresh)
  245. },
  246. opRecord: function(postData, soaUrl, isRefresh) {
  247. console.log('postData/soaUrl/isRefresh', postData, soaUrl, isRefresh)
  248. if (isRefresh === undefined) {
  249. isRefresh = true
  250. }
  251. const _this = this
  252. const acting = this.$notify({
  253. title: '正在处理,请稍等',
  254. type: 'warning'
  255. })
  256. return this.baseRequest(soaUrl, postData).then((res) => {
  257. acting.close()
  258. if (isRefresh) {
  259. _this.getData()
  260. _this.dialogVisible = false
  261. _this.$notify({
  262. title: '处理成功',
  263. type: 'info'
  264. })
  265. }
  266. }).catch((err) => {
  267. acting.close()
  268. _this.$alert(err)
  269. })
  270. },
  271. baseRequest(opUrl, postData) {
  272. return channel.globleRequest('FlowAuditController', opUrl, postData, 'project')
  273. }
  274. }
  275. }
  276. </script>
  277. <style scoped>
  278. .ch-input .el-input__inner {
  279. border-radius: 0px;
  280. border-color: #32323A;
  281. }
  282. .ch-input-size {
  283. width: 150px;
  284. }
  285. .ch-button {
  286. border-radius: 0px;
  287. border-color: #32323A;
  288. background-color: #32323A;
  289. color: #fff;
  290. }
  291. .ch-button-warning {
  292. margin-left: 10px;
  293. border-radius: 0px;
  294. border-color: #E75B5B;
  295. background-color: #E75B5B;
  296. color: #fff;
  297. }
  298. </style>