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.
417 lines
14 KiB
417 lines
14 KiB
<template>
|
|
<div class="customer-css">
|
|
<el-dialog :title="titleCon" :close-on-click-modal="false" :visible.sync="visible" width="340px" style="height: 520px;" class="customer-dialog">
|
|
<el-form :inline="true" label-position="top" label-width="80px" :model="pageData" :rules="rules">
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" label="设备编码:" prop="objectID" :rules="rules.objectIdType">
|
|
<el-input v-model="pageData.objectID" :disabled="readOnlyFlag" style="width: 120px;" >
|
|
</el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" label="设备名称" prop="objectDesc" :rules="rules.objectDescType">
|
|
<el-input v-model="pageData.objectDesc" style="width: 120px;"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-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-col>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" prop="locationName" :rules="rules.locationType">
|
|
<span slot="label" style="" @click="getBaseList(1026)"><a herf="#">区域:</a></span>
|
|
<el-input v-model="pageData.locationName" style="width: 120px;"></el-input >
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" prop="familyDesc" :rules="rules.familyType">
|
|
<span slot="label" style="" @click="getBaseList(1027)"><a herf="#">分类:</a></span>
|
|
<el-input v-model="pageData.familyDesc" style="width: 120px;" ></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" prop="groupDesc" :rules="rules.groupType">
|
|
<span slot="label" style="" @click="getBaseList(1028)"><a herf="#">分组:</a></span>
|
|
<el-input v-model="pageData.groupDesc" style="width: 120px;" ></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item">
|
|
<span slot="label" style="" @click="getBaseList(1029)"><a herf="#">供应商:</a></span>
|
|
<el-input v-model="pageData.supplierName" style="width: 120px;" >
|
|
</el-input >
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" >
|
|
<span slot="label" style="" @click="getBaseList(1030)"><a herf="#">制造商:</a></span>
|
|
<el-input v-model="pageData.manufacturerName" style="width: 120px;" ></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" label="序列号:">
|
|
<el-input v-model="pageData.seqNo" style="width: 120px;"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" label="购入日期:">
|
|
<el-date-picker class="el-time-width" style="width: 120px;" v-model="pageData.purchessDate" value-format="yyyy-MM-dd hh:mm:ss">
|
|
</el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" prop="resourceDesc">
|
|
<span slot="label" style="" @click="getBaseList(203)"><a herf="#">机台编号:</a></span>
|
|
<el-input v-model="pageData.resourceDesc" style="width: 120px;" ></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" prop="deptID" :rules="rules.deptType">
|
|
<span slot="label" style="" @click="getBaseList(204)"><a herf="#">所属部门:</a></span>
|
|
<el-input v-model="pageData.deptName" style="width: 120px"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" label="资产编号:" >
|
|
<el-input v-model="pageData.assetNo" style="width: 120px;" ></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="12">
|
|
<el-form-item class="customer-item" label="备注:" >
|
|
<el-input v-model="pageData.assetRemark" style="width: 120px;" ></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
<span slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="saveEamObject()">保存</el-button>
|
|
<el-button type="primary" @click="closeDialog">关闭</el-button>
|
|
</span>
|
|
</el-dialog>
|
|
<!--列表的组件-->
|
|
<Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {
|
|
insertEamObject,
|
|
updateEamObject,
|
|
} from '@/api/eam/com_eam_object_add_update.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: '',
|
|
username: this.$store.state.user.name,
|
|
objectID: '',
|
|
objectDesc: '',
|
|
locationID: '',
|
|
locationName: '',
|
|
familyID: '',
|
|
familyDesc: '',
|
|
groupID: '',
|
|
groupDesc: '',
|
|
supplierID: '',
|
|
supplierName: '',
|
|
manufacturerID: '',
|
|
manufacturerName: '',
|
|
resourceID: '',
|
|
resourceDesc: '',
|
|
seqNo: '',
|
|
purchessDate: '',
|
|
active: 'Y',
|
|
addFlag: 'Y',
|
|
checkFlag: 'Y',
|
|
updateBy:'',
|
|
deptID: '',
|
|
deptName: '',
|
|
assetNo: '',
|
|
assetRemark: '',
|
|
},
|
|
readOnlyFlag: false,
|
|
dataListLoading: false,
|
|
rules:{
|
|
objectIdType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
objectDescType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
locationType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
familyType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
groupType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
deptType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
activeType:[
|
|
{
|
|
required: true,
|
|
message: ' ',
|
|
trigger: 'change'
|
|
}
|
|
],
|
|
}
|
|
}
|
|
},
|
|
methods: {
|
|
//初始化组件的参数
|
|
init(currentRow) {
|
|
//初始化参数
|
|
this.pageData = JSON.parse(JSON.stringify(currentRow));
|
|
//打开页面
|
|
this.visible = true;
|
|
//判断是否是新增
|
|
if(this.pageData.addFlag === 'Y'){
|
|
this.readOnlyFlag = false;
|
|
}else{
|
|
this.readOnlyFlag = true;
|
|
}
|
|
//重置人员信息
|
|
this.pageData.username = this.userId;
|
|
//重置标题
|
|
this.titleCon = this.labels.titleCon;
|
|
},
|
|
|
|
/*保存标签自定义的信息*/
|
|
saveEamObject(){
|
|
//判断标签内容是否为空
|
|
// let objectID = this.pageData.objectID.trim();
|
|
// let locationID = this.pageData.locationID.trim();
|
|
// let familyID = this.pageData.familyID.trim();
|
|
// let groupID = this.pageData.groupID.trim();
|
|
// let supplierID = this.pageData.supplierID.trim();
|
|
// let manufacturerID = this.pageData.manufacturerID.trim();
|
|
// let resourceID = this.pageData.resourceID.trim();
|
|
// let deptID = this.pageData.deptID.trim();
|
|
if(this.pageData.active == null || this.pageData.active === ''){
|
|
this.$message.success("请选择是否在用!");
|
|
return false;
|
|
}
|
|
if(this.pageData.objectID == null || this.pageData.objectID === ''){
|
|
this.$message.success("设备编码不能为空!");
|
|
return false;
|
|
}
|
|
if(this.pageData.objectDesc == null || this.pageData.objectDesc === ''){
|
|
this.$message.success("设备名称不能为空!");
|
|
return false;
|
|
}
|
|
if(this.pageData.locationID == null || this.pageData.locationID === ''){
|
|
this.$message.success("区域不能为空!");
|
|
return false;
|
|
}
|
|
if(this.pageData.groupID == null || this.pageData.groupID === ''){
|
|
this.$message.success("分组不能为空!");
|
|
return false;
|
|
}
|
|
if(this.pageData.familyID == null || this.pageData.familyID === ''){
|
|
this.$message.success("分类不能为空!");
|
|
return false;
|
|
}
|
|
// if(this.pageData.resourceID == null || this.pageData.resourceID === ''){
|
|
// this.$message.success("机台不能为空!");
|
|
// return false;
|
|
// }
|
|
if(this.pageData.deptID == null || this.pageData.deptID === ''){
|
|
this.$message.success("所属部门不能为空!");
|
|
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 === 1026) {
|
|
//设置参数
|
|
this.pageData.locationID = val.LocationID;
|
|
this.$set(this.pageData,'locationName',val.LocationName);
|
|
}else if (this.tagNo === 1027) {
|
|
//设置参数
|
|
this.pageData.familyID = val.FamilyID;
|
|
this.$set(this.pageData,'familyDesc',val.FamilyDesc);
|
|
}else if (this.tagNo === 1028) {
|
|
//设置参数
|
|
this.pageData.groupID = val.GroupID;
|
|
this.$set(this.pageData,'groupDesc',val.GroupDesc);
|
|
}else if (this.tagNo === 1029) {
|
|
//设置参数
|
|
this.pageData.supplierID = val.SupplierID;
|
|
this.$set(this.pageData,'supplierName',val.SupplierName);
|
|
}else if (this.tagNo === 1030) {
|
|
//设置参数
|
|
this.pageData.manufacturerID = val.ManufacturerID;
|
|
this.$set(this.pageData,'manufacturerName',val.ManufacturerName);
|
|
}else if (this.tagNo === 203) {
|
|
//设置参数
|
|
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 = ''
|
|
if (val === 1026) {
|
|
strVal = this.pageData.locationID;
|
|
}else if (val === 1027) {
|
|
strVal = this.pageData.familyID;
|
|
}else if (val === 1028) {
|
|
strVal = this.pageData.groupID;
|
|
}else if (val === 1029) {
|
|
strVal = this.pageData.supplierID;
|
|
}else if (val === 1030) {
|
|
strVal = this.pageData.manufacturerID;
|
|
}else if (val === 203) {
|
|
strVal = this.pageData.resourceID;
|
|
}else if (val === 204) {
|
|
strVal = this.pageData.deptID;
|
|
}
|
|
this.$refs.baseList.init(val, strVal)
|
|
})
|
|
},
|
|
|
|
},
|
|
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() {
|
|
// this.factoryList()
|
|
// this.getLanguageList()
|
|
}
|
|
}
|
|
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
|
</style>
|