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.

1042 lines
35 KiB

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