caojunjie 1 rok pred
rodič
commit
2a767e7767

+ 1 - 1
src/views/product/detailsPage.vue

@@ -654,7 +654,7 @@ export default {
       getDetails({ goodsId: id })
         .then(res => {
           this.form = res.data.data;
-          this.form.categoryitemList = this.form.categoryitemId.split(',');
+          this.form.categoryitemList = this.form.categoryitemId?this.form.categoryitemId.split(','):'';
 
           this.data = res.data.data.stockGoodsList;
           this.filesList = res.data.data.filesList

+ 207 - 0
src/views/tirePartsMall/basicData/RotationChart/detailsPage.vue

@@ -0,0 +1,207 @@
+<template>
+  <div>
+    <div class="customer-head">
+      <div class="customer-back">
+        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
+                   @click="backToList(0)">返回列表
+        </el-button>
+      </div>
+      <div class="add-customer-btn">
+        <!--        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="!editButton"-->
+        <!--                   @click="confirmEditing">编辑-->
+        <!--        </el-button>-->
+        <el-button
+          class="el-button--small-yh"
+          type="primary"
+          size="small"
+          @click="editCustomer">保存数据
+        </el-button>
+        <el-button
+          class="el-button--small-yh"
+          type="primary"
+          size="small"
+          @click="enableNot"
+          v-if="form.id">
+          {{ form.enableOrNot == 0 ? '启用' : '禁用' }}
+        </el-button>
+      </div>
+    </div>
+    <div style="margin-top: 50px">
+      <trade-card title="基础信息">
+        <avue-form :option="optionForm" v-model="form" ref="form"></avue-form>
+      </trade-card>
+      <trade-card title="附件信息  (图片文件像素推荐700X750,有且只允许有一张主图,其余均为副图)">
+        <c-upload
+          basic
+          :data="form.brandFilesList"
+          :disabled="disabled"
+          deleteUrl="/api/blade-sales-part/brandfiles/remove"
+          :enumerationValue="272.1"
+          display
+        />
+        <!-- <span style="font-size: 12px;">(图片文件像素推荐700X750,有且只允许有一张主图,其余均为副图)</span> -->
+      </trade-card>
+    </div>
+  </div>
+</template>
+
+<script>
+// import {submit} from "@/api/tirePartsMall/basicData/customerInformation";
+import {submit, getDetails, updateEnableOrNot} from "@/api/tirePartsMall/basicData/brandPage";
+import it from "element-ui/src/locale/lang/it";
+
+export default {
+  name: "detailsPage",
+  data() {
+    return {
+      disabled: false,
+      form: {
+        brandFilesList: []
+      },
+      optionForm: {
+        menuBtn: false,
+        span: 8,
+        column: [{
+          label: '名称',
+          prop: "cname",
+          rules: [{
+            required: true,
+            message: " ",
+            trigger: "blur"
+          }]
+        }, {
+          label: '制单人',
+          prop: "createUserName",
+          disabled: true
+        }, {
+          label: '制单日期',
+          prop: "createTime",
+          disabled: true
+        }, {
+          label: '排序',
+          prop: "sort",
+          type:'number'
+        }, {
+          label: '备注',
+          prop: "remarks",
+          type: 'textarea',
+          span: 24,
+          minRows: 2
+        }]
+      },
+      formContacts: {},
+    }
+  },
+  props: {
+    onLoad: Object,
+    detailData: Object
+  },
+  async created() {
+    if (this.onLoad.id && this.detailData.id) {
+      this.refresh(this.onLoad.id, true)
+    } else if (this.onLoad.id) {
+      this.refresh(this.onLoad.id, true)
+    }
+  },
+  methods: {
+    refresh(id, type) {
+      const loading = this.$loading({
+        lock: true,
+        text: '加载中',
+        spinner: 'el-icon-loading',
+        background: 'rgba(255,255,255,0.7)'
+      })
+      getDetails({id: id}).then(res => {
+        this.form = res.data.data
+        loading.close();
+      }).catch(() => {
+        loading.close();
+      })
+    },
+    //是否启用
+    enableNot() {
+      const {brandFilesList, ...formWithoutBrandFilesList} = this.form;
+      const loading = this.$loading({
+        lock: true,
+        text: '加载中',
+        spinner: 'el-icon-loading',
+        background: 'rgba(255,255,255,0.7)'
+      })
+      updateEnableOrNot({
+        ...formWithoutBrandFilesList,
+        enableOrNot: this.form.enableOrNot == 0 ? 1 : 0
+      }).then(res => {
+        loading.close()
+        this.$message.success("操作成功")
+        this.refresh(this.form.id)
+      }).catch(() => {
+        loading.close()
+      })
+    },
+    //修改提交触发
+    editCustomer() {
+      if (this.form.brandFilesList.length === 0) {
+        return this.$message.error("请上传主图")
+      }
+      let num = 0
+      for (let item of this.form.brandFilesList) {
+        if (item.version == 0) {
+          num++
+        }
+      }
+      if (num > 1) {
+        return this.$message.error("主图类型重复")
+      }
+      this.$refs["form"].validate((valid, done) => {
+        done();
+        if (valid) {
+          this.loadingBtn = true;
+          this.form.type = 'LBT'
+          submit({
+            ...this.form
+          }).then(res => {
+            this.$message.success("保存成功");
+            this.refresh(res.data.data.id)
+          }).finally(() => {
+            this.loadingBtn = false;
+          });
+        } else {
+          return false;
+        }
+      });
+    },
+    //自定义列保存
+    async saveColumnTwo(ref, option, optionBack, code) {
+      /**
+       * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
+       * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
+       * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
+       */
+      const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    },
+    //自定义列重置
+    async resetColumnTwo(ref, option, optionBack, code) {
+      this[option] = this[optionBack];
+      const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
+      if (inSave) {
+        this.$message.success("重置成功");
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    },
+    backToList(type) {
+      this.$emit("backToList", type);
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+::v-deep .el-form-item {
+  margin-bottom: 8px !important;
+}
+</style>

+ 261 - 0
src/views/tirePartsMall/basicData/RotationChart/index.vue

@@ -0,0 +1,261 @@
+<template>
+  <div>
+    <basic-container v-show="!detailsOpen">
+      <avue-crud
+          :option="option"
+          :search.sync="search"
+          v-model="form"
+          :table-loading="loading"
+          :data="dataList"
+          ref="crud"
+          :key="key"
+          @on-load="onLoad"
+          @search-change="searchChange"
+          @row-del="rowDel"
+          @refresh-change="refreshChange"
+          @resetColumn="resetColumnTwo('crud','option','optionList',272)"
+          @saveColumn="saveColumnTwo('crud','option','optionList',272)"
+          :page.sync="page">
+        <template slot-scope="{type,size,row,index}" slot="menu">
+          <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
+          <el-button :size="size" :type="type" :disabled="row.enableOrNot" @click="$refs.crud.rowDel(row,index)">删除
+          </el-button>
+        </template>
+        <template slot-scope="{ row, index }" slot="cname">
+              <span style="color: #409EFF;cursor: pointer" @click.stop="check(row)">{{ row.cname }}</span>
+            </template>
+        <template slot="corpNameSearch">
+          <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
+        </template>
+        <template slot-scope="{type,size,row,$index}" slot="menuLeft">
+          <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新增</el-button>
+        </template>
+      </avue-crud>
+    </basic-container>
+    <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
+  </div>
+</template>
+
+<script>
+// import {getList, remove} from "@/api/oceanShipping/maritimeExport";
+import {getList, remove} from "@/api/tirePartsMall/basicData/brandPage";
+import detailsPage from "./detailsPage.vue"
+
+export default {
+  name: "index",
+  components: {
+    detailsPage
+  },
+  data() {
+    return {
+      detailsOpen: false,
+      loading: false,
+      search: {},
+      form: {},
+      dataList: [],
+      detailData: {},
+      page: {
+        pageSize: 20,
+        currentPage: 1,
+        total: 0,
+        pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
+      },
+      key: 0,
+      option: {},
+      optionList: {
+        viewBtn: false,
+        editBtn: false,
+        delBtn: false,
+        addBtn: false,
+        index: true,
+        span: 8,
+        border: true,
+        height: "auto",
+        searchMenuPosition: "right",
+        align: "center",
+        size: "small",
+        menuWidth: 50,
+        searchSpan: 8,
+        searchIcon: true,
+        searchIndex: 2,
+        highlightCurrentRow: true,
+        dialogWidth: "70%",
+        column: [{
+          label: '名称',
+          prop: "cname",
+          search: true,
+          overHidden: true,
+        }, {
+          label: '排序',
+          prop: "sort",
+          type:'number'
+        }, {
+          label: "制单人",
+          search: true,
+          prop: "createUserName",
+          searchProp: "createUser",
+          overHidden: true,
+          width: 100,
+          filterable: true,
+          remote: true,
+          type: "select",
+          dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
+          props: {
+            label: "account",
+            value: "id",
+            res: 'data.records'
+          }
+        }, {
+          label: "制单日期",
+          search: true,
+          prop: "createTime",
+          searchProp: "createTimeList",
+          type: "date",
+          overHidden: true,
+          width: 100,
+          searchRange: true,
+          searchDefaultTime: ["00:00:00", "23:59:59"],
+          format: "yyyy-MM-dd",
+          valueFormat: "yyyy-MM-dd HH:mm:ss"
+        }, {
+          label: "更新人",
+          prop: "updateUserName",
+          searchProp: "updateUser",
+          overHidden: true,
+          width: 100,
+          filterable: true,
+          remote: true,
+          type: "select",
+          dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
+          props: {
+            label: "account",
+            value: "id",
+            res: 'data.records'
+          }
+        }, {
+          label: "更新日期",
+          prop: "updateTime",
+          searchProp: "updateTimeList",
+          type: "date",
+          overHidden: true,
+          width: 100,
+          searchRange: true,
+          searchDefaultTime: ["00:00:00", "23:59:59"],
+          format: "yyyy-MM-dd",
+          valueFormat: "yyyy-MM-dd HH:mm:ss"
+        }, {
+          label: '是否启用',
+          prop: "enableOrNot",
+          search: false,
+          overHidden: true,
+          type: 'select',
+          dicData: [{
+            label: '否',
+            value: 0
+          }, {
+            label: '是',
+            value: 1
+          }]
+        }]
+      }
+    }
+  },
+  async created() {
+    this.option = await this.getColumnData(this.getColumnName(272), this.optionList);
+    this.key++
+    let i = 0;
+    this.option.column.forEach(item => {
+      if (item.search) i++
+    })
+    if (i % 3 !== 0) {
+      const num = 3 - Number(i % 3)
+      this.option.searchMenuSpan = num * 8;
+      this.option.searchMenuPosition = "right";
+    }
+  },
+  methods: {
+    check(row) {
+      this.form = row
+      this.detailsOpen = true
+    },
+    backToList(type) {
+      this.form = {}
+      this.detailsOpen = false
+      if (type === 0) {
+        this.detailData = {}
+      }
+      this.onLoad(this.page, this.search)
+    },
+    //刷新
+    refreshChange() {
+      this.onLoad(this.page, this.search)
+    },
+    rowDel(form, index) {
+      this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        remove(form.id).then(res => {
+          this.$message({
+            type: 'success',
+            message: '删除成功!'
+          });
+          this.dataList.splice(index, 1);
+          this.onLoad(this.page)
+        })
+      }).catch(() => {
+      });
+    },
+    searchChange(params, done) {
+      done();
+      console.log(this.page)
+      this.onLoad(this.page, params)
+    },
+    onLoad(page, params = {}) {
+      params = {
+        type : 'LBT',
+        ...params,
+        current: page.currentPage,
+        size: page.pageSize,
+        ...Object.assign(params, this.search)
+      }
+      this.loading = true
+      getList(params).then(res => {
+        this.dataList = res.data.data.records
+        this.page.total = res.data.data.total
+        this.loading = false
+      }).finally(() => {
+        this.loading = false
+      })
+    },
+    //自定义列保存
+    async saveColumnTwo(ref, option, optionBack, code) {
+      /**
+       * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
+       * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
+       * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
+       */
+      const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
+      if (inSave) {
+        this.$message.success("保存成功");
+        //关闭窗口
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    },
+    //自定义列重置
+    async resetColumnTwo(ref, option, optionBack, code) {
+      this[option] = this[optionBack];
+      const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
+      if (inSave) {
+        this.$message.success("重置成功");
+        this.$refs[ref].$refs.dialogColumn.columnBox = false;
+      }
+    }
+  }
+}
+</script>
+
+<style scoped>
+
+</style>