c93c71a6d2200d317192c36d0b2c049d7003d9f6.svn-base 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <a-spin :spinning="confirmLoading">
  3. <j-form-container :disabled="formDisabled">
  4. <!-- 主表单区域 -->
  5. <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
  6. <a-row>
  7. <a-col :span="12">
  8. <a-form-model-item label="项目名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xmmc">
  9. <a-input v-model="model.xmmc" placeholder="请输入项目名称"></a-input>
  10. </a-form-model-item>
  11. </a-col>
  12. <a-col :span="12">
  13. <a-form-model-item label="所在水系" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="szsx">
  14. <j-dict-select-tag type="list" v-model="model.szsx" dictCode="shuixi"
  15. placeholder="请选择所在水系"/>
  16. </a-form-model-item>
  17. </a-col>
  18. <a-col :span="12">
  19. <a-form-model-item label="行政区划" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xzqh">
  20. <j-area-linkage type="cascader" v-model="model.xzqh" placeholder="请输入省市区"/>
  21. </a-form-model-item>
  22. </a-col>
  23. <a-col :span="12">
  24. <a-form-model-item label="项目负责人" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xmfzr">
  25. <a-input v-model="model.xmfzr" placeholder="请输入项目负责人"></a-input>
  26. </a-form-model-item>
  27. </a-col>
  28. <a-col :span="12">
  29. <a-form-model-item label="县级区划代码" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="xjqhdm">
  30. <a-input v-model="model.xjqhdm" placeholder="请输入县级区划代码"></a-input>
  31. </a-form-model-item>
  32. </a-col>
  33. <a-col :span="12">
  34. <a-form-model-item label="横坐标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="hzb">
  35. <a-input v-model="model.hzb" placeholder="请输入横坐标"></a-input>
  36. </a-form-model-item>
  37. </a-col>
  38. <a-col :span="12">
  39. <a-form-model-item label="纵坐标" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="zzb">
  40. <a-input v-model="model.zzb" placeholder="请输入纵坐标"></a-input>
  41. </a-form-model-item>
  42. </a-col>
  43. <a-col :span="12">
  44. <a-form-model-item label="电话" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="dha">
  45. <a-input v-model="model.dha" placeholder="请输入电话"></a-input>
  46. </a-form-model-item>
  47. </a-col>
  48. <a-col :span="12">
  49. <a-form-model-item label="立项情况" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="lxqk">
  50. <a-input v-model="model.lxqk" placeholder="请输入立项情况"></a-input>
  51. </a-form-model-item>
  52. </a-col>
  53. <a-col :span="12">
  54. <a-form-model-item label="审批年度" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spnd">
  55. <j-date placeholder="请选择审批年度" v-model="model.spnd" style="width: 100%"/>
  56. </a-form-model-item>
  57. </a-col>
  58. <a-col :span="12">
  59. <a-form-model-item label="防洪标准" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fhbz">
  60. <a-input v-model="model.fhbz" placeholder="请输入防洪标准"></a-input>
  61. </a-form-model-item>
  62. </a-col>
  63. <a-col :span="12">
  64. <a-form-model-item label="审批单位" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spdw">
  65. <a-input v-model="model.spdw" placeholder="请输入审批单位"></a-input>
  66. </a-form-model-item>
  67. </a-col>
  68. <a-col :span="12">
  69. <a-form-model-item label="审批级别" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spjb">
  70. <a-input v-model="model.spjb" placeholder="请输入审批级别"></a-input>
  71. </a-form-model-item>
  72. </a-col>
  73. <a-col :span="12">
  74. <a-form-model-item label="审批情况" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="spqk">
  75. <j-dict-select-tag type="list" v-model="model.spqk" dictCode="spzt" placeholder="请选择审批情况"/>
  76. </a-form-model-item>
  77. </a-col>
  78. <a-col :span="12">
  79. <a-form-model-item label="总体布置简述" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ztbzjs">
  80. <a-textarea v-model="model.ztbzjs" placeholder="请输入总体布置简述" rows="4"></a-textarea>
  81. </a-form-model-item>
  82. </a-col>
  83. <a-col :span="12">
  84. <a-form-model-item label="建设状态" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="jszt">
  85. <j-dict-select-tag type="list" v-model="model.jszt" dictCode="gcjsqk"
  86. placeholder="请选择建设状态"/>
  87. </a-form-model-item>
  88. </a-col>
  89. <a-col :span="12">
  90. <a-form-model-item label="其他" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="qt">
  91. <a-textarea v-model="model.qt" placeholder="请输入其他" rows="4"></a-textarea>
  92. </a-form-model-item>
  93. </a-col>
  94. </a-row>
  95. <div v-for="user in obj1" :key="user.id">
  96. <a-divider dashed>涉河工程信息</a-divider>
  97. <a-col :span="6">
  98. <a-form-model-item label="涉河工程名称" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fhbzXz">
  99. <a-input v-model="user.gcmc" placeholder="请输入涉河工程名称"></a-input>
  100. </a-form-model-item>
  101. </a-col>
  102. <a-col :span="6">
  103. <a-form-model-item label="涉河类型" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fhbzSj">
  104. <j-category-select placeholder="请选择涉河类型" v-model="user.shlx" pcode="A02"/>
  105. </a-form-model-item>
  106. </a-col>
  107. <a-col :span="6">
  108. <a-form-model-item label="所在河道" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fhbzGh">
  109. <a-input v-model="user.sjhd" placeholder="请输入所在河道"></a-input>
  110. </a-form-model-item>
  111. </a-col>
  112. <a-col :span="6">
  113. <a-form-model-item label="位置信息" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="fhbzGh">
  114. <a-input v-model="user.jd+','+user.wd" placeholder="请输入位置信息"></a-input>
  115. </a-form-model-item>
  116. </a-col>
  117. </div>
  118. </a-form-model>
  119. </j-form-container>
  120. <!-- 子表单区域 -->
  121. <a-tabs v-model="activeKey" @change="handleChangeTabs">
  122. <a-tab-pane tab="监管记录" :key="refKeys[0]" :forceRender="true">
  123. <j-editable-table
  124. :ref="refKeys[0]"
  125. :loading="rmJgjlTable.loading"
  126. :columns="rmJgjlTable.columns"
  127. :dataSource="rmJgjlTable.dataSource"
  128. :maxHeight="300"
  129. :disabled="formDisabled"
  130. :rowNumber="true"
  131. :rowSelection="true"
  132. :actionButton="true"/>
  133. </a-tab-pane>
  134. </a-tabs>
  135. </a-spin>
  136. </template>
  137. <script>
  138. import {postAction, getAction} from '@/api/manage'
  139. import {FormTypes, getRefPromise, VALIDATE_NO_PASSED} from '@/utils/JEditableTableUtil'
  140. import {JEditableTableModelMixin} from '@/mixins/JEditableTableModelMixin'
  141. import {validateDuplicateValue} from '@/utils/util'
  142. export default {
  143. name: 'RmXmxxForm',
  144. mixins: [JEditableTableModelMixin],
  145. components: {},
  146. data() {
  147. return {
  148. labelCol: {
  149. xs: {span: 24},
  150. sm: {span: 6},
  151. },
  152. wrapperCol: {
  153. xs: {span: 24},
  154. sm: {span: 16},
  155. },
  156. labelCol2: {
  157. xs: {span: 24},
  158. sm: {span: 3},
  159. },
  160. wrapperCol2: {
  161. xs: {span: 24},
  162. sm: {span: 20},
  163. },
  164. model: {},
  165. obj1: [],
  166. // 新增时子表默认添加几行空数据
  167. addDefaultRowNum: 1,
  168. validatorRules: {},
  169. refKeys: ['rmJgjl',],
  170. tableKeys: ['rmJgjl',],
  171. activeKey: 'rmJgjl',
  172. // 监管记录
  173. rmJgjlTable: {
  174. loading: false,
  175. dataSource: [],
  176. columns: [
  177. {
  178. title: '项目名称',
  179. key: 'jcmc',
  180. type: FormTypes.input,
  181. width: "200px",
  182. placeholder: '请输入${title}',
  183. defaultValue: '',
  184. },
  185. {
  186. title: '日期',
  187. key: 'jcsj',
  188. type: FormTypes.date,
  189. width: "200px",
  190. placeholder: '请输入${title}',
  191. defaultValue: '',
  192. },
  193. {
  194. title: '监管单位',
  195. key: 'jgdw',
  196. type: FormTypes.input,
  197. width: "200px",
  198. placeholder: '请输入${title}',
  199. defaultValue: '',
  200. },
  201. {
  202. title: '监管负责人',
  203. key: 'jgfzr',
  204. type: FormTypes.input,
  205. width: "200px",
  206. placeholder: '请输入${title}',
  207. defaultValue: '',
  208. },
  209. {
  210. title: '存在问题及处理情况',
  211. key: 'czwtjclqk',
  212. type: FormTypes.input,
  213. width: "200px",
  214. placeholder: '请输入${title}',
  215. defaultValue: '',
  216. },
  217. ]
  218. },
  219. url: {
  220. add: "/hzz.shjsgc.xmxx/rmXmxx/add",
  221. edit: "/hzz.shjsgc.xmxx/rmXmxx/edit",
  222. queryById: "/hzz.shjsgc.xmxx/rmXmxx/queryById",
  223. SelectById: "/hzz.shjsgc.xmxx/rmXmxx/SelectById",
  224. rmJgjl: {
  225. list: '/hzz.shjsgc.xmxx/rmXmxx/queryRmJgjlByMainId'
  226. },
  227. }
  228. }
  229. },
  230. props: {
  231. //表单禁用
  232. disabled: {
  233. type: Boolean,
  234. default: false,
  235. required: false
  236. }
  237. },
  238. computed: {
  239. formDisabled() {
  240. return this.disabled
  241. },
  242. },
  243. created() {
  244. },
  245. mounted() {
  246. // this.SelectById();
  247. },
  248. methods: {
  249. addBefore() {
  250. this.rmJgjlTable.dataSource = []
  251. },
  252. getAllTable() {
  253. let values = this.tableKeys.map(key => getRefPromise(this, key))
  254. return Promise.all(values)
  255. },
  256. /** 调用完edit()方法之后会自动调用此方法 */
  257. editAfter() {
  258. this.SelectById();
  259. this.$nextTick(() => {
  260. })
  261. // 加载子表数据
  262. if (this.model.id) {
  263. let params = {id: this.model.id}
  264. this.requestSubTableData(this.url.rmJgjl.list, params, this.rmJgjlTable)
  265. }
  266. },
  267. //校验所有一对一子表表单
  268. validateSubForm(allValues) {
  269. return new Promise((resolve, reject) => {
  270. Promise.all([]).then(() => {
  271. resolve(allValues)
  272. }).catch(e => {
  273. if (e.error === VALIDATE_NO_PASSED) {
  274. // 如果有未通过表单验证的子表,就自动跳转到它所在的tab
  275. this.activeKey = e.index == null ? this.activeKey : this.refKeys[e.index]
  276. } else {
  277. console.error(e)
  278. }
  279. })
  280. })
  281. },
  282. /** 整理成formData */
  283. classifyIntoFormData(allValues) {
  284. let main = Object.assign(this.model, allValues.formValue)
  285. return {
  286. ...main, // 展开
  287. rmJgjlList: allValues.tablesValue[0].values,
  288. }
  289. },
  290. validateError(msg) {
  291. this.$message.error(msg)
  292. },
  293. SelectById() {
  294. getAction(this.url.SelectById, {id: this.model.id}).then((res) => {
  295. let arr = res.result
  296. this.obj1 = arr
  297. // this.loadData()
  298. console.log("结果:", this.obj1)
  299. })
  300. },
  301. }
  302. }
  303. </script>
  304. <style scoped>
  305. </style>