update 企标稽查流程
This commit is contained in:
+46
-17
@@ -22,14 +22,14 @@
|
||||
<a-input :placeholder="$t('pleaseEnter') + $t('workCenter.esInspectionProcess.sectionNumber')"
|
||||
:maxLength="50"
|
||||
@change="event => event.target.value = event.target.value.trim()"
|
||||
v-decorator.trim="[ 'sectionNumber', validatorRules.sectionNumber ]" />
|
||||
v-decorator.trim="[ 'standardNo', validatorRules.sectionNumber ]" />
|
||||
</a-form-item>
|
||||
<!-- 标准内容或要求 -->
|
||||
<a-form-item :labelCol="labelCol" :wrapperCol="wrapperCol" :label="$t('workCenter.esInspectionProcess.standardContentOrDemand')">
|
||||
<a-input :placeholder="$t('pleaseEnter') + $t('workCenter.esInspectionProcess.standardContentOrDemand')"
|
||||
:maxLength="50"
|
||||
@change="event => event.target.value = event.target.value.trim()"
|
||||
v-decorator.trim="[ 'standardContentOrDemand', validatorRules.standardContentOrDemand ]" />
|
||||
v-decorator.trim="[ 'requirement', validatorRules.standardContentOrDemand ]" />
|
||||
</a-form-item>
|
||||
</a-form>
|
||||
</a-spin>
|
||||
@@ -53,11 +53,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import pick from 'lodash.pick'
|
||||
import { getFileInfo } from '@/api/api'
|
||||
import { previewPdf } from '@/utils/previewPdf'
|
||||
import Vue from 'vue'
|
||||
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||
import { addInspectionContentTable, editInspectionContentTable } from '@api/workCenter'
|
||||
|
||||
const Base64 = require('js-base64').Base64
|
||||
|
||||
@@ -69,6 +69,9 @@ export default {
|
||||
visible: false,
|
||||
confirmLoading: false,
|
||||
form: this.$form.createForm(this),
|
||||
// 父表的当前行数据
|
||||
data: {},
|
||||
// 当前表的当前行数据
|
||||
model: {},
|
||||
labelCol: {
|
||||
xs: { span: 24 },
|
||||
@@ -99,23 +102,25 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
add (file) {
|
||||
this.getFileInfo(file).then(res => {
|
||||
add (data) {
|
||||
this.data = Object.assign({}, data)
|
||||
this.getFileInfo(data.file).then(res => {
|
||||
this.handlePreview(res)
|
||||
})
|
||||
this.visible = true
|
||||
this.form.resetFields()
|
||||
},
|
||||
edit (file, record, index) {
|
||||
this.getFileInfo(file).then(res => {
|
||||
edit (data, record, index) {
|
||||
this.getFileInfo(data.file).then(res => {
|
||||
this.handlePreview(res)
|
||||
})
|
||||
this.visible = true
|
||||
this.index = index
|
||||
this.form.resetFields()
|
||||
this.data = Object.assign({}, data)
|
||||
this.model = Object.assign({}, record)
|
||||
this.$nextTick(() => {
|
||||
this.form.setFieldsValue(pick(this.model, 'sectionNumber', 'standardContentOrDemand'))
|
||||
this.form.setFieldsValue(this.model)
|
||||
})
|
||||
},
|
||||
getFileInfo (fileId) {
|
||||
@@ -158,12 +163,24 @@ export default {
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
this.confirmLoading = true
|
||||
const param = Object.assign({}, values)
|
||||
const param = Object.assign({}, this.model, values)
|
||||
if (!param.processEsInspectId) {
|
||||
param.processEsInspectId = this.data.id
|
||||
}
|
||||
console.log(param)
|
||||
this.$emit('ok', param, this.index)
|
||||
this.form.resetFields()
|
||||
this.model = {}
|
||||
this.confirmLoading = false
|
||||
const fn = param.id ? editInspectionContentTable : addInspectionContentTable
|
||||
fn(param).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
this.$emit('ok', param, this.index)
|
||||
this.form.resetFields()
|
||||
this.model = {}
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -172,11 +189,23 @@ export default {
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
this.confirmLoading = true
|
||||
const param = Object.assign({}, values)
|
||||
const param = Object.assign({}, this.model, values)
|
||||
if (!this.model.processEsInspectId) {
|
||||
param.processEsInspectId = this.data.id
|
||||
}
|
||||
console.log(param)
|
||||
this.$emit('ok', param, this.index)
|
||||
this.close()
|
||||
this.confirmLoading = false
|
||||
const fn = param.id ? editInspectionContentTable : addInspectionContentTable
|
||||
fn(param).then(res => {
|
||||
if (res.success) {
|
||||
this.$message.success(res.message)
|
||||
this.$emit('ok', param, this.index)
|
||||
this.close()
|
||||
} else {
|
||||
this.$message.warn(res.message)
|
||||
}
|
||||
}).finally(() => {
|
||||
this.confirmLoading = false
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user