<template>
|
<div class="app-container">
|
<div class="filter-container">
|
<el-input v-model="queryForm.supplyunitname" placeholder="生产企业" style="width: 25%;"/>
|
<el-input v-model="queryForm.ordercode" placeholder="合同单号" style="width: 25%;"/>
|
<el-select v-model="queryForm.status" clearable placeholder="请选择合同状态">
|
<el-option
|
class="filter-item"
|
v-for="item in orderStatus"
|
:key="item.value"
|
:label="item.label"
|
:value="item.value">
|
</el-option>
|
</el-select>
|
<el-button v-if="getBtnPermission('add')" class="filter-item" style="margin-left: 10px;" type="primary"
|
icon="el-icon-plus" @click="openApplyForm('新增','')">新增
|
</el-button>
|
<el-button v-if="getBtnPermission('add')" class="filter-item" style="margin-left: 10px;" type="primary"
|
icon="el-icon-plus" @click="copyAndOpenApplyForm('快速创建','')">快速创建
|
</el-button>
|
<el-button class="filter-item" style="margin-left: 10px;" type="primary" icon="el-icon-refresh"
|
@click="refreshHandle">查询
|
</el-button>
|
</div>
|
<div class="table_content">
|
<el-table
|
v-loading="listLoading"
|
:key="tableKey"
|
:data="contractData"
|
border
|
ref="contractTable"
|
fit
|
highlight-current-row
|
style="width: 100%;"
|
@sort-change="sortChange"
|
@selection-change="handleSelectionChange"
|
>
|
<el-table-column
|
type="selection"
|
width="55"/>
|
<el-table-column type="index" label="序号" align="center" width="80"/>
|
<el-table-column label="合同单号" prop="ordercode" align="center" sortable="custom">
|
<template slot-scope="scope">
|
<span>{{ scope.row.ordercode }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="合同状态" prop="status" align="center" sortable="custom">
|
<template slot-scope="scope">
|
<span>{{ scope.row.status }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="标签退回状态" prop="returnstatus" align="center" sortable="custom">
|
<template slot-scope="scope">
|
<span>{{ scope.row.returnstatus }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="甲方" prop="operator" align="center" sortable="custom">
|
<template slot-scope="scope">
|
<span>{{ scope.row.operator }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="乙方" prop="manufacturer" align="center" sortable="custom">
|
<template slot-scope="scope">
|
<span>{{ scope.row.manufacturer }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="乙方意见" prop="opinion" align="center" sortable="custom">
|
<template slot-scope="scope">
|
<span>{{ scope.row.opinion }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="创建时间" prop="createddate" align="center" sortable="custom">
|
<template slot-scope="scope">
|
<span>{{ scope.row.createddate | parseTime('{y}-{m}-{d}') }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="操作" align="center" width="300" class-name="small-padding fixed-width">
|
<template slot-scope="scope">
|
<el-button type="text" @click="submitHandle(scope.row)" v-if="isSupervision == 'null'?false:true">提交</el-button>
|
<el-button type="text" @click="viewProductHandle(scope.row)">产品明细</el-button>
|
<el-button type="text" @click="exportProductHandle(scope.row)">导出产品明细</el-button>
|
<el-button v-if="getBtnPermission('edit') && isSupervision == 'null'?false:true" type="text" @click="openApplyForm('编辑',scope.row)" >编辑</el-button>
|
<el-button v-if="getBtnPermission('delete') && isSupervision == 'null'?false:true" type="text" style="color:red;" @click="deleteHandle(scope.row)" >删除</el-button>
|
</template>
|
</el-table-column>
|
</el-table>
|
<br>
|
<el-pagination
|
v-show="recordTotal>0"
|
:current-page="currentPage"
|
:page-sizes="[10, 20, 30, 50]"
|
:page-size="pageSize"
|
:total="recordTotal"
|
layout="total, sizes, prev, pager, next, jumper"
|
background
|
style="float:right;"
|
@size-change="handleSizeChange"
|
@current-change="handleCurrentChange"
|
/>
|
</div>
|
<el-dialog :visible.sync="productVoDialogVisible"
|
:modal-append-to-body="false" :close-on-click-modal="false" width="1200px">
|
<el-table
|
v-loading="listLoading"
|
:key="tableKey"
|
:data="productVoList"
|
border
|
fit
|
highlight-current-row
|
style="width: 100%;"
|
>
|
<el-table-column label="产品名称" prop="name" align="center">
|
<template slot-scope="scope">
|
<span>{{ scope.row.name }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="流向码" prop="directionCode" align="center" >
|
<template slot-scope="scope">
|
<span>{{ scope.row.directionCode }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="数量" prop="num" align="center" >
|
<template slot-scope="scope">
|
<span>{{ scope.row.num }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="变更数量" v-if="isShowChangnum" prop="changenum" align="center" >
|
<template slot-scope="scope">
|
<span>{{ scope.row.changenum }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="进价" v-if="isSupervision == 'null'?false:true" prop="price" align="center" >
|
<template slot-scope="scope">
|
<span>{{ scope.row.price }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="生产厂家" prop="manufacturer" align="center" >
|
<template slot-scope="scope">
|
<span>{{ scope.row.manufacturer }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="规格" prop="specification" align="center" >
|
<template slot-scope="scope">
|
<span>{{ scope.row.specification }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="含药量" prop="explosiveContent" align="center" >
|
<template slot-scope="scope">
|
<span>{{ scope.row.explosiveContent }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="类型" prop="type" align="center" >
|
<template slot-scope="scope">
|
<span>{{ scope.row.type }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="产品级别" prop="level" align="center" >
|
<template slot-scope="scope">
|
<span>{{ scope.row.level }}</span>
|
</template>
|
</el-table-column>
|
<el-table-column label="箱含量(挂)" prop="boxNumber" align="center" >
|
<template slot-scope="scope">
|
<span>{{ scope.row.boxNumber }}</span>
|
</template>
|
</el-table-column>
|
</el-table>
|
</el-dialog>
|
<div style="clear: both;"></div>
|
<applyForm ref="apply" @getinfo="getApplyList"></applyForm>
|
</div>
|
</template>
|
|
<script>
|
import {uploadUrl} from '@/assets/upload/url'
|
import applyForm from './components/applyForm'
|
import { checkBtnPermission} from "../../utils/permission";
|
import { applyList, createApply, updateApply, deleteApply, submitApply} from "../../api/contract";
|
import { parseError} from "../../utils/messageDialog";
|
import { computePageCount} from "../../utils";
|
import { mapGetters} from "vuex";
|
import { productList } from "@/api/product";
|
import { dictionaryAllItems } from '@/api/dictionary';
|
import {MessageBox} from "element-ui";
|
import Cookies from "js-cookie";
|
|
export default {
|
name: "apply",
|
data() {
|
return {
|
baseUrl: process.env.IMG_API + 'contract/',
|
pageSize: 10,
|
recordTotal: 0,
|
currentPage: 1,
|
pageTotal: 0,
|
tableKey: 0,
|
contractData: null,
|
listLoading: true,
|
dataForm: {
|
id: '',
|
ordercode: '',
|
status:'',
|
operator:'',
|
manufacturer:'',
|
origincontract:'',
|
confirmcontract:'',
|
file: '',
|
productInfoList: []
|
},
|
isSupervision : Cookies.get('isSupervision'),
|
roleType :Cookies.get('roleType'),
|
queryForm: {
|
supplyunitname:'',
|
ordercode:'',
|
status:'',
|
},
|
dialogFormVisible: false,
|
dialogStatus: '',
|
dataFormRules: {
|
manufacturer: [{required: true, message: '生产企业不能为空', trigger: 'blur'}],
|
productInfoList: [{required: true, message: '产品列表不能为空', trigger: 'blur'}],
|
},
|
orderStatus:[],
|
productVoList:[],
|
productVoDialogVisible:false,
|
|
productDialogFormVisible:false,
|
productData:[],
|
pageSizeProduct: 10,
|
currentPageProduct: 1,
|
recordTotalProduct: 0,
|
pageTotalProduct: 0,
|
queryProductForm: {
|
name: '',
|
manufacturer:'',
|
directionCode:'',
|
type:'',
|
},
|
typeOptions: [{
|
value: '爆竹类',
|
label: '爆竹类'
|
}, {
|
value: '单个爆竹类',
|
label: '单个爆竹类'
|
}, {
|
value: '喷花类',
|
label: '喷花类'
|
}, {
|
value: '日景烟花',
|
label: '日景烟花'
|
}, {
|
value: '吐珠类',
|
label: '吐珠类'
|
}, {
|
value: '造型玩具类',
|
label: '造型玩具类'
|
}, {
|
value: '玩具烟花类',
|
label: '玩具烟花类'
|
}, {
|
value: '线香类',
|
label: '线香类'
|
}, {
|
value: '组合类',
|
label: '组合类'
|
}, {
|
value: '组合烟花',
|
label: '组合烟花'
|
}, {
|
value: '组合烟花类',
|
label: '组合烟花类'
|
}, {
|
value: '组合盆花类',
|
label: '组合盆花类'
|
}, {
|
value: '鞭炮类',
|
label: '鞭炮类'
|
}, {
|
value: '火箭类',
|
label: '火箭类'
|
}, {
|
value: '旋转类',
|
label: '旋转类'
|
}, {
|
value: '升空类',
|
label: '升空类'
|
}, {
|
value: '旋转升空类',
|
label: '旋转升空类'
|
}, {
|
value: '冷光类',
|
label: '冷光类'
|
}, {
|
value: '烟雾类',
|
label: '烟雾类'
|
}, {
|
value: '摩擦类',
|
label: '摩擦类'
|
}, {
|
value: '小礼花类',
|
label: '小礼花类'
|
}, {
|
value: '礼花弹类',
|
label: '礼花弹类'
|
}, {
|
value: '架子烟类',
|
label: '架子烟类'
|
}, {
|
value: '引火线',
|
label: '引火线'
|
}, {
|
value: '黑火药',
|
label: '黑火药'
|
}, {
|
value: '烟火药',
|
label: '烟火药'
|
}, {
|
value: '氯酸钾',
|
label: '氯酸钾'
|
}, {
|
value: '精品礼品箱类',
|
label: '精品礼品箱类'
|
}, {
|
value: '彩箱烟花类',
|
label: '彩箱烟花类'
|
}, {
|
value: '玩具类',
|
label: '玩具类'
|
}, {
|
value: '同类组合烟花',
|
label: '同类组合烟花'
|
}],
|
|
manufacturer:'',
|
enterpriseList : [],
|
enterpriseDialogFormVisible:false,
|
pageSizeEnterpise: 10,
|
currentPageEnterpise: 1,
|
recordTotalEnterpise: 0,
|
pageTotalEnterpise: 0,
|
isShowChangnum:false,
|
selectRow:''
|
}
|
},
|
created() {
|
this.getApplyList();
|
this.getDictionaryStatusList();
|
},
|
components:{
|
applyForm
|
},
|
computed: {
|
...mapGetters([
|
'userType',
|
'username'
|
])
|
},
|
methods: {
|
getDictionaryStatusList(){
|
const _this = this
|
if (_this.orderStatus && _this.orderStatus.length > 0) {
|
return
|
}
|
const params = {}
|
params['dictionaryType'] = '合同状态'
|
dictionaryAllItems(params).then(response => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.orderStatus = res.result
|
} else {
|
parseError({ error: res.message, vm: _this })
|
}
|
}).catch(error => {
|
parseError({ error: error, vm: _this })
|
})
|
},
|
getApplyList() {
|
const _this = this
|
const params = {}
|
params['pageIndex'] = _this.currentPage
|
params['pageSize'] = _this.pageSize
|
params['sort'] = _this.sort
|
params['order'] = _this.order
|
for (const i in _this.queryForm) {
|
if (_this.queryForm[i] != undefined && _this.queryForm[i].toString() != '') {
|
params[i] = _this.queryForm[i]
|
}
|
}
|
_this.listLoading = true
|
applyList(params).then(response => {
|
const res = response.data;
|
if (res.code == 200) {
|
const result = res.result;
|
_this.recordTotal = result.totalCount;
|
_this.pageSize = result.pageSize;
|
_this.pageTotal = computePageCount(result.totalCount, result.pageSize);
|
_this.currentPage = result.pageIndex;
|
_this.contractData = result.result
|
} else {
|
parseError({error: res.message, vm: _this})
|
}
|
_this.listLoading = false
|
}).catch(error => {
|
_this.listLoading = false
|
parseError({error: error, vm: _this})
|
})
|
},
|
handleSizeChange: function (val) {
|
this.pageSize = val
|
this.currentPage = 1
|
this.getApplyList()
|
},
|
openApplyForm(title,value){
|
this.getApplyList()
|
this.$refs.apply.showApplyForm(title,value)
|
},//打开新增修改
|
copyAndOpenApplyForm(title) {
|
if (this.selectRow.length < 1) {
|
this.$message({
|
type:'warning',
|
message:'请选择一条合同进行快速创建'
|
})
|
}else{
|
this.getApplyList()
|
this.$refs.apply.showCopyApplyForm(title,this.selectRow)
|
}
|
|
},
|
handleCurrentChange: function (val) {
|
this.currentPage = val
|
this.getApplyList()
|
},
|
getBtnPermission(btnType) {
|
return checkBtnPermission(this.userType, btnType)
|
},
|
sortChange(param){
|
this.sort = param.prop;
|
this.order = param.order;
|
this.getApplyList();
|
},
|
viewProductHandle:function(row){
|
this.productVoList = row.productInfoList;
|
this.productVoDialogVisible = true;
|
if(row.status == '已生成'){
|
this.isShowChangnum= true
|
} else{
|
this.isShowChangnum= false;
|
}
|
|
},
|
exportProductHandle:function(row){
|
if(row.productInfoList.length === 0){
|
this.$message({
|
type:'warning',
|
message:'无数据可导出'
|
})
|
}else {
|
let allData = []
|
for (let i = 0; i < row.productInfoList.length; i++) {
|
var { ...productOne } = row.productInfoList[i]
|
productOne['manufacturer'] = row.manufacturer
|
productOne['operator'] = row.operator
|
allData.push(productOne)
|
}
|
import('@/vendor/Export2Excel').then((excel) => {
|
const tHeader = [
|
'甲方',
|
'乙方',
|
'产品名称',
|
'流向码',
|
'规格',
|
'含药量',
|
'箱含量',
|
'类型',
|
'等级',
|
'数量',
|
'变更数量'
|
]
|
const filterVal = [
|
'operator',
|
'manufacturer',
|
'name',
|
'directionCode',
|
'specification',
|
'explosiveContent',
|
'boxNumber',
|
'type',
|
'level',
|
'num',
|
'changenum'
|
]
|
if(this.isSupervision != 'null'){
|
tHeader.push('进价')
|
filterVal.push('price')
|
}else{
|
|
}
|
const data = this.formatJson(filterVal, allData)
|
excel.export_json_to_excel({
|
header: tHeader,
|
data,
|
filename: '产品明细'
|
})
|
})
|
}
|
|
},
|
formatJson(filterVal, jsonData) {
|
return jsonData.map(v => filterVal.map(j => v[j]))
|
},
|
refreshHandle(){
|
this.getApplyList()
|
},
|
deleteHandle: function (row) {
|
const _this = this
|
MessageBox.confirm('确定删除信息', '确定删除', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
_this.deleteAction(row)
|
}).catch(() => {
|
console.log('已取消删除')
|
})
|
},
|
submitHandle:function(row){
|
const _this = this
|
MessageBox.confirm('确定提交信息', '确定提交', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
const params = {}
|
params['id'] = row.id;
|
submitApply(params).then(response => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.$message({
|
message: '提交成功',
|
type: 'success'
|
})
|
_this.getApplyList()
|
} else {
|
parseError({error: res.message, vm: _this})
|
}
|
}).catch(error => {
|
parseError({error: error, vm: _this})
|
})
|
}).catch(() => {
|
console.log('已取消提交')
|
})
|
},
|
deleteAction: function (row) {
|
const _this = this;
|
const params = {}
|
params['id'] = row.id;
|
deleteApply(params).then(response => {
|
const res = response.data
|
if (res.code == 200) {
|
_this.$message({
|
message: '删除成功',
|
type: 'success'
|
})
|
_this.getApplyList()
|
} else {
|
parseError({error: res.message, vm: _this})
|
}
|
}).catch(error => {
|
parseError({error: error, vm: _this})
|
})
|
},
|
downloadUrl(val){
|
window.open(uploadUrl() + val, '_blank')
|
},
|
handleSelectionChange (val) {
|
if(val.length > 1) {
|
this.$refs.contractTable.clearSelection(); //清除
|
this.$refs.contractTable.toggleRowSelection(val.pop()); //pop:最后一个
|
}
|
this.selectRow = val
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
|
</style>
|