|
@@ -11,21 +11,68 @@
|
|
|
<van-radio name="0">所有用户</van-radio>
|
|
|
<van-radio name="1">机构用户</van-radio>
|
|
|
<van-radio name="2">平台用户</van-radio>
|
|
|
+ <van-radio name="4">个人用户</van-radio>
|
|
|
</van-radio-group>
|
|
|
</template>
|
|
|
</van-field>
|
|
|
+ <van-field v-model="form.to_name" name="to_name" center clearable label="用戶姓名" readonly v-if="form.to_type == '4'">
|
|
|
+ <template #button>
|
|
|
+ <van-button size="small" type="primary" @click="toSelect">选择用户</van-button>
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
+ <van-field v-model="form.to_id" name="to_id" style="display: none" v-if="form.to_type == '4'" />
|
|
|
<van-field v-model="form.content" name="content" rows="2" autosize label="发送内容" type="textarea" placeholder="发送内容" />
|
|
|
+ <van-field name="notice_file" label="通知文件" :rules="[{ required: true, message: '通知文件' }]">
|
|
|
+ <template #input>
|
|
|
+ <van-uploader
|
|
|
+ :fileList="form.notice_file"
|
|
|
+ :max-count="1"
|
|
|
+ :after-read="(file) => toUpload(file, 'notice_file')"
|
|
|
+ @delete="(file) => toDelete(file, 'notice_file')"
|
|
|
+ accept="file"
|
|
|
+ />
|
|
|
+ </template>
|
|
|
+ </van-field>
|
|
|
<div style="margin: 16px">
|
|
|
<van-button round block type="info" native-type="submit">提交</van-button>
|
|
|
</div>
|
|
|
</van-form>
|
|
|
</van-col>
|
|
|
</van-row>
|
|
|
+ <van-dialog class="dialog" v-model="dialog.show" :title="dialog.title" :show-confirm-button="false" show-cancel-button cancel-button-text="返回">
|
|
|
+ <van-col span="24" class="one" v-if="dialog.type == '1'">
|
|
|
+ <van-col span="24" class="one_1">
|
|
|
+ <van-search v-model="searchName" show-action placeholder="请输入联系电话" @search="searchUser">
|
|
|
+ <template #action>
|
|
|
+ <div @click="searchUser">搜索</div>
|
|
|
+ </template>
|
|
|
+ </van-search>
|
|
|
+ </van-col>
|
|
|
+ <van-col span="24" class="one_2">
|
|
|
+ <van-col span="24" class="list" v-for="(item, index) in list" :key="index">
|
|
|
+ <van-col span="24" class="name"> {{ item.name }} </van-col>
|
|
|
+ <van-col span="24" class="other">
|
|
|
+ <van-col span="24" class="otherInfo">
|
|
|
+ 联系电话:<span>{{ item.phone }}</span>
|
|
|
+ </van-col>
|
|
|
+ </van-col>
|
|
|
+ <van-col span="24" class="btn">
|
|
|
+ <van-button type="info" size="mini" @click.prevent="conFirm(item)">确认选择</van-button>
|
|
|
+ </van-col>
|
|
|
+ </van-col>
|
|
|
+ <van-col span="24" class="page">
|
|
|
+ <page @search="searchUser" :limit="limit" :total="total"></page>
|
|
|
+ </van-col>
|
|
|
+ </van-col>
|
|
|
+ </van-col>
|
|
|
+ </van-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
import { mapState, createNamespacedHelpers } from 'vuex';
|
|
|
+const { mapActions: upload } = createNamespacedHelpers('upload');
|
|
|
+const { mapActions: personal } = createNamespacedHelpers('personal');
|
|
|
export default {
|
|
|
name: 'form-1',
|
|
|
props: {
|
|
@@ -33,13 +80,52 @@ export default {
|
|
|
},
|
|
|
components: {},
|
|
|
data: function () {
|
|
|
- return {};
|
|
|
+ return {
|
|
|
+ dialog: { show: false, titla: '查询用户', type: '1' },
|
|
|
+ // 查询
|
|
|
+ searchName: '',
|
|
|
+ list: [],
|
|
|
+ limit: 3,
|
|
|
+ total: 0,
|
|
|
+ };
|
|
|
},
|
|
|
created() {},
|
|
|
methods: {
|
|
|
+ ...upload(['upload']),
|
|
|
+ ...personal({ personalQuery: 'query' }),
|
|
|
onSubmit(values) {
|
|
|
this.$emit('onSubmit', values);
|
|
|
},
|
|
|
+ async toUpload({ file }, model) {
|
|
|
+ // 上传,赋值
|
|
|
+ const res = await this.upload({ file, dir: 'analysis' });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this.form, model, [{ name: res.name, url: res.uri }]);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ toDelete(file, model) {
|
|
|
+ const index = this.form[model].findIndex((f) => _.isEqual(f, file));
|
|
|
+ this.form[model].splice(index, 1);
|
|
|
+ },
|
|
|
+ // 选择用户
|
|
|
+ toSelect() {
|
|
|
+ this.dialog = { show: true, title: '查询用户', type: '1' };
|
|
|
+ },
|
|
|
+ // 查询用户
|
|
|
+ async searchUser({ skip = 0, limit = this.limit, ...info } = {}) {
|
|
|
+ if (this.searchName) info.phone = this.searchName;
|
|
|
+ let res = await this.personalQuery({ skip, limit, ...info });
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$set(this, `list`, res.data);
|
|
|
+ this.$set(this, `total`, res.total);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 确认选择
|
|
|
+ conFirm(value) {
|
|
|
+ this.$set(this.form, `to_id`, value.id);
|
|
|
+ this.$set(this.form, `to_name`, value.name);
|
|
|
+ this.dialog = { show: false, title: '查询用户', type: '1' };
|
|
|
+ },
|
|
|
},
|
|
|
computed: {
|
|
|
...mapState(['user']),
|
|
@@ -57,4 +143,43 @@ export default {
|
|
|
};
|
|
|
</script>
|
|
|
|
|
|
-<style lang="less" scoped></style>
|
|
|
+<style lang="less" scoped>
|
|
|
+.dialog {
|
|
|
+ /deep/.van-dialog__content {
|
|
|
+ max-height: 350px;
|
|
|
+ overflow-y: auto;
|
|
|
+ }
|
|
|
+ .one {
|
|
|
+ .one_2 {
|
|
|
+ .list {
|
|
|
+ border-bottom: 1px dashed #ccc;
|
|
|
+ margin: 0 0 8px 0;
|
|
|
+ padding: 0 8px 5px 8px;
|
|
|
+ .name {
|
|
|
+ font-size: 16px;
|
|
|
+ margin: 0 0 5px 0;
|
|
|
+ }
|
|
|
+ .other {
|
|
|
+ margin: 0 0 5px 0;
|
|
|
+ .otherInfo {
|
|
|
+ font-size: 14px;
|
|
|
+ color: #666;
|
|
|
+ span {
|
|
|
+ color: #000;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .btn {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ .two {
|
|
|
+ .btn {
|
|
|
+ margin: 8px 0;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|