detail.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543
  1. <template>
  2. <div>
  3. <el-card class="box-card" style="background-color: #f2f2f2">
  4. <el-form ref="form" :rules="rules" :model="form" label-width="130px">
  5. <el-row :gutter="24">
  6. <el-col :span="8">
  7. <el-form-item label="编号" prop="xmNumber">
  8. <el-input v-model="form.xmNumber" :disabled="true" clearable></el-input>
  9. </el-form-item>
  10. </el-col>
  11. <el-col :span="8">
  12. <el-form-item label="规则名称" prop="subscriptionRulesName">
  13. <el-input v-model="form.subscriptionRulesName" clearable></el-input>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="8">
  17. <el-form-item label="标讯推送人" prop="subscriptionPusher" >
  18. <el-select
  19. v-model="form.subscriptionPusher"
  20. clearable
  21. multiple
  22. filterable
  23. remote
  24. reserve-keyword
  25. placeholder="请输入关键词"
  26. :remote-method="getUser"
  27. style="width: 100%;">
  28. <el-option
  29. v-for="item in userList"
  30. :key="item.userName"
  31. :label="item.nickName"
  32. :value="item.userName">
  33. <span style="float: left">{{ item.nickName }}</span>
  34. <span style="float: right; color: #8492a6; font-size: 13px">{{ item.userName }}</span>
  35. </el-option>
  36. </el-select>
  37. </el-form-item>
  38. </el-col>
  39. </el-row>
  40. <el-row :gutter="24">
  41. <el-col :span="8">
  42. <el-form-item label="项目所属省份" prop="areaProvince">
  43. <el-select v-model="form.areaProvince" placeholder="请选择" style="width: 100%;" clearable>
  44. <el-option
  45. v-for="item in areaProvinceOptions"
  46. :key="item.value"
  47. :label="item.label"
  48. :value="item.value">
  49. </el-option>
  50. </el-select>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="8">
  54. <el-form-item label="项目所属城市" prop="areaCity">
  55. <el-select v-model="form.areaCity" placeholder="请选择" style="width: 100%;" clearable>
  56. <el-option
  57. v-for="item in areaCityOptions"
  58. :key="item.value"
  59. :label="item.label"
  60. :value="item.value">
  61. </el-option>
  62. </el-select>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="8">
  66. <el-form-item label="公告类型" prop="infoTypeSegment">
  67. <el-select v-model="form.infoTypeSegment" multiple placeholder="请选择公告类型" style="width: 100%" clearable>
  68. <el-option
  69. v-for="item in noticeType"
  70. :key="item.value"
  71. :label="item.label"
  72. :value="item.value"
  73. clearable >
  74. </el-option>
  75. </el-select>
  76. </el-form-item>
  77. </el-col>
  78. </el-row>
  79. <el-row :gutter="24">
  80. <!-- <el-col :span="8">-->
  81. <!-- <el-form-item label="获取标书截止日期">-->
  82. <!-- <el-date-picker-->
  83. <!-- type="datetime"-->
  84. <!-- placeholder="选择日期"-->
  85. <!-- value-format="yyyy-MM-dd HH:mm:ss"-->
  86. <!-- v-model="form.bidingEndTime"-->
  87. <!-- style="width: 100%;" >{{this.areaObj.bidingEndTime}}</el-date-picker>-->
  88. <!-- </el-form-item>-->
  89. <!-- </el-col>-->
  90. <!-- <el-col :span="8">-->
  91. <!-- <el-form-item label="投标截止日期">-->
  92. <!-- <el-date-picker-->
  93. <!-- type="datetime"-->
  94. <!-- placeholder="选择日期"-->
  95. <!-- value-format="yyyy-MM-dd HH:mm:ss"-->
  96. <!-- v-model="form.tenderEndTime"-->
  97. <!-- style="width: 100%;" >{{this.areaObj.tenderEndTime}}</el-date-picker>-->
  98. <!-- </el-form-item>-->
  99. <!-- </el-col>-->
  100. </el-row>
  101. <el-row :gutter="24">
  102. <el-col :span="8">
  103. <!-- <el-form-item label="招标公司类型">-->
  104. <!-- <el-select v-model="form.zhaoBiaoUnitType" multiple placeholder="请选择活动区域" style="width: 100%;">-->
  105. <!-- <el-option-->
  106. <!-- v-for="item in zhaoBiaoUnitType"-->
  107. <!-- :key="item.value"-->
  108. <!-- :label="item.label"-->
  109. <!-- :value="item.value">-->
  110. <!-- </el-option>-->
  111. <!-- </el-select>-->
  112. <!-- </el-form-item>-->
  113. </el-col>
  114. <el-col :span="8">
  115. <el-form-item label="招标方式" >
  116. <el-select v-model="form.biddingType" multiple placeholder="请选择活动区域" style="width: 100%;" clearable>
  117. <el-option
  118. v-for="item in bidType"
  119. :key="item.value"
  120. :label="item.label"
  121. :value="item.value"
  122. clearable>
  123. </el-option>
  124. </el-select>
  125. </el-form-item>
  126. </el-col>
  127. <el-col :span="8">
  128. <el-form-item label="标讯关键词" prop="bidingKeyword" >
  129. <el-input v-model="form.bidingKeyword" clearable></el-input>
  130. </el-form-item>
  131. </el-col>
  132. <el-col :span="8">
  133. <el-form-item label="规则天数" prop="dayNum">
  134. <!-- <el-date-picker-->
  135. <!-- v-model="infoPublishTime"-->
  136. <!-- type="daterange"-->
  137. <!-- value-format="yyyy-MM-dd HH:mm:ss"-->
  138. <!-- range-separator="至"-->
  139. <!-- start-placeholder="开始月份"-->
  140. <!-- end-placeholder="结束月份"-->
  141. <!-- >-->
  142. <!-- {{this.areaObj.infoPublishTime}}</el-date-picker>-->
  143. <el-input v-model="form.dayNum" clearable></el-input>
  144. </el-form-item>
  145. </el-col>
  146. </el-row>
  147. <el-row :gutter="24">
  148. <el-col :span="8">
  149. <el-form-item label="排除词">
  150. <el-input v-model="form.excludeWord" clearable></el-input>
  151. </el-form-item>
  152. </el-col>
  153. <el-col :span="7" >
  154. <el-form-item label="企业名称匹配" prop="unitNameMatch">
  155. <el-select
  156. v-model="form.unitNameMatch"
  157. clearable
  158. filterable
  159. remote
  160. reserve-keyword
  161. placeholder="请输入关键词"
  162. :remote-method="getCustomer"
  163. style="width: 100%;">
  164. <el-option
  165. v-for="item in customerList"
  166. :key="item.name"
  167. :label="item.name"
  168. :value="item.name">
  169. </el-option>
  170. </el-select>
  171. </el-form-item>
  172. </el-col>
  173. <el-col :span="1">
  174. <el-button type="primary" @click="goCustomerPage">新增</el-button>
  175. </el-col>
  176. <el-col :span="8">
  177. <el-form-item label="招标单位" prop="zhaoBiaoUnit">
  178. <el-select
  179. v-model="form.zhaoBiaoUnit"
  180. clearable
  181. filterable
  182. remote
  183. reserve-keyword
  184. placeholder="请输入关键词"
  185. :remote-method="getUnit"
  186. style="width: 100%;">
  187. <el-option
  188. v-for="item in zhaoBiaoUnitList"
  189. :key="item.id"
  190. :label="item.zhaoBiaoUnitCustomer"
  191. :value="item.zhaoBiaoUnitCustomer">
  192. </el-option>
  193. </el-select>
  194. </el-form-item>
  195. </el-col>
  196. </el-row>
  197. <el-row>
  198. <el-form-item label="规则描述">
  199. <el-input
  200. type="textarea"
  201. :rows="2"
  202. placeholder="请输入内容"
  203. v-model="form.ruleDescription">
  204. </el-input>
  205. </el-form-item>
  206. </el-row>
  207. </el-form>
  208. <el-row :gutter="24" type="flex" justify="end">
  209. <el-col :span="4">
  210. <el-button type="info" @click="cancel()" >取消</el-button>
  211. </el-col>
  212. <el-col :span="4">
  213. <el-button type="primary" @click="submitForm" >保存</el-button>
  214. </el-col>
  215. </el-row>
  216. </el-card>
  217. </div>
  218. </template>
  219. <script>
  220. import {
  221. cityQuery,
  222. insert,
  223. provinceQuery,
  224. queryById,
  225. updateById,
  226. getZhaoBiaoUnitList,
  227. getUserByNickName,
  228. getCustomerList, getUserByUserName,
  229. } from "@/api/business/bid/subscriptionRules";
  230. import loading from "vxe-table/packages/loading";
  231. export default {
  232. computed: {
  233. loading() {
  234. return loading
  235. }
  236. },
  237. data() {
  238. return {
  239. userName:[],
  240. customerList:[],
  241. value:'',
  242. zhaoBiaoUnitList:[],
  243. userList:[],
  244. infoPublishTime:[],
  245. areaProvinceOptions:[],
  246. areaCityOptions:[],
  247. zhaoBiaoUnitType:[
  248. {
  249. value: '1',
  250. label: '医院'
  251. },
  252. {
  253. value: '2',
  254. label: '卫生所'
  255. },
  256. ],
  257. noticeType: [
  258. {
  259. value: '2',
  260. label: '招标预告'
  261. },
  262. {
  263. value: '3',
  264. label: '招标公告'
  265. },
  266. {
  267. value: '10',
  268. label: '候选人公示'
  269. },
  270. {
  271. value: '11',
  272. label: '中标通知'
  273. },
  274. {
  275. value: '12',
  276. label: '合同公告'
  277. },
  278. ],
  279. bidType: [
  280. {
  281. value: '0',
  282. label: '公开招标'
  283. },
  284. {
  285. value: '1',
  286. label: '邀请招标'
  287. },
  288. {
  289. value: '2',
  290. label: '竞争性谈判或竞争性磋商'
  291. },
  292. {
  293. value: '3',
  294. label: '单一来源采购'
  295. },
  296. {
  297. value: '4',
  298. label: '询价'
  299. },
  300. {
  301. value: '5',
  302. label: '国务院政府采购监督管理部门认定的其他采购方式'
  303. },
  304. {
  305. value: '6',
  306. label: '电子反拍'
  307. }
  308. ],
  309. areaObj:'',
  310. form: {
  311. id:undefined,
  312. xmNumber:'',
  313. keywordMatch:'',
  314. subscriptionRulesName:'',
  315. areaCity:'',
  316. areaProvince:'',
  317. infoTypeSegment:[],
  318. bidingEndTime:'',
  319. tenderEndTime:'',
  320. zhaoBiaoUnitType:[],
  321. biddingType:[],
  322. bidingKeyword:'',
  323. excludeWord:'',
  324. unitNameMatch:'',
  325. zhaoBiaoUnit:[],
  326. subscriptionPusher:'',
  327. nickNameList:'',
  328. ruleDescription:'',
  329. stateFlag:'',
  330. infoPublishStartTime:'',
  331. infoPublishEndTime:'',
  332. dayNum:30,
  333. zhaoBiaoUnitId:'',
  334. unitNameMatchCode:'',
  335. },
  336. rules: {
  337. infoTypeSegment: [
  338. { required: true, message: '请选择公告类型', trigger: 'change' }
  339. ],
  340. subscriptionRulesName: [
  341. { required: true, message: '请输入规则名称', trigger: 'blur' }
  342. ],
  343. areaCity: [
  344. { required: true, message: '请选择项目所属城市', trigger: 'change' }
  345. ],
  346. bidingKeyword: [
  347. { required: true, message: '请选择标讯关键词', trigger: 'blur' }
  348. ],
  349. unitNameMatch: [
  350. { required: true, message: '请选择企业名称', trigger: 'blur' }
  351. ],
  352. areaProvince: [
  353. { required: true, message: '请选择项目所属省份', trigger: 'change' }
  354. ],
  355. subscriptionPusher: [
  356. { required: true, message: '请选择标讯推送人', trigger: 'blur' }
  357. ],
  358. zhaoBiaoUnit: [
  359. { required: true, message: '请选择招标单位', trigger: 'blur' }
  360. ],
  361. dayNum: [
  362. { required: true, message: '请输入规则天数', trigger: 'blur' }
  363. ]
  364. }
  365. }
  366. },
  367. created() {
  368. //如果路由参数存在
  369. if (this.$route.query.id) {
  370. this.areaObj = this.$route.query.id
  371. this.getDetail(this.areaObj)
  372. }
  373. this.getRuleCity()
  374. this.getRuleProvince()
  375. },
  376. methods: {
  377. goCustomerPage(){
  378. this.$router.push({path:'/business/spd/customers/customers'});
  379. },
  380. getUnit(val){
  381. if(val != '' && val != null){
  382. getZhaoBiaoUnitList(val).then(res => {
  383. this.zhaoBiaoUnitList=res.data
  384. })
  385. }
  386. },
  387. getCustomer(val){
  388. if(val != '' && val != null){
  389. getCustomerList(val).then(res => {
  390. this.customerList=res.data
  391. })
  392. }
  393. },
  394. getUser(val){
  395. if(val !== '' ){
  396. getUserByNickName(val).then(res =>{
  397. this.userList=res.data
  398. })
  399. }
  400. },
  401. getUserByName(val){
  402. getUserByUserName(val).then(res =>{
  403. if(res.code=='200'){
  404. this.userList=res.data
  405. }
  406. })
  407. },
  408. getRuleCity(){
  409. cityQuery().then(res =>{
  410. if (res.code == 200) {
  411. this.areaCityOptions=res.data
  412. }else {
  413. alert("获取失败")
  414. }
  415. })
  416. },
  417. getRuleProvince(){
  418. provinceQuery().then(res =>{
  419. if (res.code == 200) {
  420. this.areaProvinceOptions=res.data
  421. }else {
  422. alert("获取失败")
  423. }
  424. })
  425. },
  426. getDetail(id){
  427. queryById(id).then(res =>{
  428. this.form=res.data
  429. if(this.form.infoTypeSegment.length>0){
  430. this.form.infoTypeSegment=this.form.infoTypeSegment.split(',')
  431. }
  432. if(this.form.biddingType.length>0){
  433. this.form.biddingType=this.form.biddingType.split(',')
  434. }
  435. this.form.zhaoBiaoUnit = this.form.zhaoBiaoUnit.split(',')
  436. this.userName=this.form.subscriptionPusher
  437. if(this.userName){
  438. this.getUserByName(this.userName)
  439. }
  440. this.form.subscriptionPusher = this.form.subscriptionPusher.split(',')
  441. this.form.unitNameMatch=this.form.unitNameMatch.split(',')
  442. if(this.form.infoPublishStartTime !=null && this.form.infoPublishEndTime != null){
  443. this.infoPublishTime=[this.form.infoPublishStartTime,this.form.infoPublishEndTime]
  444. }
  445. })
  446. },
  447. cancel(){
  448. this.form = {
  449. id:'',
  450. xmNumber:'',
  451. keywordMatch:'',
  452. subscriptionRulesName:'',
  453. areaCity:'',
  454. areaProvince:'',
  455. infoTypeSegment:[],
  456. bidingEndTime:'',
  457. tenderEndTime:'',
  458. zhaoBiaoUnitType:[],
  459. biddingType:[],
  460. bidingKeyword:'',
  461. excludeWord:'',
  462. unitNameMatch:'',
  463. zhaoBiaoUnit:'',
  464. subscriptionPusher:[],
  465. ruleDescription:'',
  466. stateFlag:'',
  467. infoPublishStartTime:'',
  468. infoPublishEndTime:'',
  469. }
  470. this.$router.go(-1)
  471. },
  472. /** 提交按钮 */
  473. submitForm: function() {
  474. this.$refs["form"].validate(valid => {
  475. if (valid) {
  476. if (this.form.id != undefined) {
  477. this.form.infoTypeSegment = Array.isArray(this.form.infoTypeSegment)?this.form.infoTypeSegment.join(','):this.form.infoTypeSegment
  478. this.form.zhaoBiaoUnitType = Array.isArray(this.form.zhaoBiaoUnitType)?this.form.zhaoBiaoUnitType.join(','):this.form.zhaoBiaoUnitType
  479. this.form.biddingType = Array.isArray(this.form.biddingType)?this.form.biddingType.join(','):this.form.biddingType
  480. this.form.subscriptionPusher = Array.isArray(this.form.subscriptionPusher)?this.form.subscriptionPusher.join(','):this.form.subscriptionPusher
  481. this.form.unitNameMatch = Array.isArray(this.form.unitNameMatch)?this.form.unitNameMatch.join(','):this.form.unitNameMatch
  482. this.form.zhaoBiaoUnit=this.form.zhaoBiaoUnit.toString()
  483. this.zhaoBiaoUnitList.forEach(item =>{
  484. if(this.form.zhaoBiaoUnit === item.zhaoBiaoUnitCustomer){
  485. this.form.zhaoBiaoUnitId = item.id
  486. }
  487. })
  488. this.customerList.forEach(item =>{
  489. if(this.form.unitNameMatch === item.name){
  490. this.form.unitNameMatchCode = item.code
  491. }
  492. })
  493. updateById(this.form).then(res => {
  494. if(res.code == 200){
  495. this.$modal.msgSuccess("修改成功");
  496. this.$router.go(-1)
  497. }
  498. });
  499. } else {
  500. if (this.infoPublishTime != "" && this.infoPublishTime != null) {
  501. this.form.infoPublishStartTime = this.infoPublishTime[0]
  502. this.form.infoPublishEndTime = this.infoPublishTime[1]
  503. }
  504. this.form.infoTypeSegment = Array.isArray(this.form.infoTypeSegment)?this.form.infoTypeSegment.join(','):this.form.infoTypeSegment
  505. this.form.zhaoBiaoUnitType = Array.isArray(this.form.zhaoBiaoUnitType)?this.form.zhaoBiaoUnitType.join(','):this.form.zhaoBiaoUnitType
  506. this.form.biddingType = Array.isArray(this.form.biddingType)?this.form.biddingType.join(','):this.form.biddingType
  507. this.form.subscriptionPusher = Array.isArray(this.form.subscriptionPusher)?this.form.subscriptionPusher.join(','):this.form.subscriptionPusher
  508. this.form.unitNameMatch = Array.isArray(this.form.unitNameMatch)?this.form.unitNameMatch.join(','):this.form.unitNameMatch
  509. this.form.zhaoBiaoUnit=this.form.zhaoBiaoUnit.toString()
  510. console.log("this.form",this.form)
  511. this.zhaoBiaoUnitList.forEach(item =>{
  512. if(this.form.zhaoBiaoUnit === item.zhaoBiaoUnitCustomer){
  513. this.form.zhaoBiaoUnitId = item.id
  514. }
  515. })
  516. this.customerList.forEach(item =>{
  517. if(this.form.unitNameMatch === item.name){
  518. this.form.unitNameMatchCode = item.code
  519. }
  520. })
  521. insert(this.form).then(res => {
  522. if(res.code == 200){
  523. this.$modal.msgSuccess("新增成功");
  524. this.$router.go(-1)
  525. }
  526. });
  527. }
  528. }
  529. });
  530. },
  531. },
  532. }
  533. </script>
  534. <style>
  535. </style>