Commit 5b927673 authored by renjintao's avatar renjintao

technology index&&addindex&&add

parent 3b967bfd
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="110">
<Form ref="form" :model="entity" :rules="rules" :label-width="110">
<Row>
<!-- <Col :span="12">
<!-- <Col :span="12">
<FormItem :label="l('classId')" prop="classId">
<InputNumber v-model="entity.classId"></InputNumber>
</FormItem>
......@@ -11,56 +11,56 @@
<Input v-model="entity.unicode"></Input>
</FormItem>
</Col>-->
<Col :span="8">
<Col :span="8">
<!-- <FormItem v-if="title=='新增'" :label="l('code')" prop="code">
<Input v-model="entity.code"></Input>
</FormItem> v-else-if="title=='克隆'"-->
<FormItem :label="l('code')" prop="code">
<Input disabled v-model="entity.code"></Input>
<Input disabled v-model="entity.code"></Input>
</FormItem>
</Col>
<Col :span="8">
</Col>
<Col :span="8">
<FormItem :label="l('name')" prop="name">
<Input v-model="entity.name"></Input>
<Input v-model="entity.name"></Input>
</FormItem>
</Col>
</Col>
<Col :span="8">
<Col :span="8">
<FormItem :label="l('routingType')" prop="routingType">
<Dictionary code="Process.Routing.routingType" v-model="entity.routingType"></Dictionary>
<Dictionary code="Process.Routing.routingType" v-model="entity.routingType"></Dictionary>
</FormItem>
</Col>
<Col :span="8">
</Col>
<Col :span="8">
<FormItem :label="l('phase')" prop="phase">
<Dictionary code="Process.Routing.phase" v-model="entity.phase"></Dictionary>
<Dictionary code="Process.Routing.phase" v-model="entity.phase"></Dictionary>
</FormItem>
</Col>
<Col :span="8">
</Col>
<Col :span="8">
<FormItem :label="l('productName')" prop="productId">
<ProductSelect v-model="entity.productId" @on-change="proChange"></ProductSelect>
<ProductSelect v-model="entity.productId" @on-change="proChange"></ProductSelect>
</FormItem>
</Col>
<Col :span="8">
</Col>
<Col :span="8">
<FormItem :label="l('drawingNo')" prop="drawingNo">
<Input v-model="entity.drawingNo" disabled></Input>
<Input v-model="entity.drawingNo" disabled></Input>
</FormItem>
</Col>
<Col :span="8">
</Col>
<Col :span="8">
<FormItem :label="l('version')" prop="versionid">
<Dictionary code="Process.Routing.version" v-model="entity.versionid"></Dictionary>
<Dictionary code="Process.Routing.version" v-model="entity.versionid"></Dictionary>
</FormItem>
</Col>
<Col :span="8">
</Col>
<Col :span="8">
<FormItem :label="l('departmentName')" prop="departmentId">
<departmentSelect v-model="entity.departmentId" :type="3" @on-change="departChange"></departmentSelect>
<departmentSelect v-model="entity.departmentId" :type="3" @on-change="departChange"></departmentSelect>
</FormItem>
</Col>
<Col :span="8">
</Col>
<Col :span="8">
<FormItem :label="l('isEffect')" prop="isEffect">
<Dictionary code="Process.Status" v-model="entity.isEffect" type="radio"></Dictionary>
<Dictionary code="Process.Status" v-model="entity.isEffect" type="radio"></Dictionary>
</FormItem>
</Col>
<!--
</Col>
<!--
<Col :span="8">
<FormItem :label="l('isMain')" prop="isMain">
<Dictionary code="Process.state" v-model="entity.isMain" type="radio"></Dictionary>
......@@ -76,13 +76,13 @@
<InputNumber v-model="entity.upId"></InputNumber>
</FormItem>
</Col>-->
<!-- <Col :span="12">
<!-- <Col :span="12">
<FormItem :label="l('upDetailId')" prop="upDetailId">
<InputNumber v-model="entity.upDetailId"></InputNumber>
</FormItem>
</Col>-->
<!-- <Col :span="12">
<!-- <Col :span="12">
<FormItem :label="l('status')" prop="status">
<Dictionary code="Process.Status" v-model="entity.status"></Dictionary>
</FormItem>
......@@ -93,7 +93,7 @@
</FormItem>
</Col>-->
<!-- <Col :span="12">
<!-- <Col :span="12">
<FormItem :label="l('approvalStatusRemark')" prop="approvalStatusRemark">
<Input v-model="entity.approvalStatusRemark"></Input>
</FormItem>
......@@ -114,17 +114,17 @@
</FormItem>
</Col>-->
<!-- <Col :span="12">
<!-- <Col :span="12">
<FormItem :label="l('versionnotes')" prop="versionnotes">
<Input v-model="entity.versionnotes"></Input>
</FormItem>
</Col>-->
<!-- <Col :span="12">
<!-- <Col :span="12">
<FormItem :label="l('phase')" prop="phase">
<InputNumber v-model="entity.phase"></InputNumber>
</FormItem>
</Col>-->
<!-- <Col :span="12">
<!-- <Col :span="12">
<FormItem :label="l('versionid')" prop="versionid">
<InputNumber v-model="entity.versionid"></InputNumber>
</FormItem>
......@@ -135,250 +135,255 @@
</FormItem>
</Col>
-->
<Col :span="24">
<Col :span="24">
<FormItem :label="l('remark')" prop="remark">
<i-quill v-model="entity.remark" :height="300" border v-paste="handleImg" />
<i-quill v-model="entity.remark" :height="300" border v-paste="handleImg" />
</FormItem>
</Col>
</Col>
<Col :span="24">
<Col :span="24">
<FormItem label="多媒体附件" prop="files">
<files ref="refFile" :parms="parms" fileFormat />
<files ref="refFile" :parms="parms" fileFormat />
</FormItem>
</Col>
</Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</Form>
</template>
<script>
import Api from "./api";
import ApiWorkflow from "../workflow/process/api";
import iQuill from "@/components/quill";
export default {
name: "Add",
components: {
iQuill,
// VueUeditorWrap
},
data() {
return {
entity: {
classId: null,
unicode: "",
name: "",
code: "",
productId: null,
productName: "",
productBomId: null,
version: "",
author: null,
departmentId: null,
departmentName: "",
isMain: 1,
upId: null,
upDetailId: null,
routingType: null,
status: 0,
approvalStatus: 4,
remark: "",
approvalStatusRemark: "",
auditUserId1: "",
auditUserId2: "",
platesnum: null,
isEffect: 1,
versionnotes: "",
phase: null,
versionid: null,
isSendPpm: 1,
fileId: "",
},
rules: {
name: [
{
required: true,
message: "必填",
trigger: "blur",
},
],
code: [
{
required: true,
message: "必填",
trigger: "blur",
},
],
routingType: [
{
required: true,
message: "请选择工艺类型",
trigger: "change",
type: "number",
},
],
},
parms: {
app: "technology",
eid: null,
name: "",
field: "",
},
};
},
props: {
v: Object,
eid: Number,
title: String,
},
mounted() {
this.parms.eid = this.$u.guid();
this.$refs.refFile.intFiles();
if (this.eid > 0) {
this.load(this.eid);
} else {
this.getCodNumber();
}
},
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
if (this.title == "克隆") {
this.$Message.success("克隆");
this.getcloneData();
} else {
if (this.$refs.refFile.nameList.length > 0) {
this.entity.fileId = this.parms.eid;
} else {
this.entity.fileId = "";
}
ApiWorkflow.getbyid({
id: "2085025d-9c38-4834-846a-8f9d2f4c8553",
})
.then((res) => {
if (res.success) {
let wfStatus = res.result.status;
if (wfStatus == 0) {
this.entity.approvalStatus = 4;
} else {
this.entity.approvalStatus = 1;
}
Api.create(this.entity)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.$Message.error("保存失败");
console.warn(err);
});
}
})
.catch((err) => {
this.$Message.error("操作失败");
console.warn(err);
});
}
}
});
},
// 克隆工艺
getcloneData() {
let parmese = {
headerId: this.eid,
code: this.entity.code,
};
Api.getCloneHeader(parmese)
.then((r) => {
if (r.success) {
this.$Message.success("克隆成功");
this.$emit("on-ok");
} else {
this.$Message.error("克隆失败");
}
})
.catch((err) => {
this.$Message.error("克隆失败");
console.warn(err);
});
name: "Add",
components: {
iQuill,
// VueUeditorWrap
},
handleClose() {
this.$emit("on-close");
},
handleImg(e) {
console.warn(e);
let file = null;
if (
e.clipboardData &&
e.clipboardData.items[0] &&
e.clipboardData.items[0].type &&
e.clipboardData.items[0].type.indexOf("image") > -1
) {
//这里就是判断是否有粘贴进来的文件且文件为图片格式
file = e.clipboardData.items[0].getAsFile();
let reader = new FileReader();
reader.readAsDataURL(file);
setTimeout(() => {
var img = '<img src="' + reader.result + '" alt=""/>';
this.entity.remark += img;
}, 1000);
// new R
}
data() {
return {
entity: {
classId: null,
unicode: "",
name: "",
code: "",
productId: null,
productName: "",
productBomId: null,
version: "",
author: null,
departmentId: null,
departmentName: "",
isMain: 1,
upId: null,
upDetailId: null,
routingType: null,
status: 0,
approvalStatus: 4,
remark: "",
approvalStatusRemark: "",
auditUserId1: "",
auditUserId2: "",
platesnum: null,
isEffect: 1,
versionnotes: "",
phase: null,
versionid: null,
isSendPpm: 1,
fileId: "",
},
rules: {
name: [{
required: true,
message: "必填",
trigger: "blur",
}, ],
code: [{
required: true,
message: "必填",
trigger: "blur",
}, ],
routingType: [{
required: true,
message: "请选择工艺类型",
trigger: "change",
type: "number",
}, ],
},
parms: {
app: "technology",
eid: null,
name: "",
field: "",
},
};
},
load(v) {
Api.get({
id: v,
}).then((r) => {
this.entity = r.result;
this.entity.isEffect = parseInt(r.result.isEffect);
this.entity.id = 0;
});
this.getCodNumber();
props: {
v: Object,
eid: Number,
title: String,
},
getCodNumber() {
Api.getCodeNumber({
code: "GY",
count: "1",
}).then((r) => {
if (r.success) {
this.entity.code = r.result[0];
mounted() {
this.parms.eid = this.$u.guid();
this.$refs.refFile.intFiles();
if (this.eid > 0) {
this.load(this.eid);
} else {
this.$Message.error("生成编号失败");
this.getCodNumber();
}
});
},
l(key) {
key = "routingHeader" + "." + key;
return this.$t(key);
},
proChange(v, items) {
this.entity.productName = items.productName;
this.entity.drawingNo = items.drawingNo;
this.entity.productBomId = items.bomId;
},
departChange(v, items) {
this.entity.departmentName = items.name;
},
},
watch: {
v() {
this.entity = this.$u.clone(this.v);
methods: {
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
if (this.title == "克隆") {
this.$Message.success("克隆");
this.getcloneData();
} else {
if (this.$refs.refFile.nameList.length > 0) {
this.entity.fileId = this.parms.eid;
} else {
this.entity.fileId = "";
}
ApiWorkflow.getbyid({
id: "2085025d-9c38-4834-846a-8f9d2f4c8553",
})
.then((res) => {
if (res.success) {
let wfStatus = res.result.status;
if (wfStatus == 0) {
this.entity.approvalStatus = 4;
} else {
this.entity.approvalStatus = 1;
}
Api.create(this.entity)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
//保存成功后直接打开主页面查看功能
let rowInfo = {
id: null, //????保存成功后需要返回id
code: this.entity.code,
name: this.entity.name,
routingType: this.entity.routingType,
version: this.entity.versionid,
departmentName: this.entity.departmentName,
approvalStatus: this.entity.approvalStatus,
productBomId: this.entity.productBomId
}
// this.$emit("on-goPage", rowInfo)
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.$Message.error("保存失败");
console.warn(err);
});
}
})
.catch((err) => {
this.$Message.error("操作失败");
console.warn(err);
});
}
}
});
},
// 克隆工艺
getcloneData() {
let parmese = {
headerId: this.eid,
code: this.entity.code,
};
Api.getCloneHeader(parmese)
.then((r) => {
if (r.success) {
this.$Message.success("克隆成功");
this.$emit("on-ok");
} else {
this.$Message.error("克隆失败");
}
})
.catch((err) => {
this.$Message.error("克隆失败");
console.warn(err);
});
},
handleClose() {
this.$emit("on-close");
},
handleImg(e) {
console.warn(e);
let file = null;
if (
e.clipboardData &&
e.clipboardData.items[0] &&
e.clipboardData.items[0].type &&
e.clipboardData.items[0].type.indexOf("image") > -1
) {
//这里就是判断是否有粘贴进来的文件且文件为图片格式
file = e.clipboardData.items[0].getAsFile();
let reader = new FileReader();
reader.readAsDataURL(file);
setTimeout(() => {
var img = '<img src="' + reader.result + '" alt=""/>';
this.entity.remark += img;
}, 1000);
// new R
}
},
load(v) {
Api.get({
id: v,
}).then((r) => {
this.entity = r.result;
this.entity.isEffect = parseInt(r.result.isEffect);
this.entity.id = 0;
});
this.getCodNumber();
},
getCodNumber() {
Api.getCodeNumber({
code: "GY",
count: "1",
}).then((r) => {
if (r.success) {
this.entity.code = r.result[0];
} else {
this.$Message.error("生成编号失败");
}
});
},
l(key) {
key = "routingHeader" + "." + key;
return this.$t(key);
},
proChange(v, items) {
this.entity.productName = items.productName;
this.entity.drawingNo = items.drawingNo;
this.entity.productBomId = items.bomId;
},
departChange(v, items) {
this.entity.departmentName = items.name;
},
},
eid(v) {
// console.log("id:",v)
if (v != 0) {
this.load(v);
}
watch: {
v() {
this.entity = this.$u.clone(this.v);
},
eid(v) {
// console.log("id:",v)
if (v != 0) {
this.load(v);
}
},
},
},
};
</script>
......@@ -52,7 +52,7 @@
</template>
</DataGrid>
<Modal v-model="modal" :title="title" width="1120" footer-hide>
<component :is="detail" :eid="curId" :uid="uId" :title="title" :headid="hid" @on-close="cancel" @on-ok="ok" />
<component :is="detail" :eid="curId" :uid="uId" :title="title" :headid="hid" @on-close="cancel" @on-ok="ok" @on-goPage="view" />
</Modal>
<Modal v-model="documentShow" title="送审" :mask-closable="false" :scrollable="true" ok-text="确定" cancel-text="取消" fullscreen>
<sendAudit ref="sendAudit"></sendAudit>
......
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