Commit cd795b18 authored by renjintao's avatar renjintao

Merge branch 'product' of git.mes123.com:zhouyx/mes-ui into product-rjt

parents 00cc6099 e9f50b41
<template>
<Tooltip trigger="hover" v-if="title" :content="title" placement="top-end">
<Tooltip trigger="hover" v-if="title" :content="title" placement="top-end">
<a class="op" :class="css" @click="handler">
<slot>
<Icon v-if="type=='icon'" :type="icon" />
......
......@@ -2,22 +2,20 @@
<Poptip placement="bottom-start" trigger="hover" width="240" transfer>
<label :class="css">{{ user.name }}</label>
<div slot="content">
<Avatar
v-if="user.face"
size="large"
:src="user.face"
></Avatar>
<Avatar v-if="user.face" size="large" :src="user.face"></Avatar>
<Avatar
v-else
size="large"
style="color: #f56a00;background-color: #fde3cf; text-align:center"
:icon="user.gender=='男'?'md-person':'md-woman'"
></Avatar>
<div>姓名:{{ user.name }}
<div>
姓名:{{ user.name }}
<tag v-if="user.isDeleted">已删除</tag>
</div>
<div>状态:
<state :value="user.status" type="tag" code="User.base.status"/>
<div>
状态:
<state :value="user.status" type="tag" code="User.base.status" />
</div>
<div>性别:{{ user.gender }}</div>
<div>部门:{{ user.department }}</div>
......@@ -27,7 +25,7 @@
</template>
<script>
export default {
name: 'User',
name: "User",
props: {
value: {
type: [Number, String],
......@@ -38,58 +36,55 @@ export default {
return {
user: {
name: this.value,
face: '',
gender: '',
roles: '',
department: '',
loginName: '',
face: "",
gender: "",
roles: "",
status:0,
department: "",
loginName: "",
id: 0
},
css:"s0"
}
css: "s0"
};
},
mounted() {
//{"id":77,"name":"杨华馥","gender":"男","department":"北京生产车间","roles":"admin","status":1,"isDeleted":false}
this.load()
this.load();
},
methods: {
load() {
if (this.value) {
var user = this.$store.getters.getUser(this.value)
var user = this.$store.getters.getUser(this.value);
if (user) {
this.user = user
} else {
this.$api
.get(`${systemUrl}/user/getuser`, { id: this.value })
.then((r) => {
// alert(JSON.stringify( r.result))
if (r.success) {
this.user = r.result
if(this.user.isDeleted){
this.css="s2"
}else if(this.user.status==1){
this.css="s1"
this.user = user;
if (this.user.isDeleted) {
this.css = "s2";
} else if (this.user.status == 1) {
this.css = "s1";
}
if(this.user.face){
this.user.face=fileUrlDown+this.user.face;
if (this.user.face) {
this.user.face = fileUrlDown + this.user.face;
}
// this.$store.commit('addUser', r.result)
}
})
}
}
}
},
watch: {
value(v) {
if (v > 0) this.load()
if (v > 0) this.load();
}
}
}
};
</script>
<style lang="less">
.s2{color: red;}
.s1{color: #333}
.s0{color:#ddd}
.s2 {
color: red;
}
.s1 {
color: #333;
}
.s0 {
color: #ddd;
}
</style>
\ No newline at end of file
......@@ -924,14 +924,14 @@ export default {
demandStartDate: '投料时间',
demandFinishDate: '节点时间',
//tempTitle------
stage:'阶段',
materialId:'材料',
routing_Method:'工艺方法',
outer_Envelope_Size:'外包络尺寸',
guestName:'甲方客户',
taskCode:'甲方任务号',
putintDocmentCode:'甲方投产输入文件(编号)',
technologyDocmentCode:'甲方技术输入文件(编号)',
stage: '阶段',
materialId: '材料',
routing_Method: '工艺方法',
outer_Envelope_Size: '外包络尺寸',
guestName: '甲方客户',
taskCode: '甲方任务号',
putintDocmentCode: '甲方投产输入文件(编号)',
technologyDocmentCode: '甲方技术输入文件(编号)',
},
mes_part_task_plan_simulate: {
id: '',
......@@ -1259,5 +1259,27 @@ export default {
productionRequirement: '生产要求',
standard: '标准指标',
qualityTemplateName: '模板文件名称',
},
plan_resource: {
id: '',
creationTime: '创建时间',
creatorUserId: '创建人',
lastModificationTime: '更新时间',
lastModifierUserId: '更新人',
isDeleted: '删除人',
deletionTime: '删除时间',
deleterUserId: '删除人',
title: '资源名称',
code: '资源编号',
type: '资源类型',
property: '属性',
departId: '部门id',
departTitle: '部门',
calId: '工作日历编号',
holidayCalId: '加班日历编号',
calName: '工作日历名称',
holidayCalName: '加班日历名称',
isimportant:'关重',
capabilityValue:'能力值',
}
}
......@@ -74,7 +74,7 @@
</Header>
<div class="i-tabs">
<transition name="fade-quick">
<i-tabs v-if="tabs" v-show="showHeader" @on-reload="handleReload" />
<i-tabs v-show="showHeader" @on-reload="handleReload" />
</transition>
</div>
<Content class="i-layout-content">
......
......@@ -22,6 +22,10 @@ export default {
menus: []
};
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
await store.dispatch("loadUsers");//加载缓存的用户
},
created() {
// 处理路由 得到每一级的路由设置
this.$store.commit("admin/page/init", frameInRoutes);
......@@ -66,7 +70,6 @@ export default {
}
},
methods: {
getMenu() {
this.$http.sysUser.getusermenu().then(res => {
if (res.result) {
......
......@@ -96,6 +96,17 @@ henq.getDate = (strDate) => {
}).match(/\d+/g) + ')');
return date;
}
henq.group=(array, f)=> {
const groups = {};
array.forEach(function (o) {
const group = JSON.stringify(f(o));
groups[group] = groups[group] || [];
groups[group].push(o);
});
return Object.keys(groups).map(function (group) {
return groups[group];
});
}
henq.toTree = (list, rootId, format, parentFiledName) => {
var upId = parentFiledName;
let i = 0;
......
......@@ -25,6 +25,10 @@ export default {
saveTeamentry(params){
return Api.post(`${PlanUrl}/teamsdispatchs/saveteamentry`, params);
},
// 删除拆分项
deleteItem(params){
return Api.get(`${PlanUrl}/teamsdispatchs/deldispatch`, params);
},
//删除:
delete(params) {
return Api.delete(`${PlanUrl}/mesorder/delete`, {
......
......@@ -14,16 +14,70 @@
<Radio label="2">已排产</Radio>
</RadioGroup>
{{listTask.length}}
<span class="check">
<RadioGroup v-model="listShow" type="button" size="small">
<Radio label="订单" title="订单分类">
<Icon type="ios-albums" />
</Radio>
<Radio label="工单" title="时间顺序">
<Icon type="ios-calendar" />
</Radio>
</RadioGroup>
</span>
</p>
<div class="dispatch_part_body" :style="{height:byheight}">
<div class="dispatch_part_body" v-if="listShow == '订单'" :style="{height:byheight}">
<!-- {{ids}} -->
<Collapse simple>
<Panel v-for="(item,index) in listOrder" :key="index" :name="item.mesCode">
<b>订单号:{{item[0].mesCode}} <Tag>{{item.length}}</Tag></b>
<!-- 订单号:{{item[0].mesCode}} {{item.length}} -->
<p slot="content">
<Row :gutter="15" class="card_body01">
<Col span="8" class="dispatch_card" v-for="(li,index) in item" :key="li.id">
<Card>
<p slot="title" class="card_top">
<Checkbox v-model="li.checked" :disabled="li.status!=-1" >
<Icon type="ios-pricetags" />工序{{li.process_seq}}{{li.process_name}}
</Checkbox>
</p>
<div class="h60">
<p class="g_title">{{li.productName}}--{{li.equipCode}}</p>
<p>
产品数量:{{li.quantity}}
<op
title="拆分"
type="icon"
icon="md-cut"
v-if="li.quantity > 1 && li.pid == 0 && li.status==-1"
@click="setChai(li,index)"
></op>
<op
title="删除"
type="icon"
icon="md-close-circle"
v-else-if="li.pid != 0"
@click="removeDetail(li,index)"
></op>
</p>
<p>{{li.beginTime}}--{{li.endTime}}</p>
<p>人员 :{{li.userNames}}</p>
<!-- <p>设备 :{{item.equipCode}}</p> -->
</div>
</Card>
</Col>
</Row>
</p>
</Panel>
</Collapse>
</div>
<div class="dispatch_part_body" v-else-if="listShow == '工单'" :style="{height:byheight}">
<Row :gutter="15" class="card_body01">
<Col span="8" class="dispatch_card" v-for="(item,index) in listTask" :key="index">
<Card>
<p slot="title" class="card_top">
<Checkbox
v-model="item.checked"
:disabled="item.dispatchStatus==2"
:disabled="item.status!=-1"
>订单号:{{item.mesCode}}</Checkbox>
</p>
<div class="h60">
......@@ -36,7 +90,7 @@
title="拆分"
type="icon"
icon="md-cut"
v-if="item.quantity > 1 && item.pid == 0"
v-if="item.quantity > 1 && item.pid == 0 && item.status==-1"
@click="setChai(item,index)"
></op>
<op
......@@ -49,6 +103,7 @@
<!-- -->
</p>
<p>{{item.beginTime}}--{{item.endTime}}</p>
<p>人员 :{{item.userNames}}</p>
<!-- <p>设备 :{{item.equipCode}}</p> -->
</div>
</Card>
......@@ -246,6 +301,7 @@ export default {
byheight: '450px',
button1: '全部',
button2: '设备',
listShow: '订单',
shebei: '',
dateRange: {
//禁选工时时间区间
......@@ -263,11 +319,13 @@ export default {
listSheBei: [], //设备列表
listMan: [], //人员列表
listTask: [], //工单列表数据
listTitle: [],//订单号列表
newList: [], //选中数据
chaiModal: false, //拆分弹框
chaiNum: 1, //拆分数量
maxnum: 1,
rowIndex: 0, //多选项的index
chaiId:0,
entity: {
taskTime: '', //工时
userIds: null, //选中人员
......@@ -349,7 +407,7 @@ export default {
this.shebeiId = id
this.footerToolbar = true
},
// 获取查询人员 listTask
// 获取查询人员
getselectuser(id) {
let parme = { departmentId: id, type: '2' }
Api.getUser(parme).then((res) => {
......@@ -374,7 +432,13 @@ export default {
let parme = { departmentId: id, DispatchStatus: this.status }
Api.getEntryList(parme).then((res) => {
var savedUl = []
var pid
res.result.map((u) => {
if(u.pid){
pid = u.pid
}else{
pid = 0
}
let detailnew = {
beginTime: u.beginTime,//开始时间
dispatchStatus: u.dispatchStatus,//
......@@ -394,13 +458,27 @@ export default {
routingHeaderId: u.routingHeaderId,//
status: u.status,//
userIds: u.userIds,//
pid: 0, //拆分项id
userNames: u.userNames,
pid: pid, //拆分项id
}
savedUl.push(detailnew)
})
this.listTask = savedUl
})
},
// 数组去重
getArray(a) {
const hash = {}
const len = a.length
const result = []
for (let i = 0; i < len; i++) {
if (!hash[a[i]]) {
hash[a[i]] = true
result.push(a[i])
}
}
return result
},
// 时间改变方法
handleChange(daterange) {
this.newList.map((u) => {
......@@ -416,6 +494,7 @@ export default {
},
// 过滤条件
changeStatus(a) {
// console.log(a)
this.getUserInfoFn()
},
// 打开抽屉
......@@ -424,13 +503,6 @@ export default {
let formData = this.listTask
let timebegin = formData[0].beginTime
let timend = formData[0].endTime
if (this.button2 == '设备') {
this.entity.taskTime = [timebegin,timend]
this.facilityModal = true
} else {
this.pentity.taskTime = [timebegin,timend]
this.manModal = true
}
this.newList = []
chekids.forEach((v) => {
var item = formData.filter((u) => {
......@@ -440,6 +512,21 @@ export default {
this.newList.push(item[0])
}
})
if (this.button2 == '设备') {
this.entity.taskTime = [timebegin,timend]
this.facilityModal = true
} else {
this.pentity.taskTime = [timebegin,timend]
if(formData.map(t=>{
this.newList.filter(m=>{
if(m.id = t.id){
console.log(m.checked)
}
})
})){
}
this.manModal = true
}
console.log('选中的数据', this.newList)
},
// 设备派工
......@@ -450,7 +537,6 @@ export default {
u.remark = this.entity.remark
u.equipId = this.shebeiId
})
// console.log(item)
this.$refs['formValidate'].validate((valid) => {
if(valid){
Api.saveTeamentry(item).then((res) => {
......@@ -474,10 +560,13 @@ export default {
u.userIds = this.peploeId
u.remark = this.pentity.remark
})
// console.log(item)
this.$refs['formpepole'].validate((valid) => {
if(valid){
Api.saveTeamentry(item).then((res) => {
let params = {
isDispatch: 1,//派工是1,保存是0
entryList: item
}
Api.saveTeamentry(params).then((res) => {
if (res.success) {
this.$Message.success('人员派工成功。')
this.getUserInfoFn()
......@@ -490,7 +579,6 @@ export default {
this.$Message.error('校验不通过...')
}
})
},
// 拆分方法
setChai(item, index) {
......@@ -502,18 +590,44 @@ export default {
okChai() {
var detail = this.$u.clone(this.listTask[this.rowIndex])
this.listTask[this.rowIndex].quantity -= this.chaiNum
// detail.pid = this.$u.guid()
detail.pid = this.$u.guid()
detail.pid = detail.id
detail.id = 0
detail.quantity = this.chaiNum
this.listTask.splice(this.rowIndex + 1, 0, detail)
console.log("拆分后数据",this.listTask)
this.saveFameData()
this.getUserInfoFn()
},
// 拆分保存
saveFameData() {
let params = {
isDispatch: 0,//派工是1,保存是0
entryList: this.listTask
}
Api.saveTeamentry(params).then((res) => {
if (res.success) {
this.$Message.success('拆分成功。')
} else {
this.$Message.error('拆分失败...')
}
})
},
// 删除行
removeDetail(item, index) {
let oldList = this.listTask;
let clickRow = oldList.filter(listRow=>listRow.process_name===item.process_name)[0];
clickRow.quantity += this.chaiNum
this.listTask.splice(index, 1)
let delid = {id:item.id}
Api.deleteItem(delid).then((res) => {
if (res.success) {
this.$Message.success('拆分项已删除。')
this.getUserInfoFn()
} else {
this.$Message.error('拆分项删除失败!')
}
})
// let oldList = this.listTask;
// let clickRow = oldList.filter(listRow=>listRow.process_name===item.process_name)[0];
// clickRow.quantity += this.chaiNum
// this.listTask.splice(index, 1)
// this.$Message.success('拆分项已删除。')
},
cancle() {//取消
this.facilityModal = false
......@@ -534,6 +648,13 @@ export default {
}
return ids
},
listOrder(){
let orders= this.$u.group(this.listTask,u=>{
return u.mesCode
})
console.warn("listOrder",orders)
return orders;
},
peploeId() {
let peploeId = []
this.listMan.map((u) => {
......
......@@ -34,11 +34,7 @@
<Row :gutter="16">
<Col span="11">
<FormItem label="所属部门" prop="shop_name">
<Input
v-model="formItem.shop_name"
readonly
placeholder="请选择..."
style="width:327px" >
<Input v-model="formItem.shop_name" readonly placeholder="请选择..." style="width:327px">
<Button slot="append" @click="selectDepart">选择</Button>
</Input>
</FormItem>
......@@ -50,20 +46,20 @@
</Col>
</Row>
<Row :gutter="16">
<Col span="11">
<Col span="12">
<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> -->
</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>
<Option :value="1"></Option>
<Option :value="2"></Option>
</Select>
</FormItem>
</Col>
......@@ -71,7 +67,12 @@
<Row :gutter="16">
<Col span="11">
<FormItem label="能力系数">
<InputNumber :min="0" v-model="formItem.capability_value" size="large" style="width:240px"></InputNumber>
<InputNumber
:min="0"
v-model="formItem.capability_value"
size="large"
style="width:240px"
></InputNumber>
</FormItem>
</Col>
<Col span="11" offset="1">
......@@ -80,6 +81,13 @@
</FormItem>
</Col>
</Row>
<Row :gutter="16">
<Col :span="12">
<FormItem label="属性">
<Checkbox v-model="property">排产资源</Checkbox>
</FormItem>
</Col>
</Row>
</Form>
<div slot="footer">
<!-- class="footers" -->
......@@ -97,180 +105,194 @@
</template>
<script>
import Department from '@/components/modalTree/department.vue'
import service from '@/plugins/request'
import Department from "@/components/modalTree/department.vue";
import service from "@/plugins/request";
export default {
components: {
Department
},
name: '',
name: "",
data() {
return {
qcfileparms: 'app=newEquipment&eid=23&name=newEquipment',
qcfileparms: "app=newEquipment&eid=23&name=newEquipment",
modalShow: false,
showDeptTree: false,
saveId:'',
title:'',
editId:'',
data1:[],
cityList:[],
imgName: '',
saveId: "",
title: "",
editId: "",
data1: [],
cityList: [],
imgName: "",
formItem: {
equip_name: '',
equip_id: '',
equip_name: "",
equip_id: "",
equip_type: [],
equip_pic: '',
equip_status: '',
equip_ip: '',
shop_id: '',
shop_name: '',
isimportant:2,
location:'',
capability_value:1,
equip_pic: "",
equip_status: "",
equip_ip: "",
shop_id: "",
shop_name: "",
isimportant: 2,
location: "",
capability_value: 1
},
isimportant:2,
property: true,
isimportant: 2,
ruleValidate: {
equip_id: [
{
required: true,
message: '设备编号不能为空!',
trigger: 'blur'
message: "设备编号不能为空!",
trigger: "blur"
}
],
shop_name: [
{
required: true,
message: '所属部门不能为空!',
trigger: 'blur'
message: "所属部门不能为空!",
trigger: "blur"
}
]
}
}
};
},
created() {
this.laodaction();
},
watch: {
imgName(newName, oldName) {
if (newName != '') {
const imgPathsArr = JSON.parse(newName)
this.formItem.equip_pic = imgPathsArr[0].filePath
if (newName != "") {
const imgPathsArr = JSON.parse(newName);
this.formItem.equip_pic = imgPathsArr[0].filePath;
}
}
},
methods: {
selectDepart() {
this.showDeptTree = true
this.showDeptTree = true;
},
laodaction(){
laodaction() {
let url = `${systemUrl}/equiptype/getpaged`,
that = this;
service.get(`${url}`, ).then(res => {
service.get(`${url}`).then(res => {
let selectdata = res.result.items;
// console.log(selectdata)
selectdata.forEach(item => {
that.cityList.push({
value: item.equip_type_name,
label: item.equip_type_name,
id: item.id,
})
id: item.id
});
// console.log(that.cityList)
});
});
},
preservation() {},
close() {
this.modalShow = false
this.modalShow = false;
},
// 添加/编辑 弹框的保存
saveOk(){
saveOk() {
if (!this.formItem.equip_id) {
this.$Message.error('设备编号不能为空!')
return
this.$Message.error("设备编号不能为空!");
return;
}
if (!this.formItem.shop_name) {
this.$Message.error('所属部门不能为空!')
return
this.$Message.error("所属部门不能为空!");
return;
}
let saveId = this.editId,
url = `${systemUrl}/equipinfo/createorupdate`;
// console.log(saveId);
if(!saveId){ saveId == "" }
if(this.title == '编辑设备'){
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 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
})
var ar1 = this.data1.find(val => {
if (val.id != saveId) return val.equip_id == this.formItem.equip_id;
});
if (ar1) {
this.$Message.error('设备编号已存在!');
return
this.$Message.error("设备编号已存在!");
return;
}
if (this.property == true) {
this.property = 2;
} else {
this.property = "";
}
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,
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,
property: this.property
};
// console.log(paramsdata);
service.post(`${url}`, {equipInfo: paramsdata}).then(res=>{
if(res.success) {
this.$emit('getMessage');
this.modalShow=false;
this.$Message.success('编辑成功');
service.post(`${url}`, { equipInfo: paramsdata }).then(res => {
if (res.success) {
this.$emit("getMessage");
this.modalShow = false;
this.$Message.success("编辑成功");
}
});
// }
}
if(this.title == '新增设备'){
let arr=this.formItem.equip_type;
let str=arr.join(',');
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
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,
if (this.property == true) {
this.property = 2;
} else {
this.property = "";
}
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,
property: this.property
};
//console.log(this.formItem.equip_type);
service.post(`${url}`, {equipInfo: paramsdata}).then(res=>{
if(res.success) {
this.$emit('getMessage');
this.modalShow=false;
this.$Message.success('新增成功')
service.post(`${url}`, { equipInfo: paramsdata }).then(res => {
if (res.success) {
this.$emit("getMessage");
this.modalShow = false;
this.$Message.success("新增成功");
}
});
}
},
}
}
}
};
</script>
<style lang="less" scoped>
......
......@@ -19,7 +19,7 @@
clearable
style="width:235px;flaot:left;"
/>
<Button type="primary" class="" @click="easySearch">查询</Button>
<Button type="primary" class @click="easySearch">查询</Button>
<!-- <Button @click="advancedSearch" type="success" style="margin-left:8px;">高级搜索</Button> -->
</Col>
<Col span="12" style=" text-align: right;">
......@@ -371,106 +371,106 @@
ok-text="确定"
cancel-text="取消"
@on-ok="deleOk"
>此操作将永久删除该数据, 是否继续?</Modal> -->
>此操作将永久删除该数据, 是否继续?</Modal>-->
</div>
</template>
<script>
import TreeType from './components/treeType.vue' //左侧树列表
import NewEquipment from './components/newEquipment.vue' //新增设备弹框
import service from '@/plugins/request'
import TreeType from "./components/treeType.vue"; //左侧树列表
import NewEquipment from "./components/newEquipment.vue"; //新增设备弹框
import service from "@/plugins/request";
export default {
components: {
TreeType,
NewEquipment
},
name: '',
name: "",
data() {
return {
downUrl: fileUrlDown,
fileUrlPath: '',
ruleValidate:{},
tbHeight: '',
fileUrlPath: "",
ruleValidate: {},
tbHeight: "",
total: 0,
page: 1,
pageSize: 10,
shopid: '',
shopid: "",
treeData: [],
treeHeight: '',
treeInputSearch: '',
treeHeight: "",
treeInputSearch: "",
loading: false,
seleId: 0,
eid: '',
eid1: '',
ptimes: '',
ptimee: '',
atimes: '',
atimee: '',
inputtime: '',
mainstatus: '',
failurenotes: '',
etype: '',
eqid: '',
eqname: '',
borw: '',
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: '',
title: "新增设备",
title1: "设备维修",
title2: "设备保养",
editId: "",
typepk: [],
value1: '',
value1: "",
formItemMain: {
equip_name: '',
equip_pk: '',
equip_down_type: '',
plan_start: '',
plan_finish: '',
input_time: '',
notes: ''
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: ''
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: "季度保养"
},
{
value: '精度检查',
label: '精度检查'
value: "精度检查",
label: "精度检查"
},
{
value: '常规保养',
label: '常规保养'
value: "常规保养",
label: "常规保养"
}
],
sysdata1: [
{
value: '维护中',
label: '维护中'
value: "维护中",
label: "维护中"
},
{
value: '完成',
label: '维护完成'
value: "完成",
label: "维护完成"
}
],
column: [
......@@ -480,82 +480,82 @@ export default {
// align: 'center'
// },
{
type: 'index',
type: "index",
width: 60,
align: 'center'
align: "center"
},
{
title: '设备名称',
key: 'equip_name'
title: "设备名称",
key: "equip_name"
},
{
title: '设备编号',
key: 'equip_id'
title: "设备编号",
key: "equip_id"
},
{
title: '设备类型',
key: 'type_name'
title: "设备类型",
key: "type_name"
},
{
title: '设备图片',
key: 'equip_pic',
title: "设备图片",
key: "equip_pic",
render: (h, params) => {
return h('div', { class: 'action' }, [
return h("div", { class: "action" }, [
h(
'a',
"a",
{
attrs: {
oprate: 'detail',
oprate: "detail",
href: this.fileUrlPath,
target: '_blank'
target: "_blank"
},
on: {
click: () => {
this.downFile(params)
this.downFile(params);
}
}
},
'查看图片'
),
])
"查看图片"
)
]);
}
},
{
title: '设备状态',
key: 'equip_status'
title: "设备状态",
key: "equip_status"
},
{
title: '设备IP',
key: 'equip_ip'
title: "设备IP",
key: "equip_ip"
},
{
title: '所属部门',
key: 'shop_name'
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: "isimportant",
render: (h, params) => {
let statuse = params.row.isimportant;
let text = statuse == 1 ? "是" : statuse == 2 ? "否" : "";
return h("span", {}, text);
}
},
{
title: '位置',
key: 'location'
title: "位置",
key: "location"
},
{
title: '能力系数',
key: 'capability_value'
title: "能力系数",
key: "capability_value"
},
{
title: '操作',
key: 'action',
align: 'center',
title: "操作",
key: "action",
align: "center",
width: 280,
render: (h, params) => {
return h('div', { class: 'action' },[
return h("div", { class: "action" }, [
// h(
// 'op',
// {
......@@ -569,66 +569,66 @@ export default {
// '查看'
// ),
h(
'op',
"op",
{
attrs:{
oprate:'detail',
class:'edit'
attrs: {
oprate: "detail",
class: "edit"
},
on: {
click: () => {
this.edit(params)
this.edit(params);
}
}
},
'编辑'
"编辑"
),
h(
'op',
"op",
{
attrs:{
oprate:'delete'
attrs: {
oprate: "delete"
},
style: {
color: 'red',
color: "red"
},
on: {
click: () => {
this.del(params)
this.del(params);
}
}
},
'删除'
"删除"
),
h(
'op',
"op",
{
attrs:{
oprate:'detail'
attrs: {
oprate: "detail"
},
on: {
click: () => {
this.Main(params)
this.Main(params);
}
}
},
'保养'
"保养"
),
h(
'op',
"op",
{
attrs:{
oprate:'detail'
attrs: {
oprate: "detail"
},
on: {
click: () => {
this.Main1(params)
this.Main1(params);
}
}
},
'维修'
"维修"
)
])
]);
}
}
],
......@@ -639,85 +639,85 @@ export default {
// align: 'center'
// },
{
title: '维护状态',
key: 'status'
title: "维护状态",
key: "status"
},
{
title: '计划人',
key: 'input_name'
title: "计划人",
key: "input_name"
},
{
title: '报修时间',
key: 'input_time'
title: "报修时间",
key: "input_time"
},
{
title: '保养人',
key: 'maintain_name'
title: "保养人",
key: "maintain_name"
},
{
title: '计划开始时间',
key: 'plan_start'
title: "计划开始时间",
key: "plan_start"
},
{
title: '计划完成时间',
key: 'plan_finish'
title: "计划完成时间",
key: "plan_finish"
},
{
title: '实际开始时间',
key: 'actual_start'
title: "实际开始时间",
key: "actual_start"
},
{
title: '实际结束时间',
key: 'actual_finish'
title: "实际结束时间",
key: "actual_finish"
},
{
title: '维保类型',
key: 'equip_down_type'
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: ''
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
this.laodaction();
this.treeHeight = window.innerHeight - 140;
this.tbHeight = window.innerHeight - 250;
},
mounted() {
this.initTree()
this.initTree();
window.onresize = () => {
///浏览器窗口大小变化
return (() => {
......@@ -729,60 +729,60 @@ export default {
},
methods: {
initTree() {
this.$http.department.getDepartmentTree(this.treeData)
this.$http.department.getDepartmentTree(this.treeData);
},
//搜索查询
easySearch() {
this.page = 1
this.pageSize = 10
this.laodaction()
this.page = 1;
this.pageSize = 10;
this.laodaction();
},
handleChange(date) {
this.formItemMain.plan_start = date
this.formItemMain.plan_start = date;
},
handleChange1(date) {
this.formItemMain.plan_finish = date
this.formItemMain.plan_finish = date;
},
handleChange2(date) {
this.formItemMain.input_time = date
this.formItemMain.input_time = date;
},
handleChange3(date) {
this.formItemMain1.plan_start = date
this.formItemMain1.plan_start = date;
},
handleChange4(date) {
this.formItemMain1.plan_finish = date
this.formItemMain1.plan_finish = date;
},
handleChange5(date) {
this.formItemMain1.actual_start = date
this.formItemMain1.actual_start = date;
},
handleChange6(date) {
this.formItemMain1.actual_finish = date
this.formItemMain1.actual_finish = date;
},
handleChange7(date) {
this.formItemMain1.plan_start = date
this.formItemMain1.plan_start = date;
},
handleChange8(date) {
this.formItemMain1.plan_finish = date
this.formItemMain1.plan_finish = date;
},
handleChange9(date) {
this.formItemMain1.actual_start = date
this.formItemMain1.actual_start = date;
},
handleChange10(date) {
this.formItemMain1.actual_finish = date
this.formItemMain1.actual_finish = date;
},
laodaction() {
let url = `${systemUrl}/equipinfo/getpaged`
let url = `${systemUrl}/equipinfo/getpaged`;
service
.get(`${url}`,{
.get(`${url}`, {
equip_name: this.value1,
shopid: this.shopid,
pageindex: this.page,
pageSize: this.pageSize
})
.then((res) => {
this.datatable = res.result.items
this.total = res.result.totalCount
})
.then(res => {
this.datatable = res.result.items;
this.total = res.result.totalCount;
});
},
//高级搜索
advancedSearch() {
......@@ -790,88 +790,89 @@ export default {
},
//设备保养
newMain() {
if (this.eid == '') {
this.$Message.error('请选择设备!')
return
if (this.eid == "") {
this.$Message.error("请选择设备!");
return;
}
this.formItemMain.equip_pk = this.eqid
this.formItemMain.equip_name = this.eqname
this.show = true
this.formItemMain.equip_pk = this.eqid;
this.formItemMain.equip_name = this.eqname;
this.show = true;
},
newMain1() {
if (this.eid == '') {
this.$Message.error('请选择设备!')
return
if (this.eid == "") {
this.$Message.error("请选择设备!");
return;
}
this.formItemMain.equip_pk = this.eqid
this.formItemMain.equip_name = this.eqname
this.show5 = true
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.property = true;
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_name: "",
equip_id: "",
equip_type: [],
equip_pic: '',
equip_status: '',
equip_ip: '',
shop_id: '',
shop_name: '',
isimportant:2,
location:'',
capability_value:1,
}
equip_pic: "",
equip_status: "",
equip_ip: "",
shop_id: "",
shop_name: "",
isimportant: 2,
location: "",
capability_value: 1
};
},
// 删除
deleted() {
this.$Modal.confirm({
title: '删除',
content: '<p>您确定要删除此设备吗</p>',
title: "删除",
content: "<p>您确定要删除此设备吗</p>",
onOk: () => {
this.$Message.info('删除成功')
this.$Message.info("删除成功");
},
onCancel: () => {
this.$Message.info('已取消')
this.$Message.info("已取消");
}
})
});
},
// 分页
pageChange(num) {
//console.log(num);
this.page = num
this.laodaction()
this.page = num;
this.laodaction();
},
pageSizeChange(limit) {
//console.log(limit)
this.pageSize = limit
this.laodaction()
this.pageSize = limit;
this.laodaction();
},
selectionData(row) {
console.log(row)
console.log(row);
},
selectionRow(currentRow, oldCurrentRow) {
this.eqid = currentRow.equip_id
this.eqname = currentRow.equip_name
this.eid = currentRow.id
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
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=='')
......@@ -887,38 +888,36 @@ export default {
// console.log(str);
// console.log(this.formItemMain.plan_start);
// return;
let url = `${systemUrl}/equipmaintainplan/createorupdate`
let url = `${systemUrl}/equipmaintainplan/createorupdate`;
let paramsdata = {
id: '',
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}`, { equipMaintainPlan: paramsdata })
.then((res) => {
maintain_type: "1"
};
console.log(paramsdata);
service.post(`${url}`, { equipMaintainPlan: paramsdata }).then(res => {
if (res.success) {
this.changestatus(this.eid)
this.show = false
this.changestatus(this.eid);
this.show = false;
setTimeout(() => {
this.laodaction()
}, 1000)
this.$Message.success('新增成功')
this.laodaction();
}, 1000);
this.$Message.success("新增成功");
}
})
});
},
downFile(path) {
console.log(path)
var path1 = path.row.equip_pic
if (path1 != '') {
this.fileUrlPath = this.downUrl + path1
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
this.fileUrlPath = "javascript:void(0)";
this.$Message.error("无图片");
return;
}
},
saveOk1() {
......@@ -929,38 +928,36 @@ export default {
// return;
// }
let url = `${systemUrl}/equipmaintainplan/createorupdate`
let url = `${systemUrl}/equipmaintainplan/createorupdate`;
let paramsdata = {
id: '',
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}`, { equipMaintainPlan: paramsdata })
.then((res) => {
equip_down_type: "设备故障",
maintain_type: "2"
};
console.log(paramsdata);
service.post(`${url}`, { equipMaintainPlan: paramsdata }).then(res => {
if (res.success) {
this.changestatus(this.eid)
this.show = false
this.changestatus(this.eid);
this.show = false;
setTimeout(() => {
this.laodaction()
}, 1000)
this.$Message.success('新增成功')
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}`, { Id: data.row.id }).then((res) => {
console.log(data)
this.typepk = res.result
this.$refs.equipment.title = '编辑设备'
this.$refs.equipment.modalShow = true
this.$refs.equipment.$refs.refqcFile.newName = data.row.equip_pic;
this.$refs.equipment.data1 = this.datatable;
let url = `${systemUrl}/equipbelongtype/getbyid`;
service.get(`${url}`, { Id: data.row.id }).then(res => {
console.log(data);
this.typepk = res.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,
......@@ -970,109 +967,112 @@ export default {
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,
isimportant: data.row.isimportant,
location: data.row.location,
capability_value: data.row.capability_value
};
if (data.row.property == 2) {
this.$refs.equipment.property = true;
} else {
this.$refs.equipment.property = false;
}
this.$refs.equipment.isimportant = data.row.isimportant
this.$refs.equipment.editId = data.row.id
})
this.$refs.equipment.isimportant = data.row.isimportant;
this.$refs.equipment.editId = data.row.id;
});
},
del(data) {
this.seleId = data.row.id
this.seleId = data.row.id;
let url = `${systemUrl}/equipinfo/delete`,
uId = this.seleId
service
.delete(`${systemUrl}/equipinfo/delete?id=${uId}`)
.then((res) => {
uId = this.seleId;
service.delete(`${systemUrl}/equipinfo/delete?id=${uId}`).then(res => {
if (res.success) {
this.laodaction()
this.$Message.success('删除成功')
this.laodaction();
this.$Message.success("删除成功");
}
})
});
},
Main(data) {
this.eid1 = ''
this.seleId = data.row.id
let url = `${systemUrl}/equipmaintainplan/getpaged`
this.eid1 = "";
this.seleId = data.row.id;
let url = `${systemUrl}/equipmaintainplan/getpaged`;
service
.get(`${url}`,{ equipid: this.seleId, maintain_type: '1' })
.then((res) => {
.get(`${url}`, { equipid: this.seleId, maintain_type: "1" })
.then(res => {
//console.log(res)
this.datatable1 = res.result.items
this.datatable1 = res.result.items;
if (this.datatable1.length == 0) {
this.$Message.error('该设备没有保养数据!')
this.show3 = false
return
this.$Message.error("该设备没有保养数据!");
this.show3 = false;
return;
}
this.show3 = true
})
console.log(this.datatable1)
this.show3 = true;
});
console.log(this.datatable1);
},
Main1(data) {
this.eid1 = ''
this.seleId = data.row.id
let url = `${systemUrl}/equipmaintainplan/getpaged`
this.eid1 = "";
this.seleId = data.row.id;
let url = `${systemUrl}/equipmaintainplan/getpaged`;
service
.get(`${url}`, { equipid: this.seleId, maintain_type: '2' })
.then((res) => {
.get(`${url}`, { equipid: this.seleId, maintain_type: "2" })
.then(res => {
//console.log(res)
this.datatable1 = res.result.items
this.datatable1 = res.result.items;
if (this.datatable1.length == 0) {
this.$Message.error('该设备没有维修数据!')
this.show3 = false
return
this.$Message.error("该设备没有维修数据!");
this.show3 = false;
return;
}
this.show3 = true
})
this.show3 = true;
});
},
loadmain(id) {
let url = `${systemUrl}/equipmaintainplan/getpaged`
let url = `${systemUrl}/equipmaintainplan/getpaged`;
service
.get(`${url}`,{ equipid: id, maintain_type: this.borw })
.then((res) => {
.get(`${url}`, { equipid: id, maintain_type: this.borw })
.then(res => {
//console.log(res)
this.datatable1 = res.result.items
})
this.datatable1 = res.result.items;
});
},
changestatus(id) {
let url = `${systemUrl}/equipmaintainplan/changestatus`
service.post(`${url}`, { equipid: id }).then((res) => {
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.eid1 == "") {
this.$Message.error("请选择维保任务!");
return;
}
if (this.mainstatus == '完成') {
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 == "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
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)
console.log(this.formItemMain1.plan_start);
},
saveOkBack() {
// console.log(str);
let url = `${systemUrl}/equipmaintainplan/createorupdate`
let url = `${systemUrl}/equipmaintainplan/createorupdate`;
let paramsdata = {
id: this.eid1,
equip_pk: this.eid,
......@@ -1085,29 +1085,27 @@ export default {
input_time: this.inputtime,
maintain_type: this.borw,
status: this.formItemMain1.status
}
console.log(paramsdata)
service
.post(`${url}`, { equipMaintainPlan: paramsdata })
.then((res) => {
};
console.log(paramsdata);
service.post(`${url}`, { equipMaintainPlan: paramsdata }).then(res => {
if (res.success) {
this.changestatus(this.eid)
this.loadmain(this.eid)
this.changestatus(this.eid);
this.loadmain(this.eid);
setTimeout(() => {
this.laodaction()
}, 1000)
this.eid1 = ''
this.show4 = false
this.$Message.success('更新成功')
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.shopid = value[0].value;
this.page = 1;
this.pageSize = 10;
this.laodaction();
}
// if (value != "") {
// this.searchObj.departmentId = null
......@@ -1119,27 +1117,27 @@ export default {
},
computed: {
searchList() {
let nodeList = this.treeData
var text = this.treeInputSearch
var newNodeList = []
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])
newNodeList.push(nodeLists[i]);
} else if (nodeLists[i].children.length > 0) {
searchTree(nodeLists[i].children, value)
searchTree(nodeLists[i].children, value);
}
}
}
if (text != '') {
searchTree(nodeList, text)
if (text != "") {
searchTree(nodeList, text);
} else {
return nodeList
return nodeList;
}
return newNodeList
return newNodeList;
}
}
}
};
</script>
<style lang="less" scoped>
......
// import Api from '@/api/axios'
import Api from '@/plugins/request'
export default {
index: `${systemUrl}/planresource/paged`,
paged(params) {
return Api.post(`${systemUrl}/planresource/paged`, params);
},
get(params) {
return Api.get(`${systemUrl}/planresource/get`, params);
},
create(params) {
return Api.post(`${systemUrl}/mesdailyworksched/list`, params);
},
create1(params) {
return Api.post(`${systemUrl}/mesholidaycal/list`, params);
},
update(params) {
return Api.post(`${systemUrl}/equipcalendarwork/createorupdate`, params);
},
//删除:
delete(params) {
return Api.delete(`${systemUrl}/planresource/delete`, { params: params });
},
}
\ No newline at end of file
<template>
<div>
<DataGrid :columns="columns" ref="grid" :action="action" :high="false">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入关键字资源名称/资源编号/资源类型/部门" v-model="easySearch.keys.value" />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
</DataGrid>
<Modal v-model="editModal" title="编辑" footer-hide>
<Set :eid="curId" @on-close="cancel" @on-ok="addOk" />
</Modal>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel">
<p>确定删除?</p>
</Modal>
</div>
</template>
<script>
import Api from "./api";
import Set from "./set";
export default {
name: "list",
components: {
Set
},
data() {
return {
action: Api.index,
easySearch: {
keys: { op: "title,code,type,departTitle", value: null }
},
editModal: false,
deletelModal: false,
curId: 0,
columns: [
{ key: "id", title: this.l("id"), hide: true, align: "left" },
// {
// key: "deleterUserId",
// title: this.l("deleterUserId"),
// hide: true,
// align: "left"
// },
{
key: "title",
title: this.l("title"),
align: "left",
easy: true,
high: true
},
{
key: "code",
title: this.l("code"),
align: "left",
easy: true,
high: true
},
{
key: "type",
title: this.l("type"),
align: "center",
code: "aps.resource.type",
easy: true,
high: true
},
// {
// key: "property",
// title: this.l("property"),
// align: "left",
// high: true
// },
// {
// key: "departId",
// title: this.l("departId"),
// align: "left",
// high: true
// },
{
key: "departTitle",
title: this.l("departTitle"),
align: "left",
easy: true,
high: true
},
{
key: "calId",
title: this.l("calId"),
align: "center",
easy: true,
high: true
},
{
key: "holidayCalId",
title: this.l("holidayCalId"),
align: "center",
easy: true,
high: true
},
{
key: "calName",
title: this.l("calName"),
align: "left",
easy: true,
high: true
},
{
key: "holidayCalName",
title: this.l("holidayCalName"),
align: "left",
easy: true,
high: true
},
{
title: "操作",
key: "id",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) }
},
"设置日历"
),
h(
"op",
{
attrs: { oprate: "remove" },
on: { click: () => this.remove(params.row.id) }
},
"删除"
)
]);
}
}
]
};
},
mounted() {
console.log(this);
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
addOk() {
this.$refs.grid.load();
this.editModal = false;
this.curId = 0;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
edit(id) {
this.editModal = true;
this.curId = id;
},
remove(id) {
this.deletelModal = true;
this.curId = id;
},
removeOk() {
Api.delete({ id: this.curId }).then(r => {
if (r.success) {
this.$refs.grid.load();
this.deletelModal = false;
this.$Message.success("删除成功");
}
});
},
removeCancel() {
this.deletelModal = false;
},
cancel() {
this.curId = 0;
this.addModal = false;
this.detailModal = false;
this.editModal = false;
this.deletedlModal = false;
},
l(key) {
let vkey = "plan_resource" + "." + key;
return this.$t(vkey) || key;
}
}
};
</script>
<style lang="less">
</style>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col span="12">
<FormItem label="资源名称" prop="equip_name">
<Input v-model="formItem.equip_name" placeholder="请输入设备名称" readonly></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="资源编号" prop="equip_id">
<Input v-model="formItem.equip_id" placeholder="请输入设备编号" readonly></Input>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="工作日历" prop="work">
<Select v-model="formItem1.calendarwork_pk" clearable placeholder="请选择...">
<Option v-for="item in workList" :value="item.id" :key="item.calName">{{ item.calName }}</Option>
</Select>
</FormItem>
</Col>
<Col :span="12">
<FormItem label="加班日历" prop="overtime">
<Select v-model="formItem2.calendarovertime_pk" clearable placeholder="请选择...">
<Option
v-for="item in overtimeList"
:value="item.id"
:key="item.holidayCalName"
>{{ item.holidayCalName }}</Option>
</Select>
</FormItem>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Edit",
data() {
return {
disabled: false,
workList: [],
overtimeList: [],
formItem: {
equip_name: "",
equip_id: ""
},
formItem1: {
id: 0,
equip_pk: 0,
calendarwork_pk: 0
},
formItem2: {
id: 0,
equip_pk: 0,
calendarovertime_pk: 0
},
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }]
}
};
},
props: {
eid: Number
},
created() {
this.laodaction();
},
methods: {
laodaction() {
let parmse = {
pageIndex: 1,
conditions: [],
pageSize: 10
};
Api.create(parmse).then(r => {
if (r.success) {
this.workList = r.result;
} else {
this.$Message.error("获取数据失败...");
}
});
Api.create1(parmse).then(r => {
if (r.success) {
this.overtimeList = r.result;
} else {
this.$Message.error("获取数据失败...");
}
});
},
load(v) {
Api.get({ id: v }).then(r => {
this.formItem.equip_name = r.result.title;
this.formItem.equip_id = r.result.code;
this.formItem1.equip_pk = r.result.id;
this.formItem2.equip_pk = r.result.id;
});
},
handleSubmit() {
this.$refs.form.validate(v => {
if (v) {
this.disabled = true;
Api.update({
equipCalendarWork: this.formItem1,
equipCalendarOverTime: this.formItem2
})
.then(r => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch(err => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "plan_resource" + "." + key;
return this.$t(key);
}
},
watch: {
eid(v) {
if (v != 0) {
this.formItem1.calendarwork_pk = "";
this.formItem2.calendarovertime_pk = "";
this.load(v);
}
}
}
};
</script>
\ No newline at end of file
import createVuexAlong from 'vuex-along'
import Api from '@/plugins/request'
export const state = () => ({
counter: 0,
dictionary: new Map(), //所有字典项
userMap: [], //所有用户缓存;
userInfo: {
userId: 0,
userName: ""
export const state=()=>({
counter:0,
dictionary: new Map(),//所有字典项
userMap:new Map(),//所有用户缓存;
userInfo:{
userId:0,
userName:""
},
cart:[],
count: 0,
......@@ -15,7 +15,7 @@ export const state = () => ({
countAll:0,//整机排产
countRun:0,//流水排产
})
export const getters = {
export const getters={
dictionaryByKey: (state) => (key) => {
let result = [];
let items = state.dictionary.get(key);
......@@ -25,26 +25,15 @@ export const getters = {
}
return result;
},
getUser: state => key => {
// try{
// if(state.userMap.has(key)){
// return state.userMap.get(key);
// }
// }catch(e){
// console.log(e);
// }
let user = state.userMap.filter(u => {
return u.id == key
});
if (user.length > 0) {
return user[0]
} else {
return null;
getUser:(state)=>key=>{
// debugger
if(state.userMap&&state.userMap.get){
return state.userMap.get(key);
}
}
}
export const mutations = {
increment(state) {
export const mutations={
increment(state){
state.counter++
},
setUserInfo(state, userInfo) {
......@@ -52,7 +41,10 @@ export const mutations = {
// sessionStorage.setItem("userInfo", JSON.stringify(userInfo));
// sessionStorage.setItem("token", userInfo.token);
},
addUser(state, user) {
setUsers(state,users){
state.userMap=users;
},
addUser(state,user){
state.userMap.push(user);
},
setDictionary(state, dictionary) {
......@@ -78,26 +70,24 @@ export const mutations = {
}
}
export const actions = {
async loadUser({
commit
}, key) {
export const actions={
async loadUser({commit},key){
let {
result
} = await this.$api.get(`${systemUrl}/user/getuser`, {
id: key
let { result } = await Api.get(`${systemUrl}/user/getuser`,{id:key});
console.warn("result",result)
commit("addUser",result);
},
async loadUsers({commit}){
let { result } = await Api.get(`${systemUrl}/user/getuserlist`);
var map=new Map();
result.map(u=>{
map.set(u.id,u);
});
console.warn("result", result)
commit("addUser", result);
commit("setUsers",map)
},
async loadDictionary({
commit
}) {
async loadDictionary({ commit }) {
let url = `${systemUrl}/Dictionary/GetAll`
let {
result
} = await Api.get(url);
let { result } = await Api.get(url);
var map = new Map();
......@@ -110,7 +100,7 @@ export const actions = {
}
}
export const plugins = [
export const plugins= [
createVuexAlong({
// 设置保存的集合名字,避免同站点下的多项目数据冲突
name: "hyhmes",
......@@ -124,6 +114,6 @@ export const plugins = [
list: ["hyhmes.session"],
},
}),
]
//设置 strict 为不严格模式,即可在actions中修改state
export const strict = false;
]
//设置 strict 为不严格模式,即可在actions中修改state
export const strict=false;
\ No newline at end of file
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