audit-matters-select-modal.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <template>
  2. <a-modal
  3. ref="auditMattersSelectModal"
  4. :body-style="bodyStyle"
  5. :title="title"
  6. :destroy-on-close="true"
  7. :visible="visible"
  8. :width="modalWidth"
  9. @ok="handleOk"
  10. @cancel="handleCancel"
  11. >
  12. <audit-advanced-query
  13. :expand="expand"
  14. :search-data="formData"
  15. :ref-name="searchform"
  16. :search-style="{ height: '175px', top: '105px !important' }"
  17. :search-fun="handleSearch"
  18. @searchedClick="searchedClick"
  19. >
  20. <template>
  21. <a-col :span="12">
  22. <a-form-model-item :label="'标\u2002\u2002\u2002\u2002题'" prop="docTitle">
  23. <a-input v-model="formData.docTitle" allow-clear />
  24. </a-form-model-item>
  25. </a-col>
  26. <a-col :span="12">
  27. <a-form-model-item :label="'发文字号'" prop="dispatchWord">
  28. <a-input v-model="formData.dispatchWord" allow-clear />
  29. </a-form-model-item>
  30. </a-col>
  31. <a-col :span="12">
  32. <a-form-model-item :label="'时\u2002效\u2002性'" prop="period">
  33. <sd-select v-model="formData.period" :allow-clear="true" :options="period" />
  34. </a-form-model-item>
  35. </a-col>
  36. </template>
  37. </audit-advanced-query>
  38. <!-- 列表 -->
  39. <sd-data-table
  40. ref="auditMattersSelectModalTable"
  41. style="width:98%;margin:auto"
  42. :show-advance-btn="true"
  43. data-url="api/xcoa-mobile/v1/law-institution/getList"
  44. :pagination="{ pageSize: 10 }"
  45. form-id=""
  46. :filter-expressions="filterExpressions"
  47. :check-type="'checkbox'"
  48. :columns="columns"
  49. :show-advance-query="true"
  50. :search-fields="['docTitle', 'dispatchWord']"
  51. :process-res="processRes"
  52. :process-req="processReq"
  53. :show-selection="showSelection"
  54. @searchbtnClick="searchbtnClick"
  55. @onChange="onChange"
  56. >
  57. <div slot="islink" slot-scope="text, record">
  58. <a :title="text" @click="rowClick(record)">{{ text }}</a>
  59. </div>
  60. </sd-data-table>
  61. </a-modal>
  62. </template>
  63. <script>
  64. import axios from '@/common/services/axios-instance'
  65. import { getUserInfo } from '@/common/store-mixin'
  66. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  67. import auditAdvancedQueryMixins from '../../components/audit-advanced-query-mixins'
  68. import auditAdvancedQuery from '../../components/audit-advanced-query.vue'
  69. import components from './_import-components/audit-matters-select-modal-import'
  70. const columns = [
  71. {
  72. dataIndex: 'id',
  73. sdHidden: true,
  74. },
  75. {
  76. title: '序号',
  77. dataIndex: 'sortNumber',
  78. customRender: (text, record, index) => `${index + 1}`,
  79. width: '80px',
  80. },
  81. {
  82. title: '标题',
  83. dataIndex: 'docTitle',
  84. width: '45%',
  85. scopedSlots: { customRender: 'islink' },
  86. },
  87. {
  88. title: '属性',
  89. dataIndex: 'attribute',
  90. width: '100px',
  91. },
  92. {
  93. title: '发文字号',
  94. dataIndex: 'dispatchWord',
  95. },
  96. {
  97. title: '时效性',
  98. dataIndex: 'period',
  99. },
  100. {
  101. title: '编制日期',
  102. dataIndex: 'creationTime',
  103. defaultSortOrder: 'desc',
  104. sdHidden: true,
  105. width: '120px',
  106. },
  107. ]
  108. export default {
  109. name: 'AuditMattersSelectModal',
  110. metaInfo: {
  111. title: 'AuditMattersSelectModal',
  112. },
  113. components: {
  114. ...components,
  115. auditAdvancedQuery,
  116. },
  117. mixins: [auditAdvancedQueryMixins],
  118. props: {
  119. // 弹出窗标题
  120. title: {
  121. type: String,
  122. default: '请选择',
  123. },
  124. // 弹出窗宽度
  125. modalWidth: {
  126. type: String,
  127. default: '1200px',
  128. },
  129. // 弹出窗显示参数
  130. visible: {
  131. type: Boolean,
  132. default: false,
  133. },
  134. orgId: {
  135. type: String,
  136. default: '0',
  137. },
  138. showSelection: {
  139. type: Function,
  140. default: () => true,
  141. },
  142. },
  143. data() {
  144. return {
  145. bodyStyle: {
  146. padding: 0,
  147. },
  148. // 列表展示用
  149. columns,
  150. // 高级搜索
  151. searchform: 'searchform',
  152. expand: false,
  153. // 列表展示过滤条件
  154. filterExpressions: [
  155. {
  156. dataType: 'long',
  157. name: 'auditOrgId',
  158. op: 'eq',
  159. longValue: Number(this.orgId),
  160. },
  161. {
  162. dataType: 'exps',
  163. op: 'or',
  164. expressionsValue: [
  165. {
  166. dataType: 'int',
  167. name: 'whether',
  168. op: 'eq',
  169. intValue: 0,
  170. },
  171. {
  172. dataType: 'str',
  173. name: 'creatorAccount',
  174. op: 'eq',
  175. stringValue: this.currentUser,
  176. },
  177. ],
  178. },
  179. ],
  180. formData: {
  181. docTitle: '',
  182. dispatchWord: '',
  183. period: null,
  184. },
  185. period: [],
  186. // 列表展示过滤条件
  187. currentUser: getUserInfo().account,
  188. }
  189. },
  190. watch: {
  191. orgId() {
  192. this.filterExpressions.forEach((item) => {
  193. if (item.name === 'auditOrgId') {
  194. item.longValue = this.orgId + ''
  195. }
  196. })
  197. this.filterExpressions.push({
  198. dataType: 'exps',
  199. op: 'or',
  200. expressionsValue: [
  201. {
  202. dataType: 'int',
  203. name: 'whether',
  204. op: 'eq',
  205. intValue: 0,
  206. },
  207. {
  208. dataType: 'str',
  209. name: 'creatorAccount',
  210. op: 'eq',
  211. stringValue: this.currentUser,
  212. },
  213. ],
  214. })
  215. },
  216. },
  217. created() {
  218. if (this.orgId === null) {
  219. this.filterExpressions = []
  220. }
  221. this.getDict()
  222. },
  223. methods: {
  224. // 标题链接点击
  225. rowClick(record) {
  226. if (record.attribute === '法律法规') {
  227. crossWindowWatcher.waitForChanged(
  228. '/iam-audit-auditsource-law-form?record=' + record.recordId
  229. )
  230. } else {
  231. crossWindowWatcher.waitForChanged(
  232. '/iam-audit-auditsource-institution-form?record=' + record.recordId
  233. )
  234. }
  235. },
  236. processReq(req) {
  237. const url = req.url
  238. if (url === 'api/xcoa-mobile/v1/law-institution/getList') {
  239. const expre = req.data.expressions
  240. if (expre.length <= 0) {
  241. if (this.orgId !== null) {
  242. this.filterExpressions.push({
  243. dataType: 'long',
  244. name: 'auditOrgId',
  245. op: 'eq',
  246. longValue: Number(this.orgId),
  247. })
  248. }
  249. this.filterExpressions.push({
  250. dataType: 'exps',
  251. op: 'or',
  252. expressionsValue: [
  253. {
  254. dataType: 'int',
  255. name: 'whether',
  256. op: 'eq',
  257. intValue: 0,
  258. },
  259. // {
  260. // dataType: 'str',
  261. // name: 'creatorAccount',
  262. // op: 'eq',
  263. // stringValue: this.currentUser,
  264. // },
  265. ],
  266. })
  267. req.data.expressions = this.filterExpressions
  268. }
  269. }
  270. return req
  271. },
  272. processRes(data) {
  273. let index = 0
  274. if (data.data !== null) {
  275. data.data.forEach((item) => {
  276. item.recordId = item.id
  277. item.id = this.$refs.auditMattersSelectModalTable.localPagination.current + '-' + index
  278. index++
  279. })
  280. }
  281. return data
  282. },
  283. getDict() {
  284. // 如果是展示的,那么可能去获取字典值去
  285. if (!this.strOrArr(this.formData.period)) {
  286. // 获取时效性的字典值 'PERIOD'
  287. if (this.period.length === 0) {
  288. axios({
  289. url: 'api/xcoa-mobile/v1/iam-law/dictionary?key=PERIOD',
  290. method: 'get',
  291. }).then((res) => {
  292. if (res.status === 200) {
  293. this.period = res.data
  294. }
  295. })
  296. }
  297. }
  298. },
  299. // 判断数组或字符串为null或长度为0
  300. strOrArr(strOrArr) {
  301. return strOrArr !== null && strOrArr.length > 0
  302. },
  303. handleOk(e) {
  304. this.$parent.visible = !this.$parent.visible
  305. // 列表选择事件,返回选择的数据
  306. this.$emit(
  307. 'listSelected',
  308. this.$refs.auditMattersSelectModalTable.getSelectedRowKeys(),
  309. this.$refs.auditMattersSelectModalTable.getSelectedRows()
  310. )
  311. },
  312. handleCancel(e) {
  313. this.$parent.visible = !this.$parent.visible
  314. },
  315. // 翻页操作
  316. onChange(pagination, filters, sorter) {
  317. this.pageSize = pagination.pageSize
  318. this.startPosition = (pagination.current - 1) * pagination.pageSize
  319. },
  320. // 开启关闭
  321. searchedClick() {
  322. this.expand = false
  323. },
  324. handleSearch() {
  325. const formData = this.formData
  326. // 获取当前表格过滤条件
  327. this.filterExpressions = []
  328. // 获取高级搜索的数据
  329. // 开始修改
  330. if (formData !== null) {
  331. // 标题
  332. if (this.strOrArr(formData.docTitle)) {
  333. this.filterExpressions.push({
  334. dataType: 'str',
  335. name: 'docTitle',
  336. op: 'like',
  337. stringValue: formData.docTitle,
  338. })
  339. }
  340. // 发文字号
  341. if (this.strOrArr(formData.dispatchWord)) {
  342. this.filterExpressions.push({
  343. dataType: 'str',
  344. name: 'dispatchWord',
  345. op: 'like',
  346. stringValue: formData.dispatchWord,
  347. })
  348. }
  349. // 时效性
  350. if (this.strOrArr(formData.period)) {
  351. if (formData.period[0] === null) {
  352. formData.period = null
  353. } else {
  354. this.filterExpressions.push({
  355. dataType: 'str',
  356. name: 'period',
  357. op: 'eq',
  358. stringValue: formData.period[0].id,
  359. })
  360. }
  361. }
  362. }
  363. },
  364. },
  365. }
  366. </script>
  367. <style module lang="scss">
  368. @use '@/common/design' as *;
  369. </style>