12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <template>
- <!-- warn -->
- <div class="Warn">
- <h2 style="margin-bottom: 20px;padding-bottom:7px;border-bottom:2px solid #ddd">消息提醒</h2>
- <formList v-model="list" :title="['消息']" type="textarea" inputWidth="600px"></formList>
- <el-button style="margin-left:610px" type="primary" @click="onSubmit">更新信息</el-button>
- </div>
- </template>
- <script>
- import { reqWarn, reqSetWarn } from "@/api/breed.js";
- export default {
- name: "Warn",
- data() {
- return {
- list: [{ key: "" }]
- };
- },
- created() {
- this.getWarn();
- },
- methods: {
- /*
- 无害化仓库已满请及时清理
- 14587号母羊已到达断奶时间请及时断奶
- 阿莫西林药品已经低于安全库存请补充
-
- */
- onSubmit() {
- let data = [];
- this.list.forEach(item => {
- data.push(item.msg);
- });
- this.$confirm("确定更新信息?").then(() => {
- reqSetWarn({ content: data.join("--") })
- .then(res => {
- console.log(res);
- if (res.errcode) {
- this.$message.error("更新失败!");
- }
- this.$message.success("更新成功!");
- })
- .catch(err => {
- console.log(err);
- this.$message.error("更新失败!");
- });
- });
- },
- getWarn() {
- reqWarn()
- .then(res => {
- console.log(res.conf.content);
- this.list = [];
- res.conf.content.split("--").forEach(item => {
- this.list.push({ msg: item });
- });
- })
- .catch(err => {
- console.error(err);
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .Warn {
- .left {
- width: 400px;
- margin-left: 50px;
- }
- }
- </style>
|