Commit 21918f08 authored by renjintao's avatar renjintao

remind 工艺提醒

parent bdef2da3
<template> <template>
<div> <div>
<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('routingDetail')" prop="routingDetailId"> <FormItem :label="l('routingDetail')" prop="routingDetailId">
<Select v-model="entity.routingDetailId"> <Select v-model="entity.routingDetailId">
<Option <Option v-for="(item,index) in routingDetailList" :value="item.value" :key="index">{{ item.label }}</Option>
v-for="(item,index) in routingDetailList" </Select>
:value="item.value" </FormItem>
:key="index" </Col>
>{{ item.label }}</Option> <Col span="12">
</Select> <FormItem :label="l('title')" prop="title">
</FormItem> <Input v-model="entity.title"></Input>
</Col> </FormItem>
<Col span="12"> </Col>
<FormItem :label="l('title')" prop="title"> <Col span="12">
<Input v-model="entity.title"></Input> <FormItem :label="l('status')" prop="status">
</FormItem> <Select v-model="entity.status">
</Col> <Option :value="1">启用</Option>
<Col span="12"> <Option :value="0">禁用</Option>
<FormItem :label="l('status')" prop="status"> </Select>
<Select v-model="entity.status"> </FormItem>
<Option :value="1">启用</Option> </Col>
<Option :value="0">禁用</Option> <Col :span="24">
</Select> <FormItem :label="l('filePath')" prop="filePaths">
</FormItem> <files ref="refFile" :parms="parms" files />
</Col> </FormItem>
<Col :span="24"> </Col>
<FormItem :label="l('filePath')" prop="filePaths"> <Col span="24">
<files ref="refFile" :parms="parms" files /> <FormItem :label="l('content')" prop="content">
</FormItem> <i-quill v-model="entity.content" :height="260" v-paste="handleImg" border />
</Col> </FormItem>
<Col span="24"> </Col>
<FormItem :label="l('content')" prop="content"> </Row>
<Input v-model="entity.content" type="textarea" :rows="5"></Input>
</FormItem>
</Col>
</Row>
<Row> <Row>
<Col span="24" style="text-align:right"> <Col span="24" style="text-align:right">
<FormItem label> <FormItem label>
<Button @click="handleClose" class="ml20">取消</Button>&nbsp;&nbsp; <Button @click="handleClose" class="ml20">取消</Button>&nbsp;&nbsp;
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>&nbsp;&nbsp; <Button type="primary" @click="handleSubmit" v-noClick>保存</Button>&nbsp;&nbsp;
</FormItem> </FormItem>
</Col> </Col>
</Row> </Row>
</Form> </Form>
</div> </div>
</template> </template>
<script>
<script>
import Api from "./api"; import Api from "./api";
import ApiDetail from "../api"; import ApiDetail from "../api";
import iQuill from "@/components/quill";
export default { export default {
name: "Add", name: "Add",
components: {
data() { iQuill
return {
submitShow: true, //送审按钮显隐
checked: true, //送审选择框
entity: {
creatorUserId: this.$store.state.userInfo.userId,
creator: this.$store.state.userInfo.userName,
routingHeaderId: this.eid, //工艺规程id
type: 2,
filePath: "", //文件路径
filePaths: "", //多个文件路径
},
rules: {
title: [{ required: true, message: "必填", trigger: "blur" }],
content: [{ required: true, message: "必填", trigger: "blur" }],
routingDetailId: [
{
required: true,
message: "请选择工序",
type: "number",
trigger: "change",
},
],
},
routingDetailList: [],
parms: {
app: "technology",
eid: null,
name: "",
field: "",
},
};
},
props: ["eid"],
mounted() {
this.loadDetails();
this.parms.eid = this.$u.guid();
this.$refs.refFile.intFiles();
},
methods: {
loadDetails() {
//获取工序列表
let parms = {
headerID: this.eid,
};
ApiDetail.pagedDetails(parms).then((r) => {
let tempDetails = r.result;
let tempD = [];
tempDetails.forEach((data) => {
let tempObj = {};
tempObj.value = data.id;
tempObj.label = data.taskSeq + " " + data.name;
tempD.push(tempObj);
});
this.routingDetailList = tempD;
});
}, },
handleSubmit() { data() {
this.$refs.form.validate((v) => { return {
if (v) { submitShow: true, //送审按钮显隐
if (this.$refs.refFile.nameList.length > 0) { checked: true, //送审选择框
this.entity.filePaths = this.parms.eid; entity: {
} else { creatorUserId: this.$store.state.userInfo.userId,
this.entity.filePath = ""; creator: this.$store.state.userInfo.userName,
this.entity.filePaths = ""; routingHeaderId: this.eid, //工艺规程id
} type: 2,
Api.create(this.entity) filePath: "", //文件路径
.then((r) => { filePaths: "", //多个文件路径
if (r.success) { },
this.$Message.success("保存成功"); rules: {
this.$emit("on-ok"); title: [{
} else { required: true,
this.$Message.error("保存失败"); message: "必填",
} trigger: "blur"
this.$refs.refFile.intFiles(); }],
}) content: [{
.catch((err) => { required: true,
this.$Message.error("保存失败"); message: "必填",
}); trigger: "blur"
} }],
}); routingDetailId: [{
required: true,
message: "请选择工序",
type: "number",
trigger: "change",
}, ],
},
routingDetailList: [],
parms: {
app: "technology",
eid: null,
name: "",
field: "",
},
};
}, },
handleClose() { props: ["eid"],
this.$emit("on-close"); mounted() {
this.loadDetails();
this.parms.eid = this.$u.guid();
this.$refs.refFile.intFiles();
}, },
methods: {
loadDetails() {
//获取工序列表
let parms = {
headerID: this.eid,
};
ApiDetail.pagedDetails(parms).then((r) => {
let tempDetails = r.result;
let tempD = [];
tempDetails.forEach((data) => {
let tempObj = {};
tempObj.value = data.id;
tempObj.label = data.taskSeq + " " + data.name;
tempD.push(tempObj);
});
this.routingDetailList = tempD;
});
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
if (this.$refs.refFile.nameList.length > 0) {
this.entity.filePaths = this.parms.eid;
} else {
this.entity.filePath = "";
this.entity.filePaths = "";
}
Api.create(this.entity)
.then((r) => {
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
this.$refs.refFile.intFiles();
})
.catch((err) => {
this.$Message.error("保存失败");
});
}
});
},
handleImg(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.content += img;
}, 1000);
ok() { // new R
this.$emit("on-ok"); }
}, },
l(key) { handleClose() {
key = "remind" + "." + key; this.$emit("on-close");
return this.$t(key); },
ok() {
this.$emit("on-ok");
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
},
}, },
}, watch: {},
watch: {},
}; };
</script> </script>
<template> <template>
<div class="detail"> <div class="detail">
<Row> <Row>
<Filed :span="12" :name="l('title')">{{entity.title}}</Filed> <Filed :span="12" :name="l('title')">{{entity.title}}</Filed>
<Filed :span="12" :name="l('status')"><state code="processCase.status" :value="entity.status+''" type="text" /></Filed> <Filed :span="12" :name="l('status')">
<Filed :span="12" :name="l('creator')">{{entity.creator}}</Filed> <state code="processCase.status" :value="entity.status+''" type="text" />
<Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed> </Filed>
<Filed :span="24" :name="l('content')">{{entity.content}}</Filed> <Filed :span="12" :name="l('creator')">{{entity.creator}}</Filed>
<Filed :span="24" :name="l('filePath')"> <Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<files ref="refFile" :parms="parms" unClosable style="display:inline" /></Filed> <Filed :span="24" :name="l('content')">
</Filed> <div v-html="entity.content" class="tohtml"></div>
</Filed>
<Filed :span="24" :name="l('filePath')">
<files ref="refFile" :parms="parms" unClosable style="display:inline" />
</Filed>
</Filed>
</Row> </Row>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
name: "Add", name: "Add",
data() { data() {
return { return {
entity: {}, entity: {},
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{
code: [{ required: true, message: "必填", trigger: "blur" }], required: true,
}, message: "必填",
parms: { trigger: "blur"
app: "technology", }],
eid: "", code: [{
name: "", required: true,
field: "", message: "必填",
}, trigger: "blur"
}; }],
}, },
props: { parms: {
eid: Number, app: "technology",
}, eid: "",
mounted() { name: "",
if (this.eid > 0) { field: "",
this.load(this.eid); },
} };
},
methods: {
clickData(data, liUrl) {
window.open(data, "_blank");
}, },
load(v) { props: {
Api.get({ id: v }).then((r) => { eid: Number,
this.entity = r.result;
this.parms.eid = r.result.filePaths;
this.$emit("on-load");
});
}, },
handleClose() { mounted() {
this.$emit("on-close"); if (this.eid > 0) {
this.load(this.eid);
}
}, },
l(key) { methods: {
key = "remind" + "." + key; clickData(data, liUrl) {
return this.$t(key); window.open(data, "_blank");
},
load(v) {
Api.get({
id: v
}).then((r) => {
this.entity = r.result;
this.parms.eid = r.result.filePaths;
this.$emit("on-load");
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
},
}, },
}, watch: {
watch: { eid(v) {
eid(v) { if (v > 0) {
if (v > 0) { this.load(v);
this.load(v); }
} },
}, },
},
}; };
</script> </script>
\ No newline at end of file
<template> <template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90"> <Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row> <Row>
<Col :span="12"> <Col :span="12">
<FormItem :label="l('title')" prop="title" style="width:95%"> <FormItem :label="l('title')" prop="title" style="width:95%">
<Input v-model="entity.title"></Input> <Input v-model="entity.title"></Input>
</FormItem> </FormItem>
</Col> </Col>
<Col span="12"> <Col span="12">
<FormItem :label="l('status')" prop="status"> <FormItem :label="l('status')" prop="status">
<Select v-model="entity.status"> <Select v-model="entity.status">
<Option :value="1">启用</Option> <Option :value="1">启用</Option>
<Option :value="0">禁用</Option> <Option :value="0">禁用</Option>
</Select> </Select>
</FormItem> </FormItem>
</Col> </Col>
<Col span="24"> <Col span="24">
<FormItem :label="l('filePath')"> <FormItem :label="l('filePath')">
<!-- <files ref="refFile" :parms="parms" files /> --> <!-- <files ref="refFile" :parms="parms" files /> -->
<files ref="refFile" :parms="parms" files /> <files ref="refFile" :parms="parms" files />
</FormItem> </FormItem>
</Col> </Col>
<Col span="24"> <Col span="24">
<FormItem :label="l('content')" prop="content "> <FormItem :label="l('content')" prop="content ">
<Input v-model="entity.content" type="textarea" :rows="5"></Input> <i-quill v-model="entity.content" :height="260" v-paste="handleImg" border />
</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 iQuill from "@/components/quill";
export default { export default {
name: "Edit", name: "Edit",
data() { components: {
return { iQuill
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
},
parms: {
app: "technology", //服务
eid: "", //记录id
name: "", //表名process_case
field: "", //字段名
},
};
},
props: {
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.parms.eid = r.result.filePaths;
});
}, },
handleSubmit() { data() {
this.$refs.form.validate((v) => { return {
if (v) { entity: {},
if (this.$refs.refFile.nameList.length > 0) { rules: {
this.entity.filePaths = this.parms.eid; name: [{
} else { required: true,
this.entity.filePath = ""; message: "必填",
this.entity.filePaths = ""; trigger: "blur"
} }],
Api.update(this.entity) },
.then((r) => { parms: {
if (r.success) { app: "technology", //服务
this.$Message.success("保存成功"); eid: "", //记录id
this.$emit("on-ok"); name: "", //表名process_case
} else { field: "", //字段名
this.$Message.error("保存失败"); },
} };
}) },
.catch((err) => { props: {
this.$Message.error("保存失败"); eid: Number,
console.warn(err);
});
}
});
}, },
handleClose() { mounted() {
this.$emit("on-close"); if (this.eid > 0) {
this.load(this.eid);
}
}, },
l(key) { methods: {
key = "remind" + "." + key; load(v) {
return this.$t(key); Api.get({
id: v
}).then((r) => {
this.entity = r.result;
this.parms.eid = r.result.filePaths;
});
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
if (this.$refs.refFile.nameList.length > 0) {
this.entity.filePaths = this.parms.eid;
} else {
this.entity.filePath = "";
this.entity.filePaths = "";
}
Api.update(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);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
handleImg(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.content += img;
}, 1000);
// new R
}
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
},
}, },
}, watch: {
watch: { eid(v) {
eid(v) { if (v != 0) {
if (v != 0) { this.load(v);
this.load(v); }
} },
}, },
},
}; };
</script> </script>
\ No newline at end of file
<template> <template>
<div> <div>
<DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch"> <DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch">
<template slot="easySearch"> <template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline> <Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys"> <FormItem prop="keys">
<Input placeholder="请输入关键字标题" v-model="easySearch.keys.value" clearable /> <Input placeholder="请输入关键字标题" v-model="easySearch.keys.value" clearable />
</FormItem> </FormItem>
<FormItem> <FormItem>
<Button type="primary" @click="search">查询</Button> <Button type="primary" @click="search">查询</Button>
</FormItem> </FormItem>
</Form> </Form>
</template> </template>
<template slot="buttons"> <template slot="buttons">
<Button type="primary" @click="add">新增</Button> <Button type="primary" @click="add">新增</Button>
</template> </template>
</DataGrid> </DataGrid>
<Modal v-model="modal" :title="title" width="800" footer-hide> <Modal v-model="modal" :title="title" width="800" footer-hide>
<component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" /> <component :is="detail" :eid="curId" @on-close="cancel" @on-ok="ok" />
</Modal> </Modal>
</div> </div>
</template> </template>
<script> <script>
import Api from "./api"; import Api from "./api";
export default { export default {
name: "", name: "",
data() { data() {
return { return {
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { op: "title", value: null }, keys: {
type: { op: "Equal", value: 2 }, op: "title",
routingHeaderId: { op: "Equal", value: this.headerid }, value: null
}, },
modal: false, type: {
title: "新增", op: "Equal",
detail: null, value: 2
curId: 0, },
columns: [ routingHeaderId: {
{ op: "Equal",
type: "index", value: this.headerid
width: 60, },
align: "center", },
}, modal: false,
{ title: "新增",
key: "routingDetail", detail: null,
title: this.l("routingDetail"), curId: 0,
align: "left", columns: [{
high: true, type: "index",
tooltip: true, width: 60,
}, align: "center",
{ },
key: "title",
title: this.l("title"),
align: "left",
},
{
key: "creator",
title: this.l("creator"),
align: "left",
type: "user",
},
{
key: "content",
title: this.l("content"),
align: "left",
},
{
key: "filePaths",
title: this.l("filePath"),
align: "left",
easy: true,
render: (h, params) => {
return h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.view(params.row.id) },
},
"查看"
);
},
},
{
key: "status",
title: this.l("status"),
align: "left",
easy: true,
code: "process.status",
},
{
title: "操作",
key: "action",
width: 140,
align: "center",
render: (h, params) => {
return h("div", { class: "action" }, [
h(
"op",
{ {
attrs: { oprate: "detail" }, key: "routingDetail",
on: { click: () => this.view(params.row.id) }, title: this.l("routingDetail"),
align: "left",
high: true,
tooltip: true,
}, },
"查看"
),
h(
"op",
{ {
attrs: { oprate: "edit" }, key: "title",
on: { click: () => this.edit(params.row.id) }, title: this.l("title"),
align: "left",
}, },
"编辑"
),
h(
"op",
{ {
attrs: { oprate: "delete" }, key: "creator",
on: { click: () => this.remove(params.row.id) }, title: this.l("creator"),
align: "left",
type: "user",
}, },
"删除" {
), key: "filePaths",
]); title: this.l("filePath"),
}, align: "left",
}, easy: true,
], render: (h, params) => {
}; return h(
}, "op", {
props: ["headerid"], attrs: {
mounted() { oprate: "detail"
// console.log(this); },
this.parms.eid = this.$u.guid(); on: {
this.$refs.refFile.intFiles(); click: () => this.view(params.row.id)
}, },
async fetch({ store, params }) { },
await store.dispatch("loadDictionary"); // 加载数据字典 "查看"
}, );
methods: { },
add() { },
this.curId = this.headerid; {
this.title = "新增"; key: "status",
this.detail = () => import("./add"); title: this.l("status"),
this.modal = true; align: "left",
}, easy: true,
view(id) { code: "process.status",
this.curId = id; },
this.title = "详情"; {
this.detail = () => import("./detail"); title: "操作",
this.modal = true; key: "action",
}, width: 140,
edit(id) { align: "center",
this.curId = id; render: (h, params) => {
this.title = "编辑"; return h("div", {
this.detail = () => import("./edit"); class: "action"
this.modal = true; }, [
}, h(
remove(id) { "op", {
// this.modal = true; attrs: {
Api.delete(id).then((r) => { oprate: "detail"
if (r.success) { },
this.$refs.grid.load(); on: {
this.$Message.success("删除成功"); click: () => this.view(params.row.id)
} },
}); },
}, "查看"
ok() { ),
this.$refs.grid.load(); h(
this.modal = false; "op", {
this.curId = 0; attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row.id)
},
},
"编辑"
),
h(
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
},
},
"删除"
),
]);
},
},
],
};
}, },
cancel() { props: ["headerid"],
this.curId = 0; mounted() {
this.modal = false; // console.log(this);
this.parms.eid = this.$u.guid();
this.$refs.refFile.intFiles();
}, },
search() { async fetch({
this.$refs.grid.reload(this.easySearch); store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
}, },
l(key) { methods: {
key = "remind" + "." + key; add() {
return this.$t(key); this.curId = this.headerid;
this.title = "新增";
this.detail = () => import("./add");
this.modal = true;
},
view(id) {
this.curId = id;
this.title = "详情";
this.detail = () => import("./detail");
this.modal = true;
},
edit(id) {
this.curId = id;
this.title = "编辑";
this.detail = () => import("./edit");
this.modal = true;
},
remove(id) {
// this.modal = true;
Api.delete(id).then((r) => {
if (r.success) {
this.$refs.grid.load();
this.$Message.success("删除成功");
}
});
},
ok() {
this.$refs.grid.load();
this.modal = false;
this.curId = 0;
},
cancel() {
this.curId = 0;
this.modal = false;
},
search() {
this.$refs.grid.reload(this.easySearch);
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
},
}, },
},
}; };
</script> </script>
<style lang="less"> <style lang="less">
</style> </style>
\ No newline at end of file
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