SubmiteditAction.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div>
  3. <el-button type="primary" size="small" @click="actionSubmit" v-if="disabled">提报</el-button>
  4. <el-button type="primary" size="small" disabled v-else>提报</el-button>
  5. <el-drawer title="提报上传" :visible.sync="isFileInfoPanlShow">
  6. <el-button type="warning" size="small" class="btn1" @click="save()">保存</el-button>
  7. <div class="content" style="word-break:break-all">
  8. <p>提报内容</p>
  9. <el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" placeholder="请输入内容"
  10. v-model="param.content.content">
  11. </el-input>
  12. </div>
  13. <div class="bottom">
  14. <div class="file-box">
  15. <p>提报附件</p>
  16. <file-item :isDownLoad="false" :isDelete="true" :itemStyle="itemDrawerStyle" :fileData="upload_panl.attinfos"
  17. @deleteSuccess="deleteSuccess"></file-item>
  18. </div>
  19. <upload target="submit" @onSuccess="onSuccess"></upload>
  20. </div>
  21. </el-drawer>
  22. </div>
  23. </template>
  24. <script>
  25. import FileItem from '@/components/file-block/index'
  26. import upload from '@/SManagement/archives_upload/components/upload'
  27. import removeFile from '@/utils/removeFile'
  28. export default {
  29. name: 'SubmiteditItemInfo',
  30. data () {
  31. return {
  32. param: {
  33. "classname": "saletool.submitedit.submitedit",
  34. "method": "insertorupdate",
  35. "content": {
  36. "sat_submiteditmodelid": "",
  37. "content": "",
  38. "sat_submiteditid": "0"
  39. }
  40. },
  41. isFileInfoPanlShow: false,
  42. itemDrawerStyle: {
  43. img: {
  44. width: 53,
  45. height: 64
  46. },
  47. title: 16,
  48. descript: 12
  49. },
  50. textarea2: '',
  51. //上传模板
  52. upload_panl: 0,
  53. };
  54. },
  55. props: ['detailData', 'disabled', 'editData'],
  56. components: {
  57. FileItem,
  58. upload
  59. },
  60. computed: {
  61. },
  62. watch: {
  63. //监听字段是否删除上传模板
  64. isFileInfoPanlShow: {
  65. handler (val) {
  66. if (val == false && this.upload_panl.status == '未提报') {
  67. this.deleteSubmit()
  68. //删除附件
  69. if (this.upload_panl.attinfos.length != 0) removeFile.removeFileList(this.upload_panl.attinfos)
  70. }
  71. },
  72. },
  73. editData: {
  74. handler (val) {
  75. this.upload_panl = val
  76. this.param.content.content = val.content
  77. }
  78. }
  79. },
  80. methods: {
  81. actionSubmit () {
  82. this.isFileInfoPanlShow = true
  83. this.getSubmitPanl()
  84. },
  85. //获取上传模板
  86. getSubmitPanl () {
  87. this.param.content.sat_submiteditmodelid = this.detailData.sat_submiteditmodelid
  88. this.$api.requested(this.param).then(res => {
  89. this.upload_panl = res.data
  90. })
  91. },
  92. //删除提报记录
  93. deleteSubmit () {
  94. this.param.content.content = ''
  95. this.upload_panl.attinfos = ''
  96. let param = {
  97. "classname": "saletool.submitedit.submitedit",
  98. "method": "delete_submitdetailed",
  99. "content": {
  100. "sat_submiteditid": this.upload_panl.sat_submiteditid
  101. }
  102. }
  103. this.$api.requested(param).then(res => {
  104. if (res.code != 1) {
  105. console.log('提报删除失败');
  106. }
  107. })
  108. },
  109. save () {
  110. //新增
  111. if (this.param.content.content == false) {
  112. this.$notify({
  113. title: '提示',
  114. message: '请编辑内容',
  115. type: 'warning'
  116. })
  117. return
  118. }
  119. this.param.content.sat_submiteditmodelid = this.editData ? this.upload_panl.sat_submiteditmodelid : this.detailData.sat_submiteditmodelid
  120. this.param.content.sat_submiteditid = this.upload_panl.sat_submiteditid
  121. if (this.editData.attinfos) {
  122. this.$api.requested(this.param).then(res => {
  123. if(res.code == 1) {
  124. this.isFileInfoPanlShow = false
  125. this.$parent.getDetailData()
  126. this.upload_panl = ''
  127. this.param.content.content = ''
  128. this.param = {
  129. "classname": "saletool.submitedit.submitedit",
  130. "method": "insertorupdate",
  131. "content": {
  132. "sat_submiteditmodelid": "",
  133. "content": "",
  134. "sat_submiteditid": "0"
  135. }
  136. }
  137. this.$api.requested({
  138. "accesstoken": "5750f12f3c6ad59ab82f7d6e26499cf5",
  139. "classname": "saletool.submitedit.submitedit",
  140. "method": "sub_submitdetailed",
  141. "content": {
  142. "onceonly": this.$route.query.type == 'more' ? 1 : 0,
  143. "sat_submiteditmodelid":res.data.sat_submiteditmodelid,
  144. "sat_submiteditid":res.data.sat_submiteditid
  145. }
  146. }).then( res => {
  147. if( res.code == 1) {
  148. this.$notify({
  149. title:'提示',
  150. message:'修改成功',
  151. type:'success'
  152. })
  153. this.$parent.getDetailData()
  154. } else {
  155. this.$notify({
  156. title:'提示',
  157. message:'修改失败',
  158. type:'success'
  159. })
  160. }
  161. })
  162. }
  163. })
  164. } else {
  165. this.$api.requested(this.param).then(res => {
  166. this.upload_panl.status = '发布'
  167. if (res.code == 1) {
  168. //提交提报明细
  169. let param2 = {
  170. "classname": "saletool.submitedit.submitedit",
  171. "method": "sub_submitdetailed",
  172. "content": {
  173. "onceonly": this.$route.query.type == 'more' ? 1 : 0,
  174. "sat_submiteditmodelid": this.detailData.sat_submiteditmodelid,
  175. "sat_submiteditid": this.upload_panl.sat_submiteditid
  176. }
  177. }
  178. this.$api.requested(param2).then(res => {
  179. if (res.code == 1) {
  180. this.upload_panl.status = '发布'
  181. this.upload_panl.attinfos = null
  182. this.param = {
  183. "classname": "saletool.submitedit.submitedit",
  184. "method": "insertorupdate",
  185. "content": {
  186. "sat_submiteditmodelid": "",
  187. "content": "",
  188. "sat_submiteditid": "0"
  189. }
  190. },
  191. this.isFileInfoPanlShow = false
  192. this.$parent.getDetailData()
  193. }
  194. })
  195. }
  196. })
  197. }
  198. },
  199. onSuccess (id) {
  200. this.fileId = id
  201. let param = {
  202. "classname": "system.attachment.Attachment",
  203. "method": "createFileLink",
  204. "content": {
  205. "ownertable": "sat_submitedit",
  206. "ownerid": this.upload_panl.sat_submiteditid,
  207. "usetype": "default",
  208. "attachmentids": [
  209. id
  210. ]
  211. }
  212. }
  213. this.$api.requested(param).then(res => {
  214. if (res.msg != '成功') {
  215. this.$notify({
  216. title: '提示',
  217. message: '上传失败',
  218. type: 'error'
  219. })
  220. } else {
  221. this.upload_panl.attinfos = this.fileType.fileList(this.upload_panl.attinfos.concat(res.data[0]))
  222. }
  223. })
  224. },
  225. deleteSuccess (data) {
  226. this.upload_panl.attinfos.splice(data, 1)
  227. }
  228. },
  229. };
  230. </script>
  231. <style scoped>
  232. * {
  233. box-sizing: border-box;
  234. }
  235. /deep/ .el-drawer__header {
  236. margin-bottom: 0;
  237. }
  238. /deep/ .el-drawer {
  239. width: 546px !important;
  240. }
  241. .el-drawer__body .btn1 {
  242. margin: 20px 0 20px 20px;
  243. width: 88px;
  244. height: 36px;
  245. background: #fa8c16;
  246. }
  247. .el-drawer__body .content {
  248. border-bottom: 10px solid #fafafa;
  249. padding: 0 0 20px 20px;
  250. }
  251. .el-drawer__body .content p:first-child {
  252. font-size: 16px;
  253. font-weight: bold;
  254. color: #333333;
  255. margin-bottom: 20px;
  256. }
  257. .el-drawer .file-box p {
  258. margin: 20px 0 20px 0;
  259. font-size: 16px;
  260. font-weight: bold;
  261. color: #333333;
  262. margin-bottom: 20px;
  263. }
  264. .el-drawer .file-box .file {
  265. display: flex;
  266. flex-wrap: wrap;
  267. }
  268. .upload {
  269. display: flex;
  270. margin-top: 20px;
  271. }
  272. /deep/.upload .el-button {
  273. width: 100%;
  274. border: 1px solid #3874f6;
  275. color: #3874f6;
  276. }
  277. .bottom {
  278. padding: 0 20px;
  279. }
  280. </style>