loulijun2021
2023-02-10 418a2d2f1271f2fa05a8560ac497203f0be1d64e
src/views/cggl/cgdd.vue
@@ -41,36 +41,53 @@
              <el-input v-model="form.mesordercode" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item label="采购供方" style=" display:flex;">
              <el-input v-model="form.OrgName" placeholder="请输入" style="width: 200px" />
              <el-select
                v-model="form.customercode"
                :popper-append-to-body="false"
                filterable
                style="width: 200px"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in customercodeArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="单据日期" style="display: flex;">
              <!--              <el-select v-model="form.orderdate" style="width: 200px" placeholder="请选择">-->
              <!--                <el-date-picker-->
              <!--                  v-model="form.orderdate"-->
              <!--                  style="width: 200px"-->
              <!--                  type="date"-->
              <!--                  placeholder="选择日期"-->
              <!--                />-->
              <!--              </el-select>-->
              <el-date-picker
                v-model="form.orderdate"
                style="width: 200px"
                type="date"
                placeholder="选择日期"
                type="daterange"
                :clearable="false"
                class="timeMini"
                range-separator="~"
                start-placeholder="开始日期"
                style="width: 200px;display: flex;line-height: 34px ;height: 34px ;"
                end-placeholder="结束日期"
                size="mini"
              />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="源单单号" style="display: flex;">
              <el-input v-model="form.sourceorder" placeholder="请输入" style="width: 200px" />
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="部门信息" style="display: flex;">
              <el-cascader
                ref="cascader"
              <el-select
                v-model="form.deptcode"
                :popper-append-to-body="false"
                filterable
                popper-class="elCascader"
                :options="deptcodeArr"
                :props="defaultProps"
                @change="cascaderChange"
              />
                style="width: 200px"
                placeholder="请选择"
              >
                <el-option
                  v-for="item in deptcodeArr"
                  :key="item.code"
                  :label="item.name"
                  :value="item.code"
                />
              </el-select>
            </el-form-item>
            <el-form-item v-show="isExpandForm" label="创建人员" style="display: flex;">
              <el-input v-model="form.creatuser" placeholder="请输入" style="width: 200px" />
@@ -78,13 +95,21 @@
            <el-form-item v-show="isExpandForm" label="创建时间" style="display: flex;">
              <el-date-picker
                v-model="form.createdate"
                style="width: 200px"
                type="date"
                placeholder="选择日期"
                type="daterange"
                :clearable="false"
                class="timeMini"
                range-separator="~"
                start-placeholder="开始日期"
                style="width: 200px;display: flex;line-height: 34px ;height: 34px ;"
                end-placeholder="结束日期"
                size="mini"
              />
            </el-form-item>
          </div>
          <div class="bodySearchReset" :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}">
          <div
            class="bodySearchReset"
            :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
          >
            <el-button v-waves type="primary" icon="el-icon-search" @click="search">查询</el-button>
            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">重置</el-button>
          </div>
@@ -113,15 +138,28 @@
          ref="tableDataRef"
          class="tableFixed"
          :data="tableData"
          :height="isExpandForm?tableHeight:(tableHeight+40)+'px'"
          :height="isExpandForm?(tableHeight+40):(tableHeight+80)+'px'"
          border
          :row-class-name="tableRowClassName"
          :style="{width: 100+'%',height:isExpandForm?tableHeight:(tableHeight+40)+'px',}"
          :style="{width: 100+'%',height:isExpandForm?(tableHeight+40):(tableHeight+80)+'px'}"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
          @sort-change="sortChange"
          @row-click="rowClick"
        >
          <el-table-column
            width="50"
            fixed
          >
            <template slot-scope="{row}">
              <el-radio
                v-model="radioSelected"
                :label="row.ordercode"
                style="color: transparent;padding-left: 10px;"
              />
            </template>
          </el-table-column>
          <el-table-column
            prop="RowNum"
            width="50"
@@ -158,21 +196,36 @@
            width="130"
            show-tooltip-when-overflow
            sortable="custom"
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.deptname">{{ row.deptname }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="customername"
            label="往来单位"
            label="采购供方"
            sortable="custom"
            min-width="180"
            show-tooltip-when-overflow
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.customername">{{ row.customername }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="saleorderCode"
            label="源单单号"
            sortable="custom"
            width="160"
            show-tooltip-when-overflow
          />
          >
            <template slot-scope="{row}">
              <div v-if="row.saleorderCode">{{ row.saleorderCode }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            prop="acceptdate"
            label="预计到货日期"
@@ -230,8 +283,13 @@
          >
            <template slot-scope="{row}">
              <div class="operationClass">
                <el-tooltip class="item" effect="dark" content="编辑" placement="top">
                  <i class="el-icon-edit-outline" @click="edit('edit',row)" />
                <el-tooltip class="item" effect="dark" content="关单" placement="top">
                  <i
                    class="el-icon-switch-button"
                    :style="{color:$store.state.settings.theme}"
                    style="margin-right: 15px;cursor: pointer"
                    @click="switchButton(row)"
                  />
                </el-tooltip>
                <el-tooltip v-del-tab-index class="item" effect="dark" content="删除" placement="top">
                  <i class="el-icon-delete" @click="del(row)" />
@@ -251,6 +309,130 @@
        popper-class="select_bottom"
        @pagination="getPurchaseOrderSearch"
      />
      <div class="elTableDiv">
        <el-table
          :data="tableDataDetail"
          border
          height="210px"
          :row-class-name="tableRowClassName"
          highlight-current-row
          :header-cell-style="this.$headerCellStyle"
          :cell-style="this.$cellStyle"
        >
          <el-table-column
            width="50"
            type="index"
            label="序号"
            fixed
          />
          <el-table-column
            prop="partcode"
            label="产品编码"
            width="160"
            show-tooltip-when-overflow
          />
          <el-table-column
            prop="partname"
            label="产品名称"
            width="200"
            show-tooltip-when-overflow
          />
          <el-table-column
            label="产品规格"
            prop="partspec"
            show-tooltip-when-overflow
            width="150"
          >
            <template slot-scope="{row}">
              <div v-if="row.partspec">{{ row.partspec }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            label="单位"
            show-tooltip-when-overflow
            prop="uomname"
            width="100"
          />
          <el-table-column
            label="数量"
            show-tooltip-when-overflow
            prop="quantity"
          />
          <el-table-column
            label="累积到货数量"
            show-tooltip-when-overflow
            prop="countarrivalquantity"
          />
          <el-table-column
            label="累计入库数量"
            show-tooltip-when-overflow
            prop="countInquantity"
          >
            <template slot-scope="{row}">
              <div v-if="row.countInquantity">{{ row.countInquantity }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            label="预计到货日期"
            show-tooltip-when-overflow
            prop="acceptdate"
          >
            <template slot-scope="{row}">
              <div v-if="row.acceptdate">{{ row.acceptdate.substring(0, 11) }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            label="仓库"
            show-tooltip-when-overflow
            prop="housename"
          >
            <template slot-scope="{row}">
              <div v-if="row.housename">{{ row.housename }}</div>
              <div v-else>/</div>
            </template>
          </el-table-column>
          <el-table-column
            label="是否检验"
            show-tooltip-when-overflow
            prop="is_incheck"
          >
            <template slot-scope="{row}">
              <div v-if="row.is_incheck==='Y'">
                <i class="el-icon-success" :style="{color:$store.state.settings.theme}" style="margin-right: 2px" />
                是
              </div>
              <div v-if="row.is_incheck==='N'">
                <i class="el-icon-info" style="margin-right: 2px" />
                否
              </div>
            </template>
          </el-table-column>
          <!--          <el-table-column-->
          <!--            label="操作"-->
          <!--            width="120"-->
          <!--            fixed="right"-->
          <!--          >-->
          <!--            <template slot-scope="{row}">-->
          <!--              <div class="operationClass">-->
          <!--                <el-tooltip class="item" effect="dark" content="打印工序" placement="top">-->
          <!--                  <i-->
          <!--                    class="el-icon-printer"-->
          <!--                    :style="{color:$store.state.settings.theme}"-->
          <!--                    style="cursor: pointer;margin-right: 15px"-->
          <!--                    @click="supplementSmallClick(row)"-->
          <!--                  />-->
          <!--                </el-tooltip>-->
          <!--              </div>-->
          <!--            </template>-->
          <!--          </el-table-column>-->
        </el-table>
      </div>
    </div>
  </div>
@@ -258,17 +440,11 @@
<script>
import Pagination from '@/components/Pagination'
import {
  AddUpdateOrganization,
  DeleteOrganization,
  OrganizationSearch,
  PrentOrganization,
  UserOrganization
} from '@/api/jcsz'
import clearAllChildren, { validateCode } from '@/utils/global'
import { handleDatetime } from '@/utils/global'
import waves from '@/directive/waves'
import { SeaveSearchErpOrder, SeaveSearchErpPurchaseOrder } from '@/api/ErpSyncMes'
import { PurchaseOrderSearch } from '@/api/cggl'
import { SeaveSearchErpPurchaseOrder } from '@/api/ErpSyncMes'
import { ClosedPurchaseOrder, DeletePurchaseOrder, PurchaseOrderSearch, PurchaseOrderSubSearch } from '@/api/cggl'
import { DepartMentSelect, PurchSupplierSelect } from '@/api/jbzl'
export default {
  name: 'Zzjg',
@@ -306,31 +482,76 @@
      ],
      total: 10,
      tableData: [],
      defaultProps: {
        checkStrictly: true,
        value: 'code',
        label: 'name',
        children: 'children'
      },
      deptcodeArr: [] // 部门信息
      radioSelected: '',
      deptcodeArr: [], // 部门信息数组
      customercodeArr: [], // 采购供方数组
      tableDataDetail: []
    }
  },
  created() {
    this.getPurchaseOrderSearch()
    this.getUserOrganization()
    this.handleRequest()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
    this.getHeight()
  },
  methods: {
    handleRequest() {
      this.getPurchaseOrderSearch().then(res => {
        if (res.code === '200') {
          this.getDepartMentSelect()
          this.getPurchSupplierSelect()
        }
      })
    },
    async getPurchaseOrderSearch() {
      const res = await PurchaseOrderSearch(this.form)
      let tempDate2 = this.form.orderdate
      if (tempDate2.length > 0) {
        tempDate2 = handleDatetime(tempDate2[0]) + '~' + handleDatetime(tempDate2[1])
      }
      let tempDate = this.form.createdate
      if (tempDate.length > 0) {
        tempDate = handleDatetime(tempDate[0]) + '~' + handleDatetime(tempDate[1])
      }
      const data = {
        mesorderstus: this.form.mesorderstus,
        mesordercode: this.form.mesordercode,
        customercode: this.form.customercode,
        orderdate: tempDate2,
        sourceorder: this.form.sourceorder,
        deptcode: this.form.deptcode,
        creatuser: this.form.creatuser,
        createdate: tempDate,
        prop: this.form.prop, // 排序字段
        order: this.form.order, // 排序字段
        page: this.form.page, // 第几页
        rows: this.form.rows // 每页多少条
      }
      const res = await PurchaseOrderSearch(data)
      this.tableData = res.data
      this.total = res.count
      return { code: res.code }
    },
    // 获取部门信息
    async getDepartMentSelect() {
      const { data: res } = await DepartMentSelect()
      // this.deptcodeArr = clearAllChildren(res)
      this.deptcodeArr = res
    },
    // 采购供方信息查询
    async   getPurchSupplierSelect() {
      const { data: res } = await PurchSupplierSelect()
      this.customercodeArr = res
    },
    // 排序改变时
    sortChange({ column, prop, order }) {
      if (order === 'descending') {
@@ -358,19 +579,16 @@
      this.form.deptcode = ''
      this.form.creatuser = ''
      this.form.createdate = ''
      this.$refs.cascader.checkedValue = ''// 级联选择器的清空
      this.getPurchaseOrderSearch()
    },
    // 获取部门信息
    async getUserOrganization() {
      const { data: res } = await UserOrganization()
      this.deptcodeArr = clearAllChildren(res)
      console.log(this.deptcodeArr, 888)
    },
    // 级联选择器改变事件
    cascaderChange(val) {
      this.form.deptcode = val[val.length - 1]
    async switchButton(row) {
      ClosedPurchaseOrder({ po: row.ordercode }).then(res => {
        if (res.code === '200') {
          this.$message.success('关单成功!')
          this.getPurchaseOrderSearch()
        }
      })
    },
    // 删除按钮
    async del(row) {
@@ -379,7 +597,7 @@
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        DeleteOrganization({ orgid: row.code }).then(res => {
        DeletePurchaseOrder({ po: row.ordercode }).then(res => {
          if (res.code === '200') {
            this.$message.success('删除成功!')
            if (this.form.page > 1 && this.tableData.length === 1) {
@@ -419,11 +637,24 @@
        // }
      })
    },
    //  行点击事件
    async rowClick(row, event, column) {
      this.radioSelected = row.ordercode
      const { data: res } = await PurchaseOrderSubSearch({ purodercode: this.radioSelected })
      this.tableDataDetail = res
    },
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
        this.mainHeight = window.innerHeight - 85
        this.tableHeight = this.mainHeight - 255
        // this.tableHeight = this.mainHeight - 250
        this.tableHeight = this.mainHeight - 515
        if (window.innerHeight < 769) {
          this.tableHeight = this.tableHeight - 20
        }
        this.isIpad = window.innerHeight < 769 && window.innerWidth < 1367
        this.$refs.tableDataRef.doLayout()
      })
    },
@@ -437,15 +668,22 @@
<!--公共页面样式-->
<style lang="scss" scoped>
$main_color: #42b983;
::v-deep .el-button--text{
  font-size: 14px ;
  cursor: pointer ;
::v-deep .el-radio__label {
  display: none !important;
}
.el-icon-share ,.el-icon-delete,.el-icon-edit-outline{
::v-deep .el-button--text {
  font-size: 14px;
  cursor: pointer;
}
.el-icon-share, .el-icon-delete, .el-icon-edit-outline {
  color: $main_color;
  cursor: pointer;
}
.el-icon-edit-outline{
.el-icon-edit-outline {
  margin-right: 15px;
}
@@ -506,8 +744,8 @@
  background-color: #f8f8fa;
}
::v-deep .el-table__body .el-table__row.hover-row td{
  background-color: #eaecef ;
::v-deep .el-table__body .el-table__row.hover-row td {
  background-color: #eaecef;
}
::v-deep .el-form--inline .el-form-item__label {
@@ -528,17 +766,18 @@
  margin-bottom: 0;
}
::v-deep .el-select__caret{
::v-deep .el-select__caret {
  display: flex;
  align-items: center;
  justify-content: center;
}
.tableFixed{
  ::v-deep .el-table__fixed-right{
.tableFixed {
  ::v-deep .el-table__fixed-right {
    height: 100% !important;
  }
  ::v-deep .el-table__fixed{
  ::v-deep .el-table__fixed {
    height: 100% !important;
  }
}