iam-audit-external-project.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. <template>
  2. <div>
  3. <a-card>
  4. <audit-advanced-query
  5. :expand="expand"
  6. :search-data="formData"
  7. :ref-name="'searchform'"
  8. :search-style="{ height: '170px', left: '20px', top: '50px' }"
  9. :search-fun="handleSearch"
  10. @searchedClick="searchedClick"
  11. >
  12. <template>
  13. <a-col :span="12">
  14. <a-form-model-item :label="'项目名称'" prop="projectTitle">
  15. <a-input v-model="formData.projectTitle" allow-clear />
  16. </a-form-model-item>
  17. </a-col>
  18. <a-col :span="12">
  19. <a-form-model-item :label="'外部检查机构'" prop="inspectionOrg">
  20. <a-input v-model="formData.inspectionOrg" allow-clear />
  21. </a-form-model-item>
  22. </a-col>
  23. <a-col :span="12">
  24. <a-form-model-item :label="'检查类型'" prop="inspectionType">
  25. <sd-select
  26. v-model="formData.inspectionType"
  27. :allow-clear="true"
  28. :options="itemStatusOptions"
  29. />
  30. </a-form-model-item>
  31. </a-col>
  32. </template>
  33. </audit-advanced-query>
  34. <sd-data-table-ex
  35. ref="iamExternalProjectTable"
  36. form-id="iamExternalProject"
  37. page-id="audit/externalProject/iamExternalProject"
  38. :columns="columns"
  39. :actions="actions"
  40. :show-advance-query="true"
  41. :search-fields="['projectTitle', 'inspectionOrg', 'inspectionType']"
  42. show-selection
  43. :filter-expressions="filterExpressions"
  44. @searchbtnClick="searchbtnClick"
  45. >
  46. <template slot="islink" slot-scope="text, record">
  47. <a :title="text" @click="rowClick(record)">{{ text }}</a>
  48. </template>
  49. </sd-data-table-ex>
  50. </a-card>
  51. </div>
  52. </template>
  53. <script>
  54. import axios from '@/common/services/axios-instance'
  55. import TableActionTypes from '@/common/services/table-action-types'
  56. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  57. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  58. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  59. import components from './_import-components/iam-audit-external-project-import'
  60. export default {
  61. name: 'IamAuditExternalProject',
  62. metaInfo: {
  63. title: '外部项目',
  64. },
  65. components: {
  66. auditAdvancedQuery,
  67. ...components,
  68. },
  69. mixins: [auditAdvancedQueryMixins],
  70. data() {
  71. return {
  72. itemStatusOptions: [],
  73. formData: { projectTitle: '', inspectionOrg: '', inspectionType: '' },
  74. expand: false,
  75. filterExpressions: [],
  76. columns: [
  77. {
  78. title: '序号',
  79. customRender: (text, record, index) => `${index + 1}`,
  80. width: '80px',
  81. },
  82. {
  83. title: '项目名称',
  84. dataIndex: 'projectTitle',
  85. width: '30%',
  86. scopedSlots: { customRender: 'islink' },
  87. },
  88. {
  89. title: '项目编号',
  90. dataIndex: 'projectCode',
  91. sorter: true,
  92. },
  93. {
  94. title: '检查类型',
  95. dataIndex: 'inspectionType',
  96. },
  97. {
  98. title: '被检查机构',
  99. dataIndex: 'auditedUnitNames',
  100. },
  101. {
  102. title: '外部检查机构',
  103. dataIndex: 'inspectionOrg',
  104. },
  105. {
  106. title: '外部检查联系人',
  107. dataIndex: 'linkMan',
  108. },
  109. ],
  110. actions: [
  111. {
  112. label: '新建',
  113. id: 'new',
  114. // type: TableActionTypes.ex.create,
  115. permission: 'create',
  116. type: TableActionTypes.primary,
  117. callback: () => {
  118. const url = '/audit-externalProject-form' // 新页面要打开的路由地址
  119. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  120. if (refreshFlag) {
  121. // 这里写或者调刷新的方法
  122. setTimeout(this.refresh(), 3000)
  123. }
  124. })
  125. },
  126. },
  127. {
  128. label: '删除',
  129. id: 'delete',
  130. type: TableActionTypes.oa.delete, // 删除按钮,不需要回调,会自动处理
  131. },
  132. ],
  133. }
  134. },
  135. mounted() {
  136. // 初始化数据字典信息
  137. this.initDictionaryInfo()
  138. },
  139. created() {},
  140. methods: {
  141. initDictionaryInfo() {
  142. axios({
  143. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=DICT_CHECK_TYPE',
  144. method: 'get',
  145. }).then((res) => {
  146. if (res.status === 200) {
  147. this.itemStatusOptions = res.data
  148. }
  149. })
  150. },
  151. // 新建、详情打开新页面
  152. rowClick(record) {
  153. const url = '/audit-externalProject-form?record=' + record.id // 新页面要打开的路由地址
  154. crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
  155. if (refreshFlag) {
  156. this.refresh()
  157. }
  158. })
  159. },
  160. handleSearch() {
  161. // 修改表格过滤条件进行,再刷新进行数据过滤
  162. // 获取当前表格过滤条件
  163. this.filterExpressions = []
  164. // 外部检查机构
  165. if (this.formData.projectTitle) {
  166. this.filterExpressions.push({
  167. dataType: 'str',
  168. name: 'projectTitle',
  169. op: 'like',
  170. stringValue: `%${this.formData.projectTitle}%`,
  171. })
  172. }
  173. // 检查类型
  174. if (this.formData.inspectionOrg) {
  175. this.filterExpressions.push({
  176. dataType: 'str',
  177. name: 'inspectionOrg',
  178. op: 'like',
  179. stringValue: `%${this.formData.inspectionOrg}%`,
  180. })
  181. }
  182. // 项目名称
  183. if (this.formData.inspectionType[0]) {
  184. this.filterExpressions.push({
  185. dataType: 'str',
  186. name: 'inspectionType',
  187. op: 'like',
  188. stringValue: `%${this.formData.inspectionType[0].id}%`,
  189. })
  190. }
  191. },
  192. searchedClick() {
  193. this.expand = false
  194. },
  195. refresh() {
  196. this.$refs.iamExternalProjectTable.refresh()
  197. },
  198. getInspectionType() {},
  199. },
  200. }
  201. </script>