Commit bed9a919 authored by renjintao's avatar renjintao

bug /mesplan【add department】

parent d5171307
...@@ -528,6 +528,18 @@ export default { ...@@ -528,6 +528,18 @@ export default {
}); });
} }
}; };
}
if (u.type == "workShopName") {
u.render = (h, params) => {
let values = u.key;
if (params.row[values]) {
return h("WorkShopName", {
props: {
value: params.row[values]
}
});
}
};
} }
if (u.type == "date" || u.type == "dateTime") { if (u.type == "date" || u.type == "dateTime") {
u.render = (h, params) => { u.render = (h, params) => {
......
<template>
<div>
<label>{{workShop.name}}</label>
</div>
</template>
<script>
export default {
name: "workShopName",
props: {
value: {
type: [Number, String],
default: 0,
},
},
data() {
return {
data: [],
workShop: {},
};
},
mounted() {
this.load();
},
methods: {
load() {
if (this.value) {
var depart = this.$store.getters.getDepartment(this.value);
if (depart) {
this.workShop = depart;
}
}
},
},
watch: {
value(v) {
if (v > 0) this.load();
},
},
};
</script>
<style lang="less">
.s2 {
color: red;
}
.s1 {
color: #333;
}
.s0 {
color: #ddd;
}
</style>
\ No newline at end of file
...@@ -131,7 +131,7 @@ export default { ...@@ -131,7 +131,7 @@ export default {
] ]
} }
Api.getpaged(parme).then((res) => { Api.getpaged(parme).then((res) => {
console.log(res) // console.log(res)
}) })
}, },
openview(rowData){ openview(rowData){
......
...@@ -276,6 +276,7 @@ export default { ...@@ -276,6 +276,7 @@ export default {
align: "left", align: "left",
high: true, high: true,
hide: true, hide: true,
type:'workShopName'
}, },
{ {
key: "productingPreparationFinishDate", key: "productingPreparationFinishDate",
...@@ -531,6 +532,7 @@ export default { ...@@ -531,6 +532,7 @@ export default {
}, },
async fetch({ store, params }) { async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典 await store.dispatch("loadDictionary"); // 加载数据字典
await store.dispatch('loadDepartments');//加载部门
}, },
computed: { computed: {
searchList() { searchList() {
......
...@@ -196,18 +196,34 @@ export default { ...@@ -196,18 +196,34 @@ export default {
realWorkingHours: 0, realWorkingHours: 0,
realRuntime: 0, realRuntime: 0,
isParticipateIntime: null, isParticipateIntime: null,
equipType: "" equipType: "",
}, },
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }] name: [{ required: true, message: "必填", trigger: "blur" }],
} equipTypeId: [
{
required: true,
message: "请选择任务类型",
trigger: "change",
type: "number",
},
],
resourceType: [
{
required: true,
message: "请选择任务类型",
trigger: "change",
type: "number",
},
],
},
}; };
}, },
props: { props: {
v: Object, v: Object,
eid: Number, eid: Number,
headid: Number, headid: Number,
maxNum: Number maxNum: Number,
}, },
mounted() { mounted() {
if (this.eid > 0) { if (this.eid > 0) {
...@@ -216,13 +232,13 @@ export default { ...@@ -216,13 +232,13 @@ export default {
}, },
methods: { methods: {
handleSubmit() { handleSubmit() {
this.$refs.form.validate(v => { this.$refs.form.validate((v) => {
if (v) { if (v) {
this.disabled = true; this.disabled = true;
this.entity.routingHeaderId = this.headid; this.entity.routingHeaderId = this.headid;
this.entity.taskSeq = this.maxNum; this.entity.taskSeq = this.maxNum;
Api.create(this.entity) Api.create(this.entity)
.then(r => { .then((r) => {
this.disabled = false; this.disabled = false;
if (r.success) { if (r.success) {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
...@@ -231,7 +247,7 @@ export default { ...@@ -231,7 +247,7 @@ export default {
this.$Message.error("保存失败"); this.$Message.error("保存失败");
} }
}) })
.catch(err => { .catch((err) => {
this.disabled = false; this.disabled = false;
this.$Message.error("保存失败"); this.$Message.error("保存失败");
console.warn(err); console.warn(err);
...@@ -239,11 +255,14 @@ export default { ...@@ -239,11 +255,14 @@ export default {
} }
}); });
}, },
clearEquip() {
alert("dfr");
},
handleClose() { handleClose() {
this.$emit("on-close"); this.$emit("on-close");
}, },
load(v) { load(v) {
Api.get({ id: v }).then(r => { Api.get({ id: v }).then((r) => {
this.entity = r.result; this.entity = r.result;
this.entity.id = 0; this.entity.id = 0;
}); });
...@@ -275,12 +294,38 @@ export default { ...@@ -275,12 +294,38 @@ export default {
equipChange(v, items) { equipChange(v, items) {
this.entity.equipType = items.equip_name; this.entity.equipType = items.equip_name;
this.entity.equipTypeId = items.id; this.entity.equipTypeId = items.id;
if (v != null) {
this.rules.equipTypeId[0].required = true;
this.rules.resourceType[0].required = false;
} else {
if (this.entity.resourceId != null && this.entity.resourceId > 0) {
this.rules.equipTypeId[0].required = false;
this.rules.resourceType[0].required = true;
} else {
this.rules.equipTypeId[0].required = true;
this.rules.resourceType[0].required = true;
}
}
}, },
resourceChange(v, items) { resourceChange(v, items) {
this.entity.resourceId = v[1]; this.entity.resourceId = v[1];
this.entity.resourceType = v[0]; this.entity.resourceType = v[0];
this.entity.resourceCode = items[1].__label; this.entity.resourceCode = items[1].__label;
}
if (v != null) {
this.rules.equipTypeId[0].required = false;
this.rules.resourceType[0].required = true;
} else {
if (this.entity.equipTypeId != null && this.entity.equipTypeId > 0) {
this.rules.equipTypeId[0].required = true;
this.rules.resourceType[0].required = false;
} else {
this.rules.equipTypeId[0].required = true;
this.rules.resourceType[0].required = true;
}
}
},
}, },
watch: { watch: {
v() { v() {
...@@ -290,8 +335,8 @@ export default { ...@@ -290,8 +335,8 @@ export default {
if (v > 0) { if (v > 0) {
this.load(v); this.load(v);
} }
} },
} },
}; };
</script> </script>
<style type="less"> <style type="less">
......
...@@ -166,90 +166,7 @@ export default { ...@@ -166,90 +166,7 @@ export default {
align: "right", align: "right",
hide: true hide: true
}, },
// {
// key: "resourceId",
// title: this.l("resourceId"),
// align: "left"
// },
// {
// key: "setupTime",
// title: this.l("setupTime"),
// align: "left"
// },
// {
// key: "transportTime",
// title: this.l("transportTime"),
// align: "left"
// },
// {
// key: "checkTime",
// title: this.l("checkTime"),
// align: "left"
// },
// {
// key: "checkFlag",
// title: this.l("checkFlag"),
// align: "left",
// code: "Process.routing_detail.check_flag"
// },
// {
// key: "departmentId",
// title: this.l("departmentId"),
// align: "left"
// },
// {
// key: "milestoneId",
// title: this.l("milestoneId"),
// align: "left"
// },
// { key: "phaseId", title: this.l("phaseId"), align: "left", high: true },
// {
// key: "status",
// title: this.l("status"),
// align: "left",
// code: "Process.Status"
// },
// {
// key: "performanceHours",
// title: this.l("performanceHours"),
// align: "left"
// },
// {
// key: "resourceCode",
// title: this.l("resourceCode"),
// align: "left",
// easy: true
// },
// {
// key: "realWorkingHours",
// title: this.l("realWorkingHours"),
// align: "left"
// },
// {
// key: "performanceWorkingHours",
// title: this.l("performanceWorkingHours"),
// align: "left"
// },
// {
// key: "equipTypeId",
// title: this.l("equipTypeId"),
// align: "left"
// },
// {
// key: "note",
// title: this.l("note"),
// align: "left",
// easy: true
// },
{ {
key: "creationTime", key: "creationTime",
title: this.l("creationTime"), title: this.l("creationTime"),
......
...@@ -29,6 +29,7 @@ import RoleSelect from '@/components/page/roleSelect.vue' ...@@ -29,6 +29,7 @@ import RoleSelect from '@/components/page/roleSelect.vue'
import UserExamSelect from '@/components/page/userExamSelect.vue' import UserExamSelect from '@/components/page/userExamSelect.vue'
import DepartmentSelect from '@/components/page/departmentSelect.vue' import DepartmentSelect from '@/components/page/departmentSelect.vue'
import WorkShopSelect from '@/components/page/workShopSelect.vue' import WorkShopSelect from '@/components/page/workShopSelect.vue'
import WorkShopName from '@/components/page/workShopName.vue'
import workShopDefault from '@/components/page/workShopDefault.vue' import workShopDefault from '@/components/page/workShopDefault.vue'
import WorkShop from '@/components/page/workShop.vue' import WorkShop from '@/components/page/workShop.vue'
import EquipSelect from '@/components/page/equipSelect.vue' import EquipSelect from '@/components/page/equipSelect.vue'
...@@ -105,6 +106,7 @@ Vue.component("Materiel", Materiel) ...@@ -105,6 +106,7 @@ Vue.component("Materiel", Materiel)
Vue.component("RoleSelect", RoleSelect) Vue.component("RoleSelect", RoleSelect)
Vue.component("UserExamSelect", UserExamSelect) Vue.component("UserExamSelect", UserExamSelect)
Vue.component("WorkShopSelect", WorkShopSelect) Vue.component("WorkShopSelect", WorkShopSelect)
Vue.component("WorkShopName",WorkShopName)
Vue.component("workShopDefault", workShopDefault) Vue.component("workShopDefault", workShopDefault)
Vue.component("WorkShop", WorkShop) Vue.component("WorkShop", WorkShop)
Vue.component("EquipSelect", EquipSelect) Vue.component("EquipSelect", EquipSelect)
......
...@@ -4,10 +4,12 @@ export const state = () => ({ ...@@ -4,10 +4,12 @@ export const state = () => ({
counter: 0, counter: 0,
dictionary: new Map(), //所有字典项 dictionary: new Map(), //所有字典项
userMap: new Map(), //所有用户缓存; userMap: new Map(), //所有用户缓存;
departmentsMap: new Map(), //部门缓存;
userInfo: { userInfo: {
userId: 0, userId: 0,
userName: "" userName: ""
}, },
departments:{},//部门列表
cart: [], cart: [],
count: 0, count: 0,
countAps: 0, //aps排产 countAps: 0, //aps排产
...@@ -41,7 +43,13 @@ export const getters = { ...@@ -41,7 +43,13 @@ export const getters = {
if (state.userMap && state.userMap.get) { if (state.userMap && state.userMap.get) {
return state.userMap.get(key); return state.userMap.get(key);
} }
} },
getDepartment: (state) => (key) => {
let items = state.departmentsMap.get(key);
if (items) {
return items;
}
},
} }
export const mutations = { export const mutations = {
increment(state) { increment(state) {
...@@ -78,6 +86,10 @@ export const mutations = { ...@@ -78,6 +86,10 @@ export const mutations = {
}, },
setCountRun(state, count) { //设置流水排产数量 setCountRun(state, count) { //设置流水排产数量
state.countRun = count; state.countRun = count;
},
setDepartments(state,departmentsMap)
{
state.departmentsMap = departmentsMap;
} }
} }
...@@ -113,7 +125,6 @@ export const actions = { ...@@ -113,7 +125,6 @@ export const actions = {
let { let {
result result
} = await Api.get(url); } = await Api.get(url);
var map = new Map(); var map = new Map();
for (const key in result) { for (const key in result) {
...@@ -128,8 +139,18 @@ export const actions = { ...@@ -128,8 +139,18 @@ export const actions = {
r.result.map(u => { r.result.map(u => {
umap.set(u.id, u); umap.set(u.id, u);
}); });
commit("setUsers", umap) commit("setUsers", umap);
} },
async loadDepartments({
commit
}) {
let rdep = await Api.get(`${systemUrl}/department/getplantdepartments`);
var mapDep = new Map();
rdep.result.items.map(u => {
mapDep.set(u.id, u);
});
commit("setDepartments", mapDep);
},
} }
export const plugins = [ export const plugins = [
......
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