1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
<template>
<!--新增弹框-->
<el-dialog
custom-class="party-dialog"
title="新建视频版权方"
width="468px"
:visible.sync="dialogVisible"
:before-close="close"
>
<div class="dialog-content">
<el-form
:model="ruleForm"
:rules="rules"
ref="ruleForm"
label-width="140px"
class="party-form form-inline"
label-position="top"
>
<el-form-item label="版权方名称" prop="name">
<el-input v-model="ruleForm.name"></el-input>
</el-form-item>
<el-form-item label="版权方有效期" prop="value1">
<el-date-picker
value-format="yyyy-MM-dd"
v-model="ruleForm.value1"
type="daterange"
range-separator="至"
start-placeholder="开始日期"
end-placeholder="结束日期"
></el-date-picker>
</el-form-item>
<el-form-item class="selectH100" label="请选择预设视频分类" prop="videoContentCatIdList">
<el-select
placeholder="请选择预设视频分类"
@focus="getAssetTypeData"
multiple
v-model="ruleForm.videoContentCatIdList"
@change="getSelectDep"
>
<el-checkbox :style="selfstyle" v-model="checkedThing" @change="selectAllThing">全选</el-checkbox>
<el-option v-for="item in videoContentCat" :label="item.name" :value="item.id" :key="item.id"></el-option>
</el-select>
</el-form-item>
<el-form-item label="备注" class="w100" prop="remarks">
<el-input type="textarea" v-model="ruleForm.remarks"></el-input>
</el-form-item>
</el-form>
</div>
<div slot="footer" class="dialog-footer btn-group">
<el-button size="mini" type="primary" @click="submitForm('ruleForm')">确定</el-button>
<el-button size="mini" @click="close">取 消</el-button>
</div>
</el-dialog>
</template>
<script>
export default {
data() {
return {
value1:[],
dialogVisible:false,
ruleForm: {
videoContentCatIdList: [],
name: "",
ownerType: "VIDEO_CONTENT"
},
videoContentCat: [
{
value: "Beijing",
label: "北京"
},
{
value: "Shanghai",
label: "上海"
}
],
checkedThing: false,
selfstyle: {
textAlign: "right",
width: "100%",
paddingRight: "10px"
},
rules: {
name: [
{ required: true, message: "请输入版权方名称", trigger: "blur" },
{ min: 1, max: 20, message: "请输入1到20个字" },
],
videoContentCatIdList:[
{required: true, message: "请选择视频分类", trigger: "change" }
],
value1:[
{ required: true, message: "请填写版权方有效期", trigger: "change" }
],
remarks: [
{ min: 1, max: 100, message: "请输入1到100个字" },
],
}
};
},
methods: {
// 弹窗保存
submitForm(formName) {
this.ruleForm.expireDateEnd = this.ruleForm.value1[1];
this.ruleForm.expireDateStart = this.ruleForm.value1[0];
this.$refs[formName].validate(valid => {
if (valid) {
this.$https(
{
url: "copyrightOwner/save",
method: "post",
authType: this.backToken
},
// this.ruleForm
this.$qs.stringify(this.ruleForm)
)
.then(res => {
if(res.data.resultCode === "200"){
this.$message({ type: "success", message: "新建视频版权方成功!" });
this.dialogVisible = false
}else{
this.$message({ type: "error", message: res.message });
}
})
.catch(function(err) {
console.log(err);
});
} else {
console.log("error submit!!");
return false;
}
});
},
save(formName) {
const _this = this
_this.ruleForm.expireDateEnd = this.ruleForm.value1[1];
_this.ruleForm.expireDateStart = this.ruleForm.value1[0];
this.$refs[formName].validate(valid => {
if (valid) {
this.$https(
{
url: "copyrightOwner/save",
method: "post",
authType: this.backToken
},
// this.ruleForm
_this.$qs.stringify(this.ruleForm)
)
.then(res => {
console.log(res)
// if(res.data.resultCode === "200"){
// _this.$message({ type: "success", message: "新增成功!" });
// _this.dialogVisible =false
// }else{
// _this.$message({ type: "error", message: res.data.message });
// }
})
.catch(function(err) {
console.log(err);
});
} else {
console.log("error submit!!");
return false;
}
});
},
// 新增关闭
close() {
this.dialogVisible = false;
for (let key in this.ruleForm) {
this.ruleForm[key] = null;
}
this.$refs["ruleForm"].resetFields();
},
// 获取视频分类列表
getAssetTypeData() {
let vm = this;
vm.$https({
url: "videoContentCat/getList",
method: "get",
authType: this.backToken
})
.then(res => {
let data = res.data.data;
this.videoContentCat = data;
// this.value1[0]=data.expireDateEnd
//this.value1[1]=data.expireDateStart
})
.catch(function(err) {
console.log(err);
});
},
getSelectDep(videoContentCatIdList) {
if (videoContentCatIdList.length === this.videoContentCat.length) {
this.checkedThing = true;
} else {
this.checkedThing = false;
}
},
selectAllThing() {
// debugger
this.ruleForm.videoContentCatIdList = [];
if (this.checkedThing) {
this.videoContentCat.map(item => {
this.ruleForm.videoContentCatIdList.push(item.id);
});
} else {
this.ruleForm.videoContentCatIdList = [];
}
}
}
};
</script>
<style>
</style>