Commit 029efc3f authored by 仇晓婷's avatar 仇晓婷

工艺案例ok

parent 13b0f861
...@@ -1430,6 +1430,7 @@ export default { ...@@ -1430,6 +1430,7 @@ export default {
remind:{//工艺提醒,工艺案例 remind:{//工艺提醒,工艺案例
title: '名称', title: '名称',
creator: '创建人', creator: '创建人',
creationTime:'创建时间',
content: '内容', content: '内容',
filePath: "上传文件", //文件路径 filePath: "上传文件", //文件路径
filePaths: "", //多个文件路径 filePaths: "", //多个文件路径
......
<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="24"> <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="24"> <Col span="12">
<FormItem label> <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')">
<!-- <files ref="refFile" :parms="parms" files /> --> <!-- <files ref="refFile" :parms="parms" files /> -->
<files ref="refFile" :parms="parms" fileFormat :Photos="true" @clickItem="clickData" /> <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> </FormItem>
<!-- <FormItem :label="l('filePath')" prop="filePath">
<InputFile v-model="entity.filePath"></InputFile>
</FormItem> -->
</Col> </Col>
</Row> </Row>
<FormItem> <FormItem>
...@@ -30,13 +40,7 @@ export default { ...@@ -30,13 +40,7 @@ export default {
return { return {
disabled: false, disabled: false,
entity: { entity: {
// creationTime: null,
creatorUserId: this.$store.state.userInfo.userId, creatorUserId: this.$store.state.userInfo.userId,
// lastModificationTime: null,
// lastModifierUserId: null,
// isDeleted: null,
// deletionTime: null,
// deleterUserId: null,
title: "", title: "",
creator: this.$store.state.userInfo.userName, creator: this.$store.state.userInfo.userName,
content: "", content: "",
...@@ -45,35 +49,36 @@ export default { ...@@ -45,35 +49,36 @@ export default {
dispatchId: this.$route.query.id, dispatchId: this.$route.query.id,
routingDetailId: this.$route.query.headid, routingDetailId: this.$route.query.headid,
routingHeaderId: this.$route.query.routid, routingHeaderId: this.$route.query.routid,
type: 1 type: 1,
}, },
rules: { rules: {
title: [{ required: true, message: "请填写案例名称", trigger: "blur" }] title: [{ required: true, message: "请填写案例名称", trigger: "blur" }],
}, },
parms:{ parms: {
app: 'technology', //服务 app: "technology", //服务
eid: this.$u.guid(), //记录id eid: this.$u.guid(), //记录id
name: '', //表名process_case name: "", //表名process_case
field: '' //字段名 field: "", //字段名
}, },
}; };
}, },
props: { props: {
v: Object, v: Object,
eid: Number eid: Number,
}, },
created(){ created() {
// console.log(this.entity.creator) // console.log(this.entity.creator)
}, },
mounted() { mounted() {
if (this.eid > 0) { if (this.eid > 0) {
this.load(this.eid); this.load(this.eid);
this.$refs.refFile.intFiles() this.parms.eid = this.$u.guid();
this.$refs.refFile.intFiles();
} }
}, },
methods: { methods: {
handleSubmit() { handleSubmit() {
this.$refs.form.validate(v => { this.$refs.form.validate((v) => {
if (v) { if (v) {
this.disabled = true; this.disabled = true;
if (this.$refs.refFile.nameList.length > 0) { if (this.$refs.refFile.nameList.length > 0) {
...@@ -84,7 +89,7 @@ export default { ...@@ -84,7 +89,7 @@ export default {
this.entity.filePaths = ""; this.entity.filePaths = "";
} }
Api.create(this.entity) Api.create(this.entity)
.then(r => { .then((r) => {
this.disabled = false; this.disabled = false;
if (r.success) { if (r.success) {
this.$Message.success("保存成功"); this.$Message.success("保存成功");
...@@ -93,10 +98,10 @@ export default { ...@@ -93,10 +98,10 @@ export default {
this.$Message.error("保存失败"); this.$Message.error("保存失败");
} }
}) })
.catch(err => { .catch((err) => {
this.disabled = false; this.disabled = false;
this.$Message.error("保存失败"); this.$Message.error("保存失败");
console.warn(err); // console.warn(err);
}); });
} }
}); });
...@@ -105,15 +110,15 @@ export default { ...@@ -105,15 +110,15 @@ export default {
this.$emit("on-close"); this.$emit("on-close");
}, },
load(v) { load(v) {
Api.get({ id: v }).then(r => { Api.get({ id: v }).then((r) => {
this.entity = r.result; this.entity = r.result;
this.entity.id = 0; this.entity.id = 0;
}); });
}, },
l(key) { l(key) {
key = "process_case" + "." + key; key = "remind" + "." + key;
return this.$t(key); return this.$t(key);
} },
}, },
watch: { watch: {
v() { v() {
...@@ -123,7 +128,7 @@ export default { ...@@ -123,7 +128,7 @@ export default {
if (v > 0) { if (v > 0) {
this.load(v); this.load(v);
} }
} },
} },
}; };
</script> </script>
\ No newline at end of file
<template> <template>
<div class="detail"> <div class="detail">
<Row> <Row>
<Filed :span="24" :name="l('title')">{{entity.title}}</Filed> <Filed :span="12" :name="l('title')">{{entity.title}}</Filed>
<Filed :span="24" :name="l('creationTime')">{{entity.creationTime}}</Filed> <Filed :span="12" :name="l('status')"><state code="processCase.status" :value="entity.status+''" type="text" /></Filed>
<Filed :span="24" :name="l('creator')">{{entity.creator}}</Filed> <Filed :span="12" :name="l('creator')">{{entity.creator}}</Filed>
<Filed :span="24" :name="l('filePaths')"> <Filed :span="12" :name="l('creationTime')">{{entity.creationTime}}</Filed>
<files <Filed :span="24" :name="l('content')">{{entity.content}}</Filed>
ref="refFile" <Filed :span="24" :name="l('filePath')">
:parms="parms" <files ref="refFile" :parms="parms" unClosable style="display:inline" /></Filed>
fileFormat </Filed>
:Photos="true"
:showList="false"
@clickItem="clickData"
/></Filed>
<!-- <Filed :span="12" :name="l('filePaths')">{{entity.filePaths}}</Filed> -->
</Row> </Row>
</div> </div>
</template> </template>
...@@ -26,18 +21,18 @@ export default { ...@@ -26,18 +21,18 @@ export default {
entity: {}, entity: {},
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{ required: true, message: "必填", trigger: "blur" }],
code: [{ required: true, message: "必填", trigger: "blur" }] code: [{ required: true, message: "必填", trigger: "blur" }],
}, },
parms: { parms: {
app: "technology", app: "technology",
eid: "", eid: "",
name: "", name: "",
field: "" field: "",
} },
}; };
}, },
props: { props: {
eid: Number eid: Number,
}, },
mounted() { mounted() {
if (this.eid > 0) { if (this.eid > 0) {
...@@ -45,13 +40,13 @@ export default { ...@@ -45,13 +40,13 @@ export default {
} }
}, },
methods: { methods: {
clickData(data,liUrl) { clickData(data, liUrl) {
window.open(data, "_blank"); window.open(data, "_blank");
}, },
load(v) { load(v) {
Api.get({ id: v }).then(r => { Api.get({ id: v }).then((r) => {
this.entity = r.result; this.entity = r.result;
this.parms.eid = r.result.filePaths; this.parms.eid = r.result.filePaths;
this.$emit("on-load"); this.$emit("on-load");
}); });
}, },
...@@ -59,16 +54,16 @@ export default { ...@@ -59,16 +54,16 @@ export default {
this.$emit("on-close"); this.$emit("on-close");
}, },
l(key) { l(key) {
key = "process_case" + "." + key; key = "remind" + "." + key;
return this.$t(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"><FormItem :label="l('creationTime')" prop="creationTime"> <DatePicker type="date" v-model="entity.creationTime"></DatePicker> <Col :span="12">
</FormItem></Col> <FormItem :label="l('title')" prop="title" style="width:95%">
<Col :span="12"><FormItem :label="l('creatorUserId')" prop="creatorUserId"> <InputNumber v-model="entity.creatorUserId"></InputNumber> <Input v-model="entity.title"></Input>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('lastModificationTime')" prop="lastModificationTime"> <DatePicker type="date" v-model="entity.lastModificationTime"></DatePicker>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('lastModifierUserId')" prop="lastModifierUserId"> <InputNumber v-model="entity.lastModifierUserId"></InputNumber>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('isDeleted')" prop="isDeleted"> <InputNumber v-model="entity.isDeleted"></InputNumber>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('deletionTime')" prop="deletionTime"> <DatePicker type="date" v-model="entity.deletionTime"></DatePicker>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('deleterUserId')" prop="deleterUserId"> <InputNumber v-model="entity.deleterUserId"></InputNumber>
</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('creator')" prop="creator"> <Input v-model="entity.creator"> </Input>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('content')" prop="content"> <Input v-model="entity.content"> </Input>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('filePath')" prop="filePath"> <InputFile v-model="entity.filePath"></InputFile>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('filePaths')" prop="filePaths"> <Input v-model="entity.filePaths"> </Input>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('dispatchId')" prop="dispatchId"> <InputNumber v-model="entity.dispatchId"></InputNumber>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('routingDetailId')" prop="routingDetailId"> <InputNumber v-model="entity.routingDetailId"></InputNumber>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('routingHeaderId')" prop="routingHeaderId"> <InputNumber v-model="entity.routingHeaderId"></InputNumber>
</FormItem></Col>
<Col :span="12"><FormItem :label="l('type')" prop="type"> <InputNumber v-model="entity.type"></InputNumber>
</FormItem></Col>
</Row>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem> </FormItem>
</Form> </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')">
<!-- <files ref="refFile" :parms="parms" files /> -->
<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>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template> </template>
<script> <script>
import Api from './api' import Api from "./api";
export default { export default {
name: 'Edit', name: "Edit",
data() { data() {
return { return {
disabled: false, disabled: false,
entity: { entity: {},
}, rules: {
rules: { name: [{ required: true, message: "必填", trigger: "blur" }],
name: [{ required: true, message: '必填', trigger: 'blur' }] },
} parms: {
} app: "technology", //服务
}, eid: "", //记录id
props: { name: "", //表名process_case
eid: Number field: "", //字段名
}, },
mounted() { };
if (this.eid > 0) { },
this.load(this.eid); props: {
} eid: Number,
}, },
methods: { mounted() {
load(v) { if (this.eid > 0) {
Api.get({ id: v }).then(r => { this.load(this.eid);
this.entity = r.result;
})
},
handleSubmit() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
Api.update(this.entity).then((r) => {
this.disabled = false;
if (r.success) {
this.$Message.success('保存成功')
this.$emit('on-ok')
} else {
this.$Message.error('保存失败')
}
}).catch(err => {
this.disabled = false;
this.$Message.error('保存失败')
console.warn(err)
})
}
})
},
handleClose() {
this.$emit('on-close')
},
l(key) {
key = "process_case" + "." + key;
return this.$t(key)
}
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
}
}
} }
},
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) {
this.disabled = true;
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) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
},
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
},
},
};
</script> </script>
\ No newline at end of file
...@@ -28,36 +28,41 @@ ...@@ -28,36 +28,41 @@
</template> </template>
<template slot="card" slot-scope="{row}"> <template slot="card" slot-scope="{row}">
<div class="card_body"> <div class="card_body">
<Row class="title_i"> <Row class="title_i">
<Col :span="21">案例名称:{{row.title}}</Col> <Col :span="20">案例名称:{{row.title}}</Col>
<Col :span="3" class="btn_click"> <Col :span="4" class="btn_click">
<!-- <a @click="edit(row.id)"> <a @click="edit(row.id)">
<Icon type="ios-create" @click="edit(row.id)" /> <Icon type="ios-create" @click="edit(row.id)" />
</a> --> </a>
<a @click="view(row.id)"> <a @click="view(row.id)">
<Icon type="ios-paper" /> <Icon type="ios-paper" />
</a> </a>
<a @click="remove(row.id)"> <a @click="remove(row.id)">
<Icon type="ios-trash" /> <Icon type="ios-trash" />
</a> </a>
</Col>
</Row>
<div class="down_text">
<Row :gutter="16">
<Col span="6">
<div class="file">
<!-- <img :src="fileUrlDown +row.filePaths" /> -->
<!-- <Icon type="ios-paper" v-if="row.id%2==0" /> -->
<Icon type="ios-paper" v-if="row.filePaths" />
<Icon type="md-film" v-else />
</div>
</Col>
<Col span="18">
<p>创建时间:{{row.creationTime}}</p>
<p>创建人:{{row.creator}}</p>
<p>内容:{{row.content}}</p>
<p>
状态:
<state code="processCase.status" :value="row.status+''" type="text" />
</p>
</Col> </Col>
</Row> </Row>
<div class="down_text"> </div>
<Row :gutter="16">
<Col span="6">
<div class="file">
<!-- <img :src="fileUrlDown +row.filePaths" /> -->
<!-- <Icon type="ios-paper" v-if="row.id%2==0" /> -->
<Icon type="ios-paper" v-if="row.filePaths" />
<Icon type="md-film" v-else />
</div>
</Col>
<Col span="18">
<p>{{row.creationTime}}</p>
<p>{{row.id}}{{row.creator}}</p>
</Col>
</Row>
</div>
</div> </div>
<!-- <div class="card_box" @click="changeCards(row)"> <!-- <div class="card_box" @click="changeCards(row)">
<Row :gutter="16"> <Row :gutter="16">
...@@ -75,13 +80,19 @@ ...@@ -75,13 +80,19 @@
<p>{{row.id}}{{row.creator}}</p> <p>{{row.id}}{{row.creator}}</p>
</Col> </Col>
</Row> </Row>
</div> --> </div>-->
</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>
<Modal v-model="deletelModal" title="删除" @on-ok="removeOk" @on-cancel="cancel" :mask-closable="false"> <Modal
v-model="deletelModal"
title="删除"
@on-ok="removeOk"
@on-cancel="cancel"
:mask-closable="false"
>
<p>确定删除?</p> <p>确定删除?</p>
</Modal> </Modal>
</div> </div>
...@@ -92,7 +103,7 @@ import Search from "./search"; ...@@ -92,7 +103,7 @@ import Search from "./search";
export default { export default {
name: "list", name: "list",
components: { components: {
Search Search,
}, },
head: { head: {
title: "工艺案例", title: "工艺案例",
...@@ -104,7 +115,7 @@ export default { ...@@ -104,7 +115,7 @@ export default {
action: Api.index, action: Api.index,
easySearch: { easySearch: {
keys: { op: "title", value: null }, keys: { op: "title", value: null },
type: { op: "Equal", value: 1 } type: { op: "Equal", value: 1 },
}, },
modal: false, modal: false,
deletelModal: false, deletelModal: false,
...@@ -112,94 +123,35 @@ export default { ...@@ -112,94 +123,35 @@ export default {
detail: null, detail: null,
curId: 0, curId: 0,
columns: [ columns: [
{
key: "id",
title: this.$t("id"),
hide: true,
align: "left",
high: true
},
{
key: "creationTime",
title: this.l("creationTime"),
align: "left",
high: true
},
{
key: "creatorUserId",
title: this.l("creatorUserId"),
align: "left",
high: true
},
{
key: "lastModificationTime",
title: this.l("lastModificationTime"),
align: "left",
high: true
},
{
key: "lastModifierUserId",
title: this.l("lastModifierUserId"),
align: "left",
high: true
},
{
key: "isDeleted",
title: this.l("isDeleted"),
align: "left",
high: true
},
{
key: "deletionTime",
title: this.l("deletionTime"),
align: "left",
high: true
},
{
key: "deleterUserId",
title: this.l("deleterUserId"),
align: "left",
high: true
},
{ {
key: "title", key: "title",
title: this.l("title"), title: this.l("title"),
align: "left", align: "left",
easy: true,
high: true
}, },
{ key: "creator", title: this.l("creator"), align: "left", high: true },
{ {
key: "filePath", key: "creator",
title: this.l("filePath"), title: this.l("creator"),
align: "left", align: "left",
high: true type: "user",
}, },
{ {
key: "filePaths", key: "content",
title: this.l("filePaths"), title: this.l("content"),
align: "left", align: "left",
high: true
}, },
{ {
key: "dispatchId", key: "filePaths",
title: this.l("dispatchId"), title: this.l("filePath"),
align: "left",
high: true
},
{
key: "routingDetailId",
title: this.l("routingDetailId"),
align: "left", align: "left",
high: true easy: true,
}, },
{ {
key: "routingHeaderId", key: "status",
title: this.l("routingHeaderId"), title: this.l("status"),
align: "left", align: "left",
high: true easy: true,
code: "process.status",
}, },
{ key: "type", title: this.l("type"), align: "left", high: true },
{ {
title: "操作", title: "操作",
key: "action", key: "action",
...@@ -211,7 +163,7 @@ export default { ...@@ -211,7 +163,7 @@ export default {
"op", "op",
{ {
attrs: { oprate: "detail" }, attrs: { oprate: "detail" },
on: { click: () => this.view(params.row.id) } on: { click: () => this.view(params.row.id) },
}, },
"查看" "查看"
), ),
...@@ -219,7 +171,7 @@ export default { ...@@ -219,7 +171,7 @@ export default {
"op", "op",
{ {
attrs: { oprate: "edit" }, attrs: { oprate: "edit" },
on: { click: () => this.edit(params.row.id) } on: { click: () => this.edit(params.row.id) },
}, },
"编辑" "编辑"
), ),
...@@ -227,14 +179,14 @@ export default { ...@@ -227,14 +179,14 @@ export default {
"op", "op",
{ {
attrs: { oprate: "delete" }, attrs: { oprate: "delete" },
on: { click: () => this.remove(params.row.id) } on: { click: () => this.remove(params.row.id) },
}, },
"删除" "删除"
) ),
]); ]);
} },
} },
] ],
}; };
}, },
created() {}, created() {},
...@@ -290,9 +242,9 @@ export default { ...@@ -290,9 +242,9 @@ export default {
this.deletelModal = true; this.deletelModal = true;
this.curId = id; this.curId = id;
}, },
removeOk(){ removeOk() {
let id = this.curId; let id = this.curId;
Api.delete(id).then(r => { Api.delete(id).then((r) => {
if (r.success) { if (r.success) {
this.$refs.grid.load(); this.$refs.grid.load();
this.$Message.success("删除成功"); this.$Message.success("删除成功");
...@@ -325,10 +277,10 @@ export default { ...@@ -325,10 +277,10 @@ export default {
type:'类型(工艺案例还是工艺提醒)', type:'类型(工艺案例还是工艺提醒)',
} }
*/ */
let vkey = "process_case" + "." + key; let vkey = "remind" + "." + key;
return this.$t(vkey) || key; return this.$t(vkey) || key;
} },
} },
}; };
</script> </script>
<style lang="less"> <style lang="less">
......
...@@ -50,11 +50,12 @@ export default { ...@@ -50,11 +50,12 @@ export default {
submitShow: true, //送审按钮显隐 submitShow: true, //送审按钮显隐
checked: true, //送审选择框 checked: true, //送审选择框
entity: { entity: {
creatorUserId: this.$store.state.userInfo.userId,
creator: this.$store.state.userInfo.userName,
routingHeaderId: this.eid, //工艺规程id routingHeaderId: this.eid, //工艺规程id
type: 2, type: 2,
filePath: "", //文件路径 filePath: "", //文件路径
filePaths: "", //多个文件路径 filePaths: "", //多个文件路径
creator: this.$store.state.userInfo.userId,
}, },
rules: { rules: {
name: [{ required: true, message: "必填", trigger: "blur" }], name: [{ required: true, message: "必填", trigger: "blur" }],
...@@ -68,7 +69,7 @@ export default { ...@@ -68,7 +69,7 @@ export default {
}; };
}, },
props: { props: {
eid: Number, eid: String,
}, },
mounted() { mounted() {
this.parms.eid = this.$u.guid(); this.parms.eid = this.$u.guid();
...@@ -79,17 +80,11 @@ export default { ...@@ -79,17 +80,11 @@ export default {
this.$refs.form.validate((v) => { this.$refs.form.validate((v) => {
if (v) { if (v) {
this.disabled = true; this.disabled = true;
this.entity.filePaths = "";
if (this.$refs.refFile.nameList.length > 0) { if (this.$refs.refFile.nameList.length > 0) {
let nameList = this.$refs.refFile.nameList; this.entity.filePaths = this.parms.eid;
let names = []; } else {
nameList.forEach((e) => { this.entity.filePath = "";
names.push(e.fileName); this.entity.filePaths = "";
});
this.entity.filePaths = JSON.stringify(names)
.replace("[", "")
.replace("]", "")
.replace(/\"/g, ""); //附件本地库暂存文件名称
} }
Api.create(this.entity) Api.create(this.entity)
.then((r) => { .then((r) => {
......
import Api from '@/plugins/request' import Api from '@/plugins/request'
export default { export default {
index: `${technologyUrl}processcase/paged`, index:`${technologyUrl}processcase/paged`,
paged(params) { paged(params){
return Api.post(`${technologyUrl}processcase/paged`, params); return Api.post(`${technologyUrl}processcase/paged`,params);
}, },
create(params) { get(params){
return Api.post(`${technologyUrl}processcase/create`, params); return Api.get(`${technologyUrl}processcase/get`,params);
}, },
} create(params){
return Api.post(`${technologyUrl}processcase/create`,params);
},
update(params){
return Api.post(`${technologyUrl}processcase/update`,params);
},
delete(id) {
return Api.delete(`${technologyUrl}processcase/delete`,{params:{id:id}});
},
deletes(params) {
return Api.post(`${technologyUrl}processcase/batchdelete`,params);
}
}
\ No newline at end of file
<template>
<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>
</Row>
</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");
},
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);
}
},
},
};
</script>
\ No newline at end of file
<template>
<Form ref="form" :model="entity" :rules="rules" :label-width="90">
<Row>
<Col :span="12">
<FormItem :label="l('title')" prop="title" style="width:95%">
<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')">
<!-- <files ref="refFile" :parms="parms" files /> -->
<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>
<FormItem>
<Button type="primary" @click="handleSubmit" :disabled="disabled">保存</Button>
<Button @click="handleClose" class="ml20">取消</Button>
</FormItem>
</Form>
</template>
<script>
import Api from "./api";
export default {
name: "Edit",
data() {
return {
disabled: false,
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() {
this.$refs.form.validate((v) => {
if (v) {
this.disabled = true;
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) => {
this.disabled = false;
if (r.success) {
this.$Message.success("保存成功");
this.$emit("on-ok");
} else {
this.$Message.error("保存失败");
}
})
.catch((err) => {
this.disabled = false;
this.$Message.error("保存失败");
console.warn(err);
});
}
});
},
handleClose() {
this.$emit("on-close");
},
l(key) {
key = "remind" + "." + key;
return this.$t(key);
},
},
watch: {
eid(v) {
if (v != 0) {
this.load(v);
}
},
},
};
</script>
\ No newline at end of file
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<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>
...@@ -59,6 +59,16 @@ export default { ...@@ -59,6 +59,16 @@ export default {
title: this.l("filePath"), title: this.l("filePath"),
align: "left", align: "left",
easy: true, easy: true,
render: (h, params) => {
return h(
"op",
{
attrs: { oprate: "detail" },
on: { click: () => this.view(params.row.id) },
},
"查看"
);
},
}, },
{ {
key: "status", key: "status",
...@@ -67,6 +77,40 @@ export default { ...@@ -67,6 +77,40 @@ export default {
easy: true, easy: true,
code: "process.status", 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) },
},
"删除"
),
]);
},
},
], ],
}; };
}, },
...@@ -84,6 +128,27 @@ export default { ...@@ -84,6 +128,27 @@ export default {
this.detail = () => import("./add"); this.detail = () => import("./add");
this.modal = true; 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() { ok() {
this.$refs.grid.load(); this.$refs.grid.load();
this.modal = false; this.modal = false;
......
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