addzsyz.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <view >
  3. <view class="bgtop"></view>
  4. <uni-forms :modelValue="datainfo">
  5. <view class="addbox">
  6. <view class="boxs pdbox" style="padding-bottom: 2rpx;">
  7. <view class="titbox mb14">
  8. <view class="tit flexc">
  9. <image :src="titimg"></image>
  10. <view>基本详情</view>
  11. </view>
  12. </view>
  13. <uni-forms-item label="项目线索名称" name="clueName" required>
  14. <uni-easyinput :inputBorder="false" type="text" v-model="datainfo.clueName" placeholder="请输入项目线索名称" />
  15. </uni-forms-item>
  16. <uni-forms-item label="拟投资额" name="investmentAmount" >
  17. <view class="flexc">
  18. <uni-easyinput :inputBorder="false" type="number" v-model="datainfo.investmentAmount" placeholder="请输入拟投资额" />
  19. 万元
  20. </view>
  21. </uni-forms-item>
  22. <uni-forms-item label="联系人" name="contactsName" required>
  23. <uni-easyinput :inputBorder="false" v-model="datainfo.contactsName" placeholder="请输入联系人" />
  24. </uni-forms-item>
  25. <uni-forms-item label="联系方式" name="contactsPhone" required>
  26. <uni-easyinput :inputBorder="false" v-model="datainfo.contactsPhone" placeholder="请输入联系方式" />
  27. </uni-forms-item>
  28. <picker mode="date" @change='bindDateChangea' >
  29. <uni-forms-item label="录入日期" name="publishTime" >
  30. <view class="lbtabp">
  31. <view :class="datainfo.publishTime?'':'coa'">{{datainfo.publishTime || "请选择录入日期"}}</view>
  32. </view>
  33. </uni-forms-item>
  34. </picker>
  35. <picker range-key='label' :value="xsztidx" :range="xsztlist" @change='bindDateChangec'>
  36. <uni-forms-item label="线索状态" name="type" required>
  37. <view class="lbtabp">
  38. <view v-if="datainfo.type&&!xszttxt">{{statusFormat(datainfo.type,xsztlist)}}</view>
  39. <view v-else :class="xszttxt?'':'coa'">{{xszttxt||"请选择线索状态"}}</view>
  40. </view>
  41. </uni-forms-item>
  42. </picker>
  43. </view>
  44. <view class="boxs pdbox">
  45. <view class="titbox mb14 flexc">
  46. <view class="tit flexc flex1">
  47. <image :src="titimg"></image>
  48. <view>内容</view>
  49. </view>
  50. </view>
  51. <editor id="editor" :class="pbFlag?'pbbox':''" class="ql-container" placeholder="请输入内容" show-img-size show-img-toolbar
  52. show-img-resize @statuschange="onStatusChange" @ready="onEditorReady">
  53. </editor>
  54. </view>
  55. <view class="addbtn">
  56. <view class="btn btn2" v-if="checkPermi(['zx:investment:add'])&&pagetype=='add'||checkPermi(['zx:investment:edit'])&&pagetype=='edit'" @click="getSubmit">提交</view>
  57. </view>
  58. </view>
  59. </uni-forms>
  60. </view>
  61. </template>
  62. <script>
  63. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  64. import config from '@/config'
  65. const baseUrl = config.baseUrl
  66. import { getToken } from '@/utils/auth'
  67. import { selectValue,selectValueKey } from '@/utils/common.js';
  68. import {getinvestmentAddFn,getinvestmentEditFn,getinvestmentDetailFn} from "@/api/mine/meeting.js"
  69. import {getDictionaryFn} from "@/api/mine/register.js"
  70. export default{
  71. data(){
  72. return{
  73. titimg:require("@/work/static/images/titbg.png"),
  74. addimg:require("@/work/static/images/meeting/add.png"),
  75. datainfo:{
  76. "userId":"",//委员账号id
  77. "name":"",//委员姓名
  78. "clueName":"",//项目线索名称
  79. "investmentAmount":"",//拟投资额
  80. "contactsName":"",//联系人
  81. "contactsPhone":"",//联系方式
  82. "contactsContent":"",//联系内容
  83. "publishTime":''
  84. },
  85. id:"",
  86. pagetype:'add',
  87. editinfo:'',
  88. hylxlist:[],
  89. hylxtxt:'',
  90. hylxidx:"",
  91. pbFlag:false,
  92. readOnly:false,
  93. xsztlist:[],
  94. xsztidx:'',
  95. xszttxt:'',
  96. }
  97. },
  98. onUnload(){
  99. uni.$off('refreshtalb')
  100. },
  101. onLoad(e) {
  102. uni.$on('refreshtalb', (e) => {
  103. this.datainfo.zxConferenceUserList=e.zxConferenceUserList
  104. })
  105. if(e.type=='edit'){
  106. this.id=e.id;
  107. this.pagetype='edit'
  108. this.getDetail()
  109. }
  110. this.init()
  111. },
  112. methods:{
  113. checkPermi, checkRole,
  114. init(){
  115. // 线索状态
  116. getDictionaryFn('investment_type').then(res=>{
  117. if(res.code==200&&res.data.length){
  118. this.xsztlist = res.data.map(v => {
  119. return {
  120. label: v.dictLabel,
  121. value:v.dictValue
  122. }
  123. })
  124. }
  125. })
  126. },
  127. kayType(ite,list){
  128. return selectValue(list, ite);
  129. },
  130. statusFormat(ite,list,type) {
  131. var aite=selectValueKey(list, ite);
  132. if(type=='hylx'){
  133. this.hylxidx=aite.key
  134. }
  135. return aite.actions;
  136. },
  137. bindDateChangea(e){
  138. var val=e.detail.value;
  139. this.datainfo.publishTime=val;
  140. },
  141. bindDateChangec(e){
  142. var val=e.detail.value;
  143. this.xszttxt=this.xsztlist[val].label;
  144. this.datainfo.type=this.xsztlist[val].value
  145. },
  146. getDetail(){
  147. var that=this;
  148. var params={
  149. investmentId:this.id
  150. }
  151. getinvestmentDetailFn(this.id).then(res=>{
  152. if(res.code==200){
  153. var data=res.data;
  154. this.datainfo=res.data;
  155. this.editinfo=data.contactsContent;
  156. uni.createSelectorQuery().select('#editor').context(function(res) {
  157. that.editorCtx = res.context;
  158. that.editorCtx.setContents({
  159. html:that.editinfo
  160. })
  161. }).exec();
  162. }
  163. })
  164. },
  165. getSubmit(){
  166. var that=this;
  167. if(!this.datainfo.clueName){
  168. this.$toast("请输入项目线索名称")
  169. return
  170. }
  171. if(!this.datainfo.contactsName){
  172. this.$toast("请输入联系人")
  173. return
  174. }
  175. if(!this.datainfo.contactsPhone){
  176. this.$toast("请选择联系方式")
  177. return
  178. }
  179. if(this.datainfo.contactsPhone){
  180. let regphone = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/
  181. if (this.datainfo.contactsPhone && !regphone.test(this.datainfo.contactsPhone)) {
  182. that.$toast("请输入正确的联系方式")
  183. return
  184. }
  185. }
  186. if(!this.datainfo.type){
  187. this.$toast("请选择线索状态")
  188. return
  189. }
  190. var params=this.datainfo
  191. that.editorCtx.getContents({
  192. success: function(data) {
  193. params.contactsContent=data.html;
  194. if(that.pagetype=='add'){
  195. getinvestmentAddFn(params).then(res=>{
  196. if(res.code==200){
  197. that.$toast("新增成功")
  198. uni.removeStorageSync('cjhyList')
  199. uni.$emit("refreshlist")
  200. setTimeout(function(){
  201. uni.navigateBack({
  202. delta: 1 //返回层数,2则上上页
  203. });
  204. },1200)
  205. }
  206. })
  207. }else{
  208. getinvestmentEditFn(params).then(res=>{
  209. if(res.code==200){
  210. that.$toast("修改成功")
  211. uni.$emit("refreshdetail")
  212. uni.$emit("refreshlist")
  213. setTimeout(function(){
  214. uni.navigateBack({
  215. delta: 1 //返回层数,2则上上页
  216. });
  217. },1200)
  218. }
  219. })
  220. }
  221. }
  222. })
  223. },
  224. onStatusChange(){
  225. },
  226. onEditorReady(){
  227. var that=this;
  228. uni.createSelectorQuery().select('#editor').context(function(res) {
  229. that.editorCtx = res.context;
  230. that.editorCtx.setContents({
  231. html:that.editinfo
  232. })
  233. }).exec();
  234. }
  235. }
  236. }
  237. </script>
  238. <style scoped lang="scss">
  239. .bgtop{height: 150rpx;background-color: $com-cd3;width: 100%;}
  240. .pdbox{padding: 34rpx 24rpx 16rpx;}
  241. .addbox /deep/ .uni-forms-item{margin-bottom:36rpx;}
  242. .addbox /deep/ .uni-easyinput{flex: 1;text-align: right;font-size: 30rpx;}
  243. .addbox /deep/ .uni-forms-item__label{font-weight: bold;font-size: 30rpx;color: #343434;width: 198rpx !important;padding-left:20rpx;}
  244. .addbox /deep/ .is-required{position: absolute;left: 0;top: 50%;margin-top: -10rpx;}
  245. .addbox /deep/ .uni-data-checklist{display: flex;align-items: center;justify-content: flex-end;}
  246. .addbox /deep/ .uni-easyinput__placeholder-class{font-weight: 500;font-size: 30rpx;color: #AAAAAA;}
  247. .addbox /deep/ .checklist-box{margin-right: 0 !important;margin-left: 40rpx !important;}
  248. .fjadd{
  249. .btn{font-weight: bold;font-size: 30rpx;color: #1D64E2;margin: 0;display: flex;align-items: center;}
  250. }
  251. .addbox{margin-top: -120rpx;
  252. padding: 0 24rpx 50rpx;
  253. .boxs{background: #FFFFFF;border-radius: 30rpx;margin-bottom: 24rpx;overflow: hidden;position: relative;
  254. .infobg{width: 102rpx;height: 106rpx;position: absolute;right: 26rpx;bottom: 22rpx;}
  255. .tips{background: #F1F6FF;padding: 18rpx 38rpx;display: flex;align-items: flex-start;
  256. image{width: 20rpx;height: 26rpx;margin-right: 16rpx;flex:0 0 auto;margin-top: 4rpx;}
  257. view{font-weight: 500;font-size: 26rpx;color: #1D64E2;}
  258. }
  259. .titbox{
  260. .tit{
  261. image{width: 32rpx;height: 18rpx;margin-right: 10rpx;}
  262. view{font-weight: bold;font-size: 32rpx;color: #222327;}
  263. }
  264. .titr{width: 146rpx;height: 50rpx;background: #E4EEFF;border-radius: 26rpx;font-weight: 500;font-size: 24rpx;color: #1D64E2;text-align: center;line-height: 50rpx;}
  265. }
  266. .titinf{display: flex;flex-wrap: wrap;
  267. .txt{font-weight: 500;font-size: 28rpx;margin-bottom: 18rpx;flex:0 1 auto;min-width: 50%;display: flex;align-items: flex-start;color: #222327;
  268. text{flex: 0 0 auto;color: #9F9F9F;}
  269. }
  270. }
  271. .addpeo{font-weight: bold;font-size: 30rpx;color: #1D64E2;display: flex;align-items: center;
  272. image{width: 26rpx;height: 24rpx;margin-right: 14rpx;}
  273. }
  274. .openbox{display: flex;align-items: center;justify-content: flex-end;font-weight: 500;
  275. font-size: 30rpx;height: 100%;color: #222327;
  276. }
  277. .edtip{font-weight: 500;font-size: 22rpx;color: #FF0000;
  278. text{margin: 4rpx 8rpx 0 0;}
  279. &.pa{position: absolute;right: 0;bottom: -15px;text-align: right;width: 702rpx;}
  280. }
  281. }
  282. }
  283. .matab{display: flex;align-items: center;flex-wrap: nowrap;overflow: auto;position: absolute;left: 0;right: -48rpx;
  284. .list{min-width:112rpx;height: 50rpx;background: #ffffff;border-radius: 25rpx;font-size: 30rpx;font-weight: 500;box-sizing: border-box;
  285. color: #AAAAAA;padding: 0 24rpx;box-sizing: border-box;margin-left:24rpx;flex: 0 0 auto;border: 2rpx solid #C1C1C1;display: flex;align-items: center;justify-content: center;
  286. &.act{background: #E4EEFF;color: #1D64E2;border: none;}
  287. }
  288. }
  289. // 附件
  290. .fjlists {display: flex;align-items: flex-start;justify-content: space-between;margin-bottom: 12rpx;
  291. image{margin-right: 18rpx;flex: 0 0 auto;}
  292. .imgl{width: 40rpx;height: 40rpx;display: flex;align-items: center;justify-content: center;margin-right: 16rpx;
  293. image{width: 26rpx;height: 24rpx;}
  294. }
  295. .tit{font-size: 26rpx;color: #343434;font-weight: 500;margin-top: 4rpx;}
  296. .delimg{width: 40rpx;height:40rpx;margin-left: 16rpx;display: flex;align-items: center;justify-content: center;
  297. image{width: 26rpx;height: 26rpx;}
  298. }
  299. }
  300. .peoBox{font-size: 30rpx;color: #AAAAAA;min-height: 200rpx;display: flex;flex-wrap: wrap;
  301. view{color: #222327;}
  302. }
  303. // 按钮
  304. .addbtn{display: flex;align-items: center;justify-content: space-between;padding-top: 26rpx;
  305. .btn{width: 336rpx;height: 80rpx;font-weight: bold;font-size: 30rpx;box-sizing: border-box;border-radius: 40rpx;display: flex;align-items: center;justify-content: center;
  306. flex:1;
  307. &.btn1{border: 2rpx solid #1D64E2;background: #ffffff;color: #1D64E2;}
  308. &.btn2{background: #1D64E2;color: #ffffff;}
  309. }
  310. }
  311. .lbtabp{display: flex;align-items: center;flex: 0 0 auto;margin-left: 24rpx;height: 100%;justify-content: flex-end;
  312. view{font-size: 30rpx;color: #222327;}
  313. }
  314. .addbox /deep/ .pbbox .ql-editor p{text-indent: 2rem;}
  315. </style>