index.vue 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <div>
  3. <normalBook
  4. ref="basicLayout"
  5. tableName="phoneBookTable"
  6. idName="sys_phonebookid"
  7. :apiId="{query:20231220085804,del:''}"
  8. :autoQuery="false"
  9. @onSuccess="selectChange"
  10. >
  11. <template #titleLight>
  12. <addContact :tagList="tagList" v-if="tool.checkAuth($route.name,'addContact')" slot="addContact" :group="group" @onAddSuccess="selectChange"></addContact>
  13. </template>
  14. <template #custom>
  15. <div class="mt-10" v-if="usertype === 0">
  16. <label class="search__label" >范围:</label>
  17. <el-select class="inline-24" v-model="tabName" placeholder="请选择数据分类" @change="selectChange" size="small" >
  18. <el-option
  19. v-for="item in editableTabsAdmin"
  20. :key="item.index"
  21. :label="item.templetname"
  22. :value="item.templetid"
  23. ></el-option>
  24. </el-select>
  25. </div>
  26. <div class="mt-10" v-else>
  27. <label class="search__label" >范围:</label>
  28. <el-select class="inline-24" v-model="tabName" placeholder="请选择数据分类" @change="selectChange" size="small" >
  29. <el-option
  30. v-for="item in editableTabs"
  31. :key="item.index"
  32. :label="item.templetname"
  33. :value="item.templetid"
  34. ></el-option>
  35. </el-select>
  36. </div>
  37. <div class="inline-16">
  38. <label class="search__label">关联:</label>
  39. <el-select v-model="contactstype" placeholder="请选择标签" size="small" @change="selectChange" clearable @clear="selectChange" class="inline-16">
  40. <el-option label="关联客户" value="关联客户"></el-option>
  41. <el-option label="关联项目" value="关联项目"></el-option>
  42. </el-select>
  43. </div>
  44. <div class="inline-16 mt-10">
  45. <span class="search__label">标签:</span>
  46. <el-select v-model="tags" placeholder="请选择标签" size="small" @change="selectChange" clearable @clear="clearSearch" filterable class="inline-16" multiple @focus="getTagList">
  47. <el-option
  48. v-for="item in tagList"
  49. :key="item.index"
  50. :label="item.tag"
  51. :value="item.tag"
  52. :disabled="hasDisabledTag(item)">
  53. </el-option>
  54. </el-select>
  55. </div>
  56. </template>
  57. <template #custom-right>
  58. <div class="inline-16 mt-10">
  59. <el-button type="primary" size="small" @click="onReset" >重置</el-button>
  60. </div>
  61. </template>
  62. <template #tableLeft style="padding: 0">
  63. <div style="margin: 0;padding: 0;min-width: 320px;max-width: 320px;">
  64. <myGroup ref="groupRef" @clickGroup="clickGroup" @groupList="groupList" :typeTab="tabName" @delGroup="onReset"></myGroup>
  65. </div>
  66. </template>
  67. <template v-slot:tbList="scope">
  68. <div v-if="scope.data.column.columnname === 'tag1'">
  69. <div v-if="scope.data.column.data.tag1">
  70. <div v-if="scope.data.column.data.tag1.length > 0">
  71. <el-tag v-for="tag in scope.data.column.data.tag1" :key="tag.index" :type="tag==='支持者'?'warning':tag==='反对者'?'danger':''" size="mini" style="margin:0 5px 0 0">
  72. {{tag}}
  73. </el-tag>
  74. </div>
  75. <div v-else>--</div>
  76. </div>
  77. <div v-else>--</div>
  78. </div>
  79. <div v-else-if="scope.data.column.columnname === 'islinkcustomer'">
  80. <div>{{scope.data.column.data[[scope.data.column.columnname]]?scope.data.column.data[[scope.data.column.columnname]] === 0?'否':'是':'否'}}</div>
  81. </div>
  82. <div v-else-if="scope.data.column.columnname === 'islinkproject'">
  83. <div>{{scope.data.column.data[[scope.data.column.columnname]]?scope.data.column.data[[scope.data.column.columnname]] === 0?'否':'是':'否'}}</div>
  84. </div>
  85. <div v-else>
  86. {{scope.data.column.data[[scope.data.column.columnname]]?scope.data.column.data[[scope.data.column.columnname]]:'--'}}
  87. </div>
  88. </template>
  89. <template v-slot:tbOpreation="scope">
  90. <!-- <drawerDetail :data="scope.data.data" :groupname="scope.data.data.groupname" detailPath="/phonebookDetail" idName="sys_phonebookid"></drawerDetail>-->
  91. <el-button size="mini" @click="onGoto(scope.data.data)" type="text">详 情</el-button>
  92. </template>
  93. </normalBook>
  94. </div>
  95. </template>
  96. <script>
  97. import normalBook from "@/components/normal-basic-layout-new/normalBook";
  98. import myGroup from '../mycontact/index';
  99. import addContact from '../mycontact/modules/addContact'
  100. export default {
  101. name: "index",
  102. components:{normalBook,myGroup,addContact},
  103. data(){
  104. return {
  105. tabIndex:"1",
  106. editableTabsValue:"我负责的",
  107. usertype:JSON.parse(sessionStorage.getItem('active_account')).usertype,
  108. editableTabs:[
  109. {
  110. templetname:'我负责的',
  111. templetid:1
  112. },
  113. {
  114. templetname:'我参与的',
  115. templetid:2
  116. },
  117. {
  118. templetname:'我下属负责的',
  119. templetid:3
  120. },
  121. {
  122. templetname:'我下属参与的',
  123. templetid:4
  124. },
  125. {
  126. templetname:'我创建的',
  127. templetid:5
  128. }
  129. ],
  130. editableTabsAdmin:[
  131. {
  132. templetname:'我负责的',
  133. templetid:1
  134. },
  135. {
  136. templetname:'我参与的',
  137. templetid:2
  138. },
  139. {
  140. templetname:'我下属负责的',
  141. templetid:3
  142. },
  143. {
  144. templetname:'我下属参与的',
  145. templetid:4
  146. },
  147. {
  148. templetname:'我创建的',
  149. templetid:5
  150. },
  151. {
  152. templetname:'站点全部',
  153. templetid:99
  154. }
  155. ],
  156. tagList:[],
  157. tags:[],
  158. group:[],
  159. tabName:1,
  160. param:{
  161. "id": 20231220085804,
  162. "content": {
  163. "type":1,
  164. "groupname":"",
  165. "sys_phonebookgroupid":0,
  166. "pageNumber": 1,
  167. "pageSize": 40,
  168. "where": {
  169. "condition": "",
  170. "tag":[]
  171. }
  172. }
  173. },
  174. groupname:'',
  175. contactstype:''
  176. }
  177. },
  178. methods:{
  179. async listData(id){
  180. this.$refs.basicLayout.param.content.type = this.tabName
  181. this.$nextTick(()=>{
  182. this.$refs.basicLayout.listData()
  183. })
  184. },
  185. /*任务页面跳转*/
  186. onGoto(row){
  187. console.log(row,'row')
  188. this.$store.dispatch('changeDetailDrawer',true)
  189. this.$router.push({
  190. path:'/phonebookDetail',
  191. query:{
  192. id:row.sys_phonebookid,
  193. groupname:row.groupname,
  194. tabName:this.tabName
  195. }
  196. })
  197. },
  198. async getTagList () {
  199. let res = await this.$api.requested({
  200. "id": 20220929085401,
  201. "content": {
  202. "ownertable":"sys_phonebook",
  203. "ownerid":102
  204. }
  205. })
  206. this.tagList = res.data.option
  207. console.log(this.tagList,'tagList标签')
  208. },
  209. selectChange(){
  210. console.log(this.tabName)
  211. this.$refs.basicLayout.param.content.type = this.tabName
  212. this.$refs.basicLayout.param.content.where.tag = this.tags
  213. this.$refs.basicLayout.param.content.where.contactstype = this.contactstype
  214. this.$refs.basicLayout.listData()
  215. this.$refs.groupRef.param.content.type = this.tabName
  216. this.$refs.groupRef.listData()
  217. },
  218. onReset(){
  219. this.tags = []
  220. this.tabName = 1
  221. this.$refs.basicLayout.param.content.type = 1
  222. this.param.content.where.tag = []
  223. this.$refs.basicLayout.param.content.where.condition = ''
  224. this.$refs.basicLayout.param.content.groupname = ''
  225. this.$refs.basicLayout.param.content.sys_phonebookgroupid = ''
  226. this.$refs.groupRef.param.content.type = 1
  227. this.$refs.groupRef.param.content.where.groupname = ''
  228. this.$refs.groupRef.$refs.grouplist.active = 0
  229. /*this.$refs.groupRef.listData()*/
  230. this.selectChange()
  231. },
  232. clearSearch(){
  233. this.$refs.basicLayout.listData()
  234. },
  235. clickGroup(val,type){
  236. this.$refs.basicLayout.param.content.groupname = val.groupname
  237. this.$refs.basicLayout.param.content.sys_phonebookgroupid = val.sys_phonebookgroupid
  238. this.listData()
  239. },
  240. /*onAddSuccess () {
  241. this.listData()
  242. this.$refs.groupRef.listData()
  243. },*/
  244. hasDisabledTag (item) {
  245. let arr = []
  246. let arr2 = []
  247. arr = this.tagList.filter(item=>{
  248. return this.tags.includes(item.tag)
  249. })
  250. arr.forEach(e=>{
  251. arr2 = arr2.concat(e.mutextag)
  252. })
  253. arr2 = this.tags.length === 0?[]:arr2
  254. let _isSame = arr2.some(tag=>item.tag === tag)
  255. return _isSame
  256. },
  257. /*async querytemplet () {
  258. const res = await this.$api.requested({
  259. "classname": "sysmanage.develop.querytemplet.querytemplet",
  260. "method":"query",
  261. "content": {}
  262. })
  263. this.editableTabs = res.data
  264. for (let i=0;i<res.data.length;i++){
  265. if (res.data[i].templetname == '站点全部'){
  266. this.tabName = res.data[i].templetid
  267. break
  268. }else {
  269. this.tabName = res.data[0].templetid
  270. }
  271. }
  272. this.listData(this.tabName)
  273. }*/
  274. groupList(res){
  275. let k = 0
  276. for (var i=0;i<res.length;i++){
  277. if (res[i].groupname !== '项目联系人' && res[i].groupname !== '客户联系人' ){
  278. this.group[k] = res[i]
  279. k++
  280. }
  281. }
  282. console.log(this.group,'groupList')
  283. },
  284. onDelSuccess(){
  285. console.log('抽屉关闭')
  286. /*this.onReset()*/
  287. }
  288. },
  289. mounted() {
  290. /*this.querytemplet()*/
  291. this.listData(1)
  292. }
  293. }
  294. </script>
  295. <style scoped>
  296. </style>