戴艳蓉 3 years ago
parent
commit
1591b7dbb7

+ 17 - 0
src/apis/service/sellOut/customer/index.js

@@ -0,0 +1,17 @@
+import http from "@/apis/axios";
+const api = "admin/";
+export default {
+  // 新建
+  add: (data, params) => http(api + "resultcreate", data, "post", params),
+  // 删除
+  delete: (data, params) => http(api + "resultdel", data, "post", params),
+  // 列表
+  list: (data, params) => http(api + "customerlist", data, "post", params),
+  // 详情
+  detail: (data, params) => http(api + "resultselect", data, "post", params),
+  // 更新
+  update: (data, params) => http(api + "resultedit", data, "post", params),
+  // 状态
+  status: (data, params) => http(api + "resultstatu", data, "post", params),
+};
+   

+ 295 - 0
src/views/sellOut/customer/addEdit.vue

@@ -0,0 +1,295 @@
+<template>
+  <el-dialog
+    :title="title"
+    :center="true"
+    align="left"
+    top="5vh"
+    width="700px"
+    @close="closeModel"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    v-loading="loading"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+  >
+    <el-card>
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <el-form
+            :model="ruleForm"
+            status-icon
+            :rules="rulesThis"
+            ref="ruleForm"
+            label-width="110px"
+            class="demo-ruleForm"
+          >
+            <el-form-item
+              label="异常原因"
+              prop="result"
+              v-if="id === 'add' || (isDetail ? true : true)"
+            >
+              <el-input
+                v-model="ruleForm.result"
+                :disabled="isDetail"
+              ></el-input>
+            </el-form-item>
+
+            <el-form-item
+              label="异常备注"
+              prop="result_desc"
+              v-if="id === 'add' || (isDetail ? true : true)"
+            >
+              <el-input
+                :autosize="{ minRows: 4, maxRows: 10 }"
+                type="textarea"
+                v-model="ruleForm.result_desc"
+                :disabled="isDetail"
+              ></el-input>
+            </el-form-item>
+          </el-form>
+        </el-col>
+        <el-col :span="24" style="text-align: right">
+          <el-button type="primary" @click="submitForm" v-if="!isDetail"
+            >保 存
+          </el-button>
+          <el-button @click="showModelThis = false">{{
+            isDetail ? "关 闭" : "取 消"
+          }}</el-button>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+   <script>
+import asyncRequest from "@/apis/service/sellOut/goodsBack";
+import resToken from "@/mixins/resToken";
+import {
+  isnumber,
+  isMobile,
+  validEmail,
+  isAlphanumeric,
+  isChinese,
+  isEmoticon,
+  validAlphabets,
+} from "@/utils/validate";
+export default {
+  name: "goodsBack",
+  props: ["showModel", "id", "isDetail", "sitem"],
+  mixins: [resToken],
+  data() {
+    const validateusername = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("账号不能为空!"));
+      } else {
+        if (value.length < 6 || value.length > 18) {
+          callback(new Error("账号规则为6~18位数字与字母组合!"));
+        } else {
+          if (isnumber(value)) {
+            callback(new Error("账号规则为6~18位数字与字母组合!"));
+          } else if (validAlphabets(value)) {
+            callback(new Error("账号规则为6~18位数字与字母组合!"));
+          } else if (!isAlphanumeric(value)) {
+            callback(new Error("账号规则为6~18位数字与字母组合!"));
+          } else {
+            callback();
+          }
+        }
+      }
+    };
+    const validatename = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("真实姓名不能为空!"));
+      } else {
+        if (value.length < 2 || value.length > 12) {
+          callback(new Error("真实姓名规则为2~12位汉字!"));
+        } else {
+          if (!isChinese(value)) {
+            console.log(9999);
+            callback(new Error("真实姓名规则为2~12位汉字!"));
+          } else if (isEmoticon(value)) {
+            console.log(2345);
+            callback(new Error("真实姓名规则为2~12位汉字!"));
+          } else {
+            callback();
+          }
+        }
+      }
+    };
+    const validatemobile = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("手机号不能为空!"));
+      } else {
+        if (!isMobile(value)) {
+          callback(new Error("手机号格式不正确!"));
+        } else {
+          callback();
+        }
+      }
+    };
+
+    const validateEmail = (rule, value, callback) => {
+      if (value === "") {
+        callback();
+      } else {
+        if (!validEmail(value)) {
+          callback(new Error("邮箱格式不正确!"));
+        } else {
+          callback();
+        }
+      }
+    };
+    return {
+      loading: false,
+      title: "添加账号",
+      showModelThis: this.showModel,
+      ruleForm: {
+        // username: "", // 账号
+        // name: "", // 真实姓名
+        // mobile: "",
+        // email: "",
+        // role_id: "",
+        // status: "1",
+        // item: [],
+        result: "", //入库验收异常原因
+        result_desc: "", //入库异常备注
+      },
+      rulesThis: this.rules,
+      rules: {
+        result: [
+          {
+            required: true,
+            trigger: "blur",
+            message: "入库异常原因不能为空",
+          },
+        ],
+
+        result_desc: [
+          {
+            required: true,
+            trigger: "blur",
+            message: "入库异常备注不能为空",
+          },
+        ],
+      },
+    };
+  },
+  watch: {
+    showModel: function (val) {
+      this.showModelThis = val;
+      if (val) {
+        this.initForm();
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit("cancel");
+      }
+    },
+  },
+  methods: {
+    closeModel() {
+      console.log("closeModel!!");
+    },
+    async initForm() {
+      this.loading = true;
+      // await this.getRole();
+      if (this.id === "add") {
+        this.title = "添加异常原因";
+        this.rulesThis = this.rules;
+        await this.resetForm();
+      } else {
+        if (this.isDetail) {
+          this.title = "异常原因详情";
+          this.rulesThis = {};
+        } else {
+          this.title = "修改异常原因";
+          this.rulesThis = this.rules;
+        }
+        // console.log("修改异常");
+        console.log(this.id);
+        await this.resetForm();
+        // console.log(this.sitem);
+        await this.initData();
+      }
+      this.loading = false;
+    },
+    // 获取详情列表
+    async initData() {
+      const res = await asyncRequest.detail({ id: this.id });
+      if (res && res.code === 0 && res.data) {
+        this.ruleForm = res.data;
+        console.log(this.ruleForm);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.$message.warning(res.message);
+      }
+    },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields();
+          this.$refs.ruleForm.clearValidate();
+          this.ruleForm = {
+            result: "", //入库验收异常原因
+            result_desc: "", //入库异常备注
+          };
+        }
+      });
+    },
+
+    // 提交功能
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async (valid) => {
+        console.log(valid);
+        if (valid) {
+          this.loading = true;
+          const { result, result_desc } = JSON.parse(
+            JSON.stringify(this.ruleForm)
+          );
+          const model = {
+            result: result || "", //入库验收异常原因
+            result_desc: result_desc || "", //入库异常备注
+            id: this.id,
+          };
+          let res = {};
+          if (this.id === "add") {
+            delete model["id"];
+            res = await asyncRequest.add(model);
+          } else {
+            console.log("update");
+            res = await asyncRequest.update(model);
+            console.log(res);
+          }
+          this.loading = false;
+          if (res && res.code === 0) {
+            const title = this.id === "add" ? "添加成功" : "修改成功";
+            this.$notify.success({
+              title,
+              message: "",
+            });
+            this.showModelThis = false;
+            // 刷新
+            this.$emit("refresh");
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
+    },
+  },
+};
+</script>
+
+   <style lang="scss" scoped>
+.storeAnomaly {
+}
+</style>
+   

+ 282 - 0
src/views/sellOut/customer/index.vue

@@ -0,0 +1,282 @@
+<template>
+  <div class="customer pagePadding">
+    <div
+      v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
+    >
+      <ex-table
+        v-loading="false"
+        :table="table"
+        :data="tableData"
+        :columns="columns"
+        :page="pageInfo"
+        :size="size"
+        @page-curr-change="handlePageChange"
+        @page-size-change="handleSizeChange"
+        @screen-reset="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
+        @screen-submit="
+          pageInfo.curr = 1;
+          parmValue.page = 1;
+          searchList();
+        "
+      >
+        <template #table-header="{}">
+          <div style="width: 100%">
+            <el-row style="padding: 0 0 0 80px">
+              <el-col :span="3" style="width: 66px">
+                <el-button
+                  type="primary"
+                  icon="el-icon-arrow-left"
+                  :size="searchSize"
+                  >上一页</el-button
+                >
+              </el-col>
+              <el-col :span="3" style="width: 66px; float: right">
+                <el-button
+                  :size="searchSize"
+                  type="primary"
+                  style="float: right; margin-left: 5px"
+                  @click="getNext('add', false)"
+                >
+                  新建
+                </el-button>
+              </el-col>
+            </el-row>
+          </div>
+        </template>
+        <template #status="{ scope }">
+          <el-tag
+            :size="tablebtnSize"
+            :type="scope.row.status == '0' ? 'warning' : ''"
+            v-text="
+              (statusOptions.find((item) => item.id == scope.row.status) || {})
+                .label || '--'
+            "
+          ></el-tag>
+        </template>
+        <template #operation="{ scope }">
+          <el-tooltip effect="dark" content="查看下一级" placement="top">
+            <i
+              class="el-icon-d-arrow-right tb-icon"
+              @click="getNext(scope.row.id)"
+            ></i>
+          </el-tooltip>
+        </template>
+      </ex-table>
+      <add-edit
+        :id="modelId"
+        :sitem="sitem"
+        :show-model="showModel"
+        :is-detail="isDetail"
+        @refresh="searchList"
+        @cancel="showModel = false"
+      />
+    </div>
+    <div v-else>
+      <no-auth></no-auth>
+    </div>
+  </div>
+</template>
+   <script>
+import mixinPage from "@/mixins/elPaginationHandle";
+import resToken from "@/mixins/resToken";
+import statusList from "@/assets/js/statusList";
+import asyncRequest from "@/apis/service/sellOut/customer";
+import addEdit from "./addEdit";
+import { mapGetters } from "vuex";
+
+export default {
+  name: "customer",
+  mixins: [mixinPage, resToken],
+  components: {
+    addEdit,
+  },
+  computed: {
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    powers() {
+      let tran =
+        this.$store.getters.btnList.find(
+          (item) => item.menu_route == "customer"
+        ) || {};
+      if (tran && tran.action && tran.action.length > 0) {
+        return tran.action;
+      } else {
+        return [];
+      }
+    },
+  },
+  data() {
+    return {
+      // 状态
+      statusOptions: [
+        { id: "0", label: "禁用" },
+        { id: "1", label: "启用" },
+      ],
+      statusList: statusList,
+      loading: true,
+      showModel: false,
+      isDetail: false,
+      modelId: 0,
+      parmValue: {
+        pid: "", //
+        name: "",
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      },
+      tableData: [],
+      passwordModel: false,
+      passwordModelId: 0,
+      isPasswordDetail: false,
+      // 表格 - 数据
+      tableData: [],
+      // 表格 - 参数
+      table: {
+        stripe: true,
+        border: true,
+        _defaultHeader_: ["setcol"],
+      },
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      // 表格 - 列参数
+      columns: [
+        {
+          prop: "id",
+          label: "ID",
+          width: "80px",
+        },
+        {
+          prop: "name",
+          label: "公司编码",
+        },
+        {
+          prop: "name",
+          label: "公司名称",
+        },
+        {
+          prop: "level",
+          label: "层级",
+        },
+
+        {
+          prop: "",
+          label: "操作",
+          fixed: "right",
+          _noset_: true,
+          _slot_: "operation",
+          width: "150px",
+        },
+      ],
+    };
+  },
+  mounted() {
+    this.searchList();
+  },
+  methods: {
+    async deleteItem(id) {
+      await this.$confirm("确定要删除?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          const model = {
+            id: id,
+          };
+          const res = await asyncRequest.delete(model);
+          if (res && res.code === 0) {
+            this.$notify.success({
+              title: "删除成功",
+              message: "",
+            });
+            this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    restSearch() {
+      this.parmValue = {
+        pid: "", //
+        name: "",
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+      };
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
+      };
+      this.searchList();
+    },
+    getNext(id) {
+      this.pageInfo.curr = 1;
+      this.parmValue.page = 1;
+      this.parmValue.pid = id;
+      this.parmValue.name = "";
+      this.searchList();
+    },
+    async searchList() {
+      this.loading = true;
+      const res = await asyncRequest.list(this.parmValue);
+      if (res && res.code === 0 && res.data) {
+        this.tableData = res.data.list;
+        // console.log(this.tableData);
+        this.pageInfo.total = Number(res.data.count);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout();
+      } else {
+        this.tableData = [];
+        this.pageInfo.total = 0;
+      }
+      this.loading = false;
+    },
+
+    async statusConfirm(id, status) {
+      let str = status === "1" ? "禁用" : "启用";
+      await this.$confirm("确定要改为" + str + "?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      })
+        .then(async () => {
+          this.loading = true;
+          const model = {
+            id: id,
+            status: status === "1" ? "0" : "1",
+          };
+          const res = await asyncRequest.status(model);
+          if (res && res.code === 0) {
+            this.loading = false;
+            this.$notify.success({
+              title: "状态修改成功!",
+              message: "",
+            });
+            await this.searchList();
+          } else if (res && res.code >= 100 && res.code <= 104) {
+            await this.logout();
+          } else {
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+  },
+};
+</script>
+  <style lang="scss" scoped>
+</style>
+   

+ 170 - 332
src/views/stock/my-test/index.vue

@@ -3,181 +3,56 @@
     <div
       v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
     >
-      <ex-table
-        v-loading="loading"
-        :table="table"
-        :data="tableData"
-        :columns="columns"
-        :page="pageInfo"
-        :size="size"
-        @page-curr-change="handlePageChange"
-        @page-size-change="handleSizeChange"
-        @screen-reset="
-          pageInfo.curr = 1;
-          parmValue.page = 1;
-          searchList();
-        "
-        @screen-submit="
-          pageInfo.curr = 1;
-          parmValue.page = 1;
-          searchList();
-        "
+      <el-button type="primary" @click="addListItem()" size="mini"
+        >添加</el-button
       >
-        <template #table-header="{}">
-          <div style="width: 100%">
-            <el-row style="padding: 0 0 0 80px">
-              <el-col :span="24">
-                <el-col :span="4" style="width: 120px">
-                  <el-select
-                    :size="searchSize"
-                    v-model="parmValue.status"
-                    filterable
-                    clearable
-                    placeholder="账号状态"
-                    style="width: 100%"
-                    @change="
-                      pageInfo.curr = 1;
-                      parmValue.page = 1;
-                      searchList();
-                    "
-                  >
-                    <el-option
-                      v-for="item in statusList"
-                      :key="'status' + item.code"
-                      :label="item.name"
-                      :value="item.code"
-                    />
-                  </el-select>
-                </el-col>
-                <el-col :span="4" style="width: 150px; padding: 0 0 0 10px">
-                  <el-input
-                    :size="searchSize"
-                    v-model="parmValue.name"
-                    :maxlength="40"
-                    placeholder="业务员姓名"
-                  />
-                </el-col>
-                <el-col :span="4" style="width: 160px; padding: 0 0 0 10px">
-                  <el-input
-                    :size="searchSize"
-                    v-model="parmValue.username"
-                    :maxlength="40"
-                    placeholder="手机号"
-                  />
-                </el-col>
-                <el-col :span="4" style="width: 54px">
-                  <el-button
-                    :size="searchSize"
-                    type="primary"
-                    class="fr"
-                    icon="el-icon-search"
-                    @click="searchList"
-                /></el-col>
-                <el-col :span="4" style="width: 66px">
-                  <el-button
-                    type="warning"
-                    class="fr"
-                    :size="searchSize"
-                    @click="restSearch"
-                  >
-                    重置
-                  </el-button>
-                </el-col>
-                <el-col :span="3" style="width: 66px; float: right">
-                  <el-button
-                    :size="searchSize"
-                    type="primary"
-                    style="float: right; margin-left: 5px"
-                    @click="searchList"
-                  >
-                    刷新
-                  </el-button>
-                </el-col>
-              </el-col>
-            </el-row>
-          </div>
-        </template>
-        <template #status="{ scope }">
-          <el-tag
-            :size="tablebtnSize"
-            :type="scope.row.status == '0' ? 'warning' : ''"
-            v-text="
-              (statusOptions.find((item) => item.id == scope.row.status) || {})
-                .label || '--'
-            "
-          ></el-tag>
-        </template>
-        <template #operation="{ scope }">
-          <el-tooltip
-            v-if="powers.some((item) => item == '002')"
-            effect="dark"
-            content="重置密码"
-            placement="top"
-          >
-            <i
-              class="el-icon-refresh-left tb-icon"
-              @click="openPasswordModal(scope.row.id, false)"
-            ></i>
-          </el-tooltip>
-
-          <el-tooltip
-            v-if="powers.some((item) => item == '007')"
-            effect="dark"
-            content="详情"
-            placement="top"
-          >
-            <i
-              class="el-icon-view tb-icon"
-              @click="openModal(scope.row.id, true, scope.row)"
-            ></i>
-          </el-tooltip>
-          <el-tooltip
-            v-if="powers.some((item) => item == '005')"
-            effect="dark"
-            content="修改"
-            placement="top"
-          >
-            <i
-              class="el-icon-edit tb-icon"
-              @click="openModal(scope.row.id, false, scope.row)"
-            ></i>
-          </el-tooltip>
-          <el-tooltip
-            v-if="
-              powers.some((item) => item == '004') && scope.row.status === '1'
-            "
-            effect="dark"
-            content="禁用"
-            placement="top"
-          >
-            <i
-              class="el-icon-video-pause tb-icon"
-              @click="statusConfirm(scope.row.id, scope.row.status)"
-            ></i>
-          </el-tooltip>
-          <el-tooltip
-            v-if="
-              powers.some((item) => item == '004') && scope.row.status === '0'
-            "
-            effect="dark"
-            content="启用"
-            placement="top"
+      <el-button type="success" @click="saveList('form')" size="mini"
+        >保存</el-button
+      >
+      <el-form :model="model" ref="form" :size="'mini'">
+        <el-table :data="model.list" style="width: 100%" row-key="key">
+          <el-table-column
+            v-for="item in tableHeadData"
+            :key="item.key"
+            :label="item.label"
+            :width="item.width"
           >
-            <i
-              class="el-icon-video-play tb-icon"
-              @click="statusConfirm(scope.row.id, scope.row.status)"
-            ></i>
-          </el-tooltip>
-        </template>
-      </ex-table>
-      <add-edit
-        :id="modelId"
-        :sitem="sitem"
-        :show-model="showModel"
-        :is-detail="isDetail"
-        @refresh="searchList"
-        @cancel="showModel = false"
-      />
+            <template slot-scope="scope">
+              <el-form-item
+                :prop="'list.' + scope.$index + '.' + item.name"
+                :rules="scope.row.isEdit ? rules[item.name] : {}"
+                :size="'mini'"
+              >
+                <!-- 判断是展示列表还是新增
+                判断编辑状态下是input还是select -->
+                <span
+                  v-if="!scope.row.isEdit && isSelect.indexOf(item.name) < 0"
+                  >{{ scope.row[item.name] }}</span
+                >
+                <el-input
+                  :size="'mini'"
+                  v-model="scope.row[item.name]"
+                  v-if="scope.row.isEdit && isSelect.indexOf(item.name) < 0"
+                ></el-input>
+                <el-select
+                  :size="'mini'"
+                  v-model="scope.row[item.name]"
+                  v-if="isSelect.indexOf(item.name) > -1"
+                  :disabled="!scope.row.isEdit"
+                >
+                  <el-option
+                    v-for="childItem in scope.row[item.name + 'List']"
+                    :key="childItem.value"
+                    :label="childItem.label"
+                    :value="childItem.value"
+                  >
+                  </el-option>
+                </el-select>
+              </el-form-item>
+            </template>
+          </el-table-column>
+        </el-table>
+      </el-form>
     </div>
     <div v-else>
       <no-auth></no-auth>
@@ -187,17 +62,13 @@
    <script>
 import mixinPage from "@/mixins/elPaginationHandle";
 import resToken from "@/mixins/resToken";
-import statusList from "@/assets/js/statusList";
-import asyncRequest from "@/apis/service/stock/my-test";
-import addEdit from "./addEdit";
+
 import { mapGetters } from "vuex";
 
 export default {
   name: "my-test",
   mixins: [mixinPage, resToken],
-  components: {
-    addEdit,
-  },
+
   computed: {
     ...mapGetters(["tablebtnSize", "searchSize", "size"]),
     powers() {
@@ -213,183 +84,150 @@ export default {
     },
   },
   data() {
+    // 可以把校验规则单独提出一个js文件 通过export方式导
+    // 写在这里是为了此篇博客的展示
+    var validatePass = (rule, value, callback) => {
+      if (value === "") {
+        callback(new Error("请输入Warehouse"));
+      }
+      if (value) {
+        // 用写死value的方式 模拟接口请求
+        if (value == "345") {
+          callback(new Error("Warehouse已经存在"));
+        } else {
+          callback();
+        }
+      }
+    };
+
     return {
-      sitem: null,
-      // 状态
-      statusOptions: [
-        { id: "0", label: "禁用" },
-        { id: "1", label: "启用" },
-      ],
-      statusList: statusList,
-      loading: true,
-      showModel: false,
-      isDetail: false,
-      modelId: 0,
-      parmValue: {
-        name: "", // 业务员名字
-        username: "", // 账号
-        status: "", //
-        page: 1, // 页码
-        size: 15, // 每页显示条数
-      },
-      tableData: [],
-      passwordModel: false,
-      passwordModelId: 0,
-      isPasswordDetail: false,
-      // 表格 - 数据
-      tableData: [],
-      // 表格 - 参数
-      table: {
-        stripe: true,
-        border: true,
-        _defaultHeader_: ["setcol"],
-      },
-      // 表格 - 分页
-      pageInfo: {
-        size: 15,
-        curr: 1,
-        total: 0,
+      // list数据
+      model: {
+        list: [],
       },
-      // 表格 - 列参数
-      columns: [
+      newModel: [],
+      // 表头字段
+      tableHeadData: [
         {
-          prop: "nickname",
-          label: "真实姓名",
+          name: "warehouse",
+          width: 160,
+          label: "Warehouse",
         },
         {
-          prop: "role_name",
-          label: "角色名称",
+          name: "description",
+          width: 160,
+          label: "Description",
         },
         {
-          prop: "mobile",
-          label: "联系电话",
+          name: "warehouseType",
+          width: 160,
+          label: "Warehouse Type",
         },
         {
-          prop: "email",
-          label: "邮箱",
+          name: "extWarehouse",
+          width: 160,
+          label: "Ext Warehouse",
         },
         {
-          prop: "status",
-          label: "状态",
-          _slot_: "status",
-          width: "80px",
+          name: "goodsReceiptStep",
+          width: 160,
+          label: "Goods Receipt Step",
         },
         {
-          prop: "addtime",
-          label: "创建时间",
-          sortable: true,
+          name: "goodsIssueStep",
+          width: 160,
+          label: "Goods Issue Step",
         },
         {
-          prop: "",
-          label: "操作",
-          fixed: "right",
-          _noset_: true,
-          _slot_: "operation",
+          name: "pickingStrategy",
+          width: 160,
+          label: "Picking Strategy",
+        },
+        {
+          name: "email",
+          width: 210,
+          label: "Email",
         },
       ],
+      // 下拉选项判断条件
+      isSelect: ["warehouseType", "goodsReceiptStep", "pickingStrategy"],
+      // 校验规则
+      rules: {
+        warehouse: [{ validator: validatePass, trigger: "blur" }],
+        description: [
+          { required: true, message: "请输入description", trigger: "blur" },
+        ],
+        warehouseType: [
+          { required: true, message: "请选择", trigger: "change" },
+        ],
+        // 非必填但是填了就要复合email的格式
+        email: [
+          { type: "email", message: "请输入正确的Emall", trigger: "blur" },
+        ],
+      },
     };
   },
   mounted() {
-    this.searchList();
+    // 模拟接口请求赋值
+    this.model.list = [
+      {
+        warehouse: "345",
+        description: "345",
+        warehouseType: "1",
+        extWarehouse: "1",
+        goodsReceiptStep: "1",
+        goodsIssueStep: "1",
+        pickingStrategy: "Y",
+        email: "guozongzhang1@163.com",
+        warehouseTypeList: [
+          { label: "内部仓库", value: "1" },
+          { label: "外部仓库", value: "2" },
+        ],
+        goodsReceiptStepList: [
+          { label: "一步", value: "1" },
+          { label: "二步", value: "2" },
+        ],
+        pickingStrategyList: [
+          { label: "跳过pick", value: "Y" },
+          { label: "不跳过pick", value: "N" },
+        ],
+      },
+    ];
   },
 
   methods: {
-    restSearch() {
-        // 表格 - 分页
-      this.pageInfo = {
-        size: 15,
-        curr: 1,
-        total: 0,
-      };
-      this.parmValue = {
-        name: "", // 业务员名字
-        username: "", // 账号
-        status: "", //
-        page: 1, // 页码
-        size: 15, // 每页显示条数
-      };
-      this.searchList();
+    // 添加list
+    addListItem() {
+      let addItem = {};
+      this.tableHeadData.forEach((item) => {
+        addItem[item.name] = "";
+        addItem["isEdit"] = true;
+        addItem.key = Date.now();
+        addItem["warehouseTypeList"] = [
+          { label: "内部仓库", value: "1" },
+          { label: "外部仓库", value: "2" },
+        ];
+        addItem["goodsReceiptStepList"] = [
+          { label: "一步", value: "1" },
+          { label: "二步", value: "2" },
+        ];
+        addItem["pickingStrategyList"] = [
+          { label: "跳过pick", value: "Y" },
+          { label: "不跳过pick", value: "N" },
+        ];
+      });
+      this.model.list.unshift(addItem);
     },
-
-    openModal(id, isDetail, sitem) {
-      this.showModel = true;
-      this.modelId = id;
-      this.isDetail = isDetail;
-      this.sitem = sitem;
-    },
-    async deleteById(id, status) {
-      await this.$confirm("确定要删除?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          const model = {
-            id: id,
-            status: status === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
-            this.$notify.success({
-              title: "删除成功",
-              message: "",
-            });
-            this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
-    },
-    async searchList() {
-      this.loading = true;
-      const res = await asyncRequest.list(this.parmValue);
-      if (res && res.code === 0 && res.data) {
-        this.tableData = res.data.list;
-        this.pageInfo.total = Number(res.data.count);
-      } else if (res && res.code >= 100 && res.code <= 104) {
-        await this.logout();
-      } else {
-        this.tableData = [];
-        this.pageInfo.total = 0;
-      }
-      this.loading = false;
-    },
-
-    async statusConfirm(id, status) {
-      let str = status === "1" ? "禁用" : "启用";
-      await this.$confirm("确定要改为" + str + "?", {
-        confirmButtonText: "确定",
-        cancelButtonText: "取消",
-        type: "warning",
-      })
-        .then(async () => {
-          this.loading = true;
-          const model = {
-            id: id,
-            status: status === "1" ? "0" : "1",
-          };
-          const res = await asyncRequest.status(model);
-          if (res && res.code === 0) {
-            this.loading = false;
-            this.$notify.success({
-              title: "状态修改成功!",
-              message: "",
-            });
-            await this.searchList();
-          } else if (res && res.code >= 100 && res.code <= 104) {
-            await this.logout();
-          } else {
-            this.$message.warning(res.message);
-          }
-        })
-        .catch(() => {
-          console.log("取消");
-        });
+    // 保存
+    saveList(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          console.log("success");
+        } else {
+          console.log("error submit!!");
+          return false;
+        }
+      });
     },
   },
 };

+ 2 - 2
src/views/system/updates/index.vue

@@ -20,13 +20,13 @@
               class="demo-table-expand"
             >
               <el-form-item label="更新内容">
-                <p v-html="props.row.content"></p>
+                <p v-html="props.row.system"></p>
               </el-form-item>
             </el-form>
           </template>
         </el-table-column>
         <el-table-column label="版本号" prop="version"> </el-table-column>
-        <el-table-column label="更新模块" prop="title"> </el-table-column>
+        <el-table-column label="更新模块" prop="module"> </el-table-column>
         <el-table-column label="更新时间" prop="addtime"> </el-table-column>
       </el-table>
       <div