加入下拉框负责人

This commit is contained in:
lizhenhua 2025-09-15 13:12:43 +08:00
parent 4935f52233
commit f6511be656
3 changed files with 224 additions and 183 deletions

View File

@ -20,6 +20,15 @@ export function getMaterialListApi(data) {
params: data params: data
}) })
} }
export function fetchUsers(data) {
return request({
url: '/system/user/list',
method: 'get',
headers: {
},
params: data
})
}
//查询供应商列表 isPaging 0不分页 2分页 //查询供应商列表 isPaging 0不分页 2分页
export function supplierPageApi(data) { export function supplierPageApi(data) {
return request({ return request({

View File

@ -236,7 +236,7 @@
if(item.phonenumber&&item.phonenumber!=""){ if(item.phonenumber&&item.phonenumber!=""){
this.$set(item,"phonenumber",decryptWithSM4(item.phonenumber)) this.$set(item,"phonenumber",decryptWithSM4(item.phonenumber))
} }
}) })
this.total = Number(response.total); this.total = Number(response.total);
this.loading = false; this.loading = false;
}); });

View File

@ -7,12 +7,12 @@
</el-form-item> </el-form-item>
<el-form-item label="合同标题" prop="contractTitle"> <el-form-item label="合同标题" prop="contractTitle">
<el-input v-model="baseInfo.contractTitle" placeholder="请输入合同标题" maxlength="20" clearable style="width: 240px"/> <el-input v-model="baseInfo.contractTitle" placeholder="请输入合同标题" maxlength="20" clearable style="width: 240px"/>
</el-form-item> </el-form-item>
<el-form-item label="所属区域" prop="areaId"> <el-form-item label="所属区域" prop="areaId">
<el-cascader v-model="baseInfo.areaId" <el-cascader v-model="baseInfo.areaId"
:options="treeAreaOptions" :filterable="true" style="width: 240px" :show-all-levels="false" :options="treeAreaOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
:disabled="contractMaterialList.length>0" :disabled="contractMaterialList.length>0"
:props="{ :props="{
emitPath: false,// falseid emitPath: false,// falseid
checkStrictly: false,// checkStrictly: false,//
value:'id',label:'label' value:'id',label:'label'
@ -26,7 +26,7 @@
:label="item.canteenName" :label="item.canteenName"
:value="item.canteenId" :value="item.canteenId"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="供应商" prop="supplierId"> <el-form-item label="供应商" prop="supplierId">
<el-select v-model="baseInfo.supplierId" placeholder="请选择供应商" style="width: 240px;"> <el-select v-model="baseInfo.supplierId" placeholder="请选择供应商" style="width: 240px;">
@ -35,7 +35,7 @@
:label="item.supplierName" :label="item.supplierName"
:value="item.supplierId" :value="item.supplierId"
></el-option> ></el-option>
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="签订日期" prop="contractSigningTime"> <el-form-item label="签订日期" prop="contractSigningTime">
<el-date-picker <el-date-picker
@ -44,7 +44,7 @@
format="yyyy-MM-dd" style="width: 240px;" format="yyyy-MM-dd" style="width: 240px;"
:picker-options="pickerOptions" @change="baseInfo.contractSigningTime=formatDate(baseInfo.contractSigningTime)"> :picker-options="pickerOptions" @change="baseInfo.contractSigningTime=formatDate(baseInfo.contractSigningTime)">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
<el-form-item label="合同生效周期" prop="dateRange"> <el-form-item label="合同生效周期" prop="dateRange">
<el-date-picker <el-date-picker
v-model="baseInfo.dateRange" v-model="baseInfo.dateRange"
@ -85,16 +85,27 @@
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="baseInfo.remark" placeholder="请输入备注" maxlength="30" clearable style="width: 240px"/> <el-input v-model="baseInfo.remark" placeholder="请输入备注" maxlength="30" clearable style="width: 240px"/>
</el-form-item> </el-form-item>
<el-form-item label="负责人" prop="contractPerson"> <!-- <el-form-item label="负责人" prop="contractPerson">
<el-input v-model="baseInfo.contractPerson" placeholder="请输入负责人" maxlength="20" clearable style="width: 240px"/> <el-input v-model="baseInfo.contractPerson" placeholder="请输入负责人" maxlength="20" clearable style="width: 240px"/>
</el-form-item> </el-form-item> -->
<el-form-item label="负责人" prop="contractPerson">
<el-select v-model="contractPerson" placeholder="请选择负责人" clearable style="width: 240px">
<el-option
v-for="option in contractPersonOptions"
:key="option.value"
:label="option.label"
:value="option.value"
/>
</el-select>
</el-form-item>
<el-form-item label="合同附件" prop="contractAttachmentList"> <el-form-item label="合同附件" prop="contractAttachmentList">
<el-upload <el-upload
ref="upload" ref="upload"
:http-request="fileUpLoad" :http-request="fileUpLoad"
action="#" :limit="5" action="#" :limit="5"
accept=".xlsx, .xls, .png, .jpg, .jpeg, .docx, .doc" accept=".xlsx, .xls, .png, .jpg, .jpeg, .docx, .doc"
:show-file-list="true" :show-file-list="true"
:file-list="attachmentList" :file-list="attachmentList"
:on-remove="handleRemoveFile" :on-remove="handleRemoveFile"
:before-upload="checkFileSize" :before-upload="checkFileSize"
@ -102,13 +113,13 @@
<el-button <el-button
:disabled="attachmentList.length==5" :disabled="attachmentList.length==5"
type="primary" type="primary"
size="mini" size="mini"
>上传附件 >上传附件
</el-button> </el-button>
</el-upload> </el-upload>
</el-form-item> </el-form-item>
</el-form> </el-form>
</div> </div>
<div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;"> <div style="width: 100%;height: 450px;padding: 10px;border-radius: 10px;margin-bottom: 10px;background: #FFF;">
<div style="width: 100%;display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;"> <div style="width: 100%;display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;">
<div> <div>
@ -125,36 +136,36 @@
<el-table-column type="selection" width="50" align="center" :reserve-selection="true" /> <el-table-column type="selection" width="50" align="center" :reserve-selection="true" />
<el-table-column label="序号" align="center" width="80" type="index" /> <el-table-column label="序号" align="center" width="80" type="index" />
<!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> --> <!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> -->
<el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" /> <el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" />
<el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" /> <el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" /> <el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" /> <el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true"> <el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
<!-- <template slot-scope="scope"> <!-- <template slot-scope="scope">
<span v-if="scope.row.salesMode==1">按份</span> <span v-if="scope.row.salesMode==1">按份</span>
<span v-if="scope.row.salesMode==2">称重</span> <span v-if="scope.row.salesMode==2">称重</span>
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column label="单价(元)" align="center" prop="singlePrice" :show-overflow-tooltip="true"> <el-table-column label="单价(元)" align="center" prop="singlePrice" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.singlePrice" placeholder="请输入" maxlength="7" clearable @input="(v)=>(scope.row.singlePrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/> <el-input v-model="scope.row.singlePrice" placeholder="请输入" maxlength="7" clearable @input="(v)=>(scope.row.singlePrice=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="数量" align="center" prop="orderNum" :show-overflow-tooltip="true"> <el-table-column label="数量" align="center" prop="orderNum" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model.number="scope.row.orderNum" placeholder="请输入" maxlength="7" clearable @input="(v)=>(scope.row.orderNum=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/> <el-input v-model.number="scope.row.orderNum" placeholder="请输入" maxlength="7" clearable @input="(v)=>(scope.row.orderNum=v.replace(/[^\d.]/g, '').replace(/^(\d*\.\d{2}).*$/, '$1'))"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true"> <el-table-column label="总金额(元)" align="center" prop="" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (scope.row.orderNum*scope.row.singlePrice).toFixed(4) }}</span> <span>{{ (scope.row.orderNum*scope.row.singlePrice).toFixed(4) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true"> <el-table-column label="备注" align="center" prop="remark" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.remark" placeholder="请输入" maxlength="20" clearable/> <el-input v-model="scope.row.remark" placeholder="请输入" maxlength="20" clearable/>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
</div> </div>
</div> </div>
@ -163,7 +174,7 @@
<el-button type="success" plain @click="confirmSubmit" :loading="loadingBtn">提交</el-button> <el-button type="success" plain @click="confirmSubmit" :loading="loadingBtn">提交</el-button>
<el-button @click="jumpList">返回</el-button> <el-button @click="jumpList">返回</el-button>
</div> </div>
<!-- 选择菜品 --> <!-- 选择菜品 -->
<el-dialog title="选择货品" :visible.sync="openDialog" width="65%" append-to-body > <el-dialog title="选择货品" :visible.sync="openDialog" width="65%" append-to-body >
<div style="width: 100%;height:620px;"> <div style="width: 100%;height:620px;">
@ -171,11 +182,11 @@
<el-form-item label="货品类别" prop="materialTypeIds"> <el-form-item label="货品类别" prop="materialTypeIds">
<el-cascader v-model="queryParams.materialTypeIds" <el-cascader v-model="queryParams.materialTypeIds"
:options="materialTreeOptions" :filterable="true" style="width: 240px" :show-all-levels="false" :options="materialTreeOptions" :filterable="true" style="width: 240px" :show-all-levels="false"
:props="{ :props="{
multiple: true, multiple: true,
emitPath: false,// falseid emitPath: false,// falseid
checkStrictly: false,// checkStrictly: false,//
value:'id',label:'categoryName' value:'id',label:'categoryName'
}" collapse-tags> }" collapse-tags>
</el-cascader> </el-cascader>
</el-form-item> </el-form-item>
@ -198,21 +209,21 @@
</template> </template>
</el-table-column> </el-table-column>
<!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> --> <!-- <el-table-column label="图片" align="center" prop="" :show-overflow-tooltip="true" /> -->
<el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" /> <el-table-column label="货品编码" align="center" prop="materialCode" :show-overflow-tooltip="true" />
<el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" /> <el-table-column label="货品名称" align="center" prop="materialName" :show-overflow-tooltip="true" />
<el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" /> <el-table-column label="货品类别" align="center" prop="materialTypeName" :show-overflow-tooltip="true" />
<el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" /> <el-table-column label="计量单位" align="center" prop="unitName" :show-overflow-tooltip="true" />
<el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true"> <el-table-column label="货品规格" align="center" prop="size" :show-overflow-tooltip="true">
<!-- <template slot-scope="scope"> <!-- <template slot-scope="scope">
<span v-if="scope.row.salesMode==1">按份</span> <span v-if="scope.row.salesMode==1">按份</span>
<span v-if="scope.row.salesMode==2">称重</span> <span v-if="scope.row.salesMode==2">称重</span>
</template> --> </template> -->
</el-table-column> </el-table-column>
<el-table-column label="单价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true"> <el-table-column label="单价(元)" align="center" prop="unitPrice" :show-overflow-tooltip="true">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span> <span>{{ (scope.row.unitPrice/100).toFixed(2)||"" }}</span>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<pagination <pagination
v-show="total>0" v-show="total>0"
@ -220,21 +231,21 @@
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="confirmChosen"> </el-button> <el-button type="primary" @click="confirmChosen"> </el-button>
<el-button @click="openDialog=false"> </el-button> <el-button @click="openDialog=false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
<!-- 导入 --> <!-- 导入 -->
<el-dialog title="导入采购订单" :visible.sync="openImportDialog" width="60%" append-to-body > <el-dialog title="导入采购订单" :visible.sync="openImportDialog" width="60%" append-to-body >
<div style="width: 100%;height:600px;"> <div style="width: 100%;height:600px;">
<el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" label-width="100px"> <el-form :model="queryParams2" ref="queryForm2" size="small" :inline="true" label-width="100px">
<el-form-item label="采购单号" prop="orderGoodsCode"> <el-form-item label="采购单号" prop="orderGoodsCode">
<el-input v-model="queryParams2.orderGoodsCode" placeholder="请输入采购单号" maxlength="20" clearable style="width: 240px"/> <el-input v-model="queryParams2.orderGoodsCode" placeholder="请输入采购单号" maxlength="20" clearable style="width: 240px"/>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery2">搜索</el-button> <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery2">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery2">重置</el-button> <el-button icon="el-icon-refresh" size="mini" @click="resetQuery2">重置</el-button>
@ -247,21 +258,21 @@
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{(queryParams2.pageNum - 1) * queryParams2.pageSize + scope.$index + 1}}</span> <span>{{(queryParams2.pageNum - 1) * queryParams2.pageSize + scope.$index + 1}}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="采购单号" align="center" prop="orderGoodsCode" :show-overflow-tooltip="true" /> <el-table-column label="采购单号" align="center" prop="orderGoodsCode" :show-overflow-tooltip="true" />
<el-table-column label="采购订单标题" align="center" prop="orderTitle" :show-overflow-tooltip="true"/> <el-table-column label="采购订单标题" align="center" prop="orderTitle" :show-overflow-tooltip="true"/>
<el-table-column label="采购总金额(元" align="center" prop="orderAmount" :show-overflow-tooltip="true" width="120"> <el-table-column label="采购总金额(元" align="center" prop="orderAmount" :show-overflow-tooltip="true" width="120">
<template slot-scope="scope"> <template slot-scope="scope">
<span>{{ (scope.row.orderAmount/100).toFixed(2) }}</span> <span>{{ (scope.row.orderAmount/100).toFixed(2) }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="供应商" align="center" prop="supplierName" :show-overflow-tooltip="true" /> <el-table-column label="供应商" align="center" prop="supplierName" :show-overflow-tooltip="true" />
<el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true" /> <el-table-column label="创建人" align="center" prop="createBy" :show-overflow-tooltip="true" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button size="mini" type="text" <el-button size="mini" type="text"
@click="confirmImport(scope.row)" v-if="scope.row.orderStatus==2" @click="confirmImport(scope.row)" v-if="scope.row.orderStatus==2"
>导入</el-button> >导入</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -271,37 +282,39 @@
:page.sync="queryParams2.pageNum" :page.sync="queryParams2.pageNum"
:limit.sync="queryParams2.pageSize" :limit.sync="queryParams2.pageSize"
@pagination="getList2" @pagination="getList2"
/> />
</div> </div>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
<el-button type="primary" @click="openImportDialog=false"> </el-button> <el-button type="primary" @click="openImportDialog=false"> </el-button>
<el-button @click="openImportDialog=false"> </el-button> <el-button @click="openImportDialog=false"> </el-button>
</div> </div>
</el-dialog> </el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { imgUpLoadTwo } from '@/api/system/upload' import { imgUpLoadTwo } from '@/api/system/upload'
import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall"; import { systemAreaTreeApi,getCanteenByAreaApi,getStallByCanteenApi } from "@/api/base/stall";
import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/purchaseManage"; import { systemMaterialTreeApi,getMaterialListApi,supplierPageApi } from "@/api/foodManage/purchaseManage";
import { getPurchaseContractInfoApi,addPurchaseContractApi,editPurchaseContractApi,delPurchaseContractApi } from "@/api/foodManage/purchaseManage"; import { getPurchaseContractInfoApi,addPurchaseContractApi,editPurchaseContractApi,delPurchaseContractApi } from "@/api/foodManage/purchaseManage";
import { purchaseOrderPageApi,getPurchaseOrderInfoApi } from "@/api/foodManage/purchaseManage"; import { purchaseOrderPageApi,getPurchaseOrderInfoApi,fetchUsers } from "@/api/foodManage/purchaseManage";
export default { export default {
name: "ContractEdit", name: "ContractEdit",
dicts: [], dicts: [],
data() { data() {
return { return {
contractPersonOptions: [], //
contractPerson: '', //
contractRowData:{},// contractRowData:{},//
loading:false, loading:false,
loadingBtn:false, loadingBtn:false,
baseInfo: { baseInfo: {
contractTitle:undefined, contractTitle:undefined,
contractType:undefined, contractType:undefined,
areaId:undefined, areaId:undefined,
canteenId:undefined, canteenId:undefined,
dateRange:[], dateRange:[],
contractAttachmentList:[], contractAttachmentList:[],
}, },
// //
baseRules: { baseRules: {
@ -331,7 +344,7 @@ export default {
canteenOptions:[], canteenOptions:[],
supplierOptions:[], supplierOptions:[],
stallOptions:[], stallOptions:[],
pickerOptions: { pickerOptions: {
disabledDate(v) { disabledDate(v) {
return v.getTime() < (new Date().getTime() - 86400000);// - 86400000 return v.getTime() < (new Date().getTime() - 86400000);// - 86400000
} }
@ -340,22 +353,22 @@ export default {
contractMaterialList:[],//- contractMaterialList:[],//-
batchIds:[],//-- batchIds:[],//--
openDialog:false, openDialog:false,
materialTreeOptions:[], materialTreeOptions:[],
queryParams: { // -- queryParams: { // --
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
}, },
total: 0, // total: 0, //
tableListData: [],//- tableListData: [],//-
batchChosenMaterial:[],//-- batchChosenMaterial:[],//--
noMaterial:false, noMaterial:false,
// //
openImportDialog:false, openImportDialog:false,
queryParams2: { // -- queryParams2: { // --
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
orderGoodsCode:null orderGoodsCode:null
}, },
loading2:false, loading2:false,
total2: 0, // total2: 0, //
tableListData2: [],//- tableListData2: [],//-
@ -364,10 +377,11 @@ export default {
}; };
}, },
created() { created() {
this.getAreaTreeData() this.fetchUsers();
this.getMaterialTree() this.getAreaTreeData()
this.getMaterialTree()
this.attachmentList=[] this.attachmentList=[]
if(this.$route.query.contractRowData){ if(this.$route.query.contractRowData){
this.contractRowData = JSON.parse(this.$route.query.contractRowData) this.contractRowData = JSON.parse(this.$route.query.contractRowData)
this.getContractInfo() this.getContractInfo()
} }
@ -380,44 +394,62 @@ export default {
}else{ }else{
this.baseInfo={} this.baseInfo={}
this.contractMaterialList=[] this.contractMaterialList=[]
this.attachmentList=[] this.attachmentList=[]
} }
}, },
}, },
methods: { methods: {
//
fetchUsers() {
let param = {
pageNum:1,
pageSize: 1000,
roleIds: 130, //
}
fetchUsers(param).then((response) => {
console.log(response);
if (response.rows) {
//
this.contractPersonOptions = response.rows.map(user => ({
value: user.userId, //
label: user.userName, //
}));
}
});
},
// //
jumpList() { jumpList() {
const obj = { path: "foodManage/purchaseManage/contractDetail" }; const obj = { path: "foodManage/purchaseManage/contractDetail" };
this.$tab.closeOpenPage(obj); this.$tab.closeOpenPage(obj);
this.$router.replace({ path: "/foodManage/purchaseManage/contractList" }); // this.$router.replace({ path: "/foodManage/purchaseManage/contractList" }); //
}, },
getContractInfo(){ getContractInfo(){
console.log(this.contractRowData) console.log(this.contractRowData)
let param = { let param = {
contractId:this.contractRowData.contractId contractId:this.contractRowData.contractId
} }
// //
getPurchaseContractInfoApi(param).then((response) => { getPurchaseContractInfoApi(param).then((response) => {
this.baseInfo = response.data; this.baseInfo = response.data;
this.$set(this.baseInfo,'dateRange',[this.baseInfo.contractStartTime,this.baseInfo.contractEndTime]) this.$set(this.baseInfo,'dateRange',[this.baseInfo.contractStartTime,this.baseInfo.contractEndTime])
this.contractMaterialList = this.baseInfo.purchaseContractDetailList; this.contractMaterialList = this.baseInfo.purchaseContractDetailList;
this.contractMaterialList.forEach(item=>{ this.contractMaterialList.forEach(item=>{
this.$set(item,"singlePrice",Number(item.singlePrice)/100) this.$set(item,"singlePrice",Number(item.singlePrice)/100)
}) })
if(this.baseInfo.contractAttachmentList.length>0){ if(this.baseInfo.contractAttachmentList.length>0){
this.baseInfo.contractAttachmentList.forEach(item=>{ this.baseInfo.contractAttachmentList.forEach(item=>{
this.attachmentList.push({name:item,url:item}) this.attachmentList.push({name:item,url:item})
}) })
} }
getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => { getCanteenByAreaApi({areaId:this.baseInfo.areaId}).then((response) => {
this.canteenOptions=response.rows||[]; this.canteenOptions=response.rows||[];
this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId) this.$set(this.baseInfo,"canteenId",this.baseInfo.canteenId)
}); });
supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => { supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => {
this.supplierOptions = response.rows||[]; this.supplierOptions = response.rows||[];
this.$set(this.baseInfo,'supplierId',this.baseInfo.supplierId) this.$set(this.baseInfo,'supplierId',this.baseInfo.supplierId)
}); });
}); });
}, },
// //
getAreaTreeData() { getAreaTreeData() {
@ -437,79 +469,79 @@ export default {
} }
}, },
//- //-
handleAreaChange(e){ handleAreaChange(e){
this.getCanteenData() this.getCanteenData()
this.getSupplierData() this.getSupplierData()
}, },
/** 查询查询食堂下拉结构 */ /** 查询查询食堂下拉结构 */
getCanteenData() { getCanteenData() {
let param= { let param= {
areaId:this.baseInfo.areaId areaId:this.baseInfo.areaId
} }
getCanteenByAreaApi(param).then((response) => { getCanteenByAreaApi(param).then((response) => {
this.canteenOptions=response.rows||[]; this.canteenOptions=response.rows||[];
this.$set(this.baseInfo,"canteenId",null) this.$set(this.baseInfo,"canteenId",null)
}); });
}, },
/** 查询供应商下拉结构 */ /** 查询供应商下拉结构 */
getSupplierData() { getSupplierData() {
supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => { supplierPageApi({ isPaging:1,areaIdList:[this.baseInfo.areaId] }).then((response) => {
this.supplierOptions = response.rows||[]; this.supplierOptions = response.rows||[];
this.$set(this.baseInfo,"supplierId",null) this.$set(this.baseInfo,"supplierId",null)
}); });
}, },
/** 查询货品类别下拉树结构 */ /** 查询货品类别下拉树结构 */
getMaterialTree() { getMaterialTree() {
let param = { let param = {
// goodsType:1 // goodsType:1
} }
systemMaterialTreeApi(param).then((response) => { systemMaterialTreeApi(param).then((response) => {
this.materialTreeOptions = response.data; this.materialTreeOptions = response.data;
}); });
}, },
// //
changeDateRange(e){ changeDateRange(e){
//this.formatDate(e[0]) //this.formatDate(e[0])
}, },
// //
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.batchIds = selection.map(item => item.materialId) this.batchIds = selection.map(item => item.materialId)
}, },
// //
delMaterial(){ delMaterial(){
this.batchIds.forEach(ID=>{ this.batchIds.forEach(ID=>{
let index = this.contractMaterialList.findIndex(v=>v.materialId==ID) let index = this.contractMaterialList.findIndex(v=>v.materialId==ID)
if(index>-1){ if(index>-1){
this.contractMaterialList.splice(index,1) this.contractMaterialList.splice(index,1)
} }
}) })
setTimeout(()=>{ setTimeout(()=>{
this.$refs.multipleTable.clearSelection() this.$refs.multipleTable.clearSelection()
},300) },300)
}, },
// //
addMaterial(){ addMaterial(){
if(this.baseInfo.areaId!=undefined){ if(this.baseInfo.areaId!=undefined){
this.openDialog=true this.openDialog=true
this.resetQuery() this.resetQuery()
setTimeout(()=>{ setTimeout(()=>{
this.$refs.multipleTable1.clearSelection() this.$refs.multipleTable1.clearSelection()
},300) },300)
}else{ }else{
this.$modal.msgError("请先选择区域"); this.$modal.msgError("请先选择区域");
} }
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1; this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.queryParams = { this.queryParams = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
} }
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
@ -522,7 +554,7 @@ export default {
"pageNum": this.queryParams.pageNum, "pageNum": this.queryParams.pageNum,
"areaId": this.baseInfo.areaId, "areaId": this.baseInfo.areaId,
"materialName": this.queryParams.materialName, "materialName": this.queryParams.materialName,
"materialCode": this.queryParams.materialCode, "materialCode": this.queryParams.materialCode,
"materialTypeIds": this.queryParams.materialTypeIds, "materialTypeIds": this.queryParams.materialTypeIds,
} }
getMaterialListApi(param).then(response => { getMaterialListApi(param).then(response => {
@ -534,14 +566,14 @@ export default {
handleSelectionChange2(selection) { handleSelectionChange2(selection) {
this.batchChosenMaterial = selection; this.batchChosenMaterial = selection;
this.batchChosenMaterial.forEach(item=>{ this.batchChosenMaterial.forEach(item=>{
this.$set(item,"orderNum",0) this.$set(item,"orderNum",0)
this.$set(item,"singlePrice",item.unitPrice/100) this.$set(item,"singlePrice",item.unitPrice/100)
}) })
}, },
confirmChosen(){ confirmChosen(){
if(this.batchChosenMaterial.length>0){ if(this.batchChosenMaterial.length>0){
this.loading = true; this.loading = true;
let items = [...this.contractMaterialList,...this.batchChosenMaterial] let items = [...this.contractMaterialList,...this.batchChosenMaterial]
let uniqueItems = items.filter((item, index, array) => { let uniqueItems = items.filter((item, index, array) => {
return array.findIndex((t) => (t.materialId === item.materialId)) === index; return array.findIndex((t) => (t.materialId === item.materialId)) === index;
}); });
@ -549,32 +581,32 @@ export default {
setTimeout(()=>{ setTimeout(()=>{
this.loading = false this.loading = false
this.openDialog=false this.openDialog=false
},500) },500)
} }
}, },
//稿 //稿
confirmSave(){ confirmSave(){
this.$refs["baseInfo"].validate(valid => { this.$refs["baseInfo"].validate(valid => {
if (valid) { if (valid) {
let param = Object.assign({},this.baseInfo); let param = Object.assign({},this.baseInfo);
param.contractStartTime = this.formatDateTime(this.baseInfo.dateRange[0]) param.contractStartTime = this.formatDateTime(this.baseInfo.dateRange[0])
param.contractEndTime = this.formatDateTime(this.baseInfo.dateRange[1]) param.contractEndTime = this.formatDateTime(this.baseInfo.dateRange[1])
param.contractSigningTime = this.formatDate(this.baseInfo.contractSigningTime) param.contractSigningTime = this.formatDate(this.baseInfo.contractSigningTime)
if(this.baseInfo.payMoneyDate){ if(this.baseInfo.payMoneyDate){
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate) param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
} }
param.contractAmount = 0; param.contractAmount = 0;
param.commitStatus=1 param.commitStatus=1
param.purchaseContractDetailList = [] param.purchaseContractDetailList = []
param.contractAttachment = "" param.contractAttachment = ""
if(this.attachmentList.length>0){ if(this.attachmentList.length>0){
console.log(this.attachmentList) console.log(this.attachmentList)
let arr = this.attachmentList.map(item=>item.url) let arr = this.attachmentList.map(item=>item.url)
param.contractAttachment = arr.join(',') param.contractAttachment = arr.join(',')
console.log(param) console.log(param)
} }
this.noMaterial = false; this.noMaterial = false;
if(this.contractMaterialList.length>0){ if(this.contractMaterialList.length>0){
this.contractMaterialList.forEach(item=>{ this.contractMaterialList.forEach(item=>{
if(item.singlePrice==0 || item.orderNum==0){ if(item.singlePrice==0 || item.orderNum==0){
this.noMaterial = true this.noMaterial = true
@ -583,16 +615,16 @@ export default {
obj.singlePrice = Number(obj.singlePrice)*100 obj.singlePrice = Number(obj.singlePrice)*100
param.contractAmount = param.contractAmount+(Number(obj.singlePrice)*Number(obj.orderNum)) param.contractAmount = param.contractAmount+(Number(obj.singlePrice)*Number(obj.orderNum))
param.purchaseContractDetailList.push(obj) param.purchaseContractDetailList.push(obj)
} }
}) })
} }
if(this.noMaterial){ if(this.noMaterial){
this.$modal.msgError("请输入单价和数量!"); this.$modal.msgError("请输入单价和数量!");
}else{ }else{
this.noMaterial = true; this.noMaterial = true;
if(this.contractMaterialList.length>0){ if(this.contractMaterialList.length>0){
this.noMaterial = false; this.noMaterial = false;
} }
console.log(param) console.log(param)
if(this.noMaterial){ if(this.noMaterial){
this.$modal.msgError("请添加货品!"); this.$modal.msgError("请添加货品!");
@ -602,48 +634,48 @@ export default {
editPurchaseContractApi(param).then((response) => { editPurchaseContractApi(param).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
}).catch(() => { }).catch(() => {
this.loadingBtn=false this.loadingBtn=false
}); });
} else { } else {
addPurchaseContractApi(param).then((response) => { addPurchaseContractApi(param).then((response) => {
this.$modal.msgSuccess("保存成功"); this.$modal.msgSuccess("保存成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
}).catch(() => { }).catch(() => {
this.loadingBtn=false this.loadingBtn=false
}); });
} }
} }
} }
} }
}); });
}, },
// //
confirmSubmit(){ confirmSubmit(){
this.$refs["baseInfo"].validate(valid => { this.$refs["baseInfo"].validate(valid => {
if (valid) { if (valid) {
let param = Object.assign({},this.baseInfo); let param = Object.assign({},this.baseInfo);
param.contractStartTime = this.formatDateTime(this.baseInfo.dateRange[0]) param.contractStartTime = this.formatDateTime(this.baseInfo.dateRange[0])
param.contractEndTime = this.formatDateTime(this.baseInfo.dateRange[1]) param.contractEndTime = this.formatDateTime(this.baseInfo.dateRange[1])
param.contractSigningTime = this.formatDate(this.baseInfo.contractSigningTime) param.contractSigningTime = this.formatDate(this.baseInfo.contractSigningTime)
if(this.baseInfo.payMoneyDate){ if(this.baseInfo.payMoneyDate){
param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate) param.payMoneyDate = this.formatDate(this.baseInfo.payMoneyDate)
} }
param.contractAmount = 0; param.contractAmount = 0;
param.commitStatus=2 param.commitStatus=2
param.purchaseContractDetailList = [] param.purchaseContractDetailList = []
param.contractAttachment = "" param.contractAttachment = ""
if(this.attachmentList.length>0){ if(this.attachmentList.length>0){
console.log(this.attachmentList) console.log(this.attachmentList)
let arr = this.attachmentList.map(item=>item.url) let arr = this.attachmentList.map(item=>item.url)
param.contractAttachment = arr.join(',') param.contractAttachment = arr.join(',')
console.log(param) console.log(param)
} }
this.noMaterial = false; this.noMaterial = false;
if(this.contractMaterialList.length>0){ if(this.contractMaterialList.length>0){
this.contractMaterialList.forEach(item=>{ this.contractMaterialList.forEach(item=>{
if(item.singlePrice==0 || item.orderNum==0){ if(item.singlePrice==0 || item.orderNum==0){
this.noMaterial = true this.noMaterial = true
@ -652,16 +684,16 @@ export default {
obj.singlePrice = Number(obj.singlePrice)*100 obj.singlePrice = Number(obj.singlePrice)*100
param.contractAmount = param.contractAmount+(Number(obj.singlePrice)*Number(obj.orderNum)) param.contractAmount = param.contractAmount+(Number(obj.singlePrice)*Number(obj.orderNum))
param.purchaseContractDetailList.push(obj) param.purchaseContractDetailList.push(obj)
} }
}) })
} }
if(this.noMaterial){ if(this.noMaterial){
this.$modal.msgError("请输入单价和数量!"); this.$modal.msgError("请输入单价和数量!");
}else{ }else{
this.noMaterial = true; this.noMaterial = true;
if(this.contractMaterialList.length>0){ if(this.contractMaterialList.length>0){
this.noMaterial = false; this.noMaterial = false;
} }
console.log(param) console.log(param)
if(this.noMaterial){ if(this.noMaterial){
this.$modal.msgError("请添加货品!"); this.$modal.msgError("请添加货品!");
@ -671,36 +703,36 @@ export default {
editPurchaseContractApi(param).then((response) => { editPurchaseContractApi(param).then((response) => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
}).catch(() => { }).catch(() => {
this.loadingBtn=false this.loadingBtn=false
}); });
} else { } else {
addPurchaseContractApi(param).then((response) => { addPurchaseContractApi(param).then((response) => {
this.$modal.msgSuccess("保存成功"); this.$modal.msgSuccess("保存成功");
this.loadingBtn=false this.loadingBtn=false
this.jumpList() this.jumpList()
}).catch(() => { }).catch(() => {
this.loadingBtn=false this.loadingBtn=false
}); });
} }
} }
} }
} }
}); });
}, },
// //
importPurchaseOrder(){ importPurchaseOrder(){
if(this.baseInfo.areaId!=undefined||this.baseInfo.deliveryWarehouseId!=undefined||this.baseInfo.supplierId!=undefined){ if(this.baseInfo.areaId!=undefined||this.baseInfo.deliveryWarehouseId!=undefined||this.baseInfo.supplierId!=undefined){
this.openImportDialog=true this.openImportDialog=true
this.resetQuery2() this.resetQuery2()
// setTimeout(()=>{ // setTimeout(()=>{
// this.$refs.multipleTable2.clearSelection() // this.$refs.multipleTable2.clearSelection()
// },300) // },300)
}else{ }else{
this.$modal.msgError("请先选择区域,供应商"); this.$modal.msgError("请先选择区域,供应商");
} }
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery2() { handleQuery2() {
@ -708,10 +740,10 @@ export default {
this.getList2(); this.getList2();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery2() { resetQuery2() {
this.queryParams2 = { this.queryParams2 = {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
} }
this.resetForm("queryForm2"); this.resetForm("queryForm2");
this.handleQuery2(); this.handleQuery2();
@ -726,59 +758,59 @@ export default {
"orderStatus":2, "orderStatus":2,
// "isInspect":2, // "isInspect":2,
"areaId": this.baseInfo.areaId, "areaId": this.baseInfo.areaId,
// "warehouseId": this.baseInfo.deliveryWarehouseId, // "warehouseId": this.baseInfo.deliveryWarehouseId,
"supplierId": this.baseInfo.supplierId, "supplierId": this.baseInfo.supplierId,
} }
purchaseOrderPageApi(param).then(response => { purchaseOrderPageApi(param).then(response => {
this.tableListData2 = response.rows; this.tableListData2 = response.rows;
this.total2 = Number(response.total); this.total2 = Number(response.total);
this.loading2 = false; this.loading2 = false;
}); });
}, },
confirmImport(row){ confirmImport(row){
console.log(row) console.log(row)
this.importRow = row; this.importRow = row;
let param = { let param = {
orderGoodsId:this.importRow.orderGoodsId orderGoodsId:this.importRow.orderGoodsId
} }
getPurchaseOrderInfoApi(param).then((response) => { getPurchaseOrderInfoApi(param).then((response) => {
this.materialDetailsData = response.data.orderGoodsDetailList||[]; this.materialDetailsData = response.data.orderGoodsDetailList||[];
this.$modal.confirm('是否确认导入采购订单?').then(()=>{ this.$modal.confirm('是否确认导入采购订单?').then(()=>{
if(this.materialDetailsData.length>0){ if(this.materialDetailsData.length>0){
this.contractMaterialList = this.materialDetailsData; this.contractMaterialList = this.materialDetailsData;
this.contractMaterialList.forEach(item=>{ this.contractMaterialList.forEach(item=>{
this.$set(item,"singlePrice",Number(item.singlePrice/100)) this.$set(item,"singlePrice",Number(item.singlePrice/100))
this.$set(item,"orderNum",item.orderNum) this.$set(item,"orderNum",item.orderNum)
// if(item.totalQualifiedNum&&item.totalQualifiedNum>0){ // if(item.totalQualifiedNum&&item.totalQualifiedNum>0){
// this.$set(item,"deliveryNum",Number(item.orderNum)-Number(item.totalQualifiedNum)) // this.$set(item,"deliveryNum",Number(item.orderNum)-Number(item.totalQualifiedNum))
// this.$set(item,"qualifiedNum",Number(item.orderNum)-Number(item.totalQualifiedNum)) // this.$set(item,"qualifiedNum",Number(item.orderNum)-Number(item.totalQualifiedNum))
// }else{ // }else{
// this.$set(item,"deliveryNum",Number(item.orderNum)) // this.$set(item,"deliveryNum",Number(item.orderNum))
// this.$set(item,"qualifiedNum",Number(item.orderNum)) // this.$set(item,"qualifiedNum",Number(item.orderNum))
// } // }
}) })
// this.baseInfo.relateOrderGoodsId = this.importRow.orderGoodsCode; // this.baseInfo.relateOrderGoodsId = this.importRow.orderGoodsCode;
this.$set(this.baseInfo,"remark","导入采购订单") this.$set(this.baseInfo,"remark","导入采购订单")
setTimeout(()=>{ setTimeout(()=>{
this.openImportDialog=false this.openImportDialog=false
},500) },500)
}else{ }else{
this.$modal.msgError("采购订单明细无货品!"); this.$modal.msgError("采购订单明细无货品!");
} }
}).catch(() => {}); }).catch(() => {});
}); });
}, },
// //
fileUpLoad(param){ fileUpLoad(param){
param.type = 'canteen' param.type = 'canteen'
imgUpLoadTwo(param).then((res) => { imgUpLoadTwo(param).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.attachmentList.push(res.data) this.attachmentList.push(res.data)
this.baseInfo.contractAttachmentList.push(res.data.url) this.baseInfo.contractAttachmentList.push(res.data.url)
} else { } else {
this.$modal.msgError(res.msg); this.$modal.msgError(res.msg);
} }
}).catch((error) => { }).catch((error) => {
this.$modal.msgError(error) this.$modal.msgError(error)
}) })
}, },
@ -798,9 +830,9 @@ export default {
sum = index sum = index
} }
}) })
this.attachmentList.splice(sum, 1) this.attachmentList.splice(sum, 1)
this.baseInfo.contractAttachmentList.splice(sum, 1) this.baseInfo.contractAttachmentList.splice(sum, 1)
}, },
// //
formatDate(date) { formatDate(date) {
// YYYY-MM-DD // YYYY-MM-DD
@ -821,7 +853,7 @@ export default {
const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes() const minutes = date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()
const seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds() const seconds = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
} }
} }
}; };
</script> </script>
@ -863,10 +895,10 @@ export default {
align-items: center; align-items: center;
cursor: pointer; cursor: pointer;
} }
.dish-name:hover{ .dish-name:hover{
background-color:rgba(0, 0, 0, 0.1); background-color:rgba(0, 0, 0, 0.1);
color: #4b80fd; color: #4b80fd;
} }
.dialog-center{ .dialog-center{
width: 10%; width: 10%;
@ -918,4 +950,4 @@ export default {
border: 1px solid #fff; border: 1px solid #fff;
cursor: pointer; cursor: pointer;
} }
</style> </style>