89a5f355c19459d921e1a11bb171193f6e4ce3ac.svn-base 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <j-modal
  3. :title="title"
  4. :width="width"
  5. :visible="visible"
  6. :confirmLoading="confirmLoading"
  7. switchFullscreen
  8. @ok="handleOk"
  9. @cancel="handleCancel"
  10. cancelText="关闭">
  11. <a-spin :spinning="confirmLoading">
  12. <a-form-model ref="form" :model="model" :rules="validatorRules">
  13. <a-row>
  14. <a-col :span="24">
  15. <a-form-model-item label="任务类别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="rwlb">
  16. <j-dict-select-tag type="list" v-model="model.rwlb" dictCode="rwlb" placeholder="请选择任务类别" />
  17. </a-form-model-item>
  18. </a-col>
  19. <a-col :span="24">
  20. <a-form-model-item label="任务子任务" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="rwzrw">
  21. <j-dict-select-tag type="list" v-model="model.rwzrw" dictCode="rwzrw" placeholder="请选择任务子任务" />
  22. </a-form-model-item>
  23. </a-col>
  24. <a-col :span="24">
  25. <a-form-model-item label="总任务" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zrw">
  26. <a-input v-model="model.zrw"placeholder="请输入总任务" ></a-input>
  27. </a-form-model-item>
  28. </a-col>
  29. <a-col :span="24">
  30. <a-form-model-item label="第一年度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dynd">
  31. <a-input v-model="model.dynd"placeholder="请输入第一年度" ></a-input>
  32. </a-form-model-item>
  33. </a-col>
  34. <a-col :span="24">
  35. <a-form-model-item label="第二年度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dernd">
  36. <a-input v-model="model.dernd"placeholder="请输入第二年度" ></a-input>
  37. </a-form-model-item>
  38. </a-col>
  39. <a-col :span="24">
  40. <a-form-model-item label="第三年度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dsnd">
  41. <a-input v-model="model.dsnd"placeholder="请输入第三年度" ></a-input>
  42. </a-form-model-item>
  43. </a-col>
  44. <a-col :span="24">
  45. <a-form-model-item label="责任部门" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zrbm">
  46. <a-input v-model="model.zrbm"placeholder="请输入责任部门" ></a-input>
  47. </a-form-model-item>
  48. </a-col>
  49. <a-col :span="24">
  50. <a-form-model-item label="意见/备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="yjbz">
  51. <a-input v-model="model.yjbz"placeholder="请输入意见/备注" ></a-input>
  52. </a-form-model-item>
  53. </a-col>
  54. </a-row>
  55. </a-form-model>
  56. </a-spin>
  57. </j-modal>
  58. </template>
  59. <script>
  60. import { httpAction } from '@/api/manage'
  61. import { validateDuplicateValue } from '@/utils/util'
  62. export default {
  63. name: "RmRwqdModal",
  64. components: {
  65. },
  66. props:{
  67. mainId:{
  68. type:String,
  69. required:false,
  70. default:''
  71. }
  72. },
  73. data () {
  74. return {
  75. title:"操作",
  76. width:800,
  77. visible: false,
  78. model:{
  79. },
  80. labelCol: {
  81. xs: { span: 24 },
  82. sm: { span: 5 },
  83. },
  84. wrapperCol: {
  85. xs: { span: 24 },
  86. sm: { span: 16 },
  87. },
  88. confirmLoading: false,
  89. validatorRules: {
  90. },
  91. url: {
  92. add: "/hzz.yhyc/rmJbxx/addRmRwqd",
  93. edit: "/hzz.yhyc/rmJbxx/editRmRwqd",
  94. }
  95. }
  96. },
  97. created () {
  98. //备份model原始值
  99. this.modelDefault = JSON.parse(JSON.stringify(this.model));
  100. },
  101. methods: {
  102. add () {
  103. this.edit(this.modelDefault);
  104. },
  105. edit (record) {
  106. this.model = Object.assign({}, record);
  107. this.visible = true;
  108. },
  109. close () {
  110. this.$emit('close');
  111. this.visible = false;
  112. this.$refs.form.clearValidate();
  113. },
  114. handleOk () {
  115. const that = this;
  116. // 触发表单验证
  117. this.$refs.form.validate(valid => {
  118. if (valid) {
  119. that.confirmLoading = true;
  120. let httpurl = '';
  121. let method = '';
  122. if(!this.model.id){
  123. httpurl+=this.url.add;
  124. method = 'post';
  125. }else{
  126. httpurl+=this.url.edit;
  127. //method = 'put';
  128. method = 'post';
  129. }
  130. this.model['mainId'] = this.mainId
  131. httpAction(httpurl,this.model,method).then((res)=>{
  132. if(res.success){
  133. that.$message.success(res.message);
  134. that.$emit('ok');
  135. }else{
  136. that.$message.warning(res.message);
  137. }
  138. }).finally(() => {
  139. that.confirmLoading = false;
  140. that.close();
  141. })
  142. }else{
  143. return false
  144. }
  145. })
  146. },
  147. handleCancel () {
  148. this.close()
  149. },
  150. }
  151. }
  152. </script>