ysy 2 år sedan
förälder
incheckning
a9bbc36ee8

+ 10 - 0
src/api/login/index.js

@@ -33,3 +33,13 @@ export async function getCaptcha () {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
+
+/* 根据编码管理 */
+export async function getCode(code) {
+  const res = await request.get(`/main/codemanage/getCode/${code}`);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+}

+ 5 - 2
src/enum/dict.js

@@ -30,7 +30,9 @@ export default {
   产能计划状态: 'capacity_status',
   分类层级: 'bom_level',
   周转车材质: 'turnover_material',
-  证件类型: 'id_type'
+  证件类型: 'id_type',
+  台账状态: 'ledger'
+
 };
 
 export const numberList = [
@@ -44,5 +46,6 @@ export const numberList = [
   'inspection_scheme',
   'angle',
   'id_type',
-  'rule_status'
+  'rule_status',
+   'ledger'
 ];

+ 117 - 122
src/views/ledgerAssets/dryArea/components/dryArea-list.vue

@@ -1,144 +1,139 @@
 <template>
   <div>
-    <dryArea-search 
-      @search="reload"
-      ref="searchRef"
-    >
+    <dryArea-search @search="reload" ref="searchRef">
     </dryArea-search>
     <!-- 数据表格 -->
-    <ele-pro-table
-      ref="table"
-      :columns="columns"
-      :datasource="datasource"
-      height="calc(100vh - 265px)"
-      full-height="calc(100vh - 116px)"
-      tool-class="ele-toolbar-form"
-      cache-key="systemOrgUserTable"
-    >
+    <ele-pro-table ref="table" :columns="columns" :datasource="datasource" height="calc(100vh - 265px)"
+      full-height="calc(100vh - 116px)" tool-class="ele-toolbar-form" cache-key="systemOrgUserTable">
       <!-- 表头工具栏 -->
       <template v-slot:toolbar>
-        <el-button
-          size="small"
-          type="primary"
-          icon="el-icon-download"
-          class="ele-btn-icon"
-          @click="btnExport"
-        >
-          导出
+        <el-button size="small" type="primary" icon="el-icon-plus" class="ele-btn-icon" @click="openEdit()">
+          新增
         </el-button>
       </template>
       <!-- 编码列 -->
-      <template v-slot:code="{ row }">
-        <el-link @click="details(row)" type="primary" :underline="false">
-          {{ row.code }}
-        </el-link>
+      <template v-slot:status="{ row }">
+        <!-- 0空闲1占用 -->
+        {{ row.status == 0 ? '空闲' : row.status == 1 ? '占用' : '' }}
       </template>
     </ele-pro-table>
+
+    <user-edit :visible.sync="showEdit" :data="current" @done="reload" ref="userEdit" />
+
   </div>
 </template>
 
 <script>
-  import dryAreaSearch from './dryArea-search.vue';
-  import { getBoatList  } from '@/api/ledgerAssets';
-  import dictMixins from '@/mixins/dictMixins';
-  export default {
-    mixins: [dictMixins],
-    components: { dryAreaSearch },
-    props: {
-      // 类别id
-      categoryId: [Number, String],
-      rootId: [Number, String],
+import dryAreaSearch from './dryArea-search.vue';
+import { getList } from '@/api/ledgerAssets/dryArea';
+import dictMixins from '@/mixins/dictMixins';
+import UserEdit from './user-edit.vue';
+
+export default {
+  mixins: [dictMixins],
+  components: { dryAreaSearch, UserEdit },
+  props: {
+    // 类别id
+    categoryId: [Number, String],
+    rootId: [Number, String],
+  },
+  data() {
+    return {
+
+
+      // 当前编辑数据
+      current: null,
+      // 是否显示编辑弹窗
+      showEdit: false,
+
+
+      // 表格列配置
+      columns: [
+        {
+          columnKey: 'index',
+          type: 'index',
+          label: '序号',
+          width: 55,
+          align: 'center',
+          showOverflowTooltip: true,
+          fixed: 'left'
+        },
+        {
+          prop: 'code',
+          label: '干燥区编码',
+          showOverflowTooltip: true,
+          minWidth: 110,
+
+        },
+        {
+          prop: 'name',
+          label: '干燥区名称',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+
+        {
+          prop: 'specification',
+          label: '规格',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+
+
+        {
+          prop: 'region',
+          label: '位置',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+        {
+          prop: 'status',
+          label: '状态',
+          showOverflowTooltip: true,
+          minWidth: 110,
+          slot: 'status',
+        },
+
+
+
+      ]
+    };
+  },
+  created() {
+    this.requestDict('角度');
+  },
+  methods: {
+    /* 表格数据源 */
+    datasource({ page, limit, where }) {
+      return getList({
+        ...where,
+        pageNum: page,
+        size: limit,
+        categoryLevelId: this.categoryId,
+        rootCategoryLevelId: this.rootId
+      });
     },
-    data() {
-      return {
-        // 表格列配置
-        columns: [
-          {
-            columnKey: 'index',
-            type: 'index',
-            label: '序号',
-            width: 55,
-            align: 'center',
-            showOverflowTooltip: true,
-            fixed: 'left'
-          },
-          {
-            prop: 'code',
-            label: '干燥区编码',
-            showOverflowTooltip: true,
-            minWidth: 110,
-            slot: 'code',
-          },
-          {
-            prop: 'name',
-            label: '干燥区名称',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-   
-          {
-            prop: 'specification',
-            label: '规格',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
- 
- 
-          {
-            prop: 'region',
-            label: '位置',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-          {
-            prop: 'status',
-            label: '状态',
-            showOverflowTooltip: true,
-            minWidth: 110
-          },
-       
-     
-        
-        ]
-      };
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ pageNum: 1, where: where });
     },
-    created () {
-       this.requestDict('角度');
+
+    /* 打开编辑弹窗 */
+    openEdit(row) {
+      this.current = row;
+      this.showEdit = true;
+      this.$refs.userEdit.$refs.form &&
+        this.$refs.userEdit.$refs.form.clearValidate();
     },
-    methods: {
-      /* 表格数据源 */
-      datasource({ page, limit, where, order }) {
-        return getBoatList({
-          ...where,
-          ...order,
-          pageNum: page,
-          size: limit,
-          categoryLevelId: this.categoryId,
-          rootCategoryLevelId: this.rootId
-        });
-      },
-      /* 刷新表格 */
-      reload(where) {
-        this.$refs.table.reload({ pageNum: 1, where: where });
-      },
-
-      // 跳转到详情页
-      details ({ id }) {
-        this.$router.push({
-          path: '/ledgerAssets/boat/detail',
-          query: {
-            id
-          }
-        })
-      },
 
 
-    },
-    watch: {
-      // 监听类别id变化
-      categoryId() {
-        this.reload();
-      }
+
+  },
+  watch: {
+    // 监听类别id变化
+    categoryId() {
+      this.reload();
     }
-  };
+  }
+};
 </script>

+ 188 - 0
src/views/ledgerAssets/dryArea/components/user-edit.vue

@@ -0,0 +1,188 @@
+<!-- 用户编辑弹窗 -->
+<template>
+  <ele-modal width="60%" :visible="visible" :append-to-body="true" :close-on-click-modal="true"
+    custom-class="ele-dialog-form" :title="isUpdate ? '修改干燥区' : '新增干燥区'" @update:visible="updateVisible">
+    <el-form ref="form" :model="form" :rules="rules" label-width="100px">
+      <el-row>
+        <el-col :span="12">
+          <el-form-item label="干燥区编码:" prop="code">
+            <el-input clearable :disabled="true" v-model="form.code" placeholder="干燥区编码" />
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="干燥区名称:" prop="name">
+            <el-input clearable v-model="form.name" placeholder="请输入干燥区名称" />
+          </el-form-item>
+        </el-col>
+
+        <el-col :span="12">
+          <el-form-item label="分类:" prop="categoryLevelName">
+            <el-input v-model="form.categoryLevelName" @click.native="openCategory" readonly />
+          </el-form-item>
+        </el-col>
+
+
+
+
+        <el-col :span="12">
+          <el-form-item label="状态:" prop="status">
+            <DictSelection dictName="台账状态" clearable v-model="form.status">
+            </DictSelection>
+          </el-form-item>
+        </el-col>
+
+
+        <el-col :span="12">
+          <el-form-item label="规格:" prop="specification">
+            <el-input clearable v-model="form.specification" placeholder="请输入规格" />
+          </el-form-item>
+        </el-col>
+
+
+        <el-col :span="24">
+          <el-form-item label="位置:" prop="region">
+            <el-input clearable v-model="form.region" placeholder="请输入位置" />
+          </el-form-item>
+        </el-col>
+
+
+      </el-row>
+    </el-form>
+    <template v-slot:footer>
+      <el-button @click="updateVisible(false)">取消</el-button>
+      <el-button type="primary" :loading="loading" @click="save">
+        保存
+      </el-button>
+    </template>
+
+
+    <CategoryDialog ref="categoryRefs" @chooseCategory="changeCategory"></CategoryDialog>
+  </ele-modal>
+</template>
+
+<script>
+
+
+import { addUsers, putUsers } from '@/api/system/user';
+import CategoryDialog from '@/views/material/manage/components/CategoryDialog.vue'
+
+
+export default {
+  components: {
+    CategoryDialog
+  },
+  props: {
+    // 弹窗是否打开
+    visible: Boolean,
+    // 修改回显的数据
+    data: Object
+  },
+  data() {
+    const defaultForm = {
+      code: '',
+      name: '',
+      categoryLevelName: ''
+    };
+    return {
+      defaultForm,
+      // 表单数据
+      form: { ...defaultForm },
+      // 表单验证规则
+      rules: {
+        loginName: [
+          { required: true, message: '请输入用户账号', trigger: 'blur' }
+        ],
+        roleId: [
+          { required: true, message: '请选择角色', trigger: 'change' }
+        ],
+        loginPwd: [
+          {
+            required: true,
+            pattern: /^[\S]{5,18}$/,
+            message: '密码必须为5-18位非空白字符',
+            trigger: 'blur'
+          }
+        ]
+      },
+      // 提交状态
+      loading: false,
+      // 是否是修改
+      isUpdate: false
+    };
+  },
+  computed: {
+    // 是否开启响应式布局
+    styleResponsive() {
+      return this.$store.state.theme.styleResponsive;
+    }
+  },
+  methods: {
+    /* 保存编辑 */
+    save() {
+      this.$refs.form.validate((valid) => {
+        if (!valid) {
+          return false;
+        }
+        this.loading = true;
+        if (!this.isUpdate) {
+          delete this.form.id;
+        }
+        const data = {
+          ...this.form
+          // roleId: this.form.roleIds.map((d) => {
+          //   return { roleId: d };
+          // })
+        };
+        const saveOrUpdate = this.isUpdate ? putUsers : addUsers;
+        saveOrUpdate(data)
+          .then((msg) => {
+            this.loading = false;
+            this.$message.success(msg);
+            this.updateVisible(false);
+            this.$emit('done');
+          })
+          .catch((e) => {
+            this.loading = false;
+            // this.$message.error(e.message);
+          });
+      });
+    },
+    /* 更新visible */
+    updateVisible(value) {
+      this.$emit('update:visible', value);
+    },
+
+    openCategory() {
+      this.$refs.categoryRefs.open(11, '选择分类')
+    },
+
+
+    changeCategory(row) {
+      this.$set(this.form, 'categoryLevelName', row.name)
+      this.$set(this.form, 'categoryLevelId', row.id)
+    },
+
+
+  },
+  watch: {
+    visible(visible) {
+      if (visible) {
+        if (this.data) {
+          this.$util.assignObject(this.form, {
+            ...this.data,
+            roleId: this.data.roleList.map((d) => d.id),
+            loginPwd: ''
+          });
+          this.isUpdate = true;
+        } else {
+          this.isUpdate = false;
+        }
+      } else {
+        this.$refs.form.clearValidate();
+        this.form = { ...this.defaultForm };
+      }
+    }
+  }
+};
+</script>