小小儁爺
2024-08-01 bb2ed2e56da26a6b79575f5be9f60ca2d90774d0
1.工序、工价界面优化
已修改3个文件
232 ■■■■ 文件已修改
src/api/GeneralBasicData.js 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicSettings/meterPrice.vue 134 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/basicSettings/processList.vue 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/api/GeneralBasicData.js
@@ -157,6 +157,24 @@
  })
}
// 往来单位类型基础资料
export function CustomerTypePermissions(data) {
  return request({
    url: 'GeneralBasicData/CustomerTypePermissions',
    method: 'get',
    params: data
  })
}
// 往来单位类型查找往来单位基础资料
export function CustomerTypeSearchPermission(data) {
  return request({
    url: 'GeneralBasicData/CustomerTypeSearchPermissions',
    method: 'get',
    params: data
  })
}
// 存货树型基础资料
export function InventoryTreePermissions(data) {
  return request({
src/views/basicSettings/meterPrice.vue
@@ -192,7 +192,7 @@
      :title="operation==='add'?'新增':'编辑'"
      :visible.sync="dialogVisible"
      width="1100px"
      top="15vh"
      top="5vh"
      :close-on-click-modal="false"
      @closed="handleClose"
      @close="handleClose"
@@ -252,28 +252,101 @@
          </el-form-item>
        </div>
      </el-form>
      <!--      :expand-row-keys="expandRowKeys"-->
      <!--      row-key="code"-->
      <el-table
        :data="stepDialogArr"
        style="width: 100%"
        height="300"
        height="600"
        border
        :header-cell-style="this.$headerCellStyle"
        :cell-style="this.$cellStyle"
        :row-class-name="tableRowClassName"
      >
        <el-table-column type="expand">
          <template slot-scope="props">
            <el-table
              :data="props.row.children"
              style="width: 96%;margin: auto;"
              border
              :row-class-name="tableRowClassName"
            >
        <el-table-column
          prop="step_seq"
                prop="eqp_code"
                label="设备/往来编码"
                min-width="120"
              />
              <el-table-column
                prop="eqp_name"
                label="设备/往来名称"
                min-width="120"
              />
              <el-table-column
                prop="eqp_value"
                label="设备节拍"
                min-width="150"
              >
                <template slot-scope="{row}">
                  <div style="display: flex">
                    <el-input
                      v-model="row.eqp_value"
                      placeholder="请输入"
                      oninput="value=value.replace(/[^0-9.]/g,'')"
                      @change="val=>eqpValueChange(val,row)"
                    />
                    <div style="margin-left: 5px">秒</div>
                  </div>
                </template>
              </el-table-column>
              <el-table-column
                prop="stand_value"
                label="生产节拍"
                min-width="120"
              >
                <template slot-scope="{row}">
                  <div>{{ row.stand_value + ' ' + '秒' }}</div>
                </template>
              </el-table-column>
              <el-table-column
                prop="cavity_qty"
                label="腔型数"
                min-width="120"
              >
                <template slot-scope="{row}">
                  <el-input
                    v-model="row.cavity_qty"
                    placeholder="请输入"
                    oninput="value=value.replace(/[^0-9.]/g,'')"
                    @change="val=>cavityQtyChange(val,row)"
                  />
                </template>
              </el-table-column>
              <el-table-column
                prop="unprice"
                label="工序工价"
                min-width="120"
              >
                <template slot-scope="{row}">
                  <el-input v-model="row.unprice" oninput="value=value.replace(/[^0-9.]/g,'')" />
                </template>
              </el-table-column>
            </el-table>
          </template>
        </el-table-column>
        <el-table-column
          prop="seq"
          label="工序顺序"
          width="100"
        />
        <el-table-column
          prop="step_code"
          prop="code"
          label="工序编码"
          width="200"
        />
        <el-table-column
          prop="step_name"
          prop="name"
          label="工序名称"
          width="200"
        />
@@ -479,8 +552,9 @@
      editPartName: '', // 编辑时产品名称
      editRouteName: '', // 编辑时工艺路线名称
      editStepName: '', // 编辑时加工工序名称
      operation: ''
      operation: '',
      expandRowKeys: []// 默认展开
    }
  },
@@ -581,6 +655,12 @@
    async routeDialogChange(val) {
      const { data: res } = await RouteSelectStep({ partcode: this.dialogForm.partcode, routecode: val })
      this.stepDialogArr = res
      this.expandRowKeys = this.stepDialogArr.map(i => {
        if (i.children.length > 0) {
          return i.code
        }
      })
    },
    // 新增按钮
@@ -654,22 +734,22 @@
      this.$refs.dialogForm.validate(valid => {
        if (valid) {
          const children = []
          this.stepDialogArr.forEach(i => {
            children.push({
              'code': i.step_code,
              'name': i.step_name,
              'seq': i.step_seq,
              'isbott': i.isbott,
              'isend': i.isend,
              'unprice': i.unprice
            })
          })
          // this.stepDialogArr.forEach(i => {
          //   children.push({
          //     'code': i.step_code,
          //     'name': i.step_name,
          //     'seq': i.step_seq,
          //     'isbott': i.isbott,
          //     'isend': i.isend,
          //     'unprice': i.unprice
          //   })
          // })
          const data = [
            {
              'partcode': this.dialogForm.partcode,
              'defaultroute_code': this.dialogForm.routecode,
              'children': children
              'children': this.stepDialogArr
            }
          ]
          SaveBeatRate(data).then(res => {
@@ -684,7 +764,23 @@
        }
      })
    },
    // 设备节拍值改变
    eqpValueChange(val, row) {
      console.log(val, row)
      if (parseFloat(row.cavity_qty) !== 0) {
        row.stand_value = parseFloat((parseFloat(val) / parseFloat(row.cavity_qty)).toFixed(2))
      } else {
        row.stand_value = 0
      }
    },
    // 腔型数值改变
    cavityQtyChange(val, row) {
      if (parseFloat(val) !== 0) {
        row.stand_value = parseFloat((parseFloat(row.eqp_value) / parseFloat(val)).toFixed(2))
      } else {
        row.stand_value = 0
      }
    },
    // 获取页面高度
    getHeight() {
      this.$nextTick(() => {
src/views/basicSettings/processList.vue
@@ -229,7 +229,7 @@
    >
      <el-divider content-position="left">基本信息</el-divider>
      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="80px">
      <el-form ref="dialogForm" inline :rules="dialogFormRules" :model="dialogForm" label-width="110px">
        <el-form-item label="工序编码" prop="stepcode">
          <el-input v-model="dialogForm.stepcode" :disabled="operation!=='add'" style="width: 200px" />
        </el-form-item>
@@ -244,6 +244,7 @@
            :popper-append-to-body="false"
            @change="steptypecodeChange"
          >
            <el-option
              v-for="item in steptypeArr"
              :key="item.code"
@@ -253,9 +254,8 @@
          </el-select>
        </el-form-item>
        <el-form-item v-if="dialogForm.steptypecode==='Z'" label="所属车间" required>
        <el-form-item v-if="dialogForm.steptypecode==='Z'" label="所属车间">
          <el-select
            v-model="dialogForm.Wkshop"
            style="width:200px"
            placeholder="请选择"
@@ -269,6 +269,25 @@
              :key="item.torg_code"
              :label="item.torg_name"
              :value="item.torg_code"
            />
          </el-select>
        </el-form-item>
        <el-form-item v-if="dialogForm.steptypecode==='W'" label="往来单位类型">
          <el-select
            v-model="dialogForm.CustomerType"
            style="width:200px"
            placeholder="请选择"
            multiple
            collapse-tags
            :popper-append-to-body="false"
            @change="CustomerTypeChange"
          >
            <el-option
              v-for="item in CustomerTypeArr"
              :key="item.code"
              :label="item.name"
              :value="item.code"
            />
          </el-select>
        </el-form-item>
@@ -410,7 +429,13 @@
import elDragDialog from '@/directive/el-drag-dialog'
import waves from '@/directive/waves'
import $ from 'jquery'
import { CustomerPermissions, TorgWkshop, WkshopEqpPermissions } from '@/api/GeneralBasicData'
import {
  CustomerPermissions,
  CustomerTypePermissions,
  CustomerTypeSearchPermission,
  TorgWkshop,
  WkshopEqpPermissions
} from '@/api/GeneralBasicData'
export default {
  name: 'Zzjg',
@@ -427,8 +452,8 @@
        stepname: '', //
        enable: '', //
        steptypecode: '', // 工序类型
        prop: 'stepcode', // 排序字段
        order: 'asc', // 排序字段
        prop: 'lm_date', // 排序字段
        order: 'desc', // 排序字段
        page: 1, // 第几页
        rows: 20 // 每页多少条
      },
@@ -443,12 +468,14 @@
        { code: 'N', name: '停用' }
      ],
      WkshopArr: [], // 车间下拉数组
      CustomerTypeArr: [], // 往来单位下拉数组
      dialogVisible: false,
      dialogForm: {
        id: '',
        stepcode: '', //
        stepname: '', //
        Wkshop: '', //
        CustomerType: '', //
        steptypecode: 'Z',
        description: '', // 描述
        enable: 'Y'// 状态
@@ -486,6 +513,7 @@
  created() {
    this.getStepSearch()
    this.getTorgWkshop()
    this.getCustomerTypePermissions()
  },
  mounted() {
    window.addEventListener('resize', this.getHeight)
@@ -503,6 +531,11 @@
      const { data: res } = await TorgWkshop()
      this.WkshopArr = res
    },
    // 往来单位类型
    async getCustomerTypePermissions() {
      const { data: res } = await CustomerTypePermissions()
      this.CustomerTypeArr = res
    },
    // 查看往来资料
    async getCustomerPermissions() {
      const { data: res } = await CustomerPermissions()
@@ -515,21 +548,39 @@
    },
    async steptypecodeChange(val) {
      if (val === 'W') { // 外协
        await this.getCustomerPermissions()
      } else { // 自制
      // if (val === 'W') { // 外协
      //   this.dialogForm.CustomerType = []
      //   // await this.getCustomerPermissions()
      // } else { // 自制
      //   this.dialogForm.Wkshop = []
      // }
      this.dialogForm.CustomerType = []
        this.dialogForm.Wkshop = []
        this.dialogTreeArr = []
      }
    },
    // 车间值改变时触发
    async WkshopChange(val) {
      if (val.length === 0) {
        this.dialogTreeArr = []
        return
      }
      const { data: res } = await WkshopEqpPermissions({ wkshopcode: val.join(',') })
      this.dialogTreeArr = [
        { code: '',
          name: '全部',
          children: res
        }
      ]
    },
    // 往来单位类型值改变时
    async CustomerTypeChange(val) {
      if (val.length === 0) {
        this.dialogTreeArr = []
        return
      }
      const { data: res } = await CustomerTypeSearchPermission({ customertypecode: val.join(',') })
      this.dialogTreeArr = [
        { code: '',
          name: '全部',
@@ -585,14 +636,17 @@
        })
        await this.WkshopChange(this.dialogForm.Wkshop)
      } else if (row.flwtype === 'W') {
        await this.steptypecodeChange(row.flwtype)
        this.dialogForm.CustomerType = []
        // await this.steptypecodeChange(row.flwtype)
        res.filter(i => i.type === 'W' && i.flag === 'Y').forEach(i => {
          this.dialogForm.CustomerType.push(i.code)
          i.children.forEach(j => {
            if (j.flag === 'Y') {
              this.dialogTreeSelectedArr.push(j.code)
            }
          })
        })
        await this.CustomerTypeChange(this.dialogForm.CustomerType)
      }
      this.$nextTick(() => {
@@ -636,7 +690,7 @@
      this.dialogForm.steptypecode = 'Z'
      this.dialogTreeArr = []
      this.dialogForm.Wkshop = []
      this.dialogForm.CustomerType = []
      this.dialogTreeSelectedArr = []
      this.$refs.dialogForm.clearValidate()
    },