|
@@ -16,29 +16,29 @@
|
|
|
<row-list :col="2">
|
|
|
<row-item>
|
|
|
<a-form-item
|
|
|
- label="检定设备"
|
|
|
+ label="测量设备编号"
|
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
>
|
|
|
<a-input
|
|
|
disabled
|
|
|
- v-decorator="['sbName', {rules: [{required: false, message: '检定设备不能为空'}]}]"/>
|
|
|
+ v-decorator="['cardNo']"/>
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
<row-item>
|
|
|
<a-form-item
|
|
|
- label="设备编号"
|
|
|
+ label="检定设备名称"
|
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
>
|
|
|
<a-input
|
|
|
disabled
|
|
|
- v-decorator="['sbNo']"/>
|
|
|
+ v-decorator="['sbName', {rules: [{required: false, message: '检定设备不能为空'}]}]"/>
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
<row-item>
|
|
|
<a-form-item
|
|
|
- label="设备型号"
|
|
|
+ label="型号"
|
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
>
|
|
@@ -47,38 +47,6 @@
|
|
|
v-decorator="['sbModel']"/>
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="上次检定日期"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- v-decorator="['checkDate']"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="检定有效期"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- v-decorator="['nextCheckDate']"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="测量编号"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['cardNo']"/>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
<row-item>
|
|
|
<a-form-item
|
|
|
label="检定周期"
|
|
@@ -86,7 +54,8 @@
|
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
>
|
|
|
<a-input
|
|
|
- suffix='月'
|
|
|
+ disabled
|
|
|
+ suffix="月"
|
|
|
v-decorator="['checkPeriod']"/>
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
@@ -122,16 +91,13 @@
|
|
|
v-decorator="['name']"/>
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
- </row-list>
|
|
|
- <row-list :col="1">
|
|
|
<row-item>
|
|
|
<a-form-item
|
|
|
- label="备注"
|
|
|
- :labelCol="BaseTool.Constant.labelCol2"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol2"
|
|
|
+ label="检定单位"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
>
|
|
|
- <a-textarea
|
|
|
- :rows="4"
|
|
|
+ <a-input
|
|
|
v-decorator="['requirement', {rules: [{required: false, message: '备注不能为空'}]}]"/>
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
@@ -175,169 +141,6 @@
|
|
|
</row-item>
|
|
|
</row-list>
|
|
|
</a-form>
|
|
|
-<!-- <a-tabs type="card" default-active-key="1">
|
|
|
- <a-tab-pane key="1" tab="点检标准参数">
|
|
|
- <div class="table-operator">
|
|
|
- <a-button size="small" type="primary" @click="handleAdd">
|
|
|
- <a-icon type="plus"/>
|
|
|
- 添加
|
|
|
- </a-button>
|
|
|
- <a-button class="margin-left8" size="small" type="danger" @click="handleDel">
|
|
|
- <a-icon type="delete"/>
|
|
|
- 删除
|
|
|
- </a-button>
|
|
|
- </div>
|
|
|
- <a-table
|
|
|
- bordered
|
|
|
- :data-source="data"
|
|
|
- :columns="columns"
|
|
|
- tableLayout="auto"
|
|
|
- rowKey="id"
|
|
|
- :row-selection="rowSelection">
|
|
|
- <template
|
|
|
- slot="name"
|
|
|
- slot-scope="text, record, index"
|
|
|
- >
|
|
|
- <div>
|
|
|
- <a-input
|
|
|
- class="my-form-item-required"
|
|
|
- v-if="record.editable"
|
|
|
- style="margin: -5px 0"
|
|
|
- :value="text"
|
|
|
- @change="e => handleChange(e.target.value, record.id, 'name')"
|
|
|
- />
|
|
|
- <template v-else>
|
|
|
- {{ text }}
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template
|
|
|
- slot="type"
|
|
|
- slot-scope="text, record, index"
|
|
|
- >
|
|
|
- <div>
|
|
|
- <a-select
|
|
|
- v-if="record.editable"
|
|
|
- style="width: 80px"
|
|
|
- :defaultValue="1"
|
|
|
- @change="e => handleChange(e, record.id, 'type')"
|
|
|
- placeholder="请选择">
|
|
|
- <a-select-option
|
|
|
- v-for="(label,value) in paramTypeMap"
|
|
|
- :key="value"
|
|
|
- :label="label"
|
|
|
- :value="parseInt(value)">{{ label }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- <template v-else>
|
|
|
- {{ BaseTool.Table.getMapText(paramTypeMap, text) }}
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template
|
|
|
- slot="upperLimit"
|
|
|
- slot-scope="text, record, index"
|
|
|
- >
|
|
|
- <div>
|
|
|
- <a-input
|
|
|
- v-if="record.editable"
|
|
|
- style="margin: -5px 0"
|
|
|
- :value="text"
|
|
|
- @change="e => handleChange(e.target.value, record.id, 'upperLimit')"
|
|
|
- />
|
|
|
- <template v-else>
|
|
|
- {{ text }}
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template
|
|
|
- slot="lowerrLimit"
|
|
|
- slot-scope="text, record, index"
|
|
|
- >
|
|
|
- <div>
|
|
|
- <a-input
|
|
|
- v-if="record.editable"
|
|
|
- style="margin: -5px 0"
|
|
|
- :value="text"
|
|
|
- @change="e => handleChange(e.target.value, record.id, 'lowerrLimit')"
|
|
|
- />
|
|
|
- <template v-else>
|
|
|
- {{ text }}
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template
|
|
|
- slot="referenceValue"
|
|
|
- slot-scope="text, record, index"
|
|
|
- >
|
|
|
- <div>
|
|
|
- <a-input
|
|
|
- v-if="record.editable"
|
|
|
- style="margin: -5px 0"
|
|
|
- :value="text"
|
|
|
- @change="e => handleChange(e.target.value, record.id, 'referenceValue')"
|
|
|
- />
|
|
|
- <template v-else>
|
|
|
- {{ text }}
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template
|
|
|
- slot="normalSelection"
|
|
|
- slot-scope="text, record, index"
|
|
|
- >
|
|
|
- <div>
|
|
|
- <a-input
|
|
|
- v-if="record.editable"
|
|
|
- style="margin: -5px 0"
|
|
|
- :value="text"
|
|
|
- @change="e => handleChange(e.target.value, record.id, 'normalSelection')"
|
|
|
- />
|
|
|
- <template v-else>
|
|
|
- {{ text }}
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template
|
|
|
- slot="instruction"
|
|
|
- slot-scope="text, record, index"
|
|
|
- >
|
|
|
- <div>
|
|
|
- <a-input
|
|
|
- v-if="record.editable"
|
|
|
- style="margin: -5px 0"
|
|
|
- :value="text"
|
|
|
- @change="e => handleChange(e.target.value, record.id, 'instruction')"
|
|
|
- />
|
|
|
- <template v-else>
|
|
|
- {{ text }}
|
|
|
- </template>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
-
|
|
|
- <template slot="operation" slot-scope="text, record, index">
|
|
|
- <div class="editable-row-operations">
|
|
|
- <span v-if="record.editable">
|
|
|
- <a @click="() => saveParam(record.id)">保存</a>
|
|
|
- <a-divider type="vertical"/>
|
|
|
- <a-popconfirm title="确定取消吗?" @confirm="() => cancel(record.id)">
|
|
|
- <a>取消</a>
|
|
|
- </a-popconfirm>
|
|
|
- </span>
|
|
|
- <span v-else>
|
|
|
- <a :disabled="editingKey !== ''" @click="() => edit(record.id)">编辑</a>
|
|
|
- </span>
|
|
|
- </div>
|
|
|
- </template>
|
|
|
- </a-table>
|
|
|
- </a-tab-pane>
|
|
|
- </a-tabs>-->
|
|
|
<template slot="footer">
|
|
|
<a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
|
|
|
</template>
|
|
@@ -385,72 +188,8 @@ export default {
|
|
|
headers: {
|
|
|
Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
|
|
|
},
|
|
|
- rowSelection: {
|
|
|
- onChange: (selectedRowKeys, selectedRows) => {
|
|
|
- this.selectedRowKeys = selectedRowKeys
|
|
|
- this.selectedRows = selectedRows
|
|
|
- }
|
|
|
- },
|
|
|
- // 表头
|
|
|
- columns: [
|
|
|
- {
|
|
|
- title: '序号',
|
|
|
- dataIndex: 'index',
|
|
|
- customRender: (text, record, index) => {
|
|
|
- return index + 1
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '名称',
|
|
|
- dataIndex: 'name',
|
|
|
- scopedSlots: { customRender: 'name' }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '类型',
|
|
|
- dataIndex: 'type',
|
|
|
- scopedSlots: { customRender: 'type' }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '上限',
|
|
|
- dataIndex: 'upperLimit',
|
|
|
- scopedSlots: { customRender: 'upperLimit' }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '下限',
|
|
|
- dataIndex: 'lowerrLimit',
|
|
|
- scopedSlots: { customRender: 'lowerrLimit' }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '参考值',
|
|
|
- dataIndex: 'referenceValue',
|
|
|
- scopedSlots: { customRender: 'referenceValue' }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '正常选型',
|
|
|
- dataIndex: 'normalSelection',
|
|
|
- scopedSlots: { customRender: 'normalSelection' }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '说明',
|
|
|
- dataIndex: 'instruction',
|
|
|
- scopedSlots: { customRender: 'instruction' }
|
|
|
- },
|
|
|
- {
|
|
|
- title: '操作',
|
|
|
- dataIndex: 'operation',
|
|
|
- width: 150,
|
|
|
- scopedSlots: { customRender: 'operation' }
|
|
|
- }
|
|
|
- ],
|
|
|
data: [],
|
|
|
- cacheData: [],
|
|
|
- selectedRowKeys: [],
|
|
|
- selectedRows: [],
|
|
|
- options: {
|
|
|
- rowSelection: {
|
|
|
- selectedRowKeys: this.selectedRowKeys
|
|
|
- }
|
|
|
- }
|
|
|
+ cacheData: []
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
@@ -478,7 +217,7 @@ export default {
|
|
|
const { form: { setFieldsValue } } = this
|
|
|
// 日期处理
|
|
|
this.$nextTick(() => {
|
|
|
- setFieldsValue({ sbId: sbInfo.id, sbNo: sbInfo.no, sbName: sbInfo.name })
|
|
|
+ setFieldsValue({ sbId: sbInfo.id, cardNo: sbInfo.cardNo, sbModel: sbInfo.model, sbName: sbInfo.name, checkPeriod: sbInfo.checkPeriod })
|
|
|
})
|
|
|
}
|
|
|
return
|
|
@@ -575,40 +314,6 @@ export default {
|
|
|
this.data = newData
|
|
|
}
|
|
|
},
|
|
|
- edit (key) {
|
|
|
- const newData = [...this.data]
|
|
|
- const target = newData.filter(item => key === item.id)[0]
|
|
|
- this.editingKey = key
|
|
|
- if (target) {
|
|
|
- target.editable = true
|
|
|
- this.data = newData
|
|
|
- }
|
|
|
- },
|
|
|
- saveParam (key) {
|
|
|
- const newData = [...this.data]
|
|
|
- const newCacheData = [...this.cacheData]
|
|
|
- const target = newData.filter(item => key === item.id)[0]
|
|
|
- // 校验数据
|
|
|
- if (!this.checkParams(target)) {
|
|
|
- return false
|
|
|
- }
|
|
|
- const targetCache = newCacheData.filter(item => key === item.id)[0]
|
|
|
- console.log(targetCache, 686688)
|
|
|
- if (target && targetCache) {
|
|
|
- delete target.editable
|
|
|
- this.data = newData
|
|
|
- Object.assign(targetCache, target)
|
|
|
- this.cacheData = newCacheData
|
|
|
- }
|
|
|
- this.editingKey = ''
|
|
|
- },
|
|
|
- checkParams (param) {
|
|
|
- if (BaseTool.Object.isBlank(param.name)) {
|
|
|
- this.$message.error('参数名称不能为空')
|
|
|
- return false
|
|
|
- }
|
|
|
- return true
|
|
|
- },
|
|
|
cancel (key) {
|
|
|
const newData = [...this.data]
|
|
|
const target = newData.filter(item => key === item.id)[0]
|
|
@@ -627,43 +332,6 @@ export default {
|
|
|
this.data = newData
|
|
|
}
|
|
|
},
|
|
|
- handleAdd () {
|
|
|
- if (this.editingKey !== '') {
|
|
|
- this.$message.error('请保存后再添加')
|
|
|
- return false
|
|
|
- }
|
|
|
- const { data, cacheData } = this
|
|
|
- console.log(this.data, this.cacheData)
|
|
|
- const newParam = this.getNewParam()
|
|
|
- const newCache = { ...newParam }
|
|
|
- data.push(newParam)
|
|
|
- cacheData.push(newCache)
|
|
|
- },
|
|
|
- handleDel () {
|
|
|
- const data = [...this.data]
|
|
|
- const cacheData = [...this.cacheData]
|
|
|
- this.data = data.filter(item => !this.selectedRowKeys.includes(item.id))
|
|
|
- this.cacheData = cacheData.filter(item => !this.selectedRowKeys.includes(item.id))
|
|
|
- if (this.selectedRowKeys.includes(this.editingKey)) {
|
|
|
- this.editingKey = ''
|
|
|
- }
|
|
|
- },
|
|
|
- getNewParam () {
|
|
|
- const newParam = {
|
|
|
- name: '',
|
|
|
- type: '1',
|
|
|
- upperLimit: '',
|
|
|
- lowerrLimit: '',
|
|
|
- referenceValue: '',
|
|
|
- normalSelection: '',
|
|
|
- instruction: ''
|
|
|
- }
|
|
|
- newParam.id = new Date().getTime()
|
|
|
- newParam.editable = true
|
|
|
- this.editingKey = newParam.id
|
|
|
- console.log(newParam, 'newparam')
|
|
|
- return newParam
|
|
|
- },
|
|
|
handleCheckImgChange (info) {
|
|
|
this.defaultCheckImgList = info.fileList
|
|
|
this.checkImgList = this.setFileList(info, 31)
|