Commit bff8e6c5 authored by ztf's avatar ztf

科研计划中的自定义组件

parent c8eb54f9
<template>
<div>
<dee-as-com
:lay-config="{
typeName: 'ExtDistributeRecord',
layKey: 'DistributeRecordLists'
}"
/>
</div>
</template>
<script >
export default {
name: 'DistributeRecord',
componentName: '分发记录'
}
</script>
<style lang="scss" scoped>
</style>
<template>
<span>
<el-button v-show="showAdd" type="text" @click.stop="btnClick">添加文件</el-button>
<el-dropdown>
<span class="el-dropdown-link">
<el-button v-show="files.length" type="text">{{ `查看(${files.length})` }}</el-button>
</span>
<el-dropdown-menu slot="dropdown" class="ExtReviewDocComLink-updateflie">
<el-dropdown-item v-for="(file,index) in files" :key="index">
<div class="file-row">
<span class="file-name" :title="file.originalFileName" @click="downloadFile(file)">
{{ file.originalFileName }}
</span>
</div></el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</span>
</template>
<script>
import _get from 'lodash.get'
import { downFileByFileCode, downFileByFileId } from '@/api/file'
export default {
name: 'MuxDownloadFiles',
componentName: '多文件下载',
props: {
scope: {
type: Object,
default: null
},
filterKey: {
type: String,
default: () => ''
},
showAdd: {
type: Boolean,
default: false
}
},
data() {
return {}
},
computed: {
files() {
if (!this.scope || !this.scope.row || !this.scope.column) {
return []
}
let objFileLinks = _get(this.scope.row, this.scope.column.property)
if (!objFileLinks) {
return []
}
if (this.filterKey) {
objFileLinks = objFileLinks.filter(link => this.filterKey.includes(link.contentType))
}
return objFileLinks.map(link => link.target)
}
},
watch: {},
// 生命周期 - 创建完成(访问当前this实例)
created() {},
// 生命周期 - 挂载完成(访问DOM元素)
mounted() {},
methods: {
removeFile(row) {
this.$emit('clickRowFun', this.scope, { btnvalue: 'removeFile', row: row })
},
btnClick() {
this.$emit('clickRowFun', this.scope, { btnvalue: 'addFiles' })
},
downloadFile(file) {
if (!file.fileCode && !file.resourceId) {
this.$utils.showMessageWarning('没有权限下载该文件!')
return
}
if (file.fileCode) {
downFileByFileCode(file.fileCode).then(res => {
this.downLoadFileUrl(res)
})
return
}
if (file.resourceId) {
downFileByFileId(file.resourceId).then(res => {
this.downLoadFileUrl(res)
})
}
},
downLoadFileUrl(res) {
if (res.headers['content-disposition']) {
const fileName = decodeURI(res.headers['content-disposition'].substring(res.headers['content-disposition'].indexOf('=') + 1, res.headers['content-disposition'].length))
const url = window.URL.createObjectURL(new Blob([res.data], { type: res.headers['content-type'] }))
this.$utils.downLoadFileUrl(url, decodeURI(fileName))
} else {
if (res.data instanceof Blob) {
var reader = new FileReader()
reader.addEventListener('loadend', () => {
const message = reader.result && JSON.parse(reader.result)
this.$utils.showMessageWarning(message ? message.message : '数据包下载出错:未找到数据包内容的下载链接,请联系管理员排查问题!')
})
reader.readAsText(res.data, 'utf-8')
} else {
const message = res.data && res.data.message
this.$utils.showMessageWarning(message || '数据包下载出错:未找到数据包内容的下载链接,请联系管理员排查问题!')
}
}
}
}
}
</script>
<style lang="scss">
/* @import url(); 引入css类 */
</style>
<template>
<div class="dee-model">
<dee-table
:columns="columns"
:index-row="indexRow"
:data="tableData"
selection-row
:pagination="pagination"
@selection-change="selectionChange"
@pagination-current-change="paginationCurrentChange"
@pagination-size-change="handleSizeChange"
>
<template slot="header">
<dee-tools
:tools="tools"
mode="normal"
:collapse="true"
/>
</template>
</dee-table>
<dee-dialog
width="400px"
title="新建"
:dialog-visible="newDialog"
:dialog-bttons="dialogBttons"
@on-submit="newDoc"
@on-cancel="newDialog=false"
@handleClose="newDialog=false"
>
<dee-form
ref="newDoc"
:form="newForm"
:form-data="formData"
:rules="rules"
/>
</dee-dialog>
<dee-dialog
width="400px"
title="编辑"
:dialog-visible="editDialog"
:dialog-bttons="dialogBttons"
@on-submit="editLink"
@on-cancel="handleClose"
@handleClose="editDialog=false"
>
<!-- editDialog=false -->
<dee-form
ref="editLink"
:form="editForm"
:form-data="editFormData"
:rules="editRules"
/>
</dee-dialog>
<dee-add-model-case-dialog
:show-sub-type="true"
width="60%"
title="添加"
:show-dialog="addDialog"
search-attr="number,name"
model-name="DxDocument"
:default-data="{latest:'LATEST',modelName: 'DxDocument',state:'published' }"
@close="addDialog= false"
@selection="submit"
/>
</div>
</template>
<script>
import { updateTableData, initTableData } from '@/utils/util'
export default {
name: 'SourceDocLink',
componentName: '送审/备查文件列表',
props: {
form: {
type: Object,
default: () => {}
},
prop: {
type: String,
default: () => ''
},
readOnly: {
type: Boolean,
default: false
},
value: {
type: [Object, Array, String],
default: () => null
},
type: {
type: String,
default: () => ''
}
},
data() {
// const that = this
// const link = {
// color: '#2363AF',
// cursor: 'pointer'
// }
return {
indexRow: {
title: '序号',
align: 'center',
width: '60'
},
pagination: {
currentPage: 1,
pageSize: 10,
total: 0,
pageSizes: [10, 20, 50]
},
componentProp: {
showSubType: true,
associationFormRelationObj: []
},
columns: [
{ title: '编号', key: 'docNumber'
// component: {
// render: function(h, data) {
// return <span style={link} v-on:click={() => {
// that.jump(data)
// }}>{data.docNumber}----{data}</span>
// }
// }
},
{ title: '名称', key: 'docName' },
{ title: '状态', key: 'target.state', fildProp: {
type: 'DictDataVO',
rule: {
dictTypeCode: 'ObjStatus' }
}},
{ title: '页数', key: 'pages' },
{ title: '份数', key: 'copies' },
{ title: '密级', key: 'secret', fildProp: {
type: 'DictDataVO',
rule: {
dictTypeCode: 'SecretCode' }
}},
{ title: '关联描述', key: 'linkDescript' }
],
tools: [
{
type: 'icon',
name: '新建',
icon: '/icons/c-created.png',
handler: {
click: () => {
this.newForm = {}
this.newDialog = true
}
}
},
{
type: 'icon',
name: '添加',
icon: '/icons/c-add.png',
handler: {
click: () => {
this.addDialog = true
}
}
},
{
type: 'icon',
name: '移除',
icon: '/icons/c-delete.png',
handler: {
click: () => {
this.remove()
}
}
},
{
type: 'icon',
name: '编辑',
icon: '/icons/c-edit.png',
handler: {
click: () => {
if (this.selection.length === 0) {
this.$utils.showMessageWarning('请选择要编辑的项')
return
}
if (this.selection.length === 1) {
this.editForm = {
pages: this.selection[0].pages || '',
copies: this.selection[0].copies || '',
secret: this.selection[0].secret || '',
remark: this.selection[0].remark || '',
linkDescript: this.selection[0].linkDescript || ''
}
} else {
this.editForm = {}
}
this.editDialog = true
return
}
}
}
],
tableData: [],
selection: [],
addDialog: false,
newDialog: false,
editDialog: false,
editForm: {},
dialogBttons: [{
type: 'submit',
text: '提交',
component: {
type: 'primary'
}
}, {
type: 'cancel',
text: '取消',
component: {}
}],
newForm: {},
formData: [{
title: '',
split: 1,
data: [{
title: '编号',
key: 'number',
component: {
name: 'el-input'
}
}, {
title: '名称',
key: 'name',
component: {
name: 'el-input'
}
}]
}],
rules: {
number: [{ required: true, message: '请填写编号', trigger: 'blur' }],
name: [{ required: true, message: '请填写名称', trigger: 'blur' }]
}
}
},
computed: {
editRules() {
if (this.secretRules) {
return {
pages: [{ required: true, message: '请填写页数', trigger: 'blur' }],
copies: [{ required: true, message: '请填写份数', trigger: 'blur' }],
secret: [{ required: true, message: '请选择密级', trigger: 'change' }]
}
}
return {
pages: [{ required: true, message: '请填写页数', trigger: 'blur' }],
copies: [{ required: true, message: '请填写份数', trigger: 'blur' }]
}
},
secretRules() {
return !this.selection || this.selection.length !== 1 || !this.selection[0].targetId
},
editFormData() {
return [{
title: '',
split: 1,
data: [{
'title': '页数',
'key': 'pages',
component: {
'name': 'el-input-number',
'min': 0,
'max': 10000,
'step': 1,
'step-strictly': true
}
}, {
'title': '份数',
'key': 'copies',
component: {
'name': 'el-input-number',
'min': 0,
'max': 10000,
'step': 1,
'step-strictly': true
}
}, {
'title': '密级',
'key': 'secret',
component: {
'name': 'el-select',
'dicType': '0',
'disabled': !this.secretRules,
'optionsdic': 'SecretCode'
}
}, {
'title': '备注',
'key': 'remark',
component: {
name: 'el-input',
row: 2,
type: 'textarea'
}
}, {
'title': '描述',
'key': 'linkDescript',
component: {
name: 'el-input',
row: 2,
type: 'textarea'
}
}]
}]
},
btnsFilter() {
if (this.readOnly) {
return 'ALL'
}
return null
}
},
watch: {
value: {
immediate: true,
handler: function(val) {
val && this.init()
}
}
},
// 生命周期 - 创建完成(访问当前this实例)
created() {},
// 生命周期 - 挂载完成(访问DOM元素)
mounted() {},
methods: {
// 选择的数据
selectionChange(val) {
this.selection = val
},
// 编辑提交
editLink() {
let flag = false
this.selection.forEach(row => {
const form = { ...this.editForm }
if (row.targetId) {
flag = true
form.secret = row.secret
}
const _row = Object.assign({}, row, form)
const _idx = this.tableData.findIndex(r => r.docNumber === _row.docNumber)
if (_idx > -1) {
this.$set(this.tableData, _idx, _row)
}
})
this.editDialog = false
if (flag && this.secretRules) {
this.$utils.showMessageInfo('添加的文档密级不能修改!')
}
this.update()
},
// 新建提交
newDoc() {
this.$refs['newDoc'].validate((valid) => {
if (valid) {
this.addDialog = false
console.log('this.newForm', this.newForm)
this.submit([{ ...this.newForm }])
}
})
},
// 新建关闭
handleClose() {
this.newDialog = false
this.newForm = {}
},
submit(lists) {
// this.tableData = this.$utils.addObject2Links(lists, this.tableData)
lists.forEach(row => {
const _link = this.tableData.find(r => r.number === row.number)
console.log('_link', _link)
const _idx = this.tableData.findIndex(r => r.number === row.number)
console.log('_idx', _idx)
if (_link) {
if (_link.id) {
_link.operator = 'NO_CHANGE'
} else {
_link.docName = row.name
_link.operator = 'ADD'
}
this.$set(this.tableData, _idx, _link)
return false
}
const link = {
operator: 'ADD',
docName: row.name,
secret: row.secretCode || '',
docNumber: row.number
}
if (row.id) {
link.targetId = row.id
link.targetIdType = 'DxDocument'
link.target = row
}
this.tableData.push(link)
console.log('this.tableData', this.tableData)
})
this.newDialog = false
this.addDialog = false
this.update()
},
init() {
initTableData(this)
},
remove() {
// const selection = this.$refs['table'].selectedData
if (this.selection.length === 0) {
this.$utils.showMessageWarning('请选择要删除的项')
return
}
this.selection.forEach(row => {
const _link = this.tableData.find(r => r.docNumber === row.docNumber)
const _idx = this.tableData.findIndex(r => r.docNumber === row.docNumber)
if (_link) {
_link.operator = 'REMOVE'
this.$set(this.tableData, _idx, _link)
return false
}
})
this.tableData = this.tableData.filter(link => !(link.operator === 'REMOVE' && !link.id))
this.update()
},
update() {
updateTableData(this)
},
paginationCurrentChange(val) {
this.pagination.currentPage = val
// this.update()
},
handleSizeChange(val) {
this.pagination.pageSize = val
// this.update()
},
jump(data) {
console.log('data', data)
}
}
}
</script>
<style lang="scss">
/* @import url(); 引入css类 */
</style>
export function updateTableData(obj, table = 'tableData', type = 'input') {
obj[table].forEach(row => {
if (row.$row) {
delete row.$row
}
if (typeof row.permissions !== undefined) {
delete row.permissions
}
})
obj.$emit(type, obj[table].map(r => { return { ...r } }))
}
export function initTableData(obj, table = 'tableData', value = 'value') {
obj[table] = obj[value].map(r => { return { ...r } })
}
import { post } from '@/utils/http'
// 查询所有用户列表
export function getAllUsers(params) {
return post('/User/search', params)
}
<template>
<div class="dee-model">
<el-select
v-if="informativeUser"
v-model="cloneValue"
:disabled="disabled"
:read-only="readOnly"
:size="size"
:multiple="multiple"
placeholder="请选择"
>
<el-option
v-for="item in userListOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
<DxUserSelect
v-else
:user="user"
:value="value"
:disabled="disabled"
:read-only="readOnly"
:is-remote="isRemote"
:size="size"
:input-attr="inputAttr"
:async-attr="asyncAttr"
:form="form"
:multiple="multiple"
@input="(val)=>{update(val)}"
/>
</div>
</template>
<script>
import { getAllUsers } from '@/api/user'
export default {
name: 'DistributeReceiveUser',
componentName: '人员选择',
props: {
user: {
type: [Number, String, Object],
default: ''
},
value: {
type: [Number, String, Object, Array],
default: ''
},
disabled: {
type: Boolean,
default: false
},
readOnly: {
type: Boolean,
default: false
},
isRemote: {
type: Boolean,
default: true
},
size: {
type: String,
default: () => ''
},
inputAttr: {
type: String,
default: () => ''
},
// eslint-disable-next-line vue/require-default-prop
asyncAttr: {
type: Object,
defalut: () => {}
},
// eslint-disable-next-line vue/require-default-prop
form: {
type: Object,
defalut: () => {}
},
multiple: {
type: Boolean,
default: false
},
basicData: {
type: Object,
default: () => {}
}
},
data() {
return {
userListOptions: [],
cloneValue: ''
}
},
computed: {
informativeUser() {
return this.form && this.form.informativeUser
}
},
watch: {
cloneValue() {
this.update(this.cloneValue)
},
informativeUser: {
immediate: true,
deep: true,
handler: function(val) {
val && this.initOptions()
}
}
},
// 生命周期 - 创建完成(访问当前this实例)
created() {},
// 生命周期 - 挂载完成(访问DOM元素)
mounted() {
console.log('basicData', this.basicData)
this.cloneValue = this.value
},
methods: {
initOptions() {
this.getAllUsers()
},
getAllUsers() {
const params = {
'pageFrom': 1,
'searchItems': {
'items': [
{
'fieldName': 'id',
'operator': 'IN',
'value': this.informativeUser
}
],
'operator': 'AND'
},
'pageSize': 9999
}
getAllUsers(params).then(res => {
if (res.items && res.items.content) {
this.userListOptions = res.items.content.map(n => {
return {
label: `${n.userName}(${n.userAccount})`,
value: n.id,
data: n
}
})
} else {
this.userListOptions = []
}
})
},
update(val) {
this.$emit('input', val)
}
}
}
</script>
<style lang="scss">
/* @import url(); 引入css类 */
</style>
<template>
<div class="dee-model foreign-unit-mode">
<div v-show="editState||value"><span>{{ value }}</span>
<el-button type="text" @click="showDialogFlag=true">{{ editState?'设置':'查看' }}</el-button>
</div>
<dee-dialog
:dialog-visible="showDialogFlag"
:title="editState?'外单位选择':'外单位查看'"
width="800px"
class="foreign-unit-dialog"
:dialog-bttons="editState?dialogBttons:[]"
@on-submit="submit"
@on-cancel="showDialogFlag=false"
@handleClose="showDialogFlag=false"
>
<div v-for="(units,index) in unitLists" :key="index" class="rows">
<div class="sub-title">
{{ units.title }}
</div>
<div class="checkbox">
<el-checkbox
v-for="(unit) in units.children"
:key="unit.key"
:checked="unit.checked"
:disabled="unit.disabled"
@change="(val)=>{unit.checked = val}"
>{{ unit.title }}</el-checkbox>
</div>
</div>
</dee-dialog>
</div>
</template>
<script>
export default {
name: 'InternalUnit',
componentName: '外单位选择或查看',
props: {
disabled: {
type: Boolean,
default: false
},
readOnly: {
type: Boolean,
default: false
},
value: {
type: [String, Object],
default: () => ''
}
},
data() {
return {
dictOptions: [],
dialogBttons: [{
type: 'submit',
text: '提交',
component: {
type: 'primary'
}
}, {
type: 'cancel',
text: '取消',
component: {}
}],
showDialogFlag: false,
checkedValue: []
}
},
computed: {
editState() {
return !this.disabled && !this.readOnly
},
serviceApi() {
return this.$getService('DictData', { versionControl: false }).baseQuery().orderByDesc('modifyTime')
},
unitLists() {
if (!this.dictOptions || this.dictOptions.length === 0) { return [] }
return this.setChecked(this.dictOptions, this.value)
}
},
watch: {},
// 生命周期 - 创建完成(访问当前this实例)
created() {},
// 生命周期 - 挂载完成(访问DOM元素)
mounted() {
this.init()
},
methods: {
init() {
this.serviceApi
.page(1, 1000)
.search({
data: {
items: [{
fieldName: 'dictCode',
operator: 'EQ',
value: 'ExternalParties'
}, {
fieldName: 'dictState',
operator: 'EQ',
value: 'ENABLE'
}],
operator: 'AND'
}
}).then(res => {
this.dictOptions = res.content
})
},
submit() {
const checked = []
this.unitLists.forEach(items => {
if (items.children && items.children.length) {
items.children.forEach(unit => {
if (unit.checked) {
checked.push(unit.title)
}
})
}
})
this.$emit('input', checked.join())
this.showDialogFlag = false
},
setChecked(options, checkedStr) {
const checked = checkedStr ? checkedStr.split(',') : []
// 数据洗澡
const list = options.map(r => {
return {
title: r.dictValue,
key: r.dictKey,
parentKey: r.parentKey,
disabled: !this.editState,
checked: checked.includes(r.dictValue)
}
})
// 分类
const parent = list.filter(r => !r.parentKey)
parent.forEach(item => {
item.children = list.filter(r => r.parentKey === item.key)
})
return parent
}
}
}
</script>
<style lang="scss">
/* @import url(); 引入css类 */
.foreign-unit-dialog{
.rows{
margin-bottom: 20px;
}
.title-bar{
margin-bottom: 6px;
font-weight: 700;
&:before{
content: "";
width: 4px;
height: 13px;
-ms-flex-item-align: center;
align-self: center;
margin-right: 12px;
}
}
}
</style>
<template>
<div class="project-list">
项目列表
<dee-tools :tools="BtnTools" mode="normal" :collapse="false" :permissions="permissions" :perm-enable="true" />
<el-table
:data="tableData"
style="width: 100%; margin-bottom: 20px"
row-key="id"
border
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" />
<el-table-column prop="perIndex" label="序号" sortable />
<el-table-column label="操作">
<template #default="scope">
<el-button size="small" @click="handleEdit(scope.$index, scope.row)">
编辑
</el-button>
<img class="self-btn-icon" src="/icons/c-edit.png">
<el-button
size="small"
type="danger"
@click="handleStatusDLG(scope.$index, scope.row)"
>
改状态
</el-button>
</template>
</el-table-column>
<el-table-column prop="date" label="项目名称" show-overflow-tooltip />
<el-table-column prop="name" label="项目分类" show-overflow-tooltip />
<el-table-column prop="address" label="项目代号" show-overflow-tooltip />
<el-table-column prop="address" label="项目类型" show-overflow-tooltip />
<el-table-column prop="address" label="状态" />
<el-table-column prop="address" label="密级" />
</el-table>
<dee-dialog title="修改状态" :dialog-visible="dialogVisible" width="55%" @handleClose="dialogClose" />
</div>
</template>
<script>
export default {
name: 'ProjectList',
componentName: '项目列表',
data() {
const that = this
return {
BtnTools: [
{
name: '新增',
icon: '/icons/c-add.png',
key: 'add',
handler: {
click: () => {
// this.dialogTitle = '新增资源属性'
// this.dialogVisible = true
}
}
},
{
name: '移除',
icon: '/icons/c-remove.png',
key: 'remove',
handler: {
click: () => {
// this.dialogTitle = '新增资源属性'
// this.dialogVisible = true
this.remove()
}
}
}
],
tableData: [],
tableColums: [
{
title: '操作',
key: 'operate',
show: true,
name: 'EditTableRow',
props: {
btns: [
{
operation: '改状态',
handleClick: (row, index) => {
},
icon: '/icons/c-edit.png',
showFun: (row) => {
}
},
{
operation: '编辑',
handleClick: (row, index) => {
},
icon: '/icons/c-edit.png',
showFun: (row) => {
}
}
]
}
},
{
title: '项目名称',
key: 'name',
component: {
render: function(h, data) {
return <span class='link' v-on:click={() => {
that.jump(data)
}}>{data.name}</span>
}
}
},
{
title: '项目分类',
key: ''
},
{
title: '项目代号',
key: ''
},
{
title: '项目类型',
key: ''
},
{
title: '状态',
key: ''
},
{
title: '密级',
key: ''
}
],
optionsTree: {
fit: true,
// defaultExpandAll: true,
highlightCurrentRow: true,
rowKey: 'id'
},
selectedData: []
}
},
methods: {
jump(data) {
this.$router.push({
path: `/page/${data.pageNumber}/${data.id}/?id=${data.id}&title=${data.name}`,
query: { title: data.name + '详情', id: data.id }
})
},
handleSelectionChange(val) {
this.selectedData = val
},
remove() {
if (this.sectionData.length === 0) {
this.$message.error('请至少选择一条数据')
} else {
this.$confirm('确定要删除选中的数据吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// const caRecordLinks = []
// this.sectionData.forEach(v => {
// caRecordLinks.push({
// operator: 'REMOVE',
// id: v.id,
// target: {
// id: v.target.id,
// operator: 'REMOVE'
// }
// })
// })
// const params = {
// id: this.basicData.businessObject.id,
// operator: 'NO_CHANGE',
// caRecordLinks: caRecordLinks
// }
// batchCAData(params).then(del => {
// this.tableData = this.tableData.filter(t => {
// return !caRecordLinks.some(s => {
// return t.id === s.id
// })
// })
// const pageSize = this.pagination.pageSize
// this.pagination.total = this.tableData.length
// let maxPage = parseInt(this.pagination.total / pageSize)
// const mode = this.pagination.total % pageSize
// if (mode) {
// maxPage++
// }
// if (maxPage < this.pagination.currentPage) {
// this.pagination.currentPage = maxPage
// }
// this.$message.success('删除成功')
// }).catch(() => {
// this.$message.error('删除失败')
// })
}
).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
}
</script>
<style lang="scss" scoped>
.link{
color: #2A75CE;
cursor: pointer;
}
</style>
<template>
<div class="project-list">
项目列表
<dee-table
ref="projectTable"
:data="tableData"
:columns="tableColums"
:options="optionsTree"
selection-row
@selection-change="selectionChange"
>
<dee-tools slot="header" :tools="BtnTools" mode="normal" :collapse="false" :permissions="permissions" :perm-enable="true" />
</dee-table>
<dee-dialog title="修改状态" :dialog-visible="dialogVisible" width="55%" @handleClose="dialogClose" />
</div>
</template>
<script>
export default {
name: 'ProjectList',
componentName: '项目列表',
data() {
const that = this
return {
BtnTools: [
{
name: '新增',
icon: '/icons/c-add.png',
key: 'add',
handler: {
click: () => {
// this.dialogTitle = '新增资源属性'
// this.dialogVisible = true
}
}
},
{
name: '移除',
icon: '/icons/c-remove.png',
key: 'remove',
handler: {
click: () => {
// this.dialogTitle = '新增资源属性'
// this.dialogVisible = true
this.remove()
}
}
}
],
tableData: [],
tableColums: [
{
title: '序号',
key: 'perIndex'
},
{
title: '操作',
key: 'operate',
show: true,
name: 'EditTableRow',
props: {
btns: [
{
operation: '改状态',
handleClick: (row, index) => {
},
icon: '/icons/c-edit.png',
showFun: (row) => {
}
},
{
operation: '编辑',
handleClick: (row, index) => {
},
icon: '/icons/c-edit.png',
showFun: (row) => {
}
}
]
}
},
{
title: '项目名称',
key: 'name',
component: {
render: function(h, data) {
return <span class='link' v-on:click={() => {
that.jump(data)
}}>{data.name}</span>
}
}
},
{
title: '项目分类',
key: ''
},
{
title: '项目代号',
key: ''
},
{
title: '项目类型',
key: ''
},
{
title: '状态',
key: ''
},
{
title: '密级',
key: ''
}
],
optionsTree: {
fit: true,
// defaultExpandAll: true,
highlightCurrentRow: true,
rowKey: 'id'
},
selectedData: []
}
},
methods: {
jump(data) {
this.$router.push({
path: `/page/${data.pageNumber}/${data.id}/?id=${data.id}&title=${data.name}`,
query: { title: data.name + '详情', id: data.id }
})
},
selectionChange(val) {
this.selectedData = val
},
remove() {
if (this.sectionData.length === 0) {
this.$message.error('请至少选择一条数据')
} else {
this.$confirm('确定要删除选中的数据吗?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
// const caRecordLinks = []
// this.sectionData.forEach(v => {
// caRecordLinks.push({
// operator: 'REMOVE',
// id: v.id,
// target: {
// id: v.target.id,
// operator: 'REMOVE'
// }
// })
// })
// const params = {
// id: this.basicData.businessObject.id,
// operator: 'NO_CHANGE',
// caRecordLinks: caRecordLinks
// }
// batchCAData(params).then(del => {
// this.tableData = this.tableData.filter(t => {
// return !caRecordLinks.some(s => {
// return t.id === s.id
// })
// })
// const pageSize = this.pagination.pageSize
// this.pagination.total = this.tableData.length
// let maxPage = parseInt(this.pagination.total / pageSize)
// const mode = this.pagination.total % pageSize
// if (mode) {
// maxPage++
// }
// if (maxPage < this.pagination.currentPage) {
// this.pagination.currentPage = maxPage
// }
// this.$message.success('删除成功')
// }).catch(() => {
// this.$message.error('删除失败')
// })
}
).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
})
})
}
}
}
}
</script>
<style lang="scss" scoped>
.link{
color: #2A75CE;
cursor: pointer;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment