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.

1025 lines
34 KiB

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