init
This commit is contained in:
@@ -0,0 +1,447 @@
|
||||
<template>
|
||||
<a-card :bordered="false">
|
||||
<div class="table-page-search-wrapper">
|
||||
<search ref="searchRef" :flag="'1'" :url="url"/>
|
||||
</div>
|
||||
<div class="table-operator">
|
||||
<a-button @click="handleBatchDel" type="primary" icon="delete">{{ $t('batchDelete') }}</a-button>
|
||||
<a-button @click="handleExportXls" type="primary" icon="export">{{ $t('dataExport') }}</a-button>
|
||||
<a-button @click="handleFileExport" type="primary" icon="mail">{{ $t('exportWithFile') }}</a-button>
|
||||
<a-button @click="handleCompare" type="primary" icon="share-alt">{{ $t('share') }}</a-button>
|
||||
<a-button @click="downTemplate" type="primary" icon="download">{{ $t('templateDownload') }}</a-button>
|
||||
<a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImport">
|
||||
<a-button type="primary" icon="import">{{ $t('import') }}</a-button>
|
||||
</a-upload>
|
||||
<a-button @click="handleAdd" type="primary" icon="plus">{{ $t('newlyAdded') }}</a-button>
|
||||
</div>
|
||||
<div>
|
||||
<!--
|
||||
showAction是否有操作按钮
|
||||
OperationList操作列表的list
|
||||
onSelectChange 选中的id值
|
||||
editTable再传操作按钮的同时把事件定义名称也传过去
|
||||
-->
|
||||
<table-data
|
||||
ref="tableDataRef"
|
||||
:flag="'1'"
|
||||
:operationList="operationList"
|
||||
@editTable="editTable"
|
||||
@deleteTable="deleteTable"
|
||||
:url="url"
|
||||
showAction
|
||||
@collection="collection"
|
||||
@subscribe="subscribe"
|
||||
@onSelectChange="onSelectChange"
|
||||
@detailClick="detailClick"
|
||||
/>
|
||||
</div>
|
||||
<library-add-form
|
||||
ref="addFormRef"
|
||||
:url="url"
|
||||
:flag="'1'"
|
||||
/>
|
||||
<libraryPush
|
||||
:url="url"
|
||||
ref="libraryPushRef"
|
||||
@clearSelected="clearSelected"
|
||||
/>
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 搜索组件
|
||||
import Search from '@/components/customField/Search'
|
||||
// 表格组件
|
||||
import TableData from '@/components/customField/TableData'
|
||||
// 新增、编辑组件
|
||||
import LibraryAddForm from './modules/LibraryAddForm'
|
||||
// 推送组件
|
||||
import LibraryPush from './modules/LibraryPush'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { downFile, downloadFile, getAction } from '@/api/manage'
|
||||
import Modal from 'ant-design-vue'
|
||||
import store from '@/store'
|
||||
|
||||
export default {
|
||||
name: 'DocumentLibrary',
|
||||
components: { Search, TableData, LibraryPush, LibraryAddForm },
|
||||
data () {
|
||||
return {
|
||||
operationList: [
|
||||
{
|
||||
text: this.$t('docLibrary.cancelCollection'),
|
||||
clickEvent: 'collection',
|
||||
has: 'document:addCollect'
|
||||
},
|
||||
{
|
||||
text: this.$t('docLibrary.cancelSubscribe'),
|
||||
clickEvent: 'subscribe',
|
||||
has: 'document:addSubscribe'
|
||||
},
|
||||
{
|
||||
text: this.$t('edit'),
|
||||
clickEvent: 'editTable',
|
||||
has: 'document:updateInfo'
|
||||
},
|
||||
{
|
||||
text: this.$t('delete'),
|
||||
clickEvent: 'deleteTable',
|
||||
has: 'document:deleteBatch'
|
||||
}
|
||||
],
|
||||
selectedRowKeys: [],
|
||||
loading: false,
|
||||
tokenHeader: { 'X-Access-Token': Vue.ls.get(ACCESS_TOKEN) },
|
||||
// url传参严格按照当前命名
|
||||
url: {
|
||||
tableHeader: 'document/bussDocumentLibraryEO/getHeader', // 表格头部字段
|
||||
getSearchList: 'document/bussDocumentLibraryEO/queryCondition', // 搜索字段
|
||||
tableList: 'document/bussDocumentLibraryEO/queryPageInfo', // 表格数据
|
||||
getAddForm: 'document/bussDocumentLibraryEO/getAddForm', // 表单的字段
|
||||
addInfo: 'document/bussDocumentLibraryEO/addInfo', // 新增
|
||||
updateInfo: 'document/bussDocumentLibraryEO/updateInfo', // 编辑
|
||||
getDocumentInfo: 'document/bussDocumentLibraryEO/getDocumentInfoById', // 查看
|
||||
deleteBatch: 'document/bussDocumentLibraryEO/deleteBatch', // 删除
|
||||
pullMessage: 'document/bussDocumentLibraryEO/pullMessage', // 推送
|
||||
importZipUrl: '/document/bussDocumentLibraryEO/importZip', // 导入
|
||||
verifyBind: '/document/bussDocumentLibraryEO/verifyBind', // 验证当前的数据是否可以删除
|
||||
getPage: '/document/phasedImplementationDetailsEO/page',
|
||||
exportXlsUrl: '', // 导出
|
||||
exportZipUrl: '', // 带文件导出
|
||||
downTemplateUrl: '' // 下载导入模板
|
||||
},
|
||||
idList: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
importExcelUrl () {
|
||||
return `${window._CONFIG.domianURL}${this.url.importZipUrl}`
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 新增
|
||||
handleAdd () {
|
||||
this.$refs.addFormRef.add()
|
||||
},
|
||||
// 批量删除
|
||||
handleBatchDel () {
|
||||
if (this.idList.length > 0) {
|
||||
this.$confirm({
|
||||
content: this.$t('confirmBatchDeletion'),
|
||||
onOk: () => {
|
||||
const idList = JSON.parse(JSON.stringify(this.idList))
|
||||
this.verifyBind(idList.join(','), () => {
|
||||
getAction(this.url.deleteBatch, { ids: idList.join(',') }).then((res) => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.idList = []
|
||||
this.$emit('searchGetData')
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.$message.warning(this.$t('selectLeastOne'))
|
||||
}
|
||||
},
|
||||
// 验证传入的idList是否都可以删除,不明白具体为什么要判断??
|
||||
verifyBind (idList, callBack) {
|
||||
getAction(this.url.verifyBind, { ids: idList }).then((res) => {
|
||||
if (res.success) {
|
||||
callBack && callBack()
|
||||
} else {
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
})
|
||||
},
|
||||
// 推送
|
||||
handleCompare () {
|
||||
if (this.idList.length > 0) {
|
||||
this.$nextTick(() => {
|
||||
this.$refs.libraryPushRef.getPush(this.idList)
|
||||
})
|
||||
} else {
|
||||
this.$message.warning(this.$t('selectLeastOne'))
|
||||
}
|
||||
},
|
||||
// 编辑按钮
|
||||
editTable (val) {
|
||||
this.$refs.addFormRef.edit(val)
|
||||
},
|
||||
// 删除按钮
|
||||
deleteTable (val) {
|
||||
this.$confirm({
|
||||
content: this.$t('ConfirmDelete'),
|
||||
onOk: () => {
|
||||
this.verifyBind(val.id, () => {
|
||||
getAction(this.url.deleteBatch, { ids: val.id }).then((res) => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.$emit('searchGetData')
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 收藏按钮
|
||||
collection (val) {
|
||||
this.$confirm({
|
||||
content: val.collectFlag === 0 || !val.collectFlag ? this.$t('confirmCollection') : this.$t('cancelConfirmCollection'),
|
||||
onOk: () => {
|
||||
let url = ''
|
||||
if (val.collectFlag === 0 || !val.collectFlag) {
|
||||
url = 'document/bussDocumentLibraryEO/addCollect'
|
||||
} else {
|
||||
url = 'document/bussDocumentLibraryEO/cancelCollect'
|
||||
}
|
||||
getAction(url, { id: val.id }).then((res) => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.$emit('searchGetData')
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 订阅按钮
|
||||
subscribe (val) {
|
||||
this.$confirm({
|
||||
content: val.subscribeFlag === 0 || !val.subscribeFlag ? this.$t('confirmSubscribe') : this.$t('cancelConfirmSubscribe'),
|
||||
onOk: () => {
|
||||
let url = ''
|
||||
if (val.subscribeFlag === 0 || !val.subscribeFlag) {
|
||||
url = 'document/bussDocumentLibraryEO/addSubscribe'
|
||||
} else {
|
||||
url = 'document/bussDocumentLibraryEO/cancelSubscribe'
|
||||
}
|
||||
getAction(url, { id: val.id }).then((res) => {
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('OperationSuccessful'))
|
||||
this.$emit('searchGetData')
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 选中的id
|
||||
onSelectChange (value) {
|
||||
this.idList = value
|
||||
},
|
||||
// 处理列表中的点击事件
|
||||
detailClick (item) {
|
||||
const newUrl = this.$router.resolve({
|
||||
path: '/docManage/library/detail',
|
||||
query: item
|
||||
})
|
||||
window.open(newUrl.href, '_blank')
|
||||
},
|
||||
// 清楚表格选中
|
||||
clearSelected () {
|
||||
this.idList = []
|
||||
},
|
||||
// 下载模板
|
||||
downTemplate (fileName) {
|
||||
if (!fileName || typeof fileName !== 'string') {
|
||||
fileName = '模板文件'
|
||||
}
|
||||
downloadFile(this.url.downTemplateUrl, fileName + '.xlsx')
|
||||
},
|
||||
deselect () {
|
||||
this.$refs.tableDataRef.selectedRowKeys = []
|
||||
this.idList = []
|
||||
},
|
||||
// 带文件导出
|
||||
handleFileExport (fileName) {
|
||||
if (this.idList.length > 0) {
|
||||
if (!fileName || typeof fileName !== 'string') {
|
||||
fileName = '导出文件'
|
||||
}
|
||||
const param = {
|
||||
...this.$refs.searchRef.queryParam,
|
||||
id: this.idList.join(','),
|
||||
flag: 'file'
|
||||
}
|
||||
console.log('导出参数', param)
|
||||
// 加一个大的提示
|
||||
const modalLoading = this.$info({
|
||||
title: '提示',
|
||||
content: <span>正在导出,请稍候 <a-spin size="small"/></span>,
|
||||
keyboard: false
|
||||
})
|
||||
// 把知道了这个按钮去掉
|
||||
this.$nextTick(() => {
|
||||
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
|
||||
})
|
||||
downFile(this.url.exportZipUrl, param).then((data) => {
|
||||
if (!data) {
|
||||
this.$message.warning('文件下载失败')
|
||||
}
|
||||
}).finally(() => {
|
||||
// 销毁这个提示
|
||||
modalLoading.destroy()
|
||||
this.deselect()
|
||||
})
|
||||
} else {
|
||||
this.$message.warning(this.$t('selectLeastOne'))
|
||||
}
|
||||
},
|
||||
// 导出
|
||||
handleExportXls (fileName) {
|
||||
if (!fileName || typeof fileName !== 'string') {
|
||||
fileName = '导出文件'
|
||||
}
|
||||
const param = {
|
||||
...this.$refs.searchRef.queryParam,
|
||||
id: this.idList.join(',')
|
||||
}
|
||||
console.log('导出参数', param)
|
||||
// 加一个大的提示
|
||||
const modalLoading = this.$info({
|
||||
title: '提示',
|
||||
content: <span>正在导出,请稍候 <a-spin size="small"/></span>,
|
||||
keyboard: false
|
||||
})
|
||||
// 把知道了这个按钮去掉
|
||||
this.$nextTick(() => {
|
||||
document.getElementsByClassName('ant-modal-confirm-btns')[0].style = 'display:none'
|
||||
})
|
||||
downFile(this.url.exportXlsUrl, param).then((data) => {
|
||||
if (!data) {
|
||||
this.$message.warning('文件下载失败')
|
||||
return
|
||||
}
|
||||
if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
||||
window.navigator.msSaveBlob(new Blob([data], { type: 'application/vnd.ms-excel' }), fileName + '.xls')
|
||||
} else {
|
||||
const url = window.URL.createObjectURL(new Blob([data], { type: 'application/vnd.ms-excel' }))
|
||||
const link = document.createElement('a')
|
||||
link.style.display = 'none'
|
||||
link.href = url
|
||||
link.setAttribute('download', fileName + '.xls')
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
document.body.removeChild(link) // 下载完成移除元素
|
||||
window.URL.revokeObjectURL(url) // 释放掉blob对象
|
||||
}
|
||||
}).finally(() => {
|
||||
// 销毁这个提示
|
||||
modalLoading.destroy()
|
||||
this.deselect()
|
||||
})
|
||||
},
|
||||
handleImport (info) {
|
||||
this.spinning = true
|
||||
if (info.file.status !== 'uploading') {
|
||||
console.log(info.file, info.fileList)
|
||||
}
|
||||
|
||||
if (info.file.status === 'done') {
|
||||
if (info.file.response.success) {
|
||||
if (info.file.response.code === 201) {
|
||||
let { message } = info.file.response
|
||||
const { name } = info.file
|
||||
const content = []
|
||||
if (message) {
|
||||
message = message.split('</br>')
|
||||
message.forEach(res => {
|
||||
if (res) {
|
||||
content.push(< div > {res} < /div>)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.$warning({
|
||||
title: name,
|
||||
content: (
|
||||
< div >
|
||||
{content}
|
||||
< /div>
|
||||
)
|
||||
})
|
||||
} else {
|
||||
this.$emit('searchGetData')
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
}
|
||||
this.spinning = false
|
||||
} else {
|
||||
const data = info.file.response
|
||||
const token = Vue.ls.get(ACCESS_TOKEN)
|
||||
if ((token && data.message.includes('Token失效')) || (token && data.message.includes('token')) || (token && data.message.includes('用户不存在'))) {
|
||||
this.spinning = false
|
||||
Modal.error({
|
||||
title: '登录已过期',
|
||||
content: '很抱歉,登录已过期,请重新登录',
|
||||
okText: '重新登录',
|
||||
mask: false,
|
||||
onOk: () => {
|
||||
store.dispatch('Logout').then(() => {
|
||||
Vue.ls.remove(ACCESS_TOKEN)
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
return
|
||||
}
|
||||
let { message } = info.file.response
|
||||
const { name } = info.file
|
||||
const content = []
|
||||
if (message) {
|
||||
message = message.split('</br>')
|
||||
message.forEach(res => {
|
||||
if (res) {
|
||||
content.push(< div > {res} < /div>)
|
||||
}
|
||||
})
|
||||
}
|
||||
this.$warning({
|
||||
title: name,
|
||||
content: (
|
||||
< div >
|
||||
{content}
|
||||
< /div>
|
||||
)
|
||||
})
|
||||
this.spinning = false
|
||||
}
|
||||
} else if (info.file.status === 'error') {
|
||||
if (info.file.response.status === 500) {
|
||||
const data = info.file.response
|
||||
const token = Vue.ls.get(ACCESS_TOKEN)
|
||||
if ((token && data.message.includes('Token失效')) || (token && data.message.includes('token')) || (token && data.message.includes('用户不存在'))) {
|
||||
Modal.error({
|
||||
title: '登录已过期',
|
||||
content: '很抱歉,登录已过期,请重新登录',
|
||||
okText: '重新登录',
|
||||
mask: false,
|
||||
onOk: () => {
|
||||
store.dispatch('Logout').then(() => {
|
||||
Vue.ls.remove(ACCESS_TOKEN)
|
||||
window.location.reload()
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
this.spinning = false
|
||||
} else {
|
||||
this.$message.error(this.$t('operationFailed'))
|
||||
this.spinning = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@import '~@assets/less/common.less';
|
||||
</style>
|
||||
@@ -0,0 +1,436 @@
|
||||
<template>
|
||||
<a-drawer
|
||||
:title="title"
|
||||
:maskClosable="false"
|
||||
:width="drawerWidth"
|
||||
placement="right"
|
||||
:closable="true"
|
||||
@close="handleCancel"
|
||||
:visible="visible"
|
||||
style="height: 100%;overflow: auto;padding-bottom: 53px;">
|
||||
<add-form
|
||||
ref="addFormDataRef"
|
||||
@submitFormData="submitFormData"
|
||||
:flag="'1'"
|
||||
v-if="visible"
|
||||
:url="url"
|
||||
/>
|
||||
<div>
|
||||
<div class="header-text" style='margin-bottom: 0px'>
|
||||
{{$t('docLibrary.detailsPhasedImplementation')}}
|
||||
</div>
|
||||
<a-button key="submit" type="primary" @click="newlyAdded" style='float: right; z-index: 99; margin-bottom: 5px'>
|
||||
{{ $t('newlyAdded') }}
|
||||
</a-button>
|
||||
<a-table
|
||||
:loading="loading"
|
||||
:pagination="false"
|
||||
:data-source="dataGradto"
|
||||
:columns="columnsGrading"
|
||||
rowKey='id'
|
||||
:scroll="{x: '100%'}"
|
||||
>
|
||||
<span slot="gradOperation" slot-scope="text,result,index">
|
||||
<a @click="handleEdit(result,index)" style="margin-right: 10px">
|
||||
{{$t('edit')}}
|
||||
</a>
|
||||
<a @click="deleteLib(result,index)" style="margin-right: 10px">
|
||||
{{$t('delete')}}
|
||||
</a>
|
||||
</span>
|
||||
<span slot="standNumberOrClause">
|
||||
<span :title="$t('docLibrary.statuteNumberClause')">{{$t('docLibrary.statuteNumberClause')}}</span>
|
||||
</span>
|
||||
<span slot="implementationDateTwo">
|
||||
<span :title="$t('docLibrary.implementationDateTwo')">{{$t('docLibrary.implementationDateTwo')}}</span>
|
||||
</span>
|
||||
<span slot="typeofImplementation">
|
||||
<span :title="$t('docLibrary.typeofImplementation')">{{$t('docLibrary.typeofImplementation')}}</span>
|
||||
</span>
|
||||
</a-table>
|
||||
</div>
|
||||
<a-modal
|
||||
:title="$t('newlyAdded')"
|
||||
:width="900"
|
||||
:visible="visibleGrad"
|
||||
:confirm-loading="confirmLoading"
|
||||
:maskClosable="false"
|
||||
@cancel="visibleGrad = false"
|
||||
>
|
||||
<a-form-model :rules="tableRules" :model="tableDataGrad"
|
||||
ref="tableRuleForm">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<div class="box-title-text">
|
||||
<div class="title-text">
|
||||
<span class="required">*</span>
|
||||
<span :title="$t('docLibrary.statuteNumberClause')">{{$t('docLibrary.statuteNumberClause')}}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" prop="standNumberOrClause">
|
||||
<a-input class="box-input" v-model.trim="tableDataGrad.standNumberOrClause"
|
||||
:placeholder="$t('pleaseEnter')+$t('docLibrary.statuteNumberClause')"/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<div class="box-title-text">
|
||||
<div class="title-text">
|
||||
<span class="required">*</span>
|
||||
<span :title="$t('docLibrary.typeofImplementation')">{{$t('docLibrary.typeofImplementation')}}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" prop="implementationType">
|
||||
<j-multi-select-tag class="box-input" v-model="tableDataGrad.implementationType"
|
||||
:placeholder="$t('pleaseSelect')+$t('docLibrary.typeofImplementation')"
|
||||
:type="'select'"
|
||||
@changeQuery='implementationTypeChange'
|
||||
:triggerChange="false" dictCode="shi2_shi1_lei4_xing2"/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<div class="box-title-text">
|
||||
<div class="title-text">
|
||||
<span class="required">*</span>
|
||||
<span :title="$t('docLibrary.implementationDateTwo')">{{$t('docLibrary.implementationDateTwo')}}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" prop="implementationDate">
|
||||
<a-date-picker class="box-input" v-model="tableDataGrad.implementationDate"
|
||||
:placeholder="$t('pleaseSelect')+$t('docLibrary.implementationDateTwo')"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<div class="box-title-text">
|
||||
<div class="title-text">
|
||||
<span :title="$t('remarks')">{{$t('remarks')}}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" style="height: auto" prop="remarks">
|
||||
<a-textarea :placeholder="$t('pleaseEnter')+$t('remarks')"
|
||||
:rows="4" v-model="tableDataGrad.remarks"/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-model>
|
||||
<template slot="footer">
|
||||
<a-button key="back" @click="visibleGrad = false">
|
||||
{{ $t('cancel') }}
|
||||
</a-button>
|
||||
<a-button key="submit" type="primary" @click="handleTableSubmit">
|
||||
{{ $t('determine') }}
|
||||
</a-button>
|
||||
</template>
|
||||
</a-modal>
|
||||
<a-modal
|
||||
:title="$t('edit')"
|
||||
:width="900"
|
||||
:visible="tableVisibleGrad"
|
||||
:confirm-loading="confirmLoading"
|
||||
:maskClosable="false"
|
||||
@cancel="tableVisibleGrad = false"
|
||||
>
|
||||
<a-form-model :rules="tableRules" :model="tableDataGrad"
|
||||
ref="tableRuleFormEdit">
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<div class="box-title-text">
|
||||
<div class="title-text">
|
||||
<span class="required">*</span>
|
||||
<span :title="$t('docLibrary.statuteNumberClause')">{{$t('docLibrary.statuteNumberClause')}}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" prop="standNumberOrClause">
|
||||
<a-input class="box-input" v-model.trim="tableDataGrad.standNumberOrClause"
|
||||
:placeholder="$t('pleaseEnter')+$t('docLibrary.statuteNumberClause')"/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
<a-col :span="12">
|
||||
<div class="box-title-text">
|
||||
<div class="title-text">
|
||||
<span class="required">*</span>
|
||||
<span :title="$t('docLibrary.typeofImplementation')">{{$t('docLibrary.typeofImplementation')}}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" prop="implementationType">
|
||||
<j-multi-select-tag class="box-input" v-model="tableDataGrad.implementationType"
|
||||
:placeholder="$t('pleaseSelect')+$t('docLibrary.typeofImplementation')"
|
||||
:type="'select'"
|
||||
@changeQuery="implementationTypeChange"
|
||||
:triggerChange="false" dictCode="shi2_shi1_lei4_xing2"/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="12">
|
||||
<div class="box-title-text">
|
||||
<div class="title-text">
|
||||
<span class="required">*</span>
|
||||
<span :title="$t('docLibrary.implementationDateTwo')">{{$t('docLibrary.implementationDateTwo')}}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" prop="implementationDate">
|
||||
<a-date-picker class="box-input" v-model="tableDataGrad.implementationDate"
|
||||
:placeholder="$t('pleaseSelect')+$t('docLibrary.implementationDateTwo')"
|
||||
format="YYYY-MM-DD"
|
||||
value-format="YYYY-MM-DD"
|
||||
style="width: 100%"/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<div class="box-title-text">
|
||||
<div class="title-text">
|
||||
<span :title="$t('remarks')">{{$t('remarks')}}</span>
|
||||
</div>
|
||||
<a-form-model-item class="item-model" style="height: auto" prop="remarks">
|
||||
<a-textarea :placeholder="$t('pleaseEnter')+$t('remarks')"
|
||||
:rows="4" v-model="tableDataGrad.remarks"/>
|
||||
</a-form-model-item>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</a-form-model>
|
||||
<template slot="footer">
|
||||
<a-button key="back" @click="tablevisibleGrad = false">
|
||||
{{ $t('cancel') }}
|
||||
</a-button>
|
||||
<a-button key="submit" type="primary" @click="handleTableEditSubmit">
|
||||
{{ $t('determine') }}
|
||||
</a-button>
|
||||
</template>
|
||||
</a-modal>
|
||||
<div class="drawer-bootom-button">
|
||||
<a-button style="margin-right: 8px" @click="handleCancel">{{$t('cancel')}}</a-button>
|
||||
<a-button @click="handleSubmit" type="primary" :loading="confirmLoading">{{$t('submit')}}</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import AddForm from '@/components/customField/AddForm'
|
||||
import { postAction } from '@/api/manage'
|
||||
import JMultiSelectTag from '@/components/dict/JMultiSelectTag'
|
||||
|
||||
export default {
|
||||
name: 'LibraryAddForm',
|
||||
components: { AddForm, JMultiSelectTag },
|
||||
data () {
|
||||
return {
|
||||
title: this.$t('add'),
|
||||
drawerWidth: 900,
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
isDisplayType: false,
|
||||
dataList: [],
|
||||
// 分阶段实施详情的表格相关数据
|
||||
columns: [],
|
||||
loading: false,
|
||||
dataGradto: [],
|
||||
columnsGrading: [
|
||||
{
|
||||
dataIndex: 'standNumberOrClause',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
width: 160,
|
||||
scopedSlots: { title: 'standNumberOrClause' }
|
||||
},
|
||||
{
|
||||
// title: this.$t('Typeofimplementation'),
|
||||
dataIndex: 'implementationTypeText',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
width: 150,
|
||||
scopedSlots: { title: 'typeofimplementation' }
|
||||
},
|
||||
{
|
||||
// title: this.$t('implementationDateTwo'),
|
||||
dataIndex: 'implementationDate',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
width: 190,
|
||||
scopedSlots: { title: 'implementationDateTwo' }
|
||||
},
|
||||
{
|
||||
title: this.$t('remarks'),
|
||||
dataIndex: 'remarks',
|
||||
align: 'left',
|
||||
ellipsis: true,
|
||||
width: 204
|
||||
},
|
||||
{
|
||||
title: this.$t('operation'),
|
||||
align: 'left',
|
||||
fixed: 'right',
|
||||
width: 180,
|
||||
scopedSlots: { customRender: 'gradOperation' }
|
||||
}
|
||||
],
|
||||
visibleGrad: false,
|
||||
tableRules: {
|
||||
standNumberOrClause: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t('docLibrary.statuteNumberClause') + this.$t('cannotEmpty'),
|
||||
trigger: 'blur'
|
||||
},
|
||||
{
|
||||
// required: true,
|
||||
max: 200,
|
||||
message: this.$t('docLibrary.statuteNumberClause') + this.$t('cannotExceed') + 200 + this.$t('characters'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
],
|
||||
implementationType: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t('docLibrary.typeofImplementation') + this.$t('cannotEmpty'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
implementationDate: [
|
||||
{
|
||||
required: true,
|
||||
message: this.$t('docLibrary.implementationDateTwo') + this.$t('cannotEmpty'),
|
||||
trigger: 'change'
|
||||
}
|
||||
],
|
||||
remarks: [
|
||||
{
|
||||
// required: true,
|
||||
max: 1000,
|
||||
message: this.$t('remarks') + this.$t('cannotExceed') + 1000 + this.$t('characters'),
|
||||
trigger: 'blur'
|
||||
}
|
||||
]
|
||||
},
|
||||
tableDataGrad: {},
|
||||
tableVisibleGrad: false
|
||||
}
|
||||
},
|
||||
props: {
|
||||
flag: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 接口
|
||||
url: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
handleCancel () {
|
||||
this.visible = false
|
||||
},
|
||||
add () {
|
||||
this.confirmLoading = false
|
||||
this.title = this.$t('add')
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addFormDataRef.add()
|
||||
})
|
||||
},
|
||||
edit (item) {
|
||||
this.confirmLoading = false
|
||||
this.title = this.$t('edit')
|
||||
this.visible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.addFormDataRef.edit(item)
|
||||
})
|
||||
},
|
||||
// 分阶段实施详情的新增
|
||||
newlyAdded () {
|
||||
this.tableDataGrad = {}
|
||||
this.visibleGrad = true
|
||||
},
|
||||
// 分阶段实施详情的编辑
|
||||
handleEdit (result, index) {
|
||||
this.tableVisibleGrad = true
|
||||
this.tableDataIndex = index
|
||||
this.tableDataGrad = JSON.parse(JSON.stringify(result))
|
||||
},
|
||||
// 分阶段实施详情的删除
|
||||
deleteLib (val, index) {
|
||||
this.$confirm({
|
||||
content: this.$t('confirmDeletion'),
|
||||
onOk: () => {
|
||||
this.dataGradto.splice(index, 1)
|
||||
this.dataGradto = [...this.dataGradto]
|
||||
}
|
||||
})
|
||||
},
|
||||
// 分阶段实施详情的新增弹框
|
||||
handleTableSubmit () {
|
||||
this.$refs.tableRuleForm.validate(valid => {
|
||||
if (valid) {
|
||||
this.dataGradto.push(this.tableDataGrad)
|
||||
this.visibleGrad = false
|
||||
}
|
||||
})
|
||||
},
|
||||
// 实施类型下拉框改变
|
||||
implementationTypeChange (val) {
|
||||
this.tableDataGrad.implementationTypeText = val
|
||||
},
|
||||
// 表格编辑弹框的提交
|
||||
handleTableEditSubmit () {
|
||||
this.$refs.tableRuleFormEdit.validate((valid) => {
|
||||
if (valid) {
|
||||
this.tableVisibleGrad = false
|
||||
this.dataGradto[this.tableDataIndex] = this.tableDataGrad
|
||||
this.dataGradto = [...this.dataGradto]
|
||||
}
|
||||
})
|
||||
},
|
||||
handleSubmit () {
|
||||
this.confirmLoading = true
|
||||
this.$refs.addFormDataRef.submit()
|
||||
},
|
||||
// 表单提交的回调,获取表单数据
|
||||
submitFormData (formInline) {
|
||||
let url = ''
|
||||
if (formInline.id) {
|
||||
url = this.url.updateInfo
|
||||
} else {
|
||||
url = this.url.addInfo
|
||||
}
|
||||
postAction(url, formInline).then((res) => {
|
||||
if (res.success) {
|
||||
this.confirmLoading = false
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
if (this.formInline.id) {
|
||||
this.$emit('searchGetData')
|
||||
} else {
|
||||
this.$emit('searchGetData')
|
||||
}
|
||||
} else {
|
||||
this.confirmLoading = false
|
||||
this.$message.warning(res.message)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import '~@assets/less/common.less';
|
||||
.header-text {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
margin-left: 15px;
|
||||
/*border-bottom: 1px #d9d9d9 dashed;*/
|
||||
height: 30px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,186 @@
|
||||
<template>
|
||||
<div>
|
||||
<a-drawer
|
||||
:title="$t('share')"
|
||||
:maskClosable="false"
|
||||
:width="600"
|
||||
placement="right"
|
||||
:closable="true"
|
||||
@close="handleCancel"
|
||||
:visible="visible"
|
||||
style="height: 100%;overflow: auto;padding-bottom: 53px;">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-input-search style="margin-bottom: 8px" v-model="searchModel"
|
||||
@search="onSearch"
|
||||
allowClear
|
||||
:placeholder="$t('nodeQuickLookup')"/>
|
||||
<div class="drawer-content">
|
||||
<a-tree
|
||||
v-if="visibleTree"
|
||||
style="margin-bottom: 60px;height: 600px"
|
||||
checkable
|
||||
:autoExpandParent="false"
|
||||
:tree-data="gData"
|
||||
@select="onSelect"
|
||||
@check="checkChange"
|
||||
@expand="onExpand"
|
||||
:defaultExpandedKeys="defaultExpandedKeys"
|
||||
>
|
||||
</a-tree>
|
||||
</div>
|
||||
</a-spin>
|
||||
<div class="drawer-bootom-button">
|
||||
<a-button @click="handleCancel" style="margin-right: 16px">{{$t('cancel')}}</a-button>
|
||||
<a-button @click="handleSubmit" type="primary" :loading="submitLoading">{{$t('submit')}}</a-button>
|
||||
</div>
|
||||
</a-drawer>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAction, postAction } from '../../../api/manage'
|
||||
|
||||
export default {
|
||||
name: 'LibraryPush',
|
||||
props: {
|
||||
url: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
gData: [],
|
||||
searchModel: '',
|
||||
autoExpandParent: true,
|
||||
expandedKeys: [],
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
selectedKey: [],
|
||||
tableKey: [],
|
||||
userIds: [],
|
||||
departId: '',
|
||||
defaultExpandedKeys: [],
|
||||
submitLoading: false,
|
||||
visibleTree: false,
|
||||
flag: ''
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getPush (data, flag) {
|
||||
this.tableKey = data
|
||||
this.flag = flag
|
||||
this.searchModel = ''
|
||||
this.visible = true
|
||||
this.visibleTree = false
|
||||
this.$nextTick(() => {
|
||||
this.departId = ''
|
||||
this.queryDepartUserTreeList()
|
||||
})
|
||||
},
|
||||
onSelect (selectedKeys) {
|
||||
this.selectedKey = selectedKeys
|
||||
},
|
||||
onExpand (selectedKeys, val) {
|
||||
if (this.searchModel === '' || !this.searchModel) {
|
||||
if (val.expanded) {
|
||||
if (this.departId === val.node.value) {
|
||||
} else {
|
||||
this.departId = val.node.value
|
||||
this.queryDepartUserTreeList()
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
handleCancel () {
|
||||
this.visible = false
|
||||
this.visibleTree = false
|
||||
},
|
||||
handleSubmit () {
|
||||
let query = {}
|
||||
if (this.flag) {
|
||||
query = {
|
||||
documentIds: this.tableKey.join(','),
|
||||
userIds: this.userIds.join(','),
|
||||
departIds: this.userIds.join(','),
|
||||
flag: this.flag
|
||||
}
|
||||
} else {
|
||||
query = {
|
||||
documentIds: this.tableKey.join(','),
|
||||
userIds: this.userIds.join(','),
|
||||
departIds: this.userIds.join(',')
|
||||
}
|
||||
}
|
||||
this.submitLoading = true
|
||||
this.confirmLoading = true
|
||||
getAction(this.url.pullMessage, query).then((res) => {
|
||||
this.confirmLoading = false
|
||||
this.submitLoading = false
|
||||
if (res.success) {
|
||||
this.$message.success(this.$t('operationSuccessful'))
|
||||
this.userIds = []
|
||||
this.visible = false
|
||||
this.visibleTree = false
|
||||
this.$emit('clearSelected')
|
||||
this.$emit('searchGetData')
|
||||
} else {
|
||||
this.$message.warning(this.$t('operationFailed'))
|
||||
}
|
||||
})
|
||||
},
|
||||
onSearch (e) {
|
||||
this.gData = []
|
||||
this.departId = ''
|
||||
this.visibleTree = false
|
||||
if (e) {
|
||||
this.getUserAndDepart()
|
||||
} else {
|
||||
this.queryDepartUserTreeList()
|
||||
}
|
||||
},
|
||||
getUserAndDepart () {
|
||||
getAction('sys/user/getUserAndDepart', { name: this.searchModel }).then((res) => {
|
||||
this.gData = res || []
|
||||
this.visibleTree = true
|
||||
})
|
||||
},
|
||||
queryDepartUserTreeList () {
|
||||
let gData = JSON.parse(JSON.stringify(this.gData))
|
||||
if (gData && gData.length > 0) {
|
||||
gData = JSON.stringify(gData)
|
||||
} else {
|
||||
gData = ''
|
||||
}
|
||||
this.confirmLoading = true
|
||||
postAction('sys/user/queryDepartUserTreeList', {
|
||||
departId: this.departId,
|
||||
json: gData
|
||||
}).then((res) => {
|
||||
this.confirmLoading = false
|
||||
if (res.success) {
|
||||
this.gData = res.result
|
||||
this.defaultExpandedKeys = [this.departId]
|
||||
this.visibleTree = true
|
||||
} else {
|
||||
this.gData = []
|
||||
}
|
||||
})
|
||||
},
|
||||
checkChange (e) {
|
||||
this.userIds = e
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
@import '~@assets/less/common.less';
|
||||
|
||||
.drawer-content {
|
||||
height: calc(100% - 60px);
|
||||
overflow: auto;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user