123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <template>
- <div>
- <div class="my-title">变更通知人设置</div>
- <!-- 表单 -->
- <el-form
- :model="dataForm"
- :rules="dataRule"
- ref="dataForm"
- label-width="auto"
- >
- <el-row class="my-row">
- <el-form-item label="通知接收人" prop="userIds">
- <user-components
- v-model="dataForm.userIds"
- :userIds.sync="dataForm.userIds"
- @change="userSelectedChanged"
- />
- </el-form-item>
- </el-row>
- </el-form>
- <span slot="footer" class="dialog-footer">
- <el-button @click="onChose">取消</el-button>
- <el-button type="primary" @click="dataFormSubmit()">确定</el-button>
- </span>
- </div>
- </template>
- <script>
- import UserComponents from '../common/user-components'
- export default {
- name: 'process-add-note-change',
- components: {
- UserComponents
- },
- data () {
- return {
- visible: false,
- dataForm: {
- userIds: []
- },
- dataRule: {
- userIds: [
- { required: true, message: '请选择通知接收人', trigger: 'change' }
- ]
- }
- }
- },
- created () {},
- methods: {
- onChose () {
- this.$emit('onChose')
- },
- async init () {
- this.dataForm = {}
- this.$http({
- url: this.$http.adornUrl(
- `/biz-service/pro-crux-course/noteChangeConfig`
- ),
- method: 'get'
- }).then(({ data }) => {
- if (data && data.code === '200') {
- this.dataForm = {
- userIds: data.data
- }
- }
- })
- this.visible = true
- },
- validateField (type) {
- this.$refs.dataForm.validateField(type)
- },
- // 表单提交
- dataFormSubmit () {
- this.$refs['dataForm'].validate((valid) => {
- if (valid) {
- this.$http({
- url: this.$http.adornUrl(
- `/biz-service/pro-crux-course/noteChangeConfig`
- ),
- method: 'post',
- data: this.dataForm.userIds
- }).then(({ data }) => {
- if (data && data.code === '200') {
- this.$message({
- message: '操作成功',
- type: 'success',
- duration: 1500,
- onClose: () => {
- this.onChose()
- }
- })
- } else {
- this.$message.error(data.msg)
- }
- })
- }
- })
- },
- userSelectedChanged (val) {
- this.dataForm.userIds = val
- }
- }
- }
- </script>
- <style scoped></style>
|