You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
521 lines
19 KiB
521 lines
19 KiB
<template>
|
|
<div class="customer-css">
|
|
<el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible" width="960px" style="height: 662px;" class="customer-dialog">
|
|
<el-form :inline="true" label-position="top" :model="pageData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
|
|
<el-form-item label="BU" prop="bu" :rules="rules.bu">
|
|
<el-select v-model="pageData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 150px">
|
|
<el-option
|
|
v-for = "i in userBuList"
|
|
:key = "i.buNo"
|
|
:label = "i.sitename"
|
|
:value = "i.buNo">
|
|
<span style="float: left;width: 100px">{{ i.sitename }}</span>
|
|
<span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
|
|
{{ i.buDesc }}
|
|
</span>
|
|
</el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="设备编码" prop="objectID" :rules="rules.objectIdType">
|
|
<el-input v-model="pageData.objectID" style="width: 120px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="设备名称" prop="objectDesc" :rules="rules.objectDesc" style="margin-left: -10px">
|
|
<el-input v-model="pageData.objectDesc" style="width: 300px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="序列号" style="margin-left: -10px">
|
|
<el-input v-model="pageData.seqNo" style="width: 163px;"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="资产编号" style="margin-left: -10px">
|
|
<el-input v-model="pageData.assetNo" style="width: 163px;"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" :model="pageData" :rules="rules" style="margin-left: 7px">
|
|
<el-form-item prop="locationID" :rules="rules.locationType">
|
|
<span slot="label" @click="getBaseList(26)"><a herf="#">区域</a></span>
|
|
<el-input v-model="pageData.locationID" style="width: 120px;"></el-input>
|
|
<el-input v-model="pageData.locationName" disabled style="width: 330px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item prop="familyID" :rules="rules.familyType">
|
|
<span slot="label" @click="getBaseList(27)"><a herf="#">分类</a></span>
|
|
<el-input v-model="pageData.familyID" style="width: 120px;" ></el-input>
|
|
<el-input v-model="pageData.familyDesc" disabled style="width: 330px"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" :model="pageData" :rules="rules" style="margin-left: 7px">
|
|
<el-form-item prop="groupID" :rules="rules.groupType">
|
|
<span slot="label" @click="getBaseList(28)"><a herf="#">分组</a></span>
|
|
<el-input v-model="pageData.groupID" style="width: 120px;"></el-input>
|
|
<el-input v-model="pageData.groupDesc" disabled style="width: 330px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<span slot="label" @click="getBaseList(29)"><a herf="#">供应商</a></span>
|
|
<el-input v-model="pageData.supplierID" style="width: 120px;"></el-input>
|
|
<el-input v-model="pageData.supplierName" disabled style="width: 330px"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" :model="pageData" style="margin-left: 7px">
|
|
<el-form-item>
|
|
<span slot="label" @click="getBaseList(30)"><a herf="#">制造商编码</a></span>
|
|
<el-input v-model="pageData.manufacturerID" style="width: 120px;"></el-input>
|
|
<el-input v-model="pageData.manufacturerName" disabled style="width: 330px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<span slot="label" style="" @click="getBaseList(503)"><a herf="#">机台编码</a></span>
|
|
<el-input v-model="pageData.resourceID" style="width: 120px;" ></el-input>
|
|
<el-input v-model="pageData.resourceDesc" disabled style="width: 330px"></el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" :model="pageData" :rules="rules" style="margin-left: 7px">
|
|
<el-form-item prop="deptID" :rules="rules.deptType">
|
|
<span slot="label" @click="getBaseList(204)"><a herf="#">所属部门编码</a></span>
|
|
<el-input v-model="pageData.deptID" style="width: 120px"></el-input>
|
|
<el-input v-model="pageData.deptName" disabled style="width: 330px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="及时通知">
|
|
<el-select multiple collapse-tags v-model="pageData.mesTypeList" style="width: 151px;">
|
|
<el-option label="短信" value="A"></el-option>
|
|
<el-option label="邮件" value="B"></el-option>
|
|
<el-option label="随身机" value="C"></el-option>
|
|
<el-option label="三色灯" value="D"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
<el-form-item label="标准响应时长(m)">
|
|
<el-input-number :controls="false" :step="0" min="0" v-model="pageData.standardResponseDuration" style="width: 137px;"></el-input-number>
|
|
</el-form-item>
|
|
<el-form-item label="超时响应推送时长(m)">
|
|
<el-input-number :controls="false" :step="0" min="0" v-model="pageData.timeOutResponseDuration" style="width: 137px;"></el-input-number>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" :model="pageData" style="margin-left: 7px">
|
|
<el-form-item label="在用" prop="active" :rules="rules.activeType">
|
|
<el-select v-model="pageData.active" style="width: 120px;">
|
|
<el-option label="是" value="Y"></el-option>
|
|
<el-option label="否" value="N"></el-option>
|
|
</el-select >
|
|
</el-form-item>
|
|
<el-form-item label=" " prop="publicFacilitiesFlag">
|
|
<el-checkbox v-model="pageData.publicFacilitiesFlag" :true-label="'Y'" :false-label="'N'"
|
|
style="margin-left: 10px;">公共设施
|
|
</el-checkbox>
|
|
</el-form-item>
|
|
<el-form-item label="购入日期">
|
|
<el-date-picker v-model="pageData.purchessDate" value-format="yyyy-MM-dd HH:mm:ss"
|
|
style="width: 225px;"></el-date-picker>
|
|
</el-form-item>
|
|
<el-form-item label="循环时间(m)">
|
|
<el-input-number :controls="false" :step="0" min="0" v-model="pageData.cycleTimeSend" style="width: 152px;"></el-input-number>
|
|
</el-form-item>
|
|
<el-form-item label="标准维修时长(m)">
|
|
<el-input-number :controls="false" :step="0" min="0" v-model="pageData.standardMaintenanceDuration" style="width: 137px;"></el-input-number>
|
|
</el-form-item>
|
|
<el-form-item label="超时维修推送时长(m)">
|
|
<el-input-number :controls="false" :step="0" min="0" v-model="pageData.timeOutMaintenanceDuration" style="width: 137px;"></el-input-number>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-form :inline="true" label-position="top" :model="pageData" style="margin-left: 7px">
|
|
<el-form-item label="备注" >
|
|
<el-input
|
|
type="textarea"
|
|
v-model="pageData.assetRemark"
|
|
:rows="3"
|
|
resize='none'
|
|
show-word-limit
|
|
style="width: 921px;height: 60px">
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-form>
|
|
<el-footer style="height:31px;margin-top: 50px;text-align:center">
|
|
<el-button type="primary" @click="saveEamObject()">保存</el-button>
|
|
<el-button type="primary" @click="visible = false">关闭</el-button>
|
|
</el-footer>
|
|
</el-dialog>
|
|
<!--列表的组件-->
|
|
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
insertEamObject,
|
|
updateEamObject,
|
|
} from '@/api/eam/com_eam_object_add_update.js'
|
|
import {getSiteAndBuByUserName} from "@/api/eam/eam.js"
|
|
/* 引入组件 */
|
|
import Chooselist from '@/views/modules/common/Chooselist_eam';
|
|
var functionId = 'C10000001';
|
|
|
|
export default {
|
|
data() {
|
|
return {
|
|
titleCon: '设备清单维护',
|
|
visible: false,
|
|
userId: this.$store.state.user.name,
|
|
pageData: {
|
|
site: '',
|
|
bu: '',
|
|
buNo: '',
|
|
username: this.$store.state.user.name,
|
|
objectID: '',
|
|
objectDesc: '',
|
|
locationID: '',
|
|
locationName: '',
|
|
familyID: '',
|
|
familyDesc: '',
|
|
groupID: '',
|
|
groupDesc: '',
|
|
supplierID: '',
|
|
supplierName: '',
|
|
manufacturerID: '',
|
|
manufacturerName: '',
|
|
resourceID: '',
|
|
resourceDesc: '',
|
|
seqNo: '',
|
|
purchessDate: '',
|
|
active: 'Y',
|
|
publicFacilitiesFlag: 'Y',
|
|
addFlag: 'Y',
|
|
checkFlag: 'Y',
|
|
updateBy:'',
|
|
deptID: '',
|
|
deptName: '',
|
|
assetNo: '',
|
|
assetRemark: '',
|
|
standardMaintenanceDuration: '',
|
|
timeOutMaintenanceDuration: '',
|
|
standardResponseDuration: '',
|
|
timeOutResponseDuration: '',
|
|
cycleTimeSend: undefined,
|
|
mesType: '',
|
|
mesTypeList: []
|
|
},
|
|
dataListLoading: false,
|
|
rules:{
|
|
objectIdType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
objectDesc: [
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
locationType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
familyType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
groupType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
deptType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
activeType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
],
|
|
bu: [
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: ['blur','change']
|
|
}
|
|
]
|
|
},
|
|
userBuList: [],
|
|
modalDisableFlag: false,
|
|
}
|
|
},
|
|
methods: {
|
|
// 获取用户的bu
|
|
getSiteAndBuByUserName () {
|
|
let tempData = {
|
|
username: this.$store.state.user.name,
|
|
}
|
|
getSiteAndBuByUserName(tempData).then(({data}) => {
|
|
if (data.code === 0) {
|
|
this.userBuList = data.rows
|
|
}
|
|
})
|
|
},
|
|
|
|
// 初始化组件的参数
|
|
init (currentRow) {
|
|
//初始化参数
|
|
this.pageData = JSON.parse(JSON.stringify(currentRow))
|
|
//打开页面
|
|
this.visible = true
|
|
//判断是否是新增
|
|
if (this.pageData.addFlag === 'Y') {
|
|
this.modalDisableFlag = false
|
|
this.pageData.bu = this.userBuList[0].buNo
|
|
} else {
|
|
this.pageData.bu = this.pageData.site + '_' + this.pageData.buNo
|
|
this.modalDisableFlag = true
|
|
}
|
|
//重置人员信息
|
|
this.pageData.username = this.userId
|
|
},
|
|
|
|
// 保存标签自定义的信息
|
|
saveEamObject () {
|
|
if (this.pageData.bu === '' || this.pageData.bu == null) {
|
|
this.$message.warning('请选择BU!')
|
|
return
|
|
}
|
|
if (this.pageData.active == null || this.pageData.active === '') {
|
|
this.$message.warning("请选择是否在用!");
|
|
return false
|
|
}
|
|
if (this.pageData.objectID == null || this.pageData.objectID === '') {
|
|
this.$message.warning("设备编码不能为空!");
|
|
return false
|
|
}
|
|
if (this.pageData.objectDesc == null || this.pageData.objectDesc === '') {
|
|
this.$message.warning("设备名称不能为空!");
|
|
return false
|
|
}
|
|
if (this.pageData.locationID == null || this.pageData.locationID === '') {
|
|
this.$message.warning("区域不能为空!");
|
|
return false
|
|
}
|
|
if (this.pageData.groupID == null || this.pageData.groupID === '') {
|
|
this.$message.warning("分组不能为空!");
|
|
return false
|
|
}
|
|
if (this.pageData.familyID == null || this.pageData.familyID === '') {
|
|
this.$message.warning("分类不能为空!");
|
|
return false
|
|
}
|
|
if (this.pageData.deptID == null || this.pageData.deptID === '') {
|
|
this.$message.warning("所属部门不能为空!");
|
|
return false
|
|
}
|
|
this.pageData.mesType = this.pageData.mesTypeList.join(',')
|
|
for (let i = 0; i < this.pageData.mesType.length; i++) {
|
|
if(this.pageData.mesType[i] == 'D'){
|
|
if(!this.pageData.cycleTimeSend || this.pageData.cycleTimeSend <= 0){
|
|
this.$message.warning("三色灯选项需要添加循环时间或大于0!");
|
|
return false
|
|
}
|
|
}
|
|
|
|
}
|
|
// 判断是否是新增标签自定义
|
|
if (this.pageData.addFlag === 'Y') {
|
|
this.insertEamObjectData()
|
|
} else {
|
|
this.updateEamObjectData()
|
|
}
|
|
},
|
|
|
|
// 新增
|
|
insertEamObjectData () {
|
|
// if (this.pageData.site == '软标/RFID') {
|
|
// this.pageData.site = '2'
|
|
// }
|
|
// if (this.pageData.site == '硬标') {
|
|
// this.pageData.site = '3'
|
|
// }
|
|
// if (this.pageData.site == '通用设备') {
|
|
// this.pageData.site = '4'
|
|
// }
|
|
insertEamObject(this.pageData).then(({data}) => {
|
|
if (data.code === 200) {
|
|
this.$message.success(data.msg)
|
|
setTimeout(this.closeDialog(), 2000)
|
|
} else {
|
|
this.$message.error(data.msg)
|
|
}
|
|
})
|
|
},
|
|
|
|
// 修改
|
|
updateEamObjectData () {
|
|
// if (this.pageData.site == '软标/RFID'){
|
|
// this.pageData.site = '2'
|
|
// }
|
|
// if (this.pageData.site == '硬标'){
|
|
// this.pageData.site = '3'
|
|
// }
|
|
// if (this.pageData.site == '通用设备'){
|
|
// this.pageData.site = '4'
|
|
// }
|
|
updateEamObject(this.pageData).then(({data}) => {
|
|
if (data.code === 200) {
|
|
this.$message.success(data.msg)
|
|
setTimeout(this.closeDialog(), 2000);
|
|
}else{
|
|
this.$message.error(data.msg);
|
|
}
|
|
})
|
|
},
|
|
|
|
// 关闭modal
|
|
closeDialog () {
|
|
// 刷新报工的页面
|
|
this.$emit('refreshPageTables')
|
|
// 关闭当前的页面
|
|
this.visible = false
|
|
},
|
|
|
|
// 列表方法的回调
|
|
getBaseData (val) {
|
|
if (this.tagNo === 26) {
|
|
//设置参数
|
|
this.pageData.locationID = val.LocationID;
|
|
this.pageData.locationName = val.LocationName;
|
|
} else if (this.tagNo === 27) {
|
|
//设置参数
|
|
this.pageData.familyID = val.FamilyID;
|
|
this.$set(this.pageData,'familyDesc',val.FamilyDesc)
|
|
} else if (this.tagNo === 28) {
|
|
//设置参数
|
|
this.pageData.groupID = val.GroupID;
|
|
this.$set(this.pageData,'groupDesc',val.GroupDesc)
|
|
} else if (this.tagNo === 29) {
|
|
//设置参数
|
|
this.pageData.supplierID = val.SupplierID;
|
|
this.$set(this.pageData,'supplierName',val.SupplierName)
|
|
} else if (this.tagNo === 30) {
|
|
//设置参数
|
|
this.pageData.manufacturerID = val.ManufacturerID;
|
|
this.$set(this.pageData,'manufacturerName',val.ManufacturerName)
|
|
} else if (this.tagNo === 503) {
|
|
//设置参数
|
|
this.pageData.resourceID = val.resource_id
|
|
this.$set(this.pageData,'resourceDesc',val.resource_desc)
|
|
} else if (this.tagNo === 204) {
|
|
//设置参数
|
|
this.pageData.deptID = val.department_id
|
|
this.$set(this.pageData,'deptName',val.department_name)
|
|
}
|
|
},
|
|
|
|
// 获取基础数据列表
|
|
getBaseList (val) {
|
|
this.tagNo = val
|
|
this.$nextTick(() => {
|
|
let strVal = ''
|
|
let conSql = ''
|
|
if (val === 26) {
|
|
strVal = this.pageData.locationID
|
|
if (this.pageData.bu === null || this.pageData.bu === '') {
|
|
this.$message.warning("请选择BU!")
|
|
return
|
|
} else {
|
|
conSql = " and bu_no = '" + this.pageData.bu.split('_')[1] + "'"
|
|
this.$refs.baseList.init(val, strVal, conSql)
|
|
}
|
|
}else if (val === 27) {
|
|
strVal = this.pageData.familyID
|
|
if (this.pageData.bu === null || this.pageData.bu === '') {
|
|
this.$message.warning("请选择BU!")
|
|
return
|
|
} else {
|
|
conSql = " and bu_no = '" + this.pageData.bu.split('_')[1] + "'"
|
|
this.$refs.baseList.init(val, strVal, conSql)
|
|
}
|
|
}else if (val === 28) {
|
|
strVal = this.pageData.groupID
|
|
if (this.pageData.bu === null || this.pageData.bu === '') {
|
|
this.$message.warning("请选择BU!")
|
|
return
|
|
} else {
|
|
conSql = " and bu_no = '" + this.pageData.bu.split('_')[1] + "'"
|
|
this.$refs.baseList.init(val, strVal, conSql)
|
|
}
|
|
}else if (val === 29) {
|
|
strVal = this.pageData.supplierID
|
|
if (this.pageData.bu === null || this.pageData.bu === '') {
|
|
this.$message.warning("请选择BU!")
|
|
return
|
|
} else {
|
|
conSql = " and bu_no = '" + this.pageData.bu.split('_')[1] + "'"
|
|
this.$refs.baseList.init(val, strVal, conSql)
|
|
}
|
|
}else if (val === 30) {
|
|
strVal = this.pageData.manufacturerID
|
|
if (this.pageData.bu === null || this.pageData.bu === '') {
|
|
this.$message.warning("请选择BU!")
|
|
return
|
|
} else {
|
|
conSql = " and bu_no = '" + this.pageData.bu.split('_')[1] + "'"
|
|
this.$refs.baseList.init(val, strVal, conSql)
|
|
}
|
|
}else if (val === 503) {
|
|
strVal = this.pageData.resourceID
|
|
if (this.pageData.bu === null || this.pageData.bu === '') {
|
|
this.$message.warning("请选择BU!")
|
|
return
|
|
} else {
|
|
conSql = " and site = '" + this.pageData.bu.split('_')[0] + "'"
|
|
this.$refs.baseList.init(val, strVal, conSql)
|
|
}
|
|
}else if (val === 204) {
|
|
strVal = this.pageData.deptID
|
|
if (this.pageData.bu === null || this.pageData.bu === '') {
|
|
this.$message.warning("请选择BU!")
|
|
return
|
|
} else {
|
|
conSql = " and bu_no = '" + this.pageData.bu.split('_')[1] + "'"
|
|
this.$refs.baseList.init(val, strVal, conSql)
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
},
|
|
components: {
|
|
Chooselist, /* 选择的组件 */
|
|
},
|
|
watch: {
|
|
pageData: {
|
|
deep: true,
|
|
handler: function (newV, oldV) {
|
|
this.pageData.objectID = this.pageData.objectID.toUpperCase();
|
|
this.pageData.locationID = this.pageData.locationID.toUpperCase();
|
|
this.pageData.familyID = this.pageData.familyID.toUpperCase();
|
|
this.pageData.groupID = this.pageData.groupID.toUpperCase();
|
|
this.pageData.supplierID = this.pageData.supplierID.toUpperCase();
|
|
this.pageData.manufacturerID = this.pageData.manufacturerID.toUpperCase();
|
|
}
|
|
},
|
|
},
|
|
created() {
|
|
// 获取用户的 site 和 bu
|
|
this.getSiteAndBuByUserName()
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
</style>
|