Commit 5b927673 authored by renjintao's avatar renjintao

technology index&&addindex&&add

parent 3b967bfd
<template> <template>
<Form ref="form" :model="entity" :rules="rules" :label-width="110"> <Form ref="form" :model="entity" :rules="rules" :label-width="110">
<Row> <Row>
<!-- <Col :span="12"> <!-- <Col :span="12">
<FormItem :label="l('classId')" prop="classId"> <FormItem :label="l('classId')" prop="classId">
<InputNumber v-model="entity.classId"></InputNumber> <InputNumber v-model="entity.classId"></InputNumber>
</FormItem> </FormItem>
...@@ -11,56 +11,56 @@ ...@@ -11,56 +11,56 @@
<Input v-model="entity.unicode"></Input> <Input v-model="entity.unicode"></Input>
</FormItem> </FormItem>
</Col>--> </Col>-->
<Col :span="8"> <Col :span="8">
<!-- <FormItem v-if="title=='新增'" :label="l('code')" prop="code"> <!-- <FormItem v-if="title=='新增'" :label="l('code')" prop="code">
<Input v-model="entity.code"></Input> <Input v-model="entity.code"></Input>
</FormItem> v-else-if="title=='克隆'"--> </FormItem> v-else-if="title=='克隆'"-->
<FormItem :label="l('code')" prop="code"> <FormItem :label="l('code')" prop="code">
<Input disabled v-model="entity.code"></Input> <Input disabled v-model="entity.code"></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="8">
<FormItem :label="l('name')" prop="name"> <FormItem :label="l('name')" prop="name">
<Input v-model="entity.name"></Input> <Input v-model="entity.name"></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="8">
<FormItem :label="l('routingType')" prop="routingType"> <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> </FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="8">
<FormItem :label="l('phase')" prop="phase"> <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> </FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="8">
<FormItem :label="l('productName')" prop="productId"> <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> </FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="8">
<FormItem :label="l('drawingNo')" prop="drawingNo"> <FormItem :label="l('drawingNo')" prop="drawingNo">
<Input v-model="entity.drawingNo" disabled></Input> <Input v-model="entity.drawingNo" disabled></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="8">
<FormItem :label="l('version')" prop="versionid"> <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> </FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="8">
<FormItem :label="l('departmentName')" prop="departmentId"> <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> </FormItem>
</Col> </Col>
<Col :span="8"> <Col :span="8">
<FormItem :label="l('isEffect')" prop="isEffect"> <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> </FormItem>
</Col> </Col>
<!-- <!--
<Col :span="8"> <Col :span="8">
<FormItem :label="l('isMain')" prop="isMain"> <FormItem :label="l('isMain')" prop="isMain">
<Dictionary code="Process.state" v-model="entity.isMain" type="radio"></Dictionary> <Dictionary code="Process.state" v-model="entity.isMain" type="radio"></Dictionary>
...@@ -76,13 +76,13 @@ ...@@ -76,13 +76,13 @@
<InputNumber v-model="entity.upId"></InputNumber> <InputNumber v-model="entity.upId"></InputNumber>
</FormItem> </FormItem>
</Col>--> </Col>-->
<!-- <Col :span="12"> <!-- <Col :span="12">
<FormItem :label="l('upDetailId')" prop="upDetailId"> <FormItem :label="l('upDetailId')" prop="upDetailId">
<InputNumber v-model="entity.upDetailId"></InputNumber> <InputNumber v-model="entity.upDetailId"></InputNumber>
</FormItem> </FormItem>
</Col>--> </Col>-->
<!-- <Col :span="12"> <!-- <Col :span="12">
<FormItem :label="l('status')" prop="status"> <FormItem :label="l('status')" prop="status">
<Dictionary code="Process.Status" v-model="entity.status"></Dictionary> <Dictionary code="Process.Status" v-model="entity.status"></Dictionary>
</FormItem> </FormItem>
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
</FormItem> </FormItem>
</Col>--> </Col>-->
<!-- <Col :span="12"> <!-- <Col :span="12">
<FormItem :label="l('approvalStatusRemark')" prop="approvalStatusRemark"> <FormItem :label="l('approvalStatusRemark')" prop="approvalStatusRemark">
<Input v-model="entity.approvalStatusRemark"></Input> <Input v-model="entity.approvalStatusRemark"></Input>
</FormItem> </FormItem>
...@@ -114,17 +114,17 @@ ...@@ -114,17 +114,17 @@
</FormItem> </FormItem>
</Col>--> </Col>-->
<!-- <Col :span="12"> <!-- <Col :span="12">
<FormItem :label="l('versionnotes')" prop="versionnotes"> <FormItem :label="l('versionnotes')" prop="versionnotes">
<Input v-model="entity.versionnotes"></Input> <Input v-model="entity.versionnotes"></Input>
</FormItem> </FormItem>
</Col>--> </Col>-->
<!-- <Col :span="12"> <!-- <Col :span="12">
<FormItem :label="l('phase')" prop="phase"> <FormItem :label="l('phase')" prop="phase">
<InputNumber v-model="entity.phase"></InputNumber> <InputNumber v-model="entity.phase"></InputNumber>
</FormItem> </FormItem>
</Col>--> </Col>-->
<!-- <Col :span="12"> <!-- <Col :span="12">
<FormItem :label="l('versionid')" prop="versionid"> <FormItem :label="l('versionid')" prop="versionid">
<InputNumber v-model="entity.versionid"></InputNumber> <InputNumber v-model="entity.versionid"></InputNumber>
</FormItem> </FormItem>
...@@ -135,250 +135,255 @@ ...@@ -135,250 +135,255 @@
</FormItem> </FormItem>
</Col> </Col>
--> -->
<Col :span="24"> <Col :span="24">
<FormItem :label="l('remark')" prop="remark"> <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> </FormItem>
</Col> </Col>
<Col :span="24"> <Col :span="24">
<FormItem label="多媒体附件" prop="files"> <FormItem label="多媒体附件" prop="files">
<files ref="refFile" :parms="parms" fileFormat /> <files ref="refFile" :parms="parms" fileFormat />
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
<FormItem> <FormItem>
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button> <Button type="primary" @click="handleSubmit" v-noClick>保存</Button>
<Button @click="handleClose" class="ml20">取消</Button> <Button @click="handleClose" class="ml20">取消</Button>
</FormItem> </FormItem>
</Form> </Form>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
import ApiWorkflow from "../workflow/process/api"; import ApiWorkflow from "../workflow/process/api";
import iQuill from "@/components/quill"; import iQuill from "@/components/quill";
export default { export default {
name: "Add", name: "Add",
components: { components: {
iQuill, iQuill,
// VueUeditorWrap // 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);
});
}, },
handleClose() { data() {
this.$emit("on-close"); return {
}, entity: {
handleImg(e) { classId: null,
console.warn(e); unicode: "",
let file = null; name: "",
if ( code: "",
e.clipboardData && productId: null,
e.clipboardData.items[0] && productName: "",
e.clipboardData.items[0].type && productBomId: null,
e.clipboardData.items[0].type.indexOf("image") > -1 version: "",
) { author: null,
//这里就是判断是否有粘贴进来的文件且文件为图片格式 departmentId: null,
file = e.clipboardData.items[0].getAsFile(); departmentName: "",
let reader = new FileReader(); isMain: 1,
reader.readAsDataURL(file); upId: null,
setTimeout(() => { upDetailId: null,
var img = '<img src="' + reader.result + '" alt=""/>'; routingType: null,
this.entity.remark += img; status: 0,
}, 1000); approvalStatus: 4,
remark: "",
// new R 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) { props: {
Api.get({ v: Object,
id: v, eid: Number,
}).then((r) => { title: String,
this.entity = r.result;
this.entity.isEffect = parseInt(r.result.isEffect);
this.entity.id = 0;
});
this.getCodNumber();
}, },
getCodNumber() { mounted() {
Api.getCodeNumber({ this.parms.eid = this.$u.guid();
code: "GY", this.$refs.refFile.intFiles();
count: "1", if (this.eid > 0) {
}).then((r) => { this.load(this.eid);
if (r.success) {
this.entity.code = r.result[0];
} else { } else {
this.$Message.error("生成编号失败"); this.getCodNumber();
} }
});
}, },
l(key) { methods: {
key = "routingHeader" + "." + key; handleSubmit() {
return this.$t(key); this.$refs.form.validate((v) => {
}, if (v) {
proChange(v, items) { if (this.title == "克隆") {
this.entity.productName = items.productName; this.$Message.success("克隆");
this.entity.drawingNo = items.drawingNo; this.getcloneData();
this.entity.productBomId = items.bomId; } else {
}, if (this.$refs.refFile.nameList.length > 0) {
departChange(v, items) { this.entity.fileId = this.parms.eid;
this.entity.departmentName = items.name; } else {
}, this.entity.fileId = "";
}, }
watch: { ApiWorkflow.getbyid({
v() { id: "2085025d-9c38-4834-846a-8f9d2f4c8553",
this.entity = this.$u.clone(this.v); })
.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) { watch: {
// console.log("id:",v) v() {
if (v != 0) { this.entity = this.$u.clone(this.v);
this.load(v); },
} eid(v) {
// console.log("id:",v)
if (v != 0) {
this.load(v);
}
},
}, },
},
}; };
</script> </script>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="1120" footer-hide> <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>
<Modal v-model="documentShow" title="送审" :mask-closable="false" :scrollable="true" ok-text="确定" cancel-text="取消" fullscreen> <Modal v-model="documentShow" title="送审" :mask-closable="false" :scrollable="true" ok-text="确定" cancel-text="取消" fullscreen>
<sendAudit ref="sendAudit"></sendAudit> <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