|
@@ -1,17 +1,172 @@
|
|
|
<!--
|
|
|
* @Author: your name
|
|
|
* @Date: 2022-01-08 10:36:43
|
|
|
- * @LastEditTime: 2022-01-08 10:36:43
|
|
|
+ * @LastEditTime: 2022-01-11 14:43:30
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
- * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
+ * @Description: 基础资料 - 栋舍管理
|
|
|
* @FilePath: \goldenPig\src\views\basic-data\house-admin\HouseAdmin.vue
|
|
|
-->
|
|
|
<template>
|
|
|
- <div>
|
|
|
- 栋舍管理
|
|
|
+ <div class="house-admin">
|
|
|
+ <!-- <search-cpn
|
|
|
+ v-bind="searchConfig"
|
|
|
+ @handleSearch="handleSearchEvent"
|
|
|
+ @clearEvent="handleClearEvent"
|
|
|
+ >
|
|
|
+ </search-cpn> -->
|
|
|
+
|
|
|
+ <table-cpn
|
|
|
+ v-bind="tableConfig"
|
|
|
+ @handleAddOrEdit="handleAddOrEditEvent"
|
|
|
+ :searchForm="searchForm"
|
|
|
+ >
|
|
|
+ <!-- 状态 -->
|
|
|
+ <template #tempAnomaly="scope">
|
|
|
+ {{ statuses[scope.row.tempAnomaly] }}
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <!-- 阶段 -->
|
|
|
+ <template #stage="scope">
|
|
|
+ {{ stages[scope.row.stage - 1] }}
|
|
|
+ </template>
|
|
|
+ </table-cpn>
|
|
|
+
|
|
|
+ <modal-cpn ref="modal" v-bind="modalConfig" :otherParams="modalForm2">
|
|
|
+ <!-- 位置 -->
|
|
|
+ <template #parentId="scope">
|
|
|
+ <el-cascader
|
|
|
+ :options="options"
|
|
|
+ :value="location"
|
|
|
+ @change="submitLocation"
|
|
|
+ :placeholder="scope.item.placeholder"
|
|
|
+ style="width: 100%"
|
|
|
+ >
|
|
|
+ </el-cascader>
|
|
|
+ </template>
|
|
|
+ </modal-cpn>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
-export default {};
|
|
|
+// 搜索
|
|
|
+// import SearchCpn from "@/components/search-cpn";
|
|
|
+// import { formItemProp } from "./config/search.config";
|
|
|
+
|
|
|
+// 表格
|
|
|
+import TableCpn from "@/components/table-cpn";
|
|
|
+import { propList } from "./config/table.config";
|
|
|
+
|
|
|
+// 新增 or 编辑
|
|
|
+import ModalCpn from "@/components/modal-cpn";
|
|
|
+import { modalItemProp } from "./config/modal.config";
|
|
|
+
|
|
|
+import {
|
|
|
+ basePigpenList,
|
|
|
+ basePigpenAdd,
|
|
|
+ basePigpenEdit,
|
|
|
+ basePigpenDel,
|
|
|
+} from "@/utils/chenApi.js";
|
|
|
+
|
|
|
+export default {
|
|
|
+ components: {
|
|
|
+ // SearchCpn,
|
|
|
+ TableCpn,
|
|
|
+ ModalCpn,
|
|
|
+ },
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 搜索
|
|
|
+ searchConfig: {},
|
|
|
+ searchForm1: {
|
|
|
+ farmName: "",
|
|
|
+ type: "",
|
|
|
+ },
|
|
|
+ searchForm2: {
|
|
|
+ location: [],
|
|
|
+ },
|
|
|
+ searchForm: {},
|
|
|
+ // 表格
|
|
|
+ tableConfig: {},
|
|
|
+ tableDataList: [],
|
|
|
+ stages: ["保育", "配怀", "分娩"],
|
|
|
+ statuses: ["异常", "正常"],
|
|
|
+ // 新增 or 编辑
|
|
|
+ modalConfig: {},
|
|
|
+ modalForm1: {
|
|
|
+ farmName: "",
|
|
|
+ type: "",
|
|
|
+ },
|
|
|
+ options: [],
|
|
|
+ location: [],
|
|
|
+ modalForm2: {
|
|
|
+ parentId: "",
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ created() {
|
|
|
+ // this.searchConfig = { formItemProp, searchForm: this.searchForm1 };
|
|
|
+ this.tableConfig = {
|
|
|
+ propList,
|
|
|
+ permission: "archivesAdmin",
|
|
|
+ requests: {
|
|
|
+ list: basePigpenList,
|
|
|
+ del: basePigpenDel,
|
|
|
+ },
|
|
|
+ tableStyle: {
|
|
|
+ height: 700,
|
|
|
+ footer: false,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ this.modalConfig = {
|
|
|
+ modalItemProp,
|
|
|
+ modalForm: this.modalForm1,
|
|
|
+ requests: {
|
|
|
+ add: basePigpenAdd,
|
|
|
+ edit: basePigpenEdit,
|
|
|
+ },
|
|
|
+ };
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 查询按钮 - 获取参数
|
|
|
+ handleSearchEvent(params) {
|
|
|
+ this.searchForm = {
|
|
|
+ ...params,
|
|
|
+ ...this.searchForm2,
|
|
|
+ };
|
|
|
+ },
|
|
|
+ // 清空数据
|
|
|
+ handleClearEvent() {
|
|
|
+ this.searchForm2.location = [];
|
|
|
+ },
|
|
|
+ // 地点
|
|
|
+ getlocation(val) {
|
|
|
+ console.log(val);
|
|
|
+ },
|
|
|
+ // 模态框的 位置
|
|
|
+ submitLocation(val) {
|
|
|
+ this.modalForm2.location = val.join();
|
|
|
+ },
|
|
|
+ // 新增 or 编辑事件
|
|
|
+ handleAddOrEditEvent(row) {
|
|
|
+ this.$refs["modal"].init(row);
|
|
|
+ if (row.id) {
|
|
|
+ this.location = row.location.split(",");
|
|
|
+ this.modalForm2.location = row.location;
|
|
|
+ } else {
|
|
|
+ this.location = [];
|
|
|
+ this.modalForm2.location = "";
|
|
|
+ }
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ "searchForm2.location": {
|
|
|
+ handler(newVal) {
|
|
|
+ if (typeof newVal === "object") {
|
|
|
+ this.searchForm2.location = newVal.join();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ deep: true,
|
|
|
+ },
|
|
|
+ },
|
|
|
+};
|
|
|
</script>
|
|
|
<style scoped></style>
|