|
|
@@ -1,62 +1,31 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<div class="my-title">{{ isEdit ? "编辑" : "新增" }}</div>
|
|
|
- <el-form
|
|
|
- :model="dataForm"
|
|
|
- :rules="dataRule"
|
|
|
- ref="dataForm"
|
|
|
- label-width="auto"
|
|
|
- >
|
|
|
+ <el-form :model="dataForm" :rules="dataRule" ref="dataForm" label-width="auto">
|
|
|
<el-row class="my-row">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="对应的产品" prop="productId">
|
|
|
- <craft-product-component
|
|
|
- :disabled="display || isEdit"
|
|
|
- v-model="dataForm.productId"
|
|
|
- :product-id.sync="dataForm.productId"
|
|
|
- @productSelected="prodSelected"
|
|
|
- />
|
|
|
+ <craft-product-component :disabled="display || isEdit" v-model="dataForm.productId"
|
|
|
+ :product-id.sync="dataForm.productId" @productSelected="prodSelected" />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="任务单" prop="orderId">
|
|
|
- <el-select
|
|
|
- v-model="dataForm.orderId"
|
|
|
- :disabled="display"
|
|
|
- filterable
|
|
|
- remote
|
|
|
- reserve-keyword
|
|
|
- placeholder="请输入关键词"
|
|
|
- :remote-method="debouncedSearch"
|
|
|
- :loading="loading"
|
|
|
- style="width: 100%"
|
|
|
- >
|
|
|
- <el-option
|
|
|
- v-for="item in orderOptions"
|
|
|
- :key="item.value"
|
|
|
- :label="item.label"
|
|
|
- :value="item.value"
|
|
|
- >
|
|
|
+ <el-select v-model="dataForm.orderId" :disabled="display" filterable remote reserve-keyword
|
|
|
+ placeholder="请输入关键词" :remote-method="debouncedSearch" :loading="loading" style="width: 100%">
|
|
|
+ <el-option v-for="item in orderOptions" :key="item.value" :label="item.label" :value="item.value">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="工艺版本" prop="techVersion">
|
|
|
- <el-input
|
|
|
- v-model="dataForm.techVersion"
|
|
|
- :disabled="display || isEdit"
|
|
|
- placeholder=""
|
|
|
- ></el-input>
|
|
|
+ <el-input v-model="dataForm.techVersion" :disabled="display || isEdit" placeholder=""></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<el-form-item label="备注说明">
|
|
|
- <el-input
|
|
|
- v-model="dataForm.notes"
|
|
|
- :disabled="display || isEdit"
|
|
|
- placeholder="请输入介绍信息"
|
|
|
- ></el-input>
|
|
|
+ <el-input v-model="dataForm.notes" :disabled="display || isEdit" placeholder="请输入介绍信息"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="产品主图">
|
|
|
<!-- <upload-component
|
|
|
@@ -72,22 +41,13 @@
|
|
|
</el-form-item>
|
|
|
<el-form-item label="工艺步骤" prop="nodeList"> </el-form-item>
|
|
|
<el-row class="my-row" style="height: 350px; background-color: #efefef">
|
|
|
- <work-flow
|
|
|
- ref="workFlow"
|
|
|
- :nodeData="workFlowData"
|
|
|
- :nodeTypeList="workTypeOptions"
|
|
|
- @saveWorkFlow="saveWorkFlow"
|
|
|
- :isEdit="isEdit"
|
|
|
- @dataChange="workFlowDataChange"
|
|
|
- sourceType="1"
|
|
|
- ></work-flow>
|
|
|
+ <work-flow ref="workFlow" :nodeData="workFlowData" :nodeTypeList="workTypeOptions" @saveWorkFlow="saveWorkFlow"
|
|
|
+ :isEdit="isEdit" @dataChange="workFlowDataChange" sourceType="1"></work-flow>
|
|
|
</el-row>
|
|
|
</el-form>
|
|
|
<span slot="footer" class="dialog-footer">
|
|
|
<el-button @click="onChose">取消</el-button>
|
|
|
- <el-button v-if="!display" type="primary" @click="dataFormSubmit()"
|
|
|
- >确定</el-button
|
|
|
- >
|
|
|
+ <el-button v-if="!display" type="primary" @click="dataFormSubmit()">确定</el-button>
|
|
|
</span>
|
|
|
<!-- </el-dialog> -->
|
|
|
</div>
|
|
|
@@ -107,12 +67,12 @@ export default {
|
|
|
components: { CraftProductComponent, UploadComponent, WorkFlow },
|
|
|
computed: {
|
|
|
orgId: {
|
|
|
- get () {
|
|
|
+ get() {
|
|
|
return this.$store.state.user.orgId
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
datas: {},
|
|
|
visible: false,
|
|
|
@@ -168,32 +128,32 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- created () {
|
|
|
+ created() {
|
|
|
this.initNode()
|
|
|
// 创建防抖函数(500ms延迟)
|
|
|
this.debouncedSearch = _.debounce(this.remoteMethod, 500)
|
|
|
},
|
|
|
- beforeDestroy () {
|
|
|
+ beforeDestroy() {
|
|
|
// 清除防抖定时器,避免内存泄漏
|
|
|
this.debouncedSearch.cancel()
|
|
|
},
|
|
|
- mounted () {
|
|
|
+ mounted() {
|
|
|
this.initNode()
|
|
|
},
|
|
|
methods: {
|
|
|
- onChose () {
|
|
|
+ onChose() {
|
|
|
this.$emit('onChose')
|
|
|
},
|
|
|
- initNode () {
|
|
|
+ initNode() {
|
|
|
// this.workFlowData = data;
|
|
|
},
|
|
|
- resetWorkFlow () {
|
|
|
+ resetWorkFlow() {
|
|
|
this.workFlowData = {
|
|
|
nodeList: [],
|
|
|
lineList: []
|
|
|
}
|
|
|
},
|
|
|
- async init (id, display, isEdit, isCopy, isResubmit, orderId, productId) {
|
|
|
+ async init(id, display, isEdit, isCopy, isResubmit, orderId, productId) {
|
|
|
this.remoteMethod()
|
|
|
|
|
|
this.fileList = []
|
|
|
@@ -275,30 +235,29 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- productIdChangeHandle (val) {
|
|
|
+ productIdChangeHandle(val) {
|
|
|
if (val) {
|
|
|
let item = this.optionLevel.find((t) => t.productId === val)
|
|
|
this.dataForm.techName = item.productName
|
|
|
}
|
|
|
},
|
|
|
- handleRemove (file, fileList) {
|
|
|
+ handleRemove(file, fileList) {
|
|
|
this.fileList = fileList
|
|
|
},
|
|
|
- handleChange (file, fileList) {
|
|
|
+ handleChange(file, fileList) {
|
|
|
this.fileList = fileList
|
|
|
},
|
|
|
- handleExceed (files, fileList) {
|
|
|
+ handleExceed(files, fileList) {
|
|
|
this.$message.warning(
|
|
|
- `当前限制选择 5 个文件,本次选择了 ${files.length} 个文件,共选择了 ${
|
|
|
- files.length + fileList.length
|
|
|
+ `当前限制选择 5 个文件,本次选择了 ${files.length} 个文件,共选择了 ${files.length + fileList.length
|
|
|
} 个文件`
|
|
|
)
|
|
|
},
|
|
|
- remoteMethod (query) {
|
|
|
+ remoteMethod(query) {
|
|
|
this.loading = true
|
|
|
this.getOrderByCode(query)
|
|
|
},
|
|
|
- getOrderByCode (orderCode) {
|
|
|
+ getOrderByCode(orderCode) {
|
|
|
getOrderByCode(orderCode).then(({ data }) => {
|
|
|
this.loading = false
|
|
|
|
|
|
@@ -309,11 +268,11 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- validateField (type) {
|
|
|
+ validateField(type) {
|
|
|
this.$refs.dataForm.validateField(type)
|
|
|
},
|
|
|
// 表单提交
|
|
|
- dataFormSubmit () {
|
|
|
+ dataFormSubmit() {
|
|
|
let flowData = this.$refs.workFlow.getFlowData()
|
|
|
if (!flowData) {
|
|
|
this.$message.error('请先完成流程图!')
|
|
|
@@ -401,21 +360,21 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- uploadSuccess (fileList) {
|
|
|
+ uploadSuccess(fileList) {
|
|
|
this.fileList = fileList
|
|
|
},
|
|
|
// 保存流程图
|
|
|
- saveWorkFlow (workFlowData) {
|
|
|
+ saveWorkFlow(workFlowData) {
|
|
|
console.log('save work flow.')
|
|
|
this.workFlowData = workFlowData
|
|
|
},
|
|
|
// 流程图数据变更通知
|
|
|
- workFlowDataChange () {},
|
|
|
- handleClose () {
|
|
|
+ workFlowDataChange() { },
|
|
|
+ handleClose() {
|
|
|
// this.visible = false
|
|
|
this.$emit('close')
|
|
|
},
|
|
|
- async getWorkTypeOptions () {
|
|
|
+ async getWorkTypeOptions() {
|
|
|
this.workTypeOptions = []
|
|
|
await getWorkType().then(({ data }) => {
|
|
|
if (data && data.code === '200') {
|
|
|
@@ -424,7 +383,7 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
- prodSelected (item) {
|
|
|
+ prodSelected(item) {
|
|
|
this.dataForm.productId = item.value
|
|
|
}
|
|
|
}
|
|
|
@@ -434,7 +393,7 @@ export default {
|
|
|
<style lang="less" scoped>
|
|
|
.super-flow__node {
|
|
|
.flow-node {
|
|
|
- > header {
|
|
|
+ >header {
|
|
|
font-size: 14px;
|
|
|
height: 32px;
|
|
|
line-height: 32px;
|
|
|
@@ -442,7 +401,7 @@ export default {
|
|
|
color: #ffffff;
|
|
|
}
|
|
|
|
|
|
- > section {
|
|
|
+ >section {
|
|
|
text-align: center;
|
|
|
line-height: 20px;
|
|
|
overflow: hidden;
|
|
|
@@ -451,31 +410,31 @@ export default {
|
|
|
}
|
|
|
|
|
|
&.flow-node-start {
|
|
|
- > header {
|
|
|
+ >header {
|
|
|
background-color: #55abfc;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
&.flow-node-condition {
|
|
|
- > header {
|
|
|
+ >header {
|
|
|
background-color: #bc1d16;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
&.flow-node-approval {
|
|
|
- > header {
|
|
|
+ >header {
|
|
|
background-color: rgba(188, 181, 58, 0.76);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
&.flow-node-cc {
|
|
|
- > header {
|
|
|
+ >header {
|
|
|
background-color: #30b95c;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
&.flow-node-end {
|
|
|
- > header {
|
|
|
+ >header {
|
|
|
height: 50px;
|
|
|
line-height: 50px;
|
|
|
background-color: rgb(0, 0, 0);
|