Commit ed0dae68 authored by 全洪江's avatar 全洪江

客户主数据tab页列表优化

parent 64f4fcef
...@@ -52,17 +52,16 @@ ...@@ -52,17 +52,16 @@
<el-table v-loading="loading" :data="contactList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="contactList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="跟单员" align="center" prop="id"/> <el-table-column label="客户id" align="center" prop="clientId" width="100"/>
<el-table-column label="客户id" align="center" prop="clientId"/> <el-table-column label="品牌ID" align="center" prop="brandId" width="150"/>
<el-table-column label="品牌ID" align="center" prop="brandId"/> <el-table-column label="职位" align="center" prop="position" width="100"/>
<el-table-column label="职位" align="center" prop="position"/> <el-table-column label="联系人" align="center" prop="contact" width="100"/>
<el-table-column label="联系人" align="center" prop="contact"/> <el-table-column label="电话号码" align="center" prop="tel" width="150"/>
<el-table-column label="电话号码" align="center" prop="tel"/> <el-table-column label="email" align="center" prop="email" width="200"/>
<el-table-column label="email" align="center" prop="email"/> <el-table-column label="经营类型" align="center" prop="businessType" width="100"/>
<el-table-column label="经营类型" align="center" prop="businessType"/> <el-table-column label="工厂代号" align="center" prop="factoryCode" width="100"/>
<el-table-column label="工厂代号" align="center" prop="factoryCode"/> <el-table-column label="跟单员" align="center" prop="merchandiser" width="100"/>
<el-table-column label="跟单员" align="center" prop="merchandiser"/> <el-table-column label="操作" align="center" class-name="small-padding fixed-width" fixed="right" width="200px">
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
...@@ -91,13 +90,51 @@ ...@@ -91,13 +90,51 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" @pagination="getList"
/> />
<!-- 添加或修改客户联系人对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="品牌ID" prop="brandId" label-width="120px">
<el-input v-model="form.brandId" placeholder="请输入品牌ID" />
</el-form-item>
<el-form-item label="职位" prop="position" label-width="120px">
<el-input v-model="form.position" placeholder="请输入职位" />
</el-form-item>
<el-form-item label="联系人" prop="contact" label-width="120px">
<el-input v-model="form.contact" placeholder="请输入联系人" />
</el-form-item>
<el-form-item label="电话号码" prop="tel" label-width="120px">
<el-input v-model="form.tel" placeholder="请输入电话号码" />
</el-form-item>
<el-form-item label="email" prop="email" label-width="120px">
<el-input v-model="form.email" placeholder="请输入email" />
</el-form-item>
<el-form-item label="经营类型" prop="businessType" label-width="120px">
<el-input v-model="form.businessType" placeholder="请输入经营类型" />
</el-form-item>
<el-form-item label="工厂代号" prop="spefactoryCodec" label-width="120px">
<el-input v-model="form.factoryCode" placeholder="请输入产工厂代码" />
</el-form-item>
<el-form-item label="跟单员" prop="merchandiser" label-width="120px">
<el-input v-model="form.merchandiser" placeholder="请输入跟单员" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import { listContact } from '@/api/mes/md/clientContact' import { listContact,addContact,updateContact,getContact,delContact } from '@/api/mes/md/clientContact'
export default { export default {
props: {
clientId: { type: Number | undefined, default:undefined },
},
data() { data() {
return { return {
// 遮罩层 // 遮罩层
...@@ -112,7 +149,7 @@ export default { ...@@ -112,7 +149,7 @@ export default {
showSearch: true, showSearch: true,
// 总条数 // 总条数
total: 0, total: 0,
// 客户系人表格数据 // 客户系人表格数据
contactList: [], contactList: [],
// 弹出层标题 // 弹出层标题
title: '', title: '',
...@@ -127,13 +164,34 @@ export default { ...@@ -127,13 +164,34 @@ export default {
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: {} rules: {
brandId: [
{ required: true, trigger: 'blur' }
],
position: [
{ required: true, trigger: 'blur' }
],
contact: [
{ required: true, trigger: 'blur' }
],
tel: [
{ required: true, trigger: 'blur' }
],
businessType: [
{ required: true, trigger: 'blur' }
],
merchandiser: [
{ required: true, trigger: 'blur' }
]
}
} }
}, },
methods: { methods: {
/** 查询客户系人列表 */ /** 查询客户系人列表 */
getList() { getList() {
this.loading = true this.loading = true
this.queryParams.clientId=this.clientId
listContact(this.queryParams).then(response => { listContact(this.queryParams).then(response => {
this.contactList = response.rows this.contactList = response.rows
this.total = response.total this.total = response.total
...@@ -148,7 +206,7 @@ export default { ...@@ -148,7 +206,7 @@ export default {
reset() { reset() {
this.form = { this.form = {
id: null, id: null,
clientId: null, clientId: this.clientId,
brandId: null, brandId: null,
position: null, position: null,
contact: null, contact: null,
...@@ -184,7 +242,7 @@ export default { ...@@ -184,7 +242,7 @@ export default {
handleAdd() { handleAdd() {
this.reset() this.reset()
this.open = true this.open = true
this.title = '添加客户系人' this.title = '添加客户系人'
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
...@@ -193,7 +251,7 @@ export default { ...@@ -193,7 +251,7 @@ export default {
getContact(id).then(response => { getContact(id).then(response => {
this.form = response.data this.form = response.data
this.open = true this.open = true
this.title = '修改客户系人' this.title = '修改客户系人'
}) })
}, },
/** 提交按钮 */ /** 提交按钮 */
...@@ -201,12 +259,14 @@ export default { ...@@ -201,12 +259,14 @@ export default {
this.$refs['form'].validate(valid => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateContact(this.form).then(response => { updateContact(this.form).then(response => {
this.$modal.msgSuccess('修改成功') this.$modal.msgSuccess('修改成功')
this.open = false this.open = false
this.getList() this.getList()
}) })
} else { } else {
this.form.clientId = this.clientId
addContact(this.form).then(response => { addContact(this.form).then(response => {
this.$modal.msgSuccess('新增成功') this.$modal.msgSuccess('新增成功')
this.open = false this.open = false
...@@ -219,7 +279,7 @@ export default { ...@@ -219,7 +279,7 @@ export default {
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids const ids = row.id || this.ids
this.$modal.confirm('是否确认删除客户系人编号为"' + ids + '"的数据项?').then(function() { this.$modal.confirm('是否确认删除?').then(function() {
return delContact(ids) return delContact(ids)
}).then(() => { }).then(() => {
this.getList() this.getList()
......
...@@ -48,9 +48,11 @@ ...@@ -48,9 +48,11 @@
<el-table v-loading="loading" :data="relationList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="relationList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" /> <el-table-column type="selection" width="55" align="center" />
<el-table-column label="支付方客户ID" align="center" prop="id" />
<el-table-column label="客户id" align="center" prop="clientId" /> <el-table-column label="客户id" align="center" prop="clientId" />
<el-table-column label="支付方客户ID" align="center" prop="relatedClientId" /> <el-table-column label="支付方客户ID" align="center" prop="relatedClientId" />
<el-table-column label="创建人" align="center" prop="createBy" />
<el-table-column label="创建时间" align="center" prop="createTime" />
<el-table-column label="修改时间" align="center" prop="updateTime" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
...@@ -82,10 +84,7 @@ ...@@ -82,10 +84,7 @@
<!-- 添加或修改客户付款信息关联对话框 --> <!-- 添加或修改客户付款信息关联对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="客户id" prop="clientId"> <el-form-item label="支付方客户ID" prop="relatedClientId" label-width="8em">
<el-input v-model="form.clientId" placeholder="请输入客户id" />
</el-form-item>
<el-form-item label="支付方客户ID" prop="relatedClientId">
<el-input v-model="form.relatedClientId" placeholder="请输入支付方客户ID" /> <el-input v-model="form.relatedClientId" placeholder="请输入支付方客户ID" />
</el-form-item> </el-form-item>
</el-form> </el-form>
...@@ -102,6 +101,9 @@ import { listRelation, getRelation, delRelation, addRelation, updateRelation } f ...@@ -102,6 +101,9 @@ import { listRelation, getRelation, delRelation, addRelation, updateRelation } f
export default { export default {
name: "Relation", name: "Relation",
props: {
clientId: { type: Number | undefined, default:undefined },
},
data() { data() {
return { return {
// 遮罩层 // 遮罩层
...@@ -133,6 +135,9 @@ export default { ...@@ -133,6 +135,9 @@ export default {
form: {}, form: {},
// 表单校验 // 表单校验
rules: { rules: {
relatedClientId: [{
required: true, trigger: 'blur'
}]
} }
}; };
}, },
...@@ -143,6 +148,7 @@ export default { ...@@ -143,6 +148,7 @@ export default {
/** 查询客户付款信息关联列表 */ /** 查询客户付款信息关联列表 */
getList() { getList() {
this.loading = true; this.loading = true;
this.queryParams.clientId=this.clientId
listRelation(this.queryParams).then(response => { listRelation(this.queryParams).then(response => {
this.relationList = response.rows; this.relationList = response.rows;
this.total = response.total; this.total = response.total;
...@@ -157,7 +163,7 @@ export default { ...@@ -157,7 +163,7 @@ export default {
// 表单重置 // 表单重置
reset() { reset() {
this.form = { this.form = {
id: null, clientId: null, relatedClientId: null, createBy: null, createTime: null, updateBy: null, updateTime: null }; id: null, clientId: this.clientId, relatedClientId: null, createBy: null, createTime: null, updateBy: null, updateTime: null };
this.resetForm("form"); this.resetForm("form");
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
...@@ -203,6 +209,7 @@ export default { ...@@ -203,6 +209,7 @@ export default {
this.getList(); this.getList();
}); });
} else { } else {
this.form.clientId= this.clientId
addRelation(this.form).then(response => { addRelation(this.form).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.open = false; this.open = false;
......
...@@ -53,11 +53,14 @@ ...@@ -53,11 +53,14 @@
<el-table v-loading="loading" :data="emailList" @selection-change="handleSelectionChange"> <el-table v-loading="loading" :data="emailList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center"/> <el-table-column type="selection" width="55" align="center"/>
<el-table-column label="是否开启" align="center" prop="id"/>
<el-table-column label="客户id" align="center" prop="clientId"/> <el-table-column label="客户id" align="center" prop="clientId"/>
<el-table-column label="邮箱" align="center" prop="email"/> <el-table-column label="邮箱" align="center" prop="email"/>
<el-table-column label="联系人" align="center" prop="contact"/> <el-table-column label="联系人" align="center" prop="contact"/>
<el-table-column label="是否开启" align="center" prop="enableFlag"/> <el-table-column label="是否启用" align="center" prop="enableFlag" >
<template slot-scope="scope">
<dict-tag :options="dict.type.sys_yes_no" :value="scope.row.enableFlag"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
...@@ -90,17 +93,21 @@ ...@@ -90,17 +93,21 @@
<!-- 添加或修改催货款通知邮箱对话框 --> <!-- 添加或修改催货款通知邮箱对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="客户id" prop="clientId">
<el-input v-model="form.clientId" placeholder="请输入客户id"/>
</el-form-item>
<el-form-item label="邮箱" prop="email"> <el-form-item label="邮箱" prop="email">
<el-input v-model="form.email" placeholder="请输入邮箱"/> <el-input v-model="form.email" placeholder="请输入邮箱"/>
</el-form-item> </el-form-item>
<el-form-item label="联系人" prop="contact"> <el-form-item label="联系人" prop="contact">
<el-input v-model="form.contact" placeholder="请输入联系人"/> <el-input v-model="form.contact" placeholder="请输入联系人"/>
</el-form-item> </el-form-item>
<el-form-item label="是否开启" prop="enableFlag"> <el-form-item label="是否启用" prop="enableFlag">
<el-input v-model="form.enableFlag" placeholder="请输入是否开启"/> <el-select v-model="form.enableFlag" placeholder="请选择是或否">
<el-option
v-for="dict in dict.type.sys_yes_no"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item> </el-form-item>
</el-form> </el-form>
<div slot="footer" class="dialog-footer"> <div slot="footer" class="dialog-footer">
...@@ -116,6 +123,10 @@ import { addEmail, delEmail, getEmail, listEmail, updateEmail } from '@/api/mes/ ...@@ -116,6 +123,10 @@ import { addEmail, delEmail, getEmail, listEmail, updateEmail } from '@/api/mes/
export default { export default {
name: 'Email', name: 'Email',
dicts:['sys_yes_no'],
props: {
clientId: { type: Number | undefined, default:undefined },
},
data() { data() {
return { return {
// 遮罩层 // 遮罩层
...@@ -140,18 +151,33 @@ export default { ...@@ -140,18 +151,33 @@ export default {
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
clientId: null, email: null, contact: null, enableFlag: null clientId: null,
email: null, contact: null, enableFlag: null
}, },
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
rules: {} rules: {
email: [
{ required: true, trigger: 'blur' }
],
contact: [
{ required: true, trigger: 'blur' }
],
contact: [
{ required: true, trigger: 'blur' }
],
enableFlag: [
{ required: true, trigger: 'blur' }
]
}
} }
}, },
methods: { methods: {
/** 查询催货款通知邮箱列表 */ /** 查询催货款通知邮箱列表 */
getList() { getList() {
this.loading = true this.loading = true
this.queryParams.clientId=this.clientId
listEmail(this.queryParams).then(response => { listEmail(this.queryParams).then(response => {
this.emailList = response.rows this.emailList = response.rows
this.total = response.total this.total = response.total
...@@ -167,7 +193,7 @@ export default { ...@@ -167,7 +193,7 @@ export default {
reset() { reset() {
this.form = { this.form = {
id: null, id: null,
clientId: null, clientId: this.clientId,
email: null, email: null,
contact: null, contact: null,
enableFlag: null, enableFlag: null,
...@@ -221,6 +247,7 @@ export default { ...@@ -221,6 +247,7 @@ export default {
this.getList() this.getList()
}) })
} else { } else {
this.form.clientId = this.clientId
addEmail(this.form).then(response => { addEmail(this.form).then(response => {
this.$modal.msgSuccess('新增成功') this.$modal.msgSuccess('新增成功')
this.open = false this.open = false
......
...@@ -243,13 +243,13 @@ ...@@ -243,13 +243,13 @@
<FinanceInfo ref="FinanceInfo" :form="form"/> <FinanceInfo ref="FinanceInfo" :form="form"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="客户联系人" name="ClientContact"> <el-tab-pane label="客户联系人" name="ClientContact">
<ClientContact ref="ClientContact"/> <ClientContact ref="ClientContact" :clientId="form.clientId"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="催货款通知邮箱" name="UrgeEmail"> <el-tab-pane label="催货款通知邮箱" name="UrgeEmail">
<UrgeEmail ref="UrgeEmail"/> <UrgeEmail ref="UrgeEmail" :clientId="form.clientId"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="客户付款信息" name="PaymentRelation"> <el-tab-pane label="客户付款信息" name="PaymentRelation">
<PaymentRelation ref="PaymentRelation"/> <PaymentRelation ref="PaymentRelation" :clientId="form.clientId"/>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="SAP特性" name="SapProperty"> <el-tab-pane label="SAP特性" name="SapProperty">
<SapPropertyData ref="SapProperty"/> <SapPropertyData ref="SapProperty"/>
......
<template> <template>
<div class="app-container"> <div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form
:model="queryParams"
<el-form-item label="产品特性名称" prop="spec" label-width="7em"> ref="queryForm"
<el-input size="small"
v-model="queryParams.spec" :inline="true"
placeholder="请输入产品特性名称" v-show="showSearch"
clearable label-width="68px"
>
@keyup.enter.native="handleQuery" <el-form-item label="产品特性名称" prop="spec" label-width="7em">
/> <el-input
</el-form-item> v-model="queryParams.spec"
<el-form-item> placeholder="请输入产品特性名称"
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> clearable
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> @keyup.enter.native="handleQuery"
</el-form-item> />
</el-form> </el-form-item>
<el-form-item>
<el-row :gutter="10" class="mb8"> <el-button
<el-col :span="1.5"> type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['md:spec:add']"
>新增</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['md:spec:edit']"
>修改</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['md:spec:remove']"
>删除</el-button
>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['md:spec:export']"
>导出</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="specList"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="产品特性名称" align="center" prop="spec" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<template slot-scope="scope">
<el-button <el-button
type="primary"
plain
icon="el-icon-plus"
size="mini" size="mini"
@click="handleAdd" type="text"
v-hasPermi="['md:spec:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit" icon="el-icon-edit"
size="mini" @click="handleUpdate(scope.row)"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['md:spec:edit']" v-hasPermi="['md:spec:edit']"
>修改</el-button> >修改</el-button
</el-col> >
<el-col :span="1.5">
<el-button <el-button
type="danger"
plain
icon="el-icon-delete"
size="mini" size="mini"
:disabled="multiple" type="text"
@click="handleDelete" icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['md:spec:remove']" v-hasPermi="['md:spec:remove']"
>删除</el-button> >删除</el-button
</el-col> >
<el-col :span="1.5"> </template>
<el-button </el-table-column>
type="warning" </el-table>
plain
icon="el-icon-download" <pagination
size="mini" v-show="total > 0"
@click="handleExport" :total="total"
v-hasPermi="['md:spec:export']" :page.sync="queryParams.pageNum"
>导出</el-button> :limit.sync="queryParams.pageSize"
</el-col> @pagination="getList"
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> />
</el-row>
<!-- 添加或修改产品特性名称对话框 -->
<el-table v-loading="loading" :data="specList" @selection-change="handleSelectionChange"> <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-table-column type="selection" width="55" align="center" /> <el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="产品特性名称" prop="spec" label-width="120px">
<el-input v-model="form.spec" placeholder="请输入产品特性名称" />
<el-table-column label="产品特性名称" align="center" prop="spec" /> </el-form-item>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> </el-form>
<template slot-scope="scope"> <div slot="footer" class="dialog-footer">
<el-button <el-button type="primary" @click="submitForm">确 定</el-button>
size="mini" <el-button @click="cancel">取 消</el-button>
type="text" </div>
icon="el-icon-edit" </el-dialog>
@click="handleUpdate(scope.row)" </div>
v-hasPermi="['md:spec:edit']" </template>
>修改</el-button>
<el-button <script>
size="mini" import {
type="text" listSpec,
icon="el-icon-delete" getSpec,
@click="handleDelete(scope.row)" delSpec,
v-hasPermi="['md:spec:remove']" addSpec,
>删除</el-button> updateSpec,
</template> } from "@/api/mes/md/spec";
</el-table-column>
</el-table> export default {
name: "Spec",
<pagination props: {
v-show="total>0" itemId: { type: Number, default: "" },
:total="total" },
:page.sync="queryParams.pageNum" data() {
:limit.sync="queryParams.pageSize" return {
@pagination="getList" // 遮罩层
/> loading: true,
// 选中数组
<!-- 添加或修改产品特性名称对话框 --> ids: [],
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body> // 非单个禁用
<el-form ref="form" :model="form" :rules="rules" label-width="80px"> single: true,
// 非多个禁用
<el-form-item label="产品特性名称" prop="spec" label-width="120px"> multiple: true,
<el-input v-model="form.spec" placeholder="请输入产品特性名称" /> // 显示搜索条件
</el-form-item> showSearch: true,
</el-form> // 总条数
<div slot="footer" class="dialog-footer"> total: 0,
<el-button type="primary" @click="submitForm">确 定</el-button> // 产品特性名称表格数据
<el-button @click="cancel">取 消</el-button> specList: [],
</div> // 弹出层标题
</el-dialog> title: "",
</div> // 是否显示弹出层
</template> open: false,
// 查询参数
<script> queryParams: {
import { listSpec, getSpec, delSpec, addSpec, updateSpec } from "@/api/mes/md/spec"; pageNum: 1,
pageSize: 10,
export default { itemId: "",
name: "Spec", spec: null,
props: { },
itemId:{type:Number, // 表单参数
default:''} form: {},
// 表单校验
rules: {
spec: [
{
required: true,
message: "产品特性名称不能为空!",
trigger: "blur",
},
],
},
};
},
created() {
this.getList();
},
methods: {
/** 查询产品特性名称列表 */
getList() {
this.loading = true;
this.queryParams.itemId = this.itemId;
listSpec(this.queryParams).then((response) => {
this.specList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false;
this.reset();
}, },
data() { // 表单重置
return { reset() {
// 遮罩层 this.form = {
loading: true, itemSpecId: null,
// 选中数组 itemId: this.itemId,
ids: [], spec: null,
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 产品特性名称表格数据
specList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
itemId: '',
spec: null },
// 表单参数
form: {},
// 表单校验
rules: {
spec: [
{ required: true, message: "产品特性名称不能为空!", trigger: "blur" }
], }
}; };
this.resetForm("form");
}, },
created() { /** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList(); this.getList();
}, },
methods: { /** 重置按钮操作 */
/** 查询产品特性名称列表 */ resetQuery() {
getList() { this.resetForm("queryForm");
this.loading = true; this.handleQuery();
this.queryParams.itemId = this.itemId; },
listSpec(this.queryParams).then(response => { // 多选框选中数据
this.specList = response.rows; handleSelectionChange(selection) {
this.total = response.total; this.ids = selection.map((item) => item.itemSpecId);
this.loading = false; this.single = selection.length !== 1;
}); this.multiple = !selection.length;
}, },
// 取消按钮 /** 新增按钮操作 */
cancel() { handleAdd() {
this.open = false; this.reset();
this.reset(); this.open = true;
}, this.title = "添加产品特性名称";
// 表单重置 },
reset() { /** 修改按钮操作 */
this.form = { handleUpdate(row) {
itemSpecId: null, itemId: this.itemId, spec: null }; this.reset();
this.resetForm("form"); const itemSpecId = row.itemSpecId || this.ids;
}, getSpec(itemSpecId).then((response) => {
/** 搜索按钮操作 */ this.form = response.data;
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.itemSpecId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true; this.open = true;
this.title = "添加产品特性名称"; this.title = "修改产品特性名称";
}, });
/** 修改按钮操作 */ },
handleUpdate(row) { /** 提交按钮 */
this.reset(); submitForm() {
const itemSpecId = row.itemSpecId || this.ids this.$refs["form"].validate((valid) => {
getSpec(itemSpecId).then(response => { if (valid) {
this.form = response.data; if (this.form.itemSpecId != null) {
this.open = true; updateSpec(this.form).then((response) => {
this.title = "修改产品特性名称"; this.$modal.msgSuccess("修改成功");
}); this.open = false;
}, this.getList();
/** 提交按钮 */ });
submitForm() { } else {
this.$refs["form"].validate(valid => { this.form.itemId = this.itemId;
if (valid) { addSpec(this.form).then((response) => {
if (this.form.itemSpecId != null) { this.$modal.msgSuccess("新增成功");
updateSpec(this.form).then(response => { this.open = false;
this.$modal.msgSuccess("修改成功"); this.getList();
this.open = false; });
this.getList();
});
} else {
this.form.itemId = this.itemId;
addSpec(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
} }
}); }
}, });
/** 删除按钮操作 */ },
handleDelete(row) { /** 删除按钮操作 */
const itemSpecIds = row.itemSpecId || this.ids; handleDelete(row) {
const itemSpecIds = row.itemSpecId || this.ids;
this.$modal.confirm('是否确认删除?').then(function() {
this.$modal
.confirm("是否确认删除?")
.then(function () {
return delSpec(itemSpecIds); return delSpec(itemSpecIds);
}).then(() => { })
.then(() => {
this.getList(); this.getList();
this.$modal.msgSuccess("删除成功"); this.$modal.msgSuccess("删除成功");
}).catch(() => {}); })
}, .catch(() => {});
/** 导出按钮操作 */ },
handleExport() { /** 导出按钮操作 */
this.download('md/spec/export', { handleExport() {
...this.queryParams this.download(
}, `spec_${new Date().getTime()}.xlsx`) "md/spec/export",
} {
} ...this.queryParams,
}; },
</script> `spec_${new Date().getTime()}.xlsx`
);
\ No newline at end of file },
},
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment