|
@@ -68,28 +68,28 @@
|
|
|
</div>
|
|
</div>
|
|
|
<div class="leftbottom">
|
|
<div class="leftbottom">
|
|
|
<!-- <img src="../../assets/images/workshop.png" alt="" /> -->
|
|
<!-- <img src="../../assets/images/workshop.png" alt="" /> -->
|
|
|
- <img :src="imgsrc" alt="" v-if="imgsrc" />
|
|
|
|
|
|
|
+ <img :src="imgsrc" alt="" v-if="imgsrc"/>
|
|
|
<p v-else>—————— 请选择车间 ——————</p>
|
|
<p v-else>—————— 请选择车间 ——————</p>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
-import { listAllWorkshop } from "@/api/mes/md/workshop";
|
|
|
|
|
-import { getIsWorkareaList } from "@/api/mes/wa/workarea";
|
|
|
|
|
-import { selectIsSopById } from "@/api/mes/sop/sopindex";
|
|
|
|
|
-import { mapActions, mapGetters } from "vuex";
|
|
|
|
|
|
|
+import { listAllWorkshop } from '@/api/mes/md/workshop'
|
|
|
|
|
+import { getIsWorkareaList, getMapData } from '@/api/mes/wa/workarea'
|
|
|
|
|
+import { selectIsSopById } from '@/api/mes/sop/sopindex'
|
|
|
|
|
+import { mapActions, mapGetters } from 'vuex'
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
props: {
|
|
props: {
|
|
|
sopProps: {
|
|
sopProps: {
|
|
|
type: Array,
|
|
type: Array,
|
|
|
- default: () => [],
|
|
|
|
|
|
|
+ default: () => []
|
|
|
},
|
|
},
|
|
|
jobProps: {
|
|
jobProps: {
|
|
|
type: Array,
|
|
type: Array,
|
|
|
- default: () => [],
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ default: () => []
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
data() {
|
|
data() {
|
|
|
return {
|
|
return {
|
|
@@ -97,118 +97,123 @@ export default {
|
|
|
checkAll: false,
|
|
checkAll: false,
|
|
|
isIndeterminate: false,
|
|
isIndeterminate: false,
|
|
|
workShop: [],
|
|
workShop: [],
|
|
|
- producLine: "",
|
|
|
|
|
|
|
+ producLine: '',
|
|
|
|
|
+ sopId: ''
|
|
|
},
|
|
},
|
|
|
workShopOptions: [],
|
|
workShopOptions: [],
|
|
|
producLineOptions: [],
|
|
producLineOptions: [],
|
|
|
- imgsrc: "",
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ imgsrc: ''
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
- "form.workShop": {
|
|
|
|
|
|
|
+ 'form.workShop': {
|
|
|
handler(newVal) {
|
|
handler(newVal) {
|
|
|
if (newVal) {
|
|
if (newVal) {
|
|
|
- this.imgsrc = localStorage.getItem("img");
|
|
|
|
|
|
|
+ this.imgsrc = localStorage.getItem('img')
|
|
|
}
|
|
}
|
|
|
- },
|
|
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
// 监听父组件传递的数据
|
|
// 监听父组件传递的数据
|
|
|
sopProps: {
|
|
sopProps: {
|
|
|
handler(newVal, oldVal) {
|
|
handler(newVal, oldVal) {
|
|
|
- console.log("sopProps 发生变化", newVal);
|
|
|
|
|
- this.form.workShop = newVal[0].workshopId;
|
|
|
|
|
- this.form.producLine = newVal[0].workareaId;
|
|
|
|
|
|
|
+ console.log('sopProps 发生变化', newVal)
|
|
|
|
|
+ this.form.workShop = newVal[0].workshopId
|
|
|
|
|
+ this.form.producLine = newVal[0].workareaId
|
|
|
|
|
+
|
|
|
// 确保 handleselect 完成后再调用 handleselectProductLine
|
|
// 确保 handleselect 完成后再调用 handleselectProductLine
|
|
|
this.handleselect(newVal[0].workshopId)
|
|
this.handleselect(newVal[0].workshopId)
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
- this.handleselectProductLine(newVal[0].workareaId);
|
|
|
|
|
|
|
+ this.handleselectProductLine(newVal[0].workareaId)
|
|
|
})
|
|
})
|
|
|
.catch((error) => {
|
|
.catch((error) => {
|
|
|
- console.error("处理车间下拉失败", error);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ console.error('处理车间下拉失败', error)
|
|
|
|
|
+ })
|
|
|
// 这里是为了拿到sop模板里默认的隔离点选中的数据
|
|
// 这里是为了拿到sop模板里默认的隔离点选中的数据
|
|
|
selectIsSopById(newVal[0].sopId).then((res) => {
|
|
selectIsSopById(newVal[0].sopId).then((res) => {
|
|
|
- console.log(res, "sop");
|
|
|
|
|
|
|
+ console.log(res, 'sop')
|
|
|
const selectSopPoints = res.data.pointDetailVOList.map((item) => {
|
|
const selectSopPoints = res.data.pointDetailVOList.map((item) => {
|
|
|
- return item.pointId;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ return item.pointId
|
|
|
|
|
+ })
|
|
|
// 调用 Vuex action 来存储 selectSopPoints
|
|
// 调用 Vuex action 来存储 selectSopPoints
|
|
|
- this.setSelectSopPoints(selectSopPoints);
|
|
|
|
|
|
|
+ this.setSelectSopPoints(selectSopPoints)
|
|
|
|
|
|
|
|
- this.setSopEdit(true);
|
|
|
|
|
- console.log(selectSopPoints, "sop_selectePoints");
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.setSopEdit(true)
|
|
|
|
|
+ console.log(selectSopPoints, 'sop_selectePoints')
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
- immediate: true, // 立即执行一次,确保在组件初始化时也能捕获到 jobProps 的值
|
|
|
|
|
|
|
+ immediate: true // 立即执行一次,确保在组件初始化时也能捕获到 jobProps 的值
|
|
|
},
|
|
},
|
|
|
jobProps: {
|
|
jobProps: {
|
|
|
handler(newVal, oldVal) {
|
|
handler(newVal, oldVal) {
|
|
|
- console.log("jobProps 发生变化", newVal);
|
|
|
|
|
|
|
+ console.log('jobProps 发生变化', newVal)
|
|
|
// 在这里处理 jobProps 变化后的逻辑
|
|
// 在这里处理 jobProps 变化后的逻辑
|
|
|
- this.form.workShop = newVal[0].workshopId;
|
|
|
|
|
- this.form.producLine = newVal[0].workareaId;
|
|
|
|
|
|
|
+ this.form.workShop = newVal[0].workshopId
|
|
|
|
|
+ this.form.producLine = newVal[0].workareaId
|
|
|
|
|
+ this.form.sopId = newVal[0].sopId
|
|
|
|
|
+ console.log(this.form.sopId,'form.sopId jobProps')
|
|
|
// 确保 handleselect 完成后再调用 handleselectProductLine
|
|
// 确保 handleselect 完成后再调用 handleselectProductLine
|
|
|
this.handleselect(newVal[0].workshopId)
|
|
this.handleselect(newVal[0].workshopId)
|
|
|
.then(() => {
|
|
.then(() => {
|
|
|
- this.handleselectProductLine(newVal[0].workareaId);
|
|
|
|
|
|
|
+ this.handleselectProductLine(newVal[0].workareaId)
|
|
|
})
|
|
})
|
|
|
.catch((error) => {
|
|
.catch((error) => {
|
|
|
- console.error("处理车间下拉失败", error);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ console.error('处理车间下拉失败', error)
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
// 这里是为了拿到sop模板里默认的隔离点选中的数据a
|
|
// 这里是为了拿到sop模板里默认的隔离点选中的数据a
|
|
|
if (!newVal[0].EditBool) {
|
|
if (!newVal[0].EditBool) {
|
|
|
selectIsSopById(newVal[0].sopId).then((res) => {
|
|
selectIsSopById(newVal[0].sopId).then((res) => {
|
|
|
- console.log(res, "sop");
|
|
|
|
|
|
|
+ console.log(res, 'sop')
|
|
|
const selectSopPoints = res.data.pointDetailVOList.map((item) => {
|
|
const selectSopPoints = res.data.pointDetailVOList.map((item) => {
|
|
|
- return item.pointId;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ return item.pointId
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
// 调用 Vuex action 来存储 selectSopPoints
|
|
// 调用 Vuex action 来存储 selectSopPoints
|
|
|
- this.setSelectSopPoints(selectSopPoints);
|
|
|
|
|
- this.setPointTableData(res.data);
|
|
|
|
|
|
|
+ this.setSelectSopPoints(selectSopPoints)
|
|
|
|
|
+ this.setPointTableData(res.data)
|
|
|
|
|
|
|
|
- this.setSopEdit(false);
|
|
|
|
|
- console.log(selectSopPoints, "sop_selectePoints");
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ this.setSopEdit(false)
|
|
|
|
|
+ console.log(selectSopPoints, 'sop_selectePoints')
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
const selectSopPoints = newVal[0].spoint.map((item) => {
|
|
const selectSopPoints = newVal[0].spoint.map((item) => {
|
|
|
- return item.pointId;
|
|
|
|
|
- });
|
|
|
|
|
- this.setSelectSopPoints(selectSopPoints);
|
|
|
|
|
- this.setPointTableData(newVal[0].spoint);
|
|
|
|
|
- this.setSopEdit(true);
|
|
|
|
|
|
|
+ return item.pointId
|
|
|
|
|
+ })
|
|
|
|
|
+ this.setSelectSopPoints(selectSopPoints)
|
|
|
|
|
+ this.setPointTableData(newVal[0].spoint)
|
|
|
|
|
+ this.setSopEdit(true)
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
- immediate: true, // 立即执行一次,确保在组件初始化时也能捕获到 jobProps 的值
|
|
|
|
|
- },
|
|
|
|
|
|
|
+ immediate: true // 立即执行一次,确保在组件初始化时也能捕获到 jobProps 的值
|
|
|
|
|
+ }
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
- this.getworkshopList();
|
|
|
|
|
|
|
+ this.getworkshopList()
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
- ...mapGetters("sopSelectPoints", ["getSopLook"]),
|
|
|
|
|
|
|
+ ...mapGetters('sopSelectPoints', ['getSopLook'])
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
- ...mapActions("sopSelectPoints", [
|
|
|
|
|
- "setSelectSopPoints",
|
|
|
|
|
- "setPointTableData",
|
|
|
|
|
- "setSopEdit",
|
|
|
|
|
|
|
+ ...mapActions('sopSelectPoints', [
|
|
|
|
|
+ 'setSelectSopPoints',
|
|
|
|
|
+ 'setPointTableData',
|
|
|
|
|
+ 'setSopEdit',
|
|
|
|
|
+ 'setMapData'
|
|
|
]),
|
|
]),
|
|
|
|
|
|
|
|
// 获取车间列表
|
|
// 获取车间列表
|
|
|
getworkshopList() {
|
|
getworkshopList() {
|
|
|
listAllWorkshop().then((response) => {
|
|
listAllWorkshop().then((response) => {
|
|
|
- console.log(response, "车间信息");
|
|
|
|
|
|
|
+ console.log(response, '车间信息')
|
|
|
this.workShopOptions = response.data.map((item) => {
|
|
this.workShopOptions = response.data.map((item) => {
|
|
|
return {
|
|
return {
|
|
|
label: item.workshopName,
|
|
label: item.workshopName,
|
|
|
value: item.workshopId,
|
|
value: item.workshopId,
|
|
|
key: item.workshopCode,
|
|
key: item.workshopCode,
|
|
|
- attr1: item.attr1,
|
|
|
|
|
- };
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ attr1: item.attr1
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// 单选车间下拉
|
|
// 单选车间下拉
|
|
@@ -221,45 +226,69 @@ export default {
|
|
|
label: item.workareaName,
|
|
label: item.workareaName,
|
|
|
value: item.workareaId,
|
|
value: item.workareaId,
|
|
|
key: item.workareaCode,
|
|
key: item.workareaCode,
|
|
|
- map: item.map,
|
|
|
|
|
- };
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ map: item.map
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
// 根据选择的车间更新 imgsrc
|
|
// 根据选择的车间更新 imgsrc
|
|
|
const selectedWorkshop = this.workShopOptions.find(
|
|
const selectedWorkshop = this.workShopOptions.find(
|
|
|
(item) => item.value === value
|
|
(item) => item.value === value
|
|
|
- );
|
|
|
|
|
- localStorage.setItem("img", selectedWorkshop.attr1);
|
|
|
|
|
|
|
+ )
|
|
|
|
|
+ localStorage.setItem('img', selectedWorkshop.attr1)
|
|
|
if (selectedWorkshop) {
|
|
if (selectedWorkshop) {
|
|
|
- this.imgsrc = selectedWorkshop.attr1;
|
|
|
|
|
|
|
+ this.imgsrc = selectedWorkshop.attr1
|
|
|
} else {
|
|
} else {
|
|
|
- this.imgsrc = ""; // 如果没有找到,清空 imgsrc
|
|
|
|
|
|
|
+ this.imgsrc = '' // 如果没有找到,清空 imgsrc
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- console.log(this.producLineOptions, "this.producLineOptions");
|
|
|
|
|
- resolve(); // 异步操作成功后 resolve
|
|
|
|
|
|
|
+ console.log(this.producLineOptions, 'this.producLineOptions')
|
|
|
|
|
+ resolve() // 异步操作成功后 resolve
|
|
|
})
|
|
})
|
|
|
.catch((error) => {
|
|
.catch((error) => {
|
|
|
- console.error("获取生产线下拉列表失败", error);
|
|
|
|
|
- reject(error); // 异步操作失败后 reject
|
|
|
|
|
- });
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ console.error('获取生产线下拉列表失败', error)
|
|
|
|
|
+ reject(error) // 异步操作失败后 reject
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
},
|
|
},
|
|
|
// 生产线下拉
|
|
// 生产线下拉
|
|
|
handleselectProductLine(val) {
|
|
handleselectProductLine(val) {
|
|
|
- console.log(val, "生产线下拉");
|
|
|
|
|
|
|
+ console.log(val, '生产线下拉')
|
|
|
|
|
+ // 获取区域map解析数据
|
|
|
|
|
+ const data = val
|
|
|
|
|
+
|
|
|
|
|
+ let data1 = ''
|
|
|
|
|
+ let data2 = ''
|
|
|
|
|
+
|
|
|
|
|
+ if (this.$route.query.sopId !== 'null' && this.$route.query.sopId) {
|
|
|
|
|
+ data1 = this.$route.query.sopId
|
|
|
|
|
+ } else if (this.$route.query.ticketId !== 'null' && this.$route.query.ticketId) {
|
|
|
|
|
+ data2 = this.$route.query.ticketId // ticketId 存在时,data1 设置为空字符串
|
|
|
|
|
+ }
|
|
|
|
|
+console.log(this.form.sopId,'form.sopId')
|
|
|
|
|
+ if (this.form.sopId) {
|
|
|
|
|
+ data1 = this.form.sopId
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ getMapData(data, data1, data2).then((res) => {
|
|
|
|
|
+ console.log(res, '获取区域map的解析数据')
|
|
|
|
|
+ const mapdata = res.data
|
|
|
|
|
+ this.setMapData(mapdata)
|
|
|
|
|
+ }).catch((error) => {
|
|
|
|
|
+ console.error('获取区域map数据失败', error)
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
// 利用组件逆传递 selectProductLine方法传递数据给兄弟组件
|
|
// 利用组件逆传递 selectProductLine方法传递数据给兄弟组件
|
|
|
const selectedOption = this.producLineOptions.filter((item) => {
|
|
const selectedOption = this.producLineOptions.filter((item) => {
|
|
|
- return item.value == val;
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ return item.value == val
|
|
|
|
|
+ })
|
|
|
const selectworkShop = this.workShopOptions.filter((item) => {
|
|
const selectworkShop = this.workShopOptions.filter((item) => {
|
|
|
- return item.value == this.form.workShop;
|
|
|
|
|
- });
|
|
|
|
|
- console.log(selectworkShop, selectedOption, "workshop-components");
|
|
|
|
|
|
|
+ return item.value == this.form.workShop
|
|
|
|
|
+ })
|
|
|
|
|
+ console.log(selectworkShop, selectedOption, 'workshop-components')
|
|
|
// 触发自定义事件,传递 selectedOption[0] 数据给父组件
|
|
// 触发自定义事件,传递 selectedOption[0] 数据给父组件
|
|
|
- console.log(selectedOption, "selectedOption[0]", this.producLineOptions);
|
|
|
|
|
- this.$emit("product-line-selected", selectedOption[0]);
|
|
|
|
|
- this.$emit("work-shop-selected", selectworkShop[0]);
|
|
|
|
|
|
|
+ console.log(selectedOption, 'selectedOption[0]', this.producLineOptions)
|
|
|
|
|
+ this.$emit('product-line-selected', selectedOption[0])
|
|
|
|
|
+ this.$emit('work-shop-selected', selectworkShop[0])
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
// 多选车间下拉框选择事件
|
|
// 多选车间下拉框选择事件
|
|
@@ -279,20 +308,21 @@ export default {
|
|
|
// 全选事件
|
|
// 全选事件
|
|
|
handleCheckAllChange(val) {
|
|
handleCheckAllChange(val) {
|
|
|
const data = this.workShopOptions.map((item) => {
|
|
const data = this.workShopOptions.map((item) => {
|
|
|
- return item.value;
|
|
|
|
|
- });
|
|
|
|
|
- this.form.workShop = val ? data : [];
|
|
|
|
|
- this.isIndeterminate = false;
|
|
|
|
|
- },
|
|
|
|
|
- },
|
|
|
|
|
-};
|
|
|
|
|
|
|
+ return item.value
|
|
|
|
|
+ })
|
|
|
|
|
+ this.form.workShop = val ? data : []
|
|
|
|
|
+ this.isIndeterminate = false
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
|
|
-<style scoped lang='scss'>
|
|
|
|
|
|
|
+<style scoped lang="scss">
|
|
|
.leftcon {
|
|
.leftcon {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
height: 100%;
|
|
height: 100%;
|
|
|
background-size: 100% 100%;
|
|
background-size: 100% 100%;
|
|
|
|
|
+
|
|
|
.lefttop {
|
|
.lefttop {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
height: 60px;
|
|
height: 60px;
|
|
@@ -302,10 +332,12 @@ export default {
|
|
|
width: 1100px;
|
|
width: 1100px;
|
|
|
height: 780px;
|
|
height: 780px;
|
|
|
margin: -16px 0 0 60px;
|
|
margin: -16px 0 0 60px;
|
|
|
|
|
+
|
|
|
img {
|
|
img {
|
|
|
width: 100%;
|
|
width: 100%;
|
|
|
height: 100%;
|
|
height: 100%;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
p {
|
|
p {
|
|
|
text-align: center;
|
|
text-align: center;
|
|
|
margin: 30% 0;
|
|
margin: 30% 0;
|