|
@@ -71,7 +71,7 @@ const app = new Vue({
|
|
|
// 注意事项
|
|
|
aroundOperation: '',
|
|
|
// 效果展示图片列表
|
|
|
- displayImageList: '',
|
|
|
+ // displayImageList: '',
|
|
|
// 常见问题
|
|
|
questionList: '',
|
|
|
// 仪器类别
|
|
@@ -79,11 +79,9 @@ const app = new Vue({
|
|
|
// 仪器状态
|
|
|
status: 1,
|
|
|
// seo关键词
|
|
|
- seo: '',
|
|
|
+ seoKeyword: '',
|
|
|
// 仪器链接
|
|
|
productLink: '',
|
|
|
- // 空缺数量
|
|
|
- emptyNum: ''
|
|
|
},
|
|
|
rules: {
|
|
|
// 仪器名称
|
|
@@ -153,6 +151,8 @@ const app = new Vue({
|
|
|
// 日期选择格式
|
|
|
marketTimeType: 'year',
|
|
|
nmpaTimeType: 'year',
|
|
|
+ // 空缺数量
|
|
|
+ emptyNum: ''
|
|
|
}
|
|
|
},
|
|
|
computed: {
|
|
@@ -177,7 +177,7 @@ const app = new Vue({
|
|
|
|
|
|
created() {
|
|
|
this.getTypeList();
|
|
|
- this.watchArrayStatus(['paramList', 'questionList', 'authImageList', 'displayImageList']);
|
|
|
+ this.watchArrayStatus(['paramList', 'questionList', 'authImageList']);
|
|
|
this.getProductFormData();
|
|
|
},
|
|
|
|
|
@@ -197,14 +197,16 @@ const app = new Vue({
|
|
|
this.socrllToErrorInput()
|
|
|
return;
|
|
|
}
|
|
|
- this.formData.emptyNum = this.validateEmptyParams(this.formData)
|
|
|
- if( this.formData.emptyNum> 0){
|
|
|
- this.$confirm('您还剩余' + this.formData.emptyNum + '项未完善,将会导致用户对您产品/仪器的认识度不够,确认是否提交?', '提示', {
|
|
|
+ this.emptyNum = this.validateEmptyParams(this.formData)
|
|
|
+ if( this.emptyNum> 0){
|
|
|
+ this.$confirm('您还剩余' + this.emptyNum + '项未完善,将会导致用户对您产品/仪器的认识度不够,确认是否提交?', '提示', {
|
|
|
confirmButtonText: '是',
|
|
|
cancelButtonText: '否'
|
|
|
}).then(() => {
|
|
|
this.saveFormData()
|
|
|
})
|
|
|
+ } else{
|
|
|
+ this.saveFormData()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
@@ -238,6 +240,17 @@ const app = new Vue({
|
|
|
return count;
|
|
|
},
|
|
|
|
|
|
+ // 裁切时间格式
|
|
|
+ sliceDateStr(time, type) {
|
|
|
+ time = dateFormat(time, 'yyyy-MM-dd')
|
|
|
+ if (type === 'year') {
|
|
|
+ time = time.slice(0, 4)
|
|
|
+ } else if (type === 'month') {
|
|
|
+ time = time.slice(0, 7)
|
|
|
+ }
|
|
|
+ return time
|
|
|
+ },
|
|
|
+
|
|
|
// 保存表单数据
|
|
|
saveFormData() {
|
|
|
const that = this;
|
|
@@ -250,32 +263,23 @@ const app = new Vue({
|
|
|
// marketTime: dateFormat(this.formData.marketTime, 'yyyy-MM-dd'),
|
|
|
// nmpaTime: dateFormat(this.formData.nmpaTime, 'yyyy-MM-dd'),
|
|
|
authImageList: this.authImageList.map(image => (image.response ? image.response.data : image.url)),
|
|
|
- displayImageList: this.displayImageList.map(image => (image.response ? image.response.data : image.url))
|
|
|
+ // displayImageList: this.displayImageList.map(image => (image.response ? image.response.data : image.url))
|
|
|
};
|
|
|
|
|
|
/* 处理时间 */
|
|
|
if(this.formData.marketTime){
|
|
|
- if(this.marketTimeType === 'year'){
|
|
|
- params.marketTime = dateFormat(this.formData.marketTime, 'yyyy')
|
|
|
- }else if(this.marketTimeType === 'month'){
|
|
|
- params.marketTime = dateFormat(this.formData.marketTime, 'yyyy-MM')
|
|
|
- }else{
|
|
|
- params.marketTime = dateFormat(this.formData.marketTime, 'yyyy-MM-dd')
|
|
|
- }
|
|
|
+ params.marketTime = this.sliceDateStr(this.formData.marketTime, this.marketTimeType)
|
|
|
}
|
|
|
|
|
|
/* 处理时间 */
|
|
|
- if(this.formData.nmpaTimeType){
|
|
|
- if(this.nmpaTimeType === 'year'){
|
|
|
- params.nmpaTime = dateFormat(this.formData.nmpaTime, 'yyyy')
|
|
|
- }else if(this.marketTimeType === 'month'){
|
|
|
- params.nmpaTime = dateFormat(this.formData.nmpaTime, 'yyyy-MM')
|
|
|
- }else{
|
|
|
- params.nmpaTime = dateFormat(this.formData.nmpaTime, 'yyyy-MM-dd')
|
|
|
- }
|
|
|
+ if(this.formData.nmpaTime){
|
|
|
+ params.nmpaTime = this.sliceDateStr(this.formData.nmpaTime, this.nmpaTimeType)
|
|
|
}
|
|
|
|
|
|
if (this.productId) params.productId = this.productId;
|
|
|
+
|
|
|
+ params.emptyNum = this.emptyNum;
|
|
|
+
|
|
|
console.log(params);
|
|
|
SupplierApi.ShopBaikeProductSave(params, function (res) {
|
|
|
if (res.code === 0) {
|
|
@@ -289,6 +293,18 @@ const app = new Vue({
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ // 获取时间类型(年月日)
|
|
|
+ getTimeType(time){
|
|
|
+ time = time.split('-')
|
|
|
+ if(time.length === 1){
|
|
|
+ return 'year'
|
|
|
+ }else if(time.length === 2){
|
|
|
+ return 'month'
|
|
|
+ }else {
|
|
|
+ return 'date'
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
initFormData: function(formData){
|
|
|
console.log(formData);
|
|
|
// 初始化this.formData
|
|
@@ -300,6 +316,11 @@ const app = new Vue({
|
|
|
this.formData[key] = len > 0 ? len : ''
|
|
|
} else if(['marketTime', 'nmpaTime'].includes(key)){
|
|
|
this.formData[key] = new Date(formData[key])
|
|
|
+ if(key === 'marketTime'){
|
|
|
+ this.marketTimeType = this.getTimeType(formData[key])
|
|
|
+ }else{
|
|
|
+ this.nmpaTimeType = this.getTimeType(formData[key])
|
|
|
+ }
|
|
|
}
|
|
|
else {
|
|
|
this.formData[key] = formData[key];
|
|
@@ -310,7 +331,7 @@ const app = new Vue({
|
|
|
this.resetEmptyListData(formData.paramList, formData.questionList);
|
|
|
// 处理图片
|
|
|
this.authImageList = formData.authImageList.map(image => ({ url: image, name: 'authImage'}))
|
|
|
- this.displayImageList = formData.displayImageList.map(image => ({ url: image, name: 'authImage'}))
|
|
|
+ // this.displayImageList = formData.displayImageList.map(image => ({ url: image, name: 'authImage'}))
|
|
|
},
|
|
|
|
|
|
|