|
@@ -52,6 +52,8 @@
|
|
|
:file-list="fileList">
|
|
|
<el-button size="small" type="primary">附件上传</el-button>
|
|
|
</el-upload>
|
|
|
+ <!-- 来源输入带建议 -->
|
|
|
+ <el-autocomplete value-key="name" v-if="item.name == 'source'" v-model="formdata[item.name]" :fetch-suggestions="querySearchAsync" placeholder="请输入内容" @select="handleSelect"></el-autocomplete>
|
|
|
</template>
|
|
|
</formData>
|
|
|
<filterList v-else ref="filterList" :tableData="userList" :filter="false" :readOnly="true" :filed="userfiled" @query="userfilterQuery" :total="userTotal"></filterList>
|
|
@@ -95,10 +97,10 @@ export default {
|
|
|
{ name: 'phone', label: '手机号' }
|
|
|
],
|
|
|
formfiled: [
|
|
|
- // { name: 'thumbnail', label: '缩略图', formater: 'slot' },
|
|
|
+ { name: 'thumbnail', label: '缩略图', formater: 'slot' },
|
|
|
{ name: 'title', label: '标题' },
|
|
|
{ name: 'curtTitle', label: '副标题' },
|
|
|
- { name: 'source', label: '来源', formater: 'dict:source' },
|
|
|
+ { name: 'source', label: '来源', formater: 'slot' },
|
|
|
{ name: 'author', label: '作者' },
|
|
|
{ name: 'bind', label: '绑定菜单', formater: 'dict:menus' },
|
|
|
{ name: 'date', label: '时间', formater: 'date:datetime' },
|
|
@@ -158,6 +160,15 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
...mapActions(['contentsQuery', 'contentsCreate', 'contentsUpdate', 'contentsDelete', 'contentsQuery', 'contentsFetch', 'menusQuery', 'userQuery', 'sourceQuery']),
|
|
|
+ // 查询字典函数
|
|
|
+ async querySearchAsync(queryString, cb) {
|
|
|
+ await this.sourceQuery();
|
|
|
+ cb(this.dict.source);
|
|
|
+ },
|
|
|
+ // 选择建议
|
|
|
+ handleSelect(item) {
|
|
|
+ console.log(item);
|
|
|
+ },
|
|
|
// 添加
|
|
|
addcontents () {
|
|
|
this.formdata = {};
|
|
@@ -233,16 +244,16 @@ export default {
|
|
|
},
|
|
|
// 缩略图上传限制
|
|
|
beforeAvatarUpload(file) {
|
|
|
- const isJPG = file.type === 'image/jpeg';
|
|
|
- const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
+ // const isJPG = file.type === 'image/jpeg';
|
|
|
+ // const isLt2M = file.size / 1024 / 1024 < 2;
|
|
|
|
|
|
- if (!isJPG) {
|
|
|
- this.$message.error('上传图片只能是 JPG 格式!');
|
|
|
- }
|
|
|
- if (!isLt2M) {
|
|
|
- this.$message.error('上传图片大小不能超过 2MB!');
|
|
|
- }
|
|
|
- return isJPG && isLt2M;
|
|
|
+ // if (!isJPG) {
|
|
|
+ // this.$message.error('上传图片只能是 JPG 格式!');
|
|
|
+ // }
|
|
|
+ // if (!isLt2M) {
|
|
|
+ // this.$message.error('上传图片大小不能超过 2MB!');
|
|
|
+ // }
|
|
|
+ // return isJPG && isLt2M;
|
|
|
},
|
|
|
async treeClick({ data, node }) {
|
|
|
if (data.children) return;
|