Commit 2395cf89 authored by 仇晓婷's avatar 仇晓婷

Merge branch 'product' of http://git.mes123.com/zhouyx/mes-ui into product

parents 8b9fe315 c624f999
<template>
<div>
<div>
<Form ref="form" :model="entity" :rules="rules" :label-width="110">
<Row>
<Col :span="12">
<FormItem :label="l('routingDetail')" prop="routingDetailId">
<Select v-model="entity.routingDetailId">
<Option
v-for="(item,index) in routingDetailList"
:value="item.value"
:key="index"
>{{ item.label }}</Option>
</Select>
</FormItem>
</Col>
<Col span="12">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Col span="12">
<FormItem :label="l('status')" prop="status">
<Select v-model="entity.status">
<Option :value="1">启用</Option>
<Option :value="0">禁用</Option>
</Select>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('filePath')" prop="filePaths">
<files ref="refFile" :parms="parms" files />
</FormItem>
</Col>
<Col span="24">
<FormItem :label="l('content')" prop="content">
<Input v-model="entity.content" type="textarea" :rows="5"></Input>
</FormItem>
</Col>
</Row>
<Row>
<Col :span="12">
<FormItem :label="l('routingDetail')" prop="routingDetailId">
<Select v-model="entity.routingDetailId">
<Option v-for="(item,index) in routingDetailList" :value="item.value" :key="index">{{ item.label }}</Option>
</Select>
</FormItem>
</Col>
<Col span="12">
<FormItem :label="l('title')" prop="title">
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Col span="12">
<FormItem :label="l('status')" prop="status">
<Select v-model="entity.status">
<Option :value="1">启用</Option>
<Option :value="0">禁用</Option>
</Select>
</FormItem>
</Col>
<Col :span="24">
<FormItem :label="l('filePath')" prop="filePaths">
<files ref="refFile" :parms="parms" files />
</FormItem>
</Col>
<Col span="24">
<FormItem :label="l('content')" prop="content">
<i-quill v-model="entity.content" :height="260" v-paste="handleImg" border />
</FormItem>
</Col>
</Row>
<Row>
<Col span="24" style="text-align:right">
<FormItem label>
<Button @click="handleClose" class="ml20">取消</Button>&nbsp;&nbsp;
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>&nbsp;&nbsp;
</FormItem>
</Col>
</Row>
<Row>
<Col span="24" style="text-align:right">
<FormItem label>
<Button @click="handleClose" class="ml20">取消</Button>&nbsp;&nbsp;
<Button type="primary" @click="handleSubmit" v-noClick>保存</Button>&nbsp;&nbsp;
</FormItem>
</Col>
</Row>
</Form>
</div>
</div>
</template>
<script>
<script>
import Api from "./api";
import ApiDetail from "../api";
import iQuill from "@/components/quill";
export default {
name: "Add",
data() {
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;
});
name: "Add",
components: {
iQuill
},
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("保存失败");
});
}
});
data() {
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: "",
},
};
},
handleClose() {
this.$emit("on-close");
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() {
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() {
this.$emit("on-ok");
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
// new R
}
},
handleClose() {
this.$emit("on-close");
},
ok() {
this.$emit("on-ok");
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
},
},
},
watch: {},
watch: {},
};
</script>
<template>
<div class="detail">
<div class="detail">
<Row>
<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('creator')">{{entity.creator}}</Filed>
<Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<Filed :span="24" :name="l('content')">{{entity.content}}</Filed>
<Filed :span="24" :name="l('filePath')">
<files ref="refFile" :parms="parms" unClosable style="display:inline" /></Filed>
</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('creator')">{{entity.creator}}</Filed>
<Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<Filed :span="24" :name="l('content')">
<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>
</div>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "Add",
data() {
return {
entity: {},
rules: {
name: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }],
},
parms: {
app: "technology",
eid: "",
name: "",
field: "",
},
};
},
props: {
eid: Number,
},
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
methods: {
clickData(data, liUrl) {
window.open(data, "_blank");
name: "Add",
data() {
return {
entity: {},
rules: {
name: [{
required: true,
message: "必填",
trigger: "blur"
}],
code: [{
required: true,
message: "必填",
trigger: "blur"
}],
},
parms: {
app: "technology",
eid: "",
name: "",
field: "",
},
};
},
load(v) {
Api.get({ id: v }).then((r) => {
this.entity = r.result;
this.parms.eid = r.result.filePaths;
this.$emit("on-load");
});
props: {
eid: Number,
},
handleClose() {
this.$emit("on-close");
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
methods: {
clickData(data, liUrl) {
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: {
eid(v) {
if (v > 0) {
this.load(v);
}
watch: {
eid(v) {
if (v > 0) {
this.load(v);
}
},
},
},
};
</script>
\ No newline at end of file
</script>
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<Col :span="12">
<FormItem :label="l('title')" prop="title" style="width:95%">
<Input v-model="entity.title"></Input>
<Input v-model="entity.title"></Input>
</FormItem>
</Col>
<Col span="12">
</Col>
<Col span="12">
<FormItem :label="l('status')" prop="status">
<Select v-model="entity.status">
<Option :value="1">启用</Option>
<Option :value="0">禁用</Option>
</Select>
<Select v-model="entity.status">
<Option :value="1">启用</Option>
<Option :value="0">禁用</Option>
</Select>
</FormItem>
</Col>
<Col span="24">
</Col>
<Col span="24">
<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>
</Col>
<Col span="24">
</Col>
<Col span="24">
<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>
</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 iQuill from "@/components/quill";
export default {
name: "Edit",
data() {
return {
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;
});
name: "Edit",
components: {
iQuill
},
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);
});
}
});
data() {
return {
entity: {},
rules: {
name: [{
required: true,
message: "必填",
trigger: "blur"
}],
},
parms: {
app: "technology", //服务
eid: "", //记录id
name: "", //表名process_case
field: "", //字段名
},
};
},
props: {
eid: Number,
},
handleClose() {
this.$emit("on-close");
mounted() {
if (this.eid > 0) {
this.load(this.eid);
}
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
methods: {
load(v) {
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: {
eid(v) {
if (v != 0) {
this.load(v);
}
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
},
},
},
};
</script>
\ No newline at end of file
</script>
<template>
<div>
<div>
<DataGrid :columns="columns" ref="grid" :action="action" :conditions="easySearch">
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入关键字标题" v-model="easySearch.keys.value" clearable />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template>
<template slot="easySearch">
<Form ref="formInline" :model="easySearch" inline>
<FormItem prop="keys">
<Input placeholder="请输入关键字标题" v-model="easySearch.keys.value" clearable />
</FormItem>
<FormItem>
<Button type="primary" @click="search">查询</Button>
</FormItem>
</Form>
</template>
<template slot="buttons">
<Button type="primary" @click="add">新增</Button>
</template>
</DataGrid>
<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>
</div>
</div>
</template>
<script>
import Api from "./api";
export default {
name: "",
name: "",
data() {
return {
action: Api.index,
easySearch: {
keys: { op: "title", value: null },
type: { op: "Equal", value: 2 },
routingHeaderId: { op: "Equal", value: this.headerid },
},
modal: false,
title: "新增",
detail: null,
curId: 0,
columns: [
{
type: "index",
width: 60,
align: "center",
},
{
key: "routingDetail",
title: this.l("routingDetail"),
align: "left",
high: true,
tooltip: true,
},
{
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",
data() {
return {
action: Api.index,
easySearch: {
keys: {
op: "title",
value: null
},
type: {
op: "Equal",
value: 2
},
routingHeaderId: {
op: "Equal",
value: this.headerid
},
},
modal: false,
title: "新增",
detail: null,
curId: 0,
columns: [{
type: "index",
width: 60,
align: "center",
},
{
attrs: { oprate: "detail" },
on: { click: () => this.view(params.row.id) },
key: "routingDetail",
title: this.l("routingDetail"),
align: "left",
high: true,
tooltip: true,
},
"查看"
),
h(
"op",
{
attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) },
key: "title",
title: this.l("title"),
align: "left",
},
"编辑"
),
h(
"op",
{
attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) },
key: "creator",
title: this.l("creator"),
align: "left",
type: "user",
},
"删除"
),
]);
},
},
],
};
},
props: ["headerid"],
mounted() {
// console.log(this);
this.parms.eid = this.$u.guid();
this.$refs.refFile.intFiles();
},
async fetch({ store, params }) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
methods: {
add() {
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;
{
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"
},
on: {
click: () => this.view(params.row.id)
},
},
"查看"
),
h(
"op", {
attrs: {
oprate: "edit"
},
on: {
click: () => this.edit(params.row.id)
},
},
"编辑"
),
h(
"op", {
attrs: {
oprate: "delete"
},
on: {
click: () => this.remove(params.row.id)
},
},
"删除"
),
]);
},
},
],
};
},
cancel() {
this.curId = 0;
this.modal = false;
props: ["headerid"],
mounted() {
// console.log(this);
this.parms.eid = this.$u.guid();
this.$refs.refFile.intFiles();
},
search() {
this.$refs.grid.reload(this.easySearch);
async fetch({
store,
params
}) {
await store.dispatch("loadDictionary"); // 加载数据字典
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
methods: {
add() {
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>
<style lang="less">
</style>
\ No newline at end of file
</style>
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