formModule.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <zj-form-module :title="'申请信息' + (index + 1)" :form-data="item" :form-items="formItems">
  3. <div
  4. v-if="item.status == 'ING'"
  5. style="text-align: right; box-sizing: border-box; padding-bottom: 10px; padding-right: 10px"
  6. >
  7. <el-button size="mini" plain @click="quxiao">取消申请</el-button>
  8. <el-button size="mini" type="primary" plain @click="daohuo">到货反馈</el-button>
  9. </div>
  10. </zj-form-module>
  11. </template>
  12. <script>
  13. import editTable from '@/components/template/editTable.js'
  14. import {
  15. orderPartsApplyItemModify,
  16. orderPartsApplyCancel,
  17. orderPartsApplyEnd,
  18. orderPartsApplyItemDel
  19. } from '@/api/workOrderPool.js'
  20. export default {
  21. props: {
  22. id: {
  23. type: [String, Number],
  24. default: null
  25. },
  26. item: {
  27. type: Object,
  28. default: () => ({})
  29. },
  30. index: {
  31. type: [String, Number],
  32. default: null
  33. }
  34. },
  35. mixins: [editTable],
  36. data() {
  37. return {}
  38. },
  39. computed: {
  40. formItems() {
  41. return [
  42. {
  43. name: 'el-input',
  44. md: 6,
  45. attributes: { disabled: true, placeholder: '-' },
  46. formItemAttributes: { label: '申请单号', prop: 'id' }
  47. },
  48. {
  49. name: 'slot-component',
  50. md: 6,
  51. formItemAttributes: { label: '申请状态', prop: 'status' },
  52. render: (h, { props, onInput }) => {
  53. var { value } = props
  54. return (
  55. <el-input
  56. disabled={true}
  57. value={{ ING: '申请中', END: '到货反馈', CANCEL: '取消申请' }[value]}
  58. placeholder=""
  59. ></el-input>
  60. )
  61. }
  62. },
  63. {
  64. name: 'el-input',
  65. md: 6,
  66. attributes: { disabled: true, placeholder: '-' },
  67. formItemAttributes: { label: '申请人', prop: 'createBy' }
  68. },
  69. {
  70. name: 'el-input',
  71. md: 6,
  72. attributes: { disabled: true, placeholder: '-' },
  73. formItemAttributes: { label: '申请时间', prop: 'createTime' }
  74. },
  75. {
  76. name: 'el-input',
  77. md: 6,
  78. attributes: { disabled: true, placeholder: '-' },
  79. formItemAttributes: { label: '取消人', prop: 'cancelBy' }
  80. },
  81. {
  82. name: 'el-input',
  83. md: 6,
  84. attributes: { disabled: true, placeholder: '-' },
  85. formItemAttributes: { label: '取消时间', prop: 'cancelTime' }
  86. },
  87. {
  88. name: 'el-input',
  89. md: 6,
  90. attributes: { disabled: true, placeholder: '-' },
  91. formItemAttributes: { label: '反馈人', prop: 'confirmBy' }
  92. },
  93. {
  94. name: 'el-input',
  95. md: 6,
  96. attributes: { disabled: true, placeholder: '-' },
  97. formItemAttributes: { label: '反馈时间', prop: 'confirmTime' }
  98. },
  99. {
  100. name: 'el-input',
  101. md: 24,
  102. attributes: {
  103. disabled: true,
  104. type: 'textarea',
  105. rows: 2,
  106. placeholder: '-'
  107. },
  108. formItemAttributes: {
  109. label: '备注',
  110. prop: 'remark'
  111. }
  112. },
  113. {
  114. name: 'slot-component',
  115. md: 24,
  116. formItemAttributes: { label: '配件信息', prop: 'items' },
  117. render: (h, { props, onInput }) => {
  118. var { value } = props
  119. console.log(value)
  120. return this.convertTableJson(
  121. value,
  122. [
  123. {
  124. columnAttributes: {
  125. label: '配件名称',
  126. prop: 'name',
  127. propName: 'name'
  128. },
  129. editRender: (h, { row, column, index }) => {
  130. return (
  131. <div class="redbordererr">
  132. <el-form-item label="" label-width="0px">
  133. <el-input
  134. value={row[column.columnAttributes.prop]}
  135. onInput={val => {
  136. row[column.columnAttributes.prop] = val
  137. }}
  138. placeholder="请输入内容"
  139. ></el-input>
  140. </el-form-item>
  141. </div>
  142. )
  143. },
  144. viewRender: (h, { row, column, index }) => {
  145. return <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
  146. }
  147. },
  148. {
  149. columnAttributes: {
  150. label: '数量',
  151. prop: 'qty',
  152. propName: 'qty'
  153. },
  154. editRender: (h, { row, column, index }) => {
  155. return (
  156. <div class="redbordererr">
  157. <el-form-item label="" label-width="0px">
  158. <el-input
  159. value={row[column.columnAttributes.prop]}
  160. onInput={val => {
  161. row[column.columnAttributes.prop] = val
  162. }}
  163. placeholder="请输入内容"
  164. type="number"
  165. ></el-input>
  166. </el-form-item>
  167. </div>
  168. )
  169. },
  170. viewRender: (h, { row, column, index }) => {
  171. return <div style="padding-left:10px">{row[column.columnAttributes.prop]}</div>
  172. }
  173. }
  174. ],
  175. {
  176. isEdit: this.item.status == 'ING',
  177. isAdd: false,
  178. isDel: false // this.item.status == "ING",
  179. },
  180. {
  181. confirm: ({ row, column, index }) => {
  182. orderPartsApplyItemModify({ ...row }).then(res => {
  183. this.isEditTableIndex = -1
  184. this.$message({
  185. type: 'success',
  186. message: '保存成功'
  187. })
  188. })
  189. },
  190. delete: ({ row, column, index }, cb) => {
  191. orderPartsApplyItemDel({ ...row }).then(res => {
  192. this.$message({
  193. type: 'success',
  194. message: '删除成功'
  195. })
  196. cb && cb()
  197. })
  198. }
  199. }
  200. )
  201. }
  202. }
  203. ]
  204. }
  205. },
  206. methods: {
  207. quxiao() {
  208. this.$confirm('是否确认取消?', '提示', {
  209. confirmButtonText: '确定',
  210. cancelButtonText: '取消',
  211. type: 'warning'
  212. })
  213. .then(() => {
  214. orderPartsApplyCancel({
  215. id: this.item.id
  216. }).then(res => {
  217. this.$message({
  218. type: 'success',
  219. message: '取消成功'
  220. })
  221. this.$emit('shuaxin')
  222. })
  223. })
  224. .catch(() => {})
  225. },
  226. daohuo() {
  227. this.$confirm('是否确认反馈?', '提示', {
  228. confirmButtonText: '确定',
  229. cancelButtonText: '取消',
  230. type: 'warning'
  231. })
  232. .then(() => {
  233. orderPartsApplyEnd({
  234. id: this.item.id
  235. }).then(res => {
  236. this.$message({
  237. type: 'success',
  238. message: '反馈成功'
  239. })
  240. this.$emit('shuaxin')
  241. })
  242. })
  243. .catch(() => {})
  244. }
  245. }
  246. }
  247. </script>
  248. <style lang="scss" scoped></style>