123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <template>
- <!-- waitSlaughter -->
- <div class="WaitSlaughter">
- <h2 style="margin-bottom: 20px;padding-bottom:7px;border-bottom:2px solid #ddd">入栏待宰</h2>
- <formList v-model="list" :title="['待宰信息']" inputWidth="600px" type="textarea"></formList>
- <el-button style="margin-left:510px" type="primary" @click="onSubmit">更新信息</el-button>
- </div>
- </template>
- <script>
- import { reqWaitSlaughter, reqSetWaitSlaughter } from "@/api/butcher.js";
- export default {
- name: "WaitSlaughter",
- data() {
- return {
- id: '-1',
- list: [{ dataList: ""}]
- };
- },
- created() {
- this.getWaitSlaughter();
- },
- methods: {
- onSubmit() {
- let dataList = [];
- this.list.forEach(item => {
- dataList.push(item.dataList);
- });
- this.$confirm("确定更新信息?").then(() => {
- reqSetWaitSlaughter({id: this.id, dataList: dataList.toString()})
- .then(res => {
- if (res.errCode) {
- this.$message.error(res.errMsg);
- } else {
- this.getWaitSlaughter();
- this.$message.success("更新成功!");
- }
- })
- .catch(err => {
- console.log(err);
- this.$message.error("更新失败!");
- });
- });
- },
- getWaitSlaughter() {
- reqWaitSlaughter()
- .then(res => {
- this.id = res.id
- this.list = [];
- res.conf['dataList'].forEach((item, i) => {
- this.list.push({ 'dataList': item });
- });
- })
- .catch(err => {
- console.error(err);
- });
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- .WaitSlaughter {
- .left {
- width: 400px;
- margin-left: 50px;
- }
- }
- </style>
|