|
@@ -2,7 +2,6 @@
|
|
|
<div class="borderless">
|
|
|
<div class="customer-head">
|
|
|
<div class="customer-back">
|
|
|
- <!-- <i class="back-icon el-icon-arrow-left"></i><i style="font-style:normal">返回管理列表</i>-->
|
|
|
<el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
|
|
|
@click="backToList">返回列表
|
|
|
</el-button>
|
|
@@ -63,7 +62,7 @@
|
|
|
:data="contactsData"
|
|
|
ref="crudContact"
|
|
|
@row-save="rowContactSave"
|
|
|
- @row-del="rowDel">
|
|
|
+ @row-del="rowContactsDel">
|
|
|
<template slot-scope="{row,index}" slot="menu">
|
|
|
<el-button
|
|
|
type="text"
|
|
@@ -82,7 +81,12 @@
|
|
|
:data="purchaseData"
|
|
|
ref="crudPurchase"
|
|
|
@row-save="rowPurchaseSave"
|
|
|
- @row-del="rowDel">
|
|
|
+ @row-del="rowPurchaseDel">
|
|
|
+ <template slot="corpId" slot-scope="{row,index}">
|
|
|
+ <span v-if="row.$cellEdit" style="float: left;color: #F56C6C;">*</span>
|
|
|
+ <span style="margin-left: 12px;padding-top: 2px">{{ row.corpName }}</span>
|
|
|
+ <el-button v-if="row.$cellEdit" type="text" size="mini" style="float: right" @click="selectUser(row)">选择</el-button>
|
|
|
+ </template>
|
|
|
<template slot-scope="{row,index}" slot="menu">
|
|
|
<el-button
|
|
|
type="text"
|
|
@@ -109,6 +113,45 @@
|
|
|
<avue-ueditor v-model="text" :options="options"></avue-ueditor>
|
|
|
</basic-container>
|
|
|
</el-form>
|
|
|
+ <el-dialog
|
|
|
+ title="导入供应商"
|
|
|
+ :visible.sync="userDialog"
|
|
|
+ class="el-dialogDeep"
|
|
|
+ append-to-body
|
|
|
+ width="80%">
|
|
|
+ <el-row style="margin-top: -5px;height: 0">
|
|
|
+ <el-col :span="5">
|
|
|
+ <div class="box">
|
|
|
+ <el-scrollbar>
|
|
|
+ <basic-container>
|
|
|
+ <avue-tree :option="userTreeOption" :data="userTreeData" @node-click="userNodeClick"/>
|
|
|
+ </basic-container>
|
|
|
+ </el-scrollbar>
|
|
|
+ </div>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="19">
|
|
|
+ <basic-container>
|
|
|
+ <avue-crud ref="userCrud"
|
|
|
+ :option="userOption"
|
|
|
+ :data="userDataList"
|
|
|
+ :table-loading="userLoading"
|
|
|
+ :page.sync="userPage"
|
|
|
+ v-model="userForm"
|
|
|
+ @search-change="userSearchChange"
|
|
|
+ @search-reset="userSearchReset"
|
|
|
+ @refresh-change="userRefreshChange"
|
|
|
+ @selection-change="userSelectionChange"
|
|
|
+ @on-load="userOnLoad"
|
|
|
+ >
|
|
|
+ </avue-crud>
|
|
|
+ </basic-container>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <span slot="footer" class="dialog-footer">
|
|
|
+ <el-button @click="userDialog = false">取 消</el-button>
|
|
|
+ <el-button type="primary" :disabled="this.userSelection.length == 1 ? false:true" @click="userConfirm" >确 定</el-button>
|
|
|
+ </span>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -117,7 +160,9 @@ import customerContact from "./configuration/customerContact.json"
|
|
|
import customerPurchase from "./configuration/customerPurchase.json"
|
|
|
import {detail, corpsattn, typeSave} from "@/api/maintenance/priceManagement"
|
|
|
import imgUploadList from "./configuration/imgUploadList.json"
|
|
|
-import { getDetail, updateDetail } from "@/api/basicData/commodityType";
|
|
|
+import { getDetail, updateDetail,getDeptTree ,priceDelete} from "@/api/basicData/commodityType";
|
|
|
+import {customerList, getDeptLazyTree} from "@/api/basicData/customerInformation"
|
|
|
+import userOption from "../customerInformation/configuration/mainList.json";
|
|
|
|
|
|
export default {
|
|
|
name: "detailsPage",
|
|
@@ -135,6 +180,7 @@ export default {
|
|
|
},
|
|
|
form: {},
|
|
|
disabled: false,
|
|
|
+ userDialog:false,//供应商导入窗口
|
|
|
customerContact: customerContact,
|
|
|
customerPurchase: customerPurchase,
|
|
|
imgUploadList: imgUploadList,
|
|
@@ -181,7 +227,7 @@ export default {
|
|
|
prop: 'goodsTypeId',
|
|
|
rules: [
|
|
|
{
|
|
|
- required: false,
|
|
|
+ required: true,
|
|
|
message: ' ',
|
|
|
trigger: 'blur'
|
|
|
}
|
|
@@ -392,32 +438,63 @@ export default {
|
|
|
]
|
|
|
}
|
|
|
]
|
|
|
- }
|
|
|
+ },
|
|
|
+ detailsSelect:{},
|
|
|
+ //用户窗口定义
|
|
|
+ userTreeOption: {
|
|
|
+ nodeKey: 'id',
|
|
|
+ lazy: true,
|
|
|
+ treeLoad: function (node, resolve) {
|
|
|
+ const parentId = (node.level === 0) ? 0 : node.data.id;
|
|
|
+ getDeptLazyTree(parentId).then(res => {
|
|
|
+ resolve(res.data.data.map(item => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ leaf: !item.hasChildren
|
|
|
+ }
|
|
|
+ }))
|
|
|
+ });
|
|
|
+ },
|
|
|
+ addBtn: false,
|
|
|
+ menu: false,
|
|
|
+ size: 'small',
|
|
|
+ props: {
|
|
|
+ labelText: '标题',
|
|
|
+ label: 'title',
|
|
|
+ value: 'value',
|
|
|
+ children: 'children'
|
|
|
+ }
|
|
|
+ },
|
|
|
+ userTreeData:[],
|
|
|
+ userOption:userOption,
|
|
|
+ userLoading:false,
|
|
|
+ userDataList:[],
|
|
|
+ userSelection:"",
|
|
|
+ userTreeDeptId:"",
|
|
|
+ userForm:{},
|
|
|
+ userPage:{
|
|
|
+ currentPage: 1,
|
|
|
+ total: 0,
|
|
|
+ pageSize: 10
|
|
|
+ },
|
|
|
}
|
|
|
},
|
|
|
//初始化查询
|
|
|
created() {
|
|
|
+ getDeptTree().then(res => {
|
|
|
+ this.dicData = res.data.data;
|
|
|
+ });
|
|
|
if (this.$route.query.id) {
|
|
|
getDetail(JSON.parse(this.$route.query.id)).then(res => {
|
|
|
this.form = res.data.data
|
|
|
- // this.contactsData = res.data.data.saleGoodsPrice
|
|
|
- // this.purchaseData = res.data.data.bugGoodsPrice
|
|
|
+ this.contactsData = res.data.data.saleGoodsPrice
|
|
|
+ this.purchaseData = res.data.data.buyGoodsPrice
|
|
|
})
|
|
|
- } else {
|
|
|
- this.form = {}
|
|
|
- this.contactsData = []
|
|
|
+ }else{
|
|
|
+ //新增时根据左侧选中树结构给客户类别赋值
|
|
|
+ this.$set(this.form,"goodsTypeId", this.$route.query.treeDeptId)
|
|
|
}
|
|
|
},
|
|
|
- watch: {
|
|
|
- // '$route'(to, from) {
|
|
|
- // console.log(to, from);
|
|
|
- // if (this.$route.query.id) {
|
|
|
- //
|
|
|
- // } else {
|
|
|
- // this.form = {}
|
|
|
- // }
|
|
|
- // }
|
|
|
- },
|
|
|
methods: {
|
|
|
rowContactSave(row, done, loading) {
|
|
|
done()
|
|
@@ -432,15 +509,14 @@ export default {
|
|
|
this.$refs.crudPurchase.rowCell(row, index)
|
|
|
},
|
|
|
//删除商品信息触发
|
|
|
- rowDel(row, index, donerowDel) {
|
|
|
+ rowContactsDel(row, index) {
|
|
|
this.$confirm("确定将选择数据删除?", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
|
}).then(() => {
|
|
|
- //商品判断是否需要调用删除接口
|
|
|
if (row.id) {
|
|
|
- corpsattn(row.id).then(res => {
|
|
|
+ priceDelete(row.id).then(res => {
|
|
|
this.$message({
|
|
|
type: "success",
|
|
|
message: "操作成功!"
|
|
@@ -456,16 +532,62 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ rowPurchaseDel(row, index) {
|
|
|
+ this.$confirm("确定将选择数据删除?", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning"
|
|
|
+ }).then(() => {
|
|
|
+ if (row.id) {
|
|
|
+ priceDelete(row.id).then(res => {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ this.purchaseData.splice(index, 1);
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ this.$message({
|
|
|
+ type: "success",
|
|
|
+ message: "操作成功!"
|
|
|
+ });
|
|
|
+ this.purchaseData.splice(index, 1);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
//修改提交触发
|
|
|
editCustomer() {
|
|
|
this.$refs["form"].validate((valid) => {
|
|
|
- if (valid) {
|
|
|
+ //校验明细列表
|
|
|
+ let valids = true;
|
|
|
+ if(this.contactsData.length !=0){
|
|
|
+ this.contactsData.forEach((item) =>{
|
|
|
+ if((!item.code ||!item.bigCharacter ||!item.brand ||!item.brandItem ) && valids){
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "请检查销售价格第 "+(item.$index +1 )+" 行必填项"
|
|
|
+ });
|
|
|
+ valids = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if(this.purchaseData.length !=0){
|
|
|
+ this.purchaseData.forEach((item) =>{
|
|
|
+ if((item.corpId =="") && valids){
|
|
|
+ this.$message({
|
|
|
+ type: "warning",
|
|
|
+ message: "请检查采购价格第 "+(item.$index +1 )+" 行必填项"
|
|
|
+ });
|
|
|
+ valids = false;
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if (valid && valids) {
|
|
|
const params = {
|
|
|
...this.form,
|
|
|
type:0,
|
|
|
- goodsTypeId:"0",
|
|
|
saleGoodsPrice : this.contactsData,
|
|
|
- bugGoodsPrice : this.purchaseData
|
|
|
+ buyGoodsPrice : this.purchaseData
|
|
|
}
|
|
|
updateDetail(params).then(res => {
|
|
|
this.$message({
|
|
@@ -478,6 +600,49 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ //供应商窗口事件
|
|
|
+ selectUser(row){
|
|
|
+ this.userDialog = true
|
|
|
+ this.detailsSelect = row.$index;
|
|
|
+ },
|
|
|
+ userSearchChange(params, done){
|
|
|
+ this.userOnLoad(this.userPage, params);
|
|
|
+ done()
|
|
|
+ },
|
|
|
+ userSearchReset(){
|
|
|
+
|
|
|
+ },
|
|
|
+ userRefreshChange(){
|
|
|
+ this.userOnLoad(this.userPage)
|
|
|
+ },
|
|
|
+ userSelectionChange(row){
|
|
|
+ this.userSelection = row;
|
|
|
+ },
|
|
|
+ userOnLoad(page,params={ parentId: 0 }){
|
|
|
+ this.userLoading = true;
|
|
|
+ let queryParams = Object.assign({}, params, {
|
|
|
+ size: page.pageSize,
|
|
|
+ current: page.currentPage,
|
|
|
+ corpsTypeId: this.userTreeDeptId
|
|
|
+ });
|
|
|
+ customerList(queryParams).then(res => {
|
|
|
+ this.userDataList = res.data.data.records
|
|
|
+ this.userPage.total = res.data.data.total
|
|
|
+ this.userLoading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ userNodeClick(data){
|
|
|
+ this.userTreeDeptId = data.id;
|
|
|
+ this.userOnLoad(this.userPage);
|
|
|
+ },
|
|
|
+ //确定
|
|
|
+ userConfirm(){
|
|
|
+ if(this.userSelection){
|
|
|
+ this.purchaseData[this.detailsSelect].corpId = this.userSelection[0].id;
|
|
|
+ this.$set(this.purchaseData[this.detailsSelect],'corpName',this.userSelection[0].cname)
|
|
|
+ this.userDialog = !this.userDialog
|
|
|
+ }
|
|
|
+ },
|
|
|
// 商品图片上传保存
|
|
|
imgUploadSave(row, done, loading) {
|
|
|
console.log(row)
|
|
@@ -513,10 +678,8 @@ export default {
|
|
|
},
|
|
|
// 上传前
|
|
|
uploadBefore(file, done, loading,column) {
|
|
|
- console.log(file.type)
|
|
|
const is2M = file.size / 1024 / 1024 < 2
|
|
|
const isType = file.type === "image/jpeg" || file.type === "image/png" || file.type === "image/jpg"
|
|
|
- console.log(isType)
|
|
|
if (!isType) {
|
|
|
this.$message.error('图片只能是JPG、JPEG、PNG格式')
|
|
|
loading()
|