From 9ff66017debadfc89bc0c1b796684a4d1dbe2bc3 Mon Sep 17 00:00:00 2001
From: fangyuan <527392886@qq.com>
Date: 星期五, 16 十二月 2022 10:00:02 +0800
Subject: [PATCH] 已上报到市批量操作按钮隐藏
---
src/views/operate/images/updateUser/index.vue | 311 ++++++++++++++++++++++++++++-----------------------
1 files changed, 170 insertions(+), 141 deletions(-)
diff --git a/src/views/operate/images/updateUser/index.vue b/src/views/operate/images/updateUser/index.vue
index 3a844dc..a4af929 100644
--- a/src/views/operate/images/updateUser/index.vue
+++ b/src/views/operate/images/updateUser/index.vue
@@ -2,163 +2,198 @@
<div class="updateUser">
<main>
<div class="mainContent">
- <el-form ref="user" style="width: 100%;">
- <el-form-item prop="code" label="鎵�灞炰簨浠剁紪鍙�">
+ <el-form
+ label-position="right"
+ label-width="150px"
+ :model="imagedata"
+ :rules="rules"
+ :disabled="isDisabled"
+ ref="user"
+ style="width: 100%"
+ >
+ <!-- <el-form-item prop="belongToId" label="鎵�灞炰簨浠剁紪鍙�" v-if="true">
<el-input v-model="imagedata.code"></el-input>
</el-form-item>
- <el-form-item prop="code" label="澶х被鍚嶇О">
- <el-input v-model="imagedata.questionType"></el-input>
+ <el-form-item prop="eventSource" label="浜嬩欢鏉ユ簮">
+ <el-input
+ v-model="getEventSource(imagedata.eventSource).label"
+ ></el-input>
</el-form-item>
- <el-form-item prop="code" label="灏忕被鍚嶇О">
- <el-input v-model="imagedata.bigType"></el-input>
+ <el-form-item prop="category" label="闂绫诲埆">
+ <el-input
+ v-model="getCategory(imagedata.category).label"
+ ></el-input>
</el-form-item>
- <el-form-item prop="code" label="鍥剧墖Id">
- <el-input v-model="imagedata.imagesId"></el-input>
+
+ <el-form-item prop="regionName" label="绀惧尯鍚嶇О">
+ <el-input v-model="imagedata.regionName"></el-input>
</el-form-item>
- <el-form-item prop="code" label="涓婁紶鏃堕棿">
- <el-input v-model="imagedata.uploadTime"></el-input>
- </el-form-item>
- <el-form-item prop="questionType" label="鍥剧墖:" min-width="8">
- <img style="width: 180px;height: 120px;" :src=imagedata.imageUrl>
- </el-form-item>
- <!-- <el-form-item prop="bigType" label="澶х被鍚嶇О" min-width="8" v-model="imagedata.bigType">
- </el-form-item>
- <el-form-item prop="smallType" label="灏忕被鍚嶇О" min-width="8" v-model="imagedata.smallType">
- </el-form-item>
- <el-form-item prop="imagesId" label="鍥剧墖Id" min-width="8" v-model="imagedata.imagesId"> -->
- <!-- </el-form-item>
- <el-form-item prop="uploadTime" label="涓婁紶鏃堕棿" min-width="15" v-model="imagedata.uploadTime">
+ <el-form-item prop="id" label="鍥剧墖Id">
+ <el-input v-model="imagedata.id"></el-input>
</el-form-item> -->
- <!-- <el-form-item v-if="updateFlag"> -->
- <div class="optionBtn">
- <el-button type="primary" class="btn submit" @click.native.prevent="handleUser">鎻愪氦
- </el-button>
+ <!-- <el-form-item prop="type" label="绫诲瀷" v-show="false">
+ <el-select v-model="imagedata.type">
+ <el-option
+ v-for="item in getResourceType()"
+ :key="item.value"
+ :label="item.label"
+ :value="item.value"
+ />
+ </el-select>
+ </el-form-item> -->
+ <el-form-item prop="url" label="鍥剧墖:" min-width="8">
+ <my-upload
+ :picture-list="imageList"
+ :is-show-upload="dialogType !== 'view'"
+ @setPictureUrl="setPictureUrl"
+ @delPictureUrl="delPictureUrl"
+ ></my-upload>
+ </el-form-item>
+ <div v-if="!isDisabled" class="optionBtn">
+ <el-button
+ type="primary"
+ class="btn submit"
+ @click.native.prevent="onSubmit"
+ >鎻愪氦</el-button
+ >
</div>
- <!-- </el-form-item> -->
</el-form>
</div>
</main>
</div>
</template>
<script>
-import { getTypeList } from "@/utils/helper";
+import {
+ deepClone,
+ RESOURCE_TYPE,
+ CATEGOTY,
+ EVENT_SOURCE,
+} from "@/utils/helper";
+import imageManagement from "@/api/operate/imageManagement";
+import { FILE_ORIGINAL_URL } from "@/utils";
+import MyUpload from "@/components/myUpload";
+
export default {
+ components: { MyUpload },
data() {
-
+ const validateImageUrl = (rule, value, callback) => {
+ if (this.imagedata.url) {
+ callback();
+ } else {
+ callback(new Error("璇蜂笂浼犲浘鐗�"));
+ }
+ };
return {
-
imagedata: {
- code: "SJ202211010001",
- questionType: "杩濊",
- bigType: "杩濆弽鍥藉鏈夊叧鏍囧噯缂栧埗鍩庝埂瑙勫垝",
- smallType: "鍦ㄥ眳姘戜綇瀹呮ゼ銆佹湭閰嶅璁剧珛涓撶敤鐑熼亾鐨勫晢浣忕患鍚堟ゼ銆佸晢浣忕患鍚堟ゼ鍐呬笌灞呬綇灞傜浉閭荤殑鍟嗕笟妤煎眰鍐呮柊寤恒�佹敼寤恒�佹墿寤轰骇鐢熸补鐑熴�佸紓鍛炽�佸簾姘旂殑椁愰ギ鏈嶅姟椤圭洰",
- imagesId: "1",
- uploadTime: "2022-10-31 20:20:01",
- imageUrl: "https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.fabao365.xuanfa.cn%2Fimage%2F202107%2F130f9d19f204302f.jpg&refer=http%3A%2F%2Fimg.fabao365.xuanfa.cn&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1670034077&t=974b018f9e27023a01d2d8ad3c7c44f2"
+ belongToId: "",
+ eventSource: 1,
+ regionName: "",
+ category: 1,
+ id: "",
+ url: "",
+ type: "",
},
- }
+ rules: {
+ // belongToId: [
+ // { required: true, trigger: "blur", message: "璇疯緭鍏ユ墍灞炰簨浠剁紪鍙�" },
+ // ],
+ // eventSource: [
+ // { required: true, trigger: "blur", message: "璇疯緭鍏ヤ簨浠舵潵婧�" },
+ // ],
+ // regionName: [
+ // { required: true, trigger: "blur", message: "璇疯緭鍏ョぞ鍖哄悕绉�" },
+ // ],
+ // id: [{ required: true, trigger: "blur", message: "璇疯緭鍏ュ浘鐗嘔d" }],
+ // category: [
+ // { required: true, trigger: "blue", message: "璇疯緭鍏ラ棶棰樼被鍨�" },
+ // ],
+ url: [{ required: true, validator: validateImageUrl }],
+ // type: [
+ // {
+ // required: true,
+ // trigger: ["blur", "change"],
+ // message: "璇烽�夋嫨绫诲瀷",
+ // },
+ // ],
+ },
+ isDisabled: false,
+ imageList: [],
+ };
},
+
created() {
- // const that = this;
- // this.user = JSON.parse(JSON.stringify(that.userInfo));
- // console.log(this.user);
- // this.user.parentId = this.user.parentId === 0 ? '鏆傛棤涓婄骇閮ㄩ棬' : this.user.parentId;
- // this.checkedList = this.user.userInfoDTOS;
- // this.checkedList.forEach((e) => {
- // this.checkedUser.push(e.userId);
- // });
- // console.log(this.checkedUser)
- // this.$axios({
- // method: "get",
- // url: "sccg/depart/tree",
- // }).then((res) => {
- // that.departList = res.data;
- // });
- // this.getUserList(this.user.id);
- // // 鑾峰彇閮ㄩ棬绫诲瀷
- // this.getDepartType();
+ if (this.originalData) {
+ this.imagedata = deepClone(this.originalData);
+ }
+ if (this.dialogType !== "create") {
+ this.imageList = this.imagedata.url.split(",");
+ }
+ this.isDisabled = this.dialogType === "view";
},
methods: {
- // handleUser() {
- // this.$refs["user"].validate((valid) => {
- // if (valid) {
- // const { user, checkedList } = this;
- // const arr = [];
- // checkedList.forEach((item) => {
- // arr.push({ leader: item.leader, userId: item.id ? item.id : item.userId });
- // });
- // if (arr.length === 0) {
- // this.$message({
- // type: 'warning',
- // message: '璇烽�夋嫨閮ㄩ棬浜哄憳',
- // })
- // } else {
- // this.$axios
- // .post("sccg/depart/update", {
- // id: user.id,
- // departName: user.departName,
- // parentId: user.parentId === '鏆傛棤涓婄骇閮ㄩ棬' ? 0 : user.parentId,
- // departDes: user.departDes,
- // departManagerList: arr,
- // })
- // .then((res) => {
- // this.$message({
- // message: res.message,
- // type: res.code === 200 ? "success" : "warning",
- // });
- // this.$emit("changeDialog", { flag: false });
- // this.getDepartList();
- // });
- // }
- // } else {
- // return false;
- // }
- // });
- // },
- // // 鑾峰彇閮ㄩ棬绫诲瀷
- // async getDepartType() {
- // this.typeList = await getTypeList(1, "08");
- // },
+ onSubmit() {
+ this.$refs.user.validate((valid) => {
+ if (valid) {
+ this.imagedata.type="03";
+ const params = Object.assign({}, this.imagedata);
+ delete params.regionName;
+ delete params.category;
+ delete params.eventSource;
+ delete params.id;
+ params.belongToId = +params.belongToId;
+ if (this.dialogType === "create") {
+ imageManagement
+ .addImageResource(params)
+ .then(() => {
+ this.$message.success("鎿嶄綔鎴愬姛");
+ this.$emit("closeDialog");
+ })
+ .catch((err) => this.$message.error(`${err}`));
+ } else {
+ imageManagement
+ .updateImageResource(params)
+ .then(() => {
+ this.$message.success("鎿嶄綔鎴愬姛");
+ this.$emit("closeDialog");
+ })
+ .catch((err) => this.$message.error(`${err}`));
+ }
+ } else {
+ this.$message.warning("璇锋鏌ュ繀濉」");
+ }
+ });
+ },
+ setPictureUrl({ url }) {
+ this.imageList.push(`${FILE_ORIGINAL_URL}${url}`);
+ this.imagedata.url = this.imageList.join(",");
+ },
+ delPictureUrl({ url }) {
+ this.imageList = this.imageList.filter((item) => item !== url);
+ this.imagedata.url = this.imageList.join(",");
+ },
+ getCategory(value) {
+ return CATEGOTY.find((item) => item.value === value);
+ },
- // // 璁剧疆棰嗗
- // setLeader(idx) {
- // if (this.updateFlag) {
- // this.checkedList.forEach((item, index) => {
- // item.leader = index === idx;
- // });
- // }
- // },
-
- // // 鑾峰彇鎵�鏈夌敤鎴蜂俊鎭�
- // getUserList(id) {
- // // 鑾峰彇鎵�鏈夌敤鎴蜂俊鎭�佺敤鎴锋煡璇�(鏆傛椂鏀寔鐢佃瘽鍙风爜)
- // this.$axios.get(`/sccg/depart/query_surplus_exist_user?id=`+id).then((res) => {
- // if (res.code === 200) {
- // this.userList = res.data;
- // }
- // });
- // },
- // addUser() {
- // this.checkedList = [];
- // this.userList.forEach((item) => {
- // this.checkedUser.forEach((child) => {
- // if (item.id == child) {
- // this.checkedList.push({
- // id: item.id,
- // username: item.username,
- // leader: false,
- // });
- // }
- // });
- // });
- // this.checkedList[0].leader = true;
- // console.log(this.checkedList);
- // this.openUser = false;
- // },
- // },
- // props: ["userInfo", "updateFlag", "getDepartList", "changeDialog"],
+ getEventSource(value) {
+ return EVENT_SOURCE.find((item) => item.value === value);
+ },
+ getResourceType(value) {
+ return value
+ ? RESOURCE_TYPE.find((item) => item.value === value)
+ : RESOURCE_TYPE;
+ },
},
- props: ['updateFlag']
+ props: {
+ originalData: {
+ type: Object,
+ default: () => null,
+ },
+ dialogType: {
+ type: String,
+ default: () => "create",
+ },
+ },
};
</script>
<style lang="scss" scoped>
@@ -172,13 +207,6 @@
padding: 0 55px;
background-color: #09152f;
padding-bottom: 50px;
-
- // .mainTitle {
- // color: #4b9bb7;
- // font-weight: 600;
- // line-height: 100px;
- // font-size: 14px;
- // }
.mainContent {
display: flex;
@@ -314,7 +342,8 @@
color: red;
}
-.el-input {
+.el-input,
+.el-select {
width: 280px !important;
}
</style>
\ No newline at end of file
--
Gitblit v1.8.0