移动端
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

projectEdit.vue 10 KiB

hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
hace 2 años
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <template>
  2. <div class="home_wrapper">
  3. <!-- 头部开始 -->
  4. <van-nav-bar
  5. title="修改服务项目"
  6. fixed
  7. placeholder
  8. left-arrow
  9. @click-left="onClickLeft"
  10. />
  11. <!-- 头部结束 -->
  12. <!-- 内容开始 -->
  13. <van-form @submit="submitForm" ref="formData" show-error :show-error-message="false">
  14. <div class="main">
  15. <van-field label="产品名称" required :rules="[{ required: true }]" v-model="supplyDemand.supplyDemandName" input-align="right" placeholder="请输入产品名称" />
  16. <!-- <van-field label="产品类型" v-model="supplyDemand.productType" input-align="right" placeholder="请输入产品类型" />-->
  17. <van-field
  18. readonly
  19. clickable
  20. required
  21. :rules="[{ required: true , message:'请选择产品类型'}]"
  22. v-model="productType"
  23. label="产品类型"
  24. placeholder="请选择产品类型"
  25. @click="showProductType = true"
  26. input-align="right"
  27. right-icon="arrow-down"
  28. label-width="auto"
  29. />
  30. <van-popup v-model="showProductType" round position="bottom">
  31. <!-- v-model="cascaderValue"-->
  32. <van-cascader
  33. title="请选择产品类型"
  34. :options="productList"
  35. @close="showProductType = false"
  36. @finish="onConfirmProductType"
  37. :field-names="fieldNames"
  38. />
  39. </van-popup>
  40. <!-- <van-field label="二级分类" v-model="supplyDemand.supplyDemandType" input-align="right" placeholder="请输入二级分类" />-->
  41. <van-field label="产品规格" v-model="supplyDemand.specification" input-align="right" placeholder="请输入产品规格" />
  42. <!-- <van-field label="所属主体" v-model="supplyDemand.bodyType" input-align="right" placeholder="请输入所属主体" />-->
  43. <!-- <van-field-->
  44. <!-- readonly-->
  45. <!-- clickable-->
  46. <!-- required-->
  47. <!-- :rules="[{ required: true , message:'请选择所属主体'}]"-->
  48. <!-- v-model="bodyType"-->
  49. <!-- label="所属主体"-->
  50. <!-- placeholder="请选择所属主体"-->
  51. <!-- @click="showBodyType = true"-->
  52. <!-- input-align="right"-->
  53. <!-- right-icon="arrow-down"-->
  54. <!-- label-width="auto"-->
  55. <!-- />-->
  56. <!-- <van-popup v-model="showBodyType" position="bottom">-->
  57. <!-- <van-picker-->
  58. <!-- show-toolbar-->
  59. <!-- :columns="projectTypeOptions"-->
  60. <!-- @confirm="onConfirmProjectType"-->
  61. <!-- @cancel="showBodyType = false"-->
  62. <!-- />-->
  63. <!-- </van-popup>-->
  64. <van-field
  65. readonly
  66. clickable
  67. required
  68. :rules="[{ required: true , message:'请选择所属主体'}]"
  69. v-model="supplyDemand.entityName"
  70. label="所属主体"
  71. placeholder="请选择所属主体"
  72. @click="showBodyType = true"
  73. input-align="right"
  74. right-icon="arrow-down"
  75. label-width="auto"
  76. />
  77. <van-popup v-model="showBodyType" position="bottom">
  78. <van-picker
  79. show-toolbar
  80. :columns="detailListOptions"
  81. value-key="entityName"
  82. @confirm="onConfirmProjectType"
  83. @cancel="showBodyType = false"
  84. />
  85. </van-popup>
  86. <!-- <van-field label="所属主体" required :rules="[{ required: true }]" v-model="supplyDemand.entityName" input-align="right" placeholder="请输入所属主体" />-->
  87. <van-field label="单价" required :rules="[{ required: true }]" v-model="supplyDemand.unitPrice" input-align="right" placeholder="请输入单价" />
  88. <van-field label="数量" v-model="supplyDemand.number" input-align="right" placeholder="请输入数量" />
  89. <van-field label="单位" required :rules="[{ required: true }]" v-model="supplyDemand.unit" input-align="right" placeholder="请输入单位" />
  90. <van-field label="联系电话" required :rules="[{ required: true }]" v-model="supplyDemand.supplyDemandTal" input-align="right" placeholder="请输入联系电话" />
  91. <van-field label="联系人" required :rules="[{ required: true }]" v-model="supplyDemand.linker" input-align="right" placeholder="请输入联系人" />
  92. <van-field label="地址" v-model="supplyDemand.address" input-align="right" placeholder="请输入地址" />
  93. <van-field label="简介" required :rules="[{ required: true }]" v-model="supplyDemand.introduction" input-align="right" placeholder="请输入简介" />
  94. <van-field label="详情" v-model="supplyDemand.particulars" input-align="right" placeholder="请输入详情" />
  95. <van-field label="图片" readonly :border="false" input-align="right" />
  96. <div style="padding: 0 4% 2vh;">
  97. <van-uploader v-model="supplyDemand.supplyMasterMapList" :after-read="afterReadEvidenceForm" :before-delete="deleteFileEvidenceForm" />
  98. </div>
  99. </div>
  100. <div class="main">
  101. <baidu-map :center="center" panBy="[50,50]" :zoom="zoom" :scroll-wheel-zoom="true" :pinch-to-zoom="true" map-type="BMAP_NORMAL_MAP" style="height:25vh" >
  102. <!-- 必须给容器指高度,不然地图将显示在一个高度为0的容器中,看不到 -->
  103. <bm-marker :position="center" :dragging="true" animation="BMAP_ANIMATION_BOUNCE" :icon="{url: '../../../../static/images/lawEnforcement/new/address.gif', size: {width: 50, height: 50}}"></bm-marker>
  104. </baidu-map>
  105. </div>
  106. <div class="main_btn">
  107. <p @click="publishStatus = '3',$refs.formData.submit()">发布</p>
  108. <p @click="publishStatus = '2',$refs.formData.submit()">存稿</p>
  109. </div>
  110. </van-form>
  111. <!-- 内容结束 -->
  112. </div>
  113. </template>
  114. <script>
  115. import Cookies from "js-cookie";
  116. import {
  117. supplyDemandGet,
  118. productTypes,
  119. commonUpload,
  120. supplyDemandEdit,
  121. supplyDemandAdd, detailList
  122. } from "@/api/agriculturalTrusteeship";
  123. export default {
  124. name: "agriculturalTrusteeshipSocializationRelease",
  125. data() {
  126. return {
  127. activeKey: 0,
  128. active: 0,
  129. loading: false,
  130. finished: false,
  131. showProductType: false,
  132. showBodyType: false,
  133. center: { lng: 122.089726, lat: 37.540728 }, //经纬度
  134. zoom: 15, //地图展示级别
  135. showDialog:false,
  136. supplyDemand:{},
  137. productType:'',
  138. bodyType:'',
  139. projectTypeOptions:[],
  140. productList:[],
  141. productList1:[],
  142. demandTypeOptions:[],
  143. productTypeOptions:[],
  144. supplyMasterMapArr:[],
  145. bodyTypeOptions:[],
  146. fieldNames : {
  147. text: 'dictName',
  148. value: 'id',
  149. children: 'children',
  150. },
  151. publishStatus:'',
  152. detailListOptions:[]
  153. };
  154. },
  155. created() {
  156. let query = {
  157. parentId : null,
  158. tree:true
  159. }
  160. let query1 = {
  161. tree : false
  162. }
  163. productTypes(query).then(response => {
  164. this.productList = response.data;
  165. });
  166. productTypes(query1).then(response => {
  167. this.productList1 = response.data;
  168. });
  169. this.getDicts("newBusinessEntity_statistics_project").then(response => {
  170. for (var i = 0; i < response.data.length; i++) {
  171. this.projectTypeOptions.push({text: response.data[i].dictLabel, value: response.data[i].dictValue});
  172. }
  173. this.bodyTypeOptions = response.data;
  174. });
  175. detailList().then(res=>{
  176. if (res.code == 200) {
  177. this.detailListOptions = res.rows;
  178. }
  179. })
  180. this.getDetail();
  181. },
  182. methods: {
  183. getDetail(){
  184. supplyDemandGet(this.$route.query.id).then(response => {
  185. this.bodyType = this.selectDictLabel(this.bodyTypeOptions, response.data.bodyType);
  186. var that = this ;
  187. setTimeout(function () {
  188. that.productType = that.productList1.filter(function (e) { return e.id == response.data.productType; })[0].dictName;
  189. },1000)
  190. if (response.data.supplyMasterMap){
  191. response.data.supplyMasterMapList = [];
  192. var attachement = response.data.supplyMasterMap.split( "," );
  193. this.supplyMasterMapArr = response.data.supplyMasterMap.split( "," );
  194. attachement.forEach(responseAttach=>{
  195. response.data.supplyMasterMapList.push({
  196. url:'/api' + responseAttach,
  197. isImage: true
  198. });
  199. })
  200. }
  201. this.supplyDemand = response.data;
  202. });
  203. },
  204. onConfirmProductType({ selectedOptions }){
  205. this.supplyDemand.productType = selectedOptions[selectedOptions.length-1].id;
  206. this.productType = selectedOptions.map((option) => option.dictName).join('/');
  207. this.showProductType = false;
  208. },
  209. onConfirmProjectType(data){
  210. this.supplyDemand.entityName = data.entityName;
  211. this.supplyDemand.entityId = data.id;
  212. this.showBodyType = false;
  213. },
  214. afterReadEvidenceForm(file){
  215. let params1 = new FormData();
  216. params1.append("file", file.file);
  217. commonUpload(params1).then((r1) => {
  218. // this.tEnforceSamplingGoodsList[index].attachement.push(r1.fileName);
  219. console.log(r1)
  220. this.supplyMasterMapArr.push(r1.fileName)
  221. })
  222. },
  223. deleteFileEvidenceForm(file,detail) {
  224. this.supplyMasterMapArr.splice(detail.index,1);
  225. this.supplyDemand.supplyMasterMapList.splice(detail.index,1);
  226. },
  227. submitForm(publishStatus){
  228. this.supplyDemand.supplyMasterMap = this.supplyMasterMapArr.join(',')
  229. this.supplyDemand.supplyDemandType = '1';
  230. this.supplyDemand.publishStatus = this.publishStatus;
  231. supplyDemandEdit(this.supplyDemand).then((res) => {
  232. if(res.code=="200"){
  233. if (this.publishStatus == '3'){
  234. this.$notify({ type: 'success', message: '发布成功' });
  235. }else{
  236. this.$notify({ type: 'success', message: '存稿成功' });
  237. }
  238. setTimeout(function(){
  239. history.back(-1);
  240. },2000)
  241. }
  242. })
  243. },
  244. },
  245. }
  246. </script>
  247. <style scoped lang="scss">
  248. .home_wrapper{
  249. background: #F6F6F6;
  250. min-height: 100vh;
  251. }
  252. .main{
  253. width: 92%;
  254. margin: 0 auto;
  255. margin-top: 2vh;
  256. border-radius: 10PX;
  257. overflow: hidden;
  258. background-color: #FFF;
  259. }
  260. .main_btn{
  261. display: flex;
  262. justify-content: space-around;
  263. padding: 4vh 0;
  264. p{
  265. font-size: .4rem;
  266. width: 35%;
  267. text-align: center;
  268. padding: 10PX 0;
  269. border-radius: 5rem;
  270. box-shadow: 0px 3PX 6PX 0px rgba(0,0,0,0.16);
  271. &:nth-child(1){
  272. background: #334281;
  273. color: #ffffff;
  274. }
  275. &:nth-child(2){
  276. background: #D1D5E4;
  277. color: #334281;
  278. }
  279. }
  280. }
  281. </style>