Commit edd99be3 authored by 康振飞's avatar 康振飞

Merge branch 'master' into kk_mes

parents 9af2908a 47f7650f
......@@ -16,7 +16,7 @@
</Button>
</ButtonGroup>
</h3>
<div class="tree" >
<div class="tree" :style="{height:divHeight}">
<Tree
ref="tree"
:data="tree"
......@@ -33,7 +33,8 @@ export default {
return {
expand: false,
ids: [],
tree: []
tree: [],
divHeight:''
}
},
props: {
......@@ -45,6 +46,8 @@ export default {
mounted() {},
created() {
this.loadTree()
var theight = window.innerHeight - 180 + 'px'
this.divHeight = theight
},
methods: {
toggle() {
......
<template>
<div class="new-equipment">
<Modal v-model="modalShow" title="设置日历" width="500" :mask-closable="false">
<Form :model="formItem" :label-width="100" style="margin:10px;" :rules="ruleValidate">
<Row >
<Col span="20">
<FormItem label="设备名称" prop="equip_name">
<Input v-model="formItem.equip_name" placeholder="请输入设备名称" readonly></Input>
</FormItem>
</Col>
</Row>
<Row >
<Col span="20" >
<FormItem label="设备编号" prop="equip_id">
<Input v-model="formItem.equip_id" placeholder="请输入设备编号" readonly></Input>
</FormItem>
</Col>
</Row>
<Row >
<Col span="20">
<FormItem label="工作日历" prop="work">
<Select v-model="formItem1.calendarwork_pk" clearable placeholder="请选择...">
<Option v-for="item in cityList" :value="item.id" :key="item.value">{{ item.label }}</Option>
</Select>
</FormItem>
</Col>
</Row>
<Row >
<Col span="20" >
<FormItem label="加班日历" prop="overtime">
<Select v-model="formItem2.calendarovertime_pk" clearable placeholder="请选择...">
<Option v-for="item in cityList1" :value="item.id" :key="item.value">{{ item.label }}</Option>
</Select>
</FormItem>
</Col>
</Row>
</Form>
<div slot="footer">
<!-- class="footers" -->
<Button @click="close">取消</Button>
<Button @click="saveOk" type="success">保存</Button>
</div>
</Modal>
<Department
:show.sync="showDeptTree"
:value.sync="formItem.shop_id"
:text.sync="formItem.shop_name"
:isAdd="false"
/>
</div>
</template>
<script>
import Department from '@/components/modalTree/department.vue'
import service from '@/plugins/request'
export default {
components: {
Department
},
name: '',
data() {
return {
qcfileparms: 'app=newEquipment&eid=23&name=newEquipment',
modalShow: false,
showDeptTree: false,
saveId:'',
title:'',
editId:0,
data1:[],
cityList:[],
cityList1:[],
imgName: '',
formItem: {
equip_name: '',
equip_id: '',
},
formItem1: {
id:0,
equip_pk:0,
calendarwork_pk:0,
},
formItem2: {
id:0,
equip_pk:0,
calendarovertime_pk:0
},
ruleValidate: {
}
}
},
created() {
this.laodaction();
},
watch: {
imgName(newName, oldName) {
if (newName != '') {
const imgPathsArr = JSON.parse(newName)
this.formItem.equip_pic = imgPathsArr[0].filePath
}
}
},
methods: {
selectDepart() {
this.showDeptTree = true
},
laodaction(){
let parmse ={
pageIndex:0,
cont:0,
conditions: [],
pageSize: 0
}
let url = `${systemUrl}/calendarwork/list`,
that = this;
service.post(`${url}`, parmse).then(res => {
let selectdata = res.data.result;
//console.log(selectdata)
selectdata.forEach(item => {
that.cityList.push({
value: item.title,
label: item.title,
id: item.id,
})
// console.log(that.cityList)
});
});
let url1 = `${systemUrl}/calendarovertime/list`;
service.post(`${url1}`,parmse).then(res => {
let selectdata1 = res.data.result;
console.log(selectdata1)
selectdata1.forEach(item => {
this.cityList1.push({
value: item.title,
label: item.title,
id: item.id,
})
// console.log(that.cityList)
});
});
},
preservation() {},
close() {
this.modalShow = false
},
// 添加/编辑 弹框的保存
saveOk() {
var url = `${systemUrl}/equipcalendarwork/createorupdate`
console.log(this.formItem1)
console.log(this.formItem2)
console.log(this.editId)
service.post(`${url}`, JSON.stringify({ equipCalendarWork: this.formItem1,equipCalendarOverTime: this.formItem2 }))
.then((res) => {
if (res.data.success) {
this.$Message.success('保存成功')
this.$emit('getMessage');
this.modalShow = false
}
})
},
}
}
</script>
<style lang="less" scoped>
.footers {
margin-right: -60px;
}
</style>
\ No newline at end of file
<template>
<div class="tree-type">
<h3 class="zh-title">产品结构</h3>
<div class="zh-box">
<Input placeholder="输入内容" style="width: auto">
<Icon type="ios-search" slot="prefix" />
</Input>
<Tree :data="treeData" class="tree-content"></Tree>
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {
treeData: [
{
title: '工厂',
expand: true,
children: [
{
title: '生产处1',
expand: true,
children: [
{
title: '车间1'
},
{
title: '车间2'
},
{
title: '车间3'
}
]
},
{
title: '生产处2',
expand: true,
children: [
{
title: '车间1'
},
{
title: '车间2'
},
{
title: '车间3'
}
]
},
{
title: '生产处3',
expand: true,
children: [
{
title: '车间1'
},
{
title: '车间2'
},
{
title: '车间3'
}
]
}
]
}
]
}
},
mounted() {},
methods: {}
}
</script>
<style lang="less" scoped>
.tree-content{
margin-top: 15px;
}
</style>
\ No newline at end of file
<template>
<div class="deviceManagement">
<!-- 左侧树 -->
<div class="zh-tree" :style="{height:treeHeight+'px'}">
<h3 class="zh-title">组织架构</h3>
<div class="zh-box">
<Input search placeholder="请输入查询条件" clearable v-model="treeInputSearch" />
<Tree :data="searchList" class="tree-content" @on-select-change="selectTreeNode"></Tree>
</div>
</div>
<!-- 右侧内容 -->
<div class="content-right">
<div class="search-form">
<Row>
<Col span="12" style="display: flex;">
<Input
placeholder="请输入设备名称"
v-model="value1"
clearable
style="width:235px;flaot:left;"
/>
<Button type="success" class @click="easySearch">查询</Button>
<!-- <Button @click="advancedSearch" type="success" style="margin-left:8px;">高级搜索</Button> -->
</Col>
<!-- <Col span="12" style=" text-align: right;">
<Button type="success" @click="newEquipment">新增设备</Button>
<Button type="success" @click="newMain1">设备维修</Button>
<Button type="success" @click="newMain">设备保养</Button>-->
<!-- <Button type="success" @click="deleted">删除</Button> -->
<!-- </Col> -->
</Row>
</div>
<div class="table">
<Table
border
:loading="loading"
ref="selection"
:columns="column"
:data="datatable"
:height="this.tbHeight"
highlight-row
@on-selection-change="selectionData"
@on-current-change="selectionRow"
></Table>
<Page
:total="this.total"
:current="this.page"
:page-size="this.pageSize"
show-elevator
show-sizer
style="margin:10px 0;"
@on-change="pageChange"
@on-page-size-change="pageSizeChange"
/>
</div>
</div>
<!-- 新增设备弹框 -->
<New-Equipment ref="equipment" v-on:getMessage="laodaction"></New-Equipment>
<Modal
v-model="show"
:title="title2"
:width="500"
:mask-closable="false"
ok-text="保存"
@on-ok="saveOk"
cancel-text="取消"
>
<Form :model="formItemMain" :label-width="150" :rules="ruleValidate">
<Row>
<Col span="20">
<FormItem label="设备编号">
<Input v-model="formItemMain.equip_pk"></Input>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="设备名称">
<Input v-model="formItemMain.equip_name"></Input>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="保养类别">
<Select v-model="formItemMain.equip_down_type" placeholder="请选择" style="width:240px;">
<Option
v-for="item in sysdata"
:value="item.value"
:key="item.value"
>{{item.label }}</Option>
</Select>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="计划开始时间">
<DatePicker
:value="formItemMain.plan_start"
type="date"
placeholder="计划开始时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="计划结束时间">
<DatePicker
:value="formItemMain.plan_finish"
type="date"
placeholder="计划结束时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange1"
></DatePicker>
</FormItem>
</Col>
</Row>
</Form>
</Modal>
<Modal
v-model="show5"
:title="title1"
:width="500"
:mask-closable="false"
ok-text="保存"
@on-ok="saveOk1"
cancel-text="取消"
>
<Form :model="formItemMain" :label-width="100" :rules="ruleValidate">
<Row class="rowTitle100">
<Col :span="24">
<FormItem label="设备编号">
<Input v-model="formItemMain.equip_pk"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem label="设备名称">
<Input v-model="formItemMain.equip_name"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem label="故障现象">
<textarea v-model="formItemMain.notes" style="width:347px"></textarea>
</FormItem>
</Col>
<Col span="24">
<FormItem label="故障时间">
<DatePicker
:value="formItemMain.input_time"
type="date"
placeholder="故障时间"
format="yyyy/MM/dd"
@on-change="handleChange2"
></DatePicker>
</FormItem>
</Col>
</Row>
</Form>
</Modal>
<Modal
v-model="show4"
title="保养反馈"
:width="500"
:mask-closable="false"
ok-text="保存"
@on-ok="saveOkBack"
cancel-text="取消"
>
<Form :model="formItemMain1" :label-width="150" :rules="ruleValidate">
<Row>
<Col span="20">
<FormItem label="计划开始时间">
<DatePicker
:value="formItemMain1.plan_start"
type="date"
placeholder="计划开始时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange3"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="计划结束时间">
<DatePicker
:value="formItemMain1.plan_finish"
type="date"
placeholder="计划结束时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange4"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="实际开始时间">
<DatePicker
:value="formItemMain1.actual_start"
type="date"
placeholder="实际开始时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange5"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="实际结束时间">
<DatePicker
:value="formItemMain1.actual_finish"
type="date"
placeholder="实际结束时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange6"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="维修记录">
<textarea v-model="formItemMain1.failure_notes"></textarea>
</FormItem>
</Col>
</Row>
</Form>
</Modal>
<Modal
v-model="show6"
title="保养反馈"
:width="500"
:mask-closable="false"
ok-text="保存"
@on-ok="saveOkBack"
cancel-text="取消"
>
<Form :model="formItemMain1" :label-width="150" :rules="ruleValidate">
<Row>
<Col span="20">
<FormItem label="计划开始时间">
<DatePicker
:value="formItemMain1.plan_start"
type="date"
placeholder="计划开始时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange7"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="计划结束时间">
<DatePicker
:value="formItemMain1.plan_finish"
type="date"
placeholder="计划结束时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange8"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="实际开始时间">
<DatePicker
:value="formItemMain1.actual_start"
type="date"
placeholder="实际开始时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange9"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="实际结束时间">
<DatePicker
:value="formItemMain1.actual_finish"
type="date"
placeholder="实际结束时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange10"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="维修进度">
<Select v-model="formItemMain1.status" placeholder="请选择" style="width:240px;">
<Option
v-for="item in sysdata1"
:value="item.value"
:key="item.value"
>{{item.label }}</Option>
</Select>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="维修记录">
<textarea v-model="formItemMain1.failure_notes"></textarea>
</FormItem>
</Col>
</Row>
</Form>
</Modal>
<Modal
v-model="show3"
title="设备保养"
:width="1500"
:mask-closable="false"
ok-text="保存"
cancel-text="取消"
>
<div class="search-form">
<Row>
<Col span="1" style=" text-align: right;">
<Button type="success" @click="newMainBack">维保反馈</Button>
<!-- <Button type="success" @click="deleted">删除</Button> -->
</Col>
</Row>
</div>
<div class="table">
<Table
border
:loading="loading"
ref="selection"
:columns="column1"
:data="datatable1"
highlight-row
@on-selection-change="selectionData"
@on-current-change="selectionRow1"
></Table>
<!-- <Page
show-elevator
show-sizer
style="margin:10px 0;"
:current="page"
@on-change="pageChange"
@on-page-size-change="pageSizeChange"
/>-->
</div>
<div slot="footer"></div>
</Modal>
<!-- <Modal
v-model="show2"
title="提示"
:mask-closable="false"
ok-text="确定"
cancel-text="取消"
@on-ok="deleOk"
>此操作将永久删除该数据, 是否继续?</Modal>-->
</div>
</template>
<script>
import TreeType from "./components/treeType.vue"; //左侧树列表
import NewEquipment from "./components/newEquipment.vue"; //新增设备弹框
import service from "@/plugins/request";
export default {
components: {
TreeType,
NewEquipment
},
name: "",
data() {
return {
downUrl: fileUrlDown,
fileUrlPath: "",
ruleValidate: {},
tbHeight: "",
total: 0,
page: 1,
pageSize: 10,
shopid: "",
treeData: [],
treeHeight: "",
treeInputSearch: "",
loading: false,
seleId: 0,
eid: "",
eid1: "",
ptimes: "",
ptimee: "",
atimes: "",
atimee: "",
inputtime: "",
mainstatus: "",
failurenotes: "",
etype: "",
eqid: "",
eqname: "",
borw: "",
show: false,
show2: false,
show3: false,
show4: false,
show5: false,
show6: false,
title: "新增设备",
title1: "设备维修",
title2: "设备保养",
editId: "",
typepk: [],
value1: "",
formItemMain: {
equip_name: "",
equip_pk: "",
equip_down_type: "",
plan_start: "",
plan_finish: "",
input_time: "",
notes: ""
},
formItemMain1: {
equip_name: "",
equip_pk: "",
equip_down_type: "",
plan_start: "",
plan_finish: "",
actual_start: "",
actual_finish: "",
failure_notes: "",
status: ""
},
sysdata: [
{
value: "月度保养",
label: "月度保养"
},
{
value: "季度保养",
label: "季度保养"
},
{
value: "精度检查",
label: "精度检查"
},
{
value: "常规保养",
label: "常规保养"
}
],
sysdata1: [
{
value: "维护中",
label: "维护中"
},
{
value: "完成",
label: "维护完成"
}
],
column: [
// {
// type: 'selection',
// width: 60,
// align: 'center'
// },
{
type: "index",
width: 60,
align: "center"
},
{
title: "设备名称",
key: "equip_name"
},
{
title: "设备编号",
key: "equip_id"
},
{
title: "所属部门",
key: "shop_name"
},
{
title: "工作日历编号",
key: "calendarwork_pk"
},
{
title: "工作日历名称",
key: "calendarwork_name"
},
{
title: "加班日历编号",
key: "calendarovertime_pk"
},
{
title: "加班日历名称",
key: "calendarovertime_name"
},
{
title: "操作",
key: "action",
align: "center",
width: 280,
render: (h, params) => {
return h("div", { class: "action" }, [
// h(
// 'op',
// {
// attrs:{
// oprate:'detail'
// },
// on: {
// click: () => {}
// }
// },
// '查看'
// ),
h(
"op",
{
attrs: {
oprate: "detail",
class: "edit"
},
on: {
click: () => {
this.edit(params);
}
}
},
"设置日历"
)
]);
}
}
],
column1: [
// {
// type: 'selection',
// width: 60,
// align: 'center'
// },
{
title: "维护状态",
key: "status"
},
{
title: "计划人",
key: "input_name"
},
{
title: "报修时间",
key: "input_time"
},
{
title: "保养人",
key: "maintain_name"
},
{
title: "计划开始时间",
key: "plan_start"
},
{
title: "计划完成时间",
key: "plan_finish"
},
{
title: "实际开始时间",
key: "actual_start"
},
{
title: "实际结束时间",
key: "actual_finish"
},
{
title: "维保类型",
key: "equip_down_type"
}
],
datatable1: [],
datatable: [
{
name: "3D打印机",
name1: "EOS M290",
name2: "New York No. 1 Lake Park",
name3: "2016-10-03",
name4: "正常",
name5: "102.10.0.80",
name6: "车间1",
name7: ""
},
{
name: "3D打印机",
name1: "EOS M290",
name2: "New York No. 1 Lake Park",
name3: "2016-10-03",
name4: "正常",
name5: "102.10.0.80",
name6: "车间1",
name7: ""
},
{
name: "3D打印机",
name1: "EOS M290",
name2: "New York No. 1 Lake Park",
name3: "2016-10-03",
name4: "正常",
name5: "102.10.0.80",
name6: "车间1",
name7: ""
}
],
page: 1 //当前页 整形 选填 默认1
};
},
created() {
this.laodaction();
this.treeHeight = window.innerHeight - 140;
this.tbHeight = window.innerHeight - 250;
},
mounted() {
this.initTree();
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 140;
this.tbHeight = window.screenHeight - 250;
})();
};
},
methods: {
initTree() {
this.$http.department.getDepartmentTree(this.treeData);
},
//搜索查询
easySearch() {
this.page = 1;
this.pageSize = 10;
this.laodaction();
},
handleChange(date) {
this.formItemMain.plan_start = date;
},
handleChange1(date) {
this.formItemMain.plan_finish = date;
},
handleChange2(date) {
this.formItemMain.input_time = date;
},
handleChange3(date) {
this.formItemMain1.plan_start = date;
},
handleChange4(date) {
this.formItemMain1.plan_finish = date;
},
handleChange5(date) {
this.formItemMain1.actual_start = date;
},
handleChange6(date) {
this.formItemMain1.actual_finish = date;
},
handleChange7(date) {
this.formItemMain1.plan_start = date;
},
handleChange8(date) {
this.formItemMain1.plan_finish = date;
},
handleChange9(date) {
this.formItemMain1.actual_start = date;
},
handleChange10(date) {
this.formItemMain1.actual_finish = date;
},
laodaction() {
let url = `${systemUrl}/equipinfo/getpagedec`;
service
.get(`${url}`, {
params: {
equip_name: this.value1,
shopid: this.shopid,
pageindex: this.page,
pageSize: this.pageSize
}
})
.then(res => {
this.datatable = res.data.result.items;
this.total = res.data.result.totalCount;
});
},
//高级搜索
advancedSearch() {
// this.$refs.searchBox.modalShow = true
},
//设备保养
newMain() {
if (this.eid == "") {
this.$Message.error("请选择设备!");
return;
}
this.formItemMain.equip_pk = this.eqid;
this.formItemMain.equip_name = this.eqname;
this.show = true;
},
newMain1() {
if (this.eid == "") {
this.$Message.error("请选择设备!");
return;
}
this.formItemMain.equip_pk = this.eqid;
this.formItemMain.equip_name = this.eqname;
this.show5 = true;
},
//新增设备
newEquipment() {
this.$refs.equipment.modalShow = true;
this.$refs.equipment.title = "新增设备";
this.$refs.equipment.data1 = this.datatable;
this.$refs.equipment.$refs.refqcFile.newName = "";
//this.$refs.equipment.refqcFile.newName = ''
this.$refs.equipment.formItem = {
equip_name: "",
equip_id: "",
equip_type: [],
equip_pic: "",
equip_status: "",
equip_ip: "",
shop_id: "",
shop_name: ""
};
},
// 删除
deleted() {
this.$Modal.confirm({
title: "删除",
content: "<p>您确定要删除此设备吗</p>",
onOk: () => {
this.$Message.info("删除成功");
},
onCancel: () => {
this.$Message.info("已取消");
}
});
},
// 分页
pageChange(num) {
//console.log(num);
this.page = num;
this.laodaction();
},
pageSizeChange(limit) {
//console.log(limit)
this.pageSize = limit;
this.laodaction();
},
selectionData(row) {
console.log(row);
},
selectionRow(currentRow, oldCurrentRow) {
this.eqid = currentRow.equip_id;
this.eqname = currentRow.equip_name;
this.eid = currentRow.id;
},
selectionRow1(currentRow, oldCurrentRow) {
this.ptimes = currentRow.plan_start;
this.ptimee = currentRow.plan_finish;
this.atimes = currentRow.actual_start;
this.atimee = currentRow.actual_finish;
this.inputtime = currentRow.input_time;
this.etype = currentRow.equip_down_type;
this.mainstatus = currentRow.status;
this.eid1 = currentRow.id;
this.failurenotes = currentRow.failure_notes;
this.borw = currentRow.maintain_type;
},
saveOk() {
// if(this.formItemMain.plan_start=='')
// {
// this.$Message.error('请选择计划开始时间!')
// return;
// }
// if(this.formItemMain.plan_finish=='')
// {
// this.$Message.error('请选择计划结束时间!')
// return;
// }
// console.log(str);
// console.log(this.formItemMain.plan_start);
// return;
let url = `${systemUrl}/equipmaintainplan/createorupdate`;
let paramsdata = {
id: "",
equip_pk: this.eid,
equip_down_type: this.formItemMain.equip_down_type,
plan_start: this.formItemMain.plan_start,
plan_finish: this.formItemMain.plan_finish,
maintain_type: "1"
};
console.log(paramsdata);
service
.post(`${url}`, JSON.stringify({ equipMaintainPlan: paramsdata }))
.then(res => {
if (res.data.success) {
this.changestatus(this.eid);
this.show = false;
setTimeout(() => {
this.laodaction();
}, 1000);
this.$Message.success("新增成功");
}
});
},
downFile(path) {
console.log(path);
var path1 = path.row.equip_pic;
if (path1 != "") {
this.fileUrlPath = this.downUrl + path1;
} else {
this.fileUrlPath = "javascript:void(0)";
this.$Message.error("无图片");
return;
}
},
saveOk1() {
// console.log(str);
// if(this.formItemMain.input_time=='')
// {
// this.$Message.error('请选择故障时间!')
// return;
// }
let url = `${systemUrl}/equipmaintainplan/createorupdate`;
let paramsdata = {
id: "",
equip_pk: this.eid,
notes: this.formItemMain.notes,
input_time: this.formItemMain.input_time,
equip_down_type: "设备故障",
maintain_type: "2"
};
console.log(paramsdata);
service
.post(`${url}`, JSON.stringify({ equipMaintainPlan: paramsdata }))
.then(res => {
if (res.data.success) {
this.changestatus(this.eid);
this.show = false;
setTimeout(() => {
this.laodaction();
}, 1000);
this.$Message.success("新增成功");
}
});
},
edit(data) {
this.$refs.equipment.data1 = this.datatable;
let url = `${systemUrl}/equipbelongtype/getbyid`;
service.get(`${url}`, { params: { Id: data.row.id } }).then(res => {
console.log(data);
this.typepk = res.data.result;
this.$refs.equipment.title = "设置日历";
this.$refs.equipment.modalShow = true;
this.$refs.equipment.formItem = {
equip_name: data.row.equip_name,
equip_id: data.row.equip_id,
equip_type: this.typepk,
equip_pic: data.row.equip_pic,
equip_status: data.row.equip_status,
equip_ip: data.row.equip_ip,
shop_id: data.row.shop_id,
shop_name: data.row.shop_name
};
this.$refs.equipment.formItem1.equip_pk = data.row.id;
this.$refs.equipment.formItem2.equip_pk = data.row.id;
this.$refs.equipment.formItem1.calendarwork_pk =
data.row.calendarwork_pk;
this.$refs.equipment.formItem2.calendarovertime_pk =
data.row.calendarovertime_pk;
});
},
del(data) {
this.seleId = data.row.id;
let url = `${systemUrl}/equipinfo/delete`,
uId = this.seleId;
service.delete(`${systemUrl}/equipinfo/delete?id=${uId}`).then(res => {
if (res.data.success) {
this.laodaction();
this.$Message.success("删除成功");
}
});
},
Main(data) {
this.eid1 = "";
this.seleId = data.row.id;
let url = `${systemUrl}/equipmaintainplan/getpaged`;
service
.get(`${url}`, { params: { equipid: this.seleId, maintain_type: "1" } })
.then(res => {
//console.log(res)
this.datatable1 = res.data.result.items;
if (this.datatable1.length == 0) {
this.$Message.error("该设备没有保养数据!");
this.show3 = false;
return;
}
this.show3 = true;
});
console.log(this.datatable1);
},
Main1(data) {
this.eid1 = "";
this.seleId = data.row.id;
let url = `${systemUrl}/equipmaintainplan/getpaged`;
service
.get(`${url}`, { params: { equipid: this.seleId, maintain_type: "2" } })
.then(res => {
//console.log(res)
this.datatable1 = res.data.result.items;
if (this.datatable1.length == 0) {
this.$Message.error("该设备没有维修数据!");
this.show3 = false;
return;
}
this.show3 = true;
});
},
loadmain(id) {
let url = `${systemUrl}/equipmaintainplan/getpaged`;
service
.get(`${url}`, { params: { equipid: id, maintain_type: this.borw } })
.then(res => {
//console.log(res)
this.datatable1 = res.data.result.items;
});
},
changestatus(id) {
let url = `${systemUrl}/equipmaintainplan/changestatus`;
service.post(`${url}`, { equipid: id }).then(res => {
//console.log(res)
});
},
newMainBack() {
if (this.eid1 == "") {
this.$Message.error("请选择维保任务!");
return;
}
if (this.mainstatus == "完成") {
this.$Message.error("该维保任务已完成!");
return;
}
if (this.borw == "1") {
this.show4 = true;
this.formItemMain1.plan_start = this.ptimes;
this.formItemMain1.plan_finish = this.ptimee;
this.formItemMain1.actual_start = this.atimes;
this.formItemMain1.actual_finish = this.atimee;
this.formItemMain1.failure_notes = this.failurenotes;
}
if (this.borw == "2") {
this.show6 = true;
this.formItemMain1.plan_start = this.ptimes;
this.formItemMain1.plan_finish = this.ptimee;
this.formItemMain1.actual_start = this.atimes;
this.formItemMain1.actual_finish = this.atimee;
this.formItemMain1.failure_notes = this.failurenotes;
}
console.log(this.formItemMain1.plan_start);
},
saveOkBack() {
// console.log(str);
let url = `${systemUrl}/equipmaintainplan/createorupdate`;
let paramsdata = {
id: this.eid1,
equip_pk: this.eid,
equip_down_type: this.etype,
plan_start: this.formItemMain1.plan_start,
plan_finish: this.formItemMain1.plan_finish,
actual_start: this.formItemMain1.actual_start,
actual_finish: this.formItemMain1.actual_finish,
failure_notes: this.formItemMain1.failure_notes,
input_time: this.inputtime,
maintain_type: this.borw,
status: this.formItemMain1.status
};
console.log(paramsdata);
service
.post(`${url}`, JSON.stringify({ equipMaintainPlan: paramsdata }))
.then(res => {
if (res.data.success) {
this.changestatus(this.eid);
this.loadmain(this.eid);
setTimeout(() => {
this.laodaction();
}, 1000);
this.eid1 = "";
this.show4 = false;
this.$Message.success("更新成功");
}
});
},
selectTreeNode(value) {
if (value != "") {
this.shopid = value[0].value;
this.page = 1;
this.pageSize = 10;
this.laodaction();
}
// if (value != "") {
// this.searchObj.departmentId = null
// this.searchObj.level_Desc=value[0].value
// this.mDatas.splice(0)
// this.$http.sysUser.getSearchTable2(this.mDatas, this.searchObj)
// }
}
},
computed: {
searchList() {
let nodeList = this.treeData;
var text = this.treeInputSearch;
var newNodeList = [];
function searchTree(nodeLists, value) {
for (let i = 0; i < nodeLists.length; i++) {
if (nodeLists[i].title.indexOf(value) != -1) {
newNodeList.push(nodeLists[i]);
} else if (nodeLists[i].children.length > 0) {
searchTree(nodeLists[i].children, value);
}
}
}
if (text != "") {
searchTree(nodeList, text);
} else {
return nodeList;
}
return newNodeList;
}
}
};
</script>
<style lang="less" scoped>
.table {
margin-top: 15px;
}
</style>
<style>
.single-page-con {
overflow-y: hidden !important;
}
</style>
<template>
<div class="new-equipment">
<Modal v-model="modalShow" title="新增设备" width="1000" :mask-closable="false">
<Form :model="formItem" :label-width="100" style="margin:10px;" :rules="ruleValidate">
<Row :gutter="16">
<Col span="11">
<FormItem label="设备名称" prop="equip_name">
<Input v-model="formItem.equip_name" placeholder="请输入设备名称"></Input>
</FormItem>
</Col>
<Col span="11" offset="1">
<FormItem label="设备编号" prop="equip_id">
<Input v-model="formItem.equip_id" placeholder="请输入设备编号"></Input>
</FormItem>
</Col>
</Row>
<Row :gutter="16">
<Col span="11">
<FormItem label="设备类型" prop="equip_type">
<Select v-model="formItem.equip_type" multiple placeholder="请选择...">
<Option v-for="item in cityList" :value="item.id" :key="item.value">{{ item.label }}</Option>
</Select>
</FormItem>
</Col>
<Col span="11" offset="1">
<FormItem label="设备状态" prop="equip_status">
<Select v-model="formItem.equip_status" placeholder="请选择...">
<Option value="启用">启用</Option>
<Option value="禁用">禁用</Option>
</Select>
</FormItem>
</Col>
</Row>
<Row :gutter="16">
<Col span="11">
<FormItem label="所属部门" prop="shop_name">
<Input
v-model="formItem.shop_name"
readonly
placeholder="请选择..."
style="width:327px" >
<Button slot="append" @click="selectDepart">选择</Button>
</Input>
</FormItem>
</Col>
<Col span="11" offset="1">
<FormItem label="设备IP" prop="equip_ip">
<Input v-model="formItem.equip_ip" placeholder="请输入设备IP"></Input>
</FormItem>
</Col>
</Row>
<Row :gutter="16">
<Col span="11">
<FormItem label="设备图片">
<!-- <Upload multiple type="drag" action="//jsonplaceholder.typicode.com/posts/">
<span>上传图片</span>
<Icon type="ios-cloud-upload" size="30" style="color: #3399ff"></Icon>
</Upload> -->
<inputFile ref="refqcFile" v-model="imgName" :parms="qcfileparms" files />
</FormItem>
</Col>
<Col span="11" offset="1">
<FormItem label="是否关重" prop="isimportant">
<Select v-model="isimportant">
<Option :value="1" ></Option>
<Option :value="2" ></Option>
</Select>
</FormItem>
</Col>
</Row>
<Row :gutter="16">
<Col span="11">
<FormItem label="能力系数">
<InputNumber :min="0" v-model="formItem.capability_value" size="large" style="width:240px"></InputNumber>
</FormItem>
</Col>
<Col span="11" offset="1">
<FormItem label="位置" prop="location">
<Input v-model="formItem.location" placeholder="请输入位置"></Input>
</FormItem>
</Col>
</Row>
</Form>
<div slot="footer">
<!-- class="footers" -->
<Button @click="close">取消</Button>
<Button @click="saveOk" type="success">保存</Button>
</div>
</Modal>
<Department
:show.sync="showDeptTree"
:value.sync="formItem.shop_id"
:text.sync="formItem.shop_name"
:isAdd="false"
/>
</div>
</template>
<script>
import Department from '@/components/modalTree/department.vue'
import service from '@/plugins/request'
export default {
components: {
Department
},
name: '',
data() {
return {
qcfileparms: 'app=newEquipment&eid=23&name=newEquipment',
modalShow: false,
showDeptTree: false,
saveId:'',
title:'',
editId:'',
data1:[],
cityList:[],
imgName: '',
formItem: {
equip_name: '',
equip_id: '',
equip_type: [],
equip_pic: '',
equip_status: '',
equip_ip: '',
shop_id: '',
shop_name: '',
isimportant:2,
location:'',
capability_value:1,
},
isimportant:2,
ruleValidate: {
equip_id: [
{
required: true,
message: '设备编号不能为空!',
trigger: 'blur'
}
],
shop_name: [
{
required: true,
message: '所属部门不能为空!',
trigger: 'blur'
}
]
}
}
},
created() {
this.laodaction();
},
watch: {
imgName(newName, oldName) {
if (newName != '') {
const imgPathsArr = JSON.parse(newName)
this.formItem.equip_pic = imgPathsArr[0].filePath
}
}
},
methods: {
selectDepart() {
this.showDeptTree = true
},
laodaction(){
let url = `${systemUrl}/equiptype/getpaged`,
that = this;
service.get(`${url}`, ).then(res => {
let selectdata = res.data.result.items;
// console.log(selectdata)
selectdata.forEach(item => {
that.cityList.push({
value: item.equip_type_name,
label: item.equip_type_name,
id: item.id,
})
// console.log(that.cityList)
});
});
},
preservation() {},
close() {
this.modalShow = false
},
// 添加/编辑 弹框的保存
saveOk(){
if (!this.formItem.equip_id) {
this.$Message.error('设备编号不能为空!')
return
}
if (!this.formItem.shop_name) {
this.$Message.error('所属部门不能为空!')
return
}
let saveId = this.editId,
url = `${systemUrl}/equipinfo/createorupdate`;
// console.log(saveId);
if(!saveId){ saveId == "" }
if(this.title == '编辑设备'){
//this.$Message.success(saveId);
// if(this.formItem.selectName){
let arr=this.formItem.equip_type;
let str=arr.join(',');
let url = `${systemUrl}/equipinfo/createorupdate`;
var ar1 = this.data1.find((val) => {
if(val.id!=saveId)
return val.equip_id == this.formItem.equip_id
})
if (ar1) {
this.$Message.error('设备编号已存在!');
return
}
let paramsdata = {
"id": saveId,
"equip_id": this.formItem.equip_id,
"equip_name": this.formItem.equip_name,
"equip_status": this.formItem.equip_status,
"equip_pic": this.formItem.equip_pic,
"equip_ip": this.formItem.equip_ip,
"shop_id": this.formItem.shop_id,
"eqstyle": str,
"isimportant":this.isimportant,
"location":this.formItem.location,
"capability_value":this.formItem.capability_value,
};
// console.log(paramsdata);
service.post(`${url}`, JSON.stringify({equipInfo: paramsdata})).then(res=>{
if(res.data.success) {
this.$emit('getMessage');
this.modalShow=false;
this.$Message.success('编辑成功');
}
});
// }
}
if(this.title == '新增设备'){
let arr=this.formItem.equip_type;
let str=arr.join(',');
//console.log(str);
let url = `${systemUrl}/equipinfo/createorupdate`;
var ar = this.data1.find((val) => {
return val.equip_id == this.formItem.equip_id
})
if (ar ) {
this.$Message.error('设备编号已存在!');
return
}
let paramsdata = {
"id": this.saveId,
"equip_id": this.formItem.equip_id,
"equip_name": this.formItem.equip_name,
"equip_status": this.formItem.equip_status,
"equip_pic": this.formItem.equip_pic,
"equip_ip": this.formItem.equip_ip,
"shop_id": this.formItem.shop_id,
"eqstyle": str,
"isimportant":this.isimportant,
"location":this.formItem.location,
"capability_value":this.formItem.capability_value,
};
//console.log(this.formItem.equip_type);
service.post(`${url}`, JSON.stringify({equipInfo: paramsdata})).then(res=>{
if(res.data.success) {
this.$emit('getMessage');
this.modalShow=false;
this.$Message.success('新增成功')
}
});
}
},
}
}
</script>
<style lang="less" scoped>
.footers {
margin-right: -60px;
}
</style>
\ No newline at end of file
<template>
<div class="tree-type">
<h3 class="zh-title">产品结构</h3>
<div class="zh-box">
<Input placeholder="输入内容" style="width: auto">
<Icon type="ios-search" slot="prefix" />
</Input>
<Tree :data="treeData" class="tree-content"></Tree>
</div>
</div>
</template>
<script>
export default {
name: '',
data() {
return {
treeData: [
{
title: '工厂',
expand: true,
children: [
{
title: '生产处1',
expand: true,
children: [
{
title: '车间1'
},
{
title: '车间2'
},
{
title: '车间3'
}
]
},
{
title: '生产处2',
expand: true,
children: [
{
title: '车间1'
},
{
title: '车间2'
},
{
title: '车间3'
}
]
},
{
title: '生产处3',
expand: true,
children: [
{
title: '车间1'
},
{
title: '车间2'
},
{
title: '车间3'
}
]
}
]
}
]
}
},
mounted() {},
methods: {}
}
</script>
<style lang="less" scoped>
.tree-content{
margin-top: 15px;
}
</style>
\ No newline at end of file
<template>
<div class="deviceManagement">
<!-- 左侧树 -->
<div class="zh-tree" :style="{height:treeHeight+'px'}">
<h3 class="zh-title">组织架构</h3>
<div class="zh-box">
<Input search placeholder="请输入查询条件" clearable v-model="treeInputSearch" />
<Tree :data="searchList" class="tree-content" @on-select-change="selectTreeNode"></Tree>
</div>
</div>
<!-- 右侧内容 -->
<div class="content-right">
<div class="search-form">
<Row>
<Col span="12" style="display: flex;">
<Input
placeholder="请输入设备名称"
v-model="value1"
clearable
style="width:235px;flaot:left;"
/>
<Button type="success" class="" @click="easySearch">查询</Button>
<!-- <Button @click="advancedSearch" type="success" style="margin-left:8px;">高级搜索</Button> -->
</Col>
<Col span="12" style=" text-align: right;">
<Button type="success" @click="newEquipment">新增设备</Button>
<Button type="success" @click="newMain1">设备维修</Button>
<Button type="success" @click="newMain">设备保养</Button>
<!-- <Button type="success" @click="deleted">删除</Button> -->
</Col>
</Row>
</div>
<div class="table">
<Table
border
:loading="loading"
ref="selection"
:columns="column"
:data="datatable"
:height="this.tbHeight"
highlight-row
@on-selection-change="selectionData"
@on-current-change="selectionRow"
></Table>
<Page
:total="this.total"
:current="this.page"
:page-size="this.pageSize"
show-elevator
show-sizer
style="margin:10px 0;"
@on-change="pageChange"
@on-page-size-change="pageSizeChange"
/>
</div>
</div>
<!-- 新增设备弹框 -->
<New-Equipment ref="equipment" v-on:getMessage="laodaction"></New-Equipment>
<Modal
v-model="show"
:title="title2"
:width="500"
:mask-closable="false"
ok-text="保存"
@on-ok="saveOk"
cancel-text="取消"
>
<Form :model="formItemMain" :label-width="150" :rules="ruleValidate">
<Row>
<Col span="20">
<FormItem label="设备编号">
<Input v-model="formItemMain.equip_pk"></Input>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="设备名称">
<Input v-model="formItemMain.equip_name"></Input>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="保养类别">
<Select v-model="formItemMain.equip_down_type" placeholder="请选择" style="width:240px;">
<Option
v-for="item in sysdata"
:value="item.value"
:key="item.value"
>{{item.label }}</Option>
</Select>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="计划开始时间">
<DatePicker
:value="formItemMain.plan_start"
type="date"
placeholder="计划开始时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="计划结束时间">
<DatePicker
:value="formItemMain.plan_finish"
type="date"
placeholder="计划结束时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange1"
></DatePicker>
</FormItem>
</Col>
</Row>
</Form>
</Modal>
<Modal
v-model="show5"
:title="title1"
:width="500"
:mask-closable="false"
ok-text="保存"
@on-ok="saveOk1"
cancel-text="取消"
>
<Form :model="formItemMain" :label-width="100" :rules="ruleValidate">
<Row class="rowTitle100">
<Col :span="24">
<FormItem label="设备编号">
<Input v-model="formItemMain.equip_pk"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem label="设备名称">
<Input v-model="formItemMain.equip_name"></Input>
</FormItem>
</Col>
<Col :span="24">
<FormItem label="故障现象">
<textarea v-model="formItemMain.notes" style="width:347px"></textarea>
</FormItem>
</Col>
<Col span="24">
<FormItem label="故障时间">
<DatePicker
:value="formItemMain.input_time"
type="date"
placeholder="故障时间"
format="yyyy/MM/dd"
@on-change="handleChange2"
></DatePicker>
</FormItem>
</Col>
</Row>
</Form>
</Modal>
<Modal
v-model="show4"
title="保养反馈"
:width="500"
:mask-closable="false"
ok-text="保存"
@on-ok="saveOkBack"
cancel-text="取消"
>
<Form :model="formItemMain1" :label-width="150" :rules="ruleValidate">
<Row>
<Col span="20">
<FormItem label="计划开始时间">
<DatePicker
:value="formItemMain1.plan_start"
type="date"
placeholder="计划开始时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange3"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="计划结束时间">
<DatePicker
:value="formItemMain1.plan_finish"
type="date"
placeholder="计划结束时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange4"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="实际开始时间">
<DatePicker
:value="formItemMain1.actual_start"
type="date"
placeholder="实际开始时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange5"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="实际结束时间">
<DatePicker
:value="formItemMain1.actual_finish"
type="date"
placeholder="实际结束时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange6"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="维修记录">
<textarea v-model="formItemMain1.failure_notes"></textarea>
</FormItem>
</Col>
</Row>
</Form>
</Modal>
<Modal
v-model="show6"
title="保养反馈"
:width="500"
:mask-closable="false"
ok-text="保存"
@on-ok="saveOkBack"
cancel-text="取消"
>
<Form :model="formItemMain1" :label-width="150" :rules="ruleValidate">
<Row>
<Col span="20">
<FormItem label="计划开始时间">
<DatePicker
:value="formItemMain1.plan_start"
type="date"
placeholder="计划开始时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange7"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="计划结束时间">
<DatePicker
:value="formItemMain1.plan_finish"
type="date"
placeholder="计划结束时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange8"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="实际开始时间">
<DatePicker
:value="formItemMain1.actual_start"
type="date"
placeholder="实际开始时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange9"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="实际结束时间">
<DatePicker
:value="formItemMain1.actual_finish"
type="date"
placeholder="实际结束时间"
style="width: 240px"
format="yyyy/MM/dd"
@on-change="handleChange10"
></DatePicker>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="维修进度">
<Select v-model="formItemMain1.status" placeholder="请选择" style="width:240px;">
<Option
v-for="item in sysdata1"
:value="item.value"
:key="item.value"
>{{item.label }}</Option>
</Select>
</FormItem>
</Col>
</Row>
<Row>
<Col span="20">
<FormItem label="维修记录">
<textarea v-model="formItemMain1.failure_notes"></textarea>
</FormItem>
</Col>
</Row>
</Form>
</Modal>
<Modal
v-model="show3"
title="设备保养"
:width="1500"
:mask-closable="false"
ok-text="保存"
cancel-text="取消"
>
<div class="search-form">
<Row>
<Col span="1" style=" text-align: right;">
<Button type="success" @click="newMainBack">维保反馈</Button>
<!-- <Button type="success" @click="deleted">删除</Button> -->
</Col>
</Row>
</div>
<div class="table">
<Table
border
:loading="loading"
ref="selection"
:columns="column1"
:data="datatable1"
highlight-row
@on-selection-change="selectionData"
@on-current-change="selectionRow1"
></Table>
<!-- <Page
show-elevator
show-sizer
style="margin:10px 0;"
:current="page"
@on-change="pageChange"
@on-page-size-change="pageSizeChange"
/>-->
</div>
<div slot="footer"></div>
</Modal>
<!-- <Modal
v-model="show2"
title="提示"
:mask-closable="false"
ok-text="确定"
cancel-text="取消"
@on-ok="deleOk"
>此操作将永久删除该数据, 是否继续?</Modal> -->
</div>
</template>
<script>
import TreeType from './components/treeType.vue' //左侧树列表
import NewEquipment from './components/newEquipment.vue' //新增设备弹框
import service from '@/plugins/request'
export default {
components: {
TreeType,
NewEquipment
},
name: '',
data() {
return {
downUrl: fileUrlDown,
fileUrlPath: '',
ruleValidate:{},
tbHeight: '',
total: 0,
page: 1,
pageSize: 10,
shopid: '',
treeData: [],
treeHeight: '',
treeInputSearch: '',
loading: false,
seleId: 0,
eid: '',
eid1: '',
ptimes: '',
ptimee: '',
atimes: '',
atimee: '',
inputtime: '',
mainstatus: '',
failurenotes: '',
etype: '',
eqid: '',
eqname: '',
borw: '',
show: false,
show2: false,
show3: false,
show4: false,
show5: false,
show6: false,
title: '新增设备',
title1: '设备维修',
title2: '设备保养',
editId: '',
typepk: [],
value1: '',
formItemMain: {
equip_name: '',
equip_pk: '',
equip_down_type: '',
plan_start: '',
plan_finish: '',
input_time: '',
notes: ''
},
formItemMain1: {
equip_name: '',
equip_pk: '',
equip_down_type: '',
plan_start: '',
plan_finish: '',
actual_start: '',
actual_finish: '',
failure_notes: '',
status: ''
},
sysdata: [
{
value: '月度保养',
label: '月度保养'
},
{
value: '季度保养',
label: '季度保养'
},
{
value: '精度检查',
label: '精度检查'
},
{
value: '常规保养',
label: '常规保养'
}
],
sysdata1: [
{
value: '维护中',
label: '维护中'
},
{
value: '完成',
label: '维护完成'
}
],
column: [
// {
// type: 'selection',
// width: 60,
// align: 'center'
// },
{
type: 'index',
width: 60,
align: 'center'
},
{
title: '设备名称',
key: 'equip_name'
},
{
title: '设备编号',
key: 'equip_id'
},
{
title: '设备类型',
key: 'type_name'
},
{
title: '设备图片',
key: 'equip_pic',
render: (h, params) => {
return h('div', { class: 'action' }, [
h(
'a',
{
attrs: {
oprate: 'detail',
href: this.fileUrlPath,
target: '_blank'
},
on: {
click: () => {
this.downFile(params)
}
}
},
'查看图片'
),
])
}
},
{
title: '设备状态',
key: 'equip_status'
},
{
title: '设备IP',
key: 'equip_ip'
},
{
title: '所属部门',
key: 'shop_name'
},
{
title: '是否关重',
key: 'isimportant',
render: (h,params) => {
let statuse = params.row.isimportant
let text = statuse == 1 ? '是' : (statuse==2? '否':'')
return h('span',{},text)
}
},
{
title: '位置',
key: 'location'
},
{
title: '能力系数',
key: 'capability_value'
},
{
title: '操作',
key: 'action',
align: 'center',
width: 280,
render: (h, params) => {
return h('div', { class: 'action' },[
// h(
// 'op',
// {
// attrs:{
// oprate:'detail'
// },
// on: {
// click: () => {}
// }
// },
// '查看'
// ),
h(
'op',
{
attrs:{
oprate:'detail',
class:'edit'
},
on: {
click: () => {
this.edit(params)
}
}
},
'编辑'
),
h(
'op',
{
attrs:{
oprate:'delete'
},
style: {
color: 'red',
},
on: {
click: () => {
this.del(params)
}
}
},
'删除'
),
h(
'op',
{
attrs:{
oprate:'detail'
},
on: {
click: () => {
this.Main(params)
}
}
},
'保养'
),
h(
'op',
{
attrs:{
oprate:'detail'
},
on: {
click: () => {
this.Main1(params)
}
}
},
'维修'
)
])
}
}
],
column1: [
// {
// type: 'selection',
// width: 60,
// align: 'center'
// },
{
title: '维护状态',
key: 'status'
},
{
title: '计划人',
key: 'input_name'
},
{
title: '报修时间',
key: 'input_time'
},
{
title: '保养人',
key: 'maintain_name'
},
{
title: '计划开始时间',
key: 'plan_start'
},
{
title: '计划完成时间',
key: 'plan_finish'
},
{
title: '实际开始时间',
key: 'actual_start'
},
{
title: '实际结束时间',
key: 'actual_finish'
},
{
title: '维保类型',
key: 'equip_down_type'
}
],
datatable1: [],
datatable: [
{
name: '3D打印机',
name1: 'EOS M290',
name2: 'New York No. 1 Lake Park',
name3: '2016-10-03',
name4: '正常',
name5: '102.10.0.80',
name6: '车间1',
name7: ''
},
{
name: '3D打印机',
name1: 'EOS M290',
name2: 'New York No. 1 Lake Park',
name3: '2016-10-03',
name4: '正常',
name5: '102.10.0.80',
name6: '车间1',
name7: ''
},
{
name: '3D打印机',
name1: 'EOS M290',
name2: 'New York No. 1 Lake Park',
name3: '2016-10-03',
name4: '正常',
name5: '102.10.0.80',
name6: '车间1',
name7: ''
}
],
page: 1 //当前页 整形 选填 默认1
}
},
created() {
this.laodaction()
this.treeHeight = window.innerHeight-140
this.tbHeight = window.innerHeight - 250
},
mounted() {
this.initTree()
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
window.screenHeight = window.innerHeight;
this.treeHeight = window.screenHeight - 140;
this.tbHeight = window.screenHeight - 250;
})();
};
},
methods: {
initTree() {
this.$http.department.getDepartmentTree(this.treeData)
},
//搜索查询
easySearch() {
this.page = 1
this.pageSize = 10
this.laodaction()
},
handleChange(date) {
this.formItemMain.plan_start = date
},
handleChange1(date) {
this.formItemMain.plan_finish = date
},
handleChange2(date) {
this.formItemMain.input_time = date
},
handleChange3(date) {
this.formItemMain1.plan_start = date
},
handleChange4(date) {
this.formItemMain1.plan_finish = date
},
handleChange5(date) {
this.formItemMain1.actual_start = date
},
handleChange6(date) {
this.formItemMain1.actual_finish = date
},
handleChange7(date) {
this.formItemMain1.plan_start = date
},
handleChange8(date) {
this.formItemMain1.plan_finish = date
},
handleChange9(date) {
this.formItemMain1.actual_start = date
},
handleChange10(date) {
this.formItemMain1.actual_finish = date
},
laodaction() {
let url = `${systemUrl}/equipinfo/getpaged`
service
.get(`${url}`, {
params: {
equip_name: this.value1,
shopid: this.shopid,
pageindex: this.page,
pageSize: this.pageSize
}
})
.then((res) => {
this.datatable = res.data.result.items
this.total = res.data.result.totalCount
})
},
//高级搜索
advancedSearch() {
// this.$refs.searchBox.modalShow = true
},
//设备保养
newMain() {
if (this.eid == '') {
this.$Message.error('请选择设备!')
return
}
this.formItemMain.equip_pk = this.eqid
this.formItemMain.equip_name = this.eqname
this.show = true
},
newMain1() {
if (this.eid == '') {
this.$Message.error('请选择设备!')
return
}
this.formItemMain.equip_pk = this.eqid
this.formItemMain.equip_name = this.eqname
this.show5 = true
},
//新增设备
newEquipment() {
this.$refs.equipment.modalShow = true
this.$refs.equipment.title = '新增设备'
this.$refs.equipment.data1 = this.datatable
this.$refs.equipment.$refs.refqcFile.newName= ''
this.$refs.equipment.isimportant= 2
//this.$refs.equipment.refqcFile.newName = ''
this.$refs.equipment.formItem = {
equip_name: '',
equip_id: '',
equip_type: [],
equip_pic: '',
equip_status: '',
equip_ip: '',
shop_id: '',
shop_name: '',
isimportant:2,
location:'',
capability_value:1,
}
},
// 删除
deleted() {
this.$Modal.confirm({
title: '删除',
content: '<p>您确定要删除此设备吗</p>',
onOk: () => {
this.$Message.info('删除成功')
},
onCancel: () => {
this.$Message.info('已取消')
}
})
},
// 分页
pageChange(num) {
//console.log(num);
this.page = num
this.laodaction()
},
pageSizeChange(limit) {
//console.log(limit)
this.pageSize = limit
this.laodaction()
},
selectionData(row) {
console.log(row)
},
selectionRow(currentRow, oldCurrentRow) {
this.eqid = currentRow.equip_id
this.eqname = currentRow.equip_name
this.eid = currentRow.id
},
selectionRow1(currentRow, oldCurrentRow) {
this.ptimes = currentRow.plan_start
this.ptimee = currentRow.plan_finish
this.atimes = currentRow.actual_start
this.atimee = currentRow.actual_finish
this.inputtime = currentRow.input_time
this.etype = currentRow.equip_down_type
this.mainstatus = currentRow.status
this.eid1 = currentRow.id
this.failurenotes = currentRow.failure_notes
this.borw = currentRow.maintain_type
},
saveOk() {
// if(this.formItemMain.plan_start=='')
// {
// this.$Message.error('请选择计划开始时间!')
// return;
// }
// if(this.formItemMain.plan_finish=='')
// {
// this.$Message.error('请选择计划结束时间!')
// return;
// }
// console.log(str);
// console.log(this.formItemMain.plan_start);
// return;
let url = `${systemUrl}/equipmaintainplan/createorupdate`
let paramsdata = {
id: '',
equip_pk: this.eid,
equip_down_type: this.formItemMain.equip_down_type,
plan_start: this.formItemMain.plan_start,
plan_finish: this.formItemMain.plan_finish,
maintain_type: '1'
}
console.log(paramsdata)
service
.post(`${url}`, JSON.stringify({ equipMaintainPlan: paramsdata }))
.then((res) => {
if (res.data.success) {
this.changestatus(this.eid)
this.show = false
setTimeout(() => {
this.laodaction()
}, 1000)
this.$Message.success('新增成功')
}
})
},
downFile(path) {
console.log(path)
var path1 = path.row.equip_pic
if (path1 != '') {
this.fileUrlPath = this.downUrl + path1
} else {
this.fileUrlPath = 'javascript:void(0)'
this.$Message.error('无图片')
return
}
},
saveOk1() {
// console.log(str);
// if(this.formItemMain.input_time=='')
// {
// this.$Message.error('请选择故障时间!')
// return;
// }
let url = `${systemUrl}/equipmaintainplan/createorupdate`
let paramsdata = {
id: '',
equip_pk: this.eid,
notes: this.formItemMain.notes,
input_time: this.formItemMain.input_time,
equip_down_type: '设备故障',
maintain_type: '2'
}
console.log(paramsdata)
service
.post(`${url}`, JSON.stringify({ equipMaintainPlan: paramsdata }))
.then((res) => {
if (res.data.success) {
this.changestatus(this.eid)
this.show = false
setTimeout(() => {
this.laodaction()
}, 1000)
this.$Message.success('新增成功')
}
})
},
edit(data) {
this.$refs.equipment.$refs.refqcFile.newName= data.row.equip_pic
this.$refs.equipment.data1 = this.datatable
let url = `${systemUrl}/equipbelongtype/getbyid`
service.get(`${url}`, { params: { Id: data.row.id } }).then((res) => {
console.log(data)
this.typepk = res.data.result
this.$refs.equipment.title = '编辑设备'
this.$refs.equipment.modalShow = true
this.$refs.equipment.formItem = {
equip_name: data.row.equip_name,
equip_id: data.row.equip_id,
equip_type: this.typepk,
equip_pic: data.row.equip_pic,
equip_status: data.row.equip_status,
equip_ip: data.row.equip_ip,
shop_id: data.row.shop_id,
shop_name: data.row.shop_name,
isimportant:data.row.isimportant,
location:data.row.location,
capability_value:data.row.capability_value,
}
this.$refs.equipment.isimportant = data.row.isimportant
this.$refs.equipment.editId = data.row.id
})
},
del(data) {
this.seleId = data.row.id
let url = `${systemUrl}/equipinfo/delete`,
uId = this.seleId
service
.delete(`${systemUrl}/equipinfo/delete?id=${uId}`)
.then((res) => {
if (res.data.success) {
this.laodaction()
this.$Message.success('删除成功')
}
})
},
Main(data) {
this.eid1 = ''
this.seleId = data.row.id
let url = `${systemUrl}/equipmaintainplan/getpaged`
service
.get(`${url}`, { params: { equipid: this.seleId, maintain_type: '1' } })
.then((res) => {
//console.log(res)
this.datatable1 = res.data.result.items
if (this.datatable1.length == 0) {
this.$Message.error('该设备没有保养数据!')
this.show3 = false
return
}
this.show3 = true
})
console.log(this.datatable1)
},
Main1(data) {
this.eid1 = ''
this.seleId = data.row.id
let url = `${systemUrl}/equipmaintainplan/getpaged`
service
.get(`${url}`, { params: { equipid: this.seleId, maintain_type: '2' } })
.then((res) => {
//console.log(res)
this.datatable1 = res.data.result.items
if (this.datatable1.length == 0) {
this.$Message.error('该设备没有维修数据!')
this.show3 = false
return
}
this.show3 = true
})
},
loadmain(id) {
let url = `${systemUrl}/equipmaintainplan/getpaged`
service
.get(`${url}`, { params: { equipid: id, maintain_type: this.borw } })
.then((res) => {
//console.log(res)
this.datatable1 = res.data.result.items
})
},
changestatus(id) {
let url = `${systemUrl}/equipmaintainplan/changestatus`
service.post(`${url}`, { equipid: id }).then((res) => {
//console.log(res)
})
},
newMainBack() {
if (this.eid1 == '') {
this.$Message.error('请选择维保任务!')
return
}
if (this.mainstatus == '完成') {
this.$Message.error('该维保任务已完成!')
return
}
if (this.borw == '1') {
this.show4 = true
this.formItemMain1.plan_start = this.ptimes
this.formItemMain1.plan_finish = this.ptimee
this.formItemMain1.actual_start = this.atimes
this.formItemMain1.actual_finish = this.atimee
this.formItemMain1.failure_notes = this.failurenotes
}
if (this.borw == '2') {
this.show6 = true
this.formItemMain1.plan_start = this.ptimes
this.formItemMain1.plan_finish = this.ptimee
this.formItemMain1.actual_start = this.atimes
this.formItemMain1.actual_finish = this.atimee
this.formItemMain1.failure_notes = this.failurenotes
}
console.log(this.formItemMain1.plan_start)
},
saveOkBack() {
// console.log(str);
let url = `${systemUrl}/equipmaintainplan/createorupdate`
let paramsdata = {
id: this.eid1,
equip_pk: this.eid,
equip_down_type: this.etype,
plan_start: this.formItemMain1.plan_start,
plan_finish: this.formItemMain1.plan_finish,
actual_start: this.formItemMain1.actual_start,
actual_finish: this.formItemMain1.actual_finish,
failure_notes: this.formItemMain1.failure_notes,
input_time: this.inputtime,
maintain_type: this.borw,
status: this.formItemMain1.status
}
console.log(paramsdata)
service
.post(`${url}`, JSON.stringify({ equipMaintainPlan: paramsdata }))
.then((res) => {
if (res.data.success) {
this.changestatus(this.eid)
this.loadmain(this.eid)
setTimeout(() => {
this.laodaction()
}, 1000)
this.eid1 = ''
this.show4 = false
this.$Message.success('更新成功')
}
})
},
selectTreeNode(value) {
if (value != '') {
this.shopid = value[0].value
this.page = 1
this.pageSize = 10
this.laodaction()
}
// if (value != "") {
// this.searchObj.departmentId = null
// this.searchObj.level_Desc=value[0].value
// this.mDatas.splice(0)
// this.$http.sysUser.getSearchTable2(this.mDatas, this.searchObj)
// }
}
},
computed: {
searchList() {
let nodeList = this.treeData
var text = this.treeInputSearch
var newNodeList = []
function searchTree(nodeLists, value) {
for (let i = 0; i < nodeLists.length; i++) {
if (nodeLists[i].title.indexOf(value) != -1) {
newNodeList.push(nodeLists[i])
} else if (nodeLists[i].children.length > 0) {
searchTree(nodeLists[i].children, value)
}
}
}
if (text != '') {
searchTree(nodeList, text)
} else {
return nodeList
}
return newNodeList
}
}
}
</script>
<style lang="less" scoped>
.table {
margin-top: 15px;
}
</style>
<style>
.single-page-con {
overflow-y: hidden !important;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment