123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304 |
- <template>
- <div style="width: 100%;height: 100%;padding: 5px" class="riskOD">
- <el-form ref="fromData" :model="fromData" style="width: 100%;padding: 5px">
- <el-row>
- <el-col style="padding-bottom: 10px">
- <span class="card_title">风险信息</span>
- <el-card shadow="always" style="padding: 15px 5px 5px 15px">
- <el-row>
- <el-col :span="3" class="col-txt"><span>企业名称</span></el-col>
- <el-col :span="20" class="col-input">
- <el-form-item prop="title">
- <el-input v-model="fromData.proName" readonly />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt"><span>风险标题</span></el-col>
- <el-col :span="20" class="col-input">
- <el-form-item>
- <el-input v-model="fromData.title" />
- </el-form-item>
- </el-col>
- <el-col :span="3" class="col-txt"><span>风险类别</span></el-col>
- <el-col :span="8" class="col-input">
- <el-form-item>
- <el-select v-model="fromData.rtype" placeholder="请选择">
- <el-option
- v-for="item in dc_data.riskWarnType"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="3" class="col-txt"><span>风险等级</span></el-col>
- <el-col :span="8" class="col-input">
- <el-form-item>
- <el-select v-model="fromData.grade" placeholder="请选择">
- <el-option
- v-for="item in dc_data.riskGrade"
- :key="item.value"
- :label="item.label"
- :value="item.value"
- />
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="3" class="col-txt"><span>风险内容说明</span></el-col>
- <el-col :span="20" class="col-input">
- <el-form-item>
- <!-- <el-input type="textarea" :rows="10" v-model="fromData.content" /> -->
- <QuillEditor
- :height="300"
- :value="fromData.content"
- @input="getContent"
- />
- </el-form-item>
- </el-col>
- </el-row>
- <el-row>
- <el-col :span="3" class="col-txt"><span>附件</span></el-col>
- <el-col :span="20" class="col-input">
- <el-form-item>
- <el-upload
- class="upload-demo"
- action="#"
- :http-request="upload"
- :before-remove="uploadRemove"
- :file-list="fileList"
- >
- <el-button size="small" type="primary">点击上传</el-button>
- <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
- </el-upload>
- </el-form-item>
- </el-col>
- <el-col :span="3" class="col-txt"><span>查阅人</span></el-col>
- <el-col :span="20" class="col-input">
- <el-form-item>
- <!-- <user-select :default-select="selectList" :multiple="true" width="700" @selectValue="parentMethod" /> -->
- <user-select-compon v-if="userSelectValue" :default-select="selectList" :multiple="true" width="700" @selectValue="parentMethod" />
- </el-form-item>
- </el-col>
- </el-row>
- </el-card>
- </el-col>
- </el-row>
- </el-form>
- </div>
- </template>
- <script>
- import axios from 'axios'
- import Base from '@/views/base/base'
- import BaseData from '@/views/base/baseData'
- import QuillEditor from '@/components/QuillEditor'
- // import UserSelect from '@/views/components/UserSelect'
- import userSelectCompon from '@/views/components/userSelectCompon'
- export default {
- name: 'RiskOperateDetial',
- components: {
- QuillEditor,
- // UserSelect
- userSelectCompon
- },
- mixins: [Base, BaseData],
- props: {
- proId: {
- type: String,
- default: ''
- },
- rId: {
- type: String,
- default: ''
- }
- },
- data() {
- return {
- dc_key: ['riskGrade', 'riskWarnType'],
- fromData: {},
- fileList: [],
- selectList: [],
- content: '',
- userSelectValue: false
- }
- },
- watch: {
- },
- created() {
- this.initData()
- },
- destroyed() {
- },
- methods: {
- initData: function() {
- this.initDict(this.dc_key).then(res => {
- this.getInfoData()
- })
- },
- getInfoData() {
- this.fromData = {}
- this.content = "";
- this.fromData.content = "";
- this.fileList = []
- this.selectList = []
- this.$set(this, 'content', ' ')
- if (this.rId) {
- const postData = {
- id: this.rId
- }
- const _this = this
- this.baseRequest('getById', postData).then((res) => {
- console.log('####res_:', res)
- if (res.data) {
- const { data } = res
- _this.fromData = Object.assign({}, _this.fromData, res.data)
- _this.content = _this.fromData.content
- if (_this.fromData.annex) {
- _this.$set(_this, 'fileList', JSON.parse(_this.fromData.annex))
- }
- if (_this.fromData.viewedBy) {
- _this.$set(_this, 'selectList', _this.fromData.viewedBy.split(','))
- }
-
- console.log('this.fileList_:', _this.fileList, _this.selectList)
- }
- this.userSelectValue = true;
- }).catch(() => {
- })
- } else {
- const postData = {
- id: this.proId
- }
- this.baseProRequest('getById', postData).then((res) => {
- console.log("项目信息——:", res)
- if (res.data) {
- // this.$set(this, 'selectList', res.data.users)
- this.$set(this.fromData, 'proId', res.data.id)
- this.$set(this.fromData, 'proName', res.data.qymc)
- }
- this.userSelectValue = true;
- }).catch(() => {
- })
- }
- },
- upload(param) {
- const formParam = new FormData()
- formParam.append('file', param.file)
- const config = {
- headers: {
- 'Content-Type': 'multipart/form-data',
- 'MVVM-Key': String(new Date().getTime()),
- 'xx': 'anything',
- 'Access-Control-Allow-Origin': '*'
- }
- }
- axios.post(this.$constant.BASE_URI + '/FileController/upload', formParam, config)
- .then(response => {
- const item = {
- name: param.file.name,
- url: this.$constant.BASE_URI + '/FileController/download/' + response.data.data
- }
- this.fileList[this.fileList.length] = item
- }).catch((err, x) => {
- console.log(err, x)
- })
- },
- uploadRemove(file, fileList) {
- this.fileList = fileList
- },
- getContent(content) {
- this.content = content
- this.fromData.content = content
- },
- parentMethod: function(val) {
- if (val.length > 0) {
- this.fromData.viewedBy = val.join(',')
- }else{
- this.fromData.viewedBy = "";
- }
- },
- confirmSubmit: function(sta) {
- const _this = this
- this.$refs.fromData.validate(valid => {
- if (valid) {
- let soaUrl = 'edit'
- const extraData = {}
- const postData = Object.assign({}, _this.fromData, extraData)
- if (!this.fromData.id) {
- postData.state = sta
- soaUrl = 'add'
- }
- postData.annex = JSON.stringify(_this.fileList)
- this.baseRequest(soaUrl, postData).then((res) => {
- if (res.data.msg === 'Success') {
- this.$message({
- type: 'success',
- message: '提交成功'
- })
- this.$emit('closeDialog')
- } else {
- this.$message({
- type: 'error',
- message: '提交失败'
- })
- }
- })
- } else {
- console.log('error submit!!')
- return false
- }
- })
- },
- baseRequest(opUrl, postData) {
- return this.$channel.globleRequest('ProRiskInfoController', opUrl, postData, 'project')
- },
- baseProRequest(opUrl, postData) {
- return this.$channel.globleRequest('MnpCompanyController', opUrl, postData, 'project')
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .riskOD{
- .el-upload{
- width: 0 !important;
- }
- .ch-input .el-input__inner {
- border-radius: 0px;
- border-color: #32323A;
- }
- .ch-input-size {
- width: 150px;
- }
- .ch-button {
- border-radius: 0px;
- border-color: #32323A;
- background-color: #32323A;
- color: #fff;
- }
- .ch-button-warning {
- margin-left: 10px;
- border-radius: 0px;
- border-color: #E6A23C;
- background-color: #E6A23C;
- color: #fff;
- }
- .ch-button-export {
- margin-left: 10px;
- border-radius: 0px;
- border-color: #98CC1F;
- background-color: #98CC1F;
- color: #fff;
- }
- }
- </style>
|