移动端
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

projectEdit.vue 11 KiB

2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
2 年前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  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. <MapGisTag ref="clickLoading" :showBtn="true" :message="supplyDemand.theGeom" v-on:formSubmit="MapTag"></MapGisTag>
  102. </div>
  103. <div class="main_btn">
  104. <p @click="publishStatus = '3',$refs.formData.submit()">发布</p>
  105. <p @click="publishStatus = '2',$refs.formData.submit()">存稿</p>
  106. </div>
  107. </van-form>
  108. <!-- 内容结束 -->
  109. </div>
  110. </template>
  111. <script>
  112. import Cookies from "js-cookie";
  113. import MapGisTag from "@/components/Map/MapGisTagDTG";
  114. import {
  115. supplyDemandGet,
  116. productTypes,
  117. commonUpload,
  118. supplyDemandEdit,
  119. supplyDemandAdd, detailList
  120. } from "@/api/agriculturalTrusteeship";
  121. export default {
  122. name: "agriculturalTrusteeshipSocializationRelease",
  123. components: {
  124. MapGisTag
  125. },
  126. data() {
  127. return {
  128. activeKey: 0,
  129. active: 0,
  130. loading: false,
  131. finished: false,
  132. showProductType: false,
  133. showBodyType: false,
  134. center: { lng: 122.089726, lat: 37.540728 }, //经纬度
  135. zoom: 15, //地图展示级别
  136. showDialog:false,
  137. supplyDemand:{},
  138. productType:'',
  139. bodyType:'',
  140. projectTypeOptions:[],
  141. productList:[],
  142. productList1:[],
  143. demandTypeOptions:[],
  144. productTypeOptions:[],
  145. supplyMasterMapArr:[],
  146. bodyTypeOptions:[],
  147. fieldNames : {
  148. text: 'dictName',
  149. value: 'id',
  150. children: 'children',
  151. },
  152. publishStatus:'',
  153. detailListOptions:[]
  154. };
  155. },
  156. created() {
  157. let query = {
  158. parentId : null,
  159. tree:true
  160. }
  161. let query1 = {
  162. tree : false
  163. }
  164. productTypes(query).then(response => {
  165. this.productList = response.data;
  166. });
  167. productTypes(query1).then(response => {
  168. this.productList1 = response.data;
  169. });
  170. this.getDicts("newBusinessEntity_statistics_project").then(response => {
  171. for (var i = 0; i < response.data.length; i++) {
  172. this.projectTypeOptions.push({text: response.data[i].dictLabel, value: response.data[i].dictValue});
  173. }
  174. this.bodyTypeOptions = response.data;
  175. });
  176. detailList().then(res=>{
  177. if (res.code == 200) {
  178. this.detailListOptions = res.rows;
  179. }
  180. })
  181. this.getDetail();
  182. },
  183. methods: {
  184. //获取自己返回值
  185. /** 查找地图中定位点 */
  186. MapTag: function (data) {
  187. this.supplyDemand.theGeom = data;
  188. },
  189. //每个查看修改,新增 方法下引用下面方法
  190. mapClickLoading(){
  191. setTimeout(() => {
  192. this.$refs.clickLoading.pointPaceCountryDarw();
  193. }, 500);
  194. },
  195. getDetail(){
  196. supplyDemandGet(this.$route.query.id).then(response => {
  197. this.bodyType = this.selectDictLabel(this.bodyTypeOptions, response.data.bodyType);
  198. var that = this ;
  199. setTimeout(function () {
  200. that.productType = that.productList1.filter(function (e) { return e.id == response.data.productType; })[0].dictName;
  201. },1000)
  202. if (response.data.supplyMasterMap){
  203. response.data.supplyMasterMapList = [];
  204. var attachement = response.data.supplyMasterMap.split( "," );
  205. this.supplyMasterMapArr = response.data.supplyMasterMap.split( "," );
  206. attachement.forEach(responseAttach=>{
  207. response.data.supplyMasterMapList.push({
  208. url:'/api' + responseAttach,
  209. isImage: true
  210. });
  211. })
  212. }
  213. this.supplyDemand = response.data;
  214. this.mapClickLoading();
  215. });
  216. },
  217. onConfirmProductType({ selectedOptions }){
  218. this.supplyDemand.productType = selectedOptions[selectedOptions.length-1].id;
  219. this.productType = selectedOptions.map((option) => option.dictName).join('/');
  220. this.showProductType = false;
  221. },
  222. onConfirmProjectType(data){
  223. this.supplyDemand.entityName = data.entityName;
  224. this.supplyDemand.entityId = data.id;
  225. this.showBodyType = false;
  226. },
  227. afterReadEvidenceForm(file){
  228. let params1 = new FormData();
  229. params1.append("file", file.file);
  230. commonUpload(params1).then((r1) => {
  231. // this.tEnforceSamplingGoodsList[index].attachement.push(r1.fileName);
  232. console.log(r1)
  233. this.supplyMasterMapArr.push(r1.fileName)
  234. })
  235. },
  236. deleteFileEvidenceForm(file,detail) {
  237. this.supplyMasterMapArr.splice(detail.index,1);
  238. this.supplyDemand.supplyMasterMapList.splice(detail.index,1);
  239. },
  240. submitForm(publishStatus){
  241. this.supplyDemand.supplyMasterMap = this.supplyMasterMapArr.join(',')
  242. this.supplyDemand.supplyDemandType = '1';
  243. this.supplyDemand.publishStatus = this.publishStatus;
  244. supplyDemandEdit(this.supplyDemand).then((res) => {
  245. if(res.code=="200"){
  246. if (this.publishStatus == '3'){
  247. this.$notify({ type: 'success', message: '发布成功' });
  248. }else{
  249. this.$notify({ type: 'success', message: '存稿成功' });
  250. }
  251. setTimeout(function(){
  252. history.back(-1);
  253. },2000)
  254. }
  255. })
  256. },
  257. },
  258. }
  259. </script>
  260. <style scoped lang="scss">
  261. .home_wrapper{
  262. background: #F6F6F6;
  263. min-height: 100vh;
  264. }
  265. .main{
  266. width: 92%;
  267. margin: 0 auto;
  268. margin-top: 2vh;
  269. border-radius: 10PX;
  270. overflow: hidden;
  271. background-color: #FFF;
  272. }
  273. .main_btn{
  274. display: flex;
  275. justify-content: space-around;
  276. padding: 4vh 0;
  277. p{
  278. font-size: .4rem;
  279. width: 35%;
  280. text-align: center;
  281. padding: 10PX 0;
  282. border-radius: 5rem;
  283. box-shadow: 0px 3PX 6PX 0px rgba(0,0,0,0.16);
  284. &:nth-child(1){
  285. background: #334281;
  286. color: #ffffff;
  287. }
  288. &:nth-child(2){
  289. background: #D1D5E4;
  290. color: #334281;
  291. }
  292. }
  293. }
  294. </style>