225 lines
6.7 KiB
Vue
225 lines
6.7 KiB
Vue
<template>
|
|
<div>
|
|
<base-info-form ref="baseInfoForm" :disabled="disabled" @processNameChange="processNameChange"></base-info-form>
|
|
<!-- 标准文本 -->
|
|
<div class="box-title-text form-flex-item">
|
|
<div class="title-text">
|
|
<span class="title-text-text" :title="$t('workCenter.enStandardRevision.standardText')">
|
|
{{ $t('workCenter.enStandardRevision.standardText') }}
|
|
</span>
|
|
</div>
|
|
<a-form-model-item class="item-model">
|
|
<div class="online-edit-wrapper">
|
|
<!-- todo: 还不确定这里展示的是什么 -->
|
|
<p>企业标准</p>
|
|
<a-button type="primary">{{ $t('workCenter.enStandardRevision.onLineEditing') }}</a-button>
|
|
</div>
|
|
</a-form-model-item>
|
|
</div>
|
|
|
|
<!-- 操作区域 -->
|
|
<div v-if="!disabled" class="table-operator">
|
|
<!-- 新增 -->
|
|
<a-button icon="plus" type="primary" @click="handleAdd" :disabled="disabled">
|
|
{{ $t('newlyAdded') }}
|
|
</a-button>
|
|
</div>
|
|
|
|
<div>
|
|
<j-table
|
|
:can-drag="true"
|
|
:scroll="{x: '100%'}"
|
|
ref="table"
|
|
rowKey="enterpriseStandardPlanId"
|
|
:columns="columns"
|
|
:dataSource="dataSource"
|
|
:pagination="false"
|
|
:loading="loading">
|
|
|
|
<!-- 修改前 -->
|
|
<template v-slot:beforeUpdate="{text, record}">
|
|
<a-button type="primary" @click="beforeUpdateClick(record)">{{ $t('workCenter.enStandardChange.lookUpdateBeforeContent') }}</a-button>
|
|
</template>
|
|
|
|
<!-- 操作栏 -->
|
|
<div slot="action" slot-scope="{record, index}" class="action-span-cell">
|
|
<a @click="handleEdit(record, index)" class="table-ope-btn" :disabled="disabled">{{ $t('edit') }}</a>
|
|
<a-divider type="vertical" />
|
|
<a @click="handleDelete(record.id, index)" class="table-ope-btn" :disabled="disabled">{{ $t('delete') }}</a>
|
|
</div>
|
|
|
|
</j-table>
|
|
</div>
|
|
|
|
<update-list-modal ref="updateListModal" @ok="modalFormOk"></update-list-modal>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import BaseInfoForm from './BaseInfoForm'
|
|
import JTable from '@/components/jero/JTable'
|
|
import UpdateListModal from './UpdateListModal'
|
|
|
|
export default {
|
|
name: 'MainDrafterInitBaseInfo',
|
|
components: { BaseInfoForm, JTable, UpdateListModal },
|
|
props: {
|
|
disabled: {
|
|
type: Boolean,
|
|
required: false,
|
|
default: false
|
|
}
|
|
},
|
|
data () {
|
|
return {
|
|
columns: [
|
|
{
|
|
title: this.$t('serialNumber'),
|
|
dataIndex: '',
|
|
key: 'rowIndex',
|
|
align: 'center',
|
|
width: 80,
|
|
customRender: function (t, r, index) {
|
|
return parseInt(index) + 1
|
|
}
|
|
},
|
|
{ // 条款号
|
|
title: this.$t('workCenter.enStandardRevision.clauseNumber'),
|
|
align: 'center',
|
|
width: 180,
|
|
dataIndex: 'clauseNumber',
|
|
scopedSlots: { customRender: 'text' }
|
|
},
|
|
{ // 条款名称
|
|
title: this.$t('workCenter.enStandardRevision.clauseName'),
|
|
align: 'center',
|
|
width: 180,
|
|
dataIndex: 'clauseName',
|
|
scopedSlots: { customRender: 'text' }
|
|
},
|
|
{ // 修改意见内容
|
|
title: this.$t('workCenter.enStandardChange.revisedOpinionContent'),
|
|
children: [
|
|
{ // 修改前
|
|
title: this.$t('workCenter.enStandardChange.beforeUpdate'),
|
|
align: 'center',
|
|
width: 180,
|
|
dataIndex: 'beforeUpdate',
|
|
scopedSlots: { customRender: 'beforeUpdate' }
|
|
},
|
|
{ // 修改后
|
|
title: this.$t('workCenter.enStandardChange.afterUpdate'),
|
|
align: 'center',
|
|
width: 180,
|
|
dataIndex: 'afterUpdate',
|
|
scopedSlots: { customRender: 'text' }
|
|
},
|
|
{ // 修改理由
|
|
title: this.$t('workCenter.enStandardChange.updateReason'),
|
|
align: 'center',
|
|
width: 180,
|
|
dataIndex: 'updateReason',
|
|
scopedSlots: { customRender: 'text' }
|
|
}
|
|
]
|
|
},
|
|
{
|
|
title: this.$t('operation'),
|
|
scopedSlots: { customRender: 'action' },
|
|
align: 'center',
|
|
width: 200
|
|
}
|
|
],
|
|
dataSource: [],
|
|
loading: false
|
|
}
|
|
},
|
|
methods: {
|
|
// 拿到外面传进来的数据初始化,因为套了几层就不在外层初始化数据了
|
|
initData (data) {
|
|
this.data = data
|
|
// 给表格赋值,在线编辑不知道要怎么赋值?
|
|
// this.dataSource =
|
|
// 给表单赋值
|
|
// this.$nextTick(() => {
|
|
// this.$refs.baseInfoForm.formInline =
|
|
// })
|
|
},
|
|
// 外层要获取数据
|
|
getData () {
|
|
// 把数据抛出,在线编辑不知道要不要抛
|
|
const data = {}
|
|
data.formInline = this.$refs.baseInfoForm.formInline
|
|
data.dataSource = this.dataSource
|
|
return data
|
|
},
|
|
// 外层获取数据要过校验,返回false表示没有通过校验
|
|
getDataValidate (callback) {
|
|
this.$refs.baseInfoForm.$refs.ruleForm.validate(valid => {
|
|
if (valid) {
|
|
const data = {}
|
|
data.formInline = this.$refs.baseInfoForm.formInline
|
|
data.dataSource = this.dataSource
|
|
callback(data)
|
|
}
|
|
})
|
|
},
|
|
// 企标编号和名称修改触发流程名称的修改
|
|
processNameChange (value) {
|
|
this.$emit('processNameChange', value)
|
|
},
|
|
// 新增修改单
|
|
handleAdd () {
|
|
// 不知道左侧要预览哪个文件
|
|
const file = ''
|
|
this.$refs.updateListModal.title = this.$t('newlyAdded')
|
|
this.$refs.updateListModal.add(file)
|
|
},
|
|
// 修改单的编辑
|
|
handleEdit (record, index) {
|
|
// 不知道左侧要预览哪个文件
|
|
const file = ''
|
|
this.$refs.updateListModal.title = this.$t('edit')
|
|
this.$refs.updateListModal.edit(file, record, index)
|
|
},
|
|
// 修改单的删除
|
|
handleDelete (index) {
|
|
this.dataSource.splice(index, 1)
|
|
},
|
|
// 修改单新增编辑完成
|
|
modalFormOk (value, index) {
|
|
console.log(value, index)
|
|
if (index || index === 0) {
|
|
// 有下标,说明是编辑
|
|
this.dataSource.splice(index, 1, value)
|
|
} else {
|
|
// 没有下标, 是新增
|
|
this.dataSource.push(value)
|
|
}
|
|
},
|
|
// 修改前按钮点击
|
|
beforeUpdateClick (record) {
|
|
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="less">
|
|
@import '~@assets/less/common.less';
|
|
|
|
.online-edit-wrapper {
|
|
height: 100%;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
p {
|
|
margin-bottom: 0;
|
|
height: 100%;
|
|
}
|
|
.ant-btn {
|
|
margin-right: 20px;
|
|
}
|
|
}
|
|
</style>
|