|
@@ -31,8 +31,8 @@
|
|
|
</section>
|
|
|
<section class="d_jump">
|
|
|
<p class="title"><i class="iconfont iconjuxing" style="color:#3A8DDE;"></i>技术参数</p>
|
|
|
- <template v-for="(item,index) in TechnicalData">
|
|
|
- <el-form-item :label="item.Name">
|
|
|
+ <template v-for="item in TechnicalData">
|
|
|
+ <el-form-item :label="item.Name" :key="item.Code">
|
|
|
<el-input
|
|
|
v-if="item.InputMode == 'B1' || item.InputMode == 'B2'"
|
|
|
v-model="ruleForm.ProdParam[item.Code]"/>
|
|
@@ -45,20 +45,32 @@
|
|
|
</el-input>
|
|
|
|
|
|
<el-select
|
|
|
- v-else-if="item.InputMode == 'D1' || item.InputMode == 'E2'"
|
|
|
+ v-else-if="item.InputMode == 'D1' || item.InputMode == 'E2' || item.InputMode == 'D1L'"
|
|
|
placeholder="请选择"
|
|
|
- v-model="ruleForm.ProdParam[item.Code]">
|
|
|
- <el-option :key="op.Name" :label="op.Name" :value="op.Code" v-for="op in item.options"></el-option>
|
|
|
+ v-model="ruleForm.ProdParam[item.Code]"
|
|
|
+ clearable>
|
|
|
+ <el-option :key="`${item.Code}-${op.code}`" :label="op.name" :value="op.code" v-for="op in item.DataSource"></el-option>
|
|
|
</el-select>
|
|
|
|
|
|
- <!-- <el-select-->
|
|
|
- <!-- v-else-if="item.InputMode == 'D2'"-->
|
|
|
- <!-- placeholder="请选择"-->
|
|
|
- <!-- v-model="ruleForm.ProdParam[item.Code]"-->
|
|
|
- <!-- multiple-->
|
|
|
- <!-- collapse-tags>-->
|
|
|
- <!-- <el-option :key="op.Name" :label="op.Name" :value="op.Code" v-for="op in item.options"></el-option>-->
|
|
|
- <!-- </el-select>-->
|
|
|
+ <el-select
|
|
|
+ v-else-if="item.InputMode == 'D2'"
|
|
|
+ placeholder="请选择"
|
|
|
+ v-model="ruleForm.ProdParam[item.Code]"
|
|
|
+ clearable
|
|
|
+ multiple
|
|
|
+ collapse-tags>
|
|
|
+ <el-option :key="`${item.Code}-${op.code}`" :label="op.name" :value="op.code" v-for="op in item.DataSource"></el-option>
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ <el-select
|
|
|
+ v-else-if="item.InputMode == 'D3'"
|
|
|
+ placeholder="请选择"
|
|
|
+ v-model="ruleForm.ProdParam[item.Code]"
|
|
|
+ clearable
|
|
|
+ multiple
|
|
|
+ collapse-tags>
|
|
|
+ <el-option :key="`${item.Code}-${op.code}`" :label="op.name" :value="op.code" v-for="op in item.DataSource"></el-option>
|
|
|
+ </el-select>
|
|
|
|
|
|
<el-date-picker
|
|
|
v-else-if="item.InputMode == 'C6'"
|
|
@@ -69,7 +81,7 @@
|
|
|
start-placeholder="开始日期"
|
|
|
end-placeholder="结束日期"/>
|
|
|
|
|
|
- <el-cascader
|
|
|
+ <!-- <el-cascader
|
|
|
v-else-if="item.InputMode == 'D1L'"
|
|
|
placeholder="请选择"
|
|
|
:options="item.options"
|
|
@@ -78,7 +90,7 @@
|
|
|
filterable
|
|
|
:show-all-levels="false"
|
|
|
clearable
|
|
|
- style="width: 200px"/>
|
|
|
+ style="width: 200px"/> -->
|
|
|
|
|
|
<el-input
|
|
|
v-else-if="item.InputMode == 'L'||item.InputMode == 'L1'||item.InputMode == 'L2'||item.InputMode == 'M'"
|
|
@@ -97,17 +109,14 @@
|
|
|
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
-
|
|
|
-
|
|
|
</section>
|
|
|
<section class="d_jump">
|
|
|
<p class="title"><i class="iconfont iconjuxing" style="color:#3A8DDE;"></i>附件信息</p>
|
|
|
- <template v-for="(item,index) in AttachmentInfo">
|
|
|
- <el-form-item :label="item.Name">
|
|
|
- <uploadFiles :readOnly="read" :keysArr="keysArr" @change="changeItem" v-model="ruleForm.ProdFile[item.Code]"/>
|
|
|
+ <template v-for="item in AttachmentInfo">
|
|
|
+ <el-form-item :label="item.Name" :key="item.Code">
|
|
|
+ <uploadFiles :readOnly="read" :defined="item.Code" :keysArr="ruleForm.ProdFile[item.Code]" @change="changeItem"/>
|
|
|
</el-form-item>
|
|
|
</template>
|
|
|
-
|
|
|
</section>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -116,9 +125,9 @@
|
|
|
|
|
|
<script>
|
|
|
import uploadFiles from "@/components/public/uploadFiles"
|
|
|
- import {defFuncidQuery, prodRecordQuery} from "@/api/product"
|
|
|
- import {brandQueryByKeyword, brandRecordQuery} from "@/api/brand"
|
|
|
- import {mapGetters} from "vuex"
|
|
|
+ import { prodTypeCreate, prodTypeUpdate, defFuncidQuery, prodRecordQuery } from "@/api/product"
|
|
|
+ import { brandQueryByKeyword, brandRecordQuery } from "@/api/brand"
|
|
|
+ import { mapGetters } from "vuex"
|
|
|
|
|
|
export default {
|
|
|
components: {uploadFiles},
|
|
@@ -127,7 +136,6 @@
|
|
|
this.getBrandNum5()
|
|
|
},
|
|
|
mounted() {
|
|
|
- console.log(this.$route.query)
|
|
|
let listener = document.querySelector('.saga-brand-box')
|
|
|
listener.addEventListener('scroll', this.onScroll)
|
|
|
},
|
|
@@ -143,16 +151,15 @@
|
|
|
TechnicalData: [],
|
|
|
AttachmentInfo: [],
|
|
|
read: false,
|
|
|
- keysArr: [],
|
|
|
loading: false,
|
|
|
- bbs: [],
|
|
|
+ defaultBrandList: [],
|
|
|
brandList: [],
|
|
|
productList: [],
|
|
|
stepActive: '0',
|
|
|
tabPosition: 'left',
|
|
|
ruleForm: {
|
|
|
ProdCode: '',
|
|
|
- BrandID: [],
|
|
|
+ BrandID: '',
|
|
|
Model: '',
|
|
|
ProdParam: {},
|
|
|
ProdFile: {},
|
|
@@ -189,18 +196,26 @@
|
|
|
}
|
|
|
})
|
|
|
this.productList = res.Content
|
|
|
+ if (this.$route.params.ProdID) {//如果是修改,加载信息点
|
|
|
+ this.handleChangeProduct(this.$route.params.ProdCode)
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
- getBrandNum5() {// 获取最新创建过产品型号的5个品牌
|
|
|
- let params = {
|
|
|
- Type: this.dictionary.dictionaryType,
|
|
|
- GroupId: this.dictionary.groupId,
|
|
|
- ProjectId: this.dictionary.projectId,
|
|
|
+ getBrandNum5() {// 获取最新创建过产品型号的5个品牌(如果是修改的话只显示修改产品的品牌)
|
|
|
+ if (this.$route.params.ProdID) {
|
|
|
+ this.defaultBrandList = [this.$route.params.Brand]
|
|
|
+ this.brandList = [this.$route.params.Brand]
|
|
|
+ } else {
|
|
|
+ let params = {
|
|
|
+ Type: this.dictionary.dictionaryType,
|
|
|
+ GroupId: this.dictionary.groupId,
|
|
|
+ ProjectId: this.dictionary.projectId,
|
|
|
+ }
|
|
|
+ brandRecordQuery(params, res => {
|
|
|
+ this.defaultBrandList = res.Content
|
|
|
+ this.brandList = res.Content
|
|
|
+ })
|
|
|
}
|
|
|
- brandRecordQuery(params, res => {
|
|
|
- this.bbs = res.Content
|
|
|
- this.brandList = res.Content
|
|
|
- })
|
|
|
},
|
|
|
handleChangeProduct(item) {// 切换产品类型
|
|
|
let param = {
|
|
@@ -211,16 +226,27 @@
|
|
|
}
|
|
|
defFuncidQuery(param, res => {
|
|
|
this.TechnicalData = []
|
|
|
- res.Content.TechnicalData.forEach(i => {
|
|
|
- for (let key in i) {
|
|
|
- i[key].forEach(i => this.TechnicalData.push(i))
|
|
|
+ this.ruleForm.ProdParam = {}
|
|
|
+ this.ruleForm.ProdFile = {}
|
|
|
+ res.Content.TechnicalData.forEach(group => {
|
|
|
+ for (let key in group) {
|
|
|
+ group[key].forEach(i => {
|
|
|
+ if (i.DataType == 'ENUM' || i.DataType == 'MENUM') {
|
|
|
+ i.DataSource = JSON.parse(i.DataSource)
|
|
|
+ }
|
|
|
+ this.TechnicalData.push(i)
|
|
|
+ })
|
|
|
}
|
|
|
})
|
|
|
this.AttachmentInfo = res.Content.AttachmentInfo
|
|
|
+ if (this.$route.params.ProdID) {//判断是否是修改,回显修改内容
|
|
|
+ let {Brand, ProdID, prodCname, ...ruleForm} = this.$route.params
|
|
|
+ this.ruleForm = Object.assign(this.ruleForm, ruleForm)
|
|
|
+ }
|
|
|
})
|
|
|
},
|
|
|
handleChangeBrand(item) {// 切换品牌
|
|
|
- debugger
|
|
|
+ console.log(item)
|
|
|
},
|
|
|
jump(tab, event) {
|
|
|
this.stepActive = tab.index
|
|
@@ -264,11 +290,10 @@
|
|
|
if (jump[i].offsetTop >= scrolled) {
|
|
|
this.stepActive = i.toString()
|
|
|
break
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- remoteMethods(query) {
|
|
|
+ remoteMethods(query) {// 品牌搜索(显示50条)
|
|
|
if (query !== '') {
|
|
|
this.loading = true
|
|
|
brandQueryByKeyword({keyword: query, PageSize: 50,}, res => {
|
|
@@ -276,23 +301,32 @@
|
|
|
this.brandList = res.Content
|
|
|
})
|
|
|
} else {
|
|
|
- this.brandList = this.bbs
|
|
|
+ this.brandList = this.defaultBrandList
|
|
|
}
|
|
|
},
|
|
|
submitForm() {
|
|
|
this.$refs.ruleForm.validate((valid) => {
|
|
|
if (valid) {
|
|
|
console.log(this.ruleForm);
|
|
|
- debugger
|
|
|
+ if (this.$route.params.ProdID) {//修改
|
|
|
+ prodTypeUpdate({ProdID:this.$route.params.ProdID, ...this.ruleForm}, res => {
|
|
|
+ this.$message.success('修改成功!')
|
|
|
+ this.$router.go(-1)
|
|
|
+ })
|
|
|
+ } else {//添加
|
|
|
+ prodTypeCreate(this.ruleForm, res => {
|
|
|
+ this.$message.success('创建成功!')
|
|
|
+ this.$router.push('/product')
|
|
|
+ })
|
|
|
+ }
|
|
|
} else {
|
|
|
console.log('error submit!!');
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- changeItem(file) {
|
|
|
- let arr = []
|
|
|
- file.forEach(({ Key }) => arr.push({ Key }))
|
|
|
+ changeItem(files, code) {
|
|
|
+ this.ruleForm.ProdFile[code] = files
|
|
|
}
|
|
|
},
|
|
|
watch: {}
|