Files
laws_weilai/jero-web/src/components/tableCollection/index.vue
T

1450 lines
50 KiB
Java

<template>
<div style="height: 100%">
<div class="box">
<!-- -->
<a-table
:components="drag(columns,'columns',JSON.parse(JSON.stringify(minWidthColumns)))"
class="table"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="false"
:scroll="this.dataSource.length > 1 ? {x: '100%',y:'calc(100vh - 330px)'} : {x: '100%'}"
:data-source="dataSource"
:loading="loading"
@change="tableOnChange"
sticky
:columns="columns"
:rowClassName="rowClassName"
@onHeaderRow="onHeaderRow"
>
<span slot="titleName" slot-scope="text,record" :title="text">
{{ text }}
</span>
<span slot="paramsName" slot-scope="text,record">
<span class="textName" :title="text">{{ text }}</span>
</span>
<div :slot="'titleName'+(index+1)" v-for="(item,index) in content">
<span v-if="item.isLock == 1" style="padding-right: 20px"><a-icon type="lock" theme="twoTone"
two-tone-color="#00B3BE"/></span>
<span style="padding-right: 10px">{{ item.db_field_txt }} </span>
<a-button @click="onClickSee(item)">{{ $t('See') }}</a-button>
</div>
<!-- {{ text && text.length > 8 ? text.slice(0, 7) + '...' : text }}-->
<span slot="ParameterDescription" slot-scope="text,record" :title="text">
<a-button @click="onClickTitle(record)">{{ $t('See') }}</a-button>
</span>
<!-- 历史记录-->
<template slot="Operation" slot-scope="text, record">
<a-button class="action-dict" @click="UpdateLog(record)">{{ $t('historicalrecord') }}</a-button>
</template>
<span slot="paramsNameDescription" slot-scope="text,record" :title="text">
{{ text && text.length > 8 ? text.slice(0, 7) + '...' : text }}
</span>
<span slot="operationbtn" slot-scope="record">
<span v-if='currentPersonRole === "homo"'>
<!-- 认证工程师 -->
<span
v-if='record.state == "待发起收集" || record.state == "工程接口人退回" || record.state == "变更" || record.state == "To be collected" || record.state == "Rejected by eng. interface" || record.state == "Modify"'>
<span
@click="areaOfResponsibility(record)">{{ (record.dataValue == null || record.dataValue == 'undefined') ? '--' : record.dataValue }}</span>
</span>
<span v-else>
<span
@click="dataValueTobeinitiated(record)">{{ (record.dataValue == null || record.dataValue == 'undefined') ? '--' : record.dataValue }}</span>
</span>
</span>
<span v-else>
<span
@click="dataValueTobeinitiated(record)">{{ (record.dataValue == null || record.dataValue == 'undefined') ? '--' : record.dataValue }}</span>
</span>
</span>
<span slot="operationzr" slot-scope="record">
<span v-if='currentPersonRole === "homo"'>
<!-- 责任领域 -->
<span
v-if='record.state == "待发起收集" || record.state == "工程接口人退回" || record.state == "To be collected" || record.state == "Rejected by eng. interface"'>
<span :title="record.dataValue"
@click="ondataValueTobe(record)">{{ (record.dataValue == null || record.dataValue == 'undefined' || record.dataValue == '') ? '--' : record.dataValue
}}</span>
</span>
<span v-else>
<span :title="record.dataValue"
@click="dataValueTobe(record)">{{ (record.dataValue == null || record.dataValue == 'undefined' || record.dataValue == '') ? '--' : record.dataValue
}}</span>
</span>
</span>
<span v-else>
<span :title="record.dataValue"
@click="dataValueTobe(record)">{{ (record.dataValue == null || record.dataValue == 'undefined' || record.dataValue == '') ? '--' : record.dataValue
}}</span>
</span>
</span>
<span slot="detailClick" slot-scope="text,record">
<collection-type :detailDate="text" :recordList="record" :columName="content"
:currentPersonRole="currentPersonRole"
@consolidateData="consolidateData"
@collectionForm="collectionForm"/>
</span>
</a-table>
</div>
<div class="page">
<div class="box-button-text" v-if="this.$route.query.version && this.$route.query.version != '1'">
<span>{{ $t('explain') + ': ' }}</span>
<span>{{ $t('parameterCollectionDescription') }}</span>
</div>
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
:current="pageNo"
:pageSizeOptions="pageSizeOptions"
@change="pageOnChange"
@showSizeChange="SizeChange"
/>
</div>
<!-- 修改工程接口人--->
<a-modal v-model="areaVisible" :title="$t('modifyprojectInterfacePerson')" width="620px" :footer="null"
@cancel="cancleImports">
<a-form-model
class="tag-module"
ref="ruleForm"
:model="Dateline"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-row :gutter="24">
<a-col :span="24">
<a-form-model-item ref="region" :label="$t('engineeringInterfacePerson')" prop="querySdt">
<a-select allowClear :placeholder="$t('PleaseSelect')+$t('engineeringInterfacePerson')"
v-model="Dateline.querySdt">
<a-select-option v-for="(item, key) in querySdtList" :key="key" :value="item.value">
<span style="display: inline-block;width: 100%" :title=" item.label ">
{{ item.label }}
</span>
</a-select-option>
</a-select>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
<div class="imports-footer">
<div class="imports-footer-wrap">
<a-button class="imports-btn imports-sub" type="primary" @click="handleSubmit">{{ $t('preservation') }}
</a-button>
<a-button class="imports-btn" type="primary" @click="cancleImports">{{ $t('cancel') }}</a-button>
</div>
</div>
</a-modal>
<!-- 修改责任领域--->
<a-modal v-model="areaVisiblezr" :title="$t('areaOfResponsibility')" width="620px" :footer="null"
@cancel="cancel">
<a-form-model
class="tag-module"
ref="ruleFormOne"
:model="Dateline"
:rules="rules"
:label-col="labelCol"
:wrapper-col="wrapperCol"
>
<a-row :gutter="24">
<a-col :span="24">
<a-form-model-item ref="region" :label="$t('areaOfResponsibility')" prop="queryzr">
<!-- <a-select allowClear :placeholder="$t('PleaseSelect')+$t('engineeringInterfacePerson')"-->
<!-- v-model="Dateline.querySdt">-->
<!-- <a-select-option v-for="(item, key) in querySdtList" :key="key" :value="item.value">-->
<!-- <span style="display: inline-block;width: 100%" :title=" item.label ">-->
<!-- {{ item.label }}-->
<!-- </span>-->
<!-- </a-select-option>-->
<!-- </a-select>-->
<j-dict-select-tag class="box-input" v-model="Dateline.queryzr"
@input="handleInput('queryzr')"
:placeholder="$t('PleaseSelect')+$t('areaOfResponsibility')"
:type="'select'"
:triggerChange="false" :dictCode="'duty_territory'"/>
</a-form-model-item>
</a-col>
</a-row>
</a-form-model>
<div class="imports-footer">
<div class="imports-footer-wrap">
<a-button class="imports-btn imports-sub" :loading="confirmLoading" type="primary" @click="handleSubmitzr">
{{ $t('preservation') }}
</a-button>
<a-button class="imports-btn" type="primary" @click="cancel">{{ $t('cancel') }}</a-button>
</div>
</div>
</a-modal>
<!-- 历史记录-->
<a-modal
:title="$t('historicalrecord')"
:width="900"
:visible="visible"
:confirm-loading="confirmLoading"
:maskClosable="false"
@ok="handleOk"
@cancel="handleCancel"
>
<historyTable :columnshistory="columnshistory" :dataSourcehistory="dataSourcehistory"></historyTable>
<!-- <a-table-->
<!-- class="table"-->
<!-- :columns="columnshistory"-->
<!-- :pagination="false"-->
<!-- :scroll="{y: 400}"-->
<!-- :data-source="dataSourcehistory"-->
<!-- :loading="loading"-->
<!-- >-->
<!-- <span slot="content" slot-scope="text,record">-->
<!-- <a-tooltip placement="topLeft">-->
<!-- <template slot="title">-->
<!-- <span v-html="text"></span>-->
<!-- </template>-->
<!-- <span v-html="text"></span>-->
<!-- </a-tooltip>-->
<!-- </span>-->
<!-- <span slot="detailText" slot-scope="text,record">-->
<!-- <span class="text" :title="text">-->
<!-- {{text && text.length > 10?text.slice(0,9)+'...':text}}-->
<!-- </span>-->
<!-- </span>-->
<!-- </a-table>-->
<div class="page" v-if="dataSourcehistory.length > 0">
<a-pagination
:show-total="total => $t('total')+` ${total} `+$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSizehistory"
:total="total"
:current="pageNohistory"
@change="onChangehistory"
@showSizeChange="SizeChangehistory"
/>
</div>
</a-modal>
<!-- 配置信息--->
<a-modal v-model="areaVisibleView" :title="$t('configurationInformation')" width="550px" :footer="null">
<div class="content-text">
<div class="text-field">
<span class="text-field-left" :title="$t('configurationName')">{{ $t('configurationName') }}:</span>
<span class="text-field-right"
:title="configDetail.configName"
>{{ configDetail.configName }}</span>
</div>
</div>
<div class="content-text">
<div class="text-field">
<span class="text-field-left" :title="$t('Model')">{{ $t('Model') }}:</span>
<span class="text-field-right" :title="configDetail.carType"
>{{ configDetail.carType }}</span>
</div>
<div class="text-field">
<span class="text-field-left" :title="$t('electricMachinery')">{{ $t('electricMachinery') }}:</span>
<span class="text-field-right" :title="configDetail.motor"
>{{ configDetail.motor }}</span>
</div>
</div>
<div class="content-text">
<div class="text-field">
<span class="text-field-left" :title="$t('Version')">{{ $t('Version') }}:</span>
<span class="text-field-right" :title="configDetail.version"
>{{ configDetail.version }}</span>
</div>
<div class="text-field">
<span class="text-field-left" :title="$t('Battery')">{{ $t('Battery') }}:</span>
<span class="text-field-right" :title="configDetail.battery"
>{{ configDetail.battery }}</span>
</div>
</div>
</a-modal>
<!-- 参数说明--->
<a-modal v-model="seeVisibleView" :title="$t('ParameterDescription')" width="550px" :footer="null">
<div class="content-text">
<div class="textfield">
<span class="textfield-left" :title="$t('ParameterDescription')">{{ $t('ParameterDescription') }}:</span>
<span class="textfield-right"
:title="this.description"
>{{ this.description }}</span>
</div>
</div>
</a-modal>
</div>
</template>
<script>
import eventBUs from '../../common/event'
import {getAction, postAction} from '@/api/manage'
import CollectionType from '@/components/CollectionType'
import {ACCESS_TOKEN} from '@/store/mutation-types'
import axios from 'axios'
import Vue from 'vue'
// import VueDraggableResizable from 'vue-draggable-resizable'
import {mapGetters} from 'vuex'
import {ResizeHeader, ResizeColumnProvide} from '@/mixins/header'
import historyTable from './historyTable.vue'
export default {
name: 'index',
mixins: [ResizeHeader, ResizeColumnProvide],
props: {
//接口
url: {
type: Object,
default: {}
},
// 详细列表得一条数据
paramsManifest: {
type: Object,
default: {},
require: true
},
description: '',
formInline: {
type: Object,
default: true
},
// queryParamQuery: {
// type: Object,
// default: true
// },
currentPersonRole: {
type: String,
default: true
}
},
components: {
CollectionType,
// VueDraggableResizable
historyTable
},
data() {
// this.components = {
// header: {
// cell: (h, props, children) => {
// const { key, ...restProps } = props
//
// // 此处的this.columns 是定义的table的表头属性变量
//
// const col = this.columns.find((col) => {
// const k = col.dataIndex || col.key
// return k === key
// })
//
// if (!col || !col.width) {
// return h('th', { ...restProps }, [...children])
// }
//
// const dragProps = {
// key: col.dataIndex || col.key,
// class: 'table-draggable-handle',
// attrs: {
// w: 10,
// x: col.width,
// z: 1,
// axis: 'x',
// draggable: false,
// resizable: false
// },
// on: {
// dragging: (x, y) => {
// col.width = Math.max(x, 1)
// }
// }
// }
// const drag = h('vue-draggable-resizable', { ...dragProps })
// return h('th', { ...restProps, class: 'resize-table-th' }, [...children, drag])
// }
// }
// }
return {
colIndexs: [],
minWidthColumns: [],
token: Vue.ls.get(ACCESS_TOKEN),
jsonBody: [],
checkboxList: [],
tableAll: false,
indeterminate: false,
columns: [],
content: [],
confirmLoading: false,
selectedRowKeys: [],
selectedRowrowValue: [],
dataSource: [],
pageNo: 1,
pageSize: 100,
pageNohistory: 1,
pageSizehistory: 10,
pageSizeOptions: ['100', '200'],
total: 0,
searchParmes: {},
loading: false,
orderBy: '1',
orderByField: '',
homo: 0, // 认证工程师
sdt: 0, // 工程接口人
dre: 0, // 填写人
areaVisible: false,
areaVisiblezr: false,
form: {},
rules: {
querySdt: [
{
required: true,
message: this.$t('PleaseSelect') + this.$t('engineeringInterfacePerson'),
trigger: 'change'
}
],
queryzr: [
{
required: true,
message: this.$t('PleaseSelect') + this.$t('areaOfResponsibility'),
trigger: 'change'
}
]
},
wrapperCol: {
xs: {span: 24},
sm: {span: 14}
},
labelCol: {
xs: {span: 24},
sm: {span: 7}
},
queryParamQuery: {},
queryParam: {},
querySdtList: [], // 工程接口人
Dateline: {},
getquerySdtId: '', // 当前工程接口人的id
areaVisibleView: false, // 查看配置得弹框
seeVisibleView: false,
visible: false,
configDetail: {}, // 查看配置得详细信息
dataSourcehistory: [],
columnshistory: [
{
title: this.$t('OperationDetails'),
dataIndex: 'logContent',
align: 'left',
width: 320,
ellipsis: true,
scopedSlots: {customRender: 'content'}
},
{
title: this.$t('OperationTime'),
dataIndex: 'createTime',
align: 'left',
ellipsis: true,
width: 180
}
]
}
},
mounted() {
this.getHeader()
eventBUs.$on('getTableList', search => {
this.queryParamQuery = search
this.getTableList()
})
},
watch: {
currentPersonRole: {
handler: function () {
this.getTableList()
},
immediate: true
}
},
methods: {
...mapGetters(['userInfo']),
rowClassName(row, index) {
if (row.changeFlag == '1') {
return 'rowClassRedYellow'
}
if (row.delFlag == '1') {
return 'rowClassRed'
}
},
handleInput(value) {
this.$nextTick(() => {
this.Dateline = {...this.Dateline}
this.$refs.ruleFormOne.validateField([value])
})
},
pageOnChange(page, pageSize) {
this.pageNo = page
this.$emit('handlePreservation')
this.getTableList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.$emit('handlePreservation')
this.getTableList()
},
onClickTitle(val) {
console.log(val)
this.description = val.description
this.seeVisibleView = true
},
// 查看配置详细信息
onClickSee(val) {
let _this = this
this.areaVisibleView = true
let url = ''
if (this.$route.query.it === undefined) {
if (val.db_field_name == 'referencesCol') {
url = `/jero-boot/params/report/queryParamsReportConfigById?id=${val.db_field_id}`
} else {
url = `/jero-boot/params/config/getById?id=${val.db_field_name}`
}
} else {
// 历史版本
url = `/jero-boot/params/collectManifestHistory/getConfigById?id=${val.db_field_name}`
}
axios({
url: url,
method: 'get',
transformRequest: [function (data) {
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token': _this.token
}
})
.then((res) => {
console.log(res)
if (res.data.success) {
this.configDetail = res.data.result || {}
} else {
this.configDetail = {}
_this.$message.warning(res.data.result)
}
})
.catch((error) => {
console.log(error)
})
},
// 获取工程接口人
getquerySdtList(record) {
// 当前工程接口人的id
this.getquerySdtId = record.id
getAction(this.url.getquerySdtList, {
projectId: this.$route.query.projectId,
projectVersion: this.$route.query.projectVersion,
dutyTerritory: record.dutyTerritory
}).then((res) => {
if (res.success) {
this.querySdtList = res.result
}
})
},
// 责任领域 保存
handleSubmitzr(record) {
let _this = this
let param = {
dutyTerritory: this.Dateline.queryzr,
ids: this.getquerySdtId,
paramsManifestId: this.$route.query.id
}
this.$refs.ruleFormOne.validate(valid => {
if (valid) {
this.confirmLoading = true
axios({
url: '/jero-boot/params/collectManifest/updateDutyTerritory',
method: 'post',
data: param,
transformRequest: [function (data) {
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token': _this.token
}
})
.then((res) => {
console.log(res)
if (res.data.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
_this.areaVisiblezr = false
this.$refs['ruleFormOne'].resetFields()
this.getLoginUserType()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
this.confirmLoading = false
})
.catch((error) => {
this.confirmLoading = false
console.log(error)
})
}
})
},
// 工程接口人 保存
handleSubmit(record) {
let _this = this
let param = {sdt: this.Dateline.querySdt, ids: this.getquerySdtId}
this.$refs.ruleForm.validate(valid => {
if (valid) {
axios({
url: '/jero-boot/params/collectManifest/updateSdt',
method: 'post',
data: param,
transformRequest: [function (data) {
let ret = ''
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
}
return ret
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'X-Access-Token': _this.token
}
})
.then((res) => {
console.log(res)
if (res.data.success) {
_this.$message.success(_this.$t('OperationSuccessful'))
this.$refs['ruleForm'].resetFields()
_this.areaVisible = false
this.getLoginUserType()
} else {
_this.$message.warning(_this.$t('operationFailed'))
}
})
.catch((error) => {
console.log(error)
})
}
})
},
// 工程接口人 取消
cancleImports() {
this.areaVisible = false
this.$refs['ruleForm'].resetFields()
},
cancel() {
this.areaVisiblezr = false
this.$refs['ruleFormOne'].resetFields()
},
// 点击工程接口人的详情人员 有权限
areaOfResponsibility(record) {
// this.$refs.ruleForm.clearValidate()
this.$nextTick(() => {
this.Dateline = {...this.Dateline}
this.getquerySdtList(record)
this.$refs.ruleForm.clearValidate()
})
this.areaVisible = true
},
// 点击责任领域的详情人员 有权限
ondataValueTobe(record) {
// this.$refs.ruleForm.clearValidate()
this.$nextTick(() => {
this.Dateline = {...this.Dateline}
this.getquerySdtId = record.id
this.$refs.ruleFormOne.clearValidate()
})
this.areaVisiblezr = true
},
dataValueTobeinitiated() {
this.$message.warning(this.$t('certifiedEngineer') + this.$t('and') + this.$t('Statusis') + this.$t('CollectionInitiated') + this.$t('ReturnedPerson') + this.$t('alteration') + this.$t('toHavePermission'))
},
dataValueTobe() {
this.$message.warning(this.$t('certifiedEngineer') + this.$t('and') + this.$t('Statusis') + this.$t('CollectionInitiated') + this.$t('ReturnedPerson') + this.$t('toHavePermission'))
},
// 点击工程接口人的详情人员 无权限
ondataValueNot() {
this.$message.warning(this.$t('operatethisbutton'))
},
onHeaderRow(column, index) {
console.log(column, index)
},
getLoginUserType() {
let params = {
paramsManifestId: this.$route.query.id,
projectId: this.$route.query.projectId
}
this.loading = true
getAction(this.url.getLoginUserType, params).then((res) => {
if (res.success) {
this.getAndUserId(res.result)
}
})
},
UpdateLog(val) {
this.visible = true
this.paramsReportDetailId = val.id
this.bussLogList(val)
},
onChangehistory(page, pageSize) {
this.pageNohistory = page
this.bussLogList()
},
SizeChangehistory(page, pageSize) {
this.pageNohistory = 1
this.pageSizehistory = pageSize
this.bussLogList()
},
bussLogList(val) {
let query = {
pageNo: this.pageNohistory,
pageSize: this.pageSizehistory,
paramsManifestId: this.$route.query.id,
paramsCollectManifestId: this.paramsReportDetailId
}
this.loading = true
getAction('paramsCollectManifestLog/paramsCollectManifestLogEO/page', query).then((res) => {
if (res.success) {
this.dataSourcehistory = res.result.records
if (this.dataSourcehistory && this.dataSourcehistory.length > 0) {
this.dataSourcehistory.forEach(val => {
val.logContent = val.logContent.replace(/\"/g, '<span class=\'textData\'>"</span>')
})
}
this.total = res.result.total
this.loading = false
} else {
this.loading = false
}
})
},
handleOk() {
this.pageNohistory = 1
this.visible = false
},
handleCancel() {
this.pageNohistory = 1
this.visible = false
},
collectionForm() {
this.getTableList()
},
consolidateData() {
this.dataSource = [...this.dataSource]
console.log(this.dataSource)
},
getAndUserId(result) {
let query = {
paramsManifestId: this.$route.query.id,
projectId: this.$route.query.projectId,
userId: this.userInfo().id
}
getAction('/params/userTypeLog/queryCurrentType', query).then((res) => {
if (res.success) {
this.queryParamQuery = {...this.queryParamQuery}
if (res.result && res.result.userType) {
if (!(result.some(val => val.value == res.result.userType))) {
res.result.userType = result[0] ? result[0].value : ''
}
this.getTableList(res.result.userType)
this.getHeader(res.result.userType)
} else {
this.getTableList(result[0].value)
this.getHeader(result[0].value)
}
this.$emit('LoginUserType', result, this.currentPersonRole, res.result.userType)
} else {
}
})
},
getHeader(userType) {
let paramsManifestid
let url
if (this.$route.query.it === undefined) {
// 页面跳转
paramsManifestid = this.$route.query.id
url = 'head/headCustomEO/list'
} else {
// 历史版本
paramsManifestid = this.$route.query.it
url = 'params/collectManifestHistory/getHeader'
}
let params = {
paramsManifestId: paramsManifestid,
projectName: this.$route.query.projectName,
flag: '7'
}
let paramscm = {
paramsManifestId: paramsManifestid,
moduleFlag: '参数项收集清单',
flag: this.$route.query.it === undefined ? '' : '7'
}
var jsonHead = []
getAction(url, paramscm).then((res) => {
if (res.success) {
if (res.result && res.result.length > 0) {
jsonHead = res.result
this.columns = []
let num = 0
this.content = []
let checkedList = []
jsonHead.forEach((res, index) => {
// console.log(res)
// 配置列
checkedList.push(res.dataIndex)
if (res.type) {
// console.log('配置')
this.columns.push({
dataIndex: res.db_field_name,
align: 'left',
ellipsis: true,
sorter: res.sort,
width: 300
})
num++
this.content.push(res)
this.columns[index].scopedSlots = {
customRender: 'detailClick',
title: 'titleName' + num
}
console.log(this.content, ' this.content this.content this.content this.content this.content')
// 非配置列
} else {
this.columns.push({
title: res.db_field_txt,
dataIndex: res.db_field_name,
align: 'left',
// ellipsis: true,
fixed: res.click5 ? 'left' : '',
sorter: res.sort,
width: 160
})
this.columns[index].scopedSlots = {
customRender: 'titleName'
}
if (res.db_field_name == 'nioNumber') {
this.columns[index].width = 120
}
if (res.db_field_name == 'dutyTerritory') {
this.columns[index].width = 120
}
if (res.db_field_name == 'sdt') {
this.columns[index].width = 130
}
if (res.db_field_name == 'dre') {
this.columns[index].width = 120
}
if (res.click1) {
this.columns[index].scopedSlots = {
customRender: 'operationzr'
}
}
if (res.click2) {
this.columns[index].scopedSlots = {
customRender: 'ParameterDescription'
}
}
if (res.click3) {
this.columns[index].scopedSlots = {
customRender: 'paramsNameDescription'
}
}
if (res.click6) {
this.columns[index].scopedSlots = {
customRender: 'Operation'
}
}
if (res.click) {
// 工程接口人列表修改
this.columns[index].scopedSlots = {
customRender: 'operationbtn'
}
}
if (res.db_field_name == 'paramsName') {
this.columns[index].width = 300
this.columns[index].scopedSlots = {
customRender: 'paramsName'
}
}
}
if (res.isLock && res.isLock === '0') {
this.colIndexs.push(index)
}
})
this.columns = [...this.columns]
this.colIndexs.forEach((item) => {
this.minWidthColumns.push([this.columns[item], 300])
})
this.$emit('getcustomizeList', checkedList)
this.$forceUpdate()
} else {
getAction(this.url.tableHeader, params).then((val) => {
if (val.success) {
jsonHead = val.result
this.columns = []
let num = 0
this.content = []
let checkedList = []
jsonHead.forEach((res, index) => {
// console.log(res)
// 配置列
if (res.headFieldCn == '操作') {
res.field = 'operation'
}
if (!res.show) {
checkedList.push(res.field)
}
// checkedList.push(res.field)
if (res.type) {
// console.log('配置')
this.columns.push({
dataIndex: res.db_field_name,
align: 'left',
ellipsis: true,
sorter: res.sort,
width: 300
})
num++
this.content.push(res)
this.columns[index].scopedSlots = {
customRender: 'detailClick',
title: 'titleName' + num
}
console.log(this.content, ' this.content this.content this.content this.content this.content')
// 非配置列
} else {
this.columns.push({
title: res.db_field_txt,
dataIndex: res.db_field_name,
align: 'left',
// ellipsis: true,
fixed: res.click5 ? 'left' : '',
sorter: res.sort,
width: 160,
show: res.show
})
this.columns[index].scopedSlots = {
customRender: 'titleName'
}
if (res.db_field_name == 'nioNumber') {
this.columns[index].width = 120
}
if (res.click1) {
this.columns[index].scopedSlots = {
customRender: 'operationzr'
}
}
if (res.click2) {
this.columns[index].scopedSlots = {
customRender: 'ParameterDescription'
}
}
if (res.click3) {
this.columns[index].scopedSlots = {
customRender: 'paramsNameDescription'
}
}
if (res.click6) {
this.columns[index].scopedSlots = {
customRender: 'Operation'
}
}
if (res.click) {
// 工程接口人列表修改
this.columns[index].scopedSlots = {
customRender: 'operationbtn'
}
}
if (res.db_field_name == 'paramsName') {
this.columns[index].width = 300
this.columns[index].scopedSlots = {
customRender: 'paramsName'
}
}
}
if (res.isLock && res.isLock === '0') {
this.colIndexs.push(index)
}
})
for (let i = 0; i < this.columns.length; i++) {
if (this.columns[i].show == '1') {
this.columns.splice(i, 1)
i--
}
}
this.columns = [...this.columns]
this.colIndexs.forEach((item) => {
this.minWidthColumns.push([this.columns[item], 300])
})
this.$emit('getcustomizeList', checkedList)
this.$forceUpdate()
}
})
}
}
})
},
getTableListReset() {
this.formInline = {}
this.queryParamQuery = {}
let params = {
paramsManifestId: this.$route.query.id,
pageNo: this.pageNo,
pageSize: this.pageSize
// userTypes: this.currentPersonRole
}
let url
let action
this.loading = true
this.$emit('listReset', '')
// todo
if (this.$route.query.it === undefined) {
// 页面跳转
url = this.url.tableList
action = postAction
params.paramsManifestId = this.$route.query.id
params.userTypes = this.currentPersonRole
} else {
// 历史版本
action = getAction
url = 'params/collectManifestHistory/list'
params.paramsManifestId = this.$route.query.it
}
action(url, params).then((res) => {
if (res.success) {
let tt = []
if (this.currentPersonRole !== 'dre') {
res.result.records.forEach((Obj) => {
Object.keys(Obj).forEach((item) => {
if (Obj[item] instanceof Object && Obj[item].controlType !== undefined) {
for (const key in Obj[item].paramsConfigData) {
Obj[item].paramsConfigData[key].forEach((itemLi) => {
itemLi.isLock = 1
if (itemLi.type === 'pull_more') {
itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
}
})
}
// Obj[item].list.forEach((itemLi) => {
// itemLi.isLock = 1
// if (itemLi.type === 'pull_more') {
// itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
// }
// })
}
})
tt.push(Obj)
})
} else {
res.result.records.forEach((Obj) => {
Object.keys(Obj).forEach((item) => {
if (Obj[item] instanceof Object && Obj[item].controlType !== undefined) {
for (const key in Obj[item].paramsConfigData) {
Obj[item].paramsConfigData[key].forEach((itemLi) => {
if (itemLi.type === 'pull_more') {
itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
}
if (Obj.state == '已同步至上报库' || Obj.state == 'Synced to library') {
Obj[item].referencesColFlag = '1'
itemLi.isLock = '1'
}
})
}
// Obj[item].list.forEach((itemLi) => {
// if (itemLi.type === 'pull_more') {
// itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.split(',')
// }
// })
}
})
tt.push(Obj)
})
}
this.dataSource = tt
this.total = res.result.total
this.selectedRowKeys = []
this.$emit('getDataSource', this.dataSource)
setTimeout(() => {
this.loading = false
}, 500)
} else {
this.loading = false
}
})
},
cancleoperationFailed() {
this.selectedRowKeys = []
},
tableOnChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
if (sorter.columnKey == 'nioNumber') {
sorter.columnKey = 'nio_number'
} else if (sorter.columnKey == 'dutyTerritory') {
sorter.columnKey = 'duty_territory'
} else if (sorter.columnKey == 'reportTime') {
sorter.columnKey = 'report_time'
}
this.orderByField = sorter.columnKey
this.getTableList()
},
getTableList(currentPersonRole) {
let paramsManifestid
let url
let action
if (this.$route.query.it === undefined) {
// 页面跳转
paramsManifestid = this.$route.query.id
url = this.url.tableList
action = postAction
} else {
// 历史版本
action = getAction
paramsManifestid = this.$route.query.it
url = 'params/collectManifestHistory/list'
}
let formInline = JSON.parse(JSON.stringify(this.formInline))
Object.keys(formInline).forEach(res => {
if (formInline[res] && formInline[res] instanceof Array) {
formInline[res] = formInline[res].join(',')
}
})
let params = {
pageNo: this.pageNo,
pageSize: this.pageSize,
userTypes: this.currentPersonRole || currentPersonRole,
paramsManifestId: paramsManifestid,
orderBy: this.orderBy,
orderByField: this.orderByField,
...formInline,
...currentPersonRole,
...this.queryParamQuery
}
this.loading = true
action(url, params).then((res) => {
if (res.success) {
// console.log(res.result,'res.result')
// let tt = []
// this.dataSource = []
// // 需要转化数据类型
// tt = res.result
// tt.forEach((Obj) => {
// Object.keys(Obj).forEach((item) => {
// if(Obj[item] instanceof Object && Obj[item].controlType !== undefined){
// Obj[item].list.forEach((itemLi) => {
// if(itemLi.type === 'pull_more'){
// itemLi.dataValue = itemLi.dataValue === null ? [] : itemLi.dataValue.splice(',')
// }
// })
// }
// })
// })
let tt = []
if (this.currentPersonRole !== 'dre') {
console.log(res.result.records, 'res.result.records')
res.result.records.forEach((Obj) => {
Object.keys(Obj).forEach((item) => {
if (Obj[item] instanceof Object && Obj[item].controlType !== undefined) {
for (const key in Obj[item].paramsConfigData) {
Obj[item].paramsConfigData[key].forEach((itemLi) => {
// console.log(item)
// console.log(this.currentPersonRole)
if ((this.currentPersonRole == 'homo' || this.currentPersonRole == 'admin') && item == 'referencesCol') {
itemLi.isLock = 0
} else if (this.currentPersonRole == 'homo' && (Obj.state == '变更' || Obj.state == 'Modify')) {
itemLi.isLock = 0
Obj[item].referencesColFlag = '1'
} else {
itemLi.isLock = 1
}
if (itemLi.type === 'pull_more') {
itemLi.dataValue = !itemLi.dataValue ? [] : itemLi.dataValue.split(',')
}
})
}
// Obj[item].list.forEach((itemLi) => {
// console.log(item)
// if((this.currentPersonRole == 'homo' || this.currentPersonRole == 'admin') && item == 'referencesCol'){
// itemLi.isLock = 0
// }else{
// itemLi.isLock = 1
// }
// if (itemLi.type === 'pull_more') {
// itemLi.dataValue = !itemLi.dataValue ? [] : itemLi.dataValue.split(',')
// }
// })
}
})
tt.push(Obj)
})
} else {
res.result.records.forEach((Obj) => {
Object.keys(Obj).forEach((item) => {
if (Obj[item] instanceof Object && Obj[item].controlType !== undefined) {
for (const key in Obj[item].paramsConfigData) {
Obj[item].paramsConfigData[key].forEach((itemLi) => {
if (itemLi.type === 'pull_more') {
itemLi.dataValue = !itemLi.dataValue ? [] : itemLi.dataValue.split(',')
}
if (Obj.state == '已同步至上报库' || Obj.state == 'Synced to library') {
itemLi.isLock = '1'
Obj[item].referencesColFlag = '1'
}
})
}
// Obj[item].list.forEach((itemLi) => {
// if (itemLi.type === 'pull_more') {
// itemLi.dataValue = !itemLi.dataValue ? [] : itemLi.dataValue.split(',')
// }
// })
}
})
tt.push(Obj)
})
}
this.dataSource = JSON.parse(JSON.stringify(tt))
this.total = res.result.total
this.selectedRowKeys = []
this.selectedRowrowValue = []
this.$emit('value', this.selectedRowKeys)
this.$emit('rowValue', this.selectedRowrowValue)
this.$emit('getDataSource', this.dataSource)
setTimeout(() => {
this.loading = false
}, 500)
} else {
this.loading = false
}
})
},
onChange(page, pageSize) {
},
onSelectChange(value, rowValue) {
this.selectedRowKeys = []
this.selectedRowrowValue = []
this.selectedRowKeys = value
this.selectedRowrowValue = rowValue
this.$emit('value', this.selectedRowKeys)
this.$emit('rowValue', this.selectedRowrowValue)
},
OperationClick(ol, item) {
// this.$emit(ol.ClickEvent, item)
},
detailClick(item, index) {
// this.$emit('detailClick', item)
}
}
}
</script>
<style lang="less">
.imports-footer {
.imports-footer-wrap {
margin: 20px 0;
text-align: center;
.imports-sub {
margin-right: 20px;
}
}
}
.table .ant-table-column-title {
font-weight: bold;
}
.textData {
font-family: cursive;
}
.nio-drag-handler {
position: absolute;
right: 0;
top: 0;
height: 100%;
width: 5px;
z-index: 1;
border-right: 1px #e8e8e8 solid;
}
.nio-drag-handler:hover,
.nio-drag-handler:focus {
cursor: col-resize !important;
border-right: 2px solid #0bd9d9 !important;
}
.nio-header-th {
position: relative;
isolation: isolate;
}
</style>
<style scoped lang="less">
@import '~@assets/less/common.less';
.box {
width: 100%;
height: calc(100% - 100px);
overflow: auto;
}
.text {
margin-right: 10px;
}
.page {
text-align: right;
margin-top: 20px;
}
/deep/ .ant-table-tbody .yellow {
background-color: #ffff001f !important;
height: 40px !important;
border: none !important;
padding: 0 !important;
}
//::v-deep .ant-table-row:first-child {
// background: #fff!important;
// /*opacity: 0.9;*/
//}
//
//::v-deep .ant-table-body {
// background: transparent!important;
//}
.content-text {
width: 100%;
display: flex;
flex-wrap: wrap;
.text-field {
width: 50%;
margin-bottom: 8px;
display: flex;
.text-field-left {
width: 80px;
display: inline-block;
font-size: 16px;
color: #040B29;
font-weight: 400;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.text-field-right {
display: inline-block;
font-size: 16px;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
word-break: break-word;
color: #040B29;
font-weight: 400;
}
}
.textfield {
width: 100%;
margin-bottom: 8px;
display: flex;
.textfield-left {
width: 80px;
display: inline-block;
font-size: 16px;
color: #040B29;
font-weight: 400;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
}
.textfield-right {
display: inline-block;
font-size: 16px;
//text-overflow: ellipsis;
//white-space: nowrap;
width: 100%;
overflow: hidden;
word-break: break-word;
color: #040B29;
font-weight: 400;
}
}
}
.textName {
width: 100%;
overflow: hidden;
display: -webkit-box;
text-overflow: ellipsis;
/*! autoprefixer: off */
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
/*! autoprefixer: on;*/
text-justify: inter-ideograph;
word-break: break-all
}
::v-deep .ant-table-placeholder {
margin-top: 8px !important;
}
.box-button-text {
white-space: pre-wrap;
word-break: break-all;
width: 40%;
float: left;
text-align: left;
}
</style>
<style>
.resize-table-th {
position: relative;
}
.table-draggable-handle {
/* width: 10px !important; */
height: 100% !important;
left: auto !important;
right: -5px;
cursor: col-resize;
touch-action: none;
border: none;
position: absolute;
transform: none !important;
bottom: 0;
}
.rowClassRed {
background: #f3d9de;
}
.rowClassRedYellow {
background: yellow;
}
</style>