123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518 |
- * @Author : yuanrunwei
- * @Date : 2021-12-04 14:23:58
- * @LastEditors: daiqisheng
- * @LastEditTime: 2022-04-25 19:11:41
- * @FilePath : \spfm-market-front\src\pages\main\performance\components\sheet.vue
- -->
- <template>
- <div class="sheet-container">
- <div style="margin: 20px 0 40px 0; display: flex">
- 运营商:
- <el-select v-model="bednumber" @change="getCheck()">
- <el-option
- v-for="(item, index) in options"
- :key="index"
- :label="item.value"
- :value="item.value"
- ></el-option>
- </el-select>
- <el-button type="primary" @click="handleResave"
- >保存</el-button
- >
- <el-upload
- class="upload-demo"
- multiple
- ref="upload"
- action="string"
- :http-request="clickok"
- :before-upload="deforeUp"
- :on-change="handleChange"
- >
- <div>
- <i class="el-icon-upload"></i>
- <div class="el-upload__text">点击上传</div>
- </div>
- <div>
- <el-button>123</el-button>
- </div>
- </el-upload>
- <el-button type="primary" @click="handleDownload">导出</el-button>
- <el-button type="primary" @click="handleFullscreen()">全屏显示</el-button>
- </div>
- <div id="luckysheet" style="width: 75%; height: 70%"></div>
- </div>
- </template>
- <script>
- import luckyexcel from "luckyexcel";
- import { exportExcel } from "./components//export.js";
- // import simpleDialog from "./dialog.vue";z
- export default {
- components: {
- // simpleDialog,
- },
- props: {
- type: {
- type: String,
- default: "view", // view 查看 edit 编辑
- },
- attribute: {
- type: String,
- default: "template", // template 模板 order 工单 file 文件
- },
- id: {
- default: null,
- },
- // 接收人
- receiver: {
- type: String,
- default: "",
- },
- // 模板状态按钮判断
- status: { type: String, default: "" },
- },
- data() {
- return {
- bednumber: "",
- checkStatus: false,
- unicomList: [], //联通excelList
- telecomList: [], //电信excelList
- options: [
- {
- value: "电信",
- },
- {
- value: "联通",
- },
- ],
- dialogTableVisible: true,
- celldata: [
- { r: 0, c: 0, v: { v: "运营商", bl: 1, ht: 0, vt: 0 } },
- {
- r: 0,
- c: 1,
- tb: 2,
- v: {
- tb: 2,
- fs: 11,
- ht: 0,
- vt: 0,
- v: "套餐档位(从低到高进行填写)低档:58元以下套餐中档:58元(含)-128元套餐(不含)高档:128元及以上套餐",
- ct: { fa: "General", t: "n" },
- m: "2",
- },
- },
- {
- r: 0,
- c: 2,
- v: {
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- v: "套餐名称",
- ct: { fa: "General", t: "n" },
- m: "3",
- },
- },
- {
- r: 0,
- c: 3,
- v: {
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- v: "是否为主推套餐",
- ct: { fa: "General", t: "n" },
- m: "0",
- },
- },
- {
- r: 0,
- c: 4,
- v: {
- v: "月费(元)",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 5,
- v: {
- v: "优惠价",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 6,
- v: {
- v: "预存款(元)",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 7,
- v: {
- v: "套餐内容",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 8,
- v: {
- v: "酬金",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 9,
- v: {
- v: "在售区域",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 10,
- v: {
- v: "在售渠道",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 11,
- v: {
- v: "月销量",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 12,
- v: {
- v: "是否包含宽带",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 13,
- v: {
- v: "宽带具体内容",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 14,
- v: {
- v: "是否包括电视",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 15,
- v: {
- v: "是否包括副卡",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 16,
- v: {
- v: "是否包括亲情网",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 17,
- v: {
- v: "是否包括v网产品",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 18,
- v: {
- v: "其他补充信息",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 19,
- v: {
- v: "上报人",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- {
- r: 0,
- c: 20,
- v: {
- v: "联系电话",
- bl: 0,
- it: 0,
- ff: 0,
- fs: 11,
- fc: "rgb(51, 51, 51)",
- ht: 0,
- vt: 0,
- },
- },
- ],
- form: {
- charge: [
- {
- person: [],
- col_start: "",
- col_end: "",
- row_start: "",
- row_end: "",
- },
- ],
- array: [],
- type: null,
- permission_type: null,
- col_start: "",
- col_end: "",
- row_start: "",
- row_end: "",
- },
- approveForm: {
- type: "",
- comments: "",
- list: [
- {
- label: "同意",
- value: "同意",
- },
- {
- label: "不同意",
- value: "不同意",
- },
- {
- label: "其他",
- value: "3",
- },
- ],
- },
- superviserules: {
- distribute: [
- { required: true, message: "请选择派发周期", trigger: "change" },
- ],
- write: [
- { required: true, message: "请选择填报周期", trigger: "change" },
- ],
- endTime: [
- { required: true, message: "请选择截止时间", trigger: "change" },
- ],
- },
- superviseForm: {
- distribute: "", // 派单周期
- write: "", // 填写周期
- endTime: "", // 截止时间
- },
- originSuperviseForm: {},
- pickOptions: {
- disabledDate(time) {
- return time.getTime() < new Date().getTime() - 8.64e7;
- },
- },
- pickWrite: {
- disabledDate(time) {
- return time.getTime() < new Date().getTime() - 8.64e7;
- },
- },
- // 可提交标志
- addFlag: "0",
- // 督办标志
- superviseFlag: null,
- rowList: [],
- isDisable: true,
- issued_id: null,
- template_id: null,
- visible: false,
- templateType: "",
- // 督办
- supervise: false,
- manager_approve: false,
- row_list: [],
- column_list: [],
- charge_list: [],
- a: [],
- b: [],
- type_options: [
- {
- value: 1,
- label: "按行",
- },
- // {
- // value: 2,
- // label: "按列",
- // },
- ],
- };
- },
- // watch: {
- // bednumber(newVal,oldVal){
- // console.log(newVal,oldVal);
- // },
- // deep:true,
- // immediate:true
- //
- // },
- // created(){
- // console.log('123123123123');
- // },
- methods: {
- async getCheck() {
- if (this.bednumber === "联通") {
- Promise.all([await this.getUnicom(), await this.getUnicomList()]).then(
- (res) => {
- this.handleCreate(this.a);
- }
- );
- } else {
- Promise.all([await this.getMove(), await this.getMoveList()]).then(
- (res) => {
- this.handleCreate(this.b);
- }
- );
- }
- },
- async getUnicom() {
- await this.$http({
- url: "/market/expensesUnicom/loadProv",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- }).then((res) => {
- // this.handleCreate(res.data.body)
- res.data.body[0].subScript = 0;
- this.a = res.data.body;
- });
- },
- async getUnicomList() {
- await this.$http({
- url: "/market/questionnaireUnicom/loadProv",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- }).then((res) => {
- res.data.body[0].subScript = 1;
- this.a.push(res.data.body[0]);
- });
- },
- async getMove() {
- await this.$http({
- url: "/market/expensesTelecom/loadProv",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- }).then((res) => {
- res.data.body[0].subScript = 2;
- this.b = res.data.body;
- });
- },
- async getMoveList() {
- await this.$http({
- url: "/market/questionnaireTelecom/loadProv",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- }).then((res) => {
- res.data.body[0].subScript = 3;
- this.b.push(res.data.body[0]);
- });
- },
- //获取用户是否为外呼调研员
- async getJurisdiction() {
- await this.$http({
- url: "/market/questionnaireUnicom/queryRole",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- }).then((res) => {
- if(res.data.body === '0'){ //是外呼管理员
- this.clickOut = true //显示导出
- this.clickSave = false //不显示保存
- }else{
- this.clickOut = false //显示导出
- this.clickSave = true //不显示保存
- }
-
- console.log(res.body);
- });
- },
- // handleChange(file, fileList) {
- // console.log(file);
- // this.fileList = fileList.slice(-3);
- // },
- clickok() {},
- deforeUp(file) {
- console.log(file);
- },
- handleInit() {
- if (this.id) {
- this.handleQuery();
- } else {
- this.handleCreate();
- }
- },
- // 填报日期
- handleWrite(value) {
- if (value) {
- let range =
- new Date().getTime() > value.getTime()
- ? new Date().getTime()
- : value.getTime();
- this.pickOptions = {
- disabledDate(time) {
- return time.getTime() < range;
- },
- };
- } else {
- this.pickOptions = {
- disabledDate(time) {
- return time.getTime() < new Date().getTime() - 864000;
- },
- };
- }
- },
- handleEnd(value) {
- if (value) {
- this.pickWrite = {
- disabledDate(time) {
- return time.getTime() > value.getTime();
- },
- };
- if (
- this.superviseForm.write &&
- value.getTime() < this.superviseForm.write.getTime()
- ) {
- this.superviseForm.endTime = "";
- }
- } else {
- this.pickWrite = {
- disabledDate(time) {
- return time.getTime() - 864000 < new Date().getTime();
- },
- };
- }
- },
- // // 权限选择
- // handleRadio(e){
- // console.log(e,'e');
- // },
- handleAllow({ row, column }) {
- let public_permisson =
- (!this.form.permission_type ||
- this.status === "2" ||
- this.status === "3") &&
- this.type === "edit";
- let editable =
- this.row_list.includes(row) && this.column_list.includes(column);
- // let totalBoolean = (public_permisson || editable) && this.id;
- let totalBoolean = public_permisson || editable;
- return totalBoolean;
- },
- async handleQuery() {
- let url = "";
- let params = {};
- switch (this.attribute) {
- case "template":
- url = "/market/CMKFileTemplate/QueryCMKFileTemplateById";
- params = {
- templateId: this.id,
- };
- break;
- case "order":
- url = "/market/CMKIssued/CMKQueryIssuedById";
- params = {
- id: this.id,
- };
- break;
- case "file":
- url = "/market/CMKIssued/CMKIssuedProcessByUser";
- params = {
- id: this.id,
- receiverId: this.receiver,
- };
- break;
- }
- const {
- data: {
- templateContent,
- templateName,
- issuedId,
- templateId,
- list,
- superviseFlag,
- templateType,
- addFlag,
- distributeEndTime,
- distributeTime,
- distributeType,
- },
- } = await this.$http({
- url,
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: params,
- });
- this.superviseFlag = superviseFlag;
- if (superviseFlag === "1") {
- this.superviseForm = {
- distribute: distributeType, // 派单周期
- write: distributeTime, // 填写周期
- endTime: distributeEndTime, // 截止时间
- };
- }
- this.templateType = templateType;
- this.template_id = templateId;
- this.issued_id = issuedId;
- this.addFlag = addFlag;
- console.log(JSON.parse(templateContent), "123123");
- if (list && list.length) {
- const { type } = list[0];
- if (type === "1") {
- // 公共权限
- // const { allowEditingColumns, rowNum } = list[0];
- this.form = {
- permission_type: Number(type) - 1,
- person: list.map((el) => {
- return `${el.principalMent}-${el.principalId},${el.principalName}`;
- }),
- charge: [
- {
- person: "",
- col_start: "",
- col_end: "",
- row_start: "",
- row_end: "",
- },
- ],
- };
- } else {
- // 特殊权限
- this.form = {
- permission_type: Number(type) - 1,
- col_start: "",
- col_end: "",
- row_start: "",
- row_end: "",
- charge: list.map((el) => ({
- person: `${el.principalMent}-${el.principalId},${el.principalName}`,
- col_start: el.allowEditingColumns.split(",")[0],
- col_end:
- el.allowEditingColumns.split(",")[
- el.allowEditingColumns.split(",").length - 1
- ],
- row_start: el.rowNum.split(",")[0],
- row_end: el.rowNum.split(",")[el.rowNum.split(",").length - 1],
- })),
- };
- }
- this.row_list =
- this.type === "edit" && list[0].rowNum
- ? list[0].rowNum
- .split(",")
- .map((element) => JSON.parse(element) - 1)
- : [];
- if (this.type === "edit" && list[0].allowEditingColumns) {
- // this.column_list = list[0].allowEditingColumns
- // .split(",")
- // .map((element) => JSON.parse(element) - 1);
- this.column_list =
- list[0].allowEditingColumnsFlag === "1"
- ? list[0].allowEditingColumnsShuzi
- .split(",")
- .map((element) => JSON.parse(element) - 1)
- : list[0].allowEditingColumns
- .split(",")
- .map((element) => JSON.parse(element) - 1);
- } else {
- this.column_list = [];
- }
- // this.formateNumber(list[0].allowEditingColumns);
- }
- this.handleCreate({
- json: templateContent ? JSON.parse(templateContent) : {},
- name: templateName,
- type: "json",
- });
- },
- handleSupervise(data) {
- if (data === "cancel") {
- this.supervise = false;
- this.superviseForm = {
- ...this.originSuperviseForm,
- };
- return;
- }
- if (this.supervise === false) {
- this.supervise = true;
- this.originSuperviseForm = {
- ...this.superviseForm,
- };
- } else {
- let filled =
- Object.keys(this.superviseForm).length === 3 &&
- Object.values(this.superviseForm).filter((el) => el !== "").length ===
- 3;
- if (filled) {
- let time = new Date().getTime();
- if (time > this.superviseForm.endTime.getTime()) {
- this.$message.error("截止时间不能小于当前时间");
- return;
- }
- this.superviseForm = {
- ...this.superviseForm,
- endTime: this.$formatDate(
- this.superviseForm.endTime,
- "YYYY-MM-DD HH:mm:ss"
- ), // 督办设置的截止时间
- write: this.$formatDate(this.superviseForm.write, "YYYY-MM-DD"), // 派发时间–或者叫—填报时间
- };
- this.supervise = false;
- } else {
- this.$message.error("请填写完整必要的信息");
- }
- }
- },
- handleForbid() {
- // const object = {};
- const { permission_type } = this.form;
- if (permission_type === 0) {
- // 公共权限 暂时不用可编辑行和列
- const { person } = this.form;
- if (person.length) {
- return false;
- }
- return true;
- } else if (permission_type === 1) {
- // 特殊权限
- let flag = 1;
- const { charge } = this.form;
- charge.forEach((el) => {
- if (
- Object.values(el).filter((v) => {
- return v !== "";
- }).length === 5
- ) {
- flag = flag * 1;
- } else {
- flag = flag * 0;
- }
- });
- return !flag;
- } else {
- return true;
- }
- },
- async handleCreate(data) {
- console.log(data);
- let that = this;
- const options = {
- container: "luckysheet",
- lang: "zh",
- total: "123",
- showsheetbar: true,
- hook: {
- // cellEditBefore: function () {
- // let time = new Date();
- // let hover = time.getHours();
- // let day = time.getDay();
- // if (day === 4 || day === 5 || day === 6 || day == 7 || day === 1) {
- // if ((day === 4 && hover <= 15) || (day === 1 && hover >= 15)) {
- // that.$message.error("不在可编辑时间");
- // return false;
- // }
- // } else {
- // that.$message.error("不在可编辑日期");
- // return false;
- // }
- // },
- },
- data: data,
- // hook: {
- // cellEditBefore: function ([
- // { row_focus: row, column_focus: column },
- // ]) {
- // if (!that.handleAllow({ row, column })) {
- // that.$message.error("您没有编辑权限");
- // }
- // },
- // // cellUpdated: function (row, column) {
- // // that.rowList.push(row);
- // // },
- // cellUpdateBefore: function (row, column) {
- // console.log(row, column);
- // if (!that.handleAllow({ row, column })) {
- // return false;
- // }
- // },
- // cellRenderAfter: function (cell, position) {
- // const { r: row, c: column } = position;
- // console.log();
- // if (cell) {
- // if (!that.handleAllow({ row, column })) {
- // cell.bg = "#d5d5d5";
- // } else {
- // cell.bg = "#ffffff";
- // }
- // }
- // },
- // rangePasteBefore: function ([
- // { row_focus: row, column_focus: column },
- // ]) {
- // if (!that.handleAllow({ row, column })) {
- // that.$message.error("您没有编辑权限");
- // return false;
- // }
- // },
- // updated: function ({ range }) {
- // const middle = range.map((el) => {
- // return that.paramsArr(el.row[0], el.row[1]);
- // });
- // let changedList = middle.join(",").split(",");
- // that.rowList.push(...changedList);
- // },
- // },
- };
- switch (data.type) {
- case "file":
- if (data.file) {
- await new Promise((resolve) => {
- luckyexcel.transformExcelToLucky(data.file, (export_json) => {
- options.data = [
- ...export_json.sheets.map((element) => ({
- ...element,
- zoomRatio: 0.75,
- })),
- ];
- options.title = export_json.info.name;
- resolve();
- });
- });
- }
- break;
- case "json":
- console.log(123);
- // if (json) {
- // options.data = [];
- // options.title = name;
- // }
- break;
- }
- window.luckysheet.create(options);
- let clock = setInterval(() => {
- if (window.luckysheet) {
- window.luckysheet.refresh();
- clearInterval(clock);
- }
- }, 1000);
- },
- async handleChange(response) {
- response.raw.total = "123";
- console.log(response);
- this.handleCreate({ file: response.raw, type: "file" });
- },
- //导出方法!!!!!
- async handleDownload() {
- Promise.all([
- await this.getMove(),
- await this.getMoveList(),
- await this.getUnicom(),
- await this.getUnicomList(),
- ]).then((res) => {
- let list = this.a.concat(this.b);
- exportExcel(list, "导出问卷");
- });
- },
- async handleAddAuth({ id }) {
- // const object = {};
- const { permission_type } = this.form;
- console.log(id, permission_type);
- let reqdata = {
- templateId: id,
- type: permission_type ? 2 : 1,
- };
- if (!permission_type) {
- // 公共权限
- const { person } = this.form;
- const principalId = [];
- const principalName = [];
- const principalMent = [];
- person.forEach((el) => {
- principalMent.push(el.split(",")[0].split("-")[0]);
- principalId.push(el.split(",")[0].split("-")[1]);
- principalName.push(el.split(",")[1]);
- });
- reqdata.principalId = principalId.join(",");
- reqdata.principalName = principalName.join(",");
- reqdata.principalMent = principalMent.join(",");
- } else {
- const { charge } = this.form;
- // 特殊权限
- reqdata.specialAuth = charge.map((el) =>
- JSON.stringify({
- allowEditingColumns: `${el.col_start},${el.col_end}`,
- rowNum: `${el.row_start},${el.row_end}`,
- principalMent: el.person.split(",")[0].split("-")[0],
- principalId: el.person.split(",")[0].split("-")[1],
- principalName: el.person.split(",")[1],
- })
- );
- }
- const {
- data: { result, desc },
- } = await this.$http({
- url: this.id
- ? "/market/CMKFileTemplateAuthority/CMKFileTemplateAuthorityUpdate"
- : "/market/CMKFileTemplateAuthority/CMKFileTemplateAuthorityAdd",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: reqdata,
- });
- if (result) {
- this.$message.error(desc);
- } else {
- this.$message.success(desc);
- }
- return result;
- },
- async handleSave(type) {
- let edit_url = "";
- switch (this.attribute) {
- case "template":
- edit_url = "";
- break;
- case "order":
- edit_url = "";
- break;
- case "file":
- edit_url = "/market/CMKIssued/CMKIssuedSubmit";
- break;
- }
- const sheet_name = window.luckysheet.getSheet().name;
- const data = window.luckysheet.getSheet(sheet_name);
- const workbook_name = window.luckysheet.getWorkbookName();
- if (!this.id) {
- // 新增时添加权限
- let value = {};
- if (!this.templateType) {
- this.$message.error("请输入模板类型");
- return;
- }
- if (
- Object.values(this.superviseForm).filter((el) => el !== "").length ===
- 3
- ) {
- value = {
- distributeEndTime: this.superviseForm.endTime, // 督办设置的截止时间
- distributeTime: this.superviseForm.write, // 派发时间–或者叫—填报时间
- distributeType: this.superviseForm.distribute, //派发周期类型 派发周期类型 0.月 1.季度 2.半年 3.年
- superviseFlag: 1, //督办标识 0.不是 1.是
- templateType: this.templateType, //模板类型
- templateContent: JSON.stringify(data), //文件内容
- templateName: workbook_name, //模板名称
- templateUrl: "", //文件链接
- status: type,
- };
- } else {
- value = {
- superviseFlag: 0, //督办标识 0.不是 1.是
- templateType: this.templateType, //模板类型
- templateContent: JSON.stringify(data), //文件内容
- templateName: workbook_name, //模板名称
- templateUrl: "", //文件链接
- status: type,
- };
- }
- const {
- data: { body },
- } = await this.$http({
- url: "/market/CMKFileTemplate/CMKFileTemplateAdd", // 新增
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: value,
- });
- await this.handleAddAuth({ id: body });
- this.$emit("save");
- } else {
- // 职位
- let duty = JSON.parse(sessionStorage.userInfo).duty;
- if (duty === "7" && type === "0") {
- this.manager_approve = true;
- } else {
- if (type === "2") {
- // 暂存
- let value = {};
- if (!this.templateType) {
- this.$message.error("请输入模板类型");
- return;
- }
- if (
- Object.values(this.superviseForm).filter((el) => el !== "")
- .length === 3
- ) {
- value = {
- templateId: this.id,
- distributeEndTime: this.superviseForm.endTime, // 督办设置的截止时间
- distributeTime: this.superviseForm.write, // 派发时间–或者叫—填报时间
- distributeType: this.superviseForm.distribute, //派发周期类型 派发周期类型 0.月 1.季度 2.半年 3.年
- superviseFlag: 1, //督办标识 0.不是 1.是
- templateType: this.templateType, //模板类型
- templateContent: JSON.stringify(data), //文件内容
- templateName: workbook_name, //模板名称
- templateUrl: "", //文件链接
- status: type,
- };
- } else {
- value = {
- templateId: this.id,
- superviseFlag: 0, //督办标识 0.不是 1.是
- templateType: this.templateType, //模板类型
- templateContent: JSON.stringify(data), //文件内容
- templateName: workbook_name, //模板名称
- templateUrl: "", //文件链接
- status: type,
- };
- }
- await this.$http({
- url: "/market/CMKFileTemplate/UptateCMKFileTemplateById", //
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: value,
- });
- this.$emit("save");
- return;
- }
- // 员工提交
- this.rowList.shift();
- let reqdata = {
- rowIndex: [...new Set(this.rowList)]
- .sort(function (a, b) {
- return a - b;
- })
- .join(","),
- rowContent: [...new Set(this.rowList)]
- .sort(function (a, b) {
- return a - b;
- })
- .map((el) => {
- return data.data[el];
- }),
- };
- await this.$http({
- url: edit_url, //提交
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {
- id: this.template_id,
- templateContent: JSON.stringify(data),
- templateName: workbook_name,
- issuedId: this.issued_id,
- rowJson: JSON.stringify(reqdata),
- },
- });
- this.$emit("save");
- }
- }
- },
- // 判断数组是否有值
- confirmArrayData(data) {
- if (data instanceof Array) {
- let flag = 0;
- if (data.length) {
- data.forEach((el) => {
- if (el instanceof Object) {
- flag = flag + 1;
- }
- });
- if (flag) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- } else {
- return false;
- }
- },
- async handleAuth() {
- this.$refs["form"].validate((valid) => {
- if (valid) {
- if (this.handleForbid()) {
- this.$message.error("请完善可编辑信息");
- return false;
- }
- if (this.id) {
- this.handleAddAuth({ id: this.id });
- }
- this.handleVisible();
- }
- });
- },
- // 通用方法用于转化全局
- paramsArr(start, end) {
- const arr = [];
- console.log(start, end);
- for (let i = Number(start); i <= Number(end); i++) {
- arr.push(i);
- }
- return arr.join(",");
- },
- filterName(id, arr) {
- return arr.filter((el) => el.secLeaderLogin === id)[0].secLeaderName;
- },
- handleCharge(type) {
- switch (type) {
- case "add":
- this.form.charge.push({
- person: "",
- });
- this.handleForbid();
- break;
- case "delete":
- this.form.charge.pop();
- this.handleForbid();
- break;
- }
- },
- handleVisible() {
- this.visible = !this.visible;
- },
- handleInput(index, name, value) {
- let reg = /^[0-9]*$/;
- if (!reg.test(value)) {
- this.form.charge[index][name] = this.form.charge[index][name].substr(
- 0,
- this.form.charge[index][name].length - 1
- );
- this.$message.error("该处只能填写数字");
- }
- },
- async handleApprove(type) {
- if (type) {
- if (this.approveForm.type) {
- if (this.approveForm.type === "3" && !this.approveForm.comments) {
- this.$message.error("请输入其他审批意见");
- return;
- }
- } else {
- this.$message.error("请选择审批意见");
- return;
- }
- const sheet_name = window.luckysheet.getSheet().name;
- const data = window.luckysheet.getSheet(sheet_name);
- const workbook_name = window.luckysheet.getWorkbookName();
- // 经理提交
- this.rowList.shift();
- let reqdata = {
- rowIndex: [...new Set(this.rowList)]
- .sort(function (a, b) {
- return a - b;
- })
- .join(","),
- rowContent: [...new Set(this.rowList)]
- .sort(function (a, b) {
- return a - b;
- })
- .map((el) => {
- return data.data[el];
- }),
- };
- await this.$http({
- url: "/market/CMKIssued/CMKIssuedSubmit", // 提交
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {
- id: this.template_id,
- templateContent: JSON.stringify(data),
- templateName: workbook_name,
- issuedId: this.issued_id,
- rowJson: JSON.stringify(reqdata),
- },
- });
- let params = {
- id: this.issued_id,
- reviewOpinion:
- this.approveForm.type === "3"
- ? this.approveForm.comments
- : this.approveForm.type,
- };
- switch (type) {
- case "1":
- params = {
- ...params,
- operateName: "结束",
- status: 3,
- };
- break;
- case "4":
- params = {
- ...params,
- operateName: "转副总审批",
- reviewType: 2,
- };
- break;
- case "3":
- params = {
- ...params,
- operateName: "转总经理审批",
- reviewType: 3,
- };
- break;
- }
- await this.$http({
- url: "/market/CMKIssued/CMKIssuedCheck", // 审批
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: params,
- });
- this.$message({
- type: "success",
- message: "审批成功",
- });
- this.manager_approve = false;
- this.$emit("save");
- } else {
- this.manager_approve = false;
- }
- },
- handleFullscreen() {
- const element = document.body;
- const is_fullscreen =
- document.fullScreen ||
- document.mozFullScreen ||
- document.webkitIsFullScreen;
- if (!is_fullscreen) {
- //进入全屏,多重短路表达式
- (element.requestFullscreen && element.requestFullscreen()) ||
- (element.mozRequestFullScreen && element.mozRequestFullScreen()) ||
- (element.webkitRequestFullscreen &&
- element.webkitRequestFullscreen()) ||
- (element.msRequestFullscreen && element.msRequestFullscreen());
- } else {
- //退出全屏,三目运算符
- document.exitFullscreen
- ? document.exitFullscreen()
- : document.mozCancelFullScreen
- ? document.mozCancelFullScreen()
- : document.webkitExitFullscreen
- ? document.webkitExitFullscreen()
- : "";
- }
- },
- handleResave() {
- const sheet_name = window.luckysheet.getSheet().name;
- let baseUrl = "";
- const datas = window.luckysheet.getSheet(sheet_name);
- // switch (datas.subScript) {
- // case 0:
- // baseUrl = "expensesUnicom";
- // break;
- // case 1:
- // baseUrl = "questionnaireUnicom";
- // break;
- // case 2:
- // baseUrl = "expensesTelecom";
- // datas.index = 2;
- // break;
- // case 3:
- // baseUrl = "questionnaireTelecom";
- // }
- switch (datas.name) {
- case '联通资费内容':
- baseUrl = "expensesUnicom";
- break;
- case '联通问卷内容':
- baseUrl = "questionnaireUnicom";
- break;
- case '电信资费内容':
- baseUrl = "expensesTelecom";
-
- break;
- case '电信问卷内容':
- baseUrl = "questionnaireTelecom";
- }
- const workbook_name = window.luckysheet.getWorkbookName();
- let value = {};
- if (
- Object.values(this.superviseForm).filter((el) => el !== "").length === 3
- ) {
- value = {
- templateId: this.id,
- distributeEndTime: this.superviseForm.endTime, // 督办设置的截止时间
- distributeTime: this.superviseForm.write, // 派发时间–或者叫—填报时间
- distributeType: this.superviseForm.distribute, //派发周期类型 派发周期类型 0.月 1.季度 2.半年 3.年
- superviseFlag: 1, //督办标识 0.不是 1.是
- templateType: this.templateType, //模板类型
- mKcompetitor: JSON.parse(datas), //文件内容
- templateName: workbook_name, //模板名称
- templateUrl: "", //文件链接
- status: "0",
- };
- } else {
- let data = datas;
- // data.id = this.id;
- // data.fileName = window.luckysheet.getWorkbookName();
- // data.powerFlag = 1;
- // data.powerFlagDev = "关";
- // data.tempType = this.templateType;
- // data.colHeaderNum = 1;
- // data.tempTypeDesc = "";
- value = {
- // templateId: this.id,
- // superviseFlag: 0, //督办标识 0.不是 1.是
- // templateType: this.templateType, //模板类型
- data: data, //文件内容
- // templateName: workbook_name, //模板名称
- // templateUrl: "", //文件链接
- // status: "0",
- };
- }
- this.$http({
- // 联通资费内容
- // url: "/market/expensesUnicom/save",
- //联通问卷
- // url: "/market/questionnaireUnicom/save",
- //电信费用
- // url: "/market/expensesTelecom/save",
- //电信问卷
- // url: "/market/questionnaireTelecom/save",
- url: "/market/" + baseUrl + "/save",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: value,
- }).then(() => {
- this.$message({
- type: "success",
- message: "保存成功",
- });
- this.getCheck();
- });
- },
- handleChargeList() {
- this.$http({
- url: "/market/techcentergj/queryLeaderList",
- method: "post",
- headers: {
- "Content-Type": "application/json",
- },
- data: {},
- }).then((response) => {
- this.charge_list = response.data.map((element) => ({
- label: `${element.ou} ${element.secLeaderName}`,
- value: `${element.ou}-${element.secLeaderLogin},${element.secLeaderName}`,
- }));
- });
- },
- },
- mounted() {
- this.getJurisdiction();
- this.handleInit();
- // this.handleChargeList();
- },
- destroyed() {
- window.luckysheet.destroy();
- },
- };
- </script>
- <style lang="scss" scope>
- .el-dialog {
- width: 100%;
- height: 100%;
- margin-top: 0 !important;
- }
- .sheet-container {
- position: fixed;
- width: calc(100% - 40px);
- height: 100%;
- &-block {
- overflow: hidden;
- position: absolute;
- width: 100%;
- height: 75%;
- }
- &-require {
- color: red;
- }
- .el-input {
- width: 200px;
- margin-right: 10px;
- }
- }
- .form {
- &-input {
- margin-top: 5px;
- .el-input {
- width: 150px;
- .el-input__inner {
- height: 30px !important;
- line-height: 30px !important;
- }
- }
- }
- &-content {
- margin: 0px 10px;
- }
- &-select {
- .el-input {
- width: 100px;
- .el-input__inner {
- height: 30px !important;
- line-height: 30px !important;
- }
- }
- }
- }
- </style>
|