|
@@ -1,17 +1,23 @@
|
|
|
<template>
|
|
|
- <a-card :bordered="false" :title="modalTitle" v-show="visible">
|
|
|
- <a-row :gutter="48" slot="extra">
|
|
|
+ <a-modal
|
|
|
+ :title="modalTitle"
|
|
|
+ :width="900"
|
|
|
+ :visible="visible"
|
|
|
+ :confirmLoading="confirmLoading"
|
|
|
+ @cancel="handleCancel">
|
|
|
+<!-- <a-row :gutter="48" slot="extra">
|
|
|
<a-col :md="48" :sm="48">
|
|
|
<span class="table-page-search-submitButtons" style="float: right" >
|
|
|
<a-button style="margin-left: 8px" type="primary" @click="save()">保存</a-button>
|
|
|
<a-button style="margin-left: 8px" @click="handleCancel()">返回列表</a-button>
|
|
|
</span>
|
|
|
</a-col>
|
|
|
- </a-row>
|
|
|
+ </a-row>-->
|
|
|
<a-form :form="form">
|
|
|
|
|
|
<a-form-item v-show="false" >
|
|
|
<a-input v-decorator="['id']" type="hidden"/>
|
|
|
+ <a-input v-decorator="['sbId']" type="hidden"/>
|
|
|
<a-input v-decorator="['typeId']" type="hidden"/>
|
|
|
</a-form-item>
|
|
|
<a-form-item v-show="false" >
|
|
@@ -20,116 +26,27 @@
|
|
|
<a-form-item v-show="false" >
|
|
|
<a-input v-decorator="['unitBz']" type="hidden"/>
|
|
|
</a-form-item>
|
|
|
- <a-form-item v-show="false" >
|
|
|
- <a-input v-decorator="['ggxh']" type="hidden"/>
|
|
|
- </a-form-item>
|
|
|
<a-form-item v-show="false">
|
|
|
<a-input v-decorator="['producerId']" />
|
|
|
</a-form-item>
|
|
|
-<!-- <title-divider title="集团统一编码" width="150px"></title-divider>
|
|
|
- <row-list :col="2">
|
|
|
- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="集团统一编码"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- v-decorator="['uniteNo']" />
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- </row-list>-->
|
|
|
- <title-divider title="编码设置" width="150px"></title-divider>
|
|
|
+ <title-divider title="类型设置" width="150px"></title-divider>
|
|
|
<row-list :col="2">
|
|
|
<row-item>
|
|
|
<a-form-item
|
|
|
- label="一级类别"
|
|
|
+ label="类别"
|
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
>
|
|
|
- <a-select
|
|
|
- @select="parentChange"
|
|
|
+ <a-tree-select
|
|
|
+ style="width: 100%"
|
|
|
+ :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
|
|
|
+ :treeData="spareTypeData"
|
|
|
+ :treeNodeFilterProp="'title'"
|
|
|
+ :showSearch="true"
|
|
|
v-decorator="['parentTypeId', {rules: [{required: true, message: '类别不能为空'}]}]"
|
|
|
- placeholder="请选择">
|
|
|
- <a-select-option
|
|
|
- v-for="({id,name,no}) in spareTypeData"
|
|
|
- :key="no"
|
|
|
- :label="no"
|
|
|
- :value="id">{{ name + '(' + no + ')' }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="一级编码"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- v-decorator="['parentNo']" />
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="二级类别"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-select
|
|
|
- @select="middleChange"
|
|
|
- v-decorator="['middleTypeId']"
|
|
|
- placeholder="请选择">
|
|
|
- <a-select-option
|
|
|
- v-for="({id,name,no}) in spareTypeDataMiddle"
|
|
|
- :key="no"
|
|
|
- :label="no"
|
|
|
- :value="id">{{ name + '(' + no + ')' }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="二级编码"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- v-decorator="['middleNo']" />
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="三级类别"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-select
|
|
|
- @select="childChange"
|
|
|
- v-decorator="['childTypeId']"
|
|
|
- placeholder="请选择">
|
|
|
- <a-select-option
|
|
|
- v-for="({id,name,no}) in spareTypeDataChild"
|
|
|
- :key="no"
|
|
|
- :label="name"
|
|
|
- :value="id">{{ name + '(' + no + ')' }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="三级编码"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- disabled
|
|
|
- v-decorator="['childNo']" />
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ </a-tree-select>
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
<row-item>
|
|
@@ -142,18 +59,6 @@
|
|
|
v-decorator="['name', {rules: [{required: true, message: '设备名称不能为空'}]}]" />
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
-<!-- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="名称编码"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- style="width: 70%"
|
|
|
- v-decorator="['nameNo']" />
|
|
|
- <a-button style="width: 30%" type="default" @click="checkSpareNo">查询编码</a-button>
|
|
|
- </a-form-item>
|
|
|
- </row-item>-->
|
|
|
<row-item>
|
|
|
<a-form-item
|
|
|
label="规格型号"
|
|
@@ -162,44 +67,9 @@
|
|
|
>
|
|
|
<a-input
|
|
|
v-decorator="['ggxh']" />
|
|
|
- <!--<a-select
|
|
|
- show-search
|
|
|
- :value="gg"
|
|
|
- :default-active-first-option="false"
|
|
|
- :show-arrow="true"
|
|
|
- :filter-option="true"
|
|
|
- :not-found-content="null"
|
|
|
- @search="handleSearchG"
|
|
|
- @blur="handleBlurG"
|
|
|
- @change="handleChangeG">
|
|
|
- <a-select-option
|
|
|
- v-for="({value, label}) in ggList"
|
|
|
- :key="value"
|
|
|
- :label="label"
|
|
|
- :value="value">{{ label }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>-->
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
-<!-- <row-item>
|
|
|
- <a-form-item
|
|
|
- label="规格型号编码"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['ggNo']" />
|
|
|
- </a-form-item>
|
|
|
- </row-item>-->
|
|
|
</row-list>
|
|
|
-<!-- <title-divider title="备件编号查询列表" width="150px"></title-divider>
|
|
|
- <a-table
|
|
|
- :data-source="data"
|
|
|
- :columns="columns"
|
|
|
- tableLayout="auto"
|
|
|
- rowKey="id">
|
|
|
- </a-table>-->
|
|
|
- <title-divider title="基础信息设置" width="150px"></title-divider>
|
|
|
<row-list :col="2">
|
|
|
<row-item>
|
|
|
<a-form-item
|
|
@@ -338,15 +208,15 @@
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
<row-item>
|
|
|
- <a-form-item
|
|
|
- label="折算系数"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- placeholder="单位折算为包装单位,如24个单位包装为一箱"
|
|
|
- v-decorator="['unitRate']" />
|
|
|
- </a-form-item>
|
|
|
+ <a-form-item
|
|
|
+ label="折算系数"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ placeholder="单位折算为包装单位,如24个单位包装为一箱"
|
|
|
+ v-decorator="['unitRate']" />
|
|
|
+ </a-form-item>
|
|
|
</row-item>
|
|
|
<row-item>
|
|
|
<a-form-item
|
|
@@ -400,32 +270,25 @@
|
|
|
</a-form-item>
|
|
|
</row-item>
|
|
|
<row-item>
|
|
|
- <a-form-item
|
|
|
- label="备件图片"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <upload-spare-file
|
|
|
- ref="imageUpload"
|
|
|
- @catchImage="catchImage"
|
|
|
- ></upload-spare-file>
|
|
|
- </a-form-item>
|
|
|
- </row-item>
|
|
|
- <row-item>
|
|
|
- <!--<a-form-item
|
|
|
- label="类型用途"
|
|
|
+ <a-form-item
|
|
|
+ label="备件图片"
|
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
>
|
|
|
- <a-select v-decorator="['yt', {rules: [{required: true, message: '类型用途不能为空'}]}]" placeholder="请选择">
|
|
|
- <a-select-option
|
|
|
- v-for="(label,value) in ytMap"
|
|
|
- :key="value"
|
|
|
- :label="label"
|
|
|
- :value="parseInt(value)">{{ label }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>-->
|
|
|
+ <a-upload
|
|
|
+ :action="uploadUrl"
|
|
|
+ :multiple="true"
|
|
|
+ list-type="picture"
|
|
|
+ :file-list="this.defaultApplicationFileList"
|
|
|
+ @change="handleApplicationFileChange"
|
|
|
+ accept="image/*"
|
|
|
+ :headers="headers"
|
|
|
+ >
|
|
|
+ <a-button> <a-icon type="upload" /> 上传图片 </a-button>
|
|
|
+ </a-upload>
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <row-item>
|
|
|
<a-form-item
|
|
|
label="备注"
|
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
@@ -437,18 +300,23 @@
|
|
|
</row-item>
|
|
|
</row-list>
|
|
|
</a-form>
|
|
|
-
|
|
|
+ <template slot="footer">
|
|
|
+ <a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
|
|
|
+ </template>
|
|
|
<firm-producer-select-modal ref="producerSelectModal" @selected="handleProducerSelected"/>
|
|
|
- </a-card>
|
|
|
+ </a-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import pick from 'lodash.pick'
|
|
|
import { addSparePartInfo, querySparePartInfo, updateSparePartInfo } from '@/api/sqarepartmanage/sparepartinfo'
|
|
|
-import { querySpareType } from '@/api/sqarepartmanage/sparetype'
|
|
|
+import { querySpareType, fetchSpareTypeTree } from '@/api/sqarepartmanage/sparetype'
|
|
|
import { fetchSbGuigeOptions } from '@/api/sb/guige'
|
|
|
import FirmProducerSelectModal from '@/views/firm/producer/modules/FirmProducerSelectModal'
|
|
|
import UploadSpareFile from '@/components/Upload/UploadSpareFile'
|
|
|
+import Vue from 'vue'
|
|
|
+import { uploadUrl } from '@/api/upms/file'
|
|
|
+import { ACCESS_TOKEN } from '@/store/mutation-types'
|
|
|
|
|
|
export default {
|
|
|
name: 'BaseSparePartInfo',
|
|
@@ -461,7 +329,9 @@ export default {
|
|
|
unitName: null,
|
|
|
unitNameBz: null,
|
|
|
gg: null,
|
|
|
- image: '',
|
|
|
+ uploadUrl: uploadUrl,
|
|
|
+ defaultApplicationFileList: [],
|
|
|
+ applicationFileList: [], // 备件图片
|
|
|
confirmLoading: false,
|
|
|
modalTitle: null,
|
|
|
form: this.$form.createForm(this),
|
|
@@ -476,6 +346,9 @@ export default {
|
|
|
spareTypeDataChild: [],
|
|
|
producers: [],
|
|
|
ggList: [],
|
|
|
+ headers: {
|
|
|
+ Authorization: 'Bearer ' + Vue.ls.get(ACCESS_TOKEN)
|
|
|
+ },
|
|
|
// 表头
|
|
|
columns: [
|
|
|
{
|
|
@@ -523,7 +396,8 @@ export default {
|
|
|
dataIndex: 'ggNo'
|
|
|
}
|
|
|
],
|
|
|
- data: []
|
|
|
+ data: [],
|
|
|
+ sbId: null
|
|
|
}
|
|
|
},
|
|
|
props: {
|
|
@@ -536,13 +410,14 @@ export default {
|
|
|
this.ytMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_USE_TYPE)
|
|
|
},
|
|
|
methods: {
|
|
|
- base (record) {
|
|
|
+ base (record, sbId) {
|
|
|
this.setTree(record)
|
|
|
this.visible = true
|
|
|
+ this.sbId = sbId
|
|
|
+ console.log('sbId: ', sbId)
|
|
|
// 如果是空标识添加
|
|
|
if (this.BaseTool.Object.isBlank(record)) {
|
|
|
this.modalTitle = '添加'
|
|
|
- this.$refs.imageUpload.base(1, [])
|
|
|
return
|
|
|
}
|
|
|
this.modalTitle = '编辑'
|
|
@@ -550,6 +425,8 @@ export default {
|
|
|
this.modalTitle = '复制'
|
|
|
}
|
|
|
const { form: { setFieldsValue } } = this
|
|
|
+ this.applicationFileList = record.applicationFileList
|
|
|
+ this.defaultApplicationFileList = this.BaseTool.UPLOAD.transImg(this.applicationFileList)
|
|
|
this.unitName = record.unit
|
|
|
this.unitNameBz = record.unitBz
|
|
|
this.gg = record.ggxh
|
|
@@ -558,6 +435,7 @@ export default {
|
|
|
setFieldsValue(Object.assign(pick(record, [
|
|
|
'id',
|
|
|
'no',
|
|
|
+ 'sbId',
|
|
|
'initNo',
|
|
|
'uniteNo',
|
|
|
'nameNo',
|
|
@@ -591,36 +469,23 @@ export default {
|
|
|
'minStock',
|
|
|
'remark'
|
|
|
])))
|
|
|
- this.image = record.image
|
|
|
- const fileList = []
|
|
|
- if (record.image) {
|
|
|
- fileList.push({
|
|
|
- uid: '-1',
|
|
|
- name: record.title,
|
|
|
- status: 'done',
|
|
|
- url: this.BaseTool.Constant.FILE_URL + record.image,
|
|
|
- originUrl: record.image
|
|
|
- })
|
|
|
- }
|
|
|
- this.$refs.imageUpload.base(1, fileList)
|
|
|
})
|
|
|
},
|
|
|
save () {
|
|
|
const { form: { validateFieldsAndScroll, setFieldsValue } } = this
|
|
|
this.confirmLoading = true
|
|
|
+ console.log('sbId: ' + this.sbId)
|
|
|
setFieldsValue({
|
|
|
'unit': this.unitName,
|
|
|
- 'unitBz': this.unitNameBz
|
|
|
+ 'unitBz': this.unitNameBz,
|
|
|
+ 'sbId': this.sbId
|
|
|
})
|
|
|
validateFieldsAndScroll((errors, values) => {
|
|
|
if (errors) {
|
|
|
this.confirmLoading = false
|
|
|
return
|
|
|
}
|
|
|
- values = {
|
|
|
- ...values,
|
|
|
- image: this.image
|
|
|
- }
|
|
|
+ values.applicationFileList = this.applicationFileList
|
|
|
// 日期处理
|
|
|
if (this.BaseTool.String.isBlank(values.id)) {
|
|
|
addSparePartInfo(values)
|
|
@@ -670,15 +535,15 @@ export default {
|
|
|
* 设置备件类别树
|
|
|
*/
|
|
|
setTree (record = {}) {
|
|
|
- querySpareType({ filter: 1 }).then(res => {
|
|
|
+ fetchSpareTypeTree({ }).then(res => {
|
|
|
this.spareTypeData = res.data
|
|
|
})
|
|
|
- querySpareType({ filter: 2, parentId: record.parentTypeId }).then(res => {
|
|
|
+ /*querySpareType({ filter: 2, parentId: record.parentTypeId }).then(res => {
|
|
|
this.spareTypeDataMiddle = res.data
|
|
|
})
|
|
|
querySpareType({ filter: 2, parentId: record.middleTypeId }).then(res => {
|
|
|
this.spareTypeDataChild = res.data
|
|
|
- })
|
|
|
+ })*/
|
|
|
fetchSbGuigeOptions().then(res => {
|
|
|
this.ggList = res.data
|
|
|
})
|
|
@@ -803,9 +668,20 @@ export default {
|
|
|
const { form: { setFieldsValue } } = this
|
|
|
setFieldsValue({ childNo: option.data.key, typeId: val, childTypeId: val })
|
|
|
},
|
|
|
- catchImage (fileList) {
|
|
|
- if (fileList.length !== 0) {
|
|
|
- this.image = fileList[0].url
|
|
|
+ handleApplicationFileChange (info) {
|
|
|
+ this.defaultApplicationFileList = info.fileList
|
|
|
+ this.applicationFileList = this.setFileList(info, 14)
|
|
|
+ },
|
|
|
+ setFileList (info, type) {
|
|
|
+ const file = info.file
|
|
|
+ const fileList = info.fileList
|
|
|
+ if (file.status === 'done') {
|
|
|
+ return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
|
|
|
+ } else if (file.status === 'removed') {
|
|
|
+ return this.BaseTool.UPLOAD.getUploadFileDTO(fileList, type)
|
|
|
+ } else if (file.status === 'error') {
|
|
|
+ this.$message.error('上传失败')
|
|
|
+ return []
|
|
|
}
|
|
|
}
|
|
|
}
|