[update] 企标新增和详情页修改
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
<template>
|
||||
<j-modal
|
||||
:title="title"
|
||||
:maskClosable="true"
|
||||
:width="500"
|
||||
:closable="true"
|
||||
@cancel="handleCancel"
|
||||
fullscreen
|
||||
@ok="handleOk"
|
||||
:visible="visible">
|
||||
<div class="content">
|
||||
<!-- 左侧文件预览 -->
|
||||
<div class="content-left">
|
||||
<iframe></iframe>
|
||||
</div>
|
||||
<!-- 右侧表单区域 -->
|
||||
<div class="content-right">
|
||||
<a-spin :spinning="confirmLoading">
|
||||
<a-form :form="form">
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('enterpriseStandardLibrary.standard.subjectToClause')">
|
||||
<a-input :placeholder="$t('pleaseEnter') + $t('enterpriseStandardLibrary.standard.subjectToClause')"
|
||||
:maxLength="50"
|
||||
v-decorator.trim="[ 'subjectToClause', validatorRules.subjectToClause ]" />
|
||||
</a-form-item>
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('enterpriseStandardLibrary.standard.standardContentOrRequirements')">
|
||||
<a-input :placeholder="$t('pleaseEnter') + $t('enterpriseStandardLibrary.standard.standardContentOrRequirements')"
|
||||
:maxLength="50"
|
||||
v-decorator.trim="[ 'standardContentOrRequirements', validatorRules.standardContentOrRequirements ]" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</j-modal>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
|
||||
export default {
|
||||
name: 'CheckContentModal',
|
||||
data () {
|
||||
return {
|
||||
title: '',
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 6 }
|
||||
},
|
||||
wrapperCol: {
|
||||
xs: { span: 24 },
|
||||
sm: { span: 16 }
|
||||
},
|
||||
validatorRules: {
|
||||
subjectToClause: {
|
||||
rules: [
|
||||
{ required: true, message: this.$t('pleaseEnter') + this.$t('enterpriseStandardLibrary.standard.subjectToClause') }
|
||||
],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
standardContentOrRequirements: {
|
||||
rules: [
|
||||
{ required: true, message: this.$t('pleaseEnter') + this.$t('enterpriseStandardLibrary.standard.standardContentOrRequirements') }
|
||||
],
|
||||
validateTrigger: 'blur'
|
||||
}
|
||||
},
|
||||
index: undefined // 编辑的表格的下标
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add () {
|
||||
this.visible = true
|
||||
this.form.resetFields()
|
||||
},
|
||||
edit (record, index) {
|
||||
this.visible = true
|
||||
this.index = index
|
||||
this.form.resetFields()
|
||||
this.model = Object.assign({}, record)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'subjectToClause', 'standardContentOrRequirements'))
|
||||
})
|
||||
},
|
||||
close () {
|
||||
this.visible = false
|
||||
this.model = {}
|
||||
},
|
||||
handleCancel () {
|
||||
this.close()
|
||||
},
|
||||
handleOk () {
|
||||
if (this.confirmLoading) return
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
this.confirmLoading = true
|
||||
const param = Object.assign({}, values)
|
||||
console.log(param)
|
||||
this.$emit('ok', param, this.index)
|
||||
this.close()
|
||||
this.confirmLoading = false
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
.content-left {
|
||||
width: 60%;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.content-right {
|
||||
width: 40%;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
}
|
||||
|
||||
</style>
|
||||
@@ -17,6 +17,32 @@
|
||||
:get-form-func="getFormFunc"
|
||||
:get-document-info-func="getDocumentInfoFunc"
|
||||
@submitFormData="submitFormData" />
|
||||
<div class="header-text-btn">
|
||||
<p class="header-text">稽查内容</p>
|
||||
<a-button icon="plus" type="primary" @click="handleAdd">{{ $t('newlyAdded') }}</a-button>
|
||||
</div>
|
||||
<div>
|
||||
<a-table
|
||||
:scroll="{x: 500}"
|
||||
:columns="columns"
|
||||
:dataSource="dataSource"
|
||||
:pagination="false"
|
||||
rowKey="id">
|
||||
|
||||
<template slot="text" slot-scope="text">
|
||||
<a-tooltip overlay-class-name="tooltip-style">
|
||||
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
|
||||
<div class="table-text">{{ text || text === 0 ? text : global.emptyLine }}</div>
|
||||
</a-tooltip>
|
||||
</template>
|
||||
|
||||
<!-- 操作栏 -->
|
||||
<template slot="action" slot-scope="text, record, index" class="action-span-cell">
|
||||
<a @click="handleEdit(record, index)" class="table-ope-btn">{{ $t('edit') }}</a>
|
||||
<a @click="handleDelete(index)" class="table-ope-btn" style="margin-left: 8px">{{ $t('delete') }}</a>
|
||||
</template>
|
||||
</a-table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="custom-drawer-style-bottom-btn">
|
||||
<a-button @click="handleOk" type="primary" style="margin-bottom: 0;">
|
||||
@@ -25,6 +51,7 @@
|
||||
<a-button @click="handleCancel" style="margin-bottom: 0;">{{ $t('close') }}</a-button>
|
||||
</div>
|
||||
</a-spin>
|
||||
<check-content-modal ref="checkContentModal" @ok="checkContentOk"></check-content-modal>
|
||||
</a-drawer>
|
||||
</template>
|
||||
|
||||
@@ -33,10 +60,11 @@ import '@assets/less/common.less'
|
||||
import AddForm from '@/components/customField/AddForm'
|
||||
import { getEnterpriseStandardAddForm, getEnterpriseStandardInfoById } from '@/api/enterpriseStandardLibraryApi'
|
||||
import { postAction } from '@/api/manage'
|
||||
import CheckContentModal from './CheckContentModal'
|
||||
|
||||
export default {
|
||||
name: 'EnterpriseStandardModal',
|
||||
components: { AddForm },
|
||||
components: { CheckContentModal, AddForm },
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
@@ -47,6 +75,29 @@ export default {
|
||||
confirmLoading: false,
|
||||
getFormFunc: getEnterpriseStandardAddForm,
|
||||
getDocumentInfoFunc: getEnterpriseStandardInfoById,
|
||||
columns: [
|
||||
{
|
||||
title: this.$t('enterpriseStandardLibrary.standard.subjectToClause'),
|
||||
align: 'center',
|
||||
width: 180,
|
||||
dataIndex: 'subjectToClause',
|
||||
scopedSlots: { customRender: 'text' }
|
||||
},
|
||||
{
|
||||
title: this.$t('enterpriseStandardLibrary.standard.standardContentOrRequirements'),
|
||||
align: 'center',
|
||||
width: 180,
|
||||
dataIndex: 'standardContentOrRequirements',
|
||||
scopedSlots: { customRender: 'text' }
|
||||
},
|
||||
{
|
||||
title: this.$t('operation'),
|
||||
scopedSlots: { customRender: 'action' },
|
||||
align: 'center',
|
||||
width: 200
|
||||
}
|
||||
],
|
||||
dataSource: [],
|
||||
url: {
|
||||
add: '/laws/standard/enterprise/commonAdd',
|
||||
edit: '/laws/standard/enterprise/commonEdit'
|
||||
@@ -66,6 +117,32 @@ export default {
|
||||
this.$refs.addForm.edit(record)
|
||||
})
|
||||
},
|
||||
// 稽查内容的添加
|
||||
handleAdd () {
|
||||
this.$refs.checkContentModal.title = this.$t('newlyAdded')
|
||||
this.$refs.checkContentModal.add()
|
||||
},
|
||||
// 稽查内容的编辑
|
||||
handleEdit (record, index) {
|
||||
console.log(record, index)
|
||||
this.$refs.checkContentModal.title = this.$t('edit')
|
||||
this.$refs.checkContentModal.edit(record, index)
|
||||
},
|
||||
// 稽查内容的删除
|
||||
handleDelete (index) {
|
||||
this.dataSource.splice(index, 1)
|
||||
},
|
||||
// 稽查内容新增编辑完成
|
||||
checkContentOk (value, index) {
|
||||
console.log(value, index)
|
||||
if (index || index === 0) {
|
||||
// 有下标,说明是编辑
|
||||
this.dataSource.splice(index, 1, value)
|
||||
} else {
|
||||
// 没有下标, 是新增
|
||||
this.dataSource.push(value)
|
||||
}
|
||||
},
|
||||
handleOk () {
|
||||
this.$refs.addForm.submit()
|
||||
},
|
||||
@@ -104,6 +181,14 @@ export default {
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
<style scoped lang="less">
|
||||
.header-text-btn {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 16px;
|
||||
.header-text {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user