1007 lines
33 KiB
Vue
1007 lines
33 KiB
Vue
<template>
|
||
<div class="sys-box knowledge-box">
|
||
<div class="sys-operate">
|
||
|
||
<el-button type="primary" @click="goAdd()" v-has="'sales:salesContract:add'">新增</el-button>
|
||
<el-button type="primary" @click="remove()" :disabled="btnOtherDisabled"
|
||
v-has="'sales:salesContract:remove'">删除</el-button>
|
||
<el-button type="primary" @click="exportExcel()" v-has="'sales:salesContract:exportExcel'">导出</el-button>
|
||
<el-button type="primary" @click="audit" :disabled="btnDelDisabled"
|
||
v-has="'sales:salesContract:audit'">审核</el-button>
|
||
<el-button type="primary" @click="disAudit" :disabled="btnDelDisabled"
|
||
v-has="'sales:salesContract:disAudit'">反审核</el-button>
|
||
<el-button type="primary" @click="close" :disabled="btnDelDisabled" v-has="'sales:salesContract:close'">{{
|
||
config.closeContractText }}</el-button>
|
||
<el-button type="primary" @click="reverseClose" :disabled="btnDelDisabled"
|
||
v-has="'sales:salesContract:reverseClose'">{{ config.openContractText }}</el-button>
|
||
<el-button type="primary" @click="change" :disabled="btnDelDisabled"
|
||
v-has="'sales:salesContract:change'">变更</el-button>
|
||
<el-button type="primary" @click="gotoAlterationList" :disabled="btnDelDisabled"
|
||
v-has="'sales:salesContract:gotoAlterationList'">变更记录</el-button>
|
||
<el-button type="primary" @click="showColumnSetDialog">{{ config.configureBtnName }}</el-button>
|
||
</div>
|
||
<div class="sys-search">
|
||
<el-form inline class="form_item_search_out">
|
||
<div class='form_item_input_out'>
|
||
<el-form-item label="合同编号" style='width:22%' class="form_item-inline">
|
||
<el-input v-model="search_data.contractCode" placeholder="请输入合同编号" clearable></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="客户" style='width:22%' class="form_item-inline">
|
||
<el-input v-model="search_data.clientName" placeholder="请输入客户" clearable></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="物料名称" style='width:22%' class="form_item-inline">
|
||
<el-input v-model="search_data.materielName" placeholder="物料" clearable></el-input>
|
||
</el-form-item>
|
||
<el-form-item label="合同日期" style='width:34%' class="form_item-inline">
|
||
<el-date-picker v-model="time" type="daterange" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
|
||
range-separator="—" start-placeholder="开始时间" end-placeholder="结束时间"></el-date-picker>
|
||
</el-form-item>
|
||
</div>
|
||
<div class='form_item_btn_out'>
|
||
<el-form-item>
|
||
<el-button type="primary" @click="search()">查询</el-button>
|
||
</el-form-item>
|
||
<el-form-item>
|
||
<el-button type="primary" @click="moreSearch()">高级查询</el-button>
|
||
</el-form-item>
|
||
</div>
|
||
</el-form>
|
||
</div>
|
||
<div class="sys-table">
|
||
<el-table border v-if="formTableData.length > 0" id="out-table" @row-click="gotoDetail" ref="tb"
|
||
v-loading="pictLoading" show-summary :summary-method="getSummaries" :data="tableData"
|
||
@selection-change="handleSelectionChange"
|
||
:header-cell-style="{ fontWeight: 'normal', textAlign: 'center', backgroundColor: '#eceff4', color: '#222' }">
|
||
<el-table-column type="selection" width="55" align="center"></el-table-column>
|
||
<el-table-column v-for="(items, index) in formTableData" :key="index" :prop="items.prop_" :label="items.title"
|
||
:sortable="items.sortAble" align="center" show-overflow-tooltip>
|
||
|
||
</el-table-column>
|
||
</el-table>
|
||
</div>
|
||
<div class="sys-pagination">
|
||
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||
:current-page="search_data.pageno" :page-sizes="pageSizes" :page-size="search_data.pagesize"
|
||
layout="total, sizes, prev, pager, next, jumper" :total="total"></el-pagination>
|
||
</div>
|
||
|
||
<!-- 状态控制 -->
|
||
<el-dialog :title="columnSetDialogTitle" center :visible.sync="columnSetDialogVisible" width="531px"
|
||
:before-close="handleClose">
|
||
<el-table border :data="showTableColumns" :key="Math.random()" max-height="350" style="width: 100%">
|
||
<el-table-column prop="title" label="列表名称" width="180" fixed>
|
||
</el-table-column>
|
||
<el-table-column prop="select" label="是否显示" width="180">
|
||
<template slot-scope="scope">
|
||
<el-switch v-model="scope.row.select">
|
||
</el-switch>
|
||
</template>
|
||
</el-table-column>
|
||
<el-table-column label="操作">
|
||
<template slot-scope="scope">
|
||
<el-button type="text" size="small" @click="toUp(scope)">前移</el-button>
|
||
<el-button type="text" size="small" @click="toDown(scope)">后移</el-button>
|
||
</template>
|
||
</el-table-column>
|
||
</el-table>
|
||
<el-row type="flex" class="row-bg" justify="center" style="margin-top: 10px;">
|
||
<el-col :span="6">
|
||
<el-button type="primary" size="middle" @click="saveAndCloseColumnSetDialog">完成</el-button>
|
||
</el-col>
|
||
<el-col :span="6">
|
||
<el-button type="primary" size="middle" @click="toDefault">恢复默认</el-button>
|
||
</el-col>
|
||
</el-row>
|
||
</el-dialog>
|
||
|
||
<!-- 高级查询对话框 -->
|
||
<el-dialog :title="dialogTitle" center :visible.sync="advanceQueryDialogVisible" width="670px">
|
||
<el-form :inline="true" v-loading="dialogLoading" label-width="80px" class="dialog-form" ref="form"
|
||
style="width: 620px">
|
||
<div class="dialog-line">
|
||
<el-form-item label="合同时间" class="dialog-form-inline-single">
|
||
<el-date-picker v-model="formDataTime" type="daterange" format="yyyy-MM-dd"
|
||
value-format="yyyy-MM-dd HH:mm:ss" range-separator="—" start-placeholder="开始时间"
|
||
end-placeholder="结束时间"></el-date-picker>
|
||
</el-form-item>
|
||
</div>
|
||
<div class="dialog-line">
|
||
<el-form-item label="合同类型" class="dialog-form-inline">
|
||
<el-select v-model="formData.contractType" style="width:100%" clearable placeholder="请选择"
|
||
@change="changeFacility">
|
||
<el-option v-for="item in typeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
<el-form-item label="客户" class="dialog-form-inline">
|
||
<el-input placeholder="请输入客户名" v-model="formData.clientName" clearable></el-input>
|
||
</el-form-item>
|
||
</div>
|
||
<div class="dialog-line">
|
||
<el-form-item label="物料" class="dialog-form-inline">
|
||
<btn-input :valueText.sync='formData.materielName' :valueId.sync='formData.materiel'
|
||
:chooseVisible.sync='chooseMaterielVisible'></btn-input>
|
||
</el-form-item>
|
||
<el-form-item label="规格型号" class="dialog-form-inline">
|
||
<el-input placeholder="请输入规格型号" v-model="formData.specification" clearable></el-input>
|
||
</el-form-item>
|
||
</div>
|
||
<div class="dialog-line">
|
||
<el-form-item label="销售部门" class="dialog-form-inline">
|
||
<el-cascader v-model="salesPersonDept" clearable :options="depOptions"
|
||
:props="{ expandTrigger: 'hover', label: 'text', value: 'id', checkStrictly: true }"
|
||
@change="handleChange"></el-cascader>
|
||
</el-form-item>
|
||
<el-form-item label="审核状态" class="dialog-form-inline">
|
||
<el-select v-model="formData.auditSign" style="width:100%" clearable placeholder="请选择"
|
||
@change="changeFacility">
|
||
<el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||
</el-select>
|
||
</el-form-item>
|
||
</div>
|
||
<div class="dialog-line">
|
||
<el-form-item label="销售员" prop="salesPersonName" class="dialog-form-inline">
|
||
>
|
||
<btn-input :valueText.sync='formData.salesPersonName' :valueId.sync='formData.salesPerson'
|
||
:chooseVisible.sync='chooseUserVisible'></btn-input>
|
||
</el-form-item>
|
||
<el-form-item label="制单人" prop="createByName" class="dialog-form-inline">
|
||
|
||
<btn-input :valueText.sync='formData.createByName' :valueId.sync='formData.createBy'
|
||
:chooseVisible.sync='chooseUserVisible1'></btn-input>
|
||
</el-form-item>
|
||
</div>
|
||
|
||
</el-form>
|
||
<span slot="footer" class="dialog-footer">
|
||
<el-button type="primary" @click="save">确定</el-button>
|
||
<el-button type="primary" @click="advanceQueryDialogVisible = false">关闭</el-button>
|
||
<el-button type="primary" @click="clear">清空</el-button>
|
||
</span>
|
||
</el-dialog>
|
||
|
||
<!--选择用户-->
|
||
<DialogChooseSingleUser :visible.sync="chooseUserVisible" @change="getUser"></DialogChooseSingleUser>
|
||
<!--选择制单人-->
|
||
<DialogChooseSingleUser1 :visible.sync="chooseUserVisible1" @change="getUser1"></DialogChooseSingleUser1>
|
||
<!--选择物料-->
|
||
<dialogChooseSingleParts :visible.sync="chooseMaterielVisible" @change="getMateriel"></dialogChooseSingleParts>
|
||
</div>
|
||
</template>
|
||
|
||
<script>
|
||
import {mapState, mapActions, mapGetters} from "vuex";
|
||
import btnInput from "@/components/btnInput.vue";
|
||
import FileSaver from 'file-saver'
|
||
import config from "@/utils/config.js";
|
||
import Cookies from "js-cookie";
|
||
import DialogChooseSingleUser from "@/components/System/dialogChooseSingleUser";
|
||
import dialogChooseSingleParts from "@/components/System/dialogChooseSingleParts";
|
||
import DialogChooseSingleUser1 from "@/components/System/dialogChooseSingleUser";
|
||
import { formatDateTime, getCurrentDate } from "@/utils/tools.js";
|
||
export default {
|
||
components: {
|
||
btnInput,DialogChooseSingleUser,DialogChooseSingleUser1,dialogChooseSingleParts
|
||
},
|
||
data() {
|
||
return {
|
||
total: 0, //总条数
|
||
pageSizes: [10, 20, 50], //每页展示多少条
|
||
search_data: {
|
||
pageno: 1,
|
||
pagesize: 10,
|
||
},
|
||
search_data1: {
|
||
pageno: 1,
|
||
pagesize: 10,
|
||
startTime: "",
|
||
endTime: "",
|
||
contractCode: '',
|
||
createByName: '',
|
||
},
|
||
formData: {
|
||
startTime: "",
|
||
endTime: "",
|
||
contractType: '',
|
||
contractTypeName: '',
|
||
unitUomName: '',
|
||
clientName: '',
|
||
materielName: '',
|
||
specification: '',
|
||
auditSign: '',
|
||
salesPersonName: '',
|
||
salesPerson: '',
|
||
// createTime: '',
|
||
deptId: '',
|
||
salesPersonDept: '',
|
||
createBy: "",//制单人id
|
||
createByName:"",
|
||
},
|
||
//默认列表数据
|
||
showTableColumnsDefault: [
|
||
{title: "合同日期", prop_: "contractDate", select: true},
|
||
{title: "合同编号", prop_: "contractCode", select: true},
|
||
{title: "客户合同编号", prop_: "clientContractCode", select: true},
|
||
{title: "合同类型", prop_: "contractTypeName", select: true},
|
||
{title: "关闭标志", prop_: "closeStatusName", select: true},
|
||
{title: "客户名称", prop_: "clientName", select: true},
|
||
{title: "销售员", prop_: "salesPersonName", select: true},
|
||
{title: "销售部门", prop_: "salesPersonDeptName", select: true},
|
||
{title: "发货是否检验", prop_: "isCheck", select: true},
|
||
{title: "物料代码", prop_: "materielSerialNo", select: true},
|
||
{title: "物料名称", prop_: "materielName", select: true},
|
||
{title: "规格型号", prop_: "specification", select: true},
|
||
{title: "主计量单位", prop_: "unitUomName", select: true},
|
||
{title: "主单位数量", prop_: "count", select: true},
|
||
{title: "辅助单位", prop_: "supportUomName", select: true},
|
||
{title: "销售数量", prop_: "saleCount", select: true},
|
||
{title: "含税单价(元)", prop_: "taxUnitPrice", select: true},
|
||
{title: "销售金额(元)", prop_: "taxAmount", select: true},
|
||
{title: "交货日期", prop_: "deliveryDate", select: true,sortAble:true},
|
||
{title: "审核状态", prop_: "auditSignName", select: true},
|
||
{title: "行关闭状态", prop_: "itemCloseStatusName", select: true},
|
||
{title: "行关闭时间", prop_: "itemCloseTime", select: true},
|
||
{title: "行关闭原因", prop_: "itemCloseReason", select: true}
|
||
],
|
||
///弹出页面列表数据
|
||
showTableColumns: [
|
||
{title: "合同日期", prop_: "contractDate", select: true},
|
||
{title: "合同编号", prop_: "contractCode", select: true},
|
||
{title: "客户合同编号", prop_: "clientContractCode", select: true},
|
||
{title: "合同类型", prop_: "contractTypeName", select: true},
|
||
{title: "关闭标志", prop_: "closeStatusName", select: true},
|
||
{title: "客户名称", prop_: "clientName", select: true},
|
||
{title: "销售员", prop_: "salesPersonName", select: true},
|
||
{title: "销售部门", prop_: "salesPersonDeptName", select: true},
|
||
{title: "发货是否检验", prop_: "isCheck", select: true},
|
||
{title: "物料代码", prop_: "materielSerialNo", select: true},
|
||
{title: "物料名称", prop_: "materielName", select: true},
|
||
{title: "规格型号", prop_: "specification", select: true},
|
||
{title: "主计量单位", prop_: "unitUomName", select: true},
|
||
{title: "主单位数量", prop_: "count", select: true},
|
||
{title: "辅助单位", prop_: "supportUomName", select: true},
|
||
{title: "销售数量", prop_: "saleCount", select: true},
|
||
{title: "含税单价(元)", prop_: "taxUnitPrice", select: true},
|
||
{title: "销售金额(元)", prop_: "taxAmount", select: true},
|
||
{title: "交货日期", prop_: "deliveryDate", select: true},
|
||
{title: "审核状态", prop_: "auditSignName", select: true},
|
||
{title: "行关闭状态", prop_: "itemCloseStatusName", select: true},
|
||
{title: "行关闭时间", prop_: "itemCloseTime", select: true},
|
||
{title: "行关闭原因", prop_: "itemCloseReason", select: true}
|
||
],
|
||
showTableColumnsTemp: [],//弹框弹出的时候,保存当前的列表数据
|
||
//显示的列表字段
|
||
alterationDetailId: '',
|
||
formTableData: [],
|
||
contractList: [],
|
||
contractData: [],
|
||
tableData1: [],
|
||
summary: {},
|
||
formDataTime: "",
|
||
time: '',
|
||
salesTime: '',
|
||
tableData: [],
|
||
depOptions: [],
|
||
salesPersonDept: '',
|
||
options: [],
|
||
typeList: [],
|
||
config: config,
|
||
btnDelDisabled: true,
|
||
btnOtherDisabled: true,
|
||
advanceQueryDialogVisible: false,
|
||
chooseUserVisible: false,
|
||
chooseUserVisible1: false,
|
||
chooseMaterielVisible:false,//物料
|
||
dialogLoading: false,
|
||
dialogTitle: "",
|
||
pictLoading: false,
|
||
columnSetDialogTitle: "设置显示字段列表",
|
||
columnSetDialogVisible: false,
|
||
salesContractIds: [],
|
||
tableId: 'sales_contract_table'
|
||
}
|
||
},
|
||
watch: {
|
||
time(val) {
|
||
if (val) {
|
||
this.search_data.startTime = val[0];
|
||
this.search_data.endTime = val[1];
|
||
} else {
|
||
this.search_data.startTime = "";
|
||
this.search_data.endTime = "";
|
||
}
|
||
|
||
},
|
||
formDataTime(val) {
|
||
if (val) {
|
||
this.formData.startTime = val[0];
|
||
this.formData.endTime = val[1];
|
||
} else {
|
||
this.formData.startTime = "";
|
||
this.formData.endTime = "";
|
||
}
|
||
|
||
},
|
||
},
|
||
created() {
|
||
this.showTableColumns = JSON.parse(JSON.stringify(this.showTableColumns));
|
||
this.showTableColumnsTemp = JSON.parse(JSON.stringify(this.showTableColumns));
|
||
this.getList()
|
||
this.getShowColumns();
|
||
this.initData()
|
||
},
|
||
methods: {
|
||
|
||
// 变更合同列表页
|
||
gotoAlterationList() {
|
||
let id = this.salesContractIds[0].salesContractId
|
||
this.$router.push({ path: "/sales/salesContract_alterationList", query: { id: id, t: Date.now()} })
|
||
},
|
||
|
||
// 返回首页
|
||
gotoIndex() {
|
||
this.chooseProVisible = false
|
||
},
|
||
// 变更
|
||
change() {
|
||
let id = this.salesContractIds[0].salesContractId
|
||
this.$router.push({ path: "/sales/salesContract_edit", query: { id: id, t: Date.now()} })
|
||
},
|
||
|
||
/**
|
||
* 关闭
|
||
*/
|
||
close() {
|
||
let id = this.salesContractIds[0].salesContractId
|
||
this.$confirm("确认终止选中的项吗?", "提示", {
|
||
type: "warning"
|
||
}).then(() => {
|
||
this.$api.salesAPI
|
||
.closeContract({id: id})
|
||
.then(res => {
|
||
if(res.code === 0) {
|
||
this.$message({
|
||
message: res.msg,
|
||
type: "success"
|
||
})
|
||
this. getList();
|
||
} else {
|
||
this.$message({
|
||
message: res.msg,
|
||
type: "error"
|
||
})
|
||
}
|
||
})
|
||
})
|
||
|
||
},
|
||
// 反关闭
|
||
reverseClose () {
|
||
let id = this.salesContractIds[0].salesContractId
|
||
this.$confirm("确认开启选中的项吗?", "提示", {
|
||
type: "warning"
|
||
}).then(() => {
|
||
this.$api.salesAPI
|
||
.reverseClose({id: id})
|
||
.then(res => {
|
||
if(res.code === 0) {
|
||
this.$message({
|
||
message: res.msg,
|
||
type: "success"
|
||
})
|
||
this. getList();
|
||
} else {
|
||
this.$message({
|
||
message: res.msg,
|
||
type: "error"
|
||
})
|
||
}
|
||
})
|
||
})
|
||
},
|
||
// 导出
|
||
exportExcel() {
|
||
delete this.search_data.pagesize
|
||
delete this.search_data.pageno
|
||
this.$api.salesAPI
|
||
.exportExcel(this.search_data)
|
||
.then(res => {
|
||
})
|
||
},
|
||
/**
|
||
* 反审核
|
||
*/
|
||
disAudit() {
|
||
let id = this.salesContractIds[0].salesContractId
|
||
this.$confirm("确认反审核选中的项吗?", "提示", {
|
||
type: "warning"
|
||
}).then(() => {
|
||
this.$api.salesAPI
|
||
.reverseAuditContract({id: id})
|
||
.then(res => {
|
||
if(res.code === 0) {
|
||
this.$message({
|
||
message: res.msg,
|
||
type: "success"
|
||
})
|
||
this. getList();
|
||
} else {
|
||
this.$message({
|
||
message: res.msg,
|
||
type: "error"
|
||
})
|
||
}
|
||
})
|
||
})
|
||
|
||
},
|
||
|
||
/**
|
||
* 审核
|
||
*/
|
||
audit() {
|
||
let id = this.salesContractIds[0].salesContractId
|
||
this.$confirm("确认审核选中的项吗?", "提示", {
|
||
type: "warning"
|
||
}).then(() => {
|
||
this.$api.salesAPI
|
||
.auditContract({id: id})
|
||
.then(res => {
|
||
if(res.code === 0) {
|
||
this.$message({
|
||
message: res.msg,
|
||
type: "success"
|
||
})
|
||
this. getList();
|
||
} else {
|
||
this.$message({
|
||
message: res.msg,
|
||
type: "error"
|
||
})
|
||
}
|
||
})
|
||
})
|
||
|
||
},
|
||
|
||
clickRow(row) {
|
||
this.$refs.tb.toggleRowSelection(row);
|
||
},
|
||
|
||
// 跳转到查看页面
|
||
gotoDetail(row) {
|
||
this.$router.push({ path: "/sales/salesContract_add", query: { id: row.salesContractId,t: Date.now() } })
|
||
},
|
||
|
||
// 前往新增页面
|
||
goAdd() {
|
||
this.$router.push({ path: "/sales/salesContract_add", query: {t: Date.now() } })
|
||
},
|
||
|
||
// 获取销售订单列表
|
||
getList() {
|
||
this.pictLoading = true;
|
||
this.$api.salesAPI
|
||
.listSalesContract(this.search_data)
|
||
.then(res => {
|
||
this.pictLoading = false;
|
||
if(res.data) {
|
||
this.summary = res.total
|
||
this.total = res.data.totalRows;
|
||
this.tableData = res.data.datas ? res.data.datas : [];
|
||
this.tableData.forEach(item => {
|
||
item.contractDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(item.contractDate)
|
||
item.deliveryDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(item.deliveryDate)
|
||
})
|
||
} else {
|
||
this.total = 0;
|
||
this.tableData = [];
|
||
}
|
||
}).catch(r => {
|
||
console.log(r);
|
||
});
|
||
},
|
||
|
||
//设置显示字段
|
||
showColumnSetDialog() {
|
||
this.columnSetDialogVisible = true;
|
||
this.showTableColumnsTemp = JSON.parse(JSON.stringify(this.showTableColumns));
|
||
},
|
||
//前移
|
||
toUp(scope) {
|
||
if (scope.$index == 0) {
|
||
return false;
|
||
}
|
||
let n;
|
||
for (let i = 0; i < this.showTableColumns.length; i++) {
|
||
if (this.showTableColumns[i].prop_ == scope.row.prop_) {
|
||
n = i;
|
||
}
|
||
}
|
||
let temp = this.showTableColumns[n];
|
||
this.showTableColumns[n] = this.showTableColumns[n - 1];
|
||
this.showTableColumns[n - 1] = temp;
|
||
this.$forceUpdate();
|
||
},
|
||
//后移
|
||
toDown(scope) {
|
||
if (scope.$index == this.showTableColumns.length - 1) {
|
||
return false;
|
||
}
|
||
let n;
|
||
for (let i = 0; i < this.showTableColumns.length; i++) {
|
||
if (this.showTableColumns[i].prop_ == scope.row.prop_) {
|
||
n = i;
|
||
}
|
||
}
|
||
let temp = this.showTableColumns[n];
|
||
this.showTableColumns[n] = this.showTableColumns[n + 1];
|
||
this.showTableColumns[n + 1] = temp;
|
||
this.$forceUpdate();
|
||
},
|
||
//恢复默认
|
||
toDefault() {
|
||
this.showTableColumns = JSON.parse(JSON.stringify(this.showTableColumnsDefault));
|
||
this.$forceUpdate();
|
||
},
|
||
//完成列表字段设置
|
||
saveAndCloseColumnSetDialog() {
|
||
let tableNo = this.tableId;
|
||
let tableColumns = JSON.stringify(this.showTableColumns);
|
||
this.columnSetDialogVisible = false;
|
||
this.$api.tableColumnAPI
|
||
.saveShowColumns({tableNo:tableNo,tableColumns:tableColumns})
|
||
.then(res => {
|
||
let arr = JSON.parse(JSON.stringify(this.showTableColumns));
|
||
this.formTableData = [];
|
||
for (let i = 0; i < arr.length; i++) {
|
||
if (arr[i].select) {
|
||
this.formTableData.push(arr[i]);
|
||
}
|
||
}
|
||
})
|
||
.catch(r => {
|
||
console.log(r);
|
||
});
|
||
},
|
||
//关闭字段设置弹出
|
||
handleClose() {
|
||
this.showTableColumns = JSON.parse(JSON.stringify(this.showTableColumnsTemp));
|
||
this.columnSetDialogVisible = false;
|
||
|
||
},
|
||
/**
|
||
* 获取显示字段
|
||
*/
|
||
getShowColumns() {
|
||
let tableNo = this.tableId;
|
||
this.formTableData = [];
|
||
|
||
this.$api.tableColumnAPI
|
||
.getShowColumns({tableNo:tableNo})
|
||
.then(res => {
|
||
if(res.code==0){
|
||
if(res.results){
|
||
this.showTableColumns = JSON.parse(res.results);
|
||
let arr = JSON.parse(JSON.stringify(this.showTableColumns));
|
||
for (let i = 0; i < arr.length; i++) {
|
||
if (arr[i].select) {
|
||
this.formTableData.push(arr[i]);
|
||
}
|
||
}
|
||
this.$forceUpdate();
|
||
}else{
|
||
let arr = JSON.parse(JSON.stringify(this.showTableColumnsDefault));
|
||
for (let i = 0; i < arr.length; i++) {
|
||
if (arr[i].select) {
|
||
this.formTableData.push(arr[i]);
|
||
}
|
||
}
|
||
this.$forceUpdate();
|
||
}
|
||
}else{
|
||
this.$message({
|
||
message: res.msg ? res.msg : "获取列表信息失败",
|
||
type: "error"
|
||
});
|
||
}
|
||
|
||
})
|
||
.catch(r => {
|
||
this.$message({
|
||
message: r,
|
||
type: "error"
|
||
});
|
||
console.log(r);
|
||
});
|
||
},
|
||
|
||
// 查询
|
||
search() {
|
||
this.search_data.pageno = 1;
|
||
this.search_data.pagesize = 10;
|
||
this.getList();
|
||
},
|
||
|
||
/**
|
||
* 高级查询
|
||
*/
|
||
moreSearch() {
|
||
this.advanceQueryDialogVisible = true;
|
||
this.dialogTitle = "高级查询";
|
||
},
|
||
save() {
|
||
for (var n in this.formData) {
|
||
this.search_data[n] = this.formData[n];
|
||
}
|
||
this.search_data.inDatas = "";
|
||
this.time = this.formDataTime;
|
||
this.search_data.pageno = 1;
|
||
this.$nextTick(function () {
|
||
this.advanceQueryDialogVisible = false;
|
||
this.getList();
|
||
})
|
||
},
|
||
//清空
|
||
clear() {
|
||
for (var n in this.formData) {
|
||
this.formData[n] = '';
|
||
}
|
||
this.formDataTime = "";
|
||
this.salesPersonDept=''
|
||
// this.createTime = "";
|
||
},
|
||
changeFacility() {
|
||
this.$forceUpdate();
|
||
},
|
||
|
||
//设置显示字段
|
||
showColumnSetDialog() {
|
||
this.columnSetDialogVisible = true;
|
||
this.showTableColumnsTemp = JSON.parse(JSON.stringify(this.showTableColumns));
|
||
},
|
||
// 每页显示多少条
|
||
handleSizeChange(val) {
|
||
this.search_data.pagesize = val;
|
||
this.getList();
|
||
},
|
||
// 上下分页
|
||
handleCurrentChange(val) {
|
||
this.search_data.pageno = val;
|
||
this.getList();
|
||
},
|
||
|
||
/**
|
||
* 初始化
|
||
*/
|
||
initData() {
|
||
// 获取审核状态
|
||
this.$api.salesAPI
|
||
.listAauditSign({
|
||
type: "audit_status",
|
||
})
|
||
.then(res => {
|
||
this.options = res.datas
|
||
});
|
||
// 获取合同类型
|
||
this.$api.salesAPI
|
||
.listContractType({
|
||
type: "sales_contract_type",
|
||
})
|
||
.then(res => {
|
||
this.typeList = res.datas
|
||
});
|
||
// 获取生产部门
|
||
Promise.all([this.$api.commonAPI.getDeptsTree(), this.$api.roleAPI.list()])
|
||
.then(([r1, r2]) => {
|
||
if (r1.code === 0) {
|
||
this.depOptions=r1.data.children;
|
||
// this.setDefaultDept();
|
||
this.setDeptList(this.depOptions);
|
||
}
|
||
if (r2.code === 0) {
|
||
this.roleList = r2.datas;
|
||
}
|
||
})
|
||
.catch(error => {
|
||
console.log(error);
|
||
});
|
||
},
|
||
getMateriel(val){
|
||
if (val) {
|
||
this.$set(this.formData,'materiel',val.id)
|
||
this.$set(this.formData,'materielName',val.name)
|
||
}else{
|
||
this.$set(this.formData,'materiel',"")
|
||
this.$set(this.formData,'materielName',"")
|
||
}
|
||
},
|
||
|
||
/**
|
||
* 获取用户
|
||
*/
|
||
getUser(data) {
|
||
if (data) {
|
||
this.$set(this.formData,'salesPersonName',data.name)
|
||
this.$set(this.formData,'salesPerson',data.id)
|
||
// this.formData.salesPersonName = data.name;
|
||
// this.formData.salesPerson = data.id;
|
||
// this.getUserList.forEach(item => {
|
||
// if (data.id === item.id) {
|
||
// self.formData.salesPersonDept = item.deptId;
|
||
// self.formData.deptId= item.deptId;
|
||
// return;
|
||
// }
|
||
// });
|
||
// if (self.formData.deptId == 0) {
|
||
// self.formData.salesPersonDept = "";
|
||
// }
|
||
this.setDefaultDept()
|
||
}
|
||
},
|
||
/**
|
||
* 获取制单人
|
||
*/
|
||
getUser1(data) {
|
||
console.log(data)
|
||
var self = this;
|
||
if (data) {
|
||
this.formData.createByName = data.name;
|
||
this.formData.createBy = data.id;
|
||
}
|
||
},
|
||
//根据当前id,获取一条树枝上的所有id数据
|
||
treeFindPath (tree, func, path = []) {
|
||
if (!tree) return []
|
||
for (const data of tree) {
|
||
path.push(data.id)
|
||
if (func(data)) return path
|
||
if (data.children) {
|
||
const findChildren = this.treeFindPath(data.children, func, path)
|
||
if (findChildren.length) return findChildren
|
||
}
|
||
path.pop()
|
||
}
|
||
return []
|
||
},
|
||
//当选择器选项没有下一级时,将children设置为undefined,就能选则该项了
|
||
setDeptList(tree){
|
||
for (const data of tree) {
|
||
if(!data.hasChildren){
|
||
data.children=undefined;
|
||
}else{
|
||
this.setDeptList(data.children)
|
||
}
|
||
}
|
||
},
|
||
//显示默认部门
|
||
// setDefaultDept(){
|
||
// if(this.depOptions.length>0&&this.formData.deptId){
|
||
// let id=JSON.stringify( this.formData.deptId)
|
||
// let select_id=this.treeFindPath(this.depOptions,data=> data.id===id)
|
||
// this.salesPersonDept=JSON.parse(JSON.stringify(select_id))
|
||
// }
|
||
// },
|
||
// 选择部门
|
||
handleChange:function(value){
|
||
this.formData.salesPersonDept=value.length>=1?value[value.length-1]:'';
|
||
this.salesPersonDept=value;
|
||
},
|
||
|
||
|
||
/**
|
||
* 处理选中
|
||
*/
|
||
handleSelectionChange(val) {
|
||
this.salesContractIds= val;
|
||
this.setBtn(val);
|
||
},
|
||
|
||
/**
|
||
* 删除
|
||
*/
|
||
remove() {
|
||
let ids = [];
|
||
this.salesContractIds.forEach(item => {
|
||
ids.push(item.salesContractId)
|
||
console.log(ids)
|
||
})
|
||
this.$confirm("确认删除选中的项吗?", "提示", {
|
||
type: "warning"
|
||
}).then(() => {
|
||
this.$api.salesAPI
|
||
.removeContract({salesContractIds: ids})
|
||
.then(res => {
|
||
if (res.code === 0) {
|
||
this.$message({
|
||
message: res.msg,
|
||
type: "success"
|
||
});
|
||
this.search();
|
||
} else {
|
||
this.$message({
|
||
message: res.msg ? res.msg : "删除失败,请重试",
|
||
type: "error"
|
||
});
|
||
}
|
||
})
|
||
.catch(error => {
|
||
this.$message({
|
||
message: "删除失败,请重试",
|
||
type: "error"
|
||
});
|
||
});
|
||
});
|
||
},
|
||
/**
|
||
* 控件操作按钮状态
|
||
*/
|
||
setBtn(val) {
|
||
let isFlag = true;
|
||
let isDelFlag = true;
|
||
if (val.length > 0) {
|
||
isDelFlag = false;
|
||
if (val.length == 1) {
|
||
isFlag = false;
|
||
}
|
||
} else {
|
||
isFlag = true;
|
||
isDelFlag = true;
|
||
}
|
||
this.btnOtherDisabled = isDelFlag;
|
||
this.btnDelDisabled = isFlag;
|
||
},
|
||
// 合计
|
||
getSummaries(param){
|
||
const { columns, data } = param;
|
||
let sums=[];
|
||
columns.forEach((column, index) => { //计算不含税金额总计
|
||
|
||
if (index === 0) {
|
||
sums[index] = '合计';
|
||
return;
|
||
}
|
||
if (column.property!=='count'&&column.property!=='taxAmount'&&column.property!=='saleCount') {
|
||
sums[index] = '';
|
||
return;
|
||
}
|
||
|
||
const values = data.map(item => Number(item[column.property]));
|
||
if (!values.every(value => isNaN(value))) {
|
||
sums[index] = values.reduce((prev, curr) => {
|
||
const value = Number(curr);
|
||
if (!isNaN(value)) {
|
||
return prev + curr;
|
||
} else {
|
||
return prev;
|
||
}
|
||
}, 0);
|
||
} else {
|
||
sums[index] = '';
|
||
}
|
||
if (column.property==='count') {
|
||
if(sums[index]) {
|
||
sums[index] = this.summary.totalCount;
|
||
}
|
||
return;
|
||
}
|
||
if (column.property==='saleCount') {
|
||
if(sums[index]) {
|
||
sums[index] = this.summary.totalSaleCount;
|
||
}
|
||
return;
|
||
}
|
||
if (column.property==='taxAmount') {
|
||
if(sums[index]) {
|
||
sums[index] = this.summary.totalTaxAmount;
|
||
}
|
||
return;
|
||
}
|
||
});
|
||
|
||
return sums;
|
||
},
|
||
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped></style>
|
||
|
||
<style>
|
||
/*.el-cascader .el-input {*/
|
||
/* width: 100% !important;*/
|
||
/*}*/
|
||
|
||
.process-box .el-select,
|
||
.process-box .el-input {
|
||
width: 100%;
|
||
}
|
||
|
||
.process-box .el-table thead {
|
||
line-height: 1;
|
||
}
|
||
|
||
.process-box .el-input-number .el-input {
|
||
width: 100% !important;
|
||
}
|
||
|
||
.process-box .el-input-number--small {
|
||
width: 70% !important;
|
||
}
|
||
|
||
.process-box .form-inline {
|
||
width: 33.3% !important;
|
||
}
|
||
|
||
.process-box .el-input-number el-input-number--small {
|
||
white-space: nowrap;
|
||
|
||
}
|
||
|
||
.process-box .el-form-item__content {
|
||
margin-left: 100px !important;
|
||
}
|
||
|
||
.process-box .el-form-item__label {
|
||
width: 100px !important;
|
||
}
|
||
|
||
.process-box .el-input,
|
||
.process-box .el-form--inline .el-input,
|
||
.process-box .el-cascader--small {
|
||
width: 100% !important;
|
||
}
|
||
|
||
.childlist .el-form-item__content {
|
||
margin-left: 0 !important;
|
||
}
|
||
|
||
.process-box .el-input--small {
|
||
width: 70% !important;
|
||
}
|
||
</style>
|
||
|
||
<style scoped>
|
||
>>>.sys-search .el-input__inner {
|
||
width: 100%;
|
||
}
|
||
|
||
.dialog-form {
|
||
position: relative;
|
||
}
|
||
|
||
.dialog-line {
|
||
position: relative;
|
||
display: flex;
|
||
justify-content: center;
|
||
width: 100%;
|
||
}
|
||
|
||
.dialog-line .dialog-form-inline {
|
||
position: relative;
|
||
width: 50%;
|
||
margin-right: 0;
|
||
}
|
||
|
||
.dialog-line .dialog-form-inline-single {
|
||
position: relative;
|
||
width: 100%;
|
||
margin-right: 0;
|
||
}
|
||
|
||
>>>.dialog-line .el-input__inner {
|
||
width: 100% !important;
|
||
;
|
||
}
|
||
|
||
>>>.dialog-line .el-form-item__content {
|
||
width: calc(100% - 80px) !important;
|
||
;
|
||
}
|
||
|
||
>>>.dialog-line .el-input,
|
||
>>>.dialog-line .el-cascader {
|
||
width: 100% !important;
|
||
}
|
||
</style>
|