formModule.vue 6.8 KB

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