Add.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701
  1. <template>
  2. <div>
  3. <a-button @click="addClass" :disabled="props.disabled" type="primary" size="samll" class="mr-10">新建</a-button>
  4. <a-drawer
  5. ref="drawer"
  6. v-model:open="modeVisible"
  7. rootClassName="customNotiveClass"
  8. placement="right"
  9. :width="'90%'"
  10. :closable="false"
  11. title="新建装备资源"
  12. >
  13. <div class="detail__panel" v-if="modeVisible">
  14. <a-row :gutter="16">
  15. <a-col :span="10">
  16. <a-row>
  17. <a-card title="设置装备资源" :bordered="false" style="margin-bottom: 10px;">
  18. <a-form ref="formRef" :model="from" layout="vertical">
  19. <a-col :span="24">
  20. <a-form-item label="标题" name="title" :rules="[{ required: true, message: '请输入标题'}]">
  21. <a-input v-model:value="from.title"></a-input>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :span="24">
  25. <a-form-item label="分类" name="sat_sharematerial_classids" :rules="[{ required: true, message: '请选择分类'}]">
  26. <a-cascader
  27. v-model:value="from.sat_sharematerial_classids"
  28. :options="classList()"
  29. :fieldNames="{label:'classname',value:'sat_sharematerial_classid',children:'children'}"
  30. placeholder="选择分类"
  31. change-on-select
  32. :multiple="true"
  33. :show-checked-strategy="Cascader.SHOW_CHILD"
  34. />
  35. </a-form-item>
  36. </a-col>
  37. <a-col :span="24">
  38. <a-form-item label="类型" name="type" :rules="[{ required: true, message: '请选择类型',trigger:'change'}]">
  39. <a-radio-group v-model:value="from.type">
  40. <a-radio :value="1">图片</a-radio>
  41. <a-radio :value="2">视频</a-radio>
  42. <a-radio :value="4">文档</a-radio>
  43. </a-radio-group>
  44. </a-form-item>
  45. </a-col>
  46. <a-col :span="24">
  47. <a-form-item label="排序" name="sequence">
  48. <a-input v-model:value="from.sequence"></a-input>
  49. </a-form-item>
  50. </a-col>
  51. <a-col :span="24">
  52. <a-form-item label="封面图" name="attinfos">
  53. <Upload
  54. :bindData="{ownerid:from.sat_sharematerialid,ownertable:'sat_sharematerial',usetype:'avatar'}"
  55. @fileChange="from.attinfos='1'"
  56. :multiple="false"
  57. accept="image/png, image/jpeg"
  58. ref="upload"
  59. ></Upload>
  60. </a-form-item>
  61. </a-col>
  62. <a-col :span="24" v-if="from.type==1">
  63. <a-form-item label="是否画册">
  64. <a-radio-group v-model:value="from.ispicture">
  65. <a-radio :value="1">是</a-radio>
  66. <a-radio :value="0">否</a-radio>
  67. </a-radio-group>
  68. </a-form-item>
  69. </a-col>
  70. <a-col :span="24" v-if="from.type != '1'">
  71. <a-form-item label="是否可下载">
  72. <a-radio-group v-model:value="from.candownload">
  73. <a-radio :value="1">是</a-radio>
  74. <a-radio :value="0">否</a-radio>
  75. </a-radio-group>
  76. </a-form-item>
  77. </a-col>
  78. <!-- <a-col :span="24" v-if="from.type == '1'">
  79. <a-form-item label="是否二维码">
  80. <a-radio-group v-model:value="from.isqrcode">
  81. <a-radio :value="1">有二维码</a-radio>
  82. <a-radio :value="0">无二维码</a-radio>
  83. </a-radio-group>
  84. </a-form-item>
  85. </a-col> -->
  86. <a-col :span="24" v-if="from.isqrcode && from.type == '1'">
  87. <a-form-item label="扫码地址" name="qrcodecontent" :rules="[{ required: true, message: '请输入地址',trigger:'change'}]">
  88. <a-input-group compact>
  89. <a-input v-model:value="from.qrcodecontent" style="width: calc(100% - 116px)" />
  90. <a-button type="primary" @click="$refs.selectProduct.modeVisible=true">从产品添加</a-button>
  91. </a-input-group>
  92. </a-form-item>
  93. <SelectModel
  94. wdith="90%"
  95. ref="selectProduct"
  96. rowKey="itemid"
  97. :param="selectProductParam"
  98. :columns="utils.TBLayout('productList')" title="添加扫码地址"
  99. :isSelect="false"
  100. :custom="true"
  101. >
  102. <template #titleLeft>
  103. <div style="display: flex;align-items: center;">
  104. <span style="width:50px">类型:</span>
  105. <a-select
  106. style="width: 150px;"
  107. ref="select"
  108. v-model:value="selectProductParam.content.type"
  109. @change="$refs.selectProduct.list.listData()"
  110. >
  111. <a-select-option :value="3">单品</a-select-option>
  112. <a-select-option :value="1">效果图</a-select-option>
  113. <a-select-option :value="2">设计实景</a-select-option>
  114. </a-select>
  115. </div>
  116. </template>
  117. <template #custom="{data}">
  118. <template v-if="data.column.dataIndex == 'attinfos'">
  119. <a-image v-if="data.record.attinfos.length" :src=" data.record.attinfos[0].url" style="width:100px"></a-image>
  120. </template>
  121. <template v-else-if="data.column.dataIndex == 'operation'">
  122. <CustomButton type="link" @click="selectProductFun(data)">选择</CustomButton>
  123. </template>
  124. <template v-else>{{ data.record[data.column.dataIndex] }}</template>
  125. </template>
  126. <template v-slot:slot1>
  127. </template>
  128. </SelectModel>
  129. </a-col>
  130. <!-- <a-col :span="24">
  131. <a-form-item label="推荐">
  132. <a-checkbox-group v-model:value="from.candownloadArr" style="width: 100%">
  133. <a-checkbox value="canshared_c">支持对外</a-checkbox>
  134. <a-checkbox value="candownload_c">支持对外下载</a-checkbox>
  135. </a-checkbox-group>
  136. </a-form-item>
  137. </a-col> -->
  138. <a-col :span="24">
  139. <a-form-item label="状态">
  140. <a-radio-group v-model:value="from.status">
  141. <a-radio value="新建">新建</a-radio>
  142. <a-radio value="发布">发布</a-radio>
  143. </a-radio-group>
  144. </a-form-item>
  145. </a-col>
  146. </a-form>
  147. </a-card>
  148. </a-row>
  149. </a-col>
  150. <a-col :span="14" style="margin-bottom:60px">
  151. <a-card title="权限设置" :bordered="false">
  152. <a-row>
  153. <a-col :span="24" style="margin-bottom:20px">
  154. <div class="flex-center">
  155. <span style="width:100px" class="redlitt">权限类型:</span>
  156. <a-select v-model:value="from.authtype" placeholder="请选择权限类型">
  157. <a-select-option :value="1">选中显示</a-select-option>
  158. <a-select-option :value="0">选中不显示</a-select-option>
  159. </a-select>
  160. </div>
  161. </a-col>
  162. <span style="width:240px" class="redlitt">浏览权限:(至少选择一个范围)</span>
  163. <a-col :span="24" style="margin:20px 0 20px 20px">
  164. <div class="flex-center">
  165. <span style="width:50px">角色:</span>
  166. <a-select v-model:value="from.role" placeholder="请选择角色" mode="tags">
  167. <a-select-option v-for="item in roleObject.roleArr" :key="item.roleid"
  168. :value="item.roleid">
  169. {{ item.rolename + '-' + item. remarks}}
  170. </a-select-option>
  171. </a-select>
  172. </div>
  173. </a-col>
  174. <a-col :span="24" style="margin:0 0 20px 20px;padding-right: 20px">
  175. <div class="flex-center mt-10">
  176. <span style="width:50px">部门:</span>
  177. <a-popover trigger="click" placement="bottom" :open="clicked">
  178. <template #content>
  179. <a-tree
  180. style="width:500px"
  181. :tree-data="roleObject.depArr"
  182. :field-names="fieldNames"
  183. defaultExpandAll
  184. >
  185. <template #title="node">
  186. <div class="custom-tree-node">
  187. <span>{{ node.depname }}</span>
  188. <a-button type="link" size="small" @click="addData('departmentids',[node],() =>{$refs.depTable.listData()})">选择</a-button>
  189. </div>
  190. </template>
  191. </a-tree>
  192. </template>
  193. <a-button type="primary" size="samll">添加</a-button>
  194. </a-popover>
  195. </div>
  196. <normalTable :is-select="false" ref="depTable" style="width:100%" size="small" :columns="utils.TBLayout('depTable')" :param="{id:20240402101602,content:{ownertable:'sat_sharematerial',ownerid:from.sat_sharematerialid,pageNumber:1,pageSize:20,where:{}}}">
  197. <template #tb_cell="{data}">
  198. <template v-if="data.column.dataIndex === 'operation'">
  199. <a-popconfirm
  200. title="确认删除当前部门吗?"
  201. ok-text="确认"
  202. cancel-text="取消"
  203. @confirm="delData('departmentids',data,() =>{$refs.depTable.listData()})"
  204. >
  205. <a-button type="link" size="samll">删除</a-button>
  206. </a-popconfirm>
  207. </template>
  208. </template>
  209. </normalTable>
  210. </a-col>
  211. <a-col :span="24" style="margin:0 0 20px 20px;padding-right: 20px">
  212. <div class="flex-center mt-10">
  213. <span style="width:50px">人员:</span>
  214. <SelectModel
  215. ref="selectHrid"
  216. @selectRowData="$event => addData('hrids',$event,() =>{$refs.hridTable.listData()})"
  217. rowKey="hrid"
  218. :param="{id:20240312145602,content:{pageNumber:1,pageSize:20,where:{}}}"
  219. :columns="utils.TBLayout('staffTable').splice(0,utils.TBLayout('staffTable').length - 1)" title="选择人员"
  220. >
  221. <template #slot1>
  222. <a-button size="middle" type="primary" @click="$refs.selectHrid.modeVisible=true">添加</a-button>
  223. </template>
  224. <template #titleLeft="{data}">
  225. <uploadAllData
  226. dataType="人员"
  227. :total="data.total"
  228. @handlePullApi="hridHandlePullApi"
  229. @handleUploadApi="hridHandleUploadApi"
  230. @onSuccess="$refs.hridTable.listData()"
  231. ></uploadAllData>
  232. </template>
  233. </SelectModel>
  234. </div>
  235. <normalTable :is-select="false" ref="hridTable" style="width:100%" size="small" :columns="utils.TBLayout('staffTable')" :param="{id:20240402101702,content:{ownertable:'sat_sharematerial',ownerid:from.sat_sharematerialid,pageNumber:1,pageSize:20,where:{}}}">
  236. <template #tb_cell="{data}">
  237. <template v-if="data.column.dataIndex === 'operation'">
  238. <a-popconfirm
  239. title="确认删除当前人员吗?"
  240. ok-text="确认"
  241. cancel-text="取消"
  242. @confirm="delData('hrids',data,() =>{$refs.hridTable.listData()})"
  243. >
  244. <a-button type="link" size="samll">删除</a-button>
  245. </a-popconfirm>
  246. </template>
  247. </template>
  248. </normalTable>
  249. </a-col>
  250. <a-col :span="24" style="margin:0 0 20px 20px;padding-right: 20px">
  251. <div class="flex-center mt-10">
  252. <span style="width:50px">区域:</span>
  253. <SelectModel
  254. ref="selectArea"
  255. @selectRowData="$event => addData('sa_saleareaids',$event,() =>{$refs.areaTable.listData()})"
  256. rowKey="sa_saleareaid"
  257. :param="{'classname': 'webmanage.sale.salearea.salearea',method:'query_area',content:{pageNumber:1,pageSize:20,where:{}}}"
  258. :columns="utils.TBLayout('areaTable').splice(0,utils.TBLayout('areaTable').length - 1)" title="选择区域"
  259. >
  260. <template v-slot:slot1>
  261. <a-button size="middle" type="primary" @click="$refs.selectArea.modeVisible=true">添加</a-button>
  262. </template>
  263. <template #titleLeft="{data}">
  264. <uploadAllData
  265. dataType="区域"
  266. :total="data.total"
  267. @handlePullApi="areaHandlePullApi"
  268. @handleUploadApi="areaHandleUploadApi"
  269. @onSuccess="$refs.areaTable.listData()"
  270. ></uploadAllData>
  271. </template>
  272. </SelectModel>
  273. </div>
  274. <normalTable :is-select="false" ref="areaTable" style="width:100%" size="small" :columns="utils.TBLayout('areaTable')" :param="{id:20240402101802,content:{ownertable:'sat_sharematerial',ownerid:from.sat_sharematerialid,pageNumber:1,pageSize:20,where:{}}}">
  275. <template #tb_cell="{data}">
  276. <template v-if="data.column.dataIndex === 'operation'">
  277. <a-popconfirm
  278. title="确认删除当前区域吗?"
  279. ok-text="确认"
  280. cancel-text="取消"
  281. @confirm="delData('sa_saleareaids',data,() =>{$refs.areaTable.listData()})"
  282. >
  283. <a-button type="link" size="samll">删除</a-button>
  284. </a-popconfirm>
  285. </template>
  286. </template>
  287. </normalTable>
  288. </a-col>
  289. <a-col :span="24" style="margin:0 0 20px 20px;padding-right: 20px">
  290. <div class="flex-center mt-10">
  291. <span style="width:80px">经销商:</span>
  292. <SelectModel
  293. ref="selectEnterprise"
  294. @selectRowData="$event => addData('sys_enterpriseids',$event,() =>{$refs.enterpriseTable.listData()})"
  295. rowKey="sys_enterpriseid"
  296. :param="{id:20240312151602,content:{pageNumber:1,pageSize:20,where:{}}}"
  297. :columns="utils.TBLayout('enterpriseTable').splice(0,utils.TBLayout('enterpriseTable').length - 1)" title="选择经销商"
  298. >
  299. <template v-slot:slot1>
  300. <a-button size="middle" type="primary" @click="$refs.selectEnterprise.modeVisible=true">添加</a-button>
  301. </template>
  302. <template #titleLeft="{data}">
  303. <uploadAllData
  304. dataType="经销商"
  305. :total="data.total"
  306. @handlePullApi="enterpriseHandlePullApi"
  307. @handleUploadApi="enterpriseHandleUploadApi"
  308. @onSuccess="$refs.enterpriseTable.listData()"
  309. ></uploadAllData>
  310. </template>
  311. </SelectModel>
  312. </div>
  313. <normalTable :is-select="false" ref="enterpriseTable" style="width:100%" size="small" :columns="utils.TBLayout('enterpriseTable')" :param="{id:20240402101902,content:{ownertable:'sat_sharematerial',ownerid:from.sat_sharematerialid,pageNumber:1,pageSize:20,where:{}}}">
  314. <template #tb_cell="{data}">
  315. <template v-if="data.column.dataIndex === 'operation'">
  316. <a-popconfirm
  317. title="确认删除当前经销商吗?"
  318. ok-text="确认"
  319. cancel-text="取消"
  320. @confirm="delData('sys_enterpriseids',data,() =>{$refs.enterpriseTable.listData()})"
  321. >
  322. <a-button type="link" size="samll">删除</a-button>
  323. </a-popconfirm>
  324. </template>
  325. </template>
  326. </normalTable>
  327. </a-col>
  328. </a-row>
  329. </a-card>
  330. </a-col>
  331. </a-row>
  332. <div class="fixed__btn__panel">
  333. <CustomButton type="primary" size="samll" @click="submit" style="margin-right: 10px">保 存</CustomButton>
  334. <a-button @click="modeVisible=false" size="samll" class="mr-10">取 消</a-button>
  335. </div>
  336. </div>
  337. </a-drawer>
  338. </div>
  339. </template>
  340. <script setup>
  341. import {ref, defineProps, defineEmits,watch, nextTick, onMounted, inject} from 'vue'
  342. import Api from '@/api/api'
  343. import utils from '@/utils/utils'
  344. import { message, Modal } from 'ant-design-vue';
  345. import { useRouter } from "vue-router";
  346. import Upload from '@/MAR/assetsStore/detail/fileUpload.vue'
  347. import normalTable from '@/template/MARnormalTable/index.vue'
  348. import SelectModel from '@/components/selectModel/index2.vue'
  349. import { useAuthStore } from '@/stores/modules/auth'
  350. import uploadAllData from '@/components/uploadAllData/index.vue'
  351. import previewImage from '@/components/previewImage/index.vue'
  352. import {Cascader} from 'ant-design-vue'
  353. const router = useRouter()
  354. let emit = defineEmits(['back','onSuccess'])
  355. let props = defineProps(['disabled', 'selectedClass'])
  356. let formRef = ref()
  357. let classList = inject('classList')
  358. let modeVisible = ref(false)
  359. let from = ref({
  360. "sat_sharematerialid": 0,
  361. "title":"",
  362. "sat_sharematerial_classids":[],
  363. "type":1,//1:图片;2:视频;3:图文
  364. "sequence":'',
  365. "isqrcode":0,
  366. "qrcodecontent":"",
  367. "canshared_c":1,//支持对外
  368. "candownload":1,//是否可下载
  369. "candownload_c":1,//支持对外下载
  370. 'candownloadArr':[],
  371. "status":'',
  372. "role":[],
  373. "authtype":1,
  374. "ispicture":0
  375. })
  376. let fieldNames = {
  377. children: 'subdep',
  378. title: 'depname',
  379. key:'departmentid'
  380. }
  381. watch(() => modeVisible.value,(val) => {
  382. if (!val) {
  383. emit('back',from.value.sat_sharematerialid,save.value)
  384. save.value = false
  385. }
  386. })
  387. let selectProductParam = ref({
  388. "id": 20240420095702,
  389. "content": {
  390. "type": 1, //1,效果图,2:设计实景,3:单品
  391. "pageNumber": 1,
  392. "pageSize": 20,
  393. "where": {
  394. "condition": ""
  395. }
  396. },
  397. })
  398. let selectProduct = ref()
  399. const selectProductFun = (data) => {
  400. from.value.qrcodecontent = data.record.appleturl
  401. selectProduct.value.modeVisible = false
  402. formRef.value.validateFields()
  403. }
  404. //新建
  405. const addClass = async () => {
  406. // 计算分类路径
  407. const categoryPath = props.selectedClass && props.selectedClass.sat_sharematerial_classid
  408. ? findCategoryPath(classList(), props.selectedClass.sat_sharematerial_classid)
  409. : [useAuthStore().nowAccount.userid+'999'];
  410. const res = await Api.requested({
  411. "id": "20240407094502",
  412. "content": {
  413. "sat_sharematerialid": 0,
  414. "title":'',
  415. "sat_sharematerial_classids": [categoryPath],
  416. "type":1,//1:图片;2:视频;3:图文
  417. "sequence":'',
  418. "isqrcode":0,
  419. "qrcodecontent":"",
  420. "canshared_c":0,//支持对外
  421. "candownload":1,//是否可下载
  422. "candownload_c":0,//支持对外下载
  423. }
  424. })
  425. selectAllTable()
  426. // 先加载完整数据再展示抽屉,避免 queryNoticeMain 异步返回时覆盖用户在级联选择器中的操作
  427. await queryNoticeMain(res.data.sat_sharematerialid)
  428. modeVisible.value = true
  429. }
  430. //封面上传成功
  431. const uploadSuccess = async (res) => {
  432. from.value.cover = JSON.parse(res.attinfos).data
  433. }
  434. // 查找分类节点的完整路径(用于级联选择器)
  435. const findCategoryPath = (categories, targetId, path = []) => {
  436. for (let category of categories) {
  437. if (category.sat_sharematerial_classid === targetId) {
  438. return [...path, targetId];
  439. }
  440. if (category.children && category.children.length > 0) {
  441. const foundPath = findCategoryPath(category.children, targetId, [...path, category.sat_sharematerial_classid]);
  442. if (foundPath.length > 0) {
  443. return foundPath;
  444. }
  445. }
  446. }
  447. return [];
  448. }
  449. //通告详情
  450. const queryNoticeMain = async (id) => {
  451. const res = await Api.requested({
  452. "id": "20240407094602",
  453. "content": {
  454. "sat_sharematerialid": id
  455. }
  456. })
  457. console.log(id);
  458. from.value = Object.assign({}, from.value, res.data)
  459. // 如果有选中的分类,则保留选中的分类,否则使用默认值
  460. if (props.selectedClass && props.selectedClass.sat_sharematerial_classid) {
  461. // 查找完整的分类路径,确保级联选择器能正确显示
  462. const categoryPath = findCategoryPath(classList(), props.selectedClass.sat_sharematerial_classid);
  463. from.value.sat_sharematerial_classids = [categoryPath];
  464. }
  465. console.log(from.value,'form');
  466. }
  467. //保存
  468. let save = ref(false)
  469. let depTable = ref()
  470. let editor = ref()
  471. let hridTable = ref()
  472. let areaTable = ref()
  473. let enterpriseTable = ref()
  474. const submit = async () => {
  475. if (!from.value.role.length && !depTable.value.data.length && !hridTable.value.data.length && !areaTable.value.data.length && !enterpriseTable.value.data.length) {
  476. return message.warning('浏览权限至少选择一项!!')
  477. }
  478. const values = await formRef.value.validateFields()
  479. if (from.value.candownloadArr.indexOf('canshared_c') != -1) from.value.canshared_c = 1
  480. if (from.value.candownloadArr.indexOf('candownload_c') != -1) from.value.candownload_c = 1
  481. if (from.value.type == 2 || from.value.type == 4) from.value.ispicture = 0
  482. from.value.sat_sharematerial_classid = from.value.sat_sharematerial_classids[from.value.sat_sharematerial_classids.length - 1]
  483. const res = await Api.requested({
  484. "id": "20240407094502",
  485. "content": from.value
  486. })
  487. utils.message(res,'保存成功',async () => {
  488. const res2 = await Api.requested({
  489. "id": "20240402101402",
  490. "content": {
  491. "authtype":from.value.authtype,
  492. "ownertable": "sat_sharematerial",
  493. "ownerid": from.value.sat_sharematerialid,
  494. "roleids": from.value.role
  495. }
  496. })
  497. if (from.value.status == '发布') {
  498. const res2 = await Api.requested({
  499. "id": "20240329131702",
  500. "content": {
  501. "sat_sharematerialids": [from.value.sat_sharematerialid],
  502. "status":1
  503. }
  504. })
  505. }
  506. formRef.value.resetFields()
  507. save.value = true
  508. modeVisible.value = false
  509. })
  510. }
  511. let roleObject = ref({
  512. roleArr:[],
  513. depArr:[],
  514. hridArr:[],
  515. areaArr:[],
  516. enterpriseArr:[],
  517. })
  518. //权限下拉数据
  519. const selectAllTable = async () => {
  520. Api.requested({
  521. "classname": "sysmanage.develop.optiontype.optiontype",
  522. "method": "optiontypeselect",
  523. "content": {
  524. "pageNumber": 1,
  525. "pageSize": 1000,
  526. "typename": "role",
  527. "parameter": {}
  528. },
  529. }).then(res => {
  530. roleObject.value.roleArr = res.data
  531. })
  532. Api.requested({
  533. "classname": "webmanage.department.department",
  534. "method": "querydepartment",
  535. "content": {},
  536. "accesstoken": "aa8ff16868041aacfd9c768d879d655e"
  537. }).then(res => {
  538. roleObject.value.depArr = res.data
  539. })
  540. }
  541. const addData = async (key,data,callback) => {
  542. let ids = data.map(item => item[key.slice(0,key.length - 1)])
  543. const res = await Api.requested({
  544. "id": "20240402101402",
  545. "content": {
  546. "ownertable": "sat_sharematerial",
  547. "ownerid": from.value.sat_sharematerialid,
  548. [key]:ids
  549. }
  550. })
  551. if (res.code) {
  552. callback && callback()
  553. }
  554. }
  555. //删除数据
  556. const delData = async (key,data,callback) => {
  557. const res = await Api.requested({
  558. "id": "20240402101502",
  559. "content": {
  560. "ownertable": "sat_sharematerial",
  561. "ownerid": from.value.sat_sharematerialid,
  562. [key]:[data.record[key.slice(0,key.length - 1)]]
  563. }
  564. })
  565. utils.message(res,'删除成功',() => {
  566. callback && callback()
  567. })
  568. }
  569. //人员全选
  570. const hridHandlePullApi = async (pullApi) => {
  571. pullApi.content = {pageNumber:1,pageSize:20,where:{}}
  572. pullApi.id = 20240312145602
  573. }
  574. const hridHandleUploadApi = async (uploadApi,data) => {
  575. uploadApi.id = 20240402101402
  576. uploadApi.content = {
  577. "ownertable": "sat_sharematerial",
  578. "ownerid": from.value.sat_sharematerialid,
  579. "hrids": data.map(e=>e.hrid)
  580. }
  581. }
  582. //区域全选
  583. const areaHandlePullApi = async (pullApi) => {
  584. pullApi.content = {pageNumber:1,pageSize:20,where:{}}
  585. pullApi.classname = 'webmanage.sale.salearea.salearea'
  586. pullApi.method = 'query_area'
  587. }
  588. const areaHandleUploadApi = async (uploadApi,data) => {
  589. uploadApi.id = 20240402101402
  590. uploadApi.content = {
  591. "ownertable": "sat_sharematerial",
  592. "ownerid": from.value.sat_sharematerialid,
  593. "sa_saleareaids": data.map(e=>e.sa_saleareaid)
  594. }
  595. }
  596. //经销商全选
  597. const enterpriseHandlePullApi = async (pullApi) => {
  598. pullApi.content = {pageNumber:1,pageSize:20,where:{}}
  599. pullApi.id = 20240312151602
  600. }
  601. const enterpriseHandleUploadApi = async (uploadApi,data) => {
  602. uploadApi.id = 20240402101402
  603. uploadApi.content = {
  604. "ownertable": "sat_sharematerial",
  605. "ownerid": from.value.sat_sharematerialid,
  606. "sys_enterpriseids": data.map(e=>e.sys_enterpriseid)
  607. }
  608. }
  609. // 暴露 addClass 方法
  610. defineExpose({
  611. addClass
  612. })
  613. onMounted(() => {
  614. })
  615. </script>
  616. <style scoped>
  617. .ant-select {
  618. width:100%;
  619. }
  620. .flex-center {
  621. display:flex;
  622. align-items: center;
  623. }
  624. .custom-tree-node {
  625. flex: 1;
  626. display: flex;
  627. align-items: center;
  628. justify-content: space-between;
  629. font-size: 14px;
  630. padding-right: 8px;
  631. background: none;
  632. }
  633. .redlitt::before {
  634. display: inline-block;
  635. margin-inline-end: 4px;
  636. color: #ff4d4f;
  637. font-size: 14px;
  638. font-family: SimSun,sans-serif;
  639. line-height: 1;
  640. content: "*";
  641. }
  642. </style>
  643. <style>
  644. .customNotiveClass .ant-drawer-header {
  645. display: none !important;
  646. }
  647. .customNotiveClass .ant-drawer-content {
  648. background: #F1F2F3 !important;
  649. }
  650. .customNotiveClass .ant-drawer-body {
  651. padding: 0 !important;
  652. }
  653. .customNotiveClass .ant-form {
  654. width: 100%;
  655. }
  656. .detail__panel .ant-card {
  657. width: 100%;
  658. }
  659. .ant-tree-treenode {
  660. width:100% !important;
  661. }
  662. .ant-tree-node-content-wrapper {
  663. width:100% !important;
  664. }
  665. .timeClass .ant-form-item {
  666. margin-bottom:0px !important;
  667. }
  668. .detail__panel .ant-card-head {
  669. min-height:35px !important;
  670. }
  671. </style>