|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<a-modal
|
|
|
:title="modalTitle"
|
|
|
- :width="800"
|
|
|
+ :width="1300"
|
|
|
:visible="visible"
|
|
|
:confirmLoading="confirmLoading"
|
|
|
@cancel="handleCancel"
|
|
@@ -11,110 +11,167 @@
|
|
|
<a-form-item v-show="false" >
|
|
|
<a-input v-decorator="['id']" type="hidden"/>
|
|
|
</a-form-item>
|
|
|
-
|
|
|
- <a-form-item
|
|
|
- label="位号"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['no', {rules: [{required: true, message: '位号不能为空'}]}]" />
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="名称"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['name', {rules: [{required: true, message: '名称不能为空'}]}]" />
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="类型"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-select v-decorator="['type', {rules: [{required: true, message: '类型不能为空'}]}]" placeholder="请选择">
|
|
|
- <a-select-option
|
|
|
- v-for="(label,value) in positionTypeMap"
|
|
|
- :key="value"
|
|
|
- :label="label"
|
|
|
- :value="parseInt(value)">{{ label }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="上层位置"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-tree-select
|
|
|
- style="width: 100%"
|
|
|
- :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
|
|
|
- :treeData="treeData"
|
|
|
- :treeNodeFilterProp="'title'"
|
|
|
- :showSearch="true"
|
|
|
- v-decorator="['parentId', {rules: [{required: false, message: '上层位置不能为空'}]}]"
|
|
|
- placeholder="请选择"
|
|
|
- >
|
|
|
- </a-tree-select>
|
|
|
- </a-form-item>
|
|
|
- <!-- <a-form-item
|
|
|
+ <row-list :col="2">
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="位号"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input
|
|
|
+ v-decorator="['no', {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
|
|
|
+ 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-select v-decorator="['type', {rules: [{required: true, message: '类型不能为空'}]}]" placeholder="请选择">
|
|
|
+ <a-select-option
|
|
|
+ v-for="(label,value) in positionTypeMap"
|
|
|
+ :key="value"
|
|
|
+ :label="label"
|
|
|
+ :value="parseInt(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-tree-select
|
|
|
+ style="width: 100%"
|
|
|
+ :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
|
|
|
+ :treeData="treeData"
|
|
|
+ :treeNodeFilterProp="'title'"
|
|
|
+ :showSearch="true"
|
|
|
+ v-decorator="['parentId', {rules: [{required: false, message: '上层位置不能为空'}]}]"
|
|
|
+ @change="changeParent"
|
|
|
+ placeholder="请选择"
|
|
|
+ >
|
|
|
+ </a-tree-select>
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <!-- <row-item>
|
|
|
+ <a-form-item
|
|
|
label="父子关联编码"
|
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
>
|
|
|
<a-input
|
|
|
v-decorator="['code', {rules: [{required: true, message: '父子关联编码不能为空'}]}]" />
|
|
|
- </a-form-item>-->
|
|
|
- <a-form-item
|
|
|
- label="区域维修负责人"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-select v-decorator="['userId', {rules: [{required: true, message: '仓库负责人不能为空'}]}]" placeholder="请选择">
|
|
|
- <a-select-option
|
|
|
- v-for="({userId, realName}) in userList"
|
|
|
- :key="userId"
|
|
|
- :label="realName"
|
|
|
- :value="userId">{{ realName }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="排序"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input-number
|
|
|
- style="width: 100%"
|
|
|
- :min="1"
|
|
|
- v-decorator="['sort', {initialValue:1,rules: [{required: true, message: '排序不能为空'}]}]" />
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="是否有电子地图"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-select v-decorator="['opcFlag', {initialValue:DictCache.VALUE.DELFLAG.NORMAL, rules: [{required: false, message: '是否OPC展示不能为空'}]}]" placeholder="请选择">
|
|
|
- <a-select-option
|
|
|
- v-for="(label,value) in yesNoMap"
|
|
|
- :key="value"
|
|
|
- :label="label"
|
|
|
- :value="parseInt(value)">{{ label }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
</a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="电子地图图片"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <upload-position-img
|
|
|
- ref="imageUpload"
|
|
|
- @catchImage="catchImage"
|
|
|
- ></upload-position-img>
|
|
|
- </a-form-item>
|
|
|
- <!--<a-form-item
|
|
|
+ </row-item>-->
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="区域维修负责人"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-select v-decorator="['userId', {rules: [{required: true, message: '仓库负责人不能为空'}]}]" placeholder="请选择">
|
|
|
+ <a-select-option
|
|
|
+ v-for="({userId, realName}) in userList"
|
|
|
+ :key="userId"
|
|
|
+ :label="realName"
|
|
|
+ :value="userId">{{ realName }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <row-item v-if="parentId">
|
|
|
+ <a-form-item
|
|
|
+ label="仓库位置"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input-group size="large">
|
|
|
+ <a-row :gutter="8">
|
|
|
+ <a-col :span="10">
|
|
|
+ <a-input-number
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
+ style="width:100%"
|
|
|
+ disabled
|
|
|
+ :formatter="value => `X ${value}`"
|
|
|
+ :parser="value => value.replace('X', '')"
|
|
|
+ v-decorator="['positionX', {rules: [{required: true, message: 'X坐标不能为空'}]}]"
|
|
|
+ />
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="10">
|
|
|
+ <a-input-number
|
|
|
+ :min="0"
|
|
|
+ :max="100"
|
|
|
+ style="width:100%"
|
|
|
+ disabled
|
|
|
+ :formatter="value => `Y ${value}`"
|
|
|
+ :parser="value => value.replace('Y', '')"
|
|
|
+ v-decorator="['positionY', {rules: [{required: true, message: 'Y坐标不能为空'}]}]"
|
|
|
+ />
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="4">
|
|
|
+ <a-button @click="openPositionMap" type="primary">选择</a-button>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-input-group>
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="排序"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-input-number
|
|
|
+ style="width: 100%"
|
|
|
+ :min="1"
|
|
|
+ v-decorator="['sort', {initialValue:1,rules: [{required: true, message: '排序不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="是否有电子地图"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-select v-decorator="['opcFlag', {initialValue:DictCache.VALUE.DELFLAG.NORMAL, rules: [{required: false, message: '是否OPC展示不能为空'}]}]" placeholder="请选择" @change="(val)=>opcFlag=val" >
|
|
|
+ <a-select-option
|
|
|
+ v-for="(label,value) in yesNoMap"
|
|
|
+ :key="value"
|
|
|
+ :label="label"
|
|
|
+ :value="parseInt(value)">{{ label }}
|
|
|
+ </a-select-option>
|
|
|
+ </a-select>
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <row-item v-if="opcFlag">
|
|
|
+ <a-form-item
|
|
|
+ label="电子地图图片"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <upload-position-img
|
|
|
+ ref="imageUpload"
|
|
|
+ @catchImage="catchImage"
|
|
|
+ ></upload-position-img>
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ <!--<row-item>
|
|
|
+ <a-form-item
|
|
|
label="是否防雷车间"
|
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
@@ -128,7 +185,9 @@
|
|
|
</a-select-option>
|
|
|
</a-select>
|
|
|
</a-form-item>
|
|
|
- <a-form-item
|
|
|
+ </row-item>
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
label="防雷点位图片"
|
|
|
:labelCol="BaseTool.Constant.labelCol"
|
|
|
:wrapperCol="BaseTool.Constant.wrapperCol"
|
|
@@ -137,45 +196,54 @@
|
|
|
ref="imageUploadLight"
|
|
|
@catchImageLight="catchImageLight"
|
|
|
></upload-position-light-img>
|
|
|
- </a-form-item>-->
|
|
|
- <a-form-item
|
|
|
- label="是否删除"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-select v-decorator="['delFlag', {initialValue:DictCache.VALUE.DELFLAG.NORMAL, rules: [{required: true, message: '是否删除不能为空'}]}]" placeholder="请选择">
|
|
|
- <a-select-option
|
|
|
- v-for="(label,value) in delFlagMap"
|
|
|
- :key="value"
|
|
|
- :label="label"
|
|
|
- :value="parseInt(value)">{{ label }}
|
|
|
- </a-select-option>
|
|
|
- </a-select>
|
|
|
- </a-form-item>
|
|
|
- <a-form-item
|
|
|
- label="备注"
|
|
|
- :labelCol="BaseTool.Constant.labelCol"
|
|
|
- :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
- >
|
|
|
- <a-input
|
|
|
- v-decorator="['remark', {rules: [{required: false, message: '备注不能为空'}]}]" />
|
|
|
</a-form-item>
|
|
|
+ </row-item>-->
|
|
|
+ <row-item>
|
|
|
+ <a-form-item
|
|
|
+ label="是否删除"
|
|
|
+ :labelCol="BaseTool.Constant.labelCol"
|
|
|
+ :wrapperCol="BaseTool.Constant.wrapperCol"
|
|
|
+ >
|
|
|
+ <a-select v-decorator="['delFlag', {initialValue:1, rules: [{required: true, message: '是否删除不能为空'}]}]" placeholder="请选择">
|
|
|
+ <a-select-option
|
|
|
+ v-for="(label,value) in delFlagMap"
|
|
|
+ :key="value"
|
|
|
+ :label="label"
|
|
|
+ :value="parseInt(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="['remark', {rules: [{required: false, message: '备注不能为空'}]}]" />
|
|
|
+ </a-form-item>
|
|
|
+ </row-item>
|
|
|
+ </row-list>
|
|
|
+
|
|
|
</a-form>
|
|
|
<template slot="footer">
|
|
|
<a-button :loading="confirmLoading" type="primary" @click="save()">保存</a-button>
|
|
|
</template>
|
|
|
+ <PositionMap ref="position" @ok="handleSelectPosition" :opcImg="parentImg" />
|
|
|
</a-modal>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import pick from 'lodash.pick'
|
|
|
-import { addSbPosition, updateSbPosition, getSbPositionTree } from '@/api/sb/position'
|
|
|
+import { addSbPosition, updateSbPosition, getSbPositionTree, fetchSbPosition } from '@/api/sb/position'
|
|
|
import { queryRepairUser } from '@/api/upms/user-dept'
|
|
|
import UploadPositionImg from '@/components/Upload/UploadPositionImg'
|
|
|
import UploadPositionLightImg from '@/components/Upload/UploadPositionLightImg'
|
|
|
+import PositionMap from '@/views/store/store/modules/PositionMap.vue'
|
|
|
export default {
|
|
|
name: 'BaseSbPosition',
|
|
|
- components: { UploadPositionImg, UploadPositionLightImg },
|
|
|
+ components: { UploadPositionImg, UploadPositionLightImg, PositionMap },
|
|
|
data () {
|
|
|
return {
|
|
|
confirmLoading: false,
|
|
@@ -183,7 +251,10 @@ export default {
|
|
|
form: this.$form.createForm(this),
|
|
|
visible: false,
|
|
|
opcImg: '',
|
|
|
+ parentImg: '',
|
|
|
+ parentId: '',
|
|
|
lightImg: '',
|
|
|
+ opcFlag: 0,
|
|
|
positionTypeMap: {},
|
|
|
delFlagMap: {},
|
|
|
userList: {},
|
|
@@ -215,6 +286,8 @@ export default {
|
|
|
if (this.BaseTool.Object.isBlank(record.id)) {
|
|
|
this.modalTitle = '复制'
|
|
|
}
|
|
|
+ this.opcFlag = record.opcFlag
|
|
|
+ this.changeParent(record.parentId)
|
|
|
const { form: { setFieldsValue } } = this
|
|
|
this.$nextTick(() => {
|
|
|
setFieldsValue(Object.assign(pick(record, [
|
|
@@ -229,7 +302,9 @@ export default {
|
|
|
'delFlag',
|
|
|
'parentId',
|
|
|
'userId',
|
|
|
- 'remark'
|
|
|
+ 'remark',
|
|
|
+ 'positionY',
|
|
|
+ 'positionX'
|
|
|
])))
|
|
|
})
|
|
|
this.opcImg = record.opcImg
|
|
@@ -295,6 +370,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+
|
|
|
handleCancel (values) {
|
|
|
this.visible = false
|
|
|
this.confirmLoading = false
|
|
@@ -311,6 +387,30 @@ export default {
|
|
|
console.log(res.data)
|
|
|
this.treeData = res.data
|
|
|
})
|
|
|
+ },
|
|
|
+ openPositionMap () {
|
|
|
+ if (!this.parentImg) {
|
|
|
+ this.$message.info('上层位置未设置电子地图!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const { form: { getFieldsValue } } = this
|
|
|
+ this.$refs.position.base(getFieldsValue(['positionY',
|
|
|
+ 'positionX']))
|
|
|
+ },
|
|
|
+ handleSelectPosition (val) {
|
|
|
+ const { form: { setFieldsValue } } = this
|
|
|
+ this.$nextTick(() => {
|
|
|
+ setFieldsValue(Object.assign(pick(val, [
|
|
|
+ 'positionY',
|
|
|
+ 'positionX'
|
|
|
+ ])))
|
|
|
+ })
|
|
|
+ },
|
|
|
+ changeParent (id) {
|
|
|
+ this.parentId = id
|
|
|
+ fetchSbPosition({ id }).then(res => {
|
|
|
+ this.parentImg = res.data.opcImg
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
}
|