plm前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

898 lines
29 KiB

3 years ago
3 years ago
2 years ago
2 years ago
2 years ago
1 year ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
1 year ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
1 year ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
1 year ago
3 years ago
3 years ago
  1. <template>
  2. <div class="mod-config">
  3. <el-dialog
  4. width="40%"
  5. :title="value === 'save' ? '新增-项目' :value === 'update'?'修改-项目':'新增-子项目'"
  6. :close-on-click-modal="false"
  7. :visible.sync="visible"
  8. @close="closeSaveDialog">
  9. <el-form ref="saveForm" :model="dataForm" label-position="top" label-width="100px" :rules="projectRole">
  10. <el-row :gutter="25">
  11. <el-col :span="6">
  12. <el-form-item :label="(value !=='save' && value !== 'update')?'上级项目号':'项目号'">
  13. <el-input v-model="dataForm.projectId" disabled ></el-input>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="12">
  17. <el-form-item label="项目名称" prop="projectName">
  18. <el-input v-model="dataForm.projectName" ></el-input>
  19. </el-form-item>
  20. </el-col>
  21. <el-col :span="6">
  22. <el-form-item prop="projectTypeDb" label="项目类型">
  23. <dict-data-select dict-type="project_info_type_db" v-if="visible" v-model="dataForm.projectTypeDb"></dict-data-select>
  24. </el-form-item>
  25. </el-col>
  26. <el-col :span="6">
  27. <el-form-item prop="projectSource" :rules="projectRole.projectSourceDesc" label="项目来源">
  28. <dict-data-select dict-type="project_info_source" v-if="visible" v-model="dataForm.projectSource"></dict-data-select>
  29. </el-form-item>
  30. </el-col>
  31. <el-col :span="6">
  32. <el-form-item prop="priority" label="优先级">
  33. <dict-data-select dict-type="project_info_priority" v-if="visible" v-model="dataForm.priority"></dict-data-select>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="6">
  37. <el-form-item label="要求日期:" prop="needDate">
  38. <el-date-picker
  39. style="width: 100%"
  40. v-model="dataForm.needDate"
  41. type="date"
  42. value-format="yyyy-MM-dd"
  43. placeholder="选择日期">
  44. </el-date-picker>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="6">
  48. <el-form-item prop="projectManagerName" :rules="projectRole.projectManagerName">
  49. <span slot="label" style="" @click="managerChooseModal()"><a herf="#">项目经理</a></span>
  50. <el-input v-model="dataForm.projectManagerName" readonly ></el-input>
  51. </el-form-item>
  52. </el-col>
  53. <el-col :span="6">
  54. <el-form-item prop="projectOwnerName" :rules="projectRole.projectOwnerName">
  55. <span slot="label" style="" @click="ownerChooseModal()"><a herf="#">项目负责人</a></span>
  56. <el-input v-model="dataForm.projectOwnerName" readonly ></el-input>
  57. </el-form-item>
  58. </el-col>
  59. <el-col :span="6">
  60. <el-form-item prop="customerId">
  61. <span slot="label" style="" @click="getBaseList(102,1)"><a herf="#">直接客户</a></span>
  62. <el-input v-model="dataForm.customerId" @blur="getCustomerName(1)"></el-input>
  63. </el-form-item>
  64. </el-col>
  65. <el-col :span="12">
  66. <el-form-item prop="customerName" label="直接客户名称:">
  67. <el-input v-model="dataForm.customerName" disabled ></el-input>
  68. </el-form-item>
  69. </el-col>
  70. <el-col :span="6">
  71. <el-form-item >
  72. <span slot="label" style="" @click="getBaseList(102,2)"><a herf="#">终端客户</a></span>
  73. <el-input v-model="dataForm.finalCustomerId" @blur="getCustomerName(2)"></el-input>
  74. </el-form-item>
  75. </el-col>
  76. <el-col :span="12">
  77. <el-form-item label="终端客户名称:">
  78. <el-input v-model="dataForm.finalCustomerName" disabled ></el-input>
  79. </el-form-item>
  80. </el-col>
  81. </el-row>
  82. <el-form-item label="项目描述" style="height: 70px">
  83. <el-input type="textarea" resize="none" :autosize="{minRows: 2, maxRows: 2}" v-model="dataForm.projectDesc" ></el-input>
  84. </el-form-item>
  85. <el-form-item label="客户应用/要求" style="height: 70px">
  86. <el-input type="textarea" resize="none" :autosize="{minRows: 2, maxRows: 2}" v-model="dataForm.customerRemark" ></el-input>
  87. </el-form-item>
  88. <el-form-item label="其他要求" style="height: 70px">
  89. <el-input type="textarea" resize="none" :autosize="{minRows: 2, maxRows: 2}" v-model="dataForm.remark" ></el-input>
  90. </el-form-item>
  91. <el-form-item prop="userRoleName" :rules="projectRole.userRoleName">
  92. <span slot="label" style="" @click="userRollModal('none')"><a herf="#">项目权限</a></span>
  93. <el-input v-model="dataForm.userRoleName" ></el-input>
  94. </el-form-item>
  95. </el-form>
  96. <span slot="footer" class="dialog-footer">
  97. <el-button type="primary" @click="dataFormSubmit()">{{'确定'}}</el-button>
  98. <el-button type="primary" @click="visible = false">{{'关闭'}}</el-button>
  99. </span>
  100. </el-dialog>
  101. <el-dialog
  102. width="530px"
  103. title="项目经理"
  104. :close-on-click-modal="false"
  105. :visible.sync="managerFlag">
  106. <el-transfer class="rq" filterable v-model="projectManagerList" :props="{
  107. key: 'operatorId',
  108. label: 'operatorName'
  109. }" :data="operatorList" :titles="['未选择', '已选择']"></el-transfer>
  110. <span slot="footer" class="dialog-footer">
  111. <div style="margin-top: 5px">
  112. <el-button type="primary" @click="saveManagerList()">确定</el-button>
  113. <el-button @click="managerFlag = false" type="primary">取消</el-button>
  114. </div>
  115. </span>
  116. </el-dialog>
  117. <el-dialog
  118. width="530px"
  119. title="项目负责人"
  120. :close-on-click-modal="false"
  121. :visible.sync="ownerFlag">
  122. <el-transfer class="rq" filterable v-model="projectOwnerList" :props="{
  123. key: 'operatorId',
  124. label: 'operatorName'
  125. }" :data="operatorList" :titles="['未选择', '已选择']"></el-transfer>
  126. <span slot="footer" class="dialog-footer">
  127. <div style="margin-top: 5px">
  128. <el-button type="primary" @click="saveOwnerList()">确定</el-button>
  129. <el-button @click="ownerFlag = false" type="primary">取消</el-button>
  130. </div>
  131. </span>
  132. </el-dialog>
  133. <el-dialog
  134. width="530px"
  135. title="权限"
  136. :close-on-click-modal="false"
  137. :visible.sync="userRoleFlag">
  138. <el-form :inline="true" :model="userRoleForm" label-position="top">
  139. <el-form-item label="账号">
  140. <el-input v-model="userRoleForm.username" placeholder=" "></el-input>
  141. </el-form-item>
  142. <el-form-item label="姓名">
  143. <el-input v-model="userRoleForm.userDisplay" placeholder=" "></el-input>
  144. </el-form-item>
  145. <el-form-item label=" ">
  146. <el-button type="primary" @click="searchUserRoll('none')">查询</el-button>
  147. </el-form-item>
  148. </el-form>
  149. <el-table
  150. :data="userRoleList"
  151. border
  152. :height="300"
  153. v-loading="false"
  154. style="width: 100%;">
  155. <el-table-column
  156. prop="username"
  157. header-align="center"
  158. align="center"
  159. min-width="35"
  160. label="账号">
  161. </el-table-column>
  162. <el-table-column
  163. prop="userDisplay"
  164. header-align="center"
  165. align="center"
  166. min-width="35"
  167. label="姓名">
  168. </el-table-column>
  169. <el-table-column
  170. prop=""
  171. header-align="center"
  172. align="center"
  173. min-width="30"
  174. label="">
  175. <template slot="header" slot-scope="scope">
  176. <el-checkbox :indeterminate="saveCheckAllIndeterminate" v-model="saveCheckAll" true-label="Y" false-label="N" @change="changeSaveCheckAll"></el-checkbox>
  177. </template>
  178. <template slot-scope="scope">
  179. <!-- 如果数据为Y显示勾选框否则不勾选 -->
  180. <el-checkbox :indeterminate="userRoleIndeterminateList[scope.$index]" v-model="scope.row.checkAll" @change="changeAll(scope.row)"></el-checkbox>
  181. </template>
  182. </el-table-column>
  183. <el-table-column
  184. prop=""
  185. header-align="center"
  186. align="center"
  187. min-width="30"
  188. label="查询">
  189. <template slot-scope="scope">
  190. <!-- 如果数据为Y显示勾选框否则不勾选 -->
  191. <el-checkbox v-model="scope.row.searchCheck" @change="changeCheck(scope.row,1)"></el-checkbox>
  192. </template>
  193. </el-table-column>
  194. <el-table-column
  195. prop=""
  196. header-align="center"
  197. align="center"
  198. min-width="30"
  199. label="修改">
  200. <template slot-scope="scope">
  201. <!-- 如果数据为Y显示勾选框否则不勾选 -->
  202. <el-checkbox v-model="scope.row.updateCheck" @change="changeCheck(scope.row,2)"></el-checkbox>
  203. </template>
  204. </el-table-column>
  205. <el-table-column
  206. prop=""
  207. header-align="center"
  208. align="center"
  209. min-width="30"
  210. label="下载">
  211. <template slot-scope="scope">
  212. <!-- 如果数据为Y显示勾选框否则不勾选 -->
  213. <el-checkbox v-model="scope.row.downCheck" @change="changeCheck(scope.row,3)"></el-checkbox>
  214. </template>
  215. </el-table-column>
  216. <el-table-column
  217. prop=""
  218. header-align="center"
  219. align="center"
  220. min-width="30"
  221. label="删除">
  222. <template slot-scope="scope">
  223. <!-- 如果数据为Y显示勾选框否则不勾选 -->
  224. <el-checkbox v-model="scope.row.deleteCheck" @change="changeCheck(scope.row,4)"></el-checkbox>
  225. </template>
  226. </el-table-column>
  227. </el-table>
  228. <span slot="footer" class="dialog-footer">
  229. <div style="margin-top: 5px">
  230. <el-button type="primary" @click="saveUserList()">确定</el-button>
  231. <el-button @click="userRoleFlag = false" type="primary">取消</el-button>
  232. </div>
  233. </span>
  234. </el-dialog>
  235. <Chooselist ref="baseList" @getBaseData="getBaseData"></Chooselist>
  236. </div>
  237. </template>
  238. <script>
  239. import {projectInfoSearch,
  240. searchOperatorWithSite,
  241. searchProjectTeamStr,
  242. searchUserRoll,
  243. saveProjectInfo,
  244. } from "@/api/project/project.js"
  245. import Chooselist from '@/views/modules/common/Chooselist'
  246. import DictDataSelect from "../../sys/dict-data-select.vue";
  247. import {queryCustomer
  248. } from "@/api/customer/customerInformation";
  249. export default {
  250. model:{
  251. prop:'value',
  252. event:'change',
  253. },
  254. props:{
  255. value:{
  256. required:true,
  257. type:String,
  258. }
  259. },
  260. components: {
  261. DictDataSelect,
  262. Chooselist
  263. },
  264. data () {
  265. return {
  266. tagNo:'',
  267. tagNo1:'',
  268. visible: false,
  269. treeVisible: false,
  270. managerFlag:false,
  271. userRoleFlag:false,
  272. ownerFlag:false,
  273. operatorList:[],
  274. dataForm: {
  275. id: 0,
  276. site:this.$store.state.user.site,
  277. projectLevel:1,
  278. projectId:'',
  279. projectTypeDb:'',
  280. projectType:'',
  281. customerName:'',
  282. finalCustomerName:'',
  283. customerId:'',
  284. finalCustomerId:'',
  285. projectName:'',
  286. projectDesc:'',
  287. needDate:'',
  288. priority:'',
  289. projectSource:'',
  290. priorityDesc:'',
  291. projectSourceDesc:'',
  292. projectManagerName:'',
  293. projectOwnerName:'',
  294. customerRemark:'',
  295. remark:'',
  296. userRoleName:'',
  297. projectManagerList:[],
  298. projectOwnerList:[],
  299. userRoleList:[],
  300. },
  301. userRoleForm:{
  302. username:'',
  303. userDisplay:'',
  304. },
  305. projectManagerList:[],
  306. projectOwnerList:[],
  307. userRoleList:[],
  308. projectRole: {
  309. projectLevel: [
  310. {
  311. required: true,
  312. message: ' ',
  313. trigger: ['change','blur']
  314. }
  315. ],
  316. customerName: [
  317. {
  318. required: true,
  319. message: ' ',
  320. trigger: ['change','blur']
  321. }
  322. ],
  323. projectName: [
  324. {
  325. required: true,
  326. message: ' ',
  327. trigger: ['change','blur']
  328. }
  329. ],
  330. customerId: [
  331. {
  332. required: true,
  333. message: ' ',
  334. trigger: ['change','blur']
  335. }
  336. ],
  337. needDate: [
  338. {
  339. required: true,
  340. message: ' ',
  341. trigger: ['change','blur']
  342. }
  343. ],
  344. projectManagerName: [
  345. {
  346. required: true,
  347. message: ' ',
  348. trigger: 'change'
  349. }
  350. ],
  351. projectOwnerName: [
  352. {
  353. required: true,
  354. message: ' ',
  355. trigger: 'change'
  356. }
  357. ],
  358. userRoleName: [
  359. {
  360. required: true,
  361. message: ' ',
  362. trigger: 'change'
  363. }
  364. ],
  365. },
  366. saveCheckAll:'N',
  367. }
  368. },
  369. created () {
  370. },
  371. watch:{
  372. userRoleFlag(newVal,oldVal){
  373. if (newVal === false){
  374. this.userRoleForm.username = ''
  375. this.userRoleForm.userDisplay = ''
  376. // this.saveCheckAll='N'
  377. }
  378. },
  379. },
  380. computed:{
  381. saveCheckAllIndeterminate(){
  382. if (this.userRoleList.every(item => item.checkAll === true)){
  383. this.saveCheckAll = 'Y'
  384. return false
  385. }else if (this.userRoleList.every(item => item.checkAll === false)){
  386. this.saveCheckAll = 'N'
  387. return false
  388. }else {
  389. this.saveCheckAll = 'N'
  390. return true
  391. }
  392. },
  393. userRoleIndeterminateList(){
  394. return this.userRoleList.map(item=>{
  395. if (item.checkAll === true){
  396. return false
  397. }else {
  398. return !(item.searchCheck === false && item.updateCheck === false && item.downCheck === false && item.deleteCheck === false);
  399. }
  400. })
  401. },
  402. },
  403. methods: {
  404. // 获取基础数据列表S
  405. getBaseList (val, type) {
  406. this.tagNo = val
  407. this.tagNo1 = type
  408. this.$nextTick(() => {
  409. let strVal = ''
  410. if (val === 1010) {
  411. if(type==1) {
  412. strVal = this.dataForm.projectTypeDb
  413. }
  414. }
  415. if (val === 106) {
  416. if(type==1) {
  417. strVal = this.dataForm.buNo
  418. }
  419. }
  420. if (val === 102) {
  421. if(type==1) {
  422. strVal = this.dataForm.customerId
  423. }
  424. if(type==2) {
  425. strVal = this.dataForm.finalCustomerId
  426. }
  427. }
  428. if (val === 1011) {
  429. if(type==1) {
  430. strVal = this.dataForm.projectSource
  431. }
  432. }
  433. if (val === 1012) {
  434. if(type==1) {
  435. strVal = this.dataForm.priority
  436. }
  437. }
  438. this.$refs.baseList.init(val, strVal)
  439. })
  440. },
  441. /* 列表方法的回调 */
  442. getBaseData (val) {
  443. if (this.tagNo === 1010) {
  444. if(this.tagNo1==1) {
  445. this.dataForm.projectTypeDb = val.Base_id
  446. this.dataForm.projectType = val.Base_desc
  447. }
  448. }
  449. if (this.tagNo === 102) {
  450. if(this.tagNo1==1) {
  451. this.dataForm.customerId = val.Customer_no
  452. this.dataForm.customerName = val.Customer_desc
  453. }
  454. if(this.tagNo1==2) {
  455. this.dataForm.finalCustomerId = val.Customer_no
  456. this.dataForm.finalCustomerName = val.Customer_desc
  457. }
  458. }
  459. if (this.tagNo === 1011) {
  460. if(this.tagNo1==1) {
  461. this.dataForm.projectSource = val.Base_id
  462. this.dataForm.projectSourceDesc = val.Base_desc
  463. }
  464. }
  465. if (this.tagNo === 1012) {
  466. if(this.tagNo1==1) {
  467. this.dataForm.priority = val.Base_id
  468. this.dataForm.priorityDesc = val.Base_desc
  469. }
  470. }
  471. if (this.tagNo === 106) {
  472. if(this.tagNo1==1) {
  473. this.dataForm.buNo = val.Bu_no
  474. this.dataForm.buDesc = val.Bu_desc
  475. }
  476. }
  477. },
  478. init (id) {
  479. this.dataForm.id = id || 0
  480. let requestCustomer = null;
  481. if (this.dataForm.customerId){
  482. requestCustomer = JSON.parse(JSON.stringify(this.dataForm))
  483. }
  484. if(this.dataForm.id!=0){
  485. let inData={
  486. page: 1,
  487. limit: 10,
  488. id:id
  489. }
  490. projectInfoSearch(inData).then(({data}) => {
  491. if(data.page.list.length>0){
  492. this.dataForm= data.page.list[0];
  493. let inData={
  494. site:this.dataForm.site,
  495. projectId:this.dataForm.projectId,
  496. type:'manager',
  497. }
  498. searchProjectTeamStr(inData).then(({data}) => {
  499. this.dataForm.projectManagerList=data.rows
  500. })
  501. let inData2={
  502. site:this.dataForm.site,
  503. projectId:this.dataForm.projectId,
  504. type:'owner',
  505. }
  506. searchProjectTeamStr(inData2).then(({data}) => {
  507. this.dataForm.projectOwnerList=data.rows
  508. })
  509. this.searchUserRoll();
  510. }
  511. })
  512. }else {
  513. this.dataForm={
  514. id: 0,
  515. site:this.$store.state.user.site,
  516. projectLevel:1,
  517. projectId:'',
  518. projectTypeDb:'',
  519. projectType:'',
  520. customerName:'',
  521. customerId:'',
  522. projectName:'',
  523. projectDesc:'',
  524. needDate:'',
  525. priority:'',
  526. projectSource:'',
  527. priorityDesc:'',
  528. projectSourceDesc:'',
  529. projectManagerName:'',
  530. projectOwnerName:'',
  531. customerRemark:'',
  532. remark:'',
  533. userRoleName:'',
  534. projectManagerList:[],
  535. projectOwnerList:[],
  536. buNo:'',
  537. buDesc:'',
  538. finalCustomerId:'',
  539. finalCustomerName:'',
  540. }
  541. this.searchUserRoll();
  542. }
  543. if (requestCustomer){
  544. this.initCustomer(requestCustomer)
  545. }
  546. this.visible = true
  547. },
  548. searchUserRoll(val){
  549. let arr = []
  550. if (val === 'none'){// 判断是否走搜索的方法
  551. arr =JSON.parse(JSON.stringify(this.userRoleList));
  552. }
  553. let inData3={
  554. site:this.dataForm.site,
  555. projectId:this.dataForm.projectId,
  556. username:this.userRoleForm.username,
  557. userDisplay:this.userRoleForm.userDisplay,
  558. }
  559. searchUserRoll(inData3).then(({data}) => {
  560. this.dataForm.userRoleList=data.rows;
  561. this.userRollModal(undefined,arr);
  562. })
  563. },
  564. managerChooseModal(){
  565. let inData={
  566. site:this.dataForm.site,
  567. projectId:this.dataForm.projectId,
  568. }
  569. searchOperatorWithSite(inData).then(({data}) => {
  570. this.operatorList=data.rows
  571. })
  572. this.projectManagerList = JSON.parse(JSON.stringify(this.dataForm.projectManagerList));
  573. this.managerFlag=true
  574. },
  575. saveManagerList(){
  576. let projectManagerName='';
  577. for (let i = 0; i < this.projectManagerList.length; i++) {
  578. let select= this.operatorList.filter(item => item.operatorId === this.projectManagerList[i])
  579. if(select.length>0){
  580. projectManagerName+=select[0].operatorName+';'
  581. }
  582. }
  583. this.dataForm.projectManagerName=projectManagerName
  584. this.dataForm.projectManagerList=JSON.parse(JSON.stringify(this.projectManagerList));
  585. this.managerFlag=false
  586. },
  587. ownerChooseModal(){
  588. let inData={
  589. site:this.dataForm.site,
  590. projectId:this.dataForm.projectId,
  591. }
  592. searchOperatorWithSite(inData).then(({data}) => {
  593. this.operatorList=data.rows
  594. })
  595. this.projectOwnerList = JSON.parse(JSON.stringify(this.dataForm.projectOwnerList));
  596. this.ownerFlag=true
  597. },
  598. saveOwnerList(){
  599. let projectOwnerName='';
  600. for (let i = 0; i < this.projectOwnerList.length; i++) {
  601. let select= this.operatorList.filter(item => item.operatorId === this.projectOwnerList[i])
  602. if(select.length>0){
  603. projectOwnerName+=select[0].operatorName+';'
  604. }
  605. }
  606. this.dataForm.projectOwnerName=projectOwnerName
  607. this.dataForm.projectOwnerList=JSON.parse(JSON.stringify(this.projectOwnerList));
  608. this.ownerFlag=false
  609. },
  610. userRollModal(val,arr){
  611. this.userRoleList=JSON.parse(JSON.stringify(this.dataForm.userRoleList));
  612. for (let i = 0; i <this.userRoleList.length ; i++) {
  613. if(this.userRoleList[i].username===this.$store.state.user.name){
  614. this.userRoleList[i].checkAll=true;
  615. this.changeAll(this.userRoleList[i])
  616. }
  617. }
  618. // 查询不刷新选择值
  619. if (arr && arr.length > 0){
  620. for (let i = 0; i < this.userRoleList.length; i++) {
  621. let row = arr[i]
  622. if (arr[i].username !== this.$store.state.user.name){
  623. row = arr.find(item => item.username === arr[i].username)
  624. }
  625. this.$set(this.userRoleList, i, row)
  626. }
  627. }
  628. if (val === 'none'){
  629. this.userRoleFlag=true
  630. }
  631. },
  632. saveUserList(){
  633. for (let i = 0; i <this.userRoleList.length ; i++) {
  634. if(this.userRoleList[i].username==this.$store.state.user.name){
  635. this.userRoleList[i].searchCheck=true;
  636. this.userRoleList[i].updateCheck=true;
  637. this.userRoleList[i].downCheck=true;
  638. this.userRoleList[i].deleteCheck=true;
  639. this.userRoleList[i].searchFlag='Y'
  640. this.userRoleList[i].updateFlag='Y'
  641. this.userRoleList[i].downFlag='Y'
  642. this.userRoleList[i].deleteFlag='Y'
  643. }
  644. }
  645. let name= [];
  646. for (let i = 0; i < this.userRoleList.length; i++) {
  647. if(this.userRoleList[i].searchCheck||this.userRoleList[i].updateCheck||this.userRoleList[i].downCheck||this.userRoleList[i].deleteCheck){
  648. name[i]=this.userRoleList[i].userDisplay
  649. }
  650. }
  651. this.dataForm.userRoleName=name.join(';')
  652. this.dataForm.userRoleList=JSON.parse(JSON.stringify(this.userRoleList));
  653. this.userRoleFlag=false
  654. },
  655. changeAll(row){
  656. if(row.checkAll){
  657. row.searchCheck=true;
  658. row.updateCheck=true;
  659. row.downCheck=true;
  660. row.deleteCheck=true;
  661. row.searchFlag='Y'
  662. row.updateFlag='Y'
  663. row.downFlag='Y'
  664. row.deleteFlag='Y'
  665. }else {
  666. row.searchCheck=false;
  667. row.updateCheck=false;
  668. row.downCheck=false;
  669. row.deleteCheck=false;
  670. row.searchFlag='N'
  671. row.updateFlag='N'
  672. row.downFlag='N'
  673. row.deleteFlag='N'
  674. }
  675. },
  676. changeCheck(row,type){
  677. if(type==1){
  678. if(row.searchCheck){
  679. row.searchFlag='Y'
  680. }else {
  681. row.searchFlag='N'
  682. }
  683. }
  684. if(type==2){
  685. if(row.updateCheck){
  686. row.updateFlag='Y'
  687. }else {
  688. row.updateFlag='N'
  689. }
  690. }
  691. if(type==3){
  692. if(row.downCheck){
  693. row.downFlag='Y'
  694. }else {
  695. row.downFlag='N'
  696. }
  697. }
  698. if(type==4){
  699. if(row.deleteCheck){
  700. row.deleteFlag='Y'
  701. }else {
  702. row.deleteFlag='N'
  703. }
  704. }
  705. if(row.searchCheck && row.updateCheck && row.downCheck && row.deleteCheck){
  706. row.checkAll=true
  707. }else{
  708. row.checkAll=false
  709. }
  710. this.$forceUpdate();
  711. },
  712. // 表单提交
  713. dataFormSubmit () {
  714. this.$refs.saveForm.validate((validate)=>{
  715. if (validate){
  716. this.dataForm.updateBy = this.$store.state.user.name
  717. console.log(this.dataForm)
  718. saveProjectInfo(this.dataForm).then(({data}) => {
  719. if (data && data.code === 0) {
  720. this.$message.success( '操作成功')
  721. this.visible = false
  722. this.$emit('refreshDataList')
  723. } else {
  724. this.$message.error(data.msg)
  725. }
  726. })
  727. }else {
  728. // if(!this.dataForm.projectTypeDb){
  729. // this.$alert('请选择项目类型!', '错误', {
  730. // confirmButtonText: '确定'
  731. // })
  732. // return false;
  733. // }
  734. if(!this.dataForm.customerId){
  735. this.$alert('请选择直接客户!', '错误', {
  736. confirmButtonText: '确定'
  737. })
  738. return false;
  739. }
  740. if(!this.dataForm.projectName){
  741. this.$alert('请输入项目名称!', '错误', {
  742. confirmButtonText: '确定'
  743. })
  744. return false;
  745. }
  746. // if(!this.dataForm.projectSource){
  747. // this.$alert('请选择项目来源!', '错误', {
  748. // confirmButtonText: '确定'
  749. // })
  750. // return false;
  751. // }
  752. // if(!this.dataForm.buDesc){
  753. // this.$alert('请选择BU!', '错误', {
  754. // confirmButtonText: '确定'
  755. // })
  756. // return false;
  757. // }
  758. // if(!this.dataForm.priority){
  759. // this.$alert('请选择优先级!', '错误', {
  760. // confirmButtonText: '确定'
  761. // })
  762. // return false;
  763. // }
  764. if(!this.dataForm.needDate){
  765. this.$alert('请选择要求日期!', '错误', {
  766. confirmButtonText: '确定'
  767. })
  768. return false;
  769. }
  770. if(!this.dataForm.projectManagerName){
  771. this.$alert('请选择项目经理!', '错误', {
  772. confirmButtonText: '确定'
  773. })
  774. return false;
  775. }
  776. if(!this.dataForm.projectOwnerName){
  777. this.$alert('请选择项目负责人!', '错误', {
  778. confirmButtonText: '确定'
  779. })
  780. return false;
  781. }
  782. if(!this.dataForm.userRoleName){
  783. this.$alert('请选择权限!', '错误', {
  784. confirmButtonText: '确定'
  785. })
  786. return false;
  787. }
  788. }
  789. })
  790. },
  791. closeSaveDialog(){
  792. this.$refs.saveForm.resetFields();
  793. },
  794. updateDataForm(val){
  795. this.dataForm.projectId = val;
  796. },
  797. initCustomer(row){
  798. this.dataForm.customerId = row.customerId;
  799. this.dataForm.customerName = row.customerName;
  800. },
  801. changeSaveCheckAll(val){
  802. for (let i = 0; i < this.userRoleList.length; i++) {
  803. let row = this.userRoleList[i]
  804. row.checkAll = (val === 'Y')
  805. this.changeAll(row)
  806. }
  807. },
  808. getCustomerName(type){
  809. if(type===1){
  810. let params = {
  811. site:this.$store.state.user.site,
  812. customerNo:this.dataForm.customerId
  813. }
  814. queryCustomer(params).then(({data})=>{
  815. if (data && data.code === 0 ) {
  816. if (data.rows && data.rows.length === 1){
  817. this.dataForm.customerName = data.rows[0].customerDesc
  818. }else {
  819. this.dataForm.customerName = ''
  820. }
  821. }else {
  822. this.$message.warning(data.msg)
  823. }
  824. }).catch((error)=>{
  825. this.$message.error(error)
  826. })
  827. }
  828. if(type===2){
  829. let params = {
  830. site:this.$store.state.user.site,
  831. customerNo:this.dataForm.finalCustomerId
  832. }
  833. queryCustomer(params).then(({data})=>{
  834. if (data && data.code === 0 ) {
  835. if (data.rows && data.rows.length === 1){
  836. this.dataForm.finalCustomerName = data.rows[0].customerDesc
  837. }else {
  838. this.dataForm.finalCustomerName = ''
  839. }
  840. }else {
  841. this.$message.warning(data.msg)
  842. }
  843. }).catch((error)=>{
  844. this.$message.error(error)
  845. })
  846. }
  847. },
  848. },
  849. }
  850. </script>
  851. <style >
  852. .el-transfer-panel {
  853. border: 2px solid #17b3a3;
  854. border-radius: 4px;
  855. overflow: hidden;
  856. background: #fff;
  857. display: inline-block;
  858. vertical-align: middle;
  859. width: 200px;
  860. max-height: 100%;
  861. -webkit-box-sizing: border-box;
  862. box-sizing: border-box;
  863. position: relative;
  864. }
  865. .el-transfer-panel .el-transfer-panel__header {
  866. height: 40px;
  867. line-height: 40px;
  868. background: #17b3a3;
  869. margin: 0;
  870. padding-left: 15px;
  871. border-bottom: 1px solid #17b3a3;
  872. -webkit-box-sizing: border-box;
  873. box-sizing: border-box;
  874. color: #000;
  875. }
  876. .el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label {
  877. font-size: 14px;
  878. color: #303133;
  879. font-weight: 400;
  880. }
  881. .el-textarea .el-textarea__inner {
  882. padding: 0px 5px;
  883. height: auto;
  884. }
  885. </style>