riskOperateDetial.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <div style="width: 100%;height: 100%;padding: 5px" class="riskOD">
  3. <el-form ref="fromData" :model="fromData" style="width: 100%;padding: 5px">
  4. <el-row>
  5. <el-col style="padding-bottom: 10px">
  6. <span class="card_title">风险信息</span>
  7. <el-card shadow="always" style="padding: 15px 5px 5px 15px">
  8. <el-row>
  9. <el-col :span="3" class="col-txt"><span>企业名称</span></el-col>
  10. <el-col :span="20" class="col-input">
  11. <el-form-item prop="title">
  12. <el-input v-model="fromData.proName" readonly />
  13. </el-form-item>
  14. </el-col>
  15. </el-row>
  16. <el-row>
  17. <el-col :span="3" class="col-txt"><span>风险标题</span></el-col>
  18. <el-col :span="20" class="col-input">
  19. <el-form-item>
  20. <el-input v-model="fromData.title" />
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="3" class="col-txt"><span>风险类别</span></el-col>
  24. <el-col :span="8" class="col-input">
  25. <el-form-item>
  26. <el-select v-model="fromData.rtype" placeholder="请选择">
  27. <el-option
  28. v-for="item in dc_data.riskWarnType"
  29. :key="item.value"
  30. :label="item.label"
  31. :value="item.value"
  32. />
  33. </el-select>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="3" class="col-txt"><span>风险等级</span></el-col>
  37. <el-col :span="8" class="col-input">
  38. <el-form-item>
  39. <el-select v-model="fromData.grade" placeholder="请选择">
  40. <el-option
  41. v-for="item in dc_data.riskGrade"
  42. :key="item.value"
  43. :label="item.label"
  44. :value="item.value"
  45. />
  46. </el-select>
  47. </el-form-item>
  48. </el-col>
  49. <el-col :span="3" class="col-txt"><span>风险内容说明</span></el-col>
  50. <el-col :span="20" class="col-input">
  51. <el-form-item>
  52. <!-- <el-input type="textarea" :rows="10" v-model="fromData.content" /> -->
  53. <QuillEditor
  54. :height="300"
  55. :value="fromData.content"
  56. @input="getContent"
  57. />
  58. </el-form-item>
  59. </el-col>
  60. </el-row>
  61. <el-row>
  62. <el-col :span="3" class="col-txt"><span>附件</span></el-col>
  63. <el-col :span="20" class="col-input">
  64. <el-form-item>
  65. <el-upload
  66. class="upload-demo"
  67. action="#"
  68. :http-request="upload"
  69. :before-remove="uploadRemove"
  70. :file-list="fileList"
  71. >
  72. <el-button size="small" type="primary">点击上传</el-button>
  73. <!-- <div slot="tip" class="el-upload__tip">只能上传jpg/png文件,且不超过500kb</div> -->
  74. </el-upload>
  75. </el-form-item>
  76. </el-col>
  77. <el-col :span="3" class="col-txt"><span>查阅人</span></el-col>
  78. <el-col :span="20" class="col-input">
  79. <el-form-item>
  80. <!-- <user-select :default-select="selectList" :multiple="true" width="700" @selectValue="parentMethod" /> -->
  81. <user-select-compon v-if="userSelectValue" :default-select="selectList" :multiple="true" width="700" @selectValue="parentMethod" />
  82. </el-form-item>
  83. </el-col>
  84. </el-row>
  85. </el-card>
  86. </el-col>
  87. </el-row>
  88. </el-form>
  89. </div>
  90. </template>
  91. <script>
  92. import axios from 'axios'
  93. import Base from '@/views/base/base'
  94. import BaseData from '@/views/base/baseData'
  95. import QuillEditor from '@/components/QuillEditor'
  96. // import UserSelect from '@/views/components/UserSelect'
  97. import userSelectCompon from '@/views/components/userSelectCompon'
  98. export default {
  99. name: 'RiskOperateDetial',
  100. components: {
  101. QuillEditor,
  102. // UserSelect
  103. userSelectCompon
  104. },
  105. mixins: [Base, BaseData],
  106. props: {
  107. proId: {
  108. type: String,
  109. default: ''
  110. },
  111. rId: {
  112. type: String,
  113. default: ''
  114. }
  115. },
  116. data() {
  117. return {
  118. dc_key: ['riskGrade', 'riskWarnType'],
  119. fromData: {},
  120. fileList: [],
  121. selectList: [],
  122. content: '',
  123. userSelectValue: false
  124. }
  125. },
  126. watch: {
  127. },
  128. created() {
  129. this.initData()
  130. },
  131. destroyed() {
  132. },
  133. methods: {
  134. initData: function() {
  135. this.initDict(this.dc_key).then(res => {
  136. this.getInfoData()
  137. })
  138. },
  139. getInfoData() {
  140. this.fromData = {}
  141. this.content = "";
  142. this.fromData.content = "";
  143. this.fileList = []
  144. this.selectList = []
  145. this.$set(this, 'content', ' ')
  146. if (this.rId) {
  147. const postData = {
  148. id: this.rId
  149. }
  150. const _this = this
  151. this.baseRequest('getById', postData).then((res) => {
  152. console.log('####res_:', res)
  153. if (res.data) {
  154. const { data } = res
  155. _this.fromData = Object.assign({}, _this.fromData, res.data)
  156. _this.content = _this.fromData.content
  157. if (_this.fromData.annex) {
  158. _this.$set(_this, 'fileList', JSON.parse(_this.fromData.annex))
  159. }
  160. if (_this.fromData.viewedBy) {
  161. _this.$set(_this, 'selectList', _this.fromData.viewedBy.split(','))
  162. }
  163. console.log('this.fileList_:', _this.fileList, _this.selectList)
  164. }
  165. this.userSelectValue = true;
  166. }).catch(() => {
  167. })
  168. } else {
  169. const postData = {
  170. id: this.proId
  171. }
  172. this.baseProRequest('getById', postData).then((res) => {
  173. console.log("项目信息——:", res)
  174. if (res.data) {
  175. // this.$set(this, 'selectList', res.data.users)
  176. this.$set(this.fromData, 'proId', res.data.id)
  177. this.$set(this.fromData, 'proName', res.data.qymc)
  178. }
  179. this.userSelectValue = true;
  180. }).catch(() => {
  181. })
  182. }
  183. },
  184. upload(param) {
  185. const formParam = new FormData()
  186. formParam.append('file', param.file)
  187. const config = {
  188. headers: {
  189. 'Content-Type': 'multipart/form-data',
  190. 'MVVM-Key': String(new Date().getTime()),
  191. 'xx': 'anything',
  192. 'Access-Control-Allow-Origin': '*'
  193. }
  194. }
  195. axios.post(this.$constant.BASE_URI + '/FileController/upload', formParam, config)
  196. .then(response => {
  197. const item = {
  198. name: param.file.name,
  199. url: this.$constant.BASE_URI + '/FileController/download/' + response.data.data
  200. }
  201. this.fileList[this.fileList.length] = item
  202. }).catch((err, x) => {
  203. console.log(err, x)
  204. })
  205. },
  206. uploadRemove(file, fileList) {
  207. this.fileList = fileList
  208. },
  209. getContent(content) {
  210. this.content = content
  211. this.fromData.content = content
  212. },
  213. parentMethod: function(val) {
  214. if (val.length > 0) {
  215. this.fromData.viewedBy = val.join(',')
  216. }else{
  217. this.fromData.viewedBy = "";
  218. }
  219. },
  220. confirmSubmit: function(sta) {
  221. const _this = this
  222. this.$refs.fromData.validate(valid => {
  223. if (valid) {
  224. let soaUrl = 'edit'
  225. const extraData = {}
  226. const postData = Object.assign({}, _this.fromData, extraData)
  227. if (!this.fromData.id) {
  228. postData.state = sta
  229. soaUrl = 'add'
  230. }
  231. postData.annex = JSON.stringify(_this.fileList)
  232. this.baseRequest(soaUrl, postData).then((res) => {
  233. if (res.data.msg === 'Success') {
  234. this.$message({
  235. type: 'success',
  236. message: '提交成功'
  237. })
  238. this.$emit('closeDialog')
  239. } else {
  240. this.$message({
  241. type: 'error',
  242. message: '提交失败'
  243. })
  244. }
  245. })
  246. } else {
  247. console.log('error submit!!')
  248. return false
  249. }
  250. })
  251. },
  252. baseRequest(opUrl, postData) {
  253. return this.$channel.globleRequest('ProRiskInfoController', opUrl, postData, 'project')
  254. },
  255. baseProRequest(opUrl, postData) {
  256. return this.$channel.globleRequest('MnpCompanyController', opUrl, postData, 'project')
  257. }
  258. }
  259. }
  260. </script>
  261. <style lang="scss" scoped>
  262. .riskOD{
  263. .el-upload{
  264. width: 0 !important;
  265. }
  266. .ch-input .el-input__inner {
  267. border-radius: 0px;
  268. border-color: #32323A;
  269. }
  270. .ch-input-size {
  271. width: 150px;
  272. }
  273. .ch-button {
  274. border-radius: 0px;
  275. border-color: #32323A;
  276. background-color: #32323A;
  277. color: #fff;
  278. }
  279. .ch-button-warning {
  280. margin-left: 10px;
  281. border-radius: 0px;
  282. border-color: #E6A23C;
  283. background-color: #E6A23C;
  284. color: #fff;
  285. }
  286. .ch-button-export {
  287. margin-left: 10px;
  288. border-radius: 0px;
  289. border-color: #98CC1F;
  290. background-color: #98CC1F;
  291. color: #fff;
  292. }
  293. }
  294. </style>