detailInfo.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div>
  3. <el-button
  4. size="small"
  5. type="text"
  6. @click="detailBtn((dialogFormVisible = true))"
  7. >详情</el-button
  8. >
  9. <el-drawer
  10. title="案例管理"
  11. :visible.sync="dialogFormVisible"
  12. size="60%"
  13. direction="rtl"
  14. append-to-body
  15. :show-close="false"
  16. :with-header="false"
  17. @close="onClose"
  18. >
  19. <div style="display: flex; justify-content: space-between; padding: 10px">
  20. <div>案例管理</div>
  21. <div>
  22. <edit
  23. v-if="tool.checkAuth($route.name, 'update')"
  24. :sat_sharematerialid="data.sat_sharematerialid"
  25. @editSuccess="detailBtn"
  26. class="inline-16"
  27. :disabled="form.status == '发布'"
  28. ></edit>
  29. <el-button
  30. v-if="tool.checkAuth($route.name, 'delete')"
  31. :type="form.status == '发布' ? '' : 'primary'"
  32. size="small"
  33. @click="delBtn"
  34. :disabled="form.status == '发布'"
  35. >删除</el-button
  36. >
  37. </div>
  38. </div>
  39. <div class="drawer__panel" style="margin-bottom: 0px !important">
  40. <el-row :gutter="10">
  41. <el-form
  42. :model="form"
  43. :rules="rules"
  44. ref="form"
  45. size="mini"
  46. label-position="top"
  47. >
  48. <el-col :span="24">
  49. <el-form-item label="标题" prop="title">
  50. <el-input
  51. v-model="form.title"
  52. placeholder="请输入标题"
  53. disabled
  54. ></el-input>
  55. </el-form-item>
  56. </el-col>
  57. <el-col :span="24">
  58. <el-form-item label="分类" prop="sat_notice_classid">
  59. <el-select
  60. v-model="form.sat_sharematerial_classid"
  61. clearable
  62. placeholder="请选择分类"
  63. style="width: 100%"
  64. disabled
  65. >
  66. <el-option
  67. v-for="item in classData"
  68. :key="item.sat_sharematerial_classid"
  69. :label="item.classname"
  70. :value="item.sat_sharematerial_classid"
  71. >
  72. </el-option>
  73. </el-select>
  74. </el-form-item>
  75. </el-col>
  76. <el-col :span="6">
  77. <el-form-item label="状态" prop="status">
  78. <el-radio-group v-model="form.status" disabled>
  79. <el-radio label="新建">新建</el-radio>
  80. <el-radio label="发布">发布</el-radio>
  81. </el-radio-group>
  82. </el-form-item>
  83. </el-col>
  84. <el-col :span="6">
  85. <el-form-item label="排序" prop="sequence">
  86. <el-input
  87. v-model="form.sequence"
  88. placeholder="请输入排序"
  89. disabled
  90. ></el-input>
  91. </el-form-item>
  92. </el-col>
  93. <el-col :span="24">
  94. <el-form-item label="封面" prop="cover">
  95. <previewImage
  96. v-if="form.cover"
  97. style="width: 256px"
  98. :image="form.image"
  99. ></previewImage>
  100. <upload
  101. v-else
  102. btntype="image"
  103. :folderid="folderid"
  104. accept=".JPG,.PNG"
  105. :bindData="{
  106. ownertable: 'sat_sharematerial',
  107. ownerid: form.sat_sharematerialid,
  108. usetype: 'cover',
  109. }"
  110. ></upload>
  111. <p class="info">
  112. 注:建议上传图片大小130x80像素,大小不超过2M,格式为JPG/PNG
  113. </p>
  114. </el-form-item>
  115. </el-col>
  116. </el-form>
  117. </el-row>
  118. <div>
  119. <div style="font-size: 16px; font-weight: bold; margin-bottom: 10px">
  120. 关联产品
  121. </div>
  122. <addProduct
  123. :sat_sharematerialid="form.sat_sharematerialid"
  124. style="margin-bottom: 10px"
  125. :disabled="true"
  126. ></addProduct>
  127. <tableNewLayout
  128. ref="tableRef"
  129. :checkbox="false"
  130. :custom="true"
  131. :data="list"
  132. :layout="tablecols"
  133. :opwidth="200"
  134. :width="true"
  135. height="300px"
  136. >
  137. <template v-slot:customcol="scope">
  138. <div v-if="scope.column.columnname === 'itemclassfullname'">
  139. {{
  140. scope.column.data.itemclass
  141. ? scope.column.data.itemclass.length > 0
  142. ? scope.column.data.itemclass[0].itemclassfullname
  143. : ""
  144. : ""
  145. }}
  146. </div>
  147. <p v-else>{{ scope.column.data[scope.column.columnname] }}</p>
  148. </template>
  149. <template v-slot:opreation="scope">
  150. <el-button type="text" disabled>删除</el-button>
  151. </template>
  152. </tableNewLayout>
  153. <div class="container normal-panel" style="text-align: right">
  154. <el-pagination
  155. background
  156. @size-change="handleSizeChange"
  157. @current-change="handleCurrentChange"
  158. :current-page="currentPage"
  159. :page-sizes="[20, 50, 100, 200]"
  160. :page-size="20"
  161. layout="total,sizes, prev, pager, next, jumper"
  162. :total="total"
  163. >
  164. </el-pagination>
  165. </div>
  166. </div>
  167. <p style="font-size: 14px; margin-top: 10px">内容</p>
  168. <div style="margin-top: 10px">
  169. <myEditor
  170. ref="editor"
  171. :content="form.content"
  172. :id="form.sat_sharematerialid"
  173. ></myEditor>
  174. </div>
  175. </div>
  176. </el-drawer>
  177. </div>
  178. </template>
  179. <script>
  180. import edit from "./edit";
  181. import upload from "@/components/upload/hw_obs_upload.vue";
  182. import previewImage from "@/components/previewImage/index.vue";
  183. import myEditor from "@/components/my-editor/Editor.vue";
  184. import tableNewLayout from "@/components/dynamic-newTable/index2";
  185. import addProduct from "@/WebsiteManagement/caseManage/modules/addProduct";
  186. export default {
  187. name: "detailInfo",
  188. props: ["data"],
  189. components: {
  190. edit,
  191. upload,
  192. previewImage,
  193. myEditor,
  194. tableNewLayout,
  195. addProduct,
  196. },
  197. data() {
  198. return {
  199. dialogFormVisible: false,
  200. tablecols: [],
  201. list: [],
  202. currentPage: 0,
  203. total: 0,
  204. form: {
  205. title: "",
  206. notes: "",
  207. content: "",
  208. sat_sharematerialid: "",
  209. status: "",
  210. sequence: "",
  211. image: "",
  212. cover: "",
  213. },
  214. rules: {
  215. title: [{ required: true, message: "请输入标题名称", trigger: "blur" }],
  216. cover: [{ required: true, message: "请上传封面", trigger: "change" }],
  217. },
  218. folderid: JSON.parse(sessionStorage.getItem("folderid")).appfolderid,
  219. productParam: {
  220. id: "20240801134003",
  221. content: {
  222. sat_sharematerialid: "",
  223. pageNumber: 1,
  224. pageSize: 20,
  225. where: {
  226. condition: "",
  227. },
  228. },
  229. },
  230. classData: [],
  231. };
  232. },
  233. methods: {
  234. async detailBtn() {
  235. const res = await this.$api.requested({
  236. id: 20240801133703,
  237. content: {
  238. sat_sharematerialid: this.data.sat_sharematerialid,
  239. },
  240. });
  241. if (res.code == 0) {
  242. this.tool.showMessage(res, () => {});
  243. } else {
  244. this.form = Object.assign({}, this.form, res.data);
  245. this.$refs.editor.html = res.data.content;
  246. this.queryFileLink();
  247. this.productParam.content.sat_sharematerialid =
  248. res.data.sat_sharematerialid;
  249. this.productData((this.productParam.content.pageNumber = 1));
  250. this.classList();
  251. }
  252. },
  253. /*获取分类*/
  254. async classList() {
  255. let param = {
  256. id: "20240808105003",
  257. content: {
  258. where: {
  259. condition: "",
  260. },
  261. },
  262. };
  263. const res = await this.$api.requested(param);
  264. this.classData = res.data;
  265. },
  266. // 获取封面信息
  267. async queryFileLink() {
  268. this.dialogEditVisible = true;
  269. const res = await this.$api.requested({
  270. classname: "system.attachment.Attachment",
  271. method: "queryFileLink",
  272. content: {
  273. ownertable: "sat_sharematerial",
  274. ownerid: this.form.sat_sharematerialid,
  275. usetype: "cover", //传空返回有所
  276. },
  277. });
  278. this.form.image = res.data[0];
  279. this.form.cover = res.data[0].url;
  280. /*res.data[0] ? this.image = res.data[0].url : this.image = { url: '' }*/
  281. },
  282. onClose() {
  283. this.$emit("onSuccess");
  284. },
  285. async delBtn() {
  286. this.$confirm("确定删除当前案例吗?", "提示", {
  287. confirmButtonText: "确定",
  288. cancelButtonText: "取消",
  289. type: "warning",
  290. })
  291. .then(async () => {
  292. const res = await this.$api.requested({
  293. id: 20240801133503,
  294. content: {
  295. sat_sharematerialids: [this.data.sat_sharematerialid],
  296. },
  297. });
  298. this.tool.showMessage(res, () => {
  299. this.dialogFormVisible = false;
  300. this.$emit("onSuccess");
  301. });
  302. })
  303. .catch(() => {
  304. this.$message({
  305. type: "info",
  306. message: "已取消删除",
  307. });
  308. });
  309. },
  310. async productData() {
  311. const res = await this.$api.requested(this.productParam);
  312. this.list = res.data;
  313. this.total = res.total;
  314. this.currentPage = res.pageNumber;
  315. },
  316. handleSizeChange(val) {
  317. // console.log(`每页 ${val} 条`);
  318. this.productParam.content.pageSize = val;
  319. this.productData();
  320. },
  321. handleCurrentChange(val) {
  322. // console.log(`当前页: ${val}`);
  323. this.productParam.content.pageNumber = val;
  324. this.productData();
  325. },
  326. },
  327. created() {
  328. this.tablecols = this.tool.tabelCol(
  329. this.$route.name
  330. ).productTable.tablecols;
  331. },
  332. };
  333. </script>
  334. <style scoped>
  335. </style>