|
@@ -131,7 +131,7 @@
|
|
|
<el-button type="primary" @click="openProductCompany = true" plain style="margin-bottom: 16px"
|
|
|
v-if="!judgeStatus() && isEditList">产品库</el-button>
|
|
|
<!-- default-expand-all -->
|
|
|
- <el-table :data="formData.data.contractProductList" style="width: 100%; ">
|
|
|
+ <el-table :data="formData.data.contractProductList" style="width: 100%; " default-expand-all>
|
|
|
<el-table-column type="expand" width="50" align="center">
|
|
|
<template #default="scope">
|
|
|
<div style="padding-left:50px">
|
|
@@ -156,7 +156,19 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column prop="quantity" label="数量" width="110" />
|
|
|
+ <el-table-column prop="quantity" label="数量" width="130">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item v-if="isEditList"
|
|
|
+ :prop="'contractProductList.' + scope.$index + '.contractProductBomList.' + $index + '.quantity'"
|
|
|
+ :rules="rules.quantity" :inline-message="true" class="margin-b-0 wid100">
|
|
|
+ <el-input-number onmousewheel="return false;" v-model="row.quantity" placeholder="请输入" style="width: 100%" :precision="0"
|
|
|
+ :controls="false" :min="1" />
|
|
|
+ </el-form-item>
|
|
|
+ <span v-else>{{row.quantity}}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<!-- <el-table-column prop="allQuantity" label="总量" width="80" /> -->
|
|
|
<!-- <el-table-column prop="price" label="单价" width="110">
|
|
|
<template #default="{ row, $index }">
|
|
@@ -172,7 +184,21 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column> -->
|
|
|
- <el-table-column prop="remark" label="备注" width="180" />
|
|
|
+ <el-table-column prop="remark" label="备注" width="180">
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <div style="width: 100%">
|
|
|
+ <el-form-item v-if="isEditList" :inline-message="true" class="margin-b-0 wid100">
|
|
|
+ <el-input v-model="row.remark" placeholder="请输入" style="width: 100%" />
|
|
|
+ </el-form-item>
|
|
|
+ <span v-else>{{row.remark}}</span>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
+ <el-table-column label="操作" width="60" align="center" fixed="right" v-if="isEditList">
|
|
|
+ <template #default="{ row,$index }">
|
|
|
+ <el-button type="primary" link @click="handleDeleteMaterial(scope.$index,$index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -302,9 +328,10 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="操作" width="60" align="center" fixed="right" v-if="!judgeStatus()">
|
|
|
+ <el-table-column label="操作" width="140" align="center" fixed="right" v-if="!judgeStatus() && isEditList">
|
|
|
<template #default="{ $index }">
|
|
|
- <el-button type="primary" link @click="handleRemove($index)" v-if="isEditList">删除</el-button>
|
|
|
+ <el-button type="primary" link @click="handleClickSelectMaterial($index)">包材辅材</el-button>
|
|
|
+ <el-button type="primary" link @click="handleRemove($index)">删除</el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -362,9 +389,18 @@
|
|
|
</template>
|
|
|
</byForm>
|
|
|
|
|
|
- <el-dialog v-if="openProductCompany" v-model="openProductCompany" title="公司产品库" width="90%" append-to-body>
|
|
|
- <!-- <SelectCompanyProduct @selectProduct="selectProduct" :alreadySelectData="formData.data.contractProductList"></SelectCompanyProduct> -->
|
|
|
+ <el-dialog v-if="openProductCompany" v-model="openProductCompany" title="产品库" width="90%" append-to-body>
|
|
|
<SelectProduct @selectProduct="selectProduct" :companyId="formData.data.companyId" :isRawMaterial="'1'"></SelectProduct>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openProductCompany = false" size="defualt" v-debounce>关 闭</el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+ <el-dialog :title="'物料选择'" v-model="openSelectMaterial" width="90%" destroy-on-close>
|
|
|
+ <SelectMaterial :isNeRawMaterial="'1'" @selectMaterial="selectMaterial"></SelectMaterial>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="openSelectMaterial = false" size="defualt" v-debounce>关 闭</el-button>
|
|
|
+ </template>
|
|
|
</el-dialog>
|
|
|
|
|
|
<!-- <el-dialog v-if="copyContract" v-model="copyContract" :title="copyType === 1 ? '合同选择' : '样品单选择'" width="90%" append-to-body>
|
|
@@ -376,11 +412,9 @@
|
|
|
|
|
|
<script setup>
|
|
|
import byForm from "@/components/byForm/index";
|
|
|
-import SelectCompanyProduct from "@/components/product/SelectCompanyProduct.vue";
|
|
|
import SelectProduct from "@/components/product/SelectProduct.vue";
|
|
|
+import SelectMaterial from "@/components/product/SelectMaterial.vue";
|
|
|
import Editor from "@/components/Editor/index.vue";
|
|
|
-
|
|
|
-// import SelectCustomerProduct from "@/components/product/SelectCustomerProduct.vue";
|
|
|
import selectCity from "@/components/selectCity/index.vue";
|
|
|
import { useRoute } from "vue-router";
|
|
|
import SelectContract from "@/components/contractCom/selectContract.vue";
|
|
@@ -415,6 +449,8 @@ const treeData = ref([]);
|
|
|
const openProductCompany = ref(false);
|
|
|
const copyType = ref(1);
|
|
|
const copyContract = ref(false);
|
|
|
+const indexValue = ref(-1);
|
|
|
+const openSelectMaterial = ref(false);
|
|
|
const formData = reactive({
|
|
|
data: {
|
|
|
contractType: "2",
|
|
@@ -976,6 +1012,12 @@ const handlePerson = (item) => {
|
|
|
formData.data.buyContactNumber = data[0].contactNo;
|
|
|
}
|
|
|
};
|
|
|
+
|
|
|
+const handleClickSelectMaterial = (index) => {
|
|
|
+ indexValue.value = index;
|
|
|
+ openSelectMaterial.value = true;
|
|
|
+};
|
|
|
+
|
|
|
const contractProductBomList = ref([]);
|
|
|
const selectProduct = (goods) => {
|
|
|
if (goods && goods.id) {
|
|
@@ -990,9 +1032,9 @@ const selectProduct = (goods) => {
|
|
|
materialId: x.materialId,
|
|
|
productName: x.materialName,
|
|
|
productCode: x.materialCode,
|
|
|
- productLength: x["length"],
|
|
|
- productWidth: x.width,
|
|
|
- productHeight: x.height,
|
|
|
+ productLength: x.materialLength,
|
|
|
+ productWidth: x.materialWidth,
|
|
|
+ productHeight: x.materialHeight,
|
|
|
quantity: x.quantity || null,
|
|
|
allQuantity: "",
|
|
|
price: x.materialPrice || null,
|
|
@@ -1035,6 +1077,37 @@ const selectProduct = (goods) => {
|
|
|
}
|
|
|
};
|
|
|
|
|
|
+const selectMaterial = (goods) => {
|
|
|
+ let flag = formData.data.contractProductList[
|
|
|
+ indexValue.value
|
|
|
+ ].contractProductBomList.some((x) => x.materialId == goods.id);
|
|
|
+ if (!flag) {
|
|
|
+ let fileUrl = "";
|
|
|
+ if (goods.fileList && goods.fileList.length > 0) {
|
|
|
+ fileUrl = goods.fileList[0].fileUrl;
|
|
|
+ }
|
|
|
+ formData.data.contractProductList[
|
|
|
+ indexValue.value
|
|
|
+ ].contractProductBomList.push({
|
|
|
+ fileUrl: fileUrl,
|
|
|
+ materialId: goods.id,
|
|
|
+ productName: goods.name,
|
|
|
+ productCode: goods.customCode,
|
|
|
+ productLength: goods["length"],
|
|
|
+ productWidth: goods.width,
|
|
|
+ productHeight: goods.height,
|
|
|
+ quantity: null,
|
|
|
+ price: goods.price || null,
|
|
|
+ amount: "",
|
|
|
+ fileList: [],
|
|
|
+ type: 2,
|
|
|
+ });
|
|
|
+ proxy.msgTip("选择成功");
|
|
|
+ } else {
|
|
|
+ proxy.msgTip("该物料已选择", 2);
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
const changeProductPrice = () => {
|
|
|
let productIds = formData.data.contractProductList.map((x) => x.productId);
|
|
|
if (productIds && productIds.length > 0) {
|
|
@@ -1090,6 +1163,14 @@ const handleRemove = (index) => {
|
|
|
formData.data.contractProductList.splice(index, 1);
|
|
|
totalAmount();
|
|
|
};
|
|
|
+
|
|
|
+const handleDeleteMaterial = (index, sonIndex) => {
|
|
|
+ formData.data.contractProductList[index].contractProductBomList.splice(
|
|
|
+ sonIndex,
|
|
|
+ 1
|
|
|
+ );
|
|
|
+};
|
|
|
+
|
|
|
const calculationAmount = (att = "") => {
|
|
|
nextTick(() => {
|
|
|
if (
|
|
@@ -1297,7 +1378,7 @@ const handleClickUpload = async (att, flag, index) => {
|
|
|
path = formData.data.contractProductList[index][att];
|
|
|
}
|
|
|
let a = document.createElement("a");
|
|
|
- a.href = "printer://" + "ftp://192.168.1.13/" + path + "/";
|
|
|
+ a.href = "printer://" + "ftp://121.37.194.75/" + path + "/";
|
|
|
a.style.display = "none";
|
|
|
document.body.appendChild(a);
|
|
|
a.click();
|