|
|
@ -17,13 +17,13 @@ |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item prop="brandCode"> |
|
|
|
<span slot="label">品牌编码:</span> |
|
|
|
<el-input v-model="temp.brandCode" maxlength="125" placeholder="" class="addinputw" clearable /> |
|
|
|
<el-input v-model="temp.brandCode" maxlength="125" placeholder="" class="addinputw" clearable/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item prop="brandName"> |
|
|
|
<span slot="label">品牌名称:</span> |
|
|
|
<el-input v-model="temp.brandName" maxlength="125" placeholder="" class="addinputw" clearable /> |
|
|
|
<el-input v-model="temp.brandName" maxlength="125" placeholder="" class="addinputw" clearable/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
@ -31,14 +31,14 @@ |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item prop="brandShortName"> |
|
|
|
<span slot="label">品牌简称:</span> |
|
|
|
<el-input v-model="temp.brandShortName" maxlength="125" placeholder="" class="addinputw" clearable /> |
|
|
|
<el-input v-model="temp.brandShortName" maxlength="125" placeholder="" class="addinputw" clearable/> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
<el-col :span="12"> |
|
|
|
<el-form-item prop="brandType"> |
|
|
|
<span slot="label">品牌类型:</span> |
|
|
|
<el-select v-model="temp.brandType" class="addinputw" placeholder="请选择品牌类型" @change="getleixing"> |
|
|
|
<el-option v-for="(item,index) in brand" :key="index" :label="item.dictValue" :value="item.dictKey" /> |
|
|
|
<el-option v-for="(item,index) in brand" :key="index" :label="item.dictValue" :value="item.dictKey"/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
@ -48,7 +48,7 @@ |
|
|
|
<el-form-item prop="manufacturerSid"> |
|
|
|
<span slot="label">厂商名称:</span> |
|
|
|
<el-select v-model="temp.manufacturerSid" class="addinputw" filterable placeholder="请选择厂商名称"> |
|
|
|
<el-option v-for="item in supplierType" :key="item.sid" :label="item.manufacturerName" :value="item.sid" /> |
|
|
|
<el-option v-for="item in supplierType" :key="item.sid" :label="item.manufacturerName" :value="item.sid"/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
@ -56,7 +56,7 @@ |
|
|
|
<el-form-item prop="isValidity"> |
|
|
|
<span slot="label">是否有效:</span> |
|
|
|
<el-select v-model="temp.isValidity" class="addinputw" placeholder="请选择是否有效"> |
|
|
|
<el-option v-for="(item,index) in isValiditys" :key="index" :label="item.dictValue" :value="item.sid" /> |
|
|
|
<el-option v-for="(item,index) in isValiditys" :key="index" :label="item.dictValue" :value="item.sid"/> |
|
|
|
</el-select> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
@ -68,8 +68,6 @@ |
|
|
|
<el-select v-model="useOrgValue" multiple placeholder="请选择" filterable clearable class="addinputw" @change="getuseOrg"> |
|
|
|
<el-option v-for="item in useOrg_list" :key="item.sid" :label="item.name" :value="item.sid"/> |
|
|
|
</el-select> |
|
|
|
<!-- <el-cascader v-model="useOrgArry" class="addinputw" @change="usrOrgArryChange" :options="options"--> |
|
|
|
<!-- :props="props" />--> |
|
|
|
</el-form-item> |
|
|
|
</el-col> |
|
|
|
</el-row> |
|
|
@ -79,51 +77,19 @@ |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
import { |
|
|
|
details, |
|
|
|
dictType, |
|
|
|
getListOrg, |
|
|
|
namesDown, |
|
|
|
SaveList, |
|
|
|
selectListOrg, |
|
|
|
Update |
|
|
|
} from '@/api/jichuxinxi/brandManagement' |
|
|
|
import { details, dictType, getListOrg, SaveList, Update } from '@/api/jichuxinxi/brandManagement' |
|
|
|
import { selectByZjcAndUseOrgIsNull } from '@/api/jichuxinxi/dictcommons' |
|
|
|
|
|
|
|
export default { |
|
|
|
name: 'PinpaiAdd', |
|
|
|
data() { |
|
|
|
var validCascader = (rule, value, callback) => { |
|
|
|
if (this.useOrgArry.length == 0) { |
|
|
|
callback(new Error('请填写使用组织')) |
|
|
|
} else { |
|
|
|
callback() |
|
|
|
} |
|
|
|
} |
|
|
|
return { |
|
|
|
// --按钮菜单------- |
|
|
|
menuState: { |
|
|
|
add: false, // 添加 |
|
|
|
edit: false, // 编辑 |
|
|
|
delete: false, // 删除 |
|
|
|
view: false, // 查看 |
|
|
|
audit: false, // 审核 |
|
|
|
input: false, // 导入 |
|
|
|
output: false, // 导出 |
|
|
|
upload: false, // 同步 |
|
|
|
release: false // 下发 |
|
|
|
}, |
|
|
|
viewTitle: '', |
|
|
|
dataArr: [], |
|
|
|
FormLoading: false, |
|
|
|
listLoading: false, |
|
|
|
temp: {}, // 添加和修改 |
|
|
|
useOrgArry: [], |
|
|
|
useOrg_list: [], // 分公司 |
|
|
|
stateId: 0, |
|
|
|
dialogFormVisible: false, // 添加修改对话框状态 |
|
|
|
dialogFormShowVisible: false, // 查看对话框默认关闭状态 |
|
|
|
dialogStatus: '', // 对话框状态 |
|
|
|
fenzuOptions: [], |
|
|
|
rules: { |
|
|
|
brandCode: [{ |
|
|
|
required: true, |
|
|
@ -149,18 +115,10 @@ export default { |
|
|
|
required: true, |
|
|
|
message: '请选择厂商名称', |
|
|
|
trigger: 'blur' |
|
|
|
}], |
|
|
|
useOrgArry: [{ |
|
|
|
required: true, |
|
|
|
validator: validCascader, |
|
|
|
trigger: 'change' |
|
|
|
}] |
|
|
|
}, |
|
|
|
// brandType: null, |
|
|
|
brandType: 'brandType', |
|
|
|
brand: [], |
|
|
|
modelValue: [], |
|
|
|
modelValue2: [], |
|
|
|
useOrgValue: [], |
|
|
|
isValiditys: [{ |
|
|
|
dictValue: '是', |
|
|
@ -171,43 +129,16 @@ export default { |
|
|
|
sid: '2' |
|
|
|
} |
|
|
|
], |
|
|
|
options: [], |
|
|
|
useOrg: [], |
|
|
|
props: { |
|
|
|
value: 'sid', |
|
|
|
label: 'name', |
|
|
|
children: 'children', |
|
|
|
// checkStrictly: true, |
|
|
|
multiple: true |
|
|
|
}, |
|
|
|
supplierType: [] |
|
|
|
// ------------------------------------ |
|
|
|
} |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
init() { |
|
|
|
this.stateId = this.$route.params.id |
|
|
|
if (this.stateId !== '0') { |
|
|
|
details(this.stateId).then((response) => { |
|
|
|
if (response.code === '200') { |
|
|
|
this.temp = response.data |
|
|
|
// this.useOrgArry = response.data.useOrg |
|
|
|
if (this.temp.useOrg.search(',') == '-1') { |
|
|
|
this.useOrgValue = this.temp.useOrg.split(' ') |
|
|
|
} else { |
|
|
|
this.useOrgValue = this.temp.useOrg.split(',') |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
this.selectDict() |
|
|
|
}, |
|
|
|
showAdd() { |
|
|
|
this.dialogStatus = 'add' |
|
|
|
this.viewTitle = '【新增】品牌管理信息' |
|
|
|
this.stateId = 0 |
|
|
|
this.geTName() |
|
|
|
this.getZuZhi() |
|
|
|
this.getListOrgAll() |
|
|
|
this.selectDict() |
|
|
|
}, |
|
|
@ -220,7 +151,6 @@ export default { |
|
|
|
if (response.code === '200') { |
|
|
|
this.temp = response.data |
|
|
|
this.temp.sid = sid |
|
|
|
// this.useOrgArry = response.data.useOrg |
|
|
|
if (this.temp.useOrg.search(',') == '-1') { |
|
|
|
this.useOrgValue = this.temp.useOrg.split(' ') |
|
|
|
} else { |
|
|
@ -229,7 +159,6 @@ export default { |
|
|
|
} |
|
|
|
}) |
|
|
|
this.geTName() |
|
|
|
this.getZuZhi() |
|
|
|
this.getListOrgAll() |
|
|
|
this.selectDict() |
|
|
|
}, |
|
|
@ -239,13 +168,8 @@ export default { |
|
|
|
if (isreload === 'true') this.$emit('reloadlist') |
|
|
|
this.temp = {} |
|
|
|
this.useOrgValue = '' |
|
|
|
this.useOrgArry = [] |
|
|
|
// this.$router.go(-1) |
|
|
|
this.$emit('doback') |
|
|
|
}, |
|
|
|
// handleReturn() { |
|
|
|
// this.$router.go(-1) |
|
|
|
// }, |
|
|
|
// 查询所有分公司 |
|
|
|
getListOrgAll() { |
|
|
|
getListOrg().then((res) => { |
|
|
@ -254,22 +178,6 @@ export default { |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// // 所有分公司 (旧的方法,来回更改过N次,暂时做保留) |
|
|
|
// getListOrgAll() { |
|
|
|
// const userSid = window.sessionStorage.getItem('userSid') |
|
|
|
// getUseOrgByUserSid({userSid: userSid}).then((res) => { |
|
|
|
// if (res.success) { |
|
|
|
// this.getListOrgAll0(res.data.sid) |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// }, |
|
|
|
// getListOrgAll0(useOrgSid) { |
|
|
|
// getListOrg({sid: useOrgSid}).then((res) => { |
|
|
|
// if (res.success) { |
|
|
|
// this.useOrg_list = res.data |
|
|
|
// } |
|
|
|
// }) |
|
|
|
// }, |
|
|
|
getuseOrg(val) { |
|
|
|
var choosetItem = [] |
|
|
|
val.forEach((ele) => { |
|
|
@ -285,98 +193,20 @@ export default { |
|
|
|
}, |
|
|
|
|
|
|
|
selectDict() { |
|
|
|
dictType({ |
|
|
|
psid: 0, |
|
|
|
type: 'brandType' |
|
|
|
}).then((response) => { |
|
|
|
if (response.code === '200') { |
|
|
|
dictType({ psid: 0, type: 'brandType' }).then((response) => { |
|
|
|
if (response.success) { |
|
|
|
this.brand = response.data |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
usrOrgArryChange(e) { |
|
|
|
console.log('选中结果:' + JSON.stringify(e)) |
|
|
|
var result = '' |
|
|
|
if (e.length > 0) { |
|
|
|
// 循环多选项 |
|
|
|
e.forEach((item) => { |
|
|
|
var last_id = item[item.length - 1] |
|
|
|
// console.log('options:'+JSON.stringify(this.options)) |
|
|
|
// 循环查找名字 |
|
|
|
this.select_temp = '' // 临时遍历,用来保存选中结果 |
|
|
|
this.findOrgId(last_id, this.options) |
|
|
|
result = result + this.select_temp + ',' |
|
|
|
}) |
|
|
|
} |
|
|
|
if (result !== '') { |
|
|
|
result = result.substring(0, result.length - 1) |
|
|
|
} |
|
|
|
this.temp.useOrgName = result |
|
|
|
console.log('选中名称:' + this.temp.useOrgName) |
|
|
|
}, |
|
|
|
// --- 循环查询 |
|
|
|
findOrgId(id, options) { |
|
|
|
for (var i = 0; i < options.length; i++) { |
|
|
|
if (id == options[i].sid) { |
|
|
|
this.select_temp = options[i].name // 保存找到的内容 |
|
|
|
return true |
|
|
|
} else { |
|
|
|
// 判断是否最后一级 |
|
|
|
if (options[i].children !== undefined) { |
|
|
|
// 不是的话查询下一级 |
|
|
|
if (this.findOrgId(id, options[i].children)) { |
|
|
|
return true |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
// 组织 |
|
|
|
getZuZhi() { |
|
|
|
selectListOrg().then((res) => { |
|
|
|
// console.log('res++++', res) |
|
|
|
if (res.code === '200') { |
|
|
|
this.options = res.data |
|
|
|
this.zuzhi0(this.options) |
|
|
|
console.log(this.options, 8888888) |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
zuzhi0(data) { |
|
|
|
data.forEach((e) => { |
|
|
|
if (e.children) { |
|
|
|
if (e.children.length != 0) { |
|
|
|
this.zuzhi0(e.children) |
|
|
|
} else { |
|
|
|
delete e.children |
|
|
|
this.dataArr.push(e) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 厂商 |
|
|
|
geTName() { |
|
|
|
namesDown({ |
|
|
|
name: '' |
|
|
|
}).then((res) => { |
|
|
|
if (res.code === '200') { |
|
|
|
selectByZjcAndUseOrgIsNull().then((res) => { |
|
|
|
if (res.success) { |
|
|
|
this.supplierType = res.data |
|
|
|
} |
|
|
|
}) |
|
|
|
}, |
|
|
|
// 添加前数据初始化 |
|
|
|
resetTemp() { |
|
|
|
this.useOrg = [] |
|
|
|
this.temp = { |
|
|
|
useOrg: '', |
|
|
|
brandCode: '', |
|
|
|
brandName: '', |
|
|
|
brandType: '', |
|
|
|
isValidity: '', |
|
|
|
manufacturerSid: '' |
|
|
|
} |
|
|
|
}, |
|
|
|
// 提交添加数据 |
|
|
|
handleCreate() { |
|
|
|
console.log('已选择的组织', this.useOrgValue) |
|
|
@ -385,41 +215,6 @@ export default { |
|
|
|
this.FormLoading = true |
|
|
|
this.dialogStatus = 'create' |
|
|
|
if (this.stateId === 0) { |
|
|
|
// if (this.temp.useOrg instanceof Array) { |
|
|
|
// let useOrg2 = '' |
|
|
|
// if (this.temp.useOrg.length === 1) { |
|
|
|
// console.log(this.temp.useOrg[0].toString(), 111111) |
|
|
|
// useOrg2 = this.temp.useOrg[0].toString() |
|
|
|
// } else { |
|
|
|
// const abc = [] |
|
|
|
// this.temp.useOrg.forEach((e) => { |
|
|
|
// abc.push(e[e.length - 1]) |
|
|
|
// }) |
|
|
|
// useOrg2 = abc.toString() |
|
|
|
// console.log(abc.toString(), 222222222) |
|
|
|
// } |
|
|
|
|
|
|
|
// this.temp.useOrg = useOrg2 |
|
|
|
// } |
|
|
|
// if (this.temp.useOrg instanceof Array) { |
|
|
|
// let useOrg2 = '' |
|
|
|
// const abc = [] |
|
|
|
// this.temp.useOrg.forEach((e) => { |
|
|
|
// abc.push(e[e.length - 1]) |
|
|
|
// }) |
|
|
|
// console.log(abc, 222222222) |
|
|
|
// useOrg2 = abc.toString() |
|
|
|
// this.useOrgArry = useOrg2 |
|
|
|
// } |
|
|
|
// if (this.useOrgArry) { |
|
|
|
// var abc = [] |
|
|
|
// this.useOrgArry.forEach((e) => { |
|
|
|
// console.log('77777777', e) |
|
|
|
// abc.push(e[e.length - 1]) |
|
|
|
// }) |
|
|
|
// this.temp.useOrg = abc.toString() |
|
|
|
// console.log('abcabc', this.temp.useOrg) |
|
|
|
// } |
|
|
|
console.log(123456789, this.temp) |
|
|
|
SaveList(this.temp).then((response) => { |
|
|
|
console.log(123) |
|
|
@ -437,15 +232,6 @@ export default { |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
// if (this.useOrgArry) { |
|
|
|
// var abc = [] |
|
|
|
// this.useOrgArry.forEach((e) => { |
|
|
|
// console.log('77777777', e) |
|
|
|
// abc.push(e[e.length - 1]) |
|
|
|
// }) |
|
|
|
// this.temp.useOrg = abc.toString() |
|
|
|
// console.log('abcabc', this.temp.useOrg) |
|
|
|
// } |
|
|
|
Update(this.temp).then((response) => { |
|
|
|
console.log('返回值:', response) |
|
|
|
this.FormLoading = false |
|
|
@ -480,10 +266,10 @@ export default { |
|
|
|
console.log(this.temp.brandTypeValue, '结算币种value') |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
<style scoped> |
|
|
|
.addinputw { |
|
|
|
.addinputw { |
|
|
|
width: 80% !important; |
|
|
|
} |
|
|
|
} |
|
|
|
</style> |
|
|
|