# Conflicts: # SC-web/src/views/scm/basicInformation/material/Form.vueproduct
commit
35741ee8c9
@ -1,235 +1,233 @@
|
||||
<template>
|
||||
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" append-to-body
|
||||
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="1000px">
|
||||
<el-row :gutter="15" class="">
|
||||
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px"
|
||||
label-position="right">
|
||||
<template v-if="!loading">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户编码" prop="supplierCd">
|
||||
<el-input v-model="dataForm.supplierCd" placeholder="请输入客户编码" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'"
|
||||
:close-on-click-modal="false" append-to-body
|
||||
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
|
||||
width="600px">
|
||||
<el-row :gutter="15" class="">
|
||||
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px" label-position="right" >
|
||||
<template v-if="!loading">
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="客户编码"
|
||||
prop="supplierCd" >
|
||||
<el-input v-model="dataForm.supplierCd"
|
||||
placeholder="请输入客户编码" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户名称" prop="supplierNm">
|
||||
<el-input v-model="dataForm.supplierNm" placeholder="请输入客户名称" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="客户名称"
|
||||
prop="supplierNm" >
|
||||
<el-input v-model="dataForm.supplierNm"
|
||||
placeholder="请输入客户名称" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属公司ID" prop="orgId">
|
||||
<el-input v-model="dataForm.orgId" placeholder="请输入所属公司ID" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="公司名称"
|
||||
prop="orgId" >
|
||||
<com-select v-model="dataForm.orgId"
|
||||
placeholder="请选择" clearable >
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="公司代码" prop="orgName">
|
||||
<el-input v-model="dataForm.orgName" placeholder="请输入公司代码" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</com-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="联系人"
|
||||
prop="contactName" >
|
||||
<el-input v-model="dataForm.contactName"
|
||||
placeholder="请输入联系人" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="客户等级" prop="customerLevel">
|
||||
<el-select v-model="dataForm.customerLevel" placeholder="请选择客户等级" :style='{"width":"100%"}'>
|
||||
<el-option v-for="(item, index) in customerLevelOptions" :key="index"
|
||||
:label="item.fullName" :value="item.id" :disabled="item.disabled"></el-option>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="客户等级"
|
||||
prop="customerLevel" >
|
||||
<el-select v-model="dataForm.customerLevel"
|
||||
placeholder="请选择客户等级" :style='{"width":"100%"}'>
|
||||
<el-option v-for="(item, index) in customerLevelOptions" :key="index" :label="item.fullName" :value="item.id" :disabled="item.disabled" ></el-option>
|
||||
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系人" prop="contactName">
|
||||
<el-input v-model="dataForm.contactName" placeholder="请输入联系人" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="电话"
|
||||
prop="contactPhone" >
|
||||
<el-input v-model="dataForm.contactPhone"
|
||||
placeholder="请输入电话" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="dataForm.address" placeholder="请输入地址" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="地址"
|
||||
prop="address" >
|
||||
<el-input v-model="dataForm.address"
|
||||
placeholder="请输入地址" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="电话" prop="contactPhone">
|
||||
<el-input v-model="dataForm.contactPhone" placeholder="请输入电话" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="是否启用"
|
||||
prop="status" >
|
||||
<el-switch v-model="dataForm.status"
|
||||
:active-value="1" :inactive-value="0" >
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="是否启用" prop="status">
|
||||
<el-switch v-model="dataForm.status" :active-value="1" :inactive-value="0">
|
||||
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false"> 取 消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail"> 确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false"> 取 消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail"> 确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import {
|
||||
getDataInterfaceRes
|
||||
} from '@/api/systemData/dataInterface'
|
||||
import {
|
||||
getDictionaryDataSelector
|
||||
} from '@/api/systemData/dictionary'
|
||||
export default {
|
||||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
loading: false,
|
||||
isDetail: false,
|
||||
dataForm: {
|
||||
supplierCd: '',
|
||||
supplierNm: '',
|
||||
orgId: '',
|
||||
orgName: '',
|
||||
customerLevel: "1",
|
||||
contactName: '',
|
||||
address: '',
|
||||
contactPhone: '',
|
||||
status: 1,
|
||||
},
|
||||
rules: {
|
||||
supplierCd: [{
|
||||
required: true,
|
||||
message: '请输入客户编码',
|
||||
trigger: 'blur'
|
||||
}, ],
|
||||
supplierNm: [{
|
||||
required: true,
|
||||
message: '请输入客户名称',
|
||||
trigger: 'blur'
|
||||
}, ],
|
||||
contactPhone: [],
|
||||
},
|
||||
customerLevelOptions: [{
|
||||
"fullName": "一级",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "二级",
|
||||
"id": "2"
|
||||
}, {
|
||||
"fullName": "三级",
|
||||
"id": "3"
|
||||
}],
|
||||
import request from '@/utils/request'
|
||||
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
|
||||
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
|
||||
export default {
|
||||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
loading: false,
|
||||
isDetail: false,
|
||||
dataForm: {
|
||||
supplierCd : '',
|
||||
supplierNm : '',
|
||||
orgId : [],
|
||||
contactName : '',
|
||||
customerLevel : "1",
|
||||
contactPhone : '',
|
||||
address : '',
|
||||
status : 1,
|
||||
},
|
||||
rules:
|
||||
{
|
||||
supplierCd: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入客户编码',
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
supplierNm: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入客户名称',
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
contactPhone: [
|
||||
],
|
||||
},
|
||||
customerLevelOptions:[{"fullName":"一级","id":"1"},{"fullName":"二级","id":"2"},{"fullName":"三级","id":"3"}],
|
||||
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
clearData(data){
|
||||
for (let key in data) {
|
||||
if (data[key] instanceof Array) {
|
||||
data[key] = [];
|
||||
} else if (data[key] instanceof Object) {
|
||||
this.clearData(data[key]);
|
||||
} else {
|
||||
data[key] = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
init(id, isDetail) {
|
||||
this.dataForm.id = id || 0;
|
||||
this.visible = true;
|
||||
this.isDetail = isDetail || false;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['elForm'].resetFields();
|
||||
if(this.dataForm.id){
|
||||
this.loading = true
|
||||
request({
|
||||
url: '/api/customer/Customer/'+this.dataForm.id,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataInfo(res.data)
|
||||
this.loading = false
|
||||
});
|
||||
}else{
|
||||
this.clearData(this.dataForm)
|
||||
}
|
||||
});
|
||||
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['elForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.request()
|
||||
}
|
||||
})
|
||||
},
|
||||
request() {
|
||||
var _data =this.dataList()
|
||||
if (!this.dataForm.id) {
|
||||
request({
|
||||
url: '/api/customer/Customer',
|
||||
method: 'post',
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
})
|
||||
}else{
|
||||
request({
|
||||
url: '/api/customer/Customer/'+this.dataForm.id,
|
||||
method: 'PUT',
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
dataList(){
|
||||
var _data = JSON.parse(JSON.stringify(this.dataForm));
|
||||
_data.orgId = JSON.stringify(_data.orgId)
|
||||
_data.status = parseInt(_data.status)
|
||||
return _data;
|
||||
},
|
||||
dataInfo(dataAll){
|
||||
let _dataAll =dataAll
|
||||
_dataAll.orgId = JSON.parse( _dataAll.orgId)
|
||||
_dataAll.status = parseInt( _dataAll.status)
|
||||
this.dataForm = _dataAll
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
clearData(data) {
|
||||
for (let key in data) {
|
||||
if (data[key] instanceof Array) {
|
||||
data[key] = [];
|
||||
} else if (data[key] instanceof Object) {
|
||||
this.clearData(data[key]);
|
||||
} else {
|
||||
data[key] = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
init(id, isDetail) {
|
||||
this.dataForm.id = id || 0;
|
||||
this.visible = true;
|
||||
this.isDetail = isDetail || false;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['elForm'].resetFields();
|
||||
if (this.dataForm.id) {
|
||||
this.loading = true
|
||||
request({
|
||||
url: '/api/customer/Customer/' + this.dataForm.id,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataInfo(res.data)
|
||||
this.loading = false
|
||||
});
|
||||
} else {
|
||||
this.clearData(this.dataForm)
|
||||
}
|
||||
});
|
||||
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['elForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.request()
|
||||
}
|
||||
})
|
||||
},
|
||||
request() {
|
||||
var _data = this.dataList()
|
||||
if (!this.dataForm.id) {
|
||||
request({
|
||||
url: '/api/customer/Customer',
|
||||
method: 'post',
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
request({
|
||||
url: '/api/customer/Customer/' + this.dataForm.id,
|
||||
method: 'PUT',
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
dataList() {
|
||||
var _data = JSON.parse(JSON.stringify(this.dataForm));
|
||||
_data.status = parseInt(_data.status)
|
||||
return _data;
|
||||
},
|
||||
dataInfo(dataAll) {
|
||||
let _dataAll = dataAll
|
||||
_dataAll.status = parseInt(_dataAll.status)
|
||||
this.dataForm = _dataAll
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -1,321 +1,279 @@
|
||||
<template>
|
||||
<div class="JNPF-common-layout">
|
||||
<div class="JNPF-common-layout">
|
||||
|
||||
<div class="JNPF-common-layout-center">
|
||||
<el-row class="JNPF-common-search-box" :gutter="16">
|
||||
<el-form @submit.native.prevent>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="客户编码">
|
||||
<el-input v-model="query.supplierCd" placeholder="请输入" clearable> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="客户名称">
|
||||
<el-input v-model="query.supplierNm" placeholder="请输入" clearable> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
||||
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||
<div class="JNPF-common-head">
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">新增
|
||||
</el-button>
|
||||
<el-button type="text" icon="el-icon-download" @click="exportData()">导出
|
||||
</el-button>
|
||||
<el-button type="text" icon="el-icon-delete" @click="handleBatchRemoveDel()">批量删除
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="JNPF-common-head-right">
|
||||
<el-tooltip effect="dark" content="刷新" placement="top">
|
||||
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
|
||||
@click="reset()" />
|
||||
</el-tooltip>
|
||||
<screenfull isContainer />
|
||||
</div>
|
||||
</div>
|
||||
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' has-c
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column prop="supplierCd" label="客户编码" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="supplierNm" label="客户名称" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="orgId" label="所属公司ID" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="orgName" label="公司代码" width="0" align="left" sortable="custom" />
|
||||
<el-table-column label="客户等级" width="0" prop="customerLevel" algin="left" sortable="custom">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.customerLevel | dynamicText(customerLevelOptions) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="contactName" label="联系人" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="address" label="地址" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="contactPhone" label="电话" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="status" label="是否启用" width="0" align="left" />
|
||||
<el-table-column label="操作" fixed="right" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="addOrUpdateHandle(scope.row.id)">编辑
|
||||
</el-button>
|
||||
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)">删除
|
||||
</el-button>
|
||||
<el-button type="text" @click="goDetail(scope.row.id)">详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</JNPF-table>
|
||||
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
|
||||
@pagination="initData" />
|
||||
</div>
|
||||
</div>
|
||||
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh" />
|
||||
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" />
|
||||
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false" />
|
||||
</div>
|
||||
<div class="JNPF-common-layout-center">
|
||||
<el-row class="JNPF-common-search-box" :gutter="16">
|
||||
<el-form @submit.native.prevent>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="客户编码">
|
||||
<el-input v-model="query.supplierCd" placeholder="请输入" clearable> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="客户名称">
|
||||
<el-input v-model="query.supplierNm" placeholder="请输入" clearable> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
||||
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||
<div class="JNPF-common-head">
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">新增
|
||||
</el-button>
|
||||
<el-button type="text" icon="el-icon-download" @click="exportData()" >导出
|
||||
</el-button>
|
||||
<el-button type="text" icon="el-icon-delete" @click="handleBatchRemoveDel()" >批量删除
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="JNPF-common-head-right">
|
||||
<el-tooltip effect="dark" content="刷新" placement="top">
|
||||
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
|
||||
@click="reset()"/>
|
||||
</el-tooltip>
|
||||
<screenfull isContainer/>
|
||||
</div>
|
||||
</div>
|
||||
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' has-c @selection-change="handleSelectionChange">
|
||||
<el-table-column prop="supplierCd" label="客户编码" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="supplierNm" label="客户名称" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="orgId" label="公司名称" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column label="客户等级" width="0" prop="customerLevel" algin="left"
|
||||
sortable="custom" >
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.customerLevel | dynamicText(customerLevelOptions) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="contactName" label="联系人" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="contactPhone" label="电话" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="address" label="地址" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="status" label="是否启用" width="0" align="left" sortable="custom" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" disable-transitions v-if="scope.row.status == '1'">启用
|
||||
</el-tag>
|
||||
<el-tag type="danger" disable-transitions v-else>停用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right"
|
||||
width="150" >
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text"
|
||||
@click="addOrUpdateHandle(scope.row.id)" >编辑
|
||||
</el-button>
|
||||
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)">删除
|
||||
</el-button>
|
||||
<el-button type="text"
|
||||
@click="goDetail(scope.row.id)">详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</JNPF-table>
|
||||
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData"/>
|
||||
</div>
|
||||
</div>
|
||||
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
|
||||
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download"/>
|
||||
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import {
|
||||
getDictionaryDataSelector
|
||||
} from '@/api/systemData/dictionary'
|
||||
import JNPFForm from './Form'
|
||||
import ExportBox from './ExportBox'
|
||||
import {
|
||||
getDataInterfaceRes
|
||||
} from '@/api/systemData/dataInterface'
|
||||
import Detail from './Detail'
|
||||
import request from '@/utils/request'
|
||||
import {getDictionaryDataSelector} from '@/api/systemData/dictionary'
|
||||
import JNPFForm from './Form'
|
||||
import ExportBox from './ExportBox'
|
||||
import {getDataInterfaceRes} from '@/api/systemData/dataInterface'
|
||||
import Detail from './Detail'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
JNPFForm,
|
||||
ExportBox,
|
||||
Detail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
detailVisible: false,
|
||||
query: {
|
||||
supplierCd: undefined,
|
||||
supplierNm: undefined,
|
||||
},
|
||||
treeProps: {
|
||||
children: 'children',
|
||||
label: 'fullName',
|
||||
value: 'id'
|
||||
},
|
||||
list: [],
|
||||
listLoading: true,
|
||||
multipleSelection: [],
|
||||
total: 0,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
sort: "desc",
|
||||
sidx: "supplierCd",
|
||||
},
|
||||
formVisible: false,
|
||||
exportBoxVisible: false,
|
||||
columnList: [{
|
||||
prop: 'supplierCd',
|
||||
label: '客户编码'
|
||||
},
|
||||
{
|
||||
prop: 'supplierNm',
|
||||
label: '客户名称'
|
||||
},
|
||||
{
|
||||
prop: 'orgId',
|
||||
label: '所属公司ID'
|
||||
},
|
||||
{
|
||||
prop: 'orgName',
|
||||
label: '公司代码'
|
||||
},
|
||||
{
|
||||
prop: 'customerLevel',
|
||||
label: '客户等级'
|
||||
},
|
||||
{
|
||||
prop: 'contactName',
|
||||
label: '联系人'
|
||||
},
|
||||
{
|
||||
prop: 'address',
|
||||
label: '地址'
|
||||
},
|
||||
{
|
||||
prop: 'contactPhone',
|
||||
label: '电话'
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '是否启用'
|
||||
},
|
||||
],
|
||||
customerLevelOptions: [{
|
||||
"fullName": "一级",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "二级",
|
||||
"id": "2"
|
||||
}, {
|
||||
"fullName": "三级",
|
||||
"id": "3"
|
||||
}],
|
||||
customerLevelProps: {
|
||||
"label": "fullName",
|
||||
"value": "id"
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
menuId() {
|
||||
return this.$route.meta.modelId || ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initData()
|
||||
},
|
||||
methods: {
|
||||
goDetail(id) {
|
||||
this.detailVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.Detail.init(id)
|
||||
})
|
||||
},
|
||||
sortChange({
|
||||
column,
|
||||
prop,
|
||||
order
|
||||
}) {
|
||||
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
|
||||
this.listQuery.sidx = !order ? '' : prop
|
||||
this.initData()
|
||||
},
|
||||
initData() {
|
||||
this.listLoading = true;
|
||||
let _query = {
|
||||
...this.listQuery,
|
||||
...this.query,
|
||||
menuId: this.menuId
|
||||
};
|
||||
request({
|
||||
url: `/api/customer/Customer/getList`,
|
||||
method: 'post',
|
||||
data: _query
|
||||
}).then(res => {
|
||||
var _list = [];
|
||||
for (let i = 0; i < res.data.list.length; i++) {
|
||||
let _data = res.data.list[i];
|
||||
_list.push(_data)
|
||||
}
|
||||
this.list = _list
|
||||
this.total = res.data.pagination.total
|
||||
export default {
|
||||
components: {JNPFForm, ExportBox,Detail},
|
||||
data() {
|
||||
return {
|
||||
detailVisible: false,
|
||||
query: {
|
||||
supplierCd:undefined,
|
||||
supplierNm:undefined,
|
||||
},
|
||||
treeProps: {
|
||||
children: 'children',
|
||||
label: 'fullName',
|
||||
value: 'id'
|
||||
},
|
||||
list: [],
|
||||
listLoading: true,
|
||||
multipleSelection: [], total: 0,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
sort: "desc",
|
||||
sidx: "supplierCd",
|
||||
},
|
||||
formVisible: false,
|
||||
exportBoxVisible: false,
|
||||
columnList: [
|
||||
{prop: 'supplierCd', label: '客户编码'},
|
||||
{prop: 'supplierNm', label: '客户名称'},
|
||||
{prop: 'orgId', label: '公司名称'},
|
||||
{prop: 'customerLevel', label: '客户等级'},
|
||||
{prop: 'contactName', label: '联系人'},
|
||||
{prop: 'contactPhone', label: '电话'},
|
||||
{prop: 'address', label: '地址'},
|
||||
{prop: 'status', label: '是否启用'},
|
||||
],
|
||||
customerLevelOptions:[{"fullName":"一级","id":"1"},{"fullName":"二级","id":"2"},{"fullName":"三级","id":"3"}],
|
||||
customerLevelProps:{"label":"fullName","value":"id"},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
menuId() {
|
||||
return this.$route.meta.modelId || ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initData()
|
||||
},
|
||||
methods: {
|
||||
goDetail(id){
|
||||
this.detailVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.Detail.init(id)
|
||||
})
|
||||
},
|
||||
sortChange({column, prop, order}) {
|
||||
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
|
||||
this.listQuery.sidx = !order ? '' : prop
|
||||
this.initData()
|
||||
},
|
||||
initData() {
|
||||
this.listLoading = true;
|
||||
let _query = {
|
||||
...this.listQuery,
|
||||
...this.query,
|
||||
menuId:this.menuId
|
||||
};
|
||||
request({
|
||||
url: `/api/customer/Customer/getList`,
|
||||
method: 'post',
|
||||
data: _query
|
||||
}).then(res => {
|
||||
var _list =[];
|
||||
for(let i=0;i<res.data.list.length;i++){
|
||||
let _data = res.data.list[i];
|
||||
_list.push(_data)
|
||||
}
|
||||
this.list = _list
|
||||
this.total = res.data.pagination.total
|
||||
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
handleDel(id) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: `/api/customer/Customer/${id}`,
|
||||
method: 'DELETE'
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: res.msg,
|
||||
onClose: () => {
|
||||
this.initData()
|
||||
}
|
||||
});
|
||||
})
|
||||
}).catch(() => {});
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
const res = val.map(item => item.id)
|
||||
this.multipleSelection = res
|
||||
},
|
||||
handleBatchRemoveDel() {
|
||||
if (!this.multipleSelection.length) {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '请选择一条数据',
|
||||
duration: 1500,
|
||||
})
|
||||
return
|
||||
}
|
||||
const ids = this.multipleSelection.join()
|
||||
this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: `/api/customer/Customer/batchRemove/${ids}`,
|
||||
method: 'DELETE'
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: res.msg,
|
||||
onClose: () => {
|
||||
this.initData()
|
||||
}
|
||||
});
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
addOrUpdateHandle(id, isDetail) {
|
||||
this.formVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.JNPFForm.init(id, isDetail)
|
||||
})
|
||||
},
|
||||
exportData() {
|
||||
this.exportBoxVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.ExportBox.init(this.columnList)
|
||||
})
|
||||
},
|
||||
download(data) {
|
||||
let query = {
|
||||
...data,
|
||||
...this.listQuery,
|
||||
...this.query,
|
||||
menuId: this.menuId
|
||||
}
|
||||
request({
|
||||
url: `/api/customer/Customer/Actions/Export`,
|
||||
method: 'GET',
|
||||
data: query
|
||||
}).then(res => {
|
||||
if (!res.data.url) return
|
||||
this.jnpf.downloadFile(res.data.url)
|
||||
this.$refs.ExportBox.visible = false
|
||||
this.exportBoxVisible = false
|
||||
})
|
||||
},
|
||||
search() {
|
||||
this.listQuery = {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
sort: "desc",
|
||||
sidx: "supplierCd",
|
||||
}
|
||||
this.initData()
|
||||
},
|
||||
refresh(isrRefresh) {
|
||||
this.formVisible = false
|
||||
if (isrRefresh) this.reset()
|
||||
},
|
||||
reset() {
|
||||
for (let key in this.query) {
|
||||
this.query[key] = undefined
|
||||
}
|
||||
this.search()
|
||||
}
|
||||
}
|
||||
}
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
handleDel(id) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: `/api/customer/Customer/${id}`,
|
||||
method: 'DELETE'
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: res.msg,
|
||||
onClose: () => {
|
||||
this.initData()
|
||||
}
|
||||
});
|
||||
})
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
const res = val.map(item => item.id)
|
||||
this.multipleSelection = res
|
||||
},
|
||||
handleBatchRemoveDel() {
|
||||
if (!this.multipleSelection.length) {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '请选择一条数据',
|
||||
duration: 1500,
|
||||
})
|
||||
return
|
||||
}
|
||||
const ids = this.multipleSelection.join()
|
||||
this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: `/api/customer/Customer/batchRemove/${ids}`,
|
||||
method: 'DELETE'
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: res.msg,
|
||||
onClose: () => {
|
||||
this.initData()
|
||||
}
|
||||
});
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
addOrUpdateHandle(id, isDetail) {
|
||||
this.formVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.JNPFForm.init(id, isDetail)
|
||||
})
|
||||
},
|
||||
exportData() {
|
||||
this.exportBoxVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.ExportBox.init(this.columnList)
|
||||
})
|
||||
},
|
||||
download(data) {
|
||||
let query = {...data, ...this.listQuery, ...this.query,menuId:this.menuId}
|
||||
request({
|
||||
url: `/api/customer/Customer/Actions/Export`,
|
||||
method: 'GET',
|
||||
data: query
|
||||
}).then(res => {
|
||||
if (!res.data.url) return
|
||||
this.jnpf.downloadFile(res.data.url)
|
||||
this.$refs.ExportBox.visible = false
|
||||
this.exportBoxVisible = false
|
||||
})
|
||||
},
|
||||
search() {
|
||||
this.listQuery = {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
sort: "desc",
|
||||
sidx: "supplierCd",
|
||||
}
|
||||
this.initData()
|
||||
},
|
||||
refresh(isrRefresh) {
|
||||
this.formVisible = false
|
||||
if (isrRefresh) this.reset()
|
||||
},
|
||||
reset() {
|
||||
for (let key in this.query) {
|
||||
this.query[key] = undefined
|
||||
}
|
||||
this.search()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -1,264 +1,258 @@
|
||||
<template>
|
||||
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'" :close-on-click-modal="false" append-to-body
|
||||
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll width="1000px">
|
||||
<el-row :gutter="15" class="">
|
||||
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px"
|
||||
label-position="right">
|
||||
<template v-if="!loading">
|
||||
<el-col :span="24">
|
||||
<el-form-item label-width="0">
|
||||
<JNPF-Text :style='{"width":"100%"}'
|
||||
:textStyle='{"color":"#000000","font-weight":"bold","text-decoration":"none","font-size":18,"line-height":32,"font-style":"normal","text-align":"left"}'
|
||||
value="供应商编辑">
|
||||
</JNPF-Text>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供应商编码" prop="supplierCode">
|
||||
<el-input v-model="dataForm.supplierCode" placeholder="请输入供应商编码" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
<el-dialog :title="!dataForm.id ? '新建' : isDetail ? '详情':'编辑'"
|
||||
:close-on-click-modal="false" append-to-body
|
||||
:visible.sync="visible" class="JNPF-dialog JNPF-dialog_center" lock-scroll
|
||||
width="1000px">
|
||||
<el-row :gutter="15" class="">
|
||||
<el-form ref="elForm" :model="dataForm" :rules="rules" size="small" label-width="100px" label-position="right" >
|
||||
<template v-if="!loading">
|
||||
<el-col :span="24" >
|
||||
<el-form-item label-width="0">
|
||||
<JNPF-Text :style='{"width":"100%"}'
|
||||
:textStyle='{"color":"#000000","font-weight":"bold","text-decoration":"none","font-size":18,"line-height":32,"font-style":"normal","text-align":"left"}' value="供应商编辑">
|
||||
</JNPF-Text>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="供应商编码"
|
||||
prop="supplierCode" >
|
||||
<el-input v-model="dataForm.supplierCode"
|
||||
placeholder="请输入供应商编码" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供应商名称" prop="supplierName">
|
||||
<el-input v-model="dataForm.supplierName" placeholder="请输入供应商名称" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="供应商名称"
|
||||
prop="supplierName" >
|
||||
<el-input v-model="dataForm.supplierName"
|
||||
placeholder="请输入供应商名称" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="地点ID" prop="supplierSiteId">
|
||||
<el-input v-model="dataForm.supplierSiteId" placeholder="请输入供应商地点ID" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="供应商地点ID"
|
||||
prop="supplierSiteId" >
|
||||
<el-input v-model="dataForm.supplierSiteId"
|
||||
placeholder="请输入供应商地点ID" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="地点名称" prop="supplierSiteCode">
|
||||
<el-input v-model="dataForm.supplierSiteCode" placeholder="请输入供应商地点名称" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="供应商地点名称"
|
||||
prop="supplierSiteCode" >
|
||||
<el-input v-model="dataForm.supplierSiteCode"
|
||||
placeholder="请输入供应商地点名称" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属公司编码" prop="companyId">
|
||||
<el-input v-model="dataForm.companyId" placeholder="请输入所属公司编码" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="公司名称"
|
||||
prop="companyId" >
|
||||
<com-select v-model="dataForm.companyId"
|
||||
placeholder="请选择" clearable >
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="所属公司名称" prop="companyName">
|
||||
<el-input v-model="dataForm.companyName" placeholder="请输入公司名称" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</com-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="地址"
|
||||
prop="address" >
|
||||
<el-input v-model="dataForm.address"
|
||||
placeholder="请输入地址" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系人" prop="contactName">
|
||||
<el-input v-model="dataForm.contactName" placeholder="请输入联系人" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="联系人"
|
||||
prop="contactName" >
|
||||
<el-input v-model="dataForm.contactName"
|
||||
placeholder="请输入联系人" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="联系电话" prop="contactPhone">
|
||||
<el-input v-model="dataForm.contactPhone" placeholder="请输入联系电话" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="联系电话"
|
||||
prop="contactPhone" >
|
||||
<el-input v-model="dataForm.contactPhone"
|
||||
placeholder="请输入联系电话" clearable :style='{"width":"100%"}'>
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="供应商等级" prop="supplierLevel">
|
||||
<el-select v-model="dataForm.supplierLevel" placeholder="请选择" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
<el-option v-for="(item, index) in supplierLevelOptions" :key="index"
|
||||
:label="item.fullName" :value="item.id" :disabled="item.disabled"></el-option>
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="供应商等级"
|
||||
prop="supplierLevel" >
|
||||
<el-select v-model="dataForm.supplierLevel"
|
||||
placeholder="请选择" clearable :style='{"width":"100%"}'>
|
||||
<el-option v-for="(item, index) in supplierLevelOptions" :key="index" :label="item.fullName" :value="item.id" :disabled="item.disabled" ></el-option>
|
||||
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="地址" prop="address">
|
||||
<el-input v-model="dataForm.address" placeholder="请输入地址" clearable
|
||||
:style='{"width":"100%"}'>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12" >
|
||||
<el-form-item label="启用"
|
||||
prop="status" >
|
||||
<el-switch v-model="dataForm.status"
|
||||
:active-value="1" :inactive-value="0" >
|
||||
|
||||
</el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="启用" prop="status">
|
||||
<el-switch v-model="dataForm.status" :active-value="1" :inactive-value="0">
|
||||
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false"> 取 消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail"> 确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</el-switch>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</template>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false"> 取 消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()" v-if="!isDetail"> 确 定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import {
|
||||
getDataInterfaceRes
|
||||
} from '@/api/systemData/dataInterface'
|
||||
import {
|
||||
getDictionaryDataSelector
|
||||
} from '@/api/systemData/dictionary'
|
||||
export default {
|
||||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
loading: false,
|
||||
isDetail: false,
|
||||
dataForm: {
|
||||
supplierCode: '',
|
||||
supplierName: '',
|
||||
supplierSiteId: '',
|
||||
supplierSiteCode: '',
|
||||
companyId: '',
|
||||
companyName: '',
|
||||
contactName: '',
|
||||
contactPhone: '',
|
||||
supplierLevel: "1",
|
||||
address: '',
|
||||
status: 1,
|
||||
},
|
||||
rules: {
|
||||
supplierCode: [{
|
||||
required: true,
|
||||
message: '请输入供应商编码',
|
||||
trigger: 'blur'
|
||||
}, ],
|
||||
supplierName: [{
|
||||
required: true,
|
||||
message: '请输入供应商名称',
|
||||
trigger: 'blur'
|
||||
}, ],
|
||||
},
|
||||
supplierLevelOptions: [{
|
||||
"fullName": "一级",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "二级",
|
||||
"id": "2"
|
||||
}, {
|
||||
"fullName": "三级",
|
||||
"id": "3"
|
||||
}, {
|
||||
"fullName": "四级",
|
||||
"id": "4"
|
||||
}],
|
||||
import request from '@/utils/request'
|
||||
import { getDataInterfaceRes } from '@/api/systemData/dataInterface'
|
||||
import { getDictionaryDataSelector } from '@/api/systemData/dictionary'
|
||||
export default {
|
||||
components: {},
|
||||
props: [],
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
loading: false,
|
||||
isDetail: false,
|
||||
dataForm: {
|
||||
supplierCode : '',
|
||||
supplierName : '',
|
||||
supplierSiteId : '',
|
||||
supplierSiteCode : '',
|
||||
companyId : [],
|
||||
address : '',
|
||||
contactName : '',
|
||||
contactPhone : '',
|
||||
supplierLevel : "1",
|
||||
status : 1,
|
||||
},
|
||||
rules:
|
||||
{
|
||||
supplierCode: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入供应商编码',
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
supplierName: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入供应商名称',
|
||||
trigger: 'blur'
|
||||
},
|
||||
],
|
||||
},
|
||||
supplierLevelOptions:[{"fullName":"一级","id":"1"},{"fullName":"二级","id":"2"},{"fullName":"三级","id":"3"},{"fullName":"四级","id":"4"}],
|
||||
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
clearData(data){
|
||||
for (let key in data) {
|
||||
if (data[key] instanceof Array) {
|
||||
data[key] = [];
|
||||
} else if (data[key] instanceof Object) {
|
||||
this.clearData(data[key]);
|
||||
} else {
|
||||
data[key] = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
init(id, isDetail) {
|
||||
this.dataForm.id = id || 0;
|
||||
this.visible = true;
|
||||
this.isDetail = isDetail || false;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['elForm'].resetFields();
|
||||
if(this.dataForm.id){
|
||||
this.loading = true
|
||||
request({
|
||||
url: '/api/supplier/Supplier/'+this.dataForm.id,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataInfo(res.data)
|
||||
this.loading = false
|
||||
});
|
||||
}else{
|
||||
this.clearData(this.dataForm)
|
||||
}
|
||||
});
|
||||
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['elForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.request()
|
||||
}
|
||||
})
|
||||
},
|
||||
request() {
|
||||
var _data =this.dataList()
|
||||
if (!this.dataForm.id) {
|
||||
request({
|
||||
url: '/api/supplier/Supplier',
|
||||
method: 'post',
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
})
|
||||
}else{
|
||||
request({
|
||||
url: '/api/supplier/Supplier/'+this.dataForm.id,
|
||||
method: 'PUT',
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
dataList(){
|
||||
var _data = JSON.parse(JSON.stringify(this.dataForm));
|
||||
_data.companyId = JSON.stringify(_data.companyId)
|
||||
_data.status = parseInt(_data.status)
|
||||
return _data;
|
||||
},
|
||||
dataInfo(dataAll){
|
||||
let _dataAll =dataAll
|
||||
_dataAll.companyId = JSON.parse( _dataAll.companyId)
|
||||
_dataAll.status = parseInt( _dataAll.status)
|
||||
this.dataForm = _dataAll
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
computed: {},
|
||||
watch: {},
|
||||
created() {},
|
||||
mounted() {},
|
||||
methods: {
|
||||
clearData(data) {
|
||||
for (let key in data) {
|
||||
if (data[key] instanceof Array) {
|
||||
data[key] = [];
|
||||
} else if (data[key] instanceof Object) {
|
||||
this.clearData(data[key]);
|
||||
} else {
|
||||
data[key] = "";
|
||||
}
|
||||
}
|
||||
},
|
||||
init(id, isDetail) {
|
||||
this.dataForm.id = id || 0;
|
||||
this.visible = true;
|
||||
this.isDetail = isDetail || false;
|
||||
this.$nextTick(() => {
|
||||
this.$refs['elForm'].resetFields();
|
||||
if (this.dataForm.id) {
|
||||
this.loading = true
|
||||
request({
|
||||
url: '/api/supplier/Supplier/' + this.dataForm.id,
|
||||
method: 'get'
|
||||
}).then(res => {
|
||||
this.dataInfo(res.data)
|
||||
this.loading = false
|
||||
});
|
||||
} else {
|
||||
this.clearData(this.dataForm)
|
||||
}
|
||||
});
|
||||
this.$store.commit('generator/UPDATE_RELATION_DATA', {})
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit() {
|
||||
this.$refs['elForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.request()
|
||||
}
|
||||
})
|
||||
},
|
||||
request() {
|
||||
var _data = this.dataList()
|
||||
if (!this.dataForm.id) {
|
||||
request({
|
||||
url: '/api/supplier/Supplier',
|
||||
method: 'post',
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
request({
|
||||
url: '/api/supplier/Supplier/' + this.dataForm.id,
|
||||
method: 'PUT',
|
||||
data: _data
|
||||
}).then((res) => {
|
||||
this.$message({
|
||||
message: res.msg,
|
||||
type: 'success',
|
||||
duration: 1000,
|
||||
onClose: () => {
|
||||
this.visible = false
|
||||
this.$emit('refresh', true)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
dataList() {
|
||||
var _data = JSON.parse(JSON.stringify(this.dataForm));
|
||||
_data.status = parseInt(_data.status)
|
||||
return _data;
|
||||
},
|
||||
dataInfo(dataAll) {
|
||||
let _dataAll = dataAll
|
||||
_dataAll.status = parseInt(_dataAll.status)
|
||||
this.dataForm = _dataAll
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
@ -1,345 +1,285 @@
|
||||
<template>
|
||||
<div class="JNPF-common-layout">
|
||||
<div class="JNPF-common-layout">
|
||||
|
||||
<div class="JNPF-common-layout-center">
|
||||
<el-row class="JNPF-common-search-box" :gutter="16">
|
||||
<el-form @submit.native.prevent>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="供应商编码">
|
||||
<el-input v-model="query.supplierCode" placeholder="请输入" clearable> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="供应商名称">
|
||||
<el-input v-model="query.supplierName" placeholder="请输入" clearable> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
||||
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||
<div class="JNPF-common-head">
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">新增
|
||||
</el-button>
|
||||
<el-button type="text" icon="el-icon-download" @click="exportData()">导出
|
||||
</el-button>
|
||||
<el-button type="text" icon="el-icon-delete" @click="handleBatchRemoveDel()">批量删除
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="JNPF-common-head-right">
|
||||
<el-tooltip effect="dark" content="刷新" placement="top">
|
||||
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
|
||||
@click="reset()" />
|
||||
</el-tooltip>
|
||||
<screenfull isContainer />
|
||||
</div>
|
||||
</div>
|
||||
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' has-c
|
||||
@selection-change="handleSelectionChange">
|
||||
<el-table-column prop="supplierCode" label="供应商编码" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="supplierName" label="供应商名称" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="supplierSiteId" label="地点ID" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="supplierSiteCode" label="地点名称" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="companyId" label="所属公司编码" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="companyName" label="所属公司名称" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="contactName" label="联系人" width="0" align="left" sortable="custom" />
|
||||
<el-table-column prop="contactPhone" label="联系电话" width="0" align="left" sortable="custom" />
|
||||
<el-table-column label="供应商等级" width="0" prop="supplierLevel" algin="left" sortable="custom">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.supplierLevel | dynamicText(supplierLevelOptions) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="address" label="地址" width="0" align="left" sortable="custom" />
|
||||
<!-- <el-table-column prop="status" label="启用" width="0" align="left"
|
||||
sortable="custom" /> -->
|
||||
|
||||
<el-table-column prop="status" label="状态" width="0" align="left">
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" disable-transitions v-if="scope.row.status == 1">启用
|
||||
</el-tag>
|
||||
<el-tag type="danger" disable-transitions v-else>禁用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
||||
|
||||
<el-table-column label="操作" fixed="right" width="150">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" @click="addOrUpdateHandle(scope.row.id)">编辑
|
||||
</el-button>
|
||||
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)">删除
|
||||
</el-button>
|
||||
<el-button type="text" @click="goDetail(scope.row.id)">详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</JNPF-table>
|
||||
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize"
|
||||
@pagination="initData" />
|
||||
</div>
|
||||
</div>
|
||||
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh" />
|
||||
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download" />
|
||||
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false" />
|
||||
</div>
|
||||
<div class="JNPF-common-layout-center">
|
||||
<el-row class="JNPF-common-search-box" :gutter="16">
|
||||
<el-form @submit.native.prevent>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="供应商编码">
|
||||
<el-input v-model="query.supplierCode" placeholder="请输入" clearable> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item label="供应商名称">
|
||||
<el-input v-model="query.supplierName" placeholder="请输入" clearable> </el-input>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" @click="search()">查询</el-button>
|
||||
<el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-form>
|
||||
</el-row>
|
||||
<div class="JNPF-common-layout-main JNPF-flex-main">
|
||||
<div class="JNPF-common-head">
|
||||
<div>
|
||||
<el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">新增
|
||||
</el-button>
|
||||
<el-button type="text" icon="el-icon-download" @click="exportData()" >导出
|
||||
</el-button>
|
||||
<el-button type="text" icon="el-icon-delete" @click="handleBatchRemoveDel()" >批量删除
|
||||
</el-button>
|
||||
</div>
|
||||
<div class="JNPF-common-head-right">
|
||||
<el-tooltip effect="dark" content="刷新" placement="top">
|
||||
<el-link icon="icon-ym icon-ym-Refresh JNPF-common-head-icon" :underline="false"
|
||||
@click="reset()"/>
|
||||
</el-tooltip>
|
||||
<screenfull isContainer/>
|
||||
</div>
|
||||
</div>
|
||||
<JNPF-table v-loading="listLoading" :data="list" @sort-change='sortChange' has-c @selection-change="handleSelectionChange">
|
||||
<el-table-column prop="supplierCode" label="供应商编码" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="supplierName" label="供应商名称" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="supplierSiteId" label="供应商地点ID" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="supplierSiteCode" label="供应商地点名称" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="companyId" label="公司名称" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="contactName" label="联系人" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="contactPhone" label="联系电话" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column label="供应商等级" width="0" prop="supplierLevel" algin="left"
|
||||
sortable="custom" >
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.supplierLevel | dynamicText(supplierLevelOptions) }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="address" label="地址" width="0" align="left"
|
||||
sortable="custom" />
|
||||
<el-table-column prop="status" label="启用" width="0" align="left" sortable="custom" >
|
||||
<template slot-scope="scope">
|
||||
<el-tag type="success" disable-transitions v-if="scope.row.status == '1'">启用
|
||||
</el-tag>
|
||||
<el-tag type="danger" disable-transitions v-else>停用</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right"
|
||||
width="150" >
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text"
|
||||
@click="addOrUpdateHandle(scope.row.id)" >编辑
|
||||
</el-button>
|
||||
<el-button type="text" class="JNPF-table-delBtn" @click="handleDel(scope.row.id)">删除
|
||||
</el-button>
|
||||
<el-button type="text"
|
||||
@click="goDetail(scope.row.id)">详情
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</JNPF-table>
|
||||
<pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData"/>
|
||||
</div>
|
||||
</div>
|
||||
<JNPF-Form v-if="formVisible" ref="JNPFForm" @refresh="refresh"/>
|
||||
<ExportBox v-if="exportBoxVisible" ref="ExportBox" @download="download"/>
|
||||
<Detail v-if="detailVisible" ref="Detail" @refresh="detailVisible=false"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import request from '@/utils/request'
|
||||
import {
|
||||
getDictionaryDataSelector
|
||||
} from '@/api/systemData/dictionary'
|
||||
import JNPFForm from './Form'
|
||||
import ExportBox from './ExportBox'
|
||||
import {
|
||||
getDataInterfaceRes
|
||||
} from '@/api/systemData/dataInterface'
|
||||
import Detail from './Detail'
|
||||
import request from '@/utils/request'
|
||||
import {getDictionaryDataSelector} from '@/api/systemData/dictionary'
|
||||
import JNPFForm from './Form'
|
||||
import ExportBox from './ExportBox'
|
||||
import {getDataInterfaceRes} from '@/api/systemData/dataInterface'
|
||||
import Detail from './Detail'
|
||||
|
||||
export default {
|
||||
components: {
|
||||
JNPFForm,
|
||||
ExportBox,
|
||||
Detail
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
detailVisible: false,
|
||||
query: {
|
||||
supplierCode: undefined,
|
||||
supplierName: undefined,
|
||||
},
|
||||
treeProps: {
|
||||
children: 'children',
|
||||
label: 'fullName',
|
||||
value: 'id'
|
||||
},
|
||||
list: [],
|
||||
listLoading: true,
|
||||
multipleSelection: [],
|
||||
total: 0,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
sort: "desc",
|
||||
sidx: "supplierCode",
|
||||
},
|
||||
formVisible: false,
|
||||
exportBoxVisible: false,
|
||||
columnList: [{
|
||||
prop: 'supplierCode',
|
||||
label: '供应商编码'
|
||||
},
|
||||
{
|
||||
prop: 'supplierName',
|
||||
label: '供应商名称'
|
||||
},
|
||||
{
|
||||
prop: 'supplierSiteId',
|
||||
label: '地点ID'
|
||||
},
|
||||
{
|
||||
prop: 'supplierSiteCode',
|
||||
label: '地点名称'
|
||||
},
|
||||
{
|
||||
prop: 'companyId',
|
||||
label: '所属公司编码'
|
||||
},
|
||||
{
|
||||
prop: 'companyName',
|
||||
label: '所属公司名称'
|
||||
},
|
||||
{
|
||||
prop: 'contactName',
|
||||
label: '联系人'
|
||||
},
|
||||
{
|
||||
prop: 'contactPhone',
|
||||
label: '联系电话'
|
||||
},
|
||||
{
|
||||
prop: 'supplierLevel',
|
||||
label: '供应商等级'
|
||||
},
|
||||
{
|
||||
prop: 'address',
|
||||
label: '地址'
|
||||
},
|
||||
{
|
||||
prop: 'status',
|
||||
label: '启用'
|
||||
},
|
||||
],
|
||||
supplierLevelOptions: [{
|
||||
"fullName": "一级",
|
||||
"id": "1"
|
||||
}, {
|
||||
"fullName": "二级",
|
||||
"id": "2"
|
||||
}, {
|
||||
"fullName": "三级",
|
||||
"id": "3"
|
||||
}, {
|
||||
"fullName": "四级",
|
||||
"id": "4"
|
||||
}],
|
||||
supplierLevelProps: {
|
||||
"label": "fullName",
|
||||
"value": "id"
|
||||
},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
menuId() {
|
||||
return this.$route.meta.modelId || ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initData()
|
||||
},
|
||||
methods: {
|
||||
goDetail(id) {
|
||||
this.detailVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.Detail.init(id)
|
||||
})
|
||||
},
|
||||
sortChange({
|
||||
column,
|
||||
prop,
|
||||
order
|
||||
}) {
|
||||
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
|
||||
this.listQuery.sidx = !order ? '' : prop
|
||||
this.initData()
|
||||
},
|
||||
initData() {
|
||||
this.listLoading = true;
|
||||
let _query = {
|
||||
...this.listQuery,
|
||||
...this.query,
|
||||
menuId: this.menuId
|
||||
};
|
||||
request({
|
||||
url: `/api/supplier/Supplier/getList`,
|
||||
method: 'post',
|
||||
data: _query
|
||||
}).then(res => {
|
||||
var _list = [];
|
||||
for (let i = 0; i < res.data.list.length; i++) {
|
||||
let _data = res.data.list[i];
|
||||
_list.push(_data)
|
||||
}
|
||||
this.list = _list
|
||||
this.total = res.data.pagination.total
|
||||
export default {
|
||||
components: {JNPFForm, ExportBox,Detail},
|
||||
data() {
|
||||
return {
|
||||
detailVisible: false,
|
||||
query: {
|
||||
supplierCode:undefined,
|
||||
supplierName:undefined,
|
||||
},
|
||||
treeProps: {
|
||||
children: 'children',
|
||||
label: 'fullName',
|
||||
value: 'id'
|
||||
},
|
||||
list: [],
|
||||
listLoading: true,
|
||||
multipleSelection: [], total: 0,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
sort: "desc",
|
||||
sidx: "supplierCode",
|
||||
},
|
||||
formVisible: false,
|
||||
exportBoxVisible: false,
|
||||
columnList: [
|
||||
{prop: 'supplierCode', label: '供应商编码'},
|
||||
{prop: 'supplierName', label: '供应商名称'},
|
||||
{prop: 'supplierSiteId', label: '供应商地点ID'},
|
||||
{prop: 'supplierSiteCode', label: '供应商地点名称'},
|
||||
{prop: 'companyId', label: '公司名称'},
|
||||
{prop: 'contactName', label: '联系人'},
|
||||
{prop: 'contactPhone', label: '联系电话'},
|
||||
{prop: 'supplierLevel', label: '供应商等级'},
|
||||
{prop: 'address', label: '地址'},
|
||||
{prop: 'status', label: '启用'},
|
||||
],
|
||||
supplierLevelOptions:[{"fullName":"一级","id":"1"},{"fullName":"二级","id":"2"},{"fullName":"三级","id":"3"},{"fullName":"四级","id":"4"}],
|
||||
supplierLevelProps:{"label":"fullName","value":"id"},
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
menuId() {
|
||||
return this.$route.meta.modelId || ''
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.initData()
|
||||
},
|
||||
methods: {
|
||||
goDetail(id){
|
||||
this.detailVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.Detail.init(id)
|
||||
})
|
||||
},
|
||||
sortChange({column, prop, order}) {
|
||||
this.listQuery.sort = order == 'ascending' ? 'asc' : 'desc'
|
||||
this.listQuery.sidx = !order ? '' : prop
|
||||
this.initData()
|
||||
},
|
||||
initData() {
|
||||
this.listLoading = true;
|
||||
let _query = {
|
||||
...this.listQuery,
|
||||
...this.query,
|
||||
menuId:this.menuId
|
||||
};
|
||||
request({
|
||||
url: `/api/supplier/Supplier/getList`,
|
||||
method: 'post',
|
||||
data: _query
|
||||
}).then(res => {
|
||||
var _list =[];
|
||||
for(let i=0;i<res.data.list.length;i++){
|
||||
let _data = res.data.list[i];
|
||||
_list.push(_data)
|
||||
}
|
||||
this.list = _list
|
||||
this.total = res.data.pagination.total
|
||||
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
handleDel(id) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: `/api/supplier/Supplier/${id}`,
|
||||
method: 'DELETE'
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: res.msg,
|
||||
onClose: () => {
|
||||
this.initData()
|
||||
}
|
||||
});
|
||||
})
|
||||
}).catch(() => {});
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
const res = val.map(item => item.id)
|
||||
this.multipleSelection = res
|
||||
},
|
||||
handleBatchRemoveDel() {
|
||||
if (!this.multipleSelection.length) {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '请选择一条数据',
|
||||
duration: 1500,
|
||||
})
|
||||
return
|
||||
}
|
||||
const ids = this.multipleSelection.join()
|
||||
this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: `/api/supplier/Supplier/batchRemove/${ids}`,
|
||||
method: 'DELETE'
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: res.msg,
|
||||
onClose: () => {
|
||||
this.initData()
|
||||
}
|
||||
});
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
addOrUpdateHandle(id, isDetail) {
|
||||
this.formVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.JNPFForm.init(id, isDetail)
|
||||
})
|
||||
},
|
||||
exportData() {
|
||||
this.exportBoxVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.ExportBox.init(this.columnList)
|
||||
})
|
||||
},
|
||||
download(data) {
|
||||
let query = {
|
||||
...data,
|
||||
...this.listQuery,
|
||||
...this.query,
|
||||
menuId: this.menuId
|
||||
}
|
||||
request({
|
||||
url: `/api/supplier/Supplier/Actions/Export`,
|
||||
method: 'GET',
|
||||
data: query
|
||||
}).then(res => {
|
||||
if (!res.data.url) return
|
||||
this.jnpf.downloadFile(res.data.url)
|
||||
this.$refs.ExportBox.visible = false
|
||||
this.exportBoxVisible = false
|
||||
})
|
||||
},
|
||||
search() {
|
||||
this.listQuery = {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
sort: "desc",
|
||||
sidx: "supplierCode",
|
||||
}
|
||||
this.initData()
|
||||
},
|
||||
refresh(isrRefresh) {
|
||||
this.formVisible = false
|
||||
if (isrRefresh) this.reset()
|
||||
},
|
||||
reset() {
|
||||
for (let key in this.query) {
|
||||
this.query[key] = undefined
|
||||
}
|
||||
this.search()
|
||||
}
|
||||
}
|
||||
}
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
handleDel(id) {
|
||||
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: `/api/supplier/Supplier/${id}`,
|
||||
method: 'DELETE'
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: res.msg,
|
||||
onClose: () => {
|
||||
this.initData()
|
||||
}
|
||||
});
|
||||
})
|
||||
}).catch(() => {
|
||||
});
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
const res = val.map(item => item.id)
|
||||
this.multipleSelection = res
|
||||
},
|
||||
handleBatchRemoveDel() {
|
||||
if (!this.multipleSelection.length) {
|
||||
this.$message({
|
||||
type: 'error',
|
||||
message: '请选择一条数据',
|
||||
duration: 1500,
|
||||
})
|
||||
return
|
||||
}
|
||||
const ids = this.multipleSelection.join()
|
||||
this.$confirm('您确定要删除这些数据吗, 是否继续?', '提示', {
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
request({
|
||||
url: `/api/supplier/Supplier/batchRemove/${ids}`,
|
||||
method: 'DELETE'
|
||||
}).then(res => {
|
||||
this.$message({
|
||||
type: 'success',
|
||||
message: res.msg,
|
||||
onClose: () => {
|
||||
this.initData()
|
||||
}
|
||||
});
|
||||
})
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
addOrUpdateHandle(id, isDetail) {
|
||||
this.formVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.JNPFForm.init(id, isDetail)
|
||||
})
|
||||
},
|
||||
exportData() {
|
||||
this.exportBoxVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs.ExportBox.init(this.columnList)
|
||||
})
|
||||
},
|
||||
download(data) {
|
||||
let query = {...data, ...this.listQuery, ...this.query,menuId:this.menuId}
|
||||
request({
|
||||
url: `/api/supplier/Supplier/Actions/Export`,
|
||||
method: 'GET',
|
||||
data: query
|
||||
}).then(res => {
|
||||
if (!res.data.url) return
|
||||
this.jnpf.downloadFile(res.data.url)
|
||||
this.$refs.ExportBox.visible = false
|
||||
this.exportBoxVisible = false
|
||||
})
|
||||
},
|
||||
search() {
|
||||
this.listQuery = {
|
||||
currentPage: 1,
|
||||
pageSize: 20,
|
||||
sort: "desc",
|
||||
sidx: "supplierCode",
|
||||
}
|
||||
this.initData()
|
||||
},
|
||||
refresh(isrRefresh) {
|
||||
this.formVisible = false
|
||||
if (isrRefresh) this.reset()
|
||||
},
|
||||
reset() {
|
||||
for (let key in this.query) {
|
||||
this.query[key] = undefined
|
||||
}
|
||||
this.search()
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in new issue