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

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

parents 8b9fe315 c624f999
This diff is collapsed.
<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
This diff is collapsed.
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