Index.vue 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <template>
  2. <div>
  3. <Tinymce v-model="defaultValue" :height="750" placeholder="在这里输入文字"/>
  4. <el-button type="primary" style="float:right;margin: 10px" @click="save">保存</el-button>
  5. <el-button v-if="this.$route.query.instructionsId" style="float:right;margin-top: 10px" type="warning"
  6. @click="goBack"
  7. >返回
  8. </el-button>
  9. </div>
  10. </template>
  11. <script>
  12. import Tinymce from '../index.vue'
  13. import { updateTechnology, getTechnologyInfo } from '../../../api/system/machinery'
  14. import { getInstructionsInfo, updateInstructions } from '../../../api/mes/instructions'
  15. export default {
  16. components: {
  17. Tinymce
  18. },
  19. data() {
  20. return {
  21. defaultValue: '',
  22. form: null
  23. }
  24. },
  25. computed: {},
  26. created() {
  27. this.getInfo()
  28. },
  29. mounted() {
  30. },
  31. methods: {
  32. getInfo() {
  33. if (this.$route.query.machineryId) {
  34. getTechnologyInfo(this.$route.query.machineryId).then((response) => {
  35. this.form = response.data
  36. this.defaultValue = response.data.remark
  37. })
  38. } else if (this.$route.query.instructionsId) {
  39. getInstructionsInfo(this.$route.query.instructionsId).then((response) => {
  40. console.log(response, '物资使用说明')
  41. this.form = response.data
  42. this.defaultValue = response.data.remark
  43. })
  44. }
  45. },
  46. save() {
  47. console.log(this.defaultValue, '拿到的设备工艺 信息------')
  48. if (this.$route.query.machineryId) {
  49. this.form.remark = this.defaultValue
  50. updateTechnology(this.form).then(response => {
  51. console.log(response, '更新设备工艺')
  52. if (response.data) {
  53. this.$message.success('保存成功')
  54. }
  55. })
  56. } else {
  57. this.form.remark = this.defaultValue
  58. updateInstructions(this.form).then(response => {
  59. console.log(response, '更新物资使用说明')
  60. if (response.data) {
  61. this.$message.success('保存成功')
  62. }
  63. })
  64. }
  65. },
  66. goBack() {
  67. this.$router.push('/material/instructions')
  68. }
  69. }
  70. }
  71. </script>