Commit ae2fec0c authored by arvin's avatar arvin

装配单元路线 设置排序

parent 2e599a44
......@@ -9,9 +9,9 @@
<dee-tools mode="normal" :tools="tools" />
</div>
<div class="content-model">
<step ref="ExtPosition" v-show="viewType === 'ExtPosition'" :show-flag="viewType === 'ExtPosition'" :node="node" />
<unit ref="unit" v-show="viewType === 'unit'" :show-flag="viewType === 'unit'" :node="node" />
<view2 ref="AircraftSorties" v-show="viewType === 'AircraftSorties'" :show-flag="viewType === 'AircraftSorties'" :node="node" />
<step v-if="viewType === 'ExtPosition'" ref="ExtPosition" :show-flag="viewType === 'ExtPosition'" :node="node" />
<unit v-if="viewType === 'unit'" ref="unit" :show-flag="viewType === 'unit'" :node="node" />
<view2 v-if="viewType === 'AircraftSorties'" ref="AircraftSorties" :show-flag="viewType === 'AircraftSorties'" :node="node" />
</div>
</div>
</template>
......@@ -73,7 +73,7 @@ export default {
icon: '/icons/check.png',
handler: {
click: () => {
this.config()
this.settings()
}
}
})
......@@ -102,13 +102,13 @@ export default {
this.node = params
},
export() {
this.$refs[this.viewType].export()
this.$refs[this.viewType].export && this.$refs[this.viewType].export()
},
save() {
this.$refs[this.viewType].save()
this.$refs[this.viewType].save && this.$refs[this.viewType].save()
},
config() {
this.$refs[this.viewType].config()
settings() {
this.$refs[this.viewType].settings && this.$refs[this.viewType].settings()
}
}
}
......
<template>
<dee-dialog
title="设置排序"
:dialog-visible.sync="visibleSort"
width="500px"
:before-close="()=>{$emit('close')}"
close-on-click-modal
>
<div>
<el-button type="text" @click="selectAll">全选</el-button>
<el-button type="text" @click="selectNothings">全清</el-button>
<el-button type="text" @click="selectToggle">反选</el-button>
<el-tree
v-if="visibleSort"
ref="treeSort"
:data="unitList"
node-key="id"
show-checkbox
draggable
:allow-drop="collapseSort"
@node-drop="nodeDrop"
>
<span slot-scope="{ node, data }" class="custom-tree-node">
<span>{{ node.label }}</span>
序号:<el-input v-model="data.sort" :style="{width:'50px'}" size="mini" @change="changeSort($event,data)" />
</span>
</el-tree>
</div>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="saveSort">确 定</el-button>
<el-button @click="()=>{$emit('close')}">取 消</el-button>
</span>
</dee-dialog>
</template>
<script>
export default {
name: 'TfMomWebSortUnit',
props: {
unitList: {
type: Array,
default: () => []
},
dialogFlag: {
type: Boolean,
default: false
}
},
data() {
return {
visibleSort: false
}
},
watch: {
dialogFlag(val) {
this.visibleSort = val
},
visibleSort(val) {
!val && this.$emit('close')
}
},
mounted() {
},
methods: {
selectAll() {
const ids = this.unitList.map(r => r.id)
this.$refs.treeSort.setCheckedKeys(ids)
},
selectNothings() {
this.$refs.treeSort.setCheckedKeys([])
},
selectToggle() {
const ids = this.unitList.map(r => r.id)
const checkedIds = this.$refs.treeSort.getCheckedKeys()
const selecteds = ids.filter(r => !checkedIds.includes(r))
this.$refs.treeSort.setCheckedKeys(selecteds)
},
collapseSort(draggingNode, dropNode, type) {
return type !== 'inner'
},
nodeDrop() {
this.unitList.forEach((p, index) => {
p.sort = index + 1
p.defaultSort = index + 1
})
},
saveSort() {
var params = this.$refs.treeSort.getCheckedNodes().map((p, index) => {
return {
operator: 'MODIFY',
id: p.id,
dictSeq: index
}
})
this.$api.recursion('ExtProcessPlan', params, true).then(() => {
this.$emit('refresh')
this.$emit('close')
})
}
}
}
</script>
<style lang="scss" scoped>
</style>
......@@ -232,9 +232,6 @@ export default {
}
ganttAg.clearAll()
ganttAg.parse(data)
setTimeout(() => {
ganttAg.autoSchedule()
}, 1000)
}
})
// 在将新链接添加到甘特图之前触发
......@@ -254,7 +251,7 @@ export default {
refreshGantt() {
const val = this.ganttData
if (!val || !val.length) {
this.gantt.parse({ data: [] })
this.gantt.clearAll()
return
}
const params = {
......
......@@ -41,65 +41,7 @@ export default {
}
},
computed: {
columns() {
const ganttIns = this.gantt
return [
{
name: '',
label: '节点',
align: 'left',
width: 60,
resize: true,
template: function(task) {
return (
"<span class='gantt_grid_wbs'>" + (ganttIns.getWBSCode(task) ||
'') + '</span>'
)
}
},
{
name: 'text',
label: '站位号',
align: 'left',
width: 160,
tree: true,
resize: true
},
{
name: 'edition',
label: '版本',
align: 'center',
width: 50,
resize: true
},
{
name: 'duration',
label: '工期(时)',
align: 'center',
width: 60,
resize: true,
template: function(task) {
return Math.round((task.duration || 0) / (3 * 60))
}
},
{
name: 'predecessors',
label: '前置',
width: 60,
align: 'center',
template: function(task) {
var links = task.$target
var labels = []
for (var i = 0; i < links.length; i++) {
var link = ganttIns.getLink(links[i])
var label = ganttIns.getWBSCode(ganttIns.getTask(link.source))
if (!labels.includes(label)) { labels.push(label) }
}
return "<span class='gantt_grid_predecessors'>" + labels.join(', ') + '</span>'
}
}
]
}
},
watch: {
......@@ -203,6 +145,9 @@ export default {
}
},
getData() {
if (this.loading && (this.currentId === this.node.id)) {
return
}
this.currentId = this.node.id
this.gantt.clearAll()
if (!this.node || !this.node.children.length) {
......
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