Quellcode durchsuchen

Merge branch 'master' of http://120.46.159.163:7400/ezhizao/ezhizao_dms_vue

wangxin vor 10 Monaten
Ursprung
Commit
d4d2834edd

+ 10 - 0
babel.config.js

@@ -0,0 +1,10 @@
+module.exports = {
+  "plugins": [
+    [
+      "jsx",
+      {
+        "preserve": true
+      }
+    ]
+  ]
+}

+ 3 - 1
package.json

@@ -38,10 +38,12 @@
     "sortablejs": "^1.15.2",
     "vue": "3.2.45",
     "vue-cropper": "1.0.3",
-    "vue-router": "4.1.4"
+    "vue-router": "4.1.4",
+    "vxe-table": "^4.7.59"
   },
   "devDependencies": {
     "@vitejs/plugin-vue": "3.1.0",
+    "@vue/babel-preset-jsx": "^1.4.0",
     "@vue/compiler-sfc": "3.2.45",
     "sass": "1.56.1",
     "unplugin-auto-import": "0.11.4",

+ 40 - 0
src/api/business/beforeCheckoutVerify.js

@@ -0,0 +1,40 @@
+import request from '@/utils/request'
+
+const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
+
+/**
+ * 获取 生产批次 列表
+ * @param {*} data
+ * @returns
+ */
+export function listCheckoutInspection(query) {
+  return request({
+    url: baseUrl + '/business/beforeCheckoutVerify/list',
+    method: 'get',
+    params: query
+  })
+}
+
+export function confirmInspection(data) {
+  return request({
+    url: baseUrl + '/business/beforeCheckoutVerify/confirm',
+    method: 'post',
+    data: data
+  })
+}
+
+export function rejectInspection(data) {
+  return request({
+    url: baseUrl + '/business/beforeCheckoutVerify/reject',
+    method: 'post',
+    data: data
+  })
+}
+
+export function checkFurnace(data) {
+  return request({
+    url: baseUrl + '/business/beforeCheckoutVerify/checkFurnace',
+    method: 'post',
+    data: data
+  })
+}

+ 68 - 0
src/api/business/outsourceBalanceAccount.js

@@ -0,0 +1,68 @@
+import request from '@/utils/request'
+const baseUrl = import.meta.env.VITE_APP_PRODUCTION_API
+
+// 查询外协结算列表
+export function listBalanceAccount(query) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询外协结算详细
+export function getBalanceAccount(id) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/' + id,
+    method: 'get'
+  })
+}
+
+// 新增外协结算
+export function addBalanceAccount(data) {
+  return request({
+    url: baseUrl + '/business/balanceAccount',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改外协结算
+export function updateBalanceAccount(data) {
+  return request({
+    url: baseUrl + '/business/balanceAccount',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除外协结算
+export function delBalanceAccount(id) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/' + id,
+    method: 'delete'
+  })
+}
+// 结算
+export function checkout(data) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/confirm',
+    method: 'post',
+    data: data
+  })
+}
+// 取消结算
+export function discheckout(data) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/cancel',
+    method: 'post',
+    data: data
+  })
+}
+export function saveBatchBalanceAccount(data) {
+  return request({
+    url: baseUrl + '/business/balanceAccount/saveBatch',
+    method: 'post',
+    data: data
+  })
+}

+ 53 - 0
src/api/business/outsourceBalanceMonth.js

@@ -0,0 +1,53 @@
+import request from '@/utils/request'
+
+const baseUrl = import.meta.env.VITE_APP_BASE_API
+// 查询外协结算月设置列表
+export function listOutsourceBalanceMonth(query) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询外协结算月设置详细
+export function getOutsourceBalanceMonth(id) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth/' + id,
+    method: 'get'
+  })
+}
+
+// 新增外协结算月设置
+export function addOutsourceBalanceMonth(data) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth',
+    method: 'post',
+    data: data
+  })
+}
+
+// 新增外协结算月设置
+export function saveOutsourceBalanceMonth(data) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth/save',
+    method: 'post',
+    data: data
+  })
+}
+// 修改外协结算月设置
+export function updateOutsourceBalanceMonth(data) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除外协结算月设置
+export function delOutsourceBalanceMonth(id) {
+  return request({
+    url: baseUrl + '/business/outsourceBalanceMonth/' + id,
+    method: 'delete'
+  })
+}

+ 8 - 0
src/api/business/returnReceipt.js

@@ -43,3 +43,11 @@ export function delReceipt(id) {
 		method: 'delete'
 	})
 }
+
+export function checkFurnace(data) {
+	return request({
+		url: baseUrl + '/business/returnReceipt/checkFurnace',
+		method: 'post',
+		data: data
+	})
+}

+ 7 - 0
src/main.js

@@ -5,6 +5,11 @@ import Cookies from 'js-cookie'
 import ElementPlus from 'element-plus'
 import locale from 'element-plus/lib/locale/lang/zh-cn' // 中文语言
 
+import VxeTable from 'vxe-table'
+import 'vxe-table/lib/style.css'
+import VxeUI from 'vxe-pc-ui'
+import 'vxe-pc-ui/lib/style.css'
+
 import moment from 'moment'
 moment.locale('zh-cn')
 
@@ -85,6 +90,8 @@ app.use(router)
 app.use(store)
 app.use(plugins)
 app.use(elementIcons)
+app.use(VxeTable)
+app.use(VxeUI)
 app.component('svg-icon', SvgIcon)
 
 directive(app)

+ 1 - 1
src/utils/request.js

@@ -18,7 +18,7 @@ const service = axios.create({
   // 因为对应了多个后端服务,这里不要统一定义前缀
   baseURL: '', //import.meta.env.VITE_APP_BASE_API
   // 超时
-  timeout: 100000
+  timeout: 1000000
 })
 
 // request拦截器

+ 501 - 0
src/views/business/outsourceBalanceAccounts/index.vue

@@ -0,0 +1,501 @@
+<template>
+  <div class="page-container column-container">
+    <div
+      style="position: absolute;  top: 0;  bottom: 0;  left: 0;  right: 0;z-index: 10; background-color: rgba(255, 255, 255, 0.5);"
+      v-if="showMask"></div>
+    <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+      <el-form-item label="结算日期:">
+        <el-date-picker v-model="queryParams.checkoutDate" type="date" value-format="YYYY-MM-DD" :clearable="true"
+          placeholder="结算日期" style="width: 130px" @change="handleDateChange" />
+      </el-form-item>
+      <el-form-item label="结束日期:">
+        <el-date-picker v-model="queryParams.endDate" type="date" value-format="YYYY-MM-DD" :clearable="true"
+          placeholder="结束日期" style="width: 130px" :disabled-date="(arg) => disabledDateHandler(arg, 'endDate')" />
+      </el-form-item>
+      <el-form-item label="结算月:">
+        <el-date-picker v-model="form.checkMonth" type="month" value-format="YYYY-MM-01" format="YYYY年MM月"
+          :clearable="true" placeholder="结算月" style="width: 130px" readonly />
+      </el-form-item>
+      <el-form-item label="外协单位:">
+        <el-input v-model.trim="queryParams.supplierName" placeholder="外协单位" style="width: 130px" />
+      </el-form-item>
+      <el-form-item label="结算状态:">
+        <el-select v-model="queryParams.status" placeholder="结算状态" style="width: 130px">
+          <el-option v-for="dict in outsource_checkout_status" :key="dict.value" :label="dict.label"
+            :value="dict.value" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="info" icon="Search" @click="handleQuery">搜索</el-button>
+      </el-form-item>
+    </el-form>
+    <!-- 功能按钮区 -->
+    <div class="list-btns-container">
+      <!-- <el-button type="primary" icon="DocumentChecked" @click="handleSave"
+        v-hasPermi="['business:balanceAccount:save']">
+        保存
+      </el-button> -->
+      <el-button type="success" icon="Plus" @click="handleBalance" v-hasPermi="['business:balanceAccount:confirm']">
+        结算
+      </el-button>
+      <el-button type="primary" icon="Select" @click="handleCheckAll">
+        全选
+      </el-button>
+      <el-button type="info" icon="Close" @click="handleDisbalance" v-hasPermi="['business:balanceAccount:cancel']">
+        取消结算
+      </el-button>
+      <el-button type="warning" icon="Download" @click="handleExport" v-hasPermi="['business:balanceAccount:export']">
+        导出
+      </el-button>
+    </div>
+    <!-- 渲染数据区 -->
+    <div class="el-table-container" style="flex-basis: 1;">
+      <div class="el-table-inner-container">
+        <vxe-table ref="tableRef" border height="100%" :loading="loading" size="small" :row-config="{ isHover: true }"
+          :data="tableData" :checkbox-config="{ highlight: true }" :scroll-y="{ enabled: true }" show-overflow
+          :column-config="{ resizable: true }" keep-source :filter-config="{ showIcon: false }"
+          :edit-config="{ trigger: 'click', mode: 'row', showStatus: true, beforeEditMethod: beforeEditCheck, showIcon: false }"
+          @checkbox-change="handleSelectChange" @checkbox-all="handleCheckAllChange" @edit-closed="handleEditClosed">
+          <vxe-column type="checkbox" width="50" align="center"></vxe-column>
+          <vxe-column field="supplierName" title="外协商简称" align="center" width="110">
+          </vxe-column>
+          <vxe-column field="outsourceNo" title="发出单号" align="center" width="120">
+          </vxe-column>
+          <vxe-column field="lotCode" title="批次号" align="center" width="120">
+          </vxe-column>
+          <vxe-column field="productDescription" title="产品描述" align="center" width="220">
+          </vxe-column>
+          <vxe-column field="processAlias" title="工序名称" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="status" title="状态" align="center" width="100">
+            <template #default="scope">
+              <div>{{ scope.row.status === 0 ? '已审核' : '已结算' }}</div>
+            </template>
+          </vxe-column>
+          <vxe-colgroup title="工序单价" align="center">
+            <template #header="scope">
+              <div><el-icon>
+                  <Edit />
+                </el-icon>工序单价</div>
+            </template>
+            <vxe-column field="processPrice" align="center" :filters="processOptions" :edit-render="{}"
+              :filter-method="processPriceFilterMethod" width="100">
+              <template #header="{ column }">
+                <vxe-select v-for="(option, index) in column.filters" :key="index" v-model="option.data"
+                  :options="priceFilterList" @change="confirmFilterEvent(option)" placeholder="请选择" transfer
+                  style="width: 100%;"></vxe-select>
+              </template>
+              <template #edit="scope">
+                <el-input-number v-model="scope.row.processPrice" :controls="false" :min="0" :precision="4"
+                  style="width: 100%;" @blur="handleBlur(scope.row)" />
+              </template>
+            </vxe-column>
+          </vxe-colgroup>
+          <!-- <vxe-column field="processPrice" title="工序单价" align="center" :edit-render="{}" width="100">
+            <template #edit="scope">
+              <el-input-number v-model="scope.row.processPrice" :controls="false" :min="0" :precision="4"
+                style="width: 100%;" @blur="handleBlur(scope.row)" />
+            </template>
+          </vxe-column> -->
+          <vxe-column field="otherCost" title="其他扣款" align="center" :edit-render="{}" width="100">
+            <template #header="scope">
+              <div><el-icon>
+                  <Edit />
+                </el-icon>其他扣款</div>
+            </template>
+            <template #edit="scope">
+              <el-input-number v-model="scope.row.otherCost" :controls="false" :min="0" :precision="4"
+                style="width: 100%;" @blur="handleBlur(scope.row)" />
+            </template>
+          </vxe-column>
+          <vxe-column field="fillDifferencePrice" title="差补额" align="center" :edit-render="{}" width="100">
+            <template #header="scope">
+              <div><el-icon>
+                  <Edit />
+                </el-icon>补差额</div>
+            </template>
+            <template #edit="scope">
+              <el-input-number v-model="scope.row.fillDifferencePrice" :controls="false" :min="0" :precision="4"
+                style="width: 100%;" @blur="handleBlur(scope.row)" />
+            </template>
+          </vxe-column>
+          <vxe-column field="productNum" title="投入数量" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="outputNum" title="发出数量" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="receiptNum" title="收回数量" align="center" width="100">
+          </vxe-column>
+          <vxe-colgroup title="实投料量" align="center">
+            <vxe-column field="actualInventory" :filters="InventoryOptions" align="center"
+              :filter-method="actualInventoryFilterMethod" width="100">
+              <template #header="{ column }">
+                <vxe-select v-for="(option, index) in column.filters" :key="index" v-model="option.data"
+                  :options="actualInventoryList" @change="confirmFilterEvent(option)" placeholder="请选择" transfer
+                  style="width: 100%;"></vxe-select>
+              </template>
+            </vxe-column>
+          </vxe-colgroup>
+          <!-- <vxe-column field="actualInventory" title="实投料量" align="center" width="100">
+          </vxe-column> -->
+          <vxe-column field="materialLoss" title="料损数量" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="materialLossAmount" title="扣料金额" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="planAmount" title="应得金额" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="acutalAmount" title="实得金额" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="taxAmount" title="含税金额" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="freightAmount" title="运费" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="materialPrice" title="材料单价" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="salePrice" title="销售单价" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="wastePrice" title="废品单价" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="carrierNum" title="箱数" align="center" width="100">
+          </vxe-column>
+          <!-- 该序号是工序的的序号 -->
+          <vxe-column field="processSort" title="序号" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="processCode" title="工序代码" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="checkoutDate" title="结算日期" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="auditDate" title="审核日期" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="returnDate" title="收回日期" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="returnNo" title="收回单号" align="center" width="120">
+          </vxe-column>
+          <vxe-column field="settlementType" title="结算方式" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="furnaceNum" title="炉数" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="checkDate" title="检查日期" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="supplierCode" title="外协单位码" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="inspectionNo" title="检查单号" align="center" width="130">
+          </vxe-column>
+          <vxe-column field="productCode" title="产品编码" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="materialLossRatio" title="料损率" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="surfaceTreatment" title="表面" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="length" title="长度" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="materialDiameter" title="材料直径" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="tolerance" title="公差" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="utilizationRatio" title="利用率" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="currency" title="币别" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="taxRate" title="税率" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="year" title="结算年" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="month" title="结算月" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="wastePriceCategory" title="废品价类别" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="rawMaterialCode" title="材料编码" align="center" width="140">
+          </vxe-column>
+          <vxe-column field="density" title="密度" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="shape" title="形状" align="center" width="100">
+          </vxe-column>
+          <vxe-column field="type" title="类别" align="center" width="100">
+          </vxe-column>
+        </vxe-table>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+// import region from '@/utils/region.js'
+import { listBalanceAccount, checkout, discheckout, saveBatchBalanceAccount } from '@/api/business/outsourceBalanceAccount'
+import { listOutsourceBalanceMonth } from '@/api/business/outsourceBalanceMonth.js'
+const { proxy } = getCurrentInstance();
+const tableData = ref([])
+const tableRef = ref(null)
+const selected = ref([])
+const loading = ref(false)
+const total = ref(0)
+let rows = []
+const form = ref({
+  checkMonth: null
+})
+const processOptions = ref([{
+  data: ''
+}])
+const InventoryOptions = ref([{
+  data: ''
+}])
+const priceFilterList = ref([
+  { label: '全部', value: '' },
+  { label: '有价', value: '1' },
+  { label: '无价', value: '0' }
+])
+const actualInventoryList = ref([
+  { label: '全部', value: '' },
+  { label: '大于0', value: '1' },
+  { label: '小于等于0', value: '0' }
+])
+const showMask = ref(true)
+const balanceMonth = ref(null)
+
+// const { outsource_checkout_status } = proxy.useDict("outsource_checkout_status");
+const outsource_checkout_status = ref([{
+  label: '全部', value: ''
+}, {
+  label: '已审核', value: 0
+}, {
+  label: '已结算', value: 1
+}])
+
+const queryParams = ref({
+  pageSize: 5000,
+  pageNum: 0
+})
+const checkBalanceAccount = () => {
+  // 判断是否有结算月,假设未设置则显示遮罩层
+  listOutsourceBalanceMonth({}).then(res => {
+    if (res.rows.length == 0) {
+      proxy.$modal.msgError('未进设置外协月结期间不能进行结算')
+      showMask.value = true
+    } else {
+      balanceMonth.value = res.rows[0]
+      showMask.value = false
+    }
+    // showMask.value = true
+  }).catch(_ => {
+  })
+}
+const getList = () => {
+  listBalanceAccount(queryParams.value).then(res => {
+    tableData.value = res.rows
+    total.value = res.total
+  })
+}
+const getListAll = () => {
+  // 每次查500条,直到查齐
+  queryParams.value.pageNum++
+  listBalanceAccount(queryParams.value).then(res => {
+    rows.push(...res.rows)
+    total.value = res.total
+    if (rows.length < total.value) {
+      getListAll()
+    } else {
+      tableData.value.push(...rows)
+      loading.value = false
+    }
+  })
+}
+const handleQuery = () => {
+  // 判断假设没有结算日期则提示选择结算日期
+  if (queryParams.value.checkoutDate == null) {
+    proxy.$modal.msgError('请选择结算日期')
+    return
+  }
+  queryParams.value.pageNum = 0
+  tableData.value = []
+  rows = []
+  loading.value = true
+  getListAll()
+}
+const changeCellEvent = (params) => {
+  const $table = tableRef.value
+  if ($table) {
+    $table.updateStatus(params)
+  }
+  console.log(tableData.value)
+}
+
+const handleBalance = () => {
+  if (selected.value.length == 0) {
+    proxy.$modal.msgError('请选择结算单')
+    return
+  }
+  if (form.value.checkMonth == null) {
+    proxy.$modal.msgError('请选择结算月份')
+    return
+  }
+  // 判断已选择结算单是否已经结算,已经结算则不能再次结算。
+  if (selected.value.some(e => e.status == 1)) {
+    proxy.$modal.msgError('选中结算单存在已结算')
+    return
+  }
+  selected.value.forEach(item => {
+    item.year = proxy.moment(form.value.checkMonth).format('YYYY')
+    item.month = proxy.moment(form.value.checkMonth).format('MM')
+    item.checkoutDate = queryParams.value.checkoutDate
+  })
+  checkout(selected.value).then(res => {
+    proxy.$modal.msgSuccess('结算成功')
+    handleQuery()
+  })
+}
+
+const handleDisbalance = () => {
+  if (selected.value.length == 0) {
+    proxy.$modal.msgError('请选择要取消的结算单')
+    return
+  }
+  selected.value.forEach(item => {
+    item.year = ''
+    item.month = ''
+  })
+  console.log(selected.value.length)
+  if (selected.value.length > 100) {
+    proxy.$modal.msgError('一次只能操作100条数据')
+    return
+  }
+  discheckout(selected.value).then(res => {
+    proxy.$modal.msgSuccess('取消结算成功')
+    handleQuery()
+  })
+}
+
+const handleCheckAll = () => {
+  const $table = tableRef.value
+  if ($table) {
+    $table.setAllCheckboxRow(true)
+    selected.value = $table.getCheckboxRecords(true)
+    // console.log(selected.value)
+  }
+}
+
+const handleExport = () => {
+  const $table = tableRef.value
+  if ($table) {
+    $table.exportData({
+      type: 'xlsx',
+      filename: '外协结算信息'
+    })
+  }
+}
+
+const handleSelectChange = ({ checked, row, rowIndex, records }) => {
+  // console.log('select-one: ', checked, records, row, rowIndex)
+  // selected.value = records
+  // 判断选中的是否是按炉结算假设是按炉结算则同时选中该炉的所有批次
+  const $table = tableRef.value
+  if (row.settlementType == 2 && $table != null) {
+    // console.log(row.outsourceOrderId)
+    const selects = tableData.value.filter(e => e.outsourceOrderId == row.outsourceOrderId)
+    // console.log(selects.length)
+    $table.setCheckboxRow(selects, checked)
+    selected.value = $table.getCheckboxRecords(true)
+    // console.log(selected.value.length)
+  }
+}
+const handleCheckAllChange = ({ checked, records }) => {
+  // console.log('select-all', checked, records)
+  selected.value = records
+}
+
+const handleDateChange = (arg) => {
+  // 获取结算日期的月份自动填入结算月
+  form.value.checkMonth = proxy.moment(arg).format('YYYY-MM-01')
+  // console.log(arg)
+  // console.log(form.value.checkMonth)
+}
+
+const disabledDateHandler = (date, type) => {
+  if (type === 'endDate') {
+    // console.log(queryParams.value.checkoutDate)
+    // console.log(proxy.moment(date).format('MM'), proxy.moment(queryParams.value.checkoutDate).format('MM'))
+    if (queryParams.value.checkoutDate == null || proxy.moment(date).format('MM') != proxy.moment(queryParams.value.checkoutDate).format('MM')) return true
+    else return false
+  }
+}
+
+const handleSave = () => {
+  const params = tableRef.value.getUpdateRecords()
+  console.log(params)
+  saveBatchBalanceAccount(params).then(res => {
+    proxy.$modal.msgSuccess('保存成功')
+    handleQuery()
+  })
+}
+
+const beforeEditCheck = ({ row }) => {
+  // 判断当结算月小于当前结算期开始日期时不能编辑
+  if (row.checkoutDate != null && proxy.moment(row.checkoutDate).isBefore(balanceMonth.value.startDate)) {
+    return false
+  }
+  return true
+}
+const handleBlur = (params) => {
+  // console.log(params)
+  // 计算应收金额,实收金额
+  let planAmount = 0
+  let acutalAmount = 0
+  let taxAmount = 0
+  if (params.settlementType == 1) {
+    if (params.surfaceTreatment == 'N') {
+      // 没有表面处理
+      if (params.supplierCode == '99024' && params.prouctCode != '99000') {
+        planAmount = (params.outputNum * params.processPrice * (1 + params.taxRate / 100)).toFixed(4)
+      } else {
+        planAmount = (params.receiptNum * params.processPrice * (1 + params.taxRate / 100)).toFixed(4)
+      }
+    } else {
+      // 有表面处理
+      if (params.supplierCode == '99024') {
+        planAmount = (params.outputNum * params.processPrice * (1 + params.taxRate / 100)).toFixed(4)
+      } else {
+        planAmount = (params.receiptNum * params.processPrice * (1 + params.taxRate / 100)).toFixed(4)
+      }
+    }
+  } else {
+    planAmount = (1 * params.processPrice * (1 + params.taxRate / 100)).toFixed(4)
+  }
+  taxAmount = (planAmount - params.otherCost + params.fillDifferencePrice - params.freightAmount - params.materialLossAmount).toFixed(4)
+  acutalAmount = ((planAmount - params.otherCost + params.fillDifferencePrice - params.freightAmount - params.materialLossAmount) / (1 + params.taxRate / 100)).toFixed(4)
+  params.planAmount = planAmount
+  params.acutalAmount = acutalAmount
+  params.taxAmount = taxAmount
+}
+
+const processPriceFilterMethod = ({ option, row, column }) => {
+  if (option.data != '') {
+    return option.data == '0' ? row[column.field] <= 0 : row[column.field] > 0
+  }
+  return true
+}
+const actualInventoryFilterMethod = ({ option, row, column }) => {
+  if (option.data != '') {
+    return option.data == '0' ? row[column.field] <= 0 : row[column.field] > 0
+  }
+  return true
+}
+const confirmFilterEvent = (option) => {
+  const $table = tableRef.value
+  if ($table) {
+    // 设置为选中状态
+    option.checked = true
+    // 修改条件之后,需要手动调用 updateData 处理表格数据
+    $table.updateData()
+  }
+}
+const handleEditClosed = (params) => {
+  console.log(params)
+}
+// const handleScroll = (params) => {
+//   // console.log('scroll')
+//   if (params.scrollTop + params.bodyHeight >= params.scrollHeight) {
+//     console.log('已经到底部了')
+//   }
+// }
+checkBalanceAccount()
+// getList()
+</script>

+ 83 - 0
src/views/business/outsourceBalanceMonth/index.vue

@@ -0,0 +1,83 @@
+<template>
+  <div class="page-container column-container">
+    <el-form class="list-search-container" :model="form" ref="queryRef" :inline="true">
+      <el-form-item label="外协结算月设置">
+      </el-form-item>
+      <el-form-item label="开始日期:" style="margin-left: 50px;">
+        <el-date-picker v-model="form.startDate" type="date" value-format="YYYY-MM-DD" :editable="false"
+          :clearable="false" placeholder="结算日期" style="width: 130px" @change="handleDateChange"
+          :disabled-date="(arg) => disabledDateHandler(arg, 'startDate')" />
+      </el-form-item>
+      <el-form-item label="结束日期:">
+        <el-date-picker v-model="form.endDate" type="date" value-format="YYYY-MM-DD" :editable="false"
+          :clearable="false" placeholder="结束日期" style="width: 130px" @change="handleDateChange"
+          :disabled-date="(arg) => disabledDateHandler(arg, 'endDate')" />
+      </el-form-item>
+      <el-form-item style="margin-left: 200px;">
+        <el-button type="primary" @click="setMonth">设置</el-button>
+      </el-form-item>
+    </el-form>
+  </div>
+</template>
+
+<script setup>
+import { ref } from 'vue'
+const { proxy } = getCurrentInstance();
+import { listOutsourceBalanceMonth, saveOutsourceBalanceMonth } from '@/api/business/outsourceBalanceMonth.js'
+
+const form = ref({
+  startDate: null,
+  endDate: null
+})
+
+const getList = () => {
+  listOutsourceBalanceMonth({}).then(res => {
+    if (res.rows.length > 0) {
+      form.value.startDate = res.rows.length > 0 ? res.rows[0].startDate : ''
+      form.value.endDate = res.rows.length > 0 ? res.rows[0].endDate : ''
+    } else {
+      form.value = {
+        startDate: null,
+        endDate: null
+      }
+    }
+  })
+}
+const setMonth = () => {
+  if (form.value.startDate == null || form.value.endDate == null) {
+    proxy.$modal.msgError('请选择开始日期和结束日期')
+    return
+  }
+  proxy.$confirm('确定要设置外协结算月吗?', '提示', {
+    confirmButtonText: '确定',
+    cancelButtonText: '取消',
+    type: 'warning'
+  }).then(res => {
+    saveOutsourceBalanceMonth(form.value).then(res => {
+      if (res.code === 200) {
+        proxy.$modal.msgSuccess('设置成功')
+        getList()
+      }
+    })
+  }).catch(_ => {
+    proxy.$modal.msgError('取消设置')
+  })
+}
+
+const handleDateChange = () => {
+  console.log(form.value.startDate, form.value.endDate)
+}
+
+
+function disabledDateHandler(date, field) {
+  if (field === 'startDate') {
+    if (form.value.endDate != null && date >= proxy.moment(form.value.endDate)) return true
+    else return false
+  } else if (field === 'endDate') {
+    if (form.value.startDate != null && date <= proxy.moment(form.value.startDate)) return true
+    else return false
+  }
+}
+
+getList()
+</script>

+ 209 - 0
src/views/business/outsourceInspectionVerify/index.vue

@@ -0,0 +1,209 @@
+<!-- 外协结算前审核 -->
+<template>
+  <div class="page-container column-container">
+    <!-- 搜索区 -->
+    <el-form class="list-search-container" :model="queryParams" ref="queryRef" :inline="true">
+      <el-form-item label="单据号:" prop="outsourcedInspectionNo">
+        <el-input v-model="queryParams.outsourcedInspectionNo" placeholder="请输入单据号" style="width: 144px" clearable
+          @keyup.enter="handleQuery" />
+      </el-form-item>
+      <el-form-item label="检查日期:" prop="startTime">
+        <!-- <el-input v-model="queryParams.startTime" placeholder="" style="width: 144px" clearable
+          @keyup.enter="handleQuery" /> -->
+        <el-date-picker v-model="queryParams.startTime" type="date" placeholder="选择日期" style="width: 144px" clearable
+          @keyup.enter="handleQuery" />
+      </el-form-item>
+      <el-form-item label="外协商名称:" prop="supplierName">
+        <el-input v-model="queryParams.supplierName" placeholder="请输入外协商名称" style="width: 144px" clearable
+          @keyup.enter="handleQuery" />
+      </el-form-item>
+      <el-form-item label="批次号:" prop="lotCode">
+        <el-input v-model="queryParams.lotCode" placeholder="请输入批次号" style="width: 144px" clearable
+          @keyup.enter="handleQuery" />
+      </el-form-item>
+      <el-form-item label="状态:" prop="auditStatus">
+        <el-select v-model="queryParams.auditStatus" style="width: 144px" clearable placeholder="请选择">
+          <el-option v-for="dict in outsource_before_checkout_verify_status" :key="dict.value" :label="dict.label"
+            :value="dict.value" />
+        </el-select>
+      </el-form-item>
+      <el-form-item>
+        <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
+        <el-button icon="Refresh" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <!-- 功能按钮区 -->
+    <!-- <div class="list-btns-container">
+    </div> -->
+
+    <!-- 渲染数据区 -->
+    <div class="el-table-container">
+      <div class="el-table-inner-container">
+        <el-table v-loading="loading" :data="orderList" size="small" border height="100%"
+          @selection-change="handleSelectionChange">
+          <el-table-column type="selection" width="48" align="center" />
+          <el-table-column label="外协单位" align="center" prop="outsourcedOrderDetail.supplierName" width="320" />
+          <el-table-column label="批次号" align="center" prop="lotCode" width="100" />
+          <el-table-column label="产品描述" align="center" prop="productDescription" width="320" />
+          <el-table-column label="质检单号" align="center" prop="outsourcedInspectionNo" width="120" />
+          <el-table-column label="检查状态" align="center" prop="status" width="120">
+            <template #default="scope">
+              <dict-tag :options="process_inspection_status" :value="scope.row.status" />
+            </template>
+          </el-table-column>
+          <el-table-column label="外协工序" align="center" prop="processNames" width="120" />
+          <el-table-column label="外协日期" align="center" prop="outsourcedOrderDetail.formDate" width="120">
+            <template #default="scope">
+              {{ parseTime(scope.row.outsourcedOrderDetail.formDate, "{y}-{m}-{d}") }}
+            </template>
+          </el-table-column>
+          <el-table-column label="发出量" align="center" prop="outsourcedOrderDetail.productNum" width="120" />
+          <el-table-column label="收回日期" align="center" prop="returnReceiptDetail.formDate" width="120" />
+          <el-table-column label="收回量" align="center" prop="returnReceiptDetail.auditNum" width="120" />
+          <el-table-column label="状态" align="center" prop="auditStatus" width="120">
+            <template #default="scope">
+              <dict-tag :options="outsource_before_checkout_verify_status" :value="scope.row.auditStatus" />
+            </template>
+          </el-table-column>
+          <el-table-column label="备注" align="center" prop="remark" />
+          <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="200">
+            <template #default="scope">
+              <el-button v-if="scope.row.auditStatus == 0 || scope.row.auditStatus == 2" link type="warning"
+                icon="Check" @click="handleConfirm(scope.row)" v-hasPermi="['business:beforeCheckoutVerify:edit']">
+                通过
+              </el-button>
+              <el-button v-if="scope.row.auditStatus == 0 || scope.row.auditStatus == 1" link type="primary"
+                icon="Close" @click="handleReject(scope.row)" v-hasPermi="['business:beforeCheckoutVerify:edit']">
+                不通过
+              </el-button>
+            </template>
+          </el-table-column>
+        </el-table>
+      </div>
+    </div>
+
+    <!-- 分页 -->
+    <pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum"
+      v-model:limit="queryParams.pageSize" @pagination="getList" />
+  </div>
+</template>
+
+<script setup name="Order">
+import {
+  listCheckoutInspection,
+  rejectInspection,
+  confirmInspection,
+  checkFurnace
+} from '@/api/business/beforeCheckoutVerify'
+import { nextTick } from "vue";
+const { proxy } = getCurrentInstance();
+/** 字典数组区 */
+const { outsource_before_checkout_verify_status } = proxy.useDict("outsource_before_checkout_verify_status");
+
+const { process_inspection_status } = proxy.useDict("process_inspection_status");
+
+const orderList = ref([]);
+const loading = ref(true);
+const ids = ref([]);
+const single = ref(true);
+const multiple = ref(true);
+const total = ref(0);
+const printCarriers = ref([])
+const webHost = import.meta.env.VITE_APP_PRODUCTION_API;
+/** 查询对象 */
+const queryParams = ref({
+  pageNum: 1,
+  pageSize: 10,
+  formCode: null,
+  formDate: null,
+  startTime: null,
+  endTime: null,
+  supplierName: null,
+  deliveryMethod: null,
+  packagingMethod: null,
+  freightPrice: null,
+  freightAmount: null,
+  isFirstProcess: 0
+});
+
+/***********************  方法区  ****************************/
+
+/** 查询外协单主 带箱方式,是整单的。如果换新箱子,明细中,都需要更换箱子列表 */
+function getList() {
+  loading.value = true;
+  listCheckoutInspection(queryParams.value).then((response) => {
+    orderList.value = response.rows;
+    total.value = response.total;
+    loading.value = false;
+  });
+}
+
+/** 搜索按钮操作 */
+function handleQuery() {
+  queryParams.value.pageNum = 1;
+  getList();
+}
+
+/** 重置按钮操作 */
+function resetQuery() {
+  proxy.resetForm("queryRef");
+  handleQuery();
+}
+
+// 多选框选中数据
+function handleSelectionChange(selection) {
+  ids.value = selection.map((item) => item.id);
+  single.value = selection.length != 1;
+  multiple.value = !selection.length;
+}
+
+function handleConfirm(row) {
+  checkFurnace(row).then(res => {
+    if (res.code === 200) {
+      if (res.data.length === 1) {
+        proxy.$confirm('是否确认通过?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          confirmInspection(res.data).then(res => {
+            getList()
+          })
+        });
+      } else {
+        proxy.$confirm('该炉已全部质检,是否全部确认通过?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        }).then(() => {
+          confirmInspection(res.data).then(res => {
+            getList()
+          })
+        });
+      }
+    } else {
+      proxy.$msgError(res.msg)
+    }
+  })
+}
+
+function handleReject(row) {
+  checkFurnace(row).then(res => {
+    if (res.code === 200) {
+      proxy.$confirm('是否确认不通过?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        rejectInspection(res.data).then(res => {
+          getList();
+        })
+      });
+    }
+  })
+}
+
+
+getList();
+</script>

+ 11 - 3
src/views/business/returnReceipt/form.vue

@@ -94,7 +94,7 @@
                     --el-switch-on-color: #13ce66;
                     --el-switch-off-color: #ff4949;
                   " :active-value="1" :inactive-value="0" active-text="已审核" inactive-text="未审核"
-                  :disabled="scope.row.productionDeptId != 0 || (scope.row.processInspecionList && scope.row.processInspecionList.length > 0)"
+                  :disabled="scope.row.productionDeptId != 0 || (scope.row.isApproved === 0 && scope.row.processInspecionList && scope.row.processInspecionList.length > 0)"
                   @change="handleChangeAuditStatus(scope.row)" />
               </template>
             </el-table-column>
@@ -120,6 +120,7 @@ import {
   getReceipt,
   addReceipt,
   updateReceipt,
+  checkFurnace
 } from "@/api/business/returnReceipt";
 import { getP2NeedCheckProcess } from '@/api/business/p2'
 import dialogOutsourceDetails from "./DialogOutsourceDetails";
@@ -261,7 +262,7 @@ function handleChangeAuditStatus(row) {
 }
 /** 提交按钮 */
 function submitForm() {
-  proxy.$refs["formRef"].validate((valid) => {
+  proxy.$refs["formRef"].validate(async (valid) => {
     if (valid) {
       var flag = true;
       var confirmFlag = false;
@@ -303,6 +304,13 @@ function submitForm() {
         flag = false
         proxy.$modal.msgError("收回明细中载具箱号不能为空")
       }
+
+      // 判断是否按炉结算
+      const checkRes = await checkFurnace(form.value.details);
+      if (!checkRes.data) {
+        flag = false
+        proxy.$modal.msgError(checkRes.msg)
+      }
       if (flag) {
         //赋值(因为收回明细是一个批次一条,所以后端传回来两个集合,一个页面显示,一个后端保存)
         handleSetAuditStatus();
@@ -406,7 +414,7 @@ function handleSetAuditStatus() {
 
 function getP2NeedCheck() {
   getP2NeedCheckProcess("Y").then(res => {
-    processList.value = res.row.map(v => v.prcode.trim())
+    processList.value = res.rows.map(v => v.prcode.trim())
   })
 }
 /** 暴露给父组件的方法 */

+ 5 - 0
vite.config.js

@@ -65,6 +65,11 @@ export default defineConfig(({ mode, command }) => {
           }
         ]
       }
+    },
+    esbuild: {
+      jsxFactory: 'h',
+      jsxFragment: 'Fragment',
+      // jsxInject: `import { h } from 'vue';`,
     }
   }
 })