Browse Source

feat:网络订单录入

snow 2 years ago
parent
commit
c629d3fab4

+ 22 - 0
src/apis/service/netOrderEntry/netOrderEnter/index.js

@@ -0,0 +1,22 @@
+import http from '@/apis/axios'
+const api = 'admin/'
+export default {
+  // 添加
+  add: (data, params) => http(api + 'interadd', data, 'post', params),
+  // 删除
+  delete: (data, params) => http(api + 'branddel', data, 'post', params),
+  delimportorder: (data, params) => http(api + 'delimportorder', data, 'post', params),
+  // 分页查询
+  list: (data, params) => http(api + 'salelist', { ...data, order_source: '9' }, 'post', params),
+  // 更新
+  update: (data, params) => http(api + 'interedit', data, 'post', params),
+  // 修改状态
+  status: (data, params) => http(api + 'brandstatus', data, 'post', params),
+  // 详情
+  detail: (data, params) => http(api + 'interinfo', data, 'post', params),
+  // 提交导入数据
+  orderimportlist: (data, params) => http(api + 'orderimportlist', data, 'post', params),
+  relationstockbatch: (data, params) => http(api + 'relationstockbatch', data, 'post', params),
+  accountall: (data, params) => http(api + 'userall', data, 'post', params),
+  getcat: (data, params) => http(api + 'userall', data, 'post', params)
+}

+ 463 - 0
src/components/ExTableNew.vue

@@ -0,0 +1,463 @@
+<template>
+  <div>
+    <div class="table-header">
+      <template v-for="(item, index) in table._defaultHeader_">
+        <el-dropdown
+          v-if="item == 'setcol'"
+          :key="index"
+          placement="bottom-end"
+          trigger="click"
+          class="setcol-table-lie"
+          :hide-on-click="false"
+        >
+          <el-button size="small">列设置</el-button>
+          <el-dropdown-menu slot="dropdown" :class="'ex-table-setcol-dropdown'">
+            <template v-for="(column, index) in setColumns">
+              <el-dropdown-item
+                v-if="!column._noset_"
+                :key="'setColumns' + index"
+              >
+                <el-switch
+                  v-model="column._hidden_"
+                  :active-text="column.label"
+                  :active-value="false"
+                  :inactive-value="true"
+                />
+              </el-dropdown-item>
+            </template>
+          </el-dropdown-menu>
+        </el-dropdown>
+      </template>
+      <slot
+        name="table-header"
+        :selection="tableSelection"
+        :alldata="data"
+      />
+    </div>
+    <el-table
+      ref="elTable"
+      :data="data"
+      v-bind="table"
+      :size="size"
+      :span-method="arraySpanMethod"
+      style="width: 100%"
+      v-on="$listeners"
+      @selection-change="tableSelection = $event"
+    >
+      <template v-for="(column, index) in columns">
+        <el-table-column
+          v-if="!column._hidden_ && column.type && !column._slot_"
+          :key="index"
+          align="center"
+          v-bind="column"
+          width="45px"
+        />
+        <el-table-column
+          v-else-if="!column._hidden_"
+          :key="index"
+          show-overflow-tooltip
+          v-bind="column"
+        >
+          <template slot="header" slot-scope="scope">
+            <span>{{ column.label }}</span>
+            <span
+              v-if="column._screen_"
+              @click.stop="addConditionItemByCol(column, scope)"
+            >
+              <i
+                v-if="column._screen_tip_ === false"
+                :style="isHasScreenColumn(column) ? 'color:#3888e5;' : ''"
+                class="el-icon-connection"
+              />
+              <el-tooltip
+                v-else
+
+                :effect="column._screen_tip_effect_ || 'dark'"
+                :content="column._screen_tip_ || '筛选'"
+                :placement="column._screen_tip_placement_ || 'top'"
+              >
+                <i
+                  :style="isHasScreenColumn(column) ? 'color:#3888e5;' : ''"
+                  class="el-icon-connection"
+                />
+              </el-tooltip>
+            </span>
+          </template>
+          <slot
+            v-if="column._slot_"
+            slot-scope="scope"
+            :name="column._slot_"
+            :scope="scope"
+          />
+          <template v-else-if="column._render_" slot-scope="scope">
+            <ex-slot
+              :column="column"
+              :render="column._render_"
+              :scope="scope"
+            />
+          </template>
+          <template v-else slot-scope="scope">
+            <span>{{
+              column._format_
+                ? column._format_(scope.row)
+                : getObjPrototype(scope.row, column.prop)
+            }}</span>
+          </template>
+        </el-table-column>
+      </template>
+    </el-table>
+    <!-- <el-pagination
+      v-if="page !== false && data && data.length > 0"
+      :current-page="page.curr"
+      :page-sizes="[10, 20, 50, 100]"
+      :total="page.total"
+      layout="total, sizes, prev, pager, next, jumper"
+      style="text-align: right"
+      class="fu-page"
+      @current-change="$emit('page-curr-change', $event)"
+      @size-change="$emit('page-size-change', $event)"
+    />
+  -->
+    <div
+      v-if="page !== false && data && data.length > 0"
+      class="Pagination"
+      style="text-align: right; margin-top: 10px"
+    >
+      <el-pagination
+        :current-page="page.curr"
+        :page-sizes="[15, 50, 100]"
+        :page-size="page.size"
+        :size="searchSize"
+        layout="total, sizes, prev, pager, next, jumper"
+        :total="page.total"
+        @size-change="$emit('page-size-change', $event)"
+        @current-change="$emit('page-curr-change', $event)"
+      />
+    </div>
+  </div>
+</template>
+
+<script>
+import Sortable from 'sortablejs'
+export default {
+  name: 'ExTable',
+  components: {
+    'ex-slot': {
+      functional: true,
+      props: {
+        render: Function,
+        scope: {
+          type: Object,
+          default: null
+        },
+        column: {
+          type: Object,
+          default: null
+        }
+      },
+      render: (h, data) => {
+        if (data.props.column) data.props.scope.column = data.props.column
+        return data.props.render(h, data.props.scope)
+      }
+    }
+  },
+  directives: {
+    // v-drap  可拖拽指令
+    drap: {
+      inserted: function(element, binding) {
+        element.onmousedown = function(e) {
+          const el = binding.modifiers.parent ? element.parentNode : element
+          const bodyWidth = document.body.offsetWidth
+          const bodyHeight = document.body.offsetHeight
+          const elWidth = el.offsetWidth
+          const elHeight = el.offsetHeight
+          // 开始拖动,记录左上角坐标点
+          const disX = e.clientX - el.offsetLeft
+          const disY = e.clientY - el.offsetTop
+          document.onmousemove = function(e) {
+            // 拖动中,修改dom的左上角坐标点
+            let l = e.clientX - disX
+            let t = e.clientY - disY
+            if (binding.modifiers.limit) {
+              l = l < 0 ? 0 : l
+              t = t < 0 ? 0 : t
+              l = l > bodyWidth - elWidth ? bodyWidth - elWidth : l
+              t = t > bodyHeight - elHeight ? bodyHeight - elHeight : t
+            }
+            el.style.left = l + 'px'
+            el.style.top = t + 'px'
+          }
+          document.onmouseup = function() {
+            // 结束拖动
+            document.onmousemove = null
+          }
+        }
+      }
+    }
+  },
+  props: {
+    /**
+     * el-table 属性集合
+     * 自定义属性:
+     * @param {Array} _defaultHeader_  : 默认的表格头部,支持['setcol', 'screen'] setcol-列设置 screen-筛选
+     * 可使用插槽扩展表格头部:
+     * table-header - 具名插槽
+     * slotProps:selection - 表格选中的数据  alldata - 表格当前全部数据
+     * <template #table-header="slotProps">
+     *   <el-button size="small" @click="click(slotProps)">扩展1</el-button>
+     * </template>
+     */
+    table: {
+      type: Object,
+      default: () => {}
+    },
+    // el-table 表格数据 对应data字段
+    data: {
+      type: Array,
+      default: () => []
+    },
+    /**
+     * el-table-column 表格列属性集合
+     * 自定义属性:
+     * @param {String}       _filter_       : 是否不允许设置列
+     * @param {Boolean}       _noset_        : 是否不允许设置列
+     * @param {Boolean}        _screen_      : 是否允许筛选
+     * @param {Boolean}        _hidden_      : 是否隐藏列
+     * @param {String/Boolean} _screen_tip_  : 筛选按钮提示信息,为false不提示
+     * @param {String} _screen_tip_effect_   : 筛选按钮提示信息主题,dark/light
+     * @param {String} _screen_tip_placement_: 筛选按钮提示信息位置,top/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end
+     * @param {Array}          _keys_        : 支持的筛选key
+     * @param {Array}      _select_options_  : 若需支持包含select的key,value的备选数据,示例:{_select_options_: [{id:'', label:''},...]}
+     * @param {Array}  _select_options_end_  : 若需支持包含select的key,value_end的备选数据,默认使用_select_options_,示例:{_select_options_: [{id:'', label:''},...]}
+     * @param {Array}          _keys_        : 支持的筛选key
+     * @param {String}         _slot_        : 使用具名插槽时的名称
+     * @param {Function}       _format_      : 数据格式化函数,支持返回html
+     * @param {Function}       _render_      : 自定义列,采用vue中的render函数,示例: { _render_:(h, scope) => { return h(...) } }
+     */
+    columns: {
+      type: Array,
+      default: () => []
+    },
+    /**
+     * el-pagination
+     * @param {Boolean} page 是否开启表格分页,若不传或传false则不开启
+     * @param {Object} page {
+     *   size: '10'
+     *   total: '100'
+     *   curr: '1'
+     * }
+     * Event:
+     * page-curr-change  分页当前页改变
+     * page-size-change  分页大小改变
+     */
+    page: {
+      type: [Boolean, Object],
+      default: false
+    },
+    /**
+     * 筛选条件集合
+     */
+    conditions: {
+      type: Array,
+      default: () => []
+    },
+    /**
+     * 是否允许拖拽行
+     */
+    isRowDrop: {
+      type: Boolean,
+      default: false
+    },
+    /**
+     * 是否允许拖拽列
+     */
+    isColDrop: {
+      type: Boolean,
+      default: false
+    },
+    /**
+     * 表格大小
+     */
+    size: {
+      type: String,
+      default: 'mini'
+    }
+  },
+  data() {
+    return {
+      // 表格选中项
+      tableSelection: []
+    }
+  },
+  computed: {
+    // 允许筛选的列
+    screenColumns() {
+      return this.columns.filter((item) => item._screen_ === true)
+    },
+    // 允许设置的列
+    setColumns() {
+      return this.columns.filter((item) => !item._noset_)
+    },
+    // 筛选条件是否包含当前列
+    isHasScreenColumn() {
+      return function(col) {
+        return this.conditions.some((item) => item.prop === col.prop)
+      }
+    }
+  },
+  computed: {
+    page_curr() {
+      return this.page.curr
+    },
+    page_size() {
+      return this.page.size
+    },
+    page_total() {
+      return this.page.total
+    }
+  },
+  watch: {
+    page_curr: function(val) {
+      this.page.curr = val
+    },
+    page_size: function(val) {
+      this.page.size = val
+    },
+    page_total: function(val) {
+      this.page.total = val
+    }
+  },
+  mounted() {
+    // 拖拽绑定
+    this.rowDrop()
+    this.columnDrop()
+  },
+  methods: {
+    //
+    arraySpanMethod({ row, column, rowIndex, columnIndex }) {
+      // if (rowIndex % 2 === 0) {
+      //   if (columnIndex === 0) {
+      //     return [1, 2];
+      //   } else if (columnIndex === 1) {
+      //     return [0, 0];
+      //   }
+      // }
+    },
+    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+      if (columnIndex === 0) {
+        if (rowIndex % 2 === 0) {
+          return {
+            rowspan: 2,
+            colspan: 1
+          }
+        } else {
+          return {
+            rowspan: 0,
+            colspan: 0
+          }
+        }
+      }
+    },
+
+    // 行拖拽
+    rowDrop() {
+      const tbody = document.querySelector(
+        '.el-table__body-wrapper > table > tbody'
+      )
+      Sortable.create(tbody, {
+        disabled: !this.isRowDrop,
+        ghostClass: 'sortable-ghost',
+        animation: 180,
+        delay: 0,
+        onEndevt: (evt) => {
+          const currItem = this.data.splice(evt.oldIndex, 1)[0]
+          this.data.splice(evt.newIndex, 0, currItem)
+        }
+      })
+    },
+    // 列拖拽
+    columnDrop() {
+      const wrapperTr = document.querySelector('.el-table__header-wrapper tr')
+      Sortable.create(wrapperTr, {
+        disabled: !this.isColDrop,
+        ghostClass: 'sortable-ghost',
+        animation: 180,
+        delay: 0,
+        onEnd: (evt) => {
+          const currItem = this.columns.splice(evt.oldIndex, 1)[0]
+          this.columns.splice(evt.newIndex, 0, currItem)
+        }
+      })
+    },
+    // 获取对象的属性
+    getObjPrototype(o, a) {
+      const fn = Function
+      return new fn('obj', `return obj.${a}`)(o)
+    },
+    /** 表格方法 传递给el-table,后续有需要可继续增加 **/
+    // 对 Table 进行重新布局。当 Table 或其祖先元素由隐藏切换为显示时,可能需要调用此方法
+    doLayout(...arg) {
+      this.$refs.elTable.doLayout(...arg)
+    },
+    // 用于多选表格,清空用户的选择
+    clearSelection(...arg) {
+      this.$refs.elTable.clearSelection(...arg)
+    },
+    // 用于多选表格,切换某一行的选中状态
+    toggleRowSelection(...arg) {
+      this.$refs.elTable.toggleRowSelection(...arg)
+    },
+    // 用于多选表格,切换所有行的选中状态
+    toggleAllSelection(...arg) {
+      this.$refs.elTable.toggleAllSelection(...arg)
+    },
+    // 用于单选表格,设定某一行为选中行
+    setCurrentRow(...arg) {
+      this.$refs.elTable.setCurrentRow(...arg)
+    },
+    // 用于可展开表格与树形表格,切换某一行的展开状态,如果使用了第二个参数,则是设置这一行展开与否(expanded 为 true 则展开)
+    toggleRowExpansion(...arg) {
+      this.$refs.elTable.toggleRowExpansion(...arg)
+    }
+  }
+}
+</script>
+
+<style lang="css">
+.el-switch__core {
+  flex-shrink: 0;
+}
+.el-switch,
+.el-switch__label {
+  height: auto;
+}
+
+.ex-table-setcol-dropdown {
+  max-width: 180px;
+  max-height: 280px;
+  overflow-y: auto;
+}
+</style>
+
+<style lang="scss" scoped>
+.table-header {
+  display: flex;
+  position: relative;
+  display: -webkit-flex;
+  // background-color: #f5f5f5;
+  padding: 0 0;
+  .setcol-table-lie{
+    position: absolute;
+    top:0;
+    left:0;
+    z-index: 7;
+  }
+}
+.table-header > * {
+  margin-top: 10px;
+  margin-bottom: 12px;
+}
+// .table-header :nth-child(n + 2) {
+//   margin-left: 10px;
+// }
+</style>

+ 144 - 0
src/components/PeriodDatePicker.vue

@@ -0,0 +1,144 @@
+<template>
+  <div class="fl time">
+    <el-date-picker
+      v-model="startTime"
+      style="margin: 0"
+      class="date-picker"
+      :type="timeType || 'date'"
+      :size="size"
+      :style="{ width: width }"
+      placeholder="开始日期"
+      value-format="yyyy-MM-dd"
+      :picker-options="pickerOptions1"
+      :editable="false"
+      :clearable="true"
+      :disabled="isEdit"
+      @change="timeChange"
+    />
+    <samp style="padding: 0 3px; margin: 0">至</samp>
+    <el-date-picker
+      v-model="endTime"
+      style="margin: 0"
+      :size="size"
+      class="date-picker"
+      :style="{ width: width }"
+      :type="timeType || 'date'"
+      placeholder="结束日期"
+      :disabled="isEdit"
+      :picker-options="pickerOptions2"
+      :editable="false"
+      value-format="yyyy-MM-dd"
+      :clearable="true"
+      @change="timeChange"
+    />
+  </div>
+</template>
+
+<script>
+// 选择时间段(只有日期)组件
+// timeReturned 返回值{startTime: Number,endTime: Number}
+export default {
+  name: 'PeriodDatePicker',
+  props: ['start', 'end', 'disabled', 'size', 'width', 'type', 'timeType'],
+  data() {
+    return {
+      startTime: this.start,
+      endTime: this.end,
+      isEdit: this.disabled,
+      pickerOptions1: {
+        disabledDate: (time) => {
+          if (this.endTime != null && this.endTime != '' && time) {
+            return time.getTime() > new Date(this.endTime).valueOf()
+          }
+        }
+      },
+      pickerOptions2: {
+        disabledDate: (time) => {
+          if (this.startTime != null && this.startTime != '' && time) {
+            return time.getTime() < new Date(this.startTime).valueOf()
+          }
+        }
+      }
+    }
+  },
+  watch: {
+    disabled: function(val) {
+      this.isEdit = val
+    },
+    start(val) {
+      this.startTime = val
+    },
+    end(val) {
+      this.endTime = val
+    }
+  },
+  mounted() {},
+  methods: {
+    timeChange() {
+      if (
+        this.startTime !== '' &&
+        this.startTime !== null &&
+        this.endTime !== '' &&
+        this.endTime !== null
+      ) {
+        if (this.type + '' === '1' && !this.setType(365)) {
+          this.showMessage('时间跨度不能超过一年!')
+          return
+        } else if (this.type + '' === '2' && !this.setType(90)) {
+          this.showMessage('时间跨度不能超过90天!')
+          return
+        } else if (
+          new Date(this.endTime).valueOf() < new Date(this.startTime).valueOf()
+        ) {
+          this.showMessage('结束时间不大于开始时间!')
+          return
+        } else {
+          this.timeReturned()
+        }
+      } else {
+        this.timeReturned()
+      }
+    },
+    timeReturned() {
+      const s = this.startTime == null ? '' : this.startTime
+      const e = this.endTime == null ? '' : this.endTime
+      const model = {
+        startTime: s == '' ? '' : this.transformTime(s),
+        endTime: e == '' ? '' : this.transformTime(e)
+      }
+
+      this.$emit('timeReturned', model)
+    },
+
+    transformTime(tTime) {
+      const time = new Date(tTime)
+      const y = time.getFullYear()
+      const M = time.getMonth() + 1
+      const d = time.getDate()
+      return y + '-' + (M < 10 ? '0' + M : M) + '-' + (d < 10 ? '0' + d : d)
+    },
+    showMessage(message) {
+      this.$message.error(message)
+      this.startTime = ''
+      this.endTime = ''
+      this.timeReturned()
+    },
+    setType(days) {
+      const step = 24 * 3600 * 1000
+      const sDay = new Date(this.startTime).valueOf()
+      const eDay = new Date(this.endTime).valueOf()
+      let isok = true
+      if (eDay - sDay > step * days) {
+        isok = false
+      }
+
+      return isok
+    }
+  }
+}
+</script>
+<style lang="scss">
+.date-picker.el-input {
+  // width: 150px !important;
+}
+</style>

+ 757 - 0
src/views/netOrderEntry/netOrderEnter/addEdit.vue

@@ -0,0 +1,757 @@
+<template>
+  <el-dialog
+    v-loading="loading || detailLoading"
+    :title="title"
+    :center="true"
+    align="left"
+    top="10vh"
+    width="1040px"
+    :close-on-click-modal="false"
+    :visible.sync="showModelThis"
+    element-loading-text="拼命加载中"
+    element-loading-spinner="el-icon-loading"
+    element-loading-background="rgba(0, 0, 0, 0.8)"
+    @close="handleClose"
+  >
+    <el-card style="margin: -20px 0 0 0">
+      <el-row :gutter="10">
+        <el-col :span="24">
+          <el-form
+            ref="ruleForm"
+            :model="ruleForm"
+            status-icon
+            :rules="rulesThis"
+            label-width="80px"
+            class="demo-ruleForm"
+            size="mini"
+          >
+            <el-divider>
+              <el-tag size="mini">确认单信息</el-tag>
+            </el-divider>
+
+            <el-row>
+              <el-col :span="8">
+                <el-form-item label="采购员" prop="buyerid">
+                  <el-select
+                    v-model="ruleForm.buyerid"
+                    filterable
+                    clearable
+                    placeholder="采购员"
+                    :disabled="id === '007'"
+                    style="width: 100%"
+                  >
+                    <el-option
+                      v-for="item in accounts"
+                      :key="`group_user` + item.id"
+                      :label="item.nickname"
+                      :value="item.id"
+                    >
+                      <span style="float: left">{{ item.nickname }}</span>
+                      <span
+                        style="
+                          float: right;
+                          color: #8492a6;
+                          font-size: 13px;
+                          padding: 0 25px 0 0;
+                        "
+                      >{{ item.role_name }}</span>
+                    </el-option>
+                  </el-select>
+                </el-form-item>
+              </el-col>
+              <el-col :span="8">
+                <el-form-item label="采购毛利率" label-width="110px" prop="cgd_tax">
+                  <el-input-number
+                    v-model="ruleForm.cgd_tax"
+                    style="width: 100%"
+                    :disabled="id === '007'"
+                    controls-position="right"
+                    placeholder="采购毛利率"
+                    :precision="2"
+                    :min="0"
+                    :max="100"
+                    :step="0.01"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="8">
+                <el-form-item label="支付渠道" prop="pay_id">
+                  <search-pay
+                    :value="ruleForm.pay_id"
+                    :disabled="id !== '003'"
+                    :size="'mini'"
+                    :is-detail="type !== 'add'"
+                    :is_show="'0'"
+                    :names="pay_name"
+                    :placeholder="'支付渠道'"
+                    @searchChange="pay_id_change"
+                  />
+                </el-form-item>
+              </el-col>
+              <el-col :span="12">
+                <el-form-item label="单据号" prop="workCode">
+                  <el-input
+                    v-model="ruleForm.workCode"
+                    :disabled="id === '007'"
+                    maxlength="50"
+                    placeholder="单据号"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="PO编号" prop="poCode">
+                  <el-input
+                    v-model="ruleForm.poCode"
+                    placeholder="PO编号"
+                    maxlength="50"
+                    :disabled="id === '007'"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="购买方公司" label-width="110px" prop="khNo">
+                  <search-customer
+                    size="mini"
+                    :names="khName"
+                    :disabled="id !== '003'"
+                    :is-detail="type !== 'add'"
+                    :value="ruleForm.khNo"
+                    placeholder="购买方公司"
+                    @searchChange="handleCustomerChange"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="销售方公司" label-width="110px" prop="companyNo">
+                  <search-work-company
+                    :disabled="id !== '003'"
+                    :value="ruleForm.companyNo"
+                    :names="''"
+                    :size="'mini'"
+                    :placeholder="'销售方公司'"
+                    @searchChange="handleCompanyChange"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+
+            <el-divider>
+              <el-tag size="mini">收货信息</el-tag>
+            </el-divider>
+            <el-row>
+              <el-col :span="12">
+                <el-form-item label="收货人" prop="contactor">
+                  <el-input
+                    v-model="ruleForm.contactor"
+                    :disabled="id === '007'"
+                    placeholder="收货人"
+                    maxlength="30"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="联系电话" prop="mobile">
+                  <el-input
+                    v-model="ruleForm.mobile"
+                    :disabled="id === '007'"
+                    placeholder="联系电话"
+                    maxlength="11"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="收货省市区" prop="addr_code" label-width="100px">
+                  <select-area
+                    size="mini"
+                    :value="ruleForm.addr_code"
+                    placeholder="收货省市区"
+                    :disabled="id === '007'"
+                    @selectChange="select_area_change($event)"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="联系地址" prop="addr">
+                  <el-input
+                    v-model="ruleForm.addr"
+                    :disabled="id === '007'"
+                    maxlength="100"
+                    placeholder="联系地址"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="发货时间" prop="sendtime">
+                  <el-date-picker
+                    v-model="ruleForm.sendtime"
+                    value-format="yyyy-MM-dd"
+                    :disabled="id === '007'"
+                    type="datetime"
+                    placeholder="发货时间"
+                    style="width: 100%"
+                    :picker-options="pickerOptions"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+
+            <el-divider>
+              <el-tag size="mini">商品信息</el-tag>
+            </el-divider>
+            <el-row>
+              <el-col :span="12">
+                <el-form-item label="供应商公司" label-width="110px" prop="supplierNo">
+                  <search-supplier
+                    size="mini"
+                    placeholder="供应商公司"
+                    :value="ruleForm.supplierNo"
+                    :names="supplierName"
+                    :disabled="id === '007'"
+                    :is-detail="type !== 'add'"
+                    @searchChange="handleSupplierChange"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="12">
+                <el-form-item label="商品分类" prop="cat_id">
+                  <search-sort
+                    :value="ruleForm.cat_id"
+                    :placeholder="'商品分类'"
+                    :disabled="id !== '003'"
+                    :size="'mini'"
+                    :names="cat_id_name"
+                    :is-detail="type !== 'add'"
+                    @searchChange="goods_class_change"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+
+            <el-row>
+              <el-col :span="12">
+                <el-form-item label="商品名称" prop="goodName">
+                  <el-input
+                    v-model="ruleForm.goodName"
+                    placeholder="商品名称"
+                    maxlength="50"
+                    :disabled="id !== '003'"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="6">
+                <el-form-item label="数量" prop="goodNum">
+                  <el-input-number
+                    v-model="ruleForm.goodNum"
+                    :disabled="id !== '003'"
+                    style="width: 100%"
+                    controls-position="right"
+                    placeholder="数量"
+                    :precision="0"
+                    :min="0"
+                    :step="1"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="6">
+                <el-form-item label="单位" prop="goodUnit" label-width="60px">
+                  <search-unit
+                    :value="ruleForm.goodUnit"
+                    :disabled="type === 'view' || type === 'editCoin'"
+                    :size="'mini'"
+                    :is-detail="type !== 'add'"
+                    :names="unit_name"
+                    :placeholder="'单位'"
+                    @searchChange="unitsearchChange"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="6">
+                <el-form-item label="单价" prop="goodPrice">
+                  <el-input-number
+                    v-model="ruleForm.goodPrice"
+                    :disabled="id !== '003'"
+                    style="width: 100%"
+                    controls-position="right"
+                    placeholder="单价"
+                    :precision="2"
+                    :min="0"
+                    :step="0.01"
+                  />
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="6">
+                <el-form-item label="贷款总额" prop="good_total">
+                  <el-input v-model="ruleForm.good_total" placeholder="贷款总额" disabled>
+                    <template #append>元</template>
+                  </el-input>
+                </el-form-item>
+              </el-col>
+
+              <el-col :span="6">
+                <el-form-item label="税率" prop="tax">
+                  <search-tax
+                    :disabled="id === '007'"
+                    :value="ruleForm.tax"
+                    :size="'mini'"
+                    :is-detail="type !== 'add'"
+                    :placeholder="'税点'"
+                    @searchChange="handleTaxChange"
+                  />
+                </el-form-item>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-col>
+        <el-col :span="24" style="text-align: right">
+          <el-button
+            v-if="id !== '007'"
+            type="primary"
+            @click="submitForm"
+          >保 存</el-button>
+          <el-button @click="showModelThis = false">
+            {{ id == "007" ? "关 闭" : "取 消" }}
+          </el-button>
+        </el-col>
+      </el-row>
+    </el-card>
+  </el-dialog>
+</template>
+<script>
+import asyncRequest from '@/apis/service/netOrderEntry/netOrderEnter'
+import { accMul, isPhone, isMobile } from '@/utils/validate'
+import resToken from '@/mixins/resToken'
+
+const defaultData = {
+  addr_code: [],
+  buyerid: '',
+  pay_id: '',
+  cgd_tax: '',
+  workCode: '',
+  poCode: '',
+  khNo: '',
+  companyNo: '',
+  contactor: '',
+  mobile: '',
+  addr: '',
+  sendtime: '',
+  supplierNo: '',
+  cat_id: '',
+  goodName: '',
+  goodNum: '',
+  goodPrice: '',
+  good_total: '',
+  goodUnit: '',
+  tax: ''
+}
+
+export default {
+  name: 'Terrace',
+  mixins: [resToken],
+  props: ['showModel', 'id', 'sitem'],
+  data() {
+    const validatemobile = (rule, value, callback) => {
+      if (value !== '') {
+        if (isPhone(value) || isMobile(value)) {
+          callback()
+        } else {
+          callback(new Error('联系电话格式不正确!'))
+        }
+      } else {
+        callback(new Error('请输入联系电话!'))
+      }
+    }
+
+    return {
+      loading: false,
+      detailLoading: false,
+      title: '添加确认单信息',
+      khName: '',
+      accounts: [],
+      cat_id_name: '',
+      showModelThis: this.showModel,
+      pickerOptions: {
+        disabledDate: (time) => time.getTime() > new Date()
+      },
+      names: [],
+      unit_name: '',
+      companyName: '',
+      ruleForm: { ...defaultData },
+      rulesThis: this.rules,
+      rules: {
+        goodUnit: [
+          {
+            required: true,
+            message: '请选择单位',
+            trigger: 'blur'
+          }
+        ],
+        addr_code: [
+          {
+            type: 'array',
+            required: true,
+            message: '请选择收货省市区',
+            trigger: 'blur'
+          }
+        ],
+        pay_id: [
+          {
+            required: true,
+            message: '请输入销售员',
+            trigger: 'blur'
+          }
+        ],
+        buyerid: [
+          {
+            required: true,
+            message: '请选择采购员',
+            trigger: 'blur'
+          }
+        ],
+        cgd_tax: [
+          {
+            required: true,
+            message: '请输入采购毛利率',
+            trigger: 'blur'
+          }
+        ],
+        cat_id: [
+          {
+            required: true,
+            message: '请选择商品分类',
+            trigger: 'change'
+          }
+        ],
+        supplierNo: [
+          {
+            type: 'array',
+            required: true,
+            message: '请选择供应商公司',
+            trigger: 'change'
+          }
+        ],
+        qrdType: [
+          {
+            required: true,
+            message: '请输入订单类型',
+            trigger: 'blur'
+          }
+        ],
+        good_total: [
+          {
+            required: true,
+            message: '请输入货款总金额',
+            trigger: 'blur'
+          }
+        ],
+        // workCode: [
+        //   {
+        //     required: true,
+        //     message: '请输入单据号',
+        //     trigger: 'blur'
+        //   }
+        // ],
+        poCode: [
+          {
+            required: true,
+            message: '请输入PO编号',
+            trigger: 'blur'
+          }
+        ],
+        khNo: [
+          {
+            type: 'array',
+            required: true,
+            message: '请选择购买方公司',
+            trigger: 'change'
+          }
+        ],
+        tax: [
+          {
+            required: true,
+            message: '请选择税率',
+            trigger: 'change'
+          }
+        ],
+        companyNo: [
+          {
+            required: true,
+            message: '请选择销售方公司',
+            trigger: 'change'
+          }
+        ],
+        contactor: [
+          {
+            required: true,
+            message: '请输入收货人',
+            trigger: 'blur'
+          }
+        ],
+        mobile: [
+          {
+            required: true,
+            validator: validatemobile,
+            trigger: 'blur'
+          }
+        ],
+        addr: [
+          {
+            required: true,
+            message: '请输入联系地址',
+            trigger: 'blur'
+          }
+        ],
+
+        sendtime: [
+          {
+            required: true,
+            message: '请输入发货时间',
+            trigger: 'change'
+          }
+        ],
+
+        goodName: [
+          {
+            required: true,
+            message: '请输入商品名称',
+            trigger: 'blur'
+          }
+        ],
+        goodPrice: [
+          {
+            required: true,
+            message: '请输入单价',
+            trigger: 'blur'
+          }
+        ],
+        goodNum: [
+          {
+            required: true,
+            message: '请输入数量',
+            trigger: 'blur'
+          }
+        ]
+      }
+    }
+  },
+  computed: {
+    totalWatchSource() {
+      const { goodNum, goodPrice } = this.ruleForm
+      return { goodNum, goodPrice }
+    }
+  },
+  watch: {
+    showModel: function(val) {
+      this.showModelThis = val
+      if (val) {
+        this.initForm()
+      }
+    },
+    showModelThis(val) {
+      if (!val) {
+        this.$emit('cancel')
+      }
+    },
+    totalWatchSource: {
+      handler({ goodPrice, goodNum }) {
+        if (goodPrice === 0 || goodNum === 0) {
+          this.ruleForm.good_total = 0
+          return
+        }
+
+        this.ruleForm.good_total = accMul(goodPrice, goodNum)
+      },
+      deep: true
+    }
+  },
+  methods: {
+    async select_area_change(e) {
+      this.ruleForm.addr_code = e
+      this.$refs.ruleForm.validateField('addr_code')
+    },
+    handleClose() {
+      this.showModelThis = false
+      this.companyName = ''
+      this.khName = ''
+      this.supplierName = ''
+      this.ruleForm = { ...defaultData }
+    },
+    async initForm() {
+      this.loading = true
+      await this.getAccounts()
+
+      if (this.id === '003') {
+        this.title = '添加确认单信息'
+        this.rulesThis = this.rules
+      } else if (this.id === '005') {
+        this.title = '修改确认单信息'
+        this.rulesThis = this.rules
+      } else {
+        this.title = '确认单信息详情'
+        this.rulesThis = {}
+      }
+      await this.resetForm()
+      this.loading = false
+    },
+
+    handleCompanyChange(e) {
+      this.ruleForm.companyNo = e.code || ''
+      this.$refs.ruleForm.validateField('companyNo')
+    },
+    handleCustomerChange(e) {
+      this.ruleForm.khNo = e.code ? [e.code] : ''
+      this.$refs.ruleForm.validateField('khNo')
+    },
+    handleSupplierChange(e) {
+      this.ruleForm.supplierNo = e.code ? [e.code] : ''
+      this.$refs.ruleForm.validateField('supplierNo')
+    },
+    handleGoodClassChange(e) {
+      this.ruleForm.cat_id = e
+      this.$refs.ruleForm.validateField('cat_id')
+    },
+    handleTaxChange(e) {
+      this.ruleForm.tax = e
+      this.$refs.ruleForm.validateField('tax')
+    },
+    unitsearchChange(e) {
+      console.log(e)
+      const { id, code, label } = e
+      this.ruleForm.goodUnit = code ? [code] : []
+      this.$refs.ruleForm.validateField('goodUnit')
+    },
+    async resetForm() {
+      // 重置
+      await this.$nextTick(() => {
+        if (this.$refs.ruleForm) {
+          this.$refs.ruleForm.resetFields()
+          this.$refs.ruleForm.clearValidate()
+        }
+      })
+
+      if (this.id !== '003') this.getDetail()
+    },
+    async getDetail() {
+      this.detailLoading = true
+      const { orderCode } = this.sitem
+      const { data } = await asyncRequest.detail({ orderCode })
+
+      const {
+        cat_id,
+        khNo,
+        supplierNo,
+        supplierNanme,
+        khName,
+        goodUnit,
+        tax,
+        addr_code,
+        unitName,
+        ...rest
+      } = data
+
+      this.ruleForm = {
+        ...rest,
+        addr_code: addr_code ? addr_code.split(',') : [],
+        cat_id: cat_id ? [cat_id[cat_id.length - 1]] : [],
+        supplierNo: supplierNo ? [supplierNo] : [],
+        khNo: khNo ? [khNo] : [],
+        tax: tax ? tax + '%' : '',
+        goodUnit: goodUnit ? [goodUnit] : ''
+      }
+
+      this.cat_id_name = cat_id.map(({ name }) => name).join('_')
+      this.unit_name = unitName
+      console.log(this.unit_name)
+
+      this.khName = khName
+      this.supplierName = supplierNanme
+      this.detailLoading = false
+    },
+    pay_id_change(e) {
+      const { id, label, pay_name } = e
+      this.ruleForm.pay_id = id || ''
+      this.pay_name = pay_name || ''
+      this.$refs.ruleForm.validateField('pay_id')
+    },
+    async getAccounts() {
+      const res = await asyncRequest.accountall(this.dataForm)
+      if (res && res.code === 0 && res.data) {
+        this.accounts = res.data
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await this.logout()
+      } else {
+        this.$message.warning(res.message)
+      }
+    },
+    async goods_class_change(e) {
+      const { id } = e
+      this.ruleForm.cat_id = id ? [id] : []
+      this.$refs.ruleForm.validateField('cat_id')
+    },
+    async submitForm() {
+      await this.$refs.ruleForm.validate(async(valid) => {
+        if (valid) {
+          if (this.loading) {
+            return
+          }
+
+          this.loading = true
+          const model = JSON.parse(JSON.stringify(this.ruleForm))
+          model.supplierNo = model.supplierNo[0]
+          model.khNo = model.khNo[0]
+          const user = this.accounts.find(({ id }) => id === model.buyerid)
+          model.buyer_name = user ? user.nickname : ''
+          model.cat_id = model.cat_id ? model.cat_id[model.cat_id.length - 1] : ''
+          model.addr_code = model.addr_code.join(',')
+          model.tax = model.tax.split('%')[0]
+          model.pay_name = this.pay_name
+          model.goodUnit = Array.isArray(model.goodUnit) ? model.goodUnit[0] : model.goodUnit
+
+          let res = {}
+          if (this.id === '003') {
+            delete model['id']
+            res = await asyncRequest.add(model)
+          } else {
+            res = await asyncRequest.update(model)
+          }
+          this.loading = false
+          if (res && res.code === 0) {
+            const title = this.id === '003' ? '添加成功!' : '修改成功!'
+            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>
+.terrace {
+}
+</style>

+ 513 - 0
src/views/netOrderEntry/netOrderEnter/index.vue

@@ -0,0 +1,513 @@
+<template>
+  <div class="terrace pagePadding">
+    <ex-table
+      v-loading="loading"
+      v-if="powers.some((i) => i == '001')"
+      :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 10px 80px">
+            <period-date-picker
+              :type="1"
+              :width="'135px'"
+              :size="searchSize"
+              :start="parmValue.start"
+              :end="parmValue.end"
+              @timeReturned="handleTime"
+            />
+
+            <el-col :span="4" style="width: 373px; margin-left: 15px">
+              <el-input
+                size="mini"
+                v-model="value"
+                @blur="
+                  pageInfo.curr = 1;
+                  parmValue.page = 1;
+                  searchList();
+                "
+              >
+                <el-select
+                  v-model="select"
+                  style="width: 125px"
+                  slot="prepend"
+                  placeholder="关键字类型"
+                  @change="
+                    pageInfo.curr = 1;
+                    parmValue.page = 1;
+                    searchList();
+                  "
+                >
+                  <el-option
+                    v-for="key in Object.keys(mapSelectValue2Query)"
+                    :label="mapSelectValue2Query[key]"
+                    :value="key"
+                    :key="key"
+                  ></el-option>
+                </el-select>
+              </el-input>
+            </el-col>
+
+            <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
+              <el-button type="primary" :size="searchSize" @click="searchList"
+                >刷新</el-button
+              >
+            </el-col>
+            <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
+              <el-button type="warning" :size="searchSize" @click="restSearch"
+                >重置</el-button
+              >
+            </el-col>
+            <el-col :span="3" class="fr" style="width: 66px; padding: 0 0 0 10px">
+              <el-button type="primary" :size="searchSize" @click="openModal({}, '003')"
+                >添加</el-button
+              >
+            </el-col>
+          </el-row>
+          <el-row>
+            <el-col :span="6" style="margin-right: 15px">
+              <search-customer
+                size="mini"
+                :value="parmValue.customer_code"
+                :names="customerName"
+                @searchChange="handleCustomerChange"
+                placeholder="购买方公司"
+              />
+            </el-col>
+
+            <el-col :span="6">
+              <search-supplier
+                size="mini"
+                placeholder="销售方公司"
+                :value="parmValue.supplierNo"
+                :disabled="false"
+                :isDetail="false"
+                @searchChange="handleSupplierChange"
+              />
+            </el-col>
+
+            <el-col :span="3" style="margin-left: 10px">
+              <el-input
+                v-model="parmValue.lower_price"
+                size="mini"
+                placeholder="最小销售价"
+                @blur="
+                  pageInfo.curr = 1;
+                  parmValue.page = 1;
+                  searchList();
+                "
+              />
+            </el-col>
+
+            <el-col :span="3" style="margin-left: 10px">
+              <el-input
+                v-model="parmValue.upper_price"
+                size="mini"
+                placeholder="最大销售价"
+                @blur="
+                  pageInfo.curr = 1;
+                  parmValue.page = 1;
+                  searchList();
+                "
+              />
+            </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 #order_type="{ scope }">
+        <el-tag
+          :size="tablebtnSize"
+          v-text="
+            (xs_order_type_options.find((item) => item.id == scope.row.order_type) || {})
+              .label || '--'
+          "
+        ></el-tag>
+      </template>
+
+      <template #order_source="{ scope }">
+        <el-tag
+          :size="tablebtnSize"
+          v-text="
+            (
+              xs_order_source_options.find((item) => item.id == scope.row.order_source) ||
+              {}
+            ).label || '--'
+          "
+        ></el-tag>
+      </template>
+
+      <template #operation="{ scope }">
+        <el-tooltip
+          v-if="powers.some((i) => i == '007')"
+          effect="dark"
+          content="详情"
+          placement="top"
+        >
+          <i class="el-icon-view tb-icon" @click="openModal(scope.row, '007')"></i>
+        </el-tooltip>
+        <el-tooltip
+          v-if="powers.some((i) => i == '005')"
+          effect="dark"
+          content="修改"
+          placement="top"
+        >
+          <i class="el-icon-edit tb-icon" @click="openModal(scope.row, '005')"></i>
+        </el-tooltip>
+      </template>
+    </ex-table>
+    <no-auth v-else></no-auth>
+    <!-- 弹窗 新增/修改 -->
+    <add-edit
+      :id="modelId"
+      :show-model="showModel"
+      :sitem="sitem"
+      @refresh="searchList"
+      @cancel="showModel = false"
+    />
+  </div>
+</template>
+<script>
+import asyncRequest from "@/apis/service/netOrderEntry/netOrderEnter";
+import { statusList } from "@/assets/js/statusList";
+import mixinPage from "@/mixins/elPaginationHandle";
+import roleLevel from "@/assets/js/roleLevel";
+import resToken from "@/mixins/resToken";
+import { mapGetters } from "vuex";
+import addEdit from "./addEdit";
+import { xs_order_type_options, xs_order_source_options } from "@/assets/js/statusList";
+
+export default {
+  name: "netOrderEnter",
+  mixins: [mixinPage, resToken],
+  components: {
+    addEdit,
+  },
+  computed: {
+    //组件SIZE设置
+    ...mapGetters(["tablebtnSize", "searchSize", "size"]),
+    powers() {
+      const { btnList } = this.$store.getters;
+      const tran = btnList.find((i) => i.menu_route == "netOrderEnter") || {};
+      const { action } = tran ?? {};
+      return action ?? [];
+    },
+  },
+  data() {
+    const mapSelectValue2Query = {
+      orderCode: "确认单编号",
+      cgdNo: "采购单编号",
+      // sale_name: "销售员",
+      // cgd_sale: "采购员"
+    };
+
+    return {
+      xs_order_type_options,
+      xs_order_source_options,
+      statusList: statusList,
+      roleLevel: roleLevel,
+      loading: true,
+      showModel: false,
+      modelId: "000",
+      select: "orderCode",
+      sitem: {},
+      customerName: "",
+      mapSelectValue2Query,
+      value: "",
+      parmValue: {
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+        start: "",
+        end: "",
+        customer_code: "",
+        supplierNo: "",
+        lower_price: "",
+        upper_price: "",
+      },
+      // 表格 - 数据
+      tableData: [],
+      // 表格 - 参数
+      table: {
+        stripe: true,
+        border: true,
+        _defaultHeader_: ["setcol"],
+      },
+      statusOptions: [
+        { id: "0", label: "待发货" },
+        { id: "1", label: "待发货完成" },
+        { id: "2", label: "发货已完成" },
+        { id: "3", label: "订单已取消" },
+      ],
+      // 表格 - 分页
+      pageInfo: {
+        size: 15,
+        curr: 1,
+        total: 0,
+      },
+      columns: [
+        {
+          prop: "orderCode",
+          label: "订单编号",
+          width: "155px",
+        },
+
+        {
+          prop: "cgdNo",
+          label: "采购单编号",
+          width: "155px",
+        },
+        {
+          prop: "good_name",
+          label: "商品名称",
+          width: "150",
+        },
+        // {
+        //   prop: 'good_class',
+        //   label: '商品分类',
+        //   width: '120'
+
+        // },
+
+        {
+          prop: "good_num",
+          label: "商品数量",
+        },
+        {
+          prop: "sale_price",
+          label: "销售单价",
+        },
+        {
+          prop: "total_price",
+          label: "总价",
+        },
+
+        {
+          prop: "status",
+          label: "订单状态",
+          _slot_: "status",
+          width: "120px",
+        },
+        {
+          prop: "order_source",
+          label: "订单来源",
+          _slot_: "order_source",
+          width: "90px",
+        },
+        {
+          prop: "order_type",
+          label: "商品来源",
+          _slot_: "order_type",
+          width: "90px",
+        },
+        // {
+        //   prop: 'useage',
+        //   label: '订单用途',
+        //   width: '100px'
+        // },
+        {
+          prop: "customer_code",
+          label: "客户公司编码",
+          width: "155px",
+        },
+        {
+          prop: "customerName",
+          label: "企业客户名称",
+          width: "125px",
+        },
+        {
+          prop: "supplierName",
+          label: "销售方公司",
+          width: "125px",
+        },
+        {
+          prop: "company_name",
+          label: "订单创建人部门",
+          minWidth: "120px",
+        },
+        {
+          prop: "apply_name",
+          label: "订单创建人",
+          width: "85px",
+        },
+        {
+          prop: "cgder",
+          label: "供应商负责人",
+          width: "95",
+        },
+        {
+          prop: "good_creater",
+          label: "商品创建人",
+          width: "85px",
+        },
+        {
+          prop: "addtime",
+          label: "创建时间",
+          width: "145px",
+        },
+        {
+          prop: "",
+          label: "操作",
+          fixed: "right",
+          _noset_: true,
+          width: "80px",
+          _slot_: "operation",
+        },
+      ],
+    };
+  },
+  mounted() {
+    this.searchList();
+  },
+  methods: {
+    restSearch() {
+      // 表格 - 分页
+      this.pageInfo = {
+        size: 15,
+        curr: 1,
+        total: 0,
+      };
+      this.parmValue = {
+        page: 1, // 页码
+        size: 15, // 每页显示条数
+        start: "",
+        end: "",
+        customer_code: "",
+        supplierNo: "",
+      };
+      this.value = "";
+      this.searchList();
+    },
+    // 新建/编辑/详情
+    openModal(row, type) {
+      // const { status } = row;
+      // if (type === "005" && status === "1") {
+      //   this.$message.warning("禁用后,才可以修改!");
+      //   return;
+      // }
+      this.sitem = row;
+      this.modelId = type;
+      this.showModel = true;
+    },
+    // 时间
+    async handleTime(e) {
+      this.parmValue.start = e.startTime || "";
+      this.parmValue.end = e.endTime || "";
+
+      if (
+        (this.parmValue.start !== "" && this.parmValue.end !== "") ||
+        (this.parmValue.start === "" && this.parmValue.end === "")
+      ) {
+        this.pageInfo.curr = 1;
+        this.parmValue.page = 1;
+        await this.searchList();
+      }
+    },
+    handleCustomerChange(e) {
+      this.parmValue.customer_code = e.code ? [e.code] : "";
+      this.customerName = e.label;
+      this.searchList();
+    },
+    handleSupplierChange(e) {
+      this.parmValue.supplierNo = e.code ? [e.code] : "";
+      this.searchList();
+    },
+    /**
+     * 启用/禁用
+     * @param {String} id id
+     * @param {String} status 0-禁用 1-启用
+     */
+    async changeStatus(id, status) {
+      await this.$confirm(`确定要改为${status === "1" ? "禁用" : "启用"}?`, {
+        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.loading = false;
+            this.$message.warning(res.message);
+          }
+        })
+        .catch(() => {
+          console.log("取消");
+        });
+    },
+    // 刷新表格
+    async searchList() {
+      const vm = this;
+      if (
+        (vm.parmValue.start !== "" && vm.parmValue.end === "") ||
+        (vm.parmValue.start == "" && vm.parmValue.end != "")
+      ) {
+        vm.$message.warning("开始时间和结束时间不能为空");
+        return;
+      }
+
+      vm.loading = true;
+      const res = await asyncRequest.list({
+        ...vm.parmValue,
+        ...(vm.value ? { [vm.select]: vm.value } : {}),
+        ...(vm.parmValue.customer_code
+          ? { customer_code: vm.parmValue.customer_code[0] }
+          : {}),
+        ...(vm.parmValue.supplierNo ? { supplierNo: vm.parmValue.supplierNo[0] } : {}),
+      });
+
+      if (res && res.code === 0 && res.data) {
+        vm.tableData = res.data.list;
+        vm.pageInfo.total = Number(res.data.count);
+      } else if (res && res.code >= 100 && res.code <= 104) {
+        await vm.logout();
+      } else {
+        vm.tableData = [];
+        vm.pageInfo.total = 0;
+      }
+      vm.loading = false;
+    },
+  },
+};
+</script>
+
+<style lang="scss" scoped></style>

+ 122 - 122
src/views/reportQuery/stockReport/components/ExTableNew.vue

@@ -4,11 +4,11 @@
       <template v-for="(item, index) in table._defaultHeader_">
         <el-dropdown
           v-if="item == 'setcol'"
+          :key="index"
           placement="bottom-end"
           trigger="click"
           class="setcol-table-lie"
           :hide-on-click="false"
-          :key="index"
         >
           <el-button size="small">列设置</el-button>
           <el-dropdown-menu slot="dropdown" :class="'ex-table-setcol-dropdown'">
@@ -22,7 +22,7 @@
                   :active-text="column.label"
                   :active-value="false"
                   :inactive-value="true"
-                ></el-switch>
+                />
               </el-dropdown-item>
             </template>
           </el-dropdown-menu>
@@ -32,31 +32,31 @@
         name="table-header"
         :selection="tableSelection"
         :alldata="data"
-      ></slot>
+      />
     </div>
     <el-table
       ref="elTable"
       :data="data"
       v-bind="table"
       :size="size"
-      v-on="$listeners"
-      @selection-change="tableSelection = $event"
       :span-method="arraySpanMethod"
       style="width: 100%"
+      v-on="$listeners"
+      @selection-change="tableSelection = $event"
     >
       <template v-for="(column, index) in columns">
         <el-table-column
-          align="center"
           v-if="!column._hidden_ && column.type && !column._slot_"
-          v-bind="column"
           :key="index"
+          align="center"
+          v-bind="column"
           width="45px"
-        ></el-table-column>
+        />
         <el-table-column
-        show-overflow-tooltip
           v-else-if="!column._hidden_"
-          v-bind="column"
           :key="index"
+          show-overflow-tooltip
+          v-bind="column"
         >
           <template slot="header" slot-scope="scope">
             <span>{{ column.label }}</span>
@@ -71,7 +71,7 @@
               />
               <el-tooltip
                 v-else
-                 
+
                 :effect="column._screen_tip_effect_ || 'dark'"
                 :content="column._screen_tip_ || '筛选'"
                 :placement="column._screen_tip_placement_ || 'top'"
@@ -88,13 +88,13 @@
             slot-scope="scope"
             :name="column._slot_"
             :scope="scope"
-          ></slot>
+          />
           <template v-else-if="column._render_" slot-scope="scope">
             <ex-slot
               :column="column"
               :render="column._render_"
               :scope="scope"
-            ></ex-slot>
+            />
           </template>
           <template v-else slot-scope="scope">
             <span>{{
@@ -138,28 +138,62 @@
 </template>
 
 <script>
-import Sortable from "sortablejs";
+import Sortable from 'sortablejs'
 export default {
-  name: "ex-table",
+  name: 'ExTable',
   components: {
-    "ex-slot": {
+    'ex-slot': {
       functional: true,
       props: {
         render: Function,
         scope: {
           type: Object,
-          default: null,
+          default: null
         },
         column: {
           type: Object,
-          default: null,
-        },
+          default: null
+        }
       },
       render: (h, data) => {
-        if (data.props.column) data.props.scope.column = data.props.column;
-        return data.props.render(h, data.props.scope);
-      },
-    },
+        if (data.props.column) data.props.scope.column = data.props.column
+        return data.props.render(h, data.props.scope)
+      }
+    }
+  },
+  directives: {
+    // v-drap  可拖拽指令
+    drap: {
+      inserted: function(element, binding) {
+        element.onmousedown = function(e) {
+          const el = binding.modifiers.parent ? element.parentNode : element
+          const bodyWidth = document.body.offsetWidth
+          const bodyHeight = document.body.offsetHeight
+          const elWidth = el.offsetWidth
+          const elHeight = el.offsetHeight
+          // 开始拖动,记录左上角坐标点
+          const disX = e.clientX - el.offsetLeft
+          const disY = e.clientY - el.offsetTop
+          document.onmousemove = function(e) {
+            // 拖动中,修改dom的左上角坐标点
+            let l = e.clientX - disX
+            let t = e.clientY - disY
+            if (binding.modifiers.limit) {
+              l = l < 0 ? 0 : l
+              t = t < 0 ? 0 : t
+              l = l > bodyWidth - elWidth ? bodyWidth - elWidth : l
+              t = t > bodyHeight - elHeight ? bodyHeight - elHeight : t
+            }
+            el.style.left = l + 'px'
+            el.style.top = t + 'px'
+          }
+          document.onmouseup = function() {
+            // 结束拖动
+            document.onmousemove = null
+          }
+        }
+      }
+    }
   },
   props: {
     /**
@@ -175,12 +209,12 @@ export default {
      */
     table: {
       type: Object,
-      default: () => {},
+      default: () => {}
     },
     // el-table 表格数据 对应data字段
     data: {
       type: Array,
-      default: () => [],
+      default: () => []
     },
     /**
      * el-table-column 表格列属性集合
@@ -202,7 +236,7 @@ export default {
      */
     columns: {
       type: Array,
-      default: () => [],
+      default: () => []
     },
     /**
      * el-pagination
@@ -218,119 +252,85 @@ export default {
      */
     page: {
       type: [Boolean, Object],
-      default: false,
+      default: false
     },
     /**
      * 筛选条件集合
      */
     conditions: {
       type: Array,
-      default: () => [],
+      default: () => []
     },
     /**
      * 是否允许拖拽行
      */
     isRowDrop: {
       type: Boolean,
-      default: false,
+      default: false
     },
     /**
      * 是否允许拖拽列
      */
     isColDrop: {
       type: Boolean,
-      default: false,
+      default: false
     },
     /**
      * 表格大小
      */
     size: {
       type: String,
-      default: "mini",
-    },
+      default: 'mini'
+    }
+  },
+  data() {
+    return {
+      // 表格选中项
+      tableSelection: []
+    }
   },
   computed: {
     // 允许筛选的列
     screenColumns() {
-      return this.columns.filter((item) => item._screen_ === true);
+      return this.columns.filter((item) => item._screen_ === true)
     },
     // 允许设置的列
     setColumns() {
-      return this.columns.filter((item) => !item._noset_);
+      return this.columns.filter((item) => !item._noset_)
     },
     // 筛选条件是否包含当前列
     isHasScreenColumn() {
-      return function (col) {
-        return this.conditions.some((item) => item.prop === col.prop);
-      };
-    },
-  },
-  data() {
-    return {
-      // 表格选中项
-      tableSelection: [],
-    };
+      return function(col) {
+        return this.conditions.some((item) => item.prop === col.prop)
+      }
+    }
   },
-   computed: {
+  computed: {
     page_curr() {
-      return this.page.curr;
+      return this.page.curr
     },
     page_size() {
-      return this.page.size;
+      return this.page.size
     },
     page_total() {
-      return this.page.total;
-    },
+      return this.page.total
+    }
   },
   watch: {
-    page_curr: function (val) {
-      this.page.curr = val;
+    page_curr: function(val) {
+      this.page.curr = val
     },
-    page_size: function (val) {
-      this.page.size = val;
-    },
-    page_total: function (val) {
-      this.page.total = val;
+    page_size: function(val) {
+      this.page.size = val
     },
+    page_total: function(val) {
+      this.page.total = val
+    }
   },
   mounted() {
     // 拖拽绑定
-    this.rowDrop();
-    this.columnDrop();
-  },
-  directives: {
-    // v-drap  可拖拽指令
-    drap: {
-      inserted: function (element, binding) {
-        element.onmousedown = function (e) {
-          let el = binding.modifiers.parent ? element.parentNode : element,
-            bodyWidth = document.body.offsetWidth,
-            bodyHeight = document.body.offsetHeight,
-            elWidth = el.offsetWidth,
-            elHeight = el.offsetHeight;
-          // 开始拖动,记录左上角坐标点
-          let disX = e.clientX - el.offsetLeft;
-          let disY = e.clientY - el.offsetTop;
-          document.onmousemove = function (e) {
-            // 拖动中,修改dom的左上角坐标点
-            let l = e.clientX - disX;
-            let t = e.clientY - disY;
-            if (binding.modifiers.limit) {
-              l = l < 0 ? 0 : l;
-              t = t < 0 ? 0 : t;
-              l = l > bodyWidth - elWidth ? bodyWidth - elWidth : l;
-              t = t > bodyHeight - elHeight ? bodyHeight - elHeight : t;
-            }
-            el.style.left = l + "px";
-            el.style.top = t + "px";
-          };
-          document.onmouseup = function () {
-            // 结束拖动
-            document.onmousemove = null;
-          };
-        };
-      },
-    },
+    this.rowDrop()
+    this.columnDrop()
   },
   methods: {
     //
@@ -348,79 +348,79 @@ export default {
         if (rowIndex % 2 === 0) {
           return {
             rowspan: 2,
-            colspan: 1,
-          };
+            colspan: 1
+          }
         } else {
           return {
             rowspan: 0,
-            colspan: 0,
-          };
+            colspan: 0
+          }
         }
       }
     },
 
-    //行拖拽
+    // 行拖拽
     rowDrop() {
       const tbody = document.querySelector(
-        ".el-table__body-wrapper > table > tbody"
-      );
+        '.el-table__body-wrapper > table > tbody'
+      )
       Sortable.create(tbody, {
         disabled: !this.isRowDrop,
-        ghostClass: "sortable-ghost",
+        ghostClass: 'sortable-ghost',
         animation: 180,
         delay: 0,
         onEndevt: (evt) => {
-          const currItem = this.data.splice(evt.oldIndex, 1)[0];
-          this.data.splice(evt.newIndex, 0, currItem);
-        },
-      });
+          const currItem = this.data.splice(evt.oldIndex, 1)[0]
+          this.data.splice(evt.newIndex, 0, currItem)
+        }
+      })
     },
-    //列拖拽
+    // 列拖拽
     columnDrop() {
-      const wrapperTr = document.querySelector(".el-table__header-wrapper tr");
+      const wrapperTr = document.querySelector('.el-table__header-wrapper tr')
       Sortable.create(wrapperTr, {
         disabled: !this.isColDrop,
-        ghostClass: "sortable-ghost",
+        ghostClass: 'sortable-ghost',
         animation: 180,
         delay: 0,
         onEnd: (evt) => {
-          const currItem = this.columns.splice(evt.oldIndex, 1)[0];
-          this.columns.splice(evt.newIndex, 0, currItem);
-        },
-      });
+          const currItem = this.columns.splice(evt.oldIndex, 1)[0]
+          this.columns.splice(evt.newIndex, 0, currItem)
+        }
+      })
     },
     // 获取对象的属性
     getObjPrototype(o, a) {
-      let fn = Function;
-      return new fn("obj", `return obj.${a}`)(o);
+      const fn = Function
+      return new fn('obj', `return obj.${a}`)(o)
     },
     /** 表格方法 传递给el-table,后续有需要可继续增加 **/
     // 对 Table 进行重新布局。当 Table 或其祖先元素由隐藏切换为显示时,可能需要调用此方法
     doLayout(...arg) {
-      this.$refs.elTable.doLayout(...arg);
+      this.$refs.elTable.doLayout(...arg)
     },
     // 用于多选表格,清空用户的选择
     clearSelection(...arg) {
-      this.$refs.elTable.clearSelection(...arg);
+      this.$refs.elTable.clearSelection(...arg)
     },
     // 用于多选表格,切换某一行的选中状态
     toggleRowSelection(...arg) {
-      this.$refs.elTable.toggleRowSelection(...arg);
+      this.$refs.elTable.toggleRowSelection(...arg)
     },
     // 用于多选表格,切换所有行的选中状态
     toggleAllSelection(...arg) {
-      this.$refs.elTable.toggleAllSelection(...arg);
+      this.$refs.elTable.toggleAllSelection(...arg)
     },
     // 用于单选表格,设定某一行为选中行
     setCurrentRow(...arg) {
-      this.$refs.elTable.setCurrentRow(...arg);
+      this.$refs.elTable.setCurrentRow(...arg)
     },
     // 用于可展开表格与树形表格,切换某一行的展开状态,如果使用了第二个参数,则是设置这一行展开与否(expanded 为 true 则展开)
     toggleRowExpansion(...arg) {
-      this.$refs.elTable.toggleRowExpansion(...arg);
-    },
-  },
-};
+      this.$refs.elTable.toggleRowExpansion(...arg)
+    }
+  }
+}
 </script>
 
 <style lang="css">

+ 5 - 5
src/views/serviceParam/supplier/index.vue

@@ -385,11 +385,11 @@ export default {
           label: "负责人",
           minWidth: "100",
         },
-        {
-          prop: "company_name",
-          label: "创建人部门",
-          minWidth: "120px",
-        },
+        // {
+        //   prop: "company_name",
+        //   label: "创建人部门",
+        //   minWidth: "120px",
+        // },
         {
           prop: "creater",
           label: "创建人",