123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413 |
- <template>
- <div :class="$style.wrapHeight">
- <a-card>
- <!-- 高级搜索组件 -->
- <audit-advanced-query
- :expand="expand"
- :search-data="formData"
- :ref-name="searchform"
- :search-style="{ height: '170px', left: '20px', top: '57px' }"
- :search-fun="handleSearch"
- @searchedClick="searchedClick"
- @resetForm="resetForm"
- >
- <template>
- <a-col :span="12">
- <a-form-model-item label="任务年度">
- <sd-select v-model="formData.year" :options="yearArry" allow-clear />
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="任务名称">
- <a-input v-model="formData.dutieName" allow-clear />
- </a-form-model-item>
- </a-col>
- <a-col :span="12">
- <a-form-model-item label="发起机构">
- <a-input v-model="formData.inspectUnitName" allow-clear />
- </a-form-model-item>
- </a-col>
- </template>
- </audit-advanced-query>
- <sd-data-table-ex
- :key="key"
- ref="riskDutieTable"
- form-id="riskDutie"
- page-id="risk/dutie/riskDutie"
- data-url="api/xcoa-mobile/v1/riskdutie/all-list"
- :columns="columns"
- :actions="actions"
- show-selection
- :show-advance-query="true"
- :filter-expressions="expressions"
- :search-fields="['year', 'dutieName']"
- @searchbtnClick="searchbtnClick"
- >
- <template slot="islink" slot-scope="text, record">
- <a @click="openversion(record)">{{ text }}</a>
- </template>
- <template slot="action" slot-scope="text, record">
- <a-button type="link" @click="open(record)"
- ><sd-icon type="sd-eye" :style="{ fontSize: '25px' }"
- /></a-button>
- </template>
- </sd-data-table-ex>
- <div :class="[$style.btns]">
- <a-col :span="13" :offset="0">
- <a-radio-group v-model="radioValue" @change="radioOnChange">
- <a-radio :style="radioStyle" :value="'0'">
- 全部
- </a-radio>
- <a-radio :style="radioStyle" :value="'1'">
- 待处理
- </a-radio>
- </a-radio-group>
- </a-col>
- </div>
- </a-card>
- </div>
- </template>
- <script>
- import { getUserInfo } from '@/common/store-mixin'
- import FlowcenterService from '@/flowcenter/flowcenter-service'
- import { Modal, message } from 'ant-design-vue'
- 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 components from './_import-components/risk-tasks-list-import'
- export default {
- name: 'RiskTasksList',
- metaInfo: {
- title: '风险任务',
- },
- components: {
- ...components,
- auditAdvancedQuery,
- },
- mixins: [auditAdvancedQueryMixins],
- data() {
- return {
- yearArry: [],
- waterMark: systemManage.getFormWaterMark(),
- flag: true,
- recordId: '',
- key: 0,
- searchform: 'searchform',
- formData: {
- year: '',
- dutieName: '',
- inspectUnitName: '',
- },
- columns: [
- {
- title: '序号',
- customRender: (text, record, index) => `${index + 1}`,
- width: '80px',
- },
- { dataIndex: 'id', sdHidden: true },
- { dataIndex: 'instId', sdHidden: true },
- {
- title: '任务年度',
- dataIndex: 'year',
- width: '120px',
- defaultSortOrder: 'desc',
- },
- {
- title: '任务名称',
- dataIndex: 'dutieName',
- scopedSlots: { customRender: 'islink' },
- },
- {
- title: '任务编号',
- dataIndex: 'dutieCode',
- },
- {
- title: '发起机构',
- dataIndex: 'inspectUnitName',
- },
- {
- title: '任务类型',
- dataIndex: 'dutieType',
- },
- {
- title: '创建人员',
- dataIndex: 'creatorName',
- },
- {
- title: '创建日期',
- dataIndex: 'creationTime',
- sdRender: TableColumnTypes.date,
- width: '120px',
- },
- {
- title: '当前状态',
- dataIndex: 'flowState',
- width: '120px',
- },
- { title: '当前处理人', dataIndex: 'currentUser', width: '120px' },
- { title: '文档状态', dataIndex: 'endType', width: '120px', sdHidden: true },
- {
- title: '操作',
- dataIndex: '',
- scopedSlots: { customRender: 'action' },
- align: 'center',
- width: '80px',
- },
- ],
- actions: [
- {
- label: '新建任务',
- id: 'new',
- type: TableActionTypes.primary, // 新建按钮,不需要回调,自动处理
- permission: null,
- callback: this.createRiskTask,
- index: 4,
- },
- {
- label: '删除',
- id: 'delete',
- permission: null,
- class: 'batch',
- callback: this.deleteRows,
- index: 3,
- },
- ],
- expressions: [],
- auditMattersPath: '',
- visible: false,
- radioValue: '0',
- radioType: true,
- radioStyle: {},
- }
- },
- mounted() {
- // 初始化年份下拉框
- this.initYearSelect()
- },
- methods: {
- radioOnChange(e, info) {
- this.radioValue = e.target.value
- this.radioType = true
- this.expressions.forEach((item) => {
- if (item.name === 'pending') {
- item.stringValue = this.radioValue
- this.radioType = false
- }
- })
- if (this.radioType) {
- this.expressions.push({
- dataType: 'str',
- name: 'pending',
- op: 'eq',
- stringValue: this.radioValue,
- })
- }
- this.expressions = [...this.expressions]
- this.$refs.riskDutieTable.clearSelection()
- },
- // 创建任务
- createRiskTask() {
- const url = '/sd-flow-guide?code=PRODUCT_RISK_TASKS' // 新页面要打开的路由地址
- crossWindowWatcher.waitForChanged(url).then((refreshFlag) => {
- if (refreshFlag) {
- // 这里写或者调刷新的方法
- this.refreshDataTable()
- }
- })
- },
- // 刷新列表
- refreshDataTable() {
- if (this.$refs.riskDutieTable) {
- this.$refs.riskDutieTable.refresh()
- this.$refs.riskDutieTable.clearSelection()
- }
- },
- // 初始化年份下拉框
- initYearSelect() {
- const nowYear = new Date().getFullYear()
- const yearArry = []
- yearArry.push(nowYear)
- for (let i = 1; i < 6; i++) {
- yearArry.push(nowYear - i)
- }
- for (let i = 1; i < 11; i++) {
- yearArry.push(nowYear + i)
- }
- yearArry.sort()
- yearArry.forEach((year) => {
- this.yearArry.push({
- name: year,
- id: year,
- })
- })
- },
- open(record) {
- this.recordId = record.id
- window.open('#/sd-webflow/done-pages/' + record.instId)
- },
- openversion(record) {
- if (record.flowState === '结束') {
- window.open('#/risk-tasks/?taskId=' + record.id)
- } else {
- let openurl = ''
- const loginUser = getUserInfo()
- if (
- (record.flowState === '开始') |
- (record.flowState === '起草') |
- (record.flowState === null)
- ) {
- if (loginUser.name === record.currentUser) {
- openurl = '/sd-webflow/pages/draft/' + record.instId
- } else {
- openurl = '/sd-webflow/done-pages/' + record.instId
- }
- } else {
- openurl = '/sd-webflow/done-pages/' + record.instId
- }
- crossWindowWatcher.waitForChanged(openurl).then((refreshFlag) => {
- if (refreshFlag) {
- // 这里写或者调刷新的方法
- this.refreshDataTable()
- }
- })
- }
- },
- handleSearch() {
- this.expressions = []
- // 全部 待处理
- if (this.radioValue === '1') {
- this.Expressions.push({
- dataType: 'str',
- name: 'pending',
- op: 'eq',
- stringValue: this.radioValue,
- })
- }
- // 年度
- if (this.formData.year.length > 0) {
- this.expressions.push({
- dataType: 'str',
- name: 'year',
- op: 'eq',
- stringValue: this.formData.year[0].name + '',
- })
- }
- // 任务名称
- if (this.formData.dutieName) {
- this.expressions.push({
- dataType: 'str',
- name: 'dutieName',
- op: 'like',
- stringValue: '%' + this.formData.dutieName + '%',
- })
- }
- // 发起机构
- if (this.formData.inspectUnitName) {
- this.expressions.push({
- dataType: 'str',
- name: 'inspectUnitName',
- op: 'like',
- stringValue: '%' + this.formData.inspectUnitName + '%',
- })
- }
- this.expressions = [...this.expressions]
- },
- // 重置
- resetForm() {
- this.formData = {
- year: '',
- dutieName: '',
- inspectUnitName: [],
- }
- },
- // 删除数据
- deleteRows(record) {
- const selecteFlowState = this.$refs.riskDutieTable.getSelectedRows()
- const selectedRowKeys = this.$refs.riskDutieTable.getSelectedRowKeys()
- if (selectedRowKeys.length === 0) {
- Modal.info({
- content: '请选择需要删除的文件',
- })
- return
- }
- let flag = false
- selecteFlowState.forEach((item) => {
- if (item.endType !== 0) {
- flag = true
- }
- })
- if (flag) {
- // 有过错误
- Modal.error({
- title: '删除失败:存在不是草稿状态的数据',
- })
- } else {
- Modal.confirm({
- title: '你确定删除这项内容吗?',
- content: '删除这条数据后,就无法恢复初始的状态。',
- okText: '删除',
- okType: 'danger',
- onOk: () => {
- this.loading = true
- const instIds = []
- selecteFlowState.forEach((item) => {
- if (item.instId) {
- instIds.push(item.instId)
- }
- })
- const params = {
- flowCallbackBeanName: 'formBeanCleanerCallBack',
- processInstanceIds: instIds.join(','),
- }
- FlowcenterService.fnDarftsDelete(params).then((res) => {
- if (res.status === 200) {
- message.success({ content: '删除成功!' }, 1).then(() => {
- this.$refs.riskDutieTable.clearSelection()
- this.$refs.riskDutieTable.refresh()
- this.loading = false
- })
- }
- })
- },
- })
- }
- },
- },
- }
- </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%;
- }
- }
- }
- .btns {
- position: absolute;
- top: 20px;
- right: 0;
- left: 20px;
- z-index: 100;
- width: calc(100% - 400px);
- span {
- color: blue;
- }
- }
- </style>
|