associationManage.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <el-dialog
  3. title="协会管理"
  4. :visible.sync="dialogVisible"
  5. :close-on-click-modal="false"
  6. :close-on-press-escape="false"
  7. @close="handleClose"
  8. width="600px"
  9. >
  10. <el-form
  11. ref="baseForm"
  12. class="base-form"
  13. label-position="right"
  14. label-width="95px"
  15. :model="baseForm"
  16. :rules="rules"
  17. size="small"
  18. >
  19. <el-row :gutter="10">
  20. <el-col :span="24">
  21. <el-form-item label="协会名称:" prop="productName">
  22. <el-row :gutter="5">
  23. <el-col :span="23">
  24. <el-input
  25. type="input"
  26. :autosize="{ minRows: 2}"
  27. placeholder="请输入协会名称"
  28. v-model="textarea">
  29. </el-input>
  30. </el-col>
  31. </el-row>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="24">
  35. <el-form-item label="管辖范围:" prop="sourceinfoId">
  36. <el-row :gutter="5">
  37. <el-col :span="23">
  38. <el-select
  39. v-model="baseForm.sourceinfoId"
  40. filterable
  41. style="width: 100%"
  42. placeholder="请选择管辖范围"
  43. >
  44. <el-option
  45. v-for="item in syinfoList"
  46. :key="item.id"
  47. :label="item.sourceinfoName"
  48. :value="item.sourceinfoId"
  49. >
  50. </el-option>
  51. </el-select>
  52. <div class="areatText" type="">
  53. <el-tag closable>
  54. 标签一
  55. </el-tag>
  56. <el-tag closable>
  57. 标签一
  58. </el-tag>
  59. <el-tag closable>
  60. 标签一
  61. </el-tag>
  62. </div>
  63. </el-col>
  64. </el-row>
  65. </el-form-item>
  66. </el-col>
  67. </el-row>
  68. <el-row :gutter="10">
  69. <el-col :span="14">
  70. <el-form-item label="负责人:" prop="stockAmount">
  71. <el-row :gutter="5">
  72. <el-col :span="23">
  73. <el-select
  74. v-model="baseForm.sourceinfoId"
  75. filterable
  76. style="width: 100%"
  77. placeholder="请选择负责人"
  78. >
  79. <el-option
  80. v-for="item in syinfoList"
  81. :key="item.id"
  82. :label="item.sourceinfoName"
  83. :value="item.sourceinfoId"
  84. >
  85. </el-option>
  86. </el-select>
  87. </el-col>
  88. </el-row>
  89. </el-form-item>
  90. </el-col>
  91. </el-row>
  92. <el-row :gutter="10">
  93. <el-col :span="24">
  94. <el-form-item label="协会介绍:" prop="supplierId">
  95. <el-row :gutter="5">
  96. <el-col :span="23">
  97. <el-input
  98. type="textarea"
  99. :autosize="{ minRows: 4}"
  100. placeholder="请输入协会介绍"
  101. maxlength="500"
  102. show-word-limit
  103. v-model="textarea" />
  104. </el-col>
  105. </el-row>
  106. </el-form-item>
  107. </el-col>
  108. </el-row>
  109. </el-form>
  110. <div style="text-align: right">
  111. <el-button type="info" plain @click="resetForm('baseForm')"
  112. >取消</el-button
  113. >
  114. <el-button
  115. type="primary"
  116. style="margin-left:16px;"
  117. @click="submitForm('baseForm')"
  118. :disabled="dialogSubmitLoading"
  119. :loading="dialogSubmitLoading"
  120. >确定</el-button
  121. >
  122. </div>
  123. </el-dialog>
  124. </template>
  125. <script>
  126. import { assign } from 'lodash-es';
  127. import { UPLOAD_TYPE_MAP } from '@/utils/constants';
  128. export default {
  129. name:'associationManage',
  130. props: {
  131. data: {
  132. default() {
  133. return {};
  134. }
  135. },
  136. visible: {
  137. type: Boolean,
  138. default: false
  139. }
  140. },
  141. data() {
  142. return {
  143. imageUploadType: UPLOAD_TYPE_MAP.FARMING_RECORD,
  144. dialogSubmitLoading: false,
  145. dialogVisible: false,
  146. textareaArea: '',
  147. baseForm: {
  148. productValue: '',
  149. productName: '',
  150. stockAmount: '',
  151. goodsUnit: '',
  152. goodsSpecValue: '',
  153. imageArr1: [],
  154. supplierId: '',
  155. imageArr2: []
  156. },
  157. productList: [],
  158. syinfoList: [],
  159. processList: [],
  160. hasFetched: false,
  161. landList: [], //基地列表
  162. rules: {
  163. stockAmount: [
  164. { required: true, message: '请选择负责人', trigger: 'blur' }
  165. ],
  166. sourceinfoId: [
  167. { required: true, message: '请选择管辖范围', trigger: 'blur' }
  168. ],
  169. productName: [
  170. { required: true, message: '请输入协会名称', trigger: 'blur' }
  171. ],
  172. supplierId: [
  173. { required: false, message: '请输入协会介绍', trigger: 'blur' }
  174. ],
  175. goodsSpecValue: [
  176. { required: true, message: '请选择规格', trigger: 'blur' }
  177. ]
  178. }
  179. };
  180. },
  181. watch: {
  182. visible(val) {
  183. if (val !== this.dialogVisible) {
  184. this.dialogVisible = val;
  185. if (val) {
  186. assign(this.baseForm, this.data);
  187. if (!this.hasFetched) {
  188. this.hasFetched = true;
  189. }
  190. }
  191. }
  192. },
  193. data: {
  194. deep: true,
  195. handler(val) {
  196. assign(this.baseForm, val);
  197. }
  198. }
  199. },
  200. methods: {
  201. resetForm(formName) {
  202. this.$refs[formName].resetFields();
  203. this.resetFormData();
  204. this.dialogVisible = false;
  205. },
  206. resetFormData() {
  207. this.baseForm = {};
  208. },
  209. submitForm(formName) {
  210. this.$refs[formName].validate((valid) => {
  211. console.log(valid)
  212. })
  213. },
  214. handleClose() {
  215. this.$emit('update:visible', false);
  216. this.resetForm('baseForm');
  217. },
  218. }
  219. };
  220. </script>
  221. <style lang="scss" scoped>
  222. ::v-deep .el-tag{
  223. margin-right: 5px;
  224. }
  225. .areatText{
  226. width: 100%;
  227. height: 100px;
  228. border:1px solid #DCDFE6;
  229. margin-top: 10px;
  230. padding:2% 3%;
  231. }
  232. .input-number {
  233. width: 100%;
  234. }
  235. .base-form {
  236. max-height: 70vh;
  237. overflow-y: auto;
  238. overflow-x: hidden;
  239. padding: 0 20px;
  240. }
  241. </style>
  242. <style lang="css" scoped>
  243. ::v-deep .el-dialog__header {
  244. border-bottom: 1px solid #ebeef5;
  245. }
  246. </style>