123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248 |
- <template>
- <div :class="$style.wrapHeight">
- <a-card>
- <!-- 高级搜索组件 -->
- <audit-advanced-query
- :expand="expand"
- :search-data="formData"
- :ref-name="searchform"
- :search-style="{
- height: '170px',
- }"
- :search-fun="handleSearch"
- @searchedClick="searchedClick"
- @resetForm="resetForm"
- >
- <template>
- <a-col :span="12">
- <a-form-model-item label="准则版本编号">
- <a-input v-model="formData.criteriaCode"></a-input>
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="准则适用范围">
- <sd-group-picker v-model="formData.criteriaDeptCode" />
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item :label="'\u2003\u2003是否启用'">
- <sd-select v-model="formData.status" :options="statusList" allow-clear />
- </a-form-model-item>
- </a-col>
- </template>
- </audit-advanced-query>
- <sd-data-table-ex
- v-show="flag"
- :key="key"
- ref="riskCriteriaTable"
- form-id="riskCriteria"
- page-id="risk/criteria/riskCriteria"
- data-url="api/xcoa-mobile/v1/riskcriteria/all-list"
- :columns="columns"
- :actions="actions"
- :show-selection="actions.length > 0"
- :show-advance-query="true"
- :filter-expressions="expressions"
- :search-fields="['criteriaCode']"
- @searchbtnClick="searchbtnClick"
- >
- <template slot="islink" slot-scope="text, record">
- <a @click="open(record)">{{ text }}</a>
- </template>
- </sd-data-table-ex>
- </a-card>
- </div>
- </template>
- <script>
- import systemManage from '@/system-manage/system-manage'
- import TableActionTypes from '@/common/services/table-action-types'
- import TableColumnTypes from '@/common/services/table-column-types'
- import crossWindowWatcher from '@/common/services/cross-window-watcher'
- import auditAdvancedQuery from '@product/iam/components/audit-advanced-query.vue'
- import auditAdvancedQueryMixins from '@product/iam/components/audit-advanced-query-mixins'
- import riskCriteriaService from './risk-criteria-service'
- import components from './_import-components/risk-criteria-list-import'
- export default {
- name: 'RiskCriteriaList',
- metaInfo: {
- title: '风险准则',
- },
- components: {
- ...components,
- auditAdvancedQuery,
- },
- mixins: [auditAdvancedQueryMixins],
- data() {
- return {
- statusList: [
- {
- id: 0,
- name: '启用',
- },
- {
- id: 1,
- name: '作废',
- },
- ],
- waterMark: systemManage.getFormWaterMark(),
- flag: true,
- key: 0,
- searchform: 'searchform',
- formData: {
- criteriaCode: '',
- criteriaDeptCode: [],
- status: [],
- },
- columns: [
- {
- title: '序号',
- customRender: (text, record, index) => `${index + 1}`,
- width: '80px',
- },
- { dataIndex: 'id', sdHidden: true },
- {
- title: '准则版本编号',
- dataIndex: 'criteriaCode',
- scopedSlots: { customRender: 'islink' },
- },
- {
- title: '准则适用范围',
- dataIndex: 'criteriaDeptName',
- width: '300px',
- },
- {
- title: '状态',
- dataIndex: 'state',
- },
- {
- title: '创建人员',
- dataIndex: 'creatorName',
- },
- {
- title: '创建日期',
- dataIndex: 'creationTime',
- sdRender: TableColumnTypes.date,
- // sorter: true,
- defaultSortOrder: 'descend',
- },
- ],
- actions: [],
- expressions: [],
- }
- },
- mounted() {
- // 判断用户权限
- riskCriteriaService
- .checkUserPermission({
- formId: 'riskCriteria',
- })
- .then((res) => {
- if (res.data) {
- this.actions = [
- {
- label: '新建',
- id: 'new',
- type: TableActionTypes.primary, // 新建按钮,不需要回调,自动处理
- permission: null,
- callback: this.createReport,
- index: 4,
- },
- {
- label: '删除',
- id: 'delete',
- type: TableActionTypes.ex.delete,
- permission: null,
- index: 3,
- },
- ]
- }
- })
- },
- methods: {
- createReport() {
- const url = '/risk-criteria-form' // 新页面要打开的路由地址
- crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
- if (refreshFlag) {
- // 这里写或者调刷新的方法
- this.refreshDataTable()
- }
- })
- },
- refreshDataTable() {
- if (this.$refs.riskCriteriaTable) {
- this.$refs.riskCriteriaTable.clearSelection()
- this.$refs.riskCriteriaTable.refresh()
- }
- },
- open(record) {
- const url = '/risk-criteria-form?record=' + record.id // 新页面要打开的路由地址
- crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
- if (refreshFlag) {
- this.refreshDataTable()
- }
- })
- },
- handleSearch() {
- this.expressions = []
- // 报告名称
- if (this.formData.criteriaCode) {
- this.expressions.push({
- dataType: 'str',
- name: 'criteriaCode',
- op: 'like',
- stringValue: '%' + this.formData.criteriaCode + '%',
- })
- }
- // 被评价单位
- if (this.formData.criteriaDeptCode.length > 0) {
- const unitExp = this.formData.criteriaDeptCode.map((item) => item.code)
- this.expressions.push({
- dataType: 'str',
- name: 'criteriaDeptCode',
- op: 'in',
- stringValue: unitExp.join(','),
- })
- }
- // 是否启用
- if (this.formData.status.length > 0) {
- this.expressions.push({
- dataType: 'str',
- name: 'state',
- op: 'eq',
- stringValue: this.formData.status[0].id + '',
- })
- }
- this.expressions = [...this.expressions]
- },
- // 重置
- resetForm() {
- this.formData = {
- criteriaCode: '',
- criteriaDeptCode: [],
- status: [],
- }
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- .wrap-height {
- height: 100%;
- .row-height {
- display: flex;
- flex: auto;
- height: 100%;
- .rightcard {
- flex: 1;
- width: calc(100% - 20%);
- height: 100%;
- }
- }
- }
- </style>
|