拆分详情新增

This commit is contained in:
caoyang
2022-03-29 15:16:04 +08:00
parent 3052d6e317
commit 19b9ce86f6
7 changed files with 719 additions and 317 deletions
+3
View File
@@ -555,4 +555,7 @@ module.exports = {
deleteNode:'delete node',
ImplementationDate:'Implementation Date',
vehicleInProductionDate:'vehicle in Production Date',
deleteNodes:'If there are child nodes under this node, they will be deleted synchronously. Are you sure to delete this data?',
leastTwo: 'please select at least two pieces of data',
vehicleInProductionDate:'vehicle in Production Date',
}
+4
View File
@@ -559,4 +559,8 @@ module.exports = {
deleteNode:'删除节点',
ImplementationDate:'新车型实施日期',
vehicleInProductionDate:'在产车实施日期',
vehicleInProductionDate:'在产车实施日期',
deleteNodes:'该节点下若有子节点将同步删除确认删除该条数据',
leastTwo:'请选择至少两条数据',
}
@@ -0,0 +1,267 @@
<template>
<div style="height: 100%">
<div class="box">
<a-table
class="table"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="false"
:scroll="{x: 600}"
:data-source="dataSource"
:loading="loading"
:columns="columns"
@change="tableOnChange"
>
<span slot="showContent" slot-scope="text, record">
<a class="content-show" href="javascript:;" :title="record.iterms_conditions" @click="showContent">{{record.iterms_conditions}}</a>
</span>
<span slot="operation" slot-scope="record">
<a v-for="(ol,index) in OperationList"
@click="OperationClick(ol,record)">
<span class="text">
{{ol.text}}
</span>
</a>
</span>
</a-table>
</div>
<div class="page" v-if="dataSource.length > 0">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
@change="onChange"
@showSizeChange="SizeChange"
/>
</div>
</div>
</template>
<script>
import eventBUs from '../../common/event'
import { getAction, postAction } from '@/api/manage'
export default {
name: 'SplitDetailTable',
props: {
//接口
url: {
type: Object,
default: {}
},
// 操作按钮
OperationList: {
type: Array,
default: []
},
flag: {
type: String,
default: ''
},
//是否显示操作;默认不显示
showAction: {
type: Boolean,
default: false
},
infoId: {
type:String,
default:''
},
menuId:{
type:String,
default:''
}
},
data() {
return {
jsonBody: [],
checkboxList: [],
tableAll: false,
indeterminate: false,
columns: [],
selectedRowKeys: [],
dataSource: [],
pageNo: 1,
pageSize: 10,
total: 0,
searchParmes: {},
loading: false,
orderBy: '1',
orderByField: ''
}
},
mounted() {
eventBUs.$on('searchQuery', search => {
Object.keys(search).forEach(res => {
if (search[res] instanceof Array) {
search[res] = search[res].join(',')
}
})
this.searchParmes = search
this.getData()
this.getTableList()
})
eventBUs.$on('searchReset', target => {
this.searchParmes = {}
this.selectedRowKeys = []
this.getData()
this.getTableList()
})
this.getData()
this.getTableList()
},
methods: {
getTextWith(text, fontStyle) {
var canvas = document.createElement('canvas')
var context = canvas.getContext('2d')
context.font = fontStyle || '14px' // 设置字体样式
var dimension = context.measureText(text)
return dimension.width + 40
},
getData() {
let params = {
flag: this.flag
}
getAction(this.url.tableHeader, params).then((res) => {
if (res.success) {
var jsonHead = res.result
this.columns = []
// res.db_field_txt
jsonHead.forEach((res, index) => {
this.columns.push({
title: res.db_field_txt,
dataIndex: res.db_field_name,
align: 'center',
ellipsis: true,
sorter: res.sort
})
if(res.db_field_name=='iterms_conditions'){
this.columns[index].width='35%'
}
if (res.click) {
this.columns[index].scopedSlots = {
customRender: 'showContent'
}
} else {
this.columns[index].scopedSlots = {
customRender: 'detailText'
}
}
})
// console.log('columns',this.columns)
let width = 0
if (this.OperationList.length > 0) {
for (let i = 0; i < this.OperationList.length; i++) {
width += this.getTextWith(this.OperationList[i].text)
}
}
if (this.showAction) {
this.columns.push({
title: this.$t('operation'),
align: 'center',
fixed: 'right',
width: width,
scopedSlots: { customRender: 'operation' }
})
}
}
})
},
tableOnChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
this.orderByField = sorter.columnKey
this.getTableList()
},
getTableList() {
let pageNo = JSON.parse(JSON.stringify(this.pageNo))
let pageSize = JSON.parse(JSON.stringify(this.pageSize))
let params = {
...this.searchParmes,
// orderBy: this.orderBy,
// orderByField: this.orderByField,
info_id:this.infoId,
menu_id:this.menuId,
pageNo: pageNo + '',
pageSize: pageSize + ''
}
// console.log('parmsss',params)
this.loading = true
postAction(this.url.tableList, params).then((res) => {
if (res.success) {
if (res.result.current > 1 && res.result.records.length == 0) {
this.pageNo = res.result.current - 1
this.getTableList()
return
}
this.dataSource = res.result.records
this.total = res.result.total
this.loading = false
} else {
this.loading = false
}
})
},
onChange(page, pageSize) {
this.pageNo = page
this.getTableList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getTableList()
},
onSelectChange(value) {
this.selectedRowKeys = value
this.$emit('onSelectChange', value)
},
OperationClick(ol, item) {
this.$emit(ol.ClickEvent, item)
},
detailClick(item, index) {
this.$emit('detailClick', item)
},
showContent(item, index) {
this.$emit('showContent', item)
}
}
}
</script>
<style>
.table .ant-table-column-title {
font-weight: bold;
}
.ant-table td {
white-space: nowrap;
}
</style>
<style lang="less" scoped>
.box {
width: 100%;
height: calc(100% - 100px);
overflow: auto;
.content-show{
width: 500px;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
height: 60px;
line-height: 20px;
white-space: pre-wrap;
}
}
.text {
margin-right: 10px;
}
.page {
text-align: right;
margin-top: 20px;
}
</style>
+16 -7
View File
@@ -13,12 +13,12 @@
@change="tableOnChange"
>
<span slot="operation" slot-scope="record">
<a v-for="(ol,index) in OperationList"
@click="OperationClick(ol,record)">
<span class="text">
{{ol.text}}
</span>
</a>
<a v-for="(ol,index) in OperationList"
@click="OperationClick(ol,record)">
<span class="text">
{{ol.text}}
</span>
</a>
</span>
</a-table>
</div>
@@ -61,6 +61,10 @@
showAction: {
type: Boolean,
default: false
},
infoId: {
type:String,
default:''
}
},
data() {
@@ -129,7 +133,7 @@
})
if (res.click) {
this.columns[index].scopedSlots = {
customRender: 'detailClick'
customRender: 'showContent'
}
} else {
this.columns[index].scopedSlots = {
@@ -167,9 +171,11 @@
...this.searchParmes,
orderBy: this.orderBy,
orderByField: this.orderByField,
infoId:this.infoId,
pageNo: pageNo + '',
pageSize: pageSize + ''
}
console.log('parmsss',params)
this.loading = true
getAction(this.url.tableList, params).then((res) => {
if (res.success) {
@@ -204,6 +210,9 @@
},
detailClick(item, index) {
this.$emit('detailClick', item)
},
showContent(item, index) {
this.$emit('showContent', item)
}
}
}
@@ -376,5 +376,8 @@
display: flex;
}
}
.ant-col-sm-8{
min-width: 300px;
}
}
</style>
@@ -10,300 +10,302 @@
@close="onClose"
width="900"
>
<a-form>
<a-form-model
class="split-content"
:model="form"
:rules="rules"
ref="splitEditForm"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-row :gutter="24">
<div v-for="(item,index) in dataList" :key="index">
<a-spin :spinning="loading">
<a-form>
<a-form-model
class="split-content"
:model="formInline"
:rules="rules"
ref="splitEditForm"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-row :gutter="24">
<div v-for="(item,index) in dataList" :key="index">
<a-col :span="12" v-if="item.field_show_type === '1' || item.field_show_type === '11'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
<a-col :span="12" v-if="item.field_show_type === '1' || item.field_show_type === '11'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-input class="box-input"
:disabled="disabled"
v-model="formInline[item.db_field_name]"
:placeholder="$t('PleaseEnter')+item.db_field_txt"/>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-input class="box-input"
:disabled="disabled"
v-model="formInline[item.db_field_name]"
:placeholder="$t('PleaseEnter')+item.db_field_txt"/>
</a-form-model-item>
</div>
</a-col>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === '2'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
<a-col :span="12" v-else-if="item.field_show_type === '2'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-input-number class="box-input"
:placeholder="$t('PleaseEnter')+item.db_field_txt"
:disabled="disabled"
v-model="formInline[item.db_field_name]" :min="1" :max="99999999"/>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-input-number class="box-input"
:placeholder="$t('PleaseEnter')+item.db_field_txt"
:disabled="disabled"
v-model="formInline[item.db_field_name]" :min="1" :max="99999999"/>
</a-form-model-item>
</div>
</a-col>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === '3'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
<a-col :span="12" v-else-if="item.field_show_type === '3'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-dict-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
@input="handleInput(item.db_field_name)"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
:type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-dict-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
@input="handleInput(item.db_field_name)"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
:type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
</a-col>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === '4'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
<a-col :span="12" v-else-if="item.field_show_type === '4'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
:type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
:type="'select'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === '5'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === '5'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-date-picker class="box-input"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
@change="dateChange(item)"
format="YYYY-MM-DD"
v-model="formInline[item.db_field_name]"
:disabled="disabled"
style="width: 100%"/>
<!-- :disabledDate="disabledDate"-->
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-date-picker class="box-input"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
@change="dateChange(item)"
format="YYYY-MM-DD"
v-model="formInline[item.db_field_name]"
:disabled="disabled"
style="width: 100%"/>
<!-- :disabledDate="disabledDate"-->
</a-form-model-item>
</div>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === '6'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === '6'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-range-picker class="box-input" v-model="formInline[item.db_field_name]"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
:disabled="disabled"
@change="onChange(item.db_field_name)"></a-range-picker>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-range-picker class="box-input" v-model="formInline[item.db_field_name]"
:placeholder="$t('PleaseSelect')+item.db_field_txt"
:disabled="disabled"
@change="onChange(item.db_field_name)"></a-range-picker>
</a-form-model-item>
</div>
</a-col>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === '7'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
<a-col :span="12" v-else-if="item.field_show_type === '7'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-button type="primary" class="button-text"
@click="clickButtonToUpload(item)">
{{ (formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' ||
formInline[item.db_field_name] == null) ? $t('clickUpload') : $t('viewUploadedFiles')
}}
</a-button>
<!-- <span class="button-text-text" v-if="formInline[item.db_field_name]">-->
<!-- {{formInline[item.db_field_name].split(',').length}}-->
<!-- </span>-->
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-button type="primary" class="button-text"
@click="clickButtonToUpload(item)">
{{ (formInline[item.db_field_name] === 'null' || formInline[item.db_field_name] === '' ||
formInline[item.db_field_name] == null) ? $t('clickUpload') : $t('viewUploadedFiles')
}}
</a-button>
<!-- <span class="button-text-text" v-if="formInline[item.db_field_name]">-->
<!-- {{formInline[item.db_field_name].split(',').length}}-->
<!-- </span>-->
</a-form-model-item>
</div>
</a-col>
</a-col>
<a-col :span="24" v-else-if="item.field_show_type === '8'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
<a-col :span="24" v-else-if="item.field_show_type === '8'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-textarea
:placeholder="$t('PleaseEnter')+item.db_field_txt"
:disabled="disabled"
v-model="formInline[item.db_field_name]" :rows="4"/>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-textarea
:placeholder="$t('PleaseEnter')+item.db_field_txt"
:disabled="disabled"
v-model="formInline[item.db_field_name]" :rows="4"/>
</a-form-model-item>
</div>
</a-col>
</a-col>
<a-col :span="24" v-else-if="item.field_show_type === '9' || item.field_show_type == 'sel_user'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
<a-col :span="24" v-else-if="item.field_show_type === '9' || item.field_show_type == 'sel_user'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<PersonnelSelection :query="item"
:personneQuery="formInline"
@change="PersonnelSelectionChange"
:disabled="disabled"
v-model="formInline[item.db_field_name]"/>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<PersonnelSelection :query="item"
:personneQuery="formInline"
@change="PersonnelSelectionChange"
:disabled="disabled"
v-model="formInline[item.db_field_name]"/>
</a-form-model-item>
</div>
</a-col>
</a-col>
<a-col :span="24" v-else-if="item.field_show_type === '10'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
<a-col :span="24" v-else-if="item.field_show_type === '10'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<Standardselection :query="item"
@change="StandardselectionChange"
:disabled="disabled"
:standard="formInline"
v-model="formInline[item.db_field_name]"/>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<Standardselection :query="item"
@change="StandardselectionChange"
:disabled="disabled"
:standard="formInline"
v-model="formInline[item.db_field_name]"/>
</a-form-model-item>
</div>
</a-col>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === 'RADIO'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
<a-col :span="12" v-else-if="item.field_show_type === 'RADIO'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-dict-select-tag v-model="formInline[item.db_field_name]"
:disabled="disabled"
@input="handleInput(item.db_field_name)"
:placeholder="$t('selectStatus')"
:type="'radio'" :triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-dict-select-tag v-model="formInline[item.db_field_name]"
:disabled="disabled"
@input="handleInput(item.db_field_name)"
:placeholder="$t('selectStatus')"
:type="'radio'" :triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
</a-col>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === '0'">
<div class="box-title-text" :title="item.db_field_txt">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text">{{item.db_field_txt}}</span>
<a-col :span="12" v-else-if="item.field_show_type === '0'">
<div class="box-title-text" :title="item.db_field_txt">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-tree-select
v-model="formInline[item.db_field_name]"
:maxTagCount="1"
style="width: 100%"
:tree-data="item.tree"
tree-checkable
:placeholder="$t('PleaseSelect')+item.db_field_txt"
/>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<a-tree-select
v-model="formInline[item.db_field_name]"
:maxTagCount="1"
style="width: 100%"
:tree-data="item.tree"
tree-checkable
:placeholder="$t('PleaseSelect')+item.db_field_txt"
/>
</a-form-model-item>
</div>
</a-col>
</a-col>
<a-col :span="12" v-else-if="item.field_show_type === 'CHECKBOX'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
<a-col :span="12" v-else-if="item.field_show_type === 'CHECKBOX'">
<div class="box-title-text">
<div class="title-text">
<span class="Required" v-if="item.field_must_input == 1">*</span>
<span class="title-text-text" :title="item.db_field_txt">{{item.db_field_txt}}</span>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('selectStatus')" :type="'checkbox'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
<a-form-model-item class="itemModel" :prop="item.db_field_name">
<j-multi-select-tag class="box-input" v-model="formInline[item.db_field_name]"
:disabled="disabled"
:placeholder="$t('selectStatus')" :type="'checkbox'"
:triggerChange="false" :dictCode="item.dict_field"/>
</a-form-model-item>
</div>
</a-col>
</a-col>
</div>
</a-row>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFile>
<!-- 条款号-->
<!-- <a-row :gutter="24">-->
<!-- <a-col :span="12">-->
<!-- <a-form-model-item :label="$t('clauseNo')" prop="number">-->
<!-- <a-input v-model="form.number" :placeholder="$t('pleaseEnter')+$t('clauseNo')" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!--&lt;!&ndash; 条款名称&ndash;&gt;-->
<!-- <a-col :span="12">-->
<!-- <a-form-model-item :label="$t('clauseName')" prop="name">-->
<!-- <a-input v-model="form.name" :placeholder="$t('pleaseEnter')+$t('clauseName')" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!--&lt;!&ndash; 功能领域&ndash;&gt;-->
<!-- <a-row :gutter="24">-->
<!-- <a-col :span="12">-->
<!-- <a-form-model-item :label="$t('functionalAreas')" prop="funArea">-->
<!-- <j-dict-select-tag type="list" v-model="form.funArea" dictCode="function_territory" :placeholder="$t('pleaseSelect')+$t('functionalAreas')" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!--&lt;!&ndash; 技术领域&ndash;&gt;-->
<!-- <a-col :span="12">-->
<!-- <a-form-model-item :label="$t('technicalField')" prop="tecArea">-->
<!-- <j-dict-select-tag type="list" v-model="form.tecArea" dictCode="technology_territory" :placeholder="$t('pleaseSelect')+$t('technicalField')" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!--&lt;!&ndash; 信息类别&ndash;&gt;-->
<!-- <a-row :gutter="24">-->
<!-- <a-col :span="12">-->
<!-- <a-form-model-item :label="$t('informationCategory')" prop="infoType">-->
<!-- <j-dict-select-tag type="list" v-model="form.infoType" dictCode="xxx" :placeholder="$t('pleaseSelect')+$t('informationCategory')" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!-- 内容简介-->
<span class="con-divider">{{$t('contentValidity')}}</span>
<a-divider dashed />
<div class="table-operator">
<div class="operator-text" @click="splitAdd('-1')">
<a-icon type="plus" />
{{$t('Add')}}
</div>
</div>
<a-row :gutter="24" class="split-content" id="split-content" v-for="(item, index) in contentList" :key="index">
<div class="split-row">
<div class="row-left">
<a-textarea v-if="item.type==='TEXT'" v-model="item.itemContent" :placeholder="$t('pleaseEnter')+$t('content')" auto-size />
<img v-if="item.type==='IMG'" :src="item.itemContent" alt="" @click="preImg(item)">
<div v-if="item.type==='TABLE'" v-html="item.content" class="item-table"></div>
</div>
<div class="row-right">
<a-button class="row-btn-add" @click="splitAdd(index)">{{$t('Add')}}</a-button>
<a-button @click="splitDelete">{{$t('delete')}}</a-button>
</div>
</a-row>
<uploadFile ref="uploadFile" @uploadSuccess="uploadSuccess"></uploadFile>
<!-- 条款号-->
<!-- <a-row :gutter="24">-->
<!-- <a-col :span="12">-->
<!-- <a-form-model-item :label="$t('clauseNo')" prop="number">-->
<!-- <a-input v-model="form.number" :placeholder="$t('pleaseEnter')+$t('clauseNo')" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!--&lt;!&ndash; 条款名称&ndash;&gt;-->
<!-- <a-col :span="12">-->
<!-- <a-form-model-item :label="$t('clauseName')" prop="name">-->
<!-- <a-input v-model="form.name" :placeholder="$t('pleaseEnter')+$t('clauseName')" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!--&lt;!&ndash; 功能领域&ndash;&gt;-->
<!-- <a-row :gutter="24">-->
<!-- <a-col :span="12">-->
<!-- <a-form-model-item :label="$t('functionalAreas')" prop="funArea">-->
<!-- <j-dict-select-tag type="list" v-model="form.funArea" dictCode="function_territory" :placeholder="$t('pleaseSelect')+$t('functionalAreas')" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!--&lt;!&ndash; 技术领域&ndash;&gt;-->
<!-- <a-col :span="12">-->
<!-- <a-form-model-item :label="$t('technicalField')" prop="tecArea">-->
<!-- <j-dict-select-tag type="list" v-model="form.tecArea" dictCode="technology_territory" :placeholder="$t('pleaseSelect')+$t('technicalField')" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!--&lt;!&ndash; 信息类别&ndash;&gt;-->
<!-- <a-row :gutter="24">-->
<!-- <a-col :span="12">-->
<!-- <a-form-model-item :label="$t('informationCategory')" prop="infoType">-->
<!-- <j-dict-select-tag type="list" v-model="form.infoType" dictCode="xxx" :placeholder="$t('pleaseSelect')+$t('informationCategory')" />-->
<!-- </a-form-model-item>-->
<!-- </a-col>-->
<!-- </a-row>-->
<!-- 内容简介-->
<span class="con-divider">{{$t('contentValidity')}}</span>
<a-divider dashed />
<div class="table-operator">
<div class="operator-text" @click="splitAdd('-1')">
<a-icon type="plus" />
{{$t('Add')}}
</div>
</div>
<a-row :gutter="24" class="split-content" id="split-content" v-for="(item, index) in contentList" :key="index">
<div class="split-row">
<div class="row-left">
<a-textarea v-if="item.type==='TEXT'" v-model="item.textContent" :placeholder="$t('pleaseEnter')+$t('content')" auto-size />
<img v-if="item.type==='IMG'" :src="item.src" alt="" @click="preImg(item)">
<div v-if="item.type==='TABLE'" v-html="item.content" class="item-table"></div>
</div>
<div class="row-right">
<a-button class="row-btn-add" @click="splitAdd(index)">{{$t('Add')}}</a-button>
<a-button @click="splitDelete">{{$t('delete')}}</a-button>
</div>
</div>
</a-row>
</a-form-model>
</a-form>
<div class="split-form-footer">
<a-button type="primary" class="footer-btn-save" @click="splitSave">{{$t('preservation')}}</a-button>
<a-button type="primary" @click="splitCancel">{{$t('cancel')}}</a-button>
</div>
</a-row>
</a-form-model>
</a-form>
<div class="split-form-footer">
<a-button type="primary" class="footer-btn-save" @click="splitSave">{{$t('preservation')}}</a-button>
<a-button type="primary" @click="splitCancel">{{$t('cancel')}}</a-button>
</div>
</a-spin>
<!-- 图片预览-->
<a-modal
:title="TitlePreImg"
@@ -383,7 +385,10 @@
import SplitUpload from '@/components/SplitUpload/index'
import UEditor from '@/components/ueditor/index'
import moment from 'moment'
import axios from 'axios'
import { getAction, postAction } from '@/api/manage'
import { ACCESS_TOKEN } from '@/store/mutation-types'
import eventBUs from '../../../../common/event'
// import eventBUs from '../../common/event'
export default {
name: 'splitAddForm',
@@ -400,18 +405,7 @@
titleColRow:this.$t('tableRowsColumns'),
title:this.$t('newClause'),
TitlePreImg:'',
contentList:[
{
id:'001',
type:'TEXT',
textContent:'本标准规定了车辆正面碰撞时前排外侧座椅乘员保护方面的术语和定义、要求和试验方法。'
},
{
id:'002',
type:'TEXT',
textContent:'本标准适用于M1类汽车和最大设计总质量不大于2500kg的N1类汽车,以及多用途货车。'
}
],
contentList:[],
content:{},
selected:1,
selectedNum:true,
@@ -545,7 +539,6 @@
rowCount:'', //行数
formInline: {},
isFormInline: false,
rules: {},
labelCol: {
xs: { span: 24 },
sm: { span: 6 }
@@ -560,6 +553,9 @@
confirmLoading: false,
uploadName: '',
type: 'add',
loading:false,
token:Vue.ls.get(ACCESS_TOKEN),
submitFlag:false,
}
},
props:{
@@ -579,6 +575,22 @@
type: String,
default: ''
},
infoId:{
type:String,
default:''
},
menuId:{
type:String,
default:''
},
itemId:{
type:String,
default:''
},
item:{
type:Object,
default:{}
}
},
watch:{
selected(val){
@@ -591,9 +603,23 @@
},
mounted() {
this.visible=this.addVisible
this.formInline=this.item
console.log('form',this.formInline,this.item)
this.loadData()
},
methods:{
loadData(){
this.loading=true
getAction(`split/sarFileSplitItemsVal/getItemsValList`,{itemId:this.itemId}).then(res=>{
if(res.success){
this.contentList=[...res.result]
console.log('res',res.result)
}
}).finally(()=>{
this.loading=false
})
},
afterVisibleChange(){
},
@@ -616,10 +642,70 @@
},
//保存
splitSave(){
console.log('formInline',this.formInline)
// console.log('formInline',this.formInline)
this.$refs.splitEditForm.validate(valid=>{
if(valid){
this.submitFlag=true
this.confirmLoading = true
if(this.submitFlag){
let url = ''
if (this.formInline.id) {
url = this.url.updateInfo
} else {
url = this.url.addInfo
}
let params = JSON.parse(JSON.stringify(this.formInline))
// console.log('item',this.item,JSON.stringify(this.item)=="{}")
if(JSON.stringify(this.item)=="{}"){
params.info_id=this.infoId
params.menu_id=this.menuId
}
// params.menuId=this.menuId
params.itemValEOList=this.contentList
// console.log('paramsformInline',params)
axios({
url: url,
method: 'post',
data: params,
headers: {
'X-Access-Token':this.token
}
})
.then( (res) =>{
if (res.data.success) {
this.confirmLoading = false
this.$message.success(this.$t('OperationSuccessful'))
this.visible=false
// this.$emit('closeVisible',false)
eventBUs.$emit('searchReset')
}else{
this.$message.warning(this.$t('operationFailed'))
}
})
.catch( (error) =>{
console.log(error);
}).finally(()=>{
this.confirmLoading=false
this.submitFlag=false
})
}
// postAction(url, params).then((res) => {
// if (res.success) {
// this.confirmLoading = false
// this.$message.success(this.$t('OperationSuccessful'))
// eventBUs.$emit('searchReset')
// this.$emit('addFormClick')
// } else {
// this.confirmLoading = false
// if (res.message.indexOf('发布日期不能大于') >= 0) {
// this.$message.warning(res.message)
// } else {
// this.$message.warning(this.$t('operationFailed'))
// }
// }
// })
}
})
},
@@ -638,9 +724,9 @@
}
for(let j=0;j<this.textNumber;j++){
this.contentList[++this.addIndex]={
id:'003',
id:'',
type:'TEXT',
textContent:''
itemContent:''
}
}
@@ -652,7 +738,7 @@
this.tableColVisible=true
}
// console.log('conteend',this.contentList)
console.log('conteend',this.contentList)
},
handleCancel(){
this.addConVisible=false
@@ -670,8 +756,9 @@
if(imgs && imgs.length > 0){
imgs.forEach(item => {
this.contentList[++this.addIndex]={
id:'',
type:'IMG',
src:item.thumbUrl
itemContent:item.thumbUrl
}
})
}
@@ -679,7 +766,7 @@
},
//点击图片预览
preImg(item){
this.itemSrc=item.src
this.itemSrc=item.itemContent
this.preImgVisible=true
},
//关闭预览图片
@@ -845,7 +932,7 @@
}
})
this.$set(this, 'rules', rules)
console.log(this.rules)
// console.log('rules',this.rules)
this.isFormInline = true
this.confirmLoading = false
},
@@ -105,10 +105,13 @@
:url="url"
:flag="'4'"
:OperationList="OperationList"
:infoId="infoId"
:menuId="menuId"
showAction
@onSelectChange="onSelectChange"
@deleteClick="deleteClick"
@editClick="editClick"
@showContent="showContent"
></table-data>
<!-- <a-table :data-source="tableData" :columns="columns" rowKey="id" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :pagination="false" :loading="loading" class="tag-con-table">-->
<!-- <template slot="clauseContent" slot-scope="text, record">-->
@@ -174,7 +177,7 @@
</a-form-model-item>
</a-form-model>
</a-modal>
<split-add-form ref="splitForm" v-if="addVisible" :addVisible="addVisible" :formTitle="formTitle" :flag="'4'" :url="url" @closeVisible="closeVisible"></split-add-form>
<split-add-form ref="splitForm" v-if="addVisible" :addVisible="addVisible" :formTitle="formTitle" :flag="'4'" :url="url" :infoId="infoId" :menuId="menuId" :itemId="itemId" :item="item" @closeVisible="closeVisible"></split-add-form>
<upload ref="uploadSplit" @uploadSuccess="uploadSuccess"></upload>
</div>
</a-card>
@@ -184,9 +187,10 @@
<script>
import { getAction, postAction, deleteAction, putAction, downloadFile } from '@/api/manage'
import search from '@/components/search/index'
import TableData from '@/components/SplitTable/index'
import TableData from '@/components/SplitDetailTable/index'
import upload from '@/components/uploadFile/file.vue'
import SplitAddForm from './SplitAddForm'
import eventBUs from '@/common/event'
export default {
name: 'SplitDetail',
components:{
@@ -317,6 +321,9 @@
],
},
infoId:'',
menuId:'',
itemId:'',
item:{},
// NodeTreeItemVisible:false,
flag:false, //提交按钮标识
isEdit:false,
@@ -333,9 +340,10 @@
url:{
tableHeader: 'language/switch/getHeader', //表格头部字段
seachList: 'language/switch/queryCondition', //搜索字段
// tableList: 'split/sarFileSplitInfo/page', //表格数据
tableList: 'split/sarFileSplitItems/getSplitItemsByPage', //表格数据
getAddForm: 'language/switch/getForm', // 表单的字段
// addInfo: 'ocr/OcrRestful/addOcrRecord', //新增
addInfo: '/jero-boot/split/sarFileSplitItems/addSplitItems', //新增
updateInfo:'/jero-boot/split/sarFileSplitItems/updateSplitItems', //编辑
},
}
},
@@ -343,6 +351,7 @@
this.infoId=this.$route.query.infoId
// console.log('info',this.$route.query)
this.loadMenuData()
this.loadData()
this.generateList(this.gData);
},
methods: {
@@ -480,7 +489,9 @@
},
//选择树节点
onSelect(selectedKeys){
console.log('sele',selectedKeys)
this.menuId=selectedKeys[0]
eventBUs.$emit('searchReset')
// console.log('sele',selectedKeys)
},
//树形新增
orgAdd(){
@@ -504,7 +515,7 @@
//树形删除
orgDelete(){
this.$confirm({
content: this.$t('areYouSure'),
content: this.$t('deleteNodes'),
onOk:
async () => {
getAction(`split/sarFileSplitMenu/deleteMenu`, { id: this.nodeItem.id }).then(res => {
@@ -528,7 +539,7 @@
expandId.push(this.form.pid)
if(!this.isEdit){
let params={
infoId: this.infoId,
info_id: this.infoId,
pid:this.nodeItem.id,
...this.form,
}
@@ -548,7 +559,7 @@
})
}else{
let params = {
infoId: this.infoId,
info_id: this.infoId,
...this.form,
}
this.flag=true
@@ -572,13 +583,13 @@
let params={
...this.queryParams
}
// this.loading=true
// getAction(``,params).then(res=>{
// if(res.success){
// this.tableData= [ ...res.result.records ]
// this.loading=false
// }
// })
this.loading=true
postAction(`split/sarFileSplitItems/getSplitItemsByPage`,params).then(res=>{
if(res.success){
this.tableData= [ ...res.result.records ]
this.loading=false
}
})
},
//搜索
searchQuery(){
@@ -617,11 +628,17 @@
},
//新增
handleAddManage(){
this.formTitle=this.$t('add')
this.addVisible=true
this.$nextTick(() => {
this.$refs.splitForm.add()
})
// console.log('this.menuId',this.menuId)
if(this.menuId){
this.formTitle=this.$t('add')
this.itemId=''
this.addVisible=true
this.$nextTick(() => {
this.$refs.splitForm.add()
})
}else{
this.$message.warning('请选择要添加条款的目录位置')
}
},
closeVisible(val){
this.addVisible=val
@@ -650,7 +667,11 @@
},
//合并条款
handleMergeManage(){
if(this.selectedRowKeys&&this.selectedRowKeys.length<1){
this.$message.warning(this.$t('leastTwo'))
}else{
}
},
//批量设置
handleManage(){
@@ -683,10 +704,13 @@
},
//编辑
editClick(val){
// console.log('val',val)
this.formTitle=this.$t('edit')
this.item=val
this.itemId=val.id
this.addVisible=true
this.$nextTick(() => {
this.$refs.splitForm.edit()
this.$refs.splitForm.edit(val)
})
},
//删除
@@ -906,5 +930,10 @@
display: flex;
}
}
.split-detail-search-header{
.ant-col-sm-8{
min-width: 300px;
}
}
}
</style>