|
@@ -34,7 +34,10 @@
|
|
|
></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="操作人" v-if="form.operatorName">
|
|
|
- <el-input :disabled="disabled && selectOperator" v-model="form.operatorName"></el-input>
|
|
|
+ <el-input
|
|
|
+ :disabled="disabled && selectOperator"
|
|
|
+ v-model="form.operatorName"
|
|
|
+ ></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item
|
|
|
label="操作人"
|
|
@@ -56,16 +59,15 @@
|
|
|
></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
-
|
|
|
</el-form>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getWorkType } from '@/api/crafts'
|
|
|
-import { workTypeMasterList } from '@/api/worktype'
|
|
|
+import { getWorkType } from "@/api/crafts";
|
|
|
+import { workTypeMasterList } from "@/api/worktype";
|
|
|
export default {
|
|
|
- name: 'nodeEdit',
|
|
|
+ name: "nodeEdit",
|
|
|
props: {
|
|
|
data: {
|
|
|
type: Object,
|
|
@@ -81,7 +83,7 @@ export default {
|
|
|
default: false
|
|
|
}
|
|
|
},
|
|
|
- data () {
|
|
|
+ data() {
|
|
|
return {
|
|
|
// 工种列表
|
|
|
workTypeOptions: [],
|
|
@@ -89,96 +91,102 @@ export default {
|
|
|
operatorIdOptions: [],
|
|
|
node: {},
|
|
|
form: {
|
|
|
- nodeName: '',
|
|
|
- workTypeId: '',
|
|
|
+ nodeName: "",
|
|
|
+ workTypeId: "",
|
|
|
operatorId: []
|
|
|
},
|
|
|
rules: {
|
|
|
nodeName: [
|
|
|
- { required: true, message: '请输入节点名称', trigger: 'blur' }
|
|
|
+ { required: true, message: "请输入节点名称", trigger: "blur" }
|
|
|
],
|
|
|
workTypeId: [
|
|
|
- { required: true, message: '请选择工种', trigger: 'blur' }
|
|
|
+ { required: true, message: "请选择工种", trigger: "blur" }
|
|
|
],
|
|
|
operatorId: [
|
|
|
- { required: true, message: '请选择操作人', trigger: 'blur' }
|
|
|
+ { required: true, message: "请选择操作人", trigger: "blur" }
|
|
|
]
|
|
|
}
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
watch: {
|
|
|
- data (val) {
|
|
|
- this.node = val
|
|
|
+ data(val) {
|
|
|
+ this.node = val;
|
|
|
this.form = {
|
|
|
...this.form,
|
|
|
...this.node
|
|
|
- }
|
|
|
+ };
|
|
|
},
|
|
|
- disabled (val) {
|
|
|
- this.disabled = val
|
|
|
+ disabled(val) {
|
|
|
+ this.disabled = val;
|
|
|
}
|
|
|
},
|
|
|
- activated () {},
|
|
|
- created () {
|
|
|
- this.getWorkTypeOptions()
|
|
|
+ activated() {},
|
|
|
+ created() {
|
|
|
+ this.getWorkTypeOptions();
|
|
|
},
|
|
|
computed: {},
|
|
|
- mounted () {
|
|
|
- this.node = this.data
|
|
|
+ mounted() {
|
|
|
+ this.node = this.data;
|
|
|
this.form = {
|
|
|
...this.form,
|
|
|
...this.node
|
|
|
- }
|
|
|
+ };
|
|
|
if (this.node.operatorId) {
|
|
|
- this.form.operatorId = this.node.operatorId.split(',')
|
|
|
+ this.form.operatorId = this.node.operatorId.split(",");
|
|
|
}
|
|
|
|
|
|
- this.getOperatorList()
|
|
|
+ this.getOperatorList();
|
|
|
},
|
|
|
methods: {
|
|
|
- getWorkTypeOptions () {
|
|
|
- this.workTypeOptions = []
|
|
|
+ getWorkTypeOptions() {
|
|
|
+ this.workTypeOptions = [];
|
|
|
getWorkType().then(({ data }) => {
|
|
|
- if (data && data.code === '200') {
|
|
|
- this.workTypeOptions = data.data
|
|
|
+ if (data && data.code === "200") {
|
|
|
+ this.workTypeOptions = data.data;
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
},
|
|
|
// 按工种ID查询操作人列表
|
|
|
- getOperatorList () {
|
|
|
+ getOperatorList() {
|
|
|
if (this.node.workTypeId) {
|
|
|
workTypeMasterList(this.node.workTypeId).then(({ data }) => {
|
|
|
- if (data && data.code === '200') {
|
|
|
- this.operatorIdOptions = []
|
|
|
+ if (data && data.code === "200") {
|
|
|
+ this.operatorIdOptions = [];
|
|
|
data.data.forEach(item => {
|
|
|
- this.operatorIdOptions.push(item)
|
|
|
- })
|
|
|
+ this.operatorIdOptions.push(item);
|
|
|
+ });
|
|
|
}
|
|
|
- })
|
|
|
+ });
|
|
|
}
|
|
|
},
|
|
|
// 校验表单
|
|
|
- validateFormData () {
|
|
|
+ validateFormData() {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
- this.$refs['form'].validate(valid => {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
if (!valid) {
|
|
|
// eslint-disable-next-line prefer-promise-reject-errors
|
|
|
- reject()
|
|
|
- return
|
|
|
+ reject();
|
|
|
+ return;
|
|
|
}
|
|
|
- resolve()
|
|
|
- })
|
|
|
- })
|
|
|
+ resolve();
|
|
|
+ });
|
|
|
+ });
|
|
|
},
|
|
|
// 获取表单数据
|
|
|
- formData () {
|
|
|
- const form = { ...this.form }
|
|
|
+ formData() {
|
|
|
+ const form = { ...this.form, operatorName: "" };
|
|
|
if (this.form.operatorId != null) {
|
|
|
- form.operatorId = this.form.operatorId.toString()
|
|
|
+ form.operatorId = this.form.operatorId.toString();
|
|
|
+ this.form.operatorId.forEach(id => {
|
|
|
+ var op = this.operatorIdOptions.find(t => t.userId == id);
|
|
|
+ if (op.name != null) {
|
|
|
+ form.operatorName += op.name + " ";
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- return form
|
|
|
+ return form;
|
|
|
}
|
|
|
}
|
|
|
-}
|
|
|
+};
|
|
|
</script>
|
|
|
<style scoped></style>
|