GroupsTaskAssignment.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <div class="communal-list" v-loading.fullscreen.lock="fullscreenLoading">
  3. <div class="communal-title">
  4. <div>团组任务分配</div>
  5. </div>
  6. <div class="konzh" style="display: flex;justify-content: space-between;">
  7. <el-form style="display: flex;" label-width="70px" class="demo-form-inline">
  8. <el-form-item style="width: 300px;margin-right: 20px;" label="团组名称">
  9. <el-select v-model="diId" filterable clearable placeholder="请选择" style="width:100%;"
  10. @change="diidChange()">
  11. <el-option v-for="item1 in delegationInfos" :key=item1.id :label=item1.name
  12. :value=item1.id></el-option>
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item style="width: 300px;margin-right: 20px;" label="操作分类">
  16. <el-select v-model="ctId" filterable clearable placeholder="请选择" style="width:100%;"
  17. @change="sdIdChange()">
  18. <el-option v-for=" item1 in setData" :key=item1.id :label=item1.name :value=item1.id></el-option>
  19. </el-select>
  20. </el-form-item>
  21. </el-form>
  22. <!-- <div style="width: 240px;margin-right: 20px;">
  23. <el-select v-model="diId" filterable clearable placeholder="请选择" style="width:100%;"
  24. @change="diidChange()">
  25. <el-option v-for="item1 in delegationInfos" :key=item1.id :label=item1.name
  26. :value=item1.id></el-option>
  27. </el-select>
  28. </div>
  29. <div style="width: 200px;">
  30. <el-select v-model="ctId" filterable clearable placeholder="请选择" style="width:100%;"
  31. @change="sdIdChange()">
  32. <el-option v-for=" item1 in setData" :key=item1.id :label=item1.name :value=item1.id></el-option>
  33. </el-select>
  34. </div> -->
  35. <div style="width: 30%;text-align: right;">
  36. <el-button type="primary" style="margin-left: 10px;" @click="btn">保存</el-button>
  37. </div>
  38. </div>
  39. <div class="tzinif-info">
  40. <div class="tzinif-info-li">
  41. <label>团 号:</label>
  42. <span>{{ DelegationInfo.tourCode }}</span>
  43. </div>
  44. <div class="tzinif-info-li">
  45. <label>客 户:</label>
  46. <span>{{ DelegationInfo.clientName }}</span>
  47. </div>
  48. <div class="tzinif-info-li">
  49. <label>出访国家:</label>
  50. <span>{{ DelegationInfo.visitCountry |filter_city}}</span>
  51. </div>
  52. <div class="tzinif-info-li">
  53. <label>起止日期:</label>
  54. <span>{{ DelegationInfo.visitStartDate|filter_time }}~{{ DelegationInfo.visitEndDate|filter_time}}</span>
  55. </div>
  56. <div class="tzinif-info-li">
  57. <label>天数/人数:</label>
  58. <span>{{ DelegationInfo.visitDays }}/{{ DelegationInfo.visitPNumber }}</span>
  59. </div>
  60. </div>
  61. <!-- <div class="tzinif">
  62. <span style="font-weight: bold;">团 号:</span>{{ DelegationInfo.tourCode }}
  63. <span style="font-weight: bold;">客 户:</span>{{ DelegationInfo.clientName }}
  64. <span style="font-weight: bold;">出访国家:</span>{{ DelegationInfo.visitCountry }}
  65. <span style="font-weight: bold;">起止日期:</span>{{ DelegationInfo.visitStartDate }} ~ {{
  66. DelegationInfo.visitEndDate }}
  67. <span style="font-weight: bold;">天数/人数:</span>{{ DelegationInfo.visitDays }}天/{{ DelegationInfo.visitPNumber }}人
  68. </div> -->
  69. <!-- <div>
  70. <div>人员安排</div>
  71. </div> -->
  72. <div style="margin-top: 10px;border-top: 1px solid #C0C4CC;">
  73. <div style="display: flex;flex-wrap: wrap;">
  74. <div v-for="( item, index ) in user "
  75. :key="index"
  76. style="width: 12.5%;margin: 10px 0;text-align: center;">
  77. <el-checkbox :label="item.id" :value="userStr.indexOf(item.id) != -1" border @change="check(item.id)"
  78. style="width: 120px;">{{
  79. item.name
  80. }}</el-checkbox>
  81. </div>
  82. </div>
  83. </div>
  84. </div>
  85. </template>
  86. <script>
  87. export default {
  88. data() {
  89. return {
  90. rules: {},
  91. token: '',
  92. userId: 0,
  93. delegationInfos: [],
  94. setData: [],
  95. user: [],
  96. diId: '',
  97. ctId: '',
  98. userStr: [],
  99. TaskAssignment: {},
  100. DelegationInfo: {},
  101. fullscreenLoading:false,
  102. }
  103. },
  104. methods: {
  105. GetTaskAssignmen() {
  106. this.fullscreenLoading=true;
  107. var that = this
  108. var url = "/api/Groups/GetTaskAssignmen";
  109. this.$axios({
  110. method: 'post',
  111. url: url,
  112. headers: {
  113. Authorization: 'Bearer ' + this.token
  114. },
  115. }).then(function (res) {
  116. console.log(res)
  117. if (res.data.code == 200) {
  118. that.delegationInfos = res.data.data.delegationInfos;
  119. that.diId=res.data.data.delegationInfos[0].id;
  120. that.setData = res.data.data.setData;
  121. that.ctId=res.data.data.setData[0].id;
  122. that.user = res.data.data.user;
  123. setTimeout(() => {
  124. that.TaskAssignmenQuery();
  125. }, 500);
  126. console.log(that.setData)
  127. }
  128. })
  129. },
  130. TaskAssignmenQuery() {
  131. var that = this
  132. var url = "/api/Groups/TaskAssignmenQuery";
  133. this.$axios({
  134. method: 'post',
  135. url: url,
  136. data: {
  137. diId: that.diId,
  138. ctId: that.ctId,
  139. },
  140. headers: {
  141. Authorization: 'Bearer ' + this.token
  142. },
  143. }).then(function (res) {
  144. if (res.data.code == 200) {
  145. that.userStr = res.data.data.userStr
  146. that.TaskAssignment = res.data.data.taskAssignment
  147. that.DelegationInfo = res.data.data.delegationInfo
  148. that.fullscreenLoading=false;
  149. } else {
  150. that.userStr = [];
  151. that.TaskAssignment = {};
  152. that.DelegationInfo = {}
  153. that.fullscreenLoading=false;
  154. }
  155. })
  156. },
  157. btn() {
  158. var id = 0
  159. var that = this;
  160. if (that.TaskAssignment.id != undefined) {
  161. id = that.TaskAssignment.id;
  162. }
  163. var url = "/api/Groups/GetTaskAssignmenOp";
  164. this.$axios({
  165. method: 'post',
  166. url: url,
  167. data: {
  168. diId: that.diId,
  169. ctId: that.ctId,
  170. uIdStr: that.userStr,
  171. isEnable: 1,
  172. createUserId: that.userId,
  173. remark: ""
  174. },
  175. headers: {
  176. Authorization: 'Bearer ' + that.token
  177. },
  178. }).then(function (res) {
  179. if (res.data.code == 200) {
  180. that.$message({
  181. message: '保存成功!',
  182. type: 'success'
  183. });
  184. } else {
  185. that.$message.error('保存失败!' + res.data.msg);
  186. }
  187. })
  188. },
  189. diidChange() {
  190. this.userStr = [];
  191. this.TaskAssignmenQuery()
  192. console.log(this.userStr)
  193. },
  194. sdIdChange() {
  195. this.TaskAssignmenQuery()
  196. console.log(this.userStr)
  197. },
  198. check(id) {
  199. var index = this.userStr.indexOf(id)
  200. if (index == -1) {
  201. this.userStr.push(id)
  202. } else {
  203. this.userStr = this.userStr.filter((x) => x !== id)
  204. }
  205. }
  206. },
  207. filters:{
  208. filter_city(value){
  209. if(value){
  210. return value.replaceAll('|','、')
  211. }
  212. },
  213. filter_time(value){
  214. if(value){
  215. return value.split(" ")[0]
  216. }
  217. }
  218. },
  219. mounted() {
  220. this.token = JSON.parse(localStorage.getItem('userinif')).token;
  221. this.userId = JSON.parse(localStorage.getItem('userinif')).userInfo.userId
  222. this.GetTaskAssignmen();
  223. }
  224. }
  225. </script>
  226. <style>
  227. .communal-list {
  228. background-color: #fff;
  229. padding: 10px;
  230. box-shadow: 0 0 5px #0005;
  231. border-radius: 10px;
  232. min-height: 820px;
  233. }
  234. .communal-title {
  235. display: flex;
  236. font-size: 17px;
  237. font-weight: 600;
  238. color: #555;
  239. margin-bottom: 15px;
  240. justify-content: space-between;
  241. align-items: center;
  242. }
  243. .communal-box {
  244. display: flex;
  245. }
  246. .communal-box>button {
  247. margin-left: 10px;
  248. padding: 8px 20px;
  249. }
  250. .tzinif-info {
  251. display: flex;
  252. margin-top: 10px;
  253. }
  254. .tzinif-info-li {
  255. margin-right: 30px;
  256. }
  257. .tzinif-info-li label {
  258. color: #606266;
  259. font-size: 15px;
  260. font-weight: 600;
  261. }
  262. .tzinif-info-li span {
  263. color: #606266;
  264. font-size: 14px;
  265. }
  266. .konzh .el-form-item{
  267. margin-bottom: 0;
  268. }
  269. </style>