소스 검색

完成商品羊

linan 4 년 전
부모
커밋
c5cce5455d

+ 9 - 1
src/api/breed.js

@@ -72,4 +72,12 @@ export const reqShiftFieldList = (data) => ajax("post", "/farm-huyang/transfer/l
 
 export const reqAddOrUpdateShiftField = (data) => ajax("post", "/farm-huyang/transfer/addOrUpdate", data)
 
-export const reqDelShiftField = (id) => ajax("post", "/farm-huyang/transfer/delete", {id})
+export const reqDelShiftField = (id) => ajax("post", "/farm-huyang/transfer/delete", {id})
+
+
+/* 商品羊档案 CommoditySheepFile reqAddOrUpdateCommoditySheepFile */
+export const reqCommoditySheepFileList = (data) => ajax("post", "/farm-huyang/commercial/list", data)
+
+export const reqAddCommoditySheepFile = (data) => ajax("post", "/farm-huyang/commercial/add", data)
+
+export const reqDelCommoditySheepFile = (id) => ajax("post", "/farm-huyang/commercial/delete", {id})

+ 4 - 0
src/api/cultivateSeed.js

@@ -8,3 +8,7 @@ export const reqGradeAssessList = (data) => ajax("post", "/farm-huyang/rank/list
 /* 系谱信息 ClanInfo */
 export const reqClanInfo = (data) => ajax("post", "/farm-huyang/sheep/genealogy", data)
 
+
+/* 虚拟配种 VirtualMating */
+export const reqVirtualMatingList = (data) => ajax("post", "/farm-huyang/sheep/genealogy", data)
+

+ 1 - 1
src/router/index.js

@@ -33,7 +33,7 @@ const routes = [
 		path: '*',
 		name: '*',
 		component: Login
-	},
+	}
 ]
 
 const router = new VueRouter({

+ 6 - 0
src/router/routes.js

@@ -7,6 +7,7 @@ import workerInfo from '@/views/fileInfo/workerInfo.vue'
 
 /* 繁殖管理 */
 import seedSheepFile from '@/views/breed/seedSheepFile.vue'
+import commoditySheepFile from '@/views/breed/commoditySheepFile.vue'
 import collectSeedLog from '@/views/breed/collectSeedLog.vue'
 import matingSuccLog from '@/views/breed/matingSuccLog.vue'
 import matingLog from '@/views/breed/matingLog.vue'
@@ -91,6 +92,11 @@ export default [
 				component: seedSheepFile
 			},
 			{
+				path: 'commoditySheepFile',
+				name: 'commoditySheepFile',
+				component: commoditySheepFile
+			},
+			{
 				path: 'collectSeedLog',
 				name: 'collectSeedLog',
 				component: collectSeedLog

+ 1 - 1
src/store/publicType.js

@@ -15,7 +15,7 @@ const seedSheedLevel = [
 // 种母羊状态
 const seedSheedStatus = [
     { label: "后备", value: 1 },
-    { label: "采精", value: 2 },
+    // { label: "采精", value: 2 },
     { label: "查情", value: 3 },
     { label: "配种", value: 4 },
     { label: "妊检", value: 5 },

+ 5 - 0
src/views/Home/mencCofig.js

@@ -40,6 +40,11 @@ export const menuData = [
                 routerName: "seedSheepFile"
             },
             {
+                optionName: '商品羊档案',
+                index: '1-100',
+                routerName: "commoditySheepFile"
+            },
+            {
                 optionName: '采精记录',
                 index: '1-2',
                 routerName: "collectSeedLog"

+ 7 - 0
src/views/Login/Login.vue

@@ -56,8 +56,15 @@ export default {
     methods: {
         /* 登录按钮 */
         onSignIn() {
+            const loading = this.$loading({
+                lock: true,
+                text: "登录中...",
+                spinner: "el-icon-loading",
+                background: "rgba(0, 0, 0, 0.7)"
+            });
             reqLogin(this.form)
                 .then(res => {
+                    loading.close();
                     localStorage.setItem("token", res.token);
                     this.doOrganizationChoose();
                 })

+ 242 - 0
src/views/breed/commoditySheepFile.vue

@@ -0,0 +1,242 @@
+<template>
+    <!-- commoditySheepFile -->
+    <div class="CommoditySheepFile">
+        <h2 style="margin-bottom: 20px;padding-bottom:7px;border-bottom:2px solid #ddd">商品羊档案</h2>
+        <header id="header">
+            <el-row type="flex" :gutter="20">
+                <el-col :span="4">
+                    <el-input v-model="search" placeholder="请选择"></el-input>
+                </el-col>
+                <el-col :span="4">
+                    <el-button type="primary" @click="getCommoditySheepFileList">查找</el-button>
+                </el-col>
+                <el-col :span="4">
+                    <el-button type="primary" @click="add">新增</el-button>
+                </el-col>
+            </el-row>
+        </header>
+        <section>
+            <article class="table">
+                <el-table :data="tableData" tooltip-effect="dark" style="width: 100%">
+                    <el-table-column prop="id" label="商品羊编码"></el-table-column>
+
+                    <el-table-column prop="fatherId" label="父亲ID"></el-table-column>
+                    <el-table-column prop="motherId" label="母亲ID"></el-table-column>
+                    <el-table-column prop="birthWeight" label="出生重量"></el-table-column>
+                    <el-table-column label="出生时间">
+                        <template v-slot="scope">
+                            <span>{{ scope.row['birthday'].substr(0,10) }}</span>
+                        </template>
+                    </el-table-column>
+                    <el-table-column prop="status" label="状态">
+                        <template v-slot="scope">
+                            <div v-for="item in $store.state['prductSheedStatus']" :key="item.value">
+                                <span v-if="item.value == scope.row['status']">{{ item.label }}</span>
+                            </div>
+                        </template>
+                    </el-table-column>
+
+                    <!-- <el-table-column label="种母羊等级">
+                        <template v-slot="scope">
+                            <div v-for="item in $store.state['seedSheedLevel']" :key="item.value">
+                                <span v-if="item.value == scope.row['level']">{{ item.label }}</span>
+                            </div>
+                        </template>
+                    </el-table-column>
+
+                    <el-table-column label="查情时间">
+                        <template v-slot="scope">
+                            <span>{{ scope.row['opeTime'].substr(0,10) }}</span>
+                        </template>
+                    </el-table-column>
+
+                    <el-table-column label="是否发情">
+                        <template v-slot="scope">
+                            <div v-for="item in $store.state['estrusStatus']" :key="item.value">
+                                <span v-if="item.value == scope.row['ifEstrus']">{{ item.label }}</span>
+                            </div>
+                        </template>
+                    </el-table-column>
+
+                    <el-table-column label="操作人">
+                        <template v-slot="scope">
+                            <div v-for="item in $store.state['workerList']" :key="item.value">
+                                <span
+                                    v-if="item.id == scope.row['opeUser']"
+                                >{{ `${item.name}(${item.position})` }}</span>
+                            </div>
+                        </template>
+                    </el-table-column> -->
+                    <el-table-column label="操作" width="150">
+                        <template slot-scope="scope">
+                            <el-popconfirm title="是否删除此设备的信息?" @onConfirm="del(scope.row)">
+                                <el-button slot="reference" type="text" size="small">删除</el-button>
+                            </el-popconfirm>
+                        </template>
+                    </el-table-column>
+                </el-table>
+
+                <el-row type="flex" justify="end">
+                    <el-col :span="8" class="pagination">
+                        <el-pagination
+                            @current-change="pageChange"
+                            background
+                            layout="prev, pager, next"
+                            :page-count="Number(totalPages)"
+                        ></el-pagination>
+                    </el-col>
+                </el-row>
+            </article>
+        </section>
+
+        <el-dialog title="新增" :visible.sync="isShow" width="40%">
+            <el-row type="flex">
+                <el-col :span="20">
+                    <el-form ref="addCommoditySheepFile" :model="formData" :rules="rules" label-width="140px">
+                        <el-form-item label="商品羊编码">
+                            <el-input v-model="formData.id"></el-input>
+                        </el-form-item>
+                        <el-form-item label="母亲ID">
+                            <el-input v-model="formData.motherId"></el-input>
+                        </el-form-item>
+                        <el-form-item label="出生重量">
+                            <el-input v-model="formData.birthWeight"></el-input>
+                        </el-form-item>
+                        <el-form-item label="出生时间">
+                            <el-date-picker
+                                v-model="formData.birthday"
+                                type="date"
+                                value-format="yyyy-MM-dd HH:mm:ss"
+                                placeholder="选择日期"
+                            ></el-date-picker>
+                        </el-form-item>
+                        <el-form-item label="状态">
+                            <el-select v-model="formData.status" placeholder="请选择">
+                                <el-option
+                                    v-for="item in $store.state['prductSheedStatus']"
+                                    :key="item.value"
+                                    :label="item.label"
+                                    :value="item.value"
+                                ></el-option>
+                            </el-select>
+                        </el-form-item>
+
+                        <el-form-item>
+                            <el-button @click="isShow=false">取 消</el-button>
+                            <el-button type="primary" @click="submitForm('addCommoditySheepFile')">保 存</el-button>
+                        </el-form-item>
+                    </el-form>
+                </el-col>
+            </el-row>
+        </el-dialog>
+    </div>
+</template>
+
+<script>
+import {
+    reqCommoditySheepFileList,
+    reqAddCommoditySheepFile,
+    reqDelCommoditySheepFile
+} from "@/api/breed.js";
+
+const pageSize = 10;
+const rules = {};
+
+export default {
+    name: "CommoditySheepFile",
+    data() {
+        return {
+            search: "",
+            pageNum: 1,
+            tableData: [],
+            totalPages: 0,
+            isShow: false,
+            formData: {
+                id: "5300",
+                motherId: "1003",
+                birthWeight: "3.3",
+                birthday: this.$moment().format("YYYY-MM-DD HH:mm:ss"),
+                status: this.$store.state["prductSheedStatus"][0].value
+            },
+            rules
+        };
+    },
+    created() {
+        // 商品羊档案列表
+        this.getCommoditySheepFileList();
+    },
+    methods: {
+        submitForm(formName) {
+            this.$refs[formName].validate(valid => {
+                if (valid) {
+                    reqAddCommoditySheepFile(this.formData)
+                        .then(res => {
+                            // 商品羊档案列表
+                            this.getCommoditySheepFileList();
+                            this.$message.success("成功!");
+                            // this.isShow = false
+                        })
+                        .catch(err => {
+                            console.log(err);
+                            this.$message.error("失败!");
+                        });
+                } else {
+                    return false;
+                }
+            });
+        },
+        // 商品羊档案列表
+        getCommoditySheepFileList() {
+            reqCommoditySheepFileList({
+                searchStr: this.search,
+                pageSize,
+                pageNum: this.pageNum
+            })
+                .then(res => {
+                    this.tableData = res.content;
+                    this.totalPages = res.totalPages;
+                })
+                .catch(err => {
+                    console.log(err);
+                });
+        },
+        add() {
+            this.isShow = true;
+        },
+        del(row) {
+            reqDelCommoditySheepFile(row.id)
+                .then(res => {
+                    // 商品羊档案列表
+                    this.getCommoditySheepFileList();
+                    if (res.code == "success") {
+                        this.$message.success(res.msg);
+                    }
+                    if (res.errCode == "delete failed") {
+                        this.$message.error(res.errMsg);
+                    }
+                })
+                .catch(err => {
+                    console.log(err);
+                    this.$message.error("删除失败!");
+                });
+        },
+        pageChange(p) {
+            console.log(p);
+            this.pageNum = p;
+            // 商品羊档案列表
+            this.getCommoditySheepFileList();
+        }
+    }
+};
+</script>
+
+<style lang="scss" scoped>
+#header {
+    margin-bottom: 15px;
+}
+.table {
+    .pagination {
+        margin-top: 20px;
+    }
+}
+</style>

+ 9 - 2
src/views/breed/pregnancyTestLog.vue

@@ -130,7 +130,14 @@
                         </el-form-item>
 
                         <el-form-item label="当前位置">
-                            <el-input v-model="formData.position"></el-input>
+                            <el-select v-model="formData.position" filterable placeholder="请选择">
+                                <el-option
+                                    v-for="item in $store.state['areaList']"
+                                    :key="item.id"
+                                    :label="item.name"
+                                    :value="item.name"
+                                ></el-option>
+                            </el-select>
                         </el-form-item>
 
                         <el-form-item label="怀胎个数">
@@ -176,7 +183,7 @@ export default {
                 opeTime: this.$moment().format("YYYY-MM-DD HH:mm:ss"),
                 status: this.$store.state['fetationStatus'][0].value,
                 opeUser: this.$store.state['workerList'][0].id,
-                position: "配怀2舍",
+                position: null,
                 number: '2',
                 remark: '这只羊怀孕了',
             },

+ 1 - 1
src/views/cultivateSeed/gradeAssess.vue

@@ -46,10 +46,10 @@
                     <el-table-column label="操作" width="150">
                         <template v-slot="scope">
                             <el-button
+                                v-if="gender==0"
                                 @click="goVirtualMating(scope.row)"
                                 type="text"
                                 size="small"
-                                v-if="gender==0"
                             >虚拟配种</el-button>
                             <el-button @click="goClan(scope.row)" type="text" size="small">查看系谱</el-button>
                         </template>

+ 4 - 0
src/views/cultivateSeed/sub/clan.vue

@@ -217,6 +217,10 @@ export default {
         };
     },
     created() {
+        // if (!this.$route.query.id) {
+        //     this.$router.replace("/home/gradeAssess");
+        //     this.message.warning("静止非法跳转链接!");
+        // }
         // 系谱信息
         this.getClanInfo();
     },

+ 45 - 13
src/views/cultivateSeed/sub/virtualMating.vue

@@ -25,9 +25,16 @@
                             <h2 style="color: #333">{{ scope.row.name }}</h2>
                         </template>
                     </el-table-column>
-                    <el-table-column prop="amount1" label="公羊编号"></el-table-column>
-                    <el-table-column prop="amount2" label="公羊级别"></el-table-column>
-                    <el-table-column prop="amount3" label="特性一"></el-table-column>
+                    <el-table-column prop="amount1" label="公羊编号" align="center"></el-table-column>
+                    <el-table-column prop="amount2" label="公羊级别" align="center"></el-table-column>
+                    <el-table-column prop="amount3" label="特性一" align="center"></el-table-column>
+                    <el-table-column prop="amount3" label="特性二" align="center"></el-table-column>
+                    <el-table-column prop="amount3" label="特性三" align="center"></el-table-column>
+                    <el-table-column prop="amount3" label="评分" align="center" sortable>
+                        <template v-slot="scope">
+                            <span style="color:#409EFF">{{ scope.row['amount3'] }}</span>
+                        </template>
+                    </el-table-column>
                 </el-table>
 
                 <el-row type="flex" justify="end" style="margin-top: 30px;">
@@ -36,7 +43,7 @@
                             @current-change="pageChange"
                             background
                             layout="prev, pager, next"
-                            :page-count="10"
+                            :page-count="totalPages"
                         ></el-pagination>
                     </el-col>
                 </el-row>
@@ -46,7 +53,9 @@
 </template>
 
 <script>
-const pageSize = 10;
+import { reqVirtualMatingList } from "@/api/cultivateSeed.js";
+
+const pageSize = 15;
 const tableData = [
     {
         id: "12987121",
@@ -160,16 +169,38 @@ export default {
         return {
             value: "",
             multipleSelection: [],
-            page: 1,
-            tableData
+            pageNum: 1,
+            tableData,
+            totalPages: 1
         };
     },
-    created() {},
+    created() {
+        // if(!this.$route.query.id) {
+        //     this.$router.replace('/home/gradeAssess')
+        //     this.message.warning("静止非法跳转链接!");
+        // }
+        this.getVirtualMatingList();
+    },
     methods: {
+        // 虚拟配种列表
+        getVirtualMatingList() {
+            reqVirtualMatingList({
+                searchStr: this.search,
+                pageSize,
+                pageNum: this.pageNum
+            })
+                .then(res => {
+                    // this.tableData = res.content;
+                    this.totalPages = res.totalPages;
+                })
+                .catch(err => {
+                    console.log(err);
+                });
+        },
         arraySpanMethod({ row, column, rowIndex, columnIndex }) {
-            if (rowIndex % 12 === 0) {
+            if (rowIndex % pageSize === 0) {
                 if (columnIndex === 0) {
-                    return [1, 12];
+                    return [1, pageSize];
                 } else if (columnIndex === 1) {
                     return [0, 1];
                 }
@@ -178,9 +209,9 @@ export default {
 
         objectSpanMethod({ row, column, rowIndex, columnIndex }) {
             if (columnIndex === 0 || columnIndex === 1) {
-                if (rowIndex % 12 === 0) {
+                if (rowIndex % pageSize === 0) {
                     return {
-                        rowspan: 12,
+                        rowspan: pageSize,
                         colspan: 1
                     };
                 } else {
@@ -192,7 +223,8 @@ export default {
             }
         },
         pageChange(p) {
-            console.log(p);
+            this.pageNum = p
+            this.getVirtualMatingList();
         }
     }
 };

+ 2 - 2
src/views/material/basicsInfo.vue

@@ -235,9 +235,9 @@ export default {
             // 有id是update 没id是add
             this.formData = {
                 name: "",
-                periodOfValidity: null,
+                periodOfValidity: 365,
                 unit: this.$store.state["periodOfValidityUnit"][0].value,
-                safeThreshold: null,
+                safeThreshold: 150,
                 specifications: "盒",
                 usageIntro: "",
                 factory: "xx药厂",